A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
epc-gtpu-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Jaume Nin <jnin@cttc.cat>
7
*/
8
9
#ifndef EPS_GTPU_V1_H
10
#define EPS_GTPU_V1_H
11
12
#include <ns3/header.h>
13
#include <ns3/ipv4-header.h>
14
#include <ns3/ptr.h>
15
16
namespace
ns3
17
{
18
19
class
Packet;
20
21
/**
22
* \ingroup lte
23
*
24
* Implementation of the GPRS Tunnelling Protocol header according to
25
* GTPv1-U Release 10 as per 3Gpp TS 29.281 document
26
*
27
*/
28
class
GtpuHeader
:
public
Header
29
{
30
public
:
31
/**
32
* \brief Get the type ID.
33
* \return the object TypeId
34
*/
35
static
TypeId
GetTypeId
();
36
GtpuHeader
();
37
~GtpuHeader
()
override
;
38
TypeId
GetInstanceTypeId
()
const override
;
39
uint32_t
GetSerializedSize
()
const override
;
40
void
Serialize
(
Buffer::Iterator
start)
const override
;
41
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
42
void
Print
(std::ostream& os)
const override
;
43
44
/**
45
* Get extension header flag function
46
* \returns the extension header flag
47
*/
48
bool
GetExtensionHeaderFlag
()
const
;
49
/**
50
* Get length function
51
* \returns the length
52
*/
53
uint16_t
GetLength
()
const
;
54
/**
55
* Get message type function
56
* \returns the message type
57
*/
58
uint8_t
GetMessageType
()
const
;
59
/**
60
* Get NPDU number function
61
* \returns the NPDU number
62
*/
63
uint8_t
GetNPduNumber
()
const
;
64
/**
65
* Get type of GTP-U message function
66
* \returns the NPDU number flag
67
*/
68
bool
GetNPduNumberFlag
()
const
;
69
/**
70
* Get next extension type function
71
* \returns the next extension type
72
*/
73
uint8_t
GetNextExtensionType
()
const
;
74
/**
75
* Get protocol type function
76
* \returns the protocol type
77
*/
78
bool
GetProtocolType
()
const
;
79
/**
80
* Get protocol type function
81
* \returns the sequence number
82
*/
83
uint16_t
GetSequenceNumber
()
const
;
84
/**
85
* Get sequence number flag function
86
* \returns the sequence number flag
87
*/
88
bool
GetSequenceNumberFlag
()
const
;
89
/**
90
* Get a tunnel endpoint identificator (TEID)
91
* \returns the TEID
92
*/
93
uint32_t
GetTeid
()
const
;
94
/**
95
* Get version function
96
* \returns the version
97
*/
98
uint8_t
GetVersion
()
const
;
99
/**
100
* Set extension header flag function
101
* \param extensionHeaderFlag
102
*/
103
void
SetExtensionHeaderFlag
(
bool
extensionHeaderFlag);
104
/**
105
* Set the length in octets of the payload
106
* \param length the length
107
*/
108
void
SetLength
(uint16_t length);
109
/**
110
* Set message type function
111
* \param messageType the message type
112
*/
113
void
SetMessageType
(uint8_t messageType);
114
/**
115
* Set NPDU number function
116
* \param nPduNumber the NPDU number
117
*/
118
void
SetNPduNumber
(uint8_t nPduNumber);
119
/**
120
* Sets the flag that indicates the presence of a meaningful value of the N-PDU Number field.
121
* \param nPduNumberFlag the NPDU number flag
122
*/
123
void
SetNPduNumberFlag
(
bool
nPduNumberFlag);
124
/**
125
* Set next extension type function
126
* \param nextExtensionType the next extension type
127
*/
128
void
SetNextExtensionType
(uint8_t nextExtensionType);
129
/**
130
* Set protocol type function
131
* \param protocolType the protocol type
132
*/
133
void
SetProtocolType
(
bool
protocolType);
134
/**
135
* Set sequence number function
136
* \param sequenceNumber the sequence number
137
*/
138
void
SetSequenceNumber
(uint16_t sequenceNumber);
139
/**
140
* Set sequence number flag function
141
* \param sequenceNumberFlag the sequence number flag
142
*/
143
void
SetSequenceNumberFlag
(
bool
sequenceNumberFlag);
144
/**
145
* Set TEID function
146
* \param teid the TEID
147
*/
148
void
SetTeid
(
uint32_t
teid);
149
/**
150
* Set version function
151
* \param version the version
152
*/
153
void
SetVersion
(uint8_t version);
154
155
/**
156
* Equality operator.
157
*
158
* \param b GtpuHeader object to compare
159
* \returns true of equal
160
*/
161
bool
operator==
(
const
GtpuHeader
& b)
const
;
162
163
private
:
164
/**
165
* This field is used to determine the version of the GTPU-U protocol. The version number shall
166
* be set to 1.
167
*/
168
uint8_t
m_version
;
// really a 3 uint3_t
169
170
/**
171
* This bit is used as a protocol discriminator between GTP (when PT is '1') and GTP' (when
172
* PT is '0').
173
*/
174
bool
m_protocolType
;
175
176
/**
177
* This flag indicates the presence of a meaningful value of the Next Extension Header
178
* field. When it is set to '0', the Next Extension Header field either is not present
179
* or, if present, shall not be interpreted. When it is set to '1', the Next Extension
180
* Header field is present, and shall be interpreted
181
*/
182
bool
m_extensionHeaderFlag
;
183
184
/**
185
* This flag indicates the presence of a meaningful value of the Sequence Number field.
186
* When it is set to '0', the Sequence Number field either is not present or, if present,
187
* shall not be interpreted. When it is set to '1', the Sequence Number field is present,
188
* and shall be interpreted
189
*/
190
bool
m_sequenceNumberFlag
;
191
/**
192
* This flag indicates the presence of a meaningful value of the N-PDU Number field.
193
* When it is set to '0', the N-PDU Number field either is not present, or, if present,
194
* shall not be interpreted. When it is set to '1', the N-PDU Number field is present,
195
* and shall be interpreted
196
*/
197
bool
m_nPduNumberFlag
;
198
/**
199
* This field indicates the type of GTP-U message
200
*/
201
uint8_t
m_messageType
;
202
/**
203
* This field indicates the length in octets of the payload, i.e. the rest of the packet
204
* following the mandatory part of the GTP header (that is the first 8 octets).
205
* The Sequence Number, the N-PDU Number or any Extension headers shall be considered
206
* to be part of the payload, i.e. included in the length count
207
*/
208
uint16_t
m_length
;
209
210
/**
211
* This field unambiguously identifies a tunnel endpoint in the receiving GTP-U
212
* protocol entity. The receiving end side of a GTP tunnel locally assigns the
213
* TEID value the transmitting side has to use.
214
*/
215
uint32_t
m_teid
;
216
/**
217
* If Sequence Number field is used for G-PDUs (T-PDUs+headers), an increasing
218
* sequence number for T-PDUs is transmitted via GTP-U tunnels, when transmission
219
* order must be preserved
220
*/
221
uint16_t
m_sequenceNumber
;
222
/**
223
* This field is used at the Inter SGSN Routeing Area Update procedure and some
224
* inter-system handover procedures (e.g. between 2G and 3G radio access networks).
225
* This field is used to co-ordinate the data transmission for acknowledged mode
226
* of communication between the MS and the SGSN
227
*/
228
uint8_t
m_nPduNumber
;
229
/**
230
* This field defines the type of Extension Header that follows this field in
231
* the GTP-PDU
232
*/
233
uint8_t
m_nextExtensionType
;
234
};
235
236
}
// namespace ns3
237
238
#endif
/* EPS_GTPU_V1_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::GtpuHeader
Implementation of the GPRS Tunnelling Protocol header according to GTPv1-U Release 10 as per 3Gpp TS ...
Definition
epc-gtpu-header.h:29
ns3::GtpuHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t sequenceNumber)
Set sequence number function.
Definition
epc-gtpu-header.cc:235
ns3::GtpuHeader::m_nextExtensionType
uint8_t m_nextExtensionType
This field defines the type of Extension Header that follows this field in the GTP-PDU.
Definition
epc-gtpu-header.h:233
ns3::GtpuHeader::SetExtensionHeaderFlag
void SetExtensionHeaderFlag(bool extensionHeaderFlag)
Set extension header flag function.
Definition
epc-gtpu-header.cc:193
ns3::GtpuHeader::m_teid
uint32_t m_teid
This field unambiguously identifies a tunnel endpoint in the receiving GTP-U protocol entity.
Definition
epc-gtpu-header.h:215
ns3::GtpuHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
epc-gtpu-header.cc:82
ns3::GtpuHeader::m_nPduNumberFlag
bool m_nPduNumberFlag
This flag indicates the presence of a meaningful value of the N-PDU Number field.
Definition
epc-gtpu-header.h:197
ns3::GtpuHeader::operator==
bool operator==(const GtpuHeader &b) const
Equality operator.
Definition
epc-gtpu-header.cc:260
ns3::GtpuHeader::m_extensionHeaderFlag
bool m_extensionHeaderFlag
This flag indicates the presence of a meaningful value of the Next Extension Header field.
Definition
epc-gtpu-header.h:182
ns3::GtpuHeader::SetTeid
void SetTeid(uint32_t teid)
Set TEID function.
Definition
epc-gtpu-header.cc:247
ns3::GtpuHeader::~GtpuHeader
~GtpuHeader() override
Definition
epc-gtpu-header.cc:50
ns3::GtpuHeader::GetExtensionHeaderFlag
bool GetExtensionHeaderFlag() const
Get extension header flag function.
Definition
epc-gtpu-header.cc:127
ns3::GtpuHeader::SetVersion
void SetVersion(uint8_t version)
Set version function.
Definition
epc-gtpu-header.cc:253
ns3::GtpuHeader::m_protocolType
bool m_protocolType
This bit is used as a protocol discriminator between GTP (when PT is '1') and GTP' (when PT is '0').
Definition
epc-gtpu-header.h:174
ns3::GtpuHeader::m_messageType
uint8_t m_messageType
This field indicates the type of GTP-U message.
Definition
epc-gtpu-header.h:201
ns3::GtpuHeader::GetVersion
uint8_t GetVersion() const
Get version function.
Definition
epc-gtpu-header.cc:187
ns3::GtpuHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
epc-gtpu-header.cc:61
ns3::GtpuHeader::GtpuHeader
GtpuHeader()
Definition
epc-gtpu-header.cc:35
ns3::GtpuHeader::GetSequenceNumberFlag
bool GetSequenceNumberFlag() const
Get sequence number flag function.
Definition
epc-gtpu-header.cc:175
ns3::GtpuHeader::GetNPduNumberFlag
bool GetNPduNumberFlag() const
Get type of GTP-U message function.
Definition
epc-gtpu-header.cc:151
ns3::GtpuHeader::SetNPduNumber
void SetNPduNumber(uint8_t nPduNumber)
Set NPDU number function.
Definition
epc-gtpu-header.cc:211
ns3::GtpuHeader::m_nPduNumber
uint8_t m_nPduNumber
This field is used at the Inter SGSN Routeing Area Update procedure and some inter-system handover pr...
Definition
epc-gtpu-header.h:228
ns3::GtpuHeader::SetNPduNumberFlag
void SetNPduNumberFlag(bool nPduNumberFlag)
Sets the flag that indicates the presence of a meaningful value of the N-PDU Number field.
Definition
epc-gtpu-header.cc:217
ns3::GtpuHeader::m_sequenceNumber
uint16_t m_sequenceNumber
If Sequence Number field is used for G-PDUs (T-PDUs+headers), an increasing sequence number for T-PDU...
Definition
epc-gtpu-header.h:221
ns3::GtpuHeader::GetNPduNumber
uint8_t GetNPduNumber() const
Get NPDU number function.
Definition
epc-gtpu-header.cc:145
ns3::GtpuHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
epc-gtpu-header.cc:55
ns3::GtpuHeader::GetLength
uint16_t GetLength() const
Get length function.
Definition
epc-gtpu-header.cc:133
ns3::GtpuHeader::Print
void Print(std::ostream &os) const override
Definition
epc-gtpu-header.cc:101
ns3::GtpuHeader::SetMessageType
void SetMessageType(uint8_t messageType)
Set message type function.
Definition
epc-gtpu-header.cc:205
ns3::GtpuHeader::m_version
uint8_t m_version
This field is used to determine the version of the GTPU-U protocol.
Definition
epc-gtpu-header.h:168
ns3::GtpuHeader::m_length
uint16_t m_length
This field indicates the length in octets of the payload, i.e.
Definition
epc-gtpu-header.h:208
ns3::GtpuHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
epc-gtpu-header.cc:26
ns3::GtpuHeader::SetSequenceNumberFlag
void SetSequenceNumberFlag(bool sequenceNumberFlag)
Set sequence number flag function.
Definition
epc-gtpu-header.cc:241
ns3::GtpuHeader::GetSequenceNumber
uint16_t GetSequenceNumber() const
Get protocol type function.
Definition
epc-gtpu-header.cc:169
ns3::GtpuHeader::GetTeid
uint32_t GetTeid() const
Get a tunnel endpoint identificator (TEID)
Definition
epc-gtpu-header.cc:181
ns3::GtpuHeader::GetProtocolType
bool GetProtocolType() const
Get protocol type function.
Definition
epc-gtpu-header.cc:163
ns3::GtpuHeader::SetProtocolType
void SetProtocolType(bool protocolType)
Set protocol type function.
Definition
epc-gtpu-header.cc:229
ns3::GtpuHeader::GetMessageType
uint8_t GetMessageType() const
Get message type function.
Definition
epc-gtpu-header.cc:139
ns3::GtpuHeader::GetNextExtensionType
uint8_t GetNextExtensionType() const
Get next extension type function.
Definition
epc-gtpu-header.cc:157
ns3::GtpuHeader::m_sequenceNumberFlag
bool m_sequenceNumberFlag
This flag indicates the presence of a meaningful value of the Sequence Number field.
Definition
epc-gtpu-header.h:190
ns3::GtpuHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
epc-gtpu-header.cc:67
ns3::GtpuHeader::SetNextExtensionType
void SetNextExtensionType(uint8_t nextExtensionType)
Set next extension type function.
Definition
epc-gtpu-header.cc:223
ns3::GtpuHeader::SetLength
void SetLength(uint16_t length)
Set the length in octets of the payload.
Definition
epc-gtpu-header.cc:199
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
lte
model
epc-gtpu-header.h
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0