A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
epc-gtpu-header.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Jaume Nin <jnin@cttc.cat>
19  */
20 
21 
22 #ifndef EPS_GTPU_V1_H
23 #define EPS_GTPU_V1_H
24 
25 #include <ns3/ptr.h>
26 #include <ns3/header.h>
27 #include <ns3/ipv4-header.h>
28 
29 namespace ns3 {
30 
31 class Packet;
32 
33 
39 class GtpuHeader : public Header
40 {
41 public:
42  static TypeId GetTypeId (void);
43  GtpuHeader ();
44  virtual ~GtpuHeader ();
45  virtual TypeId GetInstanceTypeId (void) const;
46  virtual uint32_t GetSerializedSize (void) const;
47  virtual void Serialize (Buffer::Iterator start) const;
48  virtual uint32_t Deserialize (Buffer::Iterator start);
49  virtual void Print (std::ostream &os) const;
50 
51  bool GetExtensionHeaderFlag () const;
52  uint16_t GetLength () const;
53  uint8_t GetMessageType () const;
54  uint8_t GetNPduNumber () const;
55  bool GetNPduNumberFlag () const;
56  uint8_t GetNextExtensionType () const;
57  bool GetProtocolType () const;
58  uint16_t GetSequenceNumber () const;
59  bool GetSequenceNumberFlag () const;
60  uint32_t GetTeid () const;
61  uint8_t GetVersion () const;
63  void SetLength (uint16_t m_length);
64  void SetMessageType (uint8_t m_messageType);
65  void SetNPduNumber (uint8_t m_nPduNumber);
68  void SetProtocolType (bool m_protocolType);
69  void SetSequenceNumber (uint16_t m_sequenceNumber);
71  void SetTeid (uint32_t m_teid);
72  void SetVersion (uint8_t m_version);
73 
74  bool operator == (const GtpuHeader& b) const;
75 
76 
77 private:
81  uint8_t m_version; // really a 3 uint3_t
82 
88 
96 
114  uint8_t m_messageType;
121  uint16_t m_length;
122 
128  uint32_t m_teid;
141  uint8_t m_nPduNumber;
147 
148 };
149 
150 } // namespace ns3
151 
152 #endif /* EPS_GTPU_V1_H */
Protocol header serialization and deserialization.
Definition: header.h:42
uint16_t GetSequenceNumber() const
bool m_nPduNumberFlag
This flag indicates the presence of a meaningful value of the N-PDU Number field. ...
virtual void Serialize(Buffer::Iterator start) const
uint8_t m_nPduNumber
This field is used at the Inter SGSN Routeing Area Update procedure and some inter-system handover pr...
uint8_t GetMessageType() const
void SetVersion(uint8_t m_version)
bool m_protocolType
This bit is used as a protocol discriminator between GTP (when PT is '1') and GTP' (when PT is '0')...
iterator in a Buffer instance
Definition: buffer.h:98
virtual uint32_t GetSerializedSize(void) const
uint8_t m_messageType
This field indicates the type of GTP-U message.
void SetNPduNumber(uint8_t m_nPduNumber)
void SetExtensionHeaderFlag(bool m_extensionHeaderFlag)
bool GetNPduNumberFlag() const
virtual void Print(std::ostream &os) const
void SetProtocolType(bool m_protocolType)
uint16_t m_sequenceNumber
If Sequence Number field is used for G-PDUs (T-PDUs+headers), an increasing sequence number for T-PDU...
bool m_extensionHeaderFlag
This flag indicates the presence of a meaningful value of the Next Extension Header field...
uint8_t m_version
This field is used to determine the version of the GTPU-U protocol.
bool GetProtocolType() const
uint8_t m_nextExtensionType
This field defines the type of Extension Header that follows this field in the GTP-PDU.
void SetNPduNumberFlag(bool m_nPduNumberFlag)
bool GetExtensionHeaderFlag() const
bool GetSequenceNumberFlag() const
virtual ~GtpuHeader()
uint8_t GetVersion() const
void SetMessageType(uint8_t m_messageType)
void SetTeid(uint32_t m_teid)
bool m_sequenceNumberFlag
This flag indicates the presence of a meaningful value of the Sequence Number field.
uint32_t GetTeid() const
uint16_t m_length
This field indicates the length in octets of the payload, i.e.
static TypeId GetTypeId(void)
bool operator==(const GtpuHeader &b) const
void SetSequenceNumberFlag(bool m_sequenceNumberFlag)
virtual TypeId GetInstanceTypeId(void) const
uint8_t GetNPduNumber() const
uint8_t GetNextExtensionType() const
void SetSequenceNumber(uint16_t m_sequenceNumber)
void SetLength(uint16_t m_length)
uint16_t GetLength() const
void SetNextExtensionType(uint8_t m_nextExtensionType)
virtual uint32_t Deserialize(Buffer::Iterator start)
uint32_t m_teid
This field unambiguously identifies a tunnel endpoint in the receiving GTP-U protocol entity...
a unique identifier for an interface.
Definition: type-id.h:49
Implementation of the GTPv1-U Release 10 as per 3Gpp TS 29.281 document.