A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
Enumerator
a
b
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
c
e
i
l
o
r
s
t
v
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
udp-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2005 INRIA
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
20
#ifndef UDP_HEADER_H
21
#define UDP_HEADER_H
22
23
#include "ns3/header.h"
24
#include "ns3/ipv4-address.h"
25
#include "ns3/ipv6-address.h"
26
27
#include <stdint.h>
28
#include <string>
29
30
namespace
ns3
31
{
40
class
UdpHeader
:
public
Header
41
{
42
public
:
46
void
EnableChecksums
();
50
void
SetDestinationPort
(uint16_t
port
);
54
void
SetSourcePort
(uint16_t
port
);
58
uint16_t
GetSourcePort
()
const
;
62
uint16_t
GetDestinationPort
()
const
;
63
75
void
InitializeChecksum
(
Address
source,
Address
destination, uint8_t protocol);
76
88
void
InitializeChecksum
(
Ipv4Address
source,
Ipv4Address
destination, uint8_t protocol);
89
101
void
InitializeChecksum
(
Ipv6Address
source,
Ipv6Address
destination, uint8_t protocol);
102
107
static
TypeId
GetTypeId
();
108
TypeId
GetInstanceTypeId
()
const override
;
109
void
Print
(std::ostream& os)
const override
;
110
uint32_t
GetSerializedSize
()
const override
;
111
void
Serialize
(
Buffer::Iterator
start
)
const override
;
112
uint32_t
Deserialize
(
Buffer::Iterator
start
)
override
;
113
118
bool
IsChecksumOk
()
const
;
119
137
void
ForceChecksum
(uint16_t checksum);
138
147
void
ForcePayloadSize
(uint16_t payloadSize);
148
153
uint16_t
GetChecksum
()
const
;
154
155
private
:
161
uint16_t
CalculateHeaderChecksum
(uint16_t size)
const
;
162
163
// The magic values below are used only for debugging.
164
// They can be used to easily detect memory corruption
165
// problems so you can see the patterns in memory.
166
uint16_t
m_sourcePort
{0xfffd};
167
uint16_t
m_destinationPort
{0xfffd};
168
uint16_t
m_payloadSize
{0};
169
uint16_t
m_forcedPayloadSize
{0};
170
171
Address
m_source
;
172
Address
m_destination
;
173
uint8_t
m_protocol
{17};
174
uint16_t
m_checksum
{0};
175
bool
m_calcChecksum
{
false
};
176
bool
m_goodChecksum
{
true
};
177
};
178
179
}
// namespace ns3
180
181
#endif
/* UDP_HEADER */
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:42
ns3::Ipv6Address
Describes an IPv6 address.
Definition:
ipv6-address.h:49
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::UdpHeader
Packet header for UDP packets.
Definition:
udp-header.h:41
ns3::UdpHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
udp-header.cc:159
ns3::UdpHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition:
udp-header.cc:165
ns3::UdpHeader::m_destination
Address m_destination
Destination IP address.
Definition:
udp-header.h:172
ns3::UdpHeader::CalculateHeaderChecksum
uint16_t CalculateHeaderChecksum(uint16_t size) const
Calculate the header checksum.
Definition:
udp-header.cc:84
ns3::UdpHeader::EnableChecksums
void EnableChecksums()
Enable checksum calculation for UDP.
Definition:
udp-header.cc:30
ns3::UdpHeader::m_protocol
uint8_t m_protocol
Protocol number.
Definition:
udp-header.h:173
ns3::UdpHeader::m_destinationPort
uint16_t m_destinationPort
Destination port.
Definition:
udp-header.h:167
ns3::UdpHeader::GetDestinationPort
uint16_t GetDestinationPort() const
Definition:
udp-header.cc:54
ns3::UdpHeader::m_source
Address m_source
Source IP address.
Definition:
udp-header.h:171
ns3::UdpHeader::m_payloadSize
uint16_t m_payloadSize
Payload size.
Definition:
udp-header.h:168
ns3::UdpHeader::ForceChecksum
void ForceChecksum(uint16_t checksum)
Force the UDP checksum to a given value.
Definition:
udp-header.cc:124
ns3::UdpHeader::m_sourcePort
uint16_t m_sourcePort
Source port.
Definition:
udp-header.h:166
ns3::UdpHeader::GetSourcePort
uint16_t GetSourcePort() const
Definition:
udp-header.cc:48
ns3::UdpHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
udp-header.cc:146
ns3::UdpHeader::m_calcChecksum
bool m_calcChecksum
Flag to calculate checksum.
Definition:
udp-header.h:175
ns3::UdpHeader::Print
void Print(std::ostream &os) const override
Definition:
udp-header.cc:152
ns3::UdpHeader::ForcePayloadSize
void ForcePayloadSize(uint16_t payloadSize)
Force the UDP payload length to a given value.
Definition:
udp-header.cc:130
ns3::UdpHeader::IsChecksumOk
bool IsChecksumOk() const
Is the UDP checksum correct ?
Definition:
udp-header.cc:118
ns3::UdpHeader::m_forcedPayloadSize
uint16_t m_forcedPayloadSize
Payload size (forced)
Definition:
udp-header.h:169
ns3::UdpHeader::GetChecksum
uint16_t GetChecksum() const
Return the checksum (only known after a Deserialize)
Definition:
udp-header.cc:223
ns3::UdpHeader::m_checksum
uint16_t m_checksum
Forced Checksum value.
Definition:
udp-header.h:174
ns3::UdpHeader::InitializeChecksum
void InitializeChecksum(Address source, Address destination, uint8_t protocol)
Definition:
udp-header.cc:60
ns3::UdpHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
udp-header.cc:136
ns3::UdpHeader::SetSourcePort
void SetSourcePort(uint16_t port)
Definition:
udp-header.cc:42
ns3::UdpHeader::m_goodChecksum
bool m_goodChecksum
Flag to indicate that checksum is correct.
Definition:
udp-header.h:176
ns3::UdpHeader::SetDestinationPort
void SetDestinationPort(uint16_t port)
Definition:
udp-header.cc:36
port
uint16_t port
Definition:
dsdv-manet.cc:44
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
two-ray-to-three-gpp-ch-calibration.start
start
Definition:
two-ray-to-three-gpp-ch-calibration.py:520
src
internet
model
udp-header.h
Generated on Sun Mar 3 2024 17:10:59 for ns-3 by
1.9.1