A Discrete-Event Network Simulator
API
epc-gtpc-header.h
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2018 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: Manuel Requena <manuel.requena@cttc.es>
19 */
20
21#ifndef EPC_GTPC_HEADER_H
22#define EPC_GTPC_HEADER_H
23
24#include "ns3/header.h"
25#include "ns3/epc-tft.h"
26#include "ns3/eps-bearer.h"
27
28namespace ns3 {
29
38class GtpcHeader : public Header
39{
40public:
41 GtpcHeader ();
42 virtual ~GtpcHeader ();
47 static TypeId GetTypeId (void);
48 virtual TypeId GetInstanceTypeId (void) const;
49 virtual uint32_t GetSerializedSize (void) const;
50 virtual void Serialize (Buffer::Iterator start) const;
52 virtual void Print (std::ostream &os) const;
53
61 virtual uint32_t GetMessageSize (void) const;
62
67 uint8_t GetMessageType () const;
72 uint16_t GetMessageLength () const;
77 uint32_t GetTeid () const;
83
88 void SetMessageType (uint8_t messageType);
93 void SetMessageLength (uint16_t messageLength);
98 void SetTeid (uint32_t teid);
103 void SetSequenceNumber (uint32_t sequenceNumber);
108 void SetIesLength (uint16_t iesLength);
109
113 void ComputeMessageLength (void);
114
117 {
124 };
125
127 struct Fteid_t
128 {
132 };
133
136 {
147 };
148
149
150private:
175
176
177protected:
182 void PreSerialize (Buffer::Iterator &i) const;
189
190};
191
197{
198public:
203 {
206 };
207
212 const uint32_t serializedSizePacketFilter = 3 + 9 + 9 + 5 + 5 + 3;
217 uint32_t GetSerializedSizeBearerTft (std::list<EpcTft::PacketFilter> packetFilters) const;
221
227 void SerializeImsi (Buffer::Iterator &i, uint64_t imsi) const;
234 uint32_t DeserializeImsi (Buffer::Iterator &i, uint64_t &imsi);
235
241 void SerializeCause (Buffer::Iterator &i, Cause_t cause) const;
249
255 void SerializeEbi (Buffer::Iterator &i, uint8_t epsBearerId) const;
262 uint32_t DeserializeEbi (Buffer::Iterator &i, uint8_t &epsBearerId);
263
272 void WriteHtonU40 (Buffer::Iterator &i, uint64_t data) const;
281 uint64_t ReadNtohU40 (Buffer::Iterator &i);
282
288 void SerializeBearerQos (Buffer::Iterator &i, EpsBearer bearerQos) const;
296
302 void SerializeBearerTft (Buffer::Iterator &i, std::list<EpcTft::PacketFilter> packetFilters) const;
310
316 void SerializeUliEcgi (Buffer::Iterator &i, uint32_t uliEcgi) const;
324
338
344 void SerializeBearerContextHeader (Buffer::Iterator &i, uint16_t length) const;
352};
353
359{
360public:
367 static TypeId GetTypeId (void);
368 virtual TypeId GetInstanceTypeId (void) const;
369 virtual uint32_t GetSerializedSize (void) const;
370 virtual void Serialize (Buffer::Iterator start) const;
372 virtual void Print (std::ostream &os) const;
373 virtual uint32_t GetMessageSize (void) const;
374
379 uint64_t GetImsi () const;
384 void SetImsi (uint64_t imsi);
385
390 uint32_t GetUliEcgi () const;
395 void SetUliEcgi (uint32_t uliEcgi);
396
407
412 {
414 uint8_t epsBearerId;
417 };
418
423 std::list<BearerContextToBeCreated> GetBearerContextsToBeCreated () const;
428 void SetBearerContextsToBeCreated (std::list<BearerContextToBeCreated> bearerContexts);
429
430private:
431 uint64_t m_imsi;
434
436 std::list<BearerContextToBeCreated> m_bearerContextsToBeCreated;
437};
438
444{
445public:
452 static TypeId GetTypeId (void);
453 virtual TypeId GetInstanceTypeId (void) const;
454 virtual uint32_t GetSerializedSize (void) const;
455 virtual void Serialize (Buffer::Iterator start) const;
457 virtual void Print (std::ostream &os) const;
458 virtual uint32_t GetMessageSize (void) const;
459
464 Cause_t GetCause () const;
469 void SetCause (Cause_t cause);
470
481
486 {
487 uint8_t epsBearerId;
488 uint8_t cause;
492 };
493
498 std::list<BearerContextCreated> GetBearerContextsCreated () const;
503 void SetBearerContextsCreated (std::list<BearerContextCreated> bearerContexts);
504
505private:
509 std::list<BearerContextCreated> m_bearerContextsCreated;
510};
511
512
518{
519public:
526 static TypeId GetTypeId (void);
527 virtual TypeId GetInstanceTypeId (void) const;
528 virtual uint32_t GetSerializedSize (void) const;
529 virtual void Serialize (Buffer::Iterator start) const;
531 virtual void Print (std::ostream &os) const;
532 virtual uint32_t GetMessageSize (void) const;
533
538 uint64_t GetImsi () const;
543 void SetImsi (uint64_t imsi);
544
549 uint32_t GetUliEcgi () const;
554 void SetUliEcgi (uint32_t uliEcgi);
555
560 {
561 uint8_t epsBearerId;
563 };
564
569 std::list<BearerContextToBeModified> GetBearerContextsToBeModified () const;
574 void SetBearerContextsToBeModified (std::list<BearerContextToBeModified> bearerContexts);
575
576private:
577 uint64_t m_imsi;
579
581 std::list<BearerContextToBeModified> m_bearerContextsToBeModified;
582};
583
589{
590public:
597 static TypeId GetTypeId (void);
598 virtual TypeId GetInstanceTypeId (void) const;
599 virtual uint32_t GetSerializedSize (void) const;
600 virtual void Serialize (Buffer::Iterator start) const;
602 virtual void Print (std::ostream &os) const;
603 virtual uint32_t GetMessageSize (void) const;
604
609 Cause_t GetCause () const;
614 void SetCause (Cause_t cause);
615
616private:
618};
619
625{
626public:
633 static TypeId GetTypeId (void);
634 virtual TypeId GetInstanceTypeId (void) const;
635 virtual uint32_t GetSerializedSize (void) const;
636 virtual void Serialize (Buffer::Iterator start) const;
638 virtual void Print (std::ostream &os) const;
639 virtual uint32_t GetMessageSize (void) const;
640
643 {
645 };
646
651 std::list<BearerContext> GetBearerContexts () const;
656 void SetBearerContexts (std::list<BearerContext> bearerContexts);
657
658private:
659 std::list<BearerContext> m_bearerContexts;
660};
661
667{
668public:
675 static TypeId GetTypeId (void);
676 virtual TypeId GetInstanceTypeId (void) const;
677 virtual uint32_t GetSerializedSize (void) const;
678 virtual void Serialize (Buffer::Iterator start) const;
680 virtual void Print (std::ostream &os) const;
681 virtual uint32_t GetMessageSize (void) const;
682
687 std::list<uint8_t> GetEpsBearerIds () const;
692 void SetEpsBearerIds (std::list<uint8_t> epsBearerIds);
693
694private:
695 std::list<uint8_t> m_epsBearerIds;
696};
697
703{
704public:
711 static TypeId GetTypeId (void);
712 virtual TypeId GetInstanceTypeId (void) const;
713 virtual uint32_t GetSerializedSize (void) const;
714 virtual void Serialize (Buffer::Iterator start) const;
716 virtual void Print (std::ostream &os) const;
717 virtual uint32_t GetMessageSize (void) const;
718
723 Cause_t GetCause () const;
728 void SetCause (Cause_t cause);
729
734 std::list<uint8_t> GetEpsBearerIds () const;
739 void SetEpsBearerIds (std::list<uint8_t> epsBearerIds);
740
741private:
743 std::list<uint8_t> m_epsBearerIds;
744};
745
746} // namespace ns3
747
748#endif // EPC_GTPC_HEADER_H
iterator in a Buffer instance
Definition: buffer.h:99
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
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.
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 uint32_t Deserialize(Buffer::Iterator start)
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
GTP-C Create Session Response Message.
virtual uint32_t GetMessageSize(void) const
Get the message size.
virtual uint32_t Deserialize(Buffer::Iterator start)
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.
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.
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
virtual uint32_t Deserialize(Buffer::Iterator start)
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
virtual void Serialize(Buffer::Iterator start) const
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
virtual uint32_t Deserialize(Buffer::Iterator start)
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
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 Deserialize(Buffer::Iterator start)
virtual uint32_t GetMessageSize(void) const
Get the message size.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual void Print(std::ostream &os) const
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
Header of the GTPv2-C protocol.
virtual void Serialize(Buffer::Iterator start) const
void PreSerialize(Buffer::Iterator &i) const
Serialize the GTP-C header in the GTP-C messages.
uint16_t m_messageLength
Message length field.
void SetMessageLength(uint16_t messageLength)
Set message length.
uint16_t GetMessageLength() const
Get message length.
uint8_t m_messageType
Message type field.
void ComputeMessageLength(void)
Compute the message length according to the message type.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint8_t GetMessageType() const
Get message type.
void SetMessageType(uint8_t messageType)
Set message type.
InterfaceType_t
Interface Type enumeration.
uint32_t GetSequenceNumber() const
Get sequence number.
virtual ~GtpcHeader()
uint32_t m_sequenceNumber
GTP Sequence number field.
virtual void Print(std::ostream &os) const
uint32_t m_teid
Tunnel Endpoint Identifier (TEID) field.
bool m_teidFlag
TEID flag.
MessageType_t
Message Type enumeration.
void SetSequenceNumber(uint32_t sequenceNumber)
Set sequence number.
uint32_t PreDeserialize(Buffer::Iterator &i)
Deserialize the GTP-C header in the GTP-C messages.
virtual uint32_t Deserialize(Buffer::Iterator start)
void SetIesLength(uint16_t iesLength)
Set IEs length.
static TypeId GetTypeId(void)
Get the type ID.
virtual uint32_t GetSerializedSize(void) const
void SetTeid(uint32_t teid)
Set TEID.
virtual uint32_t GetMessageSize(void) const
Get the message size.
uint32_t GetTeid() const
Get TEID.
GTP-C Information Elemements.
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.
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 uint32_t Deserialize(Buffer::Iterator start)
virtual void Serialize(Buffer::Iterator start) const
void SetUliEcgi(uint32_t uliEcgi)
Set the UliEcgi.
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
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.
virtual uint32_t Deserialize(Buffer::Iterator start)
Cause_t GetCause() const
Get the Cause.
Protocol header serialization and deserialization.
Definition: header.h:43
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
def start()
Definition: core.py:1852
uint8_t data[writeSize]
Ptr< EpcTft > tft
Bearer traffic flow template.
Ipv4Address addr
IPv4 address.
InterfaceType_t interfaceType
Interface type.