21 #include "ns3/epc-gtpc-header.h"
96 uint8_t firstByte = i.
ReadU8 ();
97 uint8_t
version = (firstByte >> 5) & 0x07;
212 uint8_t type = i.
ReadU8 ();
213 NS_ASSERT_MSG (type == 1,
"Wrong IMSI IE type = " << (uint16_t) type);
216 uint8_t instance = i.
ReadU8 () & 0x0f;
236 uint8_t type = i.
ReadU8 ();
237 NS_ASSERT_MSG (type == 2,
"Wrong Cause IE type = " << (uint16_t) type);
240 uint8_t instance = i.
ReadU8 () & 0x0f;
254 i.
WriteU8 (epsBearerId & 0x0f);
260 uint8_t type = i.
ReadU8 ();
261 NS_ASSERT_MSG (type == 73,
"Wrong EBI IE type = " << (uint16_t) type);
264 uint8_t instance = i.
ReadU8 ();
266 epsBearerId = i.
ReadU8 () & 0x0f;
314 uint8_t type = i.
ReadU8 ();
315 NS_ASSERT_MSG (type == 80,
"Wrong Bearer QoS IE type = " << (uint16_t) type);
318 uint8_t instance = i.
ReadU8 ();
319 NS_ASSERT_MSG (instance == 0,
"Wrong Bearer QoS IE instance");
335 i.
WriteU8 (0x20 + (packetFilters.size () & 0x0f));
337 for (
auto &pf : packetFilters)
339 i.
WriteU8 ((pf.direction << 4) & 0x30);
357 i.
WriteU8 (pf.typeOfServiceMask);
364 uint8_t type = i.
ReadU8 ();
365 NS_ASSERT_MSG (type == 84,
"Wrong Bearer TFT IE type = " << (uint16_t) type);
368 uint8_t numberOfPacketFilters = i.
ReadU8 () & 0x0f;
370 for (uint8_t pf = 0; pf < numberOfPacketFilters; ++pf)
391 epcTft->Add (packetFilter);
419 uint8_t type = i.
ReadU8 ();
420 NS_ASSERT_MSG (type == 86,
"Wrong ULI ECGI IE type = " << (uint16_t) type);
423 uint8_t instance = i.
ReadU8 () & 0x0f;
445 uint8_t type = i.
ReadU8 ();
446 NS_ASSERT_MSG (type == 87,
"Wrong FTEID IE type = " << (uint16_t) type);
449 uint8_t instance = i.
ReadU8 () & 0x0f;
451 uint8_t flags = i.
ReadU8 ();
470 uint8_t type = i.
ReadU8 ();
471 NS_ASSERT_MSG (type == 93,
"Wrong Bearer Context IE type = " << (uint16_t) type);
473 uint8_t instance = i.
ReadU8 () & 0x0f;
474 NS_ASSERT_MSG (instance == 0,
"Wrong Bearer Context IE instance");
484 static TypeId tid =
TypeId (
"ns3::GtpcCreateSessionRequestMessage")
486 .SetGroupName (
"Lte")
520 return serializedSize;
541 std::list<EpcTft::PacketFilter> packetFilters = bc.tft->GetPacketFilters ();
573 bearerContext.
tft = epcTft;
626 std::list<GtpcCreateSessionRequestMessage::BearerContextToBeCreated>
643 static TypeId tid =
TypeId (
"ns3::GtpcCreateSessionResponseMessage")
645 .SetGroupName (
"Lte")
678 return serializedSize;
698 std::list<EpcTft::PacketFilter> packetFilters = bc.tft->GetPacketFilters ();
729 bearerContext.
tft = epcTft;
770 std::list<GtpcCreateSessionResponseMessage::BearerContextCreated>
787 static TypeId tid =
TypeId (
"ns3::GtpcModifyBearerRequestMessage")
789 .SetGroupName (
"Lte")
819 return serializedSize;
901 std::list<GtpcModifyBearerRequestMessage::BearerContextToBeModified>
918 static TypeId tid =
TypeId (
"ns3::GtpcModifyBearerResponseMessage")
920 .SetGroupName (
"Lte")
977 os <<
" cause " << (uint16_t)
m_cause;
997 static TypeId tid =
TypeId (
"ns3::GtpcDeleteBearerCommandMessage")
999 .SetGroupName (
"Lte")
1025 return serializedSize;
1070 os <<
" bearerContexts [";
1073 os << (uint16_t)bearerContext.m_epsBearerId <<
" ";
1078 std::list<GtpcDeleteBearerCommandMessage::BearerContext>
1095 static TypeId tid =
TypeId (
"ns3::GtpcDeleteBearerRequestMessage")
1097 .SetGroupName (
"Lte")
1122 return serializedSize;
1151 uint8_t epsBearerId;
1162 os <<
" epsBearerIds [";
1165 os << (uint16_t)epsBearerId <<
" ";
1187 static TypeId tid =
TypeId (
"ns3::GtpcDeleteBearerResponseMessage")
1189 .SetGroupName (
"Lte")
1214 return serializedSize;
1247 uint8_t epsBearerId;
1258 os <<
" cause " << (uint16_t)
m_cause <<
" epsBearerIds [";
1261 os << (uint16_t)epsBearerId <<
" ";
iterator in a Buffer instance
uint16_t ReadNtohU16(void)
void WriteHtonU64(uint64_t data)
uint64_t ReadNtohU64(void)
void WriteU8(uint8_t data)
uint32_t GetRemainingSize(void) const
void Next(void)
go forward by one byte
void WriteU16(uint16_t data)
void WriteHtonU16(uint16_t data)
void WriteHtonU32(uint32_t data)
uint32_t ReadNtohU32(void)
Direction
Indicates the direction of the traffic that is to be classified.
This class contains the specification of EPS Bearers.
enum ns3::EpsBearer::Qci qci
Qos class indicator.
GbrQosInformation gbrQosInfo
GBR QOS information.
GTP-C Create Session Request Message.
std::list< BearerContextToBeCreated > m_bearerContextsToBeCreated
Bearer Context list.
uint64_t GetImsi() const
Get the IMSI.
void SetUliEcgi(uint32_t uliEcgi)
Set the UliEcgi.
GtpcHeader::Fteid_t GetSenderCpFteid() const
Get the Sender CpFteid.
uint32_t GetUliEcgi() const
Get the UliEcgi.
uint32_t m_uliEcgi
UliEcgi.
virtual uint32_t GetMessageSize(void) const
Get the message size.
virtual uint32_t GetSerializedSize(void) const
GtpcHeader::Fteid_t m_senderCpFteid
Sender CpFteid.
void SetBearerContextsToBeCreated(std::list< BearerContextToBeCreated > bearerContexts)
Set the Bearer Contexts.
std::list< BearerContextToBeCreated > GetBearerContextsToBeCreated() const
Get the Bearer Contexts.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
static TypeId GetTypeId(void)
Get the type ID.
virtual void Print(std::ostream &os) const
void SetImsi(uint64_t imsi)
Set the IMSI.
void SetSenderCpFteid(GtpcHeader::Fteid_t fteid)
Set the Sender CpFteid.
virtual void Serialize(Buffer::Iterator start) const
virtual ~GtpcCreateSessionRequestMessage()
GtpcCreateSessionRequestMessage()
GTP-C Create Session Response Message.
virtual uint32_t GetMessageSize(void) const
Get the message size.
void SetCause(Cause_t cause)
Set the Cause.
void SetBearerContextsCreated(std::list< BearerContextCreated > bearerContexts)
Set the Bearer Contexts.
virtual uint32_t GetSerializedSize(void) const
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
static TypeId GetTypeId(void)
Get the type ID.
Cause_t GetCause() const
Get the Cause.
virtual ~GtpcCreateSessionResponseMessage()
void SetSenderCpFteid(GtpcHeader::Fteid_t fteid)
Set the Sender CpFteid.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
std::list< BearerContextCreated > m_bearerContextsCreated
Container of Bearer Contexts.
std::list< BearerContextCreated > GetBearerContextsCreated() const
Get the Container of Bearer Contexts.
GtpcCreateSessionResponseMessage()
GtpcHeader::Fteid_t m_senderCpFteid
Sender CpFteid.
GtpcHeader::Fteid_t GetSenderCpFteid() const
Get the Sender CpFteid.
GTP-C Delete Bearer Command Message.
static TypeId GetTypeId(void)
Get the type ID.
virtual void Print(std::ostream &os) const
std::list< BearerContext > GetBearerContexts() const
Get the Bearer contexts.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual uint32_t GetSerializedSize(void) const
GtpcDeleteBearerCommandMessage()
virtual void Serialize(Buffer::Iterator start) const
virtual ~GtpcDeleteBearerCommandMessage()
std::list< BearerContext > m_bearerContexts
Container of Bearer Contexts.
void SetBearerContexts(std::list< BearerContext > bearerContexts)
Set the Bearer contexts.
virtual uint32_t GetMessageSize(void) const
Get the message size.
GTP-C Delete Bearer Request Message.
virtual uint32_t GetSerializedSize(void) const
static TypeId GetTypeId(void)
Get the type ID.
virtual void Serialize(Buffer::Iterator start) const
GtpcDeleteBearerRequestMessage()
virtual ~GtpcDeleteBearerRequestMessage()
std::list< uint8_t > m_epsBearerIds
Container of Bearers IDs.
virtual void Print(std::ostream &os) const
std::list< uint8_t > GetEpsBearerIds() const
Get the Bearers IDs.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual uint32_t GetMessageSize(void) const
Get the message size.
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
GTP-C Delete Bearer Response Message.
virtual void Serialize(Buffer::Iterator start) const
virtual uint32_t GetSerializedSize(void) const
GtpcDeleteBearerResponseMessage()
void SetCause(Cause_t cause)
Set the Cause.
static TypeId GetTypeId(void)
Get the type ID.
Cause_t GetCause() const
Get the Cause.
std::list< uint8_t > m_epsBearerIds
Container of Bearers IDs.
std::list< uint8_t > GetEpsBearerIds() const
Get the Bearers IDs.
virtual uint32_t GetMessageSize(void) const
Get the message size.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual ~GtpcDeleteBearerResponseMessage()
virtual void Print(std::ostream &os) const
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
void SerializeEbi(Buffer::Iterator &i, uint8_t epsBearerId) const
Serialize the eps Bearer Id.
void SerializeBearerContextHeader(Buffer::Iterator &i, uint16_t length) const
Serialize the Bearer Context Header.
uint32_t DeserializeCause(Buffer::Iterator &i, Cause_t &cause)
Deserialize the Cause.
uint32_t DeserializeBearerContextHeader(Buffer::Iterator &i, uint16_t &length)
Deserialize the Bearer Context Header.
uint32_t DeserializeFteid(Buffer::Iterator &i, GtpcHeader::Fteid_t &fteid)
Deserialize the Fteid.
const uint32_t serializedSizeEbi
EBI serialized size.
void WriteHtonU40(Buffer::Iterator &i, uint64_t data) const
void SerializeImsi(Buffer::Iterator &i, uint64_t imsi) const
Serialize the IMSI.
const uint32_t serializedSizeBearerContextHeader
Fteid serialized size.
uint32_t GetSerializedSizeBearerTft(std::list< EpcTft::PacketFilter > packetFilters) const
void SerializeFteid(Buffer::Iterator &i, GtpcHeader::Fteid_t fteid) const
Serialize the Fteid_t.
const uint32_t serializedSizePacketFilter
Packet filter serialized size.
uint64_t ReadNtohU40(Buffer::Iterator &i)
uint32_t DeserializeBearerTft(Buffer::Iterator &i, Ptr< EpcTft > epcTft)
Deserialize the Bearer TFT.
void SerializeUliEcgi(Buffer::Iterator &i, uint32_t uliEcgi) const
Serialize the UliEcgi.
const uint32_t serializedSizeImsi
IMSI serialized size.
const uint32_t serializedSizeBearerQos
Bearer QoS serialized size.
const uint32_t serializedSizeCause
Cause serialized size.
void SerializeCause(Buffer::Iterator &i, Cause_t cause) const
Serialize the Cause.
uint32_t DeserializeImsi(Buffer::Iterator &i, uint64_t &imsi)
Deserialize the IMSI.
uint32_t DeserializeBearerQos(Buffer::Iterator &i, EpsBearer &bearerQos)
Deserialize the eps Bearer QoS.
void SerializeBearerQos(Buffer::Iterator &i, EpsBearer bearerQos) const
Serialize the eps Bearer QoS.
const uint32_t serializedSizeUliEcgi
UliEcgi serialized size.
const uint32_t serializedSizeFteid
Fteid serialized size.
uint32_t DeserializeEbi(Buffer::Iterator &i, uint8_t &epsBearerId)
Deserialize the eps Bearer Id.
uint32_t DeserializeUliEcgi(Buffer::Iterator &i, uint32_t &uliEcgi)
Deserialize the UliEcgi.
void SerializeBearerTft(Buffer::Iterator &i, std::list< EpcTft::PacketFilter > packetFilters) const
Serialize the Bearer TFT.
GTP-C Modify Bearer Request Message.
uint64_t GetImsi() const
Get the IMSI.
virtual ~GtpcModifyBearerRequestMessage()
void SetBearerContextsToBeModified(std::list< BearerContextToBeModified > bearerContexts)
Set the Bearer Contexts.
uint32_t GetUliEcgi() const
Get the UliEcgi.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual void Serialize(Buffer::Iterator start) const
void SetUliEcgi(uint32_t uliEcgi)
Set the UliEcgi.
GtpcModifyBearerRequestMessage()
std::list< BearerContextToBeModified > GetBearerContextsToBeModified() const
Get the Bearer Contexts.
virtual void Print(std::ostream &os) const
void SetImsi(uint64_t imsi)
Set the IMSI.
virtual uint32_t GetMessageSize(void) const
Get the message size.
std::list< BearerContextToBeModified > m_bearerContextsToBeModified
Bearer Context list.
virtual uint32_t GetSerializedSize(void) const
uint32_t m_uliEcgi
UliEcgi.
static TypeId GetTypeId(void)
Get the type ID.
GTP-C Modify Bearer Response Message.
virtual void Print(std::ostream &os) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual void Serialize(Buffer::Iterator start) const
virtual uint32_t GetMessageSize(void) const
Get the message size.
static TypeId GetTypeId(void)
Get the type ID.
virtual uint32_t GetSerializedSize(void) const
void SetCause(Cause_t cause)
Set the Cause.
GtpcModifyBearerResponseMessage()
Cause_t GetCause() const
Get the Cause.
virtual ~GtpcModifyBearerResponseMessage()
Ipv4 addresses are stored in host order in this class.
uint32_t Get(void) const
Get the host-order 32-bit IP address.
void Set(uint32_t address)
input address is in host order.
a class to represent an Ipv4 address mask
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint8_t VERSION
GTPv2-C protocol version number.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Ipv4Address localAddress
IPv4 address of the UE.
uint16_t localPortEnd
end of the port number range of the UE
Ipv4Mask localMask
IPv4 address mask of the UE.
uint16_t remotePortEnd
end of the port number range of the remote host
uint8_t precedence
used to specify the precedence for the packet filter among all packet filters in the TFT; higher valu...
Direction direction
whether the filter needs to be applied to uplink / downlink only, or in both cases
Ipv4Mask remoteMask
IPv4 address mask of the remote host.
uint16_t remotePortStart
start of the port number range of the remote host
uint8_t typeOfService
type of service field
Ipv4Address remoteAddress
IPv4 address of the remote host
uint8_t typeOfServiceMask
type of service field mask
uint16_t localPortStart
start of the port number range of the UE
Bearer Context structure.
EpsBearer bearerLevelQos
bearer QOS level
uint8_t epsBearerId
EPS bearer ID.
GtpcHeader::Fteid_t sgwS5uFteid
FTEID.
Ptr< EpcTft > tft
traffic flow template
Bearer Context structure.
GtpcHeader::Fteid_t fteid
FTEID.
uint8_t epsBearerId
EPS bearer ID.
Ptr< EpcTft > tft
Bearer traffic flow template.
EpsBearer bearerLevelQos
Bearer QOS level.
uint8_t m_epsBearerId
EPS bearer ID.
Bearer Context structure.
uint8_t epsBearerId
EPS bearer ID.
GtpcHeader::Fteid_t fteid
FTEID.