Header of the GTPv2-C protocol. More...
#include "epc-gtpc-header.h"
Classes | |
struct | Fteid_t |
FTEID structure. More... | |
Public Types | |
enum | InterfaceType_t { S1U_ENB_GTPU = 0 , S5_SGW_GTPU = 4 , S5_PGW_GTPU = 5 , S5_SGW_GTPC = 6 , S5_PGW_GTPC = 7 , S11_MME_GTPC = 10 } |
Interface Type enumeration. More... | |
enum | MessageType_t { Reserved = 0 , CreateSessionRequest = 32 , CreateSessionResponse = 33 , ModifyBearerRequest = 34 , ModifyBearerResponse = 35 , DeleteSessionRequest = 36 , DeleteSessionResponse = 37 , DeleteBearerCommand = 66 , DeleteBearerRequest = 99 , DeleteBearerResponse = 100 } |
Message Type enumeration. More... | |
Public Member Functions | |
GtpcHeader () | |
~GtpcHeader () override | |
void | ComputeMessageLength () |
Compute the message length according to the message type. | |
uint32_t | Deserialize (Buffer::Iterator start) override |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
uint16_t | GetMessageLength () const |
Get message length. | |
virtual uint32_t | GetMessageSize () const |
Get the message size. | |
uint8_t | GetMessageType () const |
Get message type. | |
uint32_t | GetSequenceNumber () const |
Get sequence number. | |
uint32_t | GetSerializedSize () const override |
uint32_t | GetTeid () const |
Get TEID. | |
void | Print (std::ostream &os) const override |
void | Serialize (Buffer::Iterator start) const override |
void | SetIesLength (uint16_t iesLength) |
Set IEs length. | |
void | SetMessageLength (uint16_t messageLength) |
Set message length. | |
void | SetMessageType (uint8_t messageType) |
Set message type. | |
void | SetSequenceNumber (uint32_t sequenceNumber) |
Set sequence number. | |
void | SetTeid (uint32_t teid) |
Set TEID. | |
Public Member Functions inherited from ns3::Header | |
~Header () override | |
virtual uint32_t | Deserialize (Buffer::Iterator start, Buffer::Iterator end) |
Deserialize the object from a buffer iterator. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Header | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::Chunk | |
static TypeId | GetTypeId () |
Get the type ID. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Protected Member Functions | |
uint32_t | PreDeserialize (Buffer::Iterator &i) |
Deserialize the GTP-C header in the GTP-C messages. | |
void | PreSerialize (Buffer::Iterator &i) const |
Serialize the GTP-C header in the GTP-C messages. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Private Attributes | |
uint16_t | m_messageLength |
Message length field. | |
uint8_t | m_messageType |
Message type field. | |
uint32_t | m_sequenceNumber |
GTP Sequence number field. | |
uint32_t | m_teid |
Tunnel Endpoint Identifier (TEID) field. | |
bool | m_teidFlag |
TEID flag. | |
Additional Inherited Members | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Header of the GTPv2-C protocol.
Implementation of the GPRS Tunnelling Protocol for Control Plane (GTPv2-C) header according to the 3GPP TS 29.274 document
Definition at line 28 of file epc-gtpc-header.h.
Interface Type enumeration.
Enumerator | |
---|---|
S1U_ENB_GTPU | |
S5_SGW_GTPU | |
S5_PGW_GTPU | |
S5_SGW_GTPC | |
S5_PGW_GTPC | |
S11_MME_GTPC |
Definition at line 106 of file epc-gtpc-header.h.
Message Type enumeration.
Definition at line 125 of file epc-gtpc-header.h.
ns3::GtpcHeader::GtpcHeader | ( | ) |
Definition at line 33 of file epc-gtpc-header.cc.
|
override |
Definition at line 42 of file epc-gtpc-header.cc.
void ns3::GtpcHeader::ComputeMessageLength | ( | ) |
Compute the message length according to the message type.
Definition at line 184 of file epc-gtpc-header.cc.
References GetMessageSize(), and SetIesLength().
Referenced by ns3::EpcMmeApplication::DoErabReleaseIndication(), ns3::EpcMmeApplication::DoInitialUeMessage(), ns3::EpcMmeApplication::DoPathSwitchRequest(), ns3::EpcPgwApplication::DoRecvCreateSessionRequest(), ns3::EpcSgwApplication::DoRecvCreateSessionRequest(), ns3::EpcSgwApplication::DoRecvCreateSessionResponse(), ns3::EpcPgwApplication::DoRecvDeleteBearerCommand(), ns3::EpcSgwApplication::DoRecvDeleteBearerCommand(), ns3::EpcMmeApplication::DoRecvDeleteBearerRequest(), ns3::EpcSgwApplication::DoRecvDeleteBearerRequest(), ns3::EpcSgwApplication::DoRecvDeleteBearerResponse(), ns3::EpcPgwApplication::DoRecvModifyBearerRequest(), ns3::EpcSgwApplication::DoRecvModifyBearerRequest(), and ns3::EpcSgwApplication::DoRecvModifyBearerResponse().
|
overridevirtual |
start | an iterator which points to where the header should read from. |
This method is used by Packet::RemoveHeader to re-create a header from the byte buffer of a packet. The data read is expected to match bit-for-bit the representation of this header in real networks.
Note that data is not actually removed from the buffer to which the iterator points. Both Packet::RemoveHeader() and Packet::PeekHeader() call Deserialize(), but only the RemoveHeader() has additional statements to remove the header bytes from the underlying buffer and associated metadata.
Implements ns3::Header.
Reimplemented in ns3::GtpcModifyBearerRequestMessage, and ns3::GtpcModifyBearerResponseMessage.
Definition at line 78 of file epc-gtpc-header.cc.
References PreDeserialize().
|
overridevirtual |
Get the most derived TypeId for this Object.
This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.
Implements ns3::ObjectBase.
Reimplemented in ns3::GtpcModifyBearerRequestMessage, and ns3::GtpcModifyBearerResponseMessage.
Definition at line 47 of file epc-gtpc-header.cc.
References GetTypeId().
uint16_t ns3::GtpcHeader::GetMessageLength | ( | ) | const |
Get message length.
Definition at line 133 of file epc-gtpc-header.cc.
References m_messageLength.
|
virtual |
Get the message size.
Subclasses are supposed to have a message size greater than zero.
Reimplemented in ns3::GtpcCreateSessionRequestMessage, ns3::GtpcCreateSessionResponseMessage, ns3::GtpcDeleteBearerCommandMessage, ns3::GtpcDeleteBearerRequestMessage, ns3::GtpcDeleteBearerResponseMessage, ns3::GtpcModifyBearerRequestMessage, and ns3::GtpcModifyBearerResponseMessage.
Definition at line 121 of file epc-gtpc-header.cc.
Referenced by ComputeMessageLength().
uint8_t ns3::GtpcHeader::GetMessageType | ( | ) | const |
Get message type.
Definition at line 127 of file epc-gtpc-header.cc.
References m_messageType.
Referenced by ns3::EpcMmeApplication::RecvFromS11Socket(), ns3::EpcSgwApplication::RecvFromS11Socket(), ns3::EpcPgwApplication::RecvFromS5cSocket(), and ns3::EpcSgwApplication::RecvFromS5cSocket().
uint32_t ns3::GtpcHeader::GetSequenceNumber | ( | ) | const |
Get sequence number.
Definition at line 145 of file epc-gtpc-header.cc.
References m_sequenceNumber.
|
overridevirtual |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. This method should return the number of bytes which are needed to store the full header data by Serialize.
Implements ns3::Header.
Reimplemented in ns3::GtpcModifyBearerRequestMessage, and ns3::GtpcModifyBearerResponseMessage.
Definition at line 53 of file epc-gtpc-header.cc.
References m_teidFlag.
Referenced by ns3::GtpcCreateSessionRequestMessage::GetSerializedSize(), ns3::GtpcCreateSessionResponseMessage::GetSerializedSize(), ns3::GtpcDeleteBearerCommandMessage::GetSerializedSize(), ns3::GtpcDeleteBearerRequestMessage::GetSerializedSize(), ns3::GtpcDeleteBearerResponseMessage::GetSerializedSize(), ns3::GtpcModifyBearerRequestMessage::GetSerializedSize(), ns3::GtpcModifyBearerResponseMessage::GetSerializedSize(), and PreDeserialize().
uint32_t ns3::GtpcHeader::GetTeid | ( | ) | const |
Get TEID.
Definition at line 139 of file epc-gtpc-header.cc.
References m_teid.
Referenced by ns3::EpcMmeApplication::DoRecvCreateSessionResponse(), ns3::EpcSgwApplication::DoRecvCreateSessionResponse(), ns3::EpcPgwApplication::DoRecvDeleteBearerCommand(), ns3::EpcSgwApplication::DoRecvDeleteBearerCommand(), ns3::EpcMmeApplication::DoRecvDeleteBearerRequest(), ns3::EpcSgwApplication::DoRecvDeleteBearerRequest(), ns3::EpcPgwApplication::DoRecvDeleteBearerResponse(), ns3::EpcSgwApplication::DoRecvDeleteBearerResponse(), ns3::EpcMmeApplication::DoRecvModifyBearerResponse(), and ns3::EpcSgwApplication::DoRecvModifyBearerResponse().
|
static |
Get the type ID.
Definition at line 24 of file epc-gtpc-header.cc.
References ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
|
protected |
Deserialize the GTP-C header in the GTP-C messages.
i | the buffer iterator |
Definition at line 84 of file epc-gtpc-header.cc.
References GetSerializedSize(), m_messageLength, m_messageType, m_sequenceNumber, m_teid, m_teidFlag, NS_FATAL_ERROR, ns3::Buffer::Iterator::ReadNtohU16(), ns3::Buffer::Iterator::ReadNtohU32(), and ns3::Buffer::Iterator::ReadU8().
Referenced by ns3::GtpcCreateSessionRequestMessage::Deserialize(), ns3::GtpcCreateSessionResponseMessage::Deserialize(), ns3::GtpcDeleteBearerCommandMessage::Deserialize(), ns3::GtpcDeleteBearerRequestMessage::Deserialize(), ns3::GtpcDeleteBearerResponseMessage::Deserialize(), Deserialize(), ns3::GtpcModifyBearerRequestMessage::Deserialize(), and ns3::GtpcModifyBearerResponseMessage::Deserialize().
|
protected |
Serialize the GTP-C header in the GTP-C messages.
i | the buffer iterator |
Definition at line 65 of file epc-gtpc-header.cc.
References m_messageLength, m_messageType, m_sequenceNumber, m_teid, ns3::VERSION, ns3::Buffer::Iterator::WriteHtonU16(), ns3::Buffer::Iterator::WriteHtonU32(), and ns3::Buffer::Iterator::WriteU8().
Referenced by ns3::GtpcCreateSessionRequestMessage::Serialize(), ns3::GtpcCreateSessionResponseMessage::Serialize(), ns3::GtpcDeleteBearerCommandMessage::Serialize(), ns3::GtpcDeleteBearerRequestMessage::Serialize(), ns3::GtpcDeleteBearerResponseMessage::Serialize(), ns3::GtpcModifyBearerRequestMessage::Serialize(), and ns3::GtpcModifyBearerResponseMessage::Serialize().
|
overridevirtual |
os | output stream This method is used by Packet::Print to print the content of a header as ascii data to a c++ output stream. Although the header is free to format its output as it wishes, it is recommended to follow a few rules to integrate with the packet pretty printer: start with flags, small field values located between a pair of parens. Values should be separated by whitespace. Follow the parens with the important fields, separated by whitespace. i.e.: (field1 val1 field2 val2 field3 val3) field4 val4 field5 val5 |
Implements ns3::Header.
Reimplemented in ns3::GtpcModifyBearerRequestMessage, and ns3::GtpcModifyBearerResponseMessage.
Definition at line 114 of file epc-gtpc-header.cc.
References m_messageLength, m_messageType, m_sequenceNumber, and m_teid.
|
overridevirtual |
start | an iterator which points to where the header should be written. |
This method is used by Packet::AddHeader to store a header into the byte buffer of a packet. The data written is expected to match bit-for-bit the representation of this header in a real network.
Implements ns3::Header.
Reimplemented in ns3::GtpcModifyBearerRequestMessage, and ns3::GtpcModifyBearerResponseMessage.
Definition at line 59 of file epc-gtpc-header.cc.
References NS_FATAL_ERROR.
void ns3::GtpcHeader::SetIesLength | ( | uint16_t | iesLength | ) |
Set IEs length.
It is used to compute the message length
iesLength | the IEs length |
Definition at line 177 of file epc-gtpc-header.cc.
References m_messageLength, and m_teidFlag.
Referenced by ComputeMessageLength().
void ns3::GtpcHeader::SetMessageLength | ( | uint16_t | messageLength | ) |
Set message length.
messageLength | the message length |
Definition at line 157 of file epc-gtpc-header.cc.
References m_messageLength.
void ns3::GtpcHeader::SetMessageType | ( | uint8_t | messageType | ) |
Set message type.
messageType | the message type |
Definition at line 151 of file epc-gtpc-header.cc.
References m_messageType.
Referenced by ns3::GtpcCreateSessionRequestMessage::GtpcCreateSessionRequestMessage(), ns3::GtpcCreateSessionResponseMessage::GtpcCreateSessionResponseMessage(), ns3::GtpcDeleteBearerCommandMessage::GtpcDeleteBearerCommandMessage(), ns3::GtpcDeleteBearerRequestMessage::GtpcDeleteBearerRequestMessage(), ns3::GtpcDeleteBearerResponseMessage::GtpcDeleteBearerResponseMessage(), ns3::GtpcModifyBearerRequestMessage::GtpcModifyBearerRequestMessage(), and ns3::GtpcModifyBearerResponseMessage::GtpcModifyBearerResponseMessage().
void ns3::GtpcHeader::SetSequenceNumber | ( | uint32_t | sequenceNumber | ) |
Set sequence number.
sequenceNumber | the sequence number |
Definition at line 171 of file epc-gtpc-header.cc.
References m_sequenceNumber.
Referenced by ns3::GtpcCreateSessionRequestMessage::GtpcCreateSessionRequestMessage(), ns3::GtpcCreateSessionResponseMessage::GtpcCreateSessionResponseMessage(), ns3::GtpcDeleteBearerCommandMessage::GtpcDeleteBearerCommandMessage(), ns3::GtpcDeleteBearerRequestMessage::GtpcDeleteBearerRequestMessage(), ns3::GtpcDeleteBearerResponseMessage::GtpcDeleteBearerResponseMessage(), ns3::GtpcModifyBearerRequestMessage::GtpcModifyBearerRequestMessage(), and ns3::GtpcModifyBearerResponseMessage::GtpcModifyBearerResponseMessage().
void ns3::GtpcHeader::SetTeid | ( | uint32_t | teid | ) |
Set TEID.
teid | the TEID |
Definition at line 163 of file epc-gtpc-header.cc.
References m_messageLength, m_teid, and m_teidFlag.
Referenced by ns3::EpcMmeApplication::DoErabReleaseIndication(), ns3::EpcMmeApplication::DoInitialUeMessage(), ns3::EpcMmeApplication::DoPathSwitchRequest(), ns3::EpcPgwApplication::DoRecvCreateSessionRequest(), ns3::EpcSgwApplication::DoRecvCreateSessionRequest(), ns3::EpcSgwApplication::DoRecvCreateSessionResponse(), ns3::EpcPgwApplication::DoRecvDeleteBearerCommand(), ns3::EpcSgwApplication::DoRecvDeleteBearerCommand(), ns3::EpcMmeApplication::DoRecvDeleteBearerRequest(), ns3::EpcSgwApplication::DoRecvDeleteBearerRequest(), ns3::EpcSgwApplication::DoRecvDeleteBearerResponse(), ns3::EpcPgwApplication::DoRecvModifyBearerRequest(), ns3::EpcSgwApplication::DoRecvModifyBearerRequest(), and ns3::EpcSgwApplication::DoRecvModifyBearerResponse().
|
private |
Message length field.
This field indicates the length of the message in octets excluding the mandatory part of the GTP-C header (the first 4 octets)
Definition at line 155 of file epc-gtpc-header.h.
Referenced by GetMessageLength(), PreDeserialize(), PreSerialize(), Print(), SetIesLength(), SetMessageLength(), and SetTeid().
|
private |
Message type field.
It can be one of the values of MessageType_t
Definition at line 149 of file epc-gtpc-header.h.
Referenced by GetMessageType(), PreDeserialize(), PreSerialize(), Print(), and SetMessageType().
|
private |
GTP Sequence number field.
Definition at line 163 of file epc-gtpc-header.h.
Referenced by GetSequenceNumber(), PreDeserialize(), PreSerialize(), Print(), and SetSequenceNumber().
|
private |
Tunnel Endpoint Identifier (TEID) field.
Definition at line 159 of file epc-gtpc-header.h.
Referenced by GetTeid(), PreDeserialize(), PreSerialize(), Print(), and SetTeid().
|
private |
TEID flag.
This flag indicates if TEID field is present or not
Definition at line 144 of file epc-gtpc-header.h.
Referenced by GetSerializedSize(), PreDeserialize(), SetIesLength(), and SetTeid().