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