A Discrete-Event Network Simulator
API
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 
39 class GtpuHeader : public Header
40 {
41  public:
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 
59  bool GetExtensionHeaderFlag() const;
64  uint16_t GetLength() const;
69  uint8_t GetMessageType() const;
74  uint8_t GetNPduNumber() const;
79  bool GetNPduNumberFlag() const;
84  uint8_t GetNextExtensionType() const;
89  bool GetProtocolType() const;
94  uint16_t GetSequenceNumber() const;
99  bool GetSequenceNumberFlag() const;
104  uint32_t GetTeid() const;
109  uint8_t GetVersion() const;
114  void SetExtensionHeaderFlag(bool extensionHeaderFlag);
119  void SetLength(uint16_t length);
124  void SetMessageType(uint8_t messageType);
129  void SetNPduNumber(uint8_t nPduNumber);
134  void SetNPduNumberFlag(bool nPduNumberFlag);
139  void SetNextExtensionType(uint8_t nextExtensionType);
144  void SetProtocolType(bool protocolType);
149  void SetSequenceNumber(uint16_t sequenceNumber);
154  void SetSequenceNumberFlag(bool sequenceNumberFlag);
159  void SetTeid(uint32_t teid);
164  void SetVersion(uint8_t version);
165 
172  bool operator==(const GtpuHeader& b) const;
173 
174  private:
179  uint8_t m_version; // really a 3 uint3_t
180 
186 
194 
212  uint8_t m_messageType;
219  uint16_t m_length;
220 
226  uint32_t m_teid;
239  uint8_t m_nPduNumber;
245 };
246 
247 } // namespace ns3
248 
249 #endif /* EPS_GTPU_V1_H */
iterator in a Buffer instance
Definition: buffer.h:100
Implementation of the GPRS Tunnelling Protocol header according to GTPv1-U Release 10 as per 3Gpp TS ...
void SetSequenceNumber(uint16_t sequenceNumber)
Set sequence number function.
uint8_t m_nextExtensionType
This field defines the type of Extension Header that follows this field in the GTP-PDU.
void SetExtensionHeaderFlag(bool extensionHeaderFlag)
Set extension header flag function.
uint32_t m_teid
This field unambiguously identifies a tunnel endpoint in the receiving GTP-U protocol entity.
bool m_nPduNumberFlag
This flag indicates the presence of a meaningful value of the N-PDU Number field.
bool operator==(const GtpuHeader &b) const
Equality operator.
bool m_extensionHeaderFlag
This flag indicates the presence of a meaningful value of the Next Extension Header field.
void SetTeid(uint32_t teid)
Set TEID function.
~GtpuHeader() override
bool GetExtensionHeaderFlag() const
Get extension header flag function.
void SetVersion(uint8_t version)
Set version function.
bool m_protocolType
This bit is used as a protocol discriminator between GTP (when PT is '1') and GTP' (when PT is '0').
uint8_t m_messageType
This field indicates the type of GTP-U message.
uint8_t GetVersion() const
Get version function.
uint32_t GetSerializedSize() const override
bool GetSequenceNumberFlag() const
Get sequence number flag function.
bool GetNPduNumberFlag() const
Get type of GTP-U message function.
void SetNPduNumber(uint8_t nPduNumber)
Set NPDU number function.
uint8_t m_nPduNumber
This field is used at the Inter SGSN Routeing Area Update procedure and some inter-system handover pr...
void SetNPduNumberFlag(bool nPduNumberFlag)
Sets the flag that indicates the presence of a meaningful value of the N-PDU Number field.
uint16_t m_sequenceNumber
If Sequence Number field is used for G-PDUs (T-PDUs+headers), an increasing sequence number for T-PDU...
uint8_t GetNPduNumber() const
Get NPDU number function.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint16_t GetLength() const
Get length function.
void Print(std::ostream &os) const override
void SetMessageType(uint8_t messageType)
Set message type function.
uint8_t m_version
This field is used to determine the version of the GTPU-U protocol.
uint16_t m_length
This field indicates the length in octets of the payload, i.e.
static TypeId GetTypeId()
Get the type ID.
void SetSequenceNumberFlag(bool sequenceNumberFlag)
Set sequence number flag function.
uint16_t GetSequenceNumber() const
Get protocol type function.
uint32_t GetTeid() const
Get a tunnel endpoint identificator (TEID)
bool GetProtocolType() const
Get protocol type function.
void SetProtocolType(bool protocolType)
Set protocol type function.
uint8_t GetMessageType() const
Get message type function.
uint8_t GetNextExtensionType() const
Get next extension type function.
bool m_sequenceNumberFlag
This flag indicates the presence of a meaningful value of the Sequence Number field.
void Serialize(Buffer::Iterator start) const override
void SetNextExtensionType(uint8_t nextExtensionType)
Set next extension type function.
void SetLength(uint16_t length)
Set the length in octets of the payload.
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
a unique identifier for an interface.
Definition: type-id.h:59
string version
Definition: conf.py:52
Every class exported by the ns3 library is enclosed in the ns3 namespace.