A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
udp-header.h
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef UDP_HEADER_H
22
#define UDP_HEADER_H
23
24
#include <stdint.h>
25
#include <string>
26
#include "ns3/header.h"
27
#include "ns3/ipv4-address.h"
28
#include "ns3/ipv6-address.h"
29
30
namespace
ns3 {
39
class
UdpHeader
:
public
Header
40
{
41
public
:
42
48
UdpHeader
();
49
~
UdpHeader
();
50
54
void
EnableChecksums
(
void
);
58
void
SetDestinationPort
(uint16_t port);
62
void
SetSourcePort
(uint16_t port);
66
uint16_t
GetSourcePort
(
void
)
const
;
70
uint16_t
GetDestinationPort
(
void
)
const
;
71
83
void
InitializeChecksum
(
Address
source,
84
Address
destination,
85
uint8_t protocol);
86
98
void
InitializeChecksum
(
Ipv4Address
source,
99
Ipv4Address
destination,
100
uint8_t protocol);
101
113
void
InitializeChecksum
(
Ipv6Address
source,
114
Ipv6Address
destination,
115
uint8_t protocol);
116
117
static
TypeId
GetTypeId (
void
);
118
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
119
virtual
void
Print
(std::ostream &os)
const
;
120
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
121
virtual
void
Serialize
(
Buffer::Iterator
start)
const
;
122
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start);
123
128
bool
IsChecksumOk
(
void
)
const
;
129
130
private
:
131
uint16_t CalculateHeaderChecksum (uint16_t size)
const
;
132
uint16_t m_sourcePort;
133
uint16_t m_destinationPort;
134
uint16_t m_payloadSize;
135
136
Address
m_source;
137
Address
m_destination;
138
uint8_t m_protocol;
139
bool
m_calcChecksum;
140
bool
m_goodChecksum;
141
};
142
143
}
// namespace ns3
144
145
#endif
/* UDP_HEADER */
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:42
ns3::UdpHeader::InitializeChecksum
void InitializeChecksum(Address source, Address destination, uint8_t protocol)
Definition:
udp-header.cc:74
ns3::UdpHeader::SetDestinationPort
void SetDestinationPort(uint16_t port)
Definition:
udp-header.cc:54
ns3::UdpHeader::Print
virtual void Print(std::ostream &os) const
Definition:
udp-header.cc:156
ns3::UdpHeader::SetSourcePort
void SetSourcePort(uint16_t port)
Definition:
udp-header.cc:59
ns3::UdpHeader::IsChecksumOk
bool IsChecksumOk(void) const
Is the UDP checksum correct ?
Definition:
udp-header.cc:135
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::Address
a polymophic address class
Definition:
address.h:86
ns3::UdpHeader::EnableChecksums
void EnableChecksums(void)
Enable checksum calculation for UDP.
Definition:
udp-header.cc:48
ns3::UdpHeader::UdpHeader
UdpHeader()
Constructor.
Definition:
udp-header.cc:32
ns3::UdpHeader::GetSourcePort
uint16_t GetSourcePort(void) const
Definition:
udp-header.cc:64
ns3::UdpHeader
Packet header for UDP packets.
Definition:
udp-header.h:39
ns3::UdpHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition:
udp-header.cc:171
ns3::Ipv6Address
Describes an IPv6 address.
Definition:
ipv6-address.h:44
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:38
ns3::UdpHeader::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition:
udp-header.cc:192
ns3::UdpHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition:
udp-header.cc:151
ns3::UdpHeader::GetDestinationPort
uint16_t GetDestinationPort(void) const
Definition:
udp-header.cc:69
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:44
ns3::UdpHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
udp-header.cc:165
src
internet
model
udp-header.h
Generated on Sun Mar 16 2014 11:25:05 for ns-3 by
1.8.6