A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
epc-gtpc-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 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: Manuel Requena <manuel.requena@cttc.es>
18 */
19
20#ifndef EPC_GTPC_HEADER_H
21#define EPC_GTPC_HEADER_H
22
23#include "epc-tft.h"
24#include "eps-bearer.h"
25
26#include "ns3/header.h"
27
28namespace ns3
29{
30
39class GtpcHeader : public Header
40{
41 public:
42 GtpcHeader();
43 ~GtpcHeader() override;
48 static TypeId GetTypeId();
49 TypeId GetInstanceTypeId() const override;
50 uint32_t GetSerializedSize() const override;
51 void Serialize(Buffer::Iterator start) const override;
53 void Print(std::ostream& os) const override;
54
62 virtual uint32_t GetMessageSize() const;
63
68 uint8_t GetMessageType() const;
73 uint16_t GetMessageLength() const;
78 uint32_t GetTeid() const;
84
89 void SetMessageType(uint8_t messageType);
94 void SetMessageLength(uint16_t messageLength);
99 void SetTeid(uint32_t teid);
104 void SetSequenceNumber(uint32_t sequenceNumber);
109 void SetIesLength(uint16_t iesLength);
110
115
118 {
125 };
126
128 struct Fteid_t
129 {
133 };
134
137 {
148 };
149
150 private:
175
176 protected:
181 void PreSerialize(Buffer::Iterator& i) const;
188};
189
195{
196 public:
201 {
204 };
205
211 3 + 9 + 9 + 5 + 5 + 3;
216 uint32_t GetSerializedSizeBearerTft(std::list<EpcTft::PacketFilter> packetFilters) const;
220
226 void SerializeImsi(Buffer::Iterator& i, uint64_t imsi) const;
233 uint32_t DeserializeImsi(Buffer::Iterator& i, uint64_t& imsi) const;
234
240 void SerializeCause(Buffer::Iterator& i, Cause_t cause) const;
248
254 void SerializeEbi(Buffer::Iterator& i, uint8_t epsBearerId) const;
261 uint32_t DeserializeEbi(Buffer::Iterator& i, uint8_t& epsBearerId) const;
262
271 void WriteHtonU40(Buffer::Iterator& i, uint64_t data) const;
280 uint64_t ReadNtohU40(Buffer::Iterator& i);
281
287 void SerializeBearerQos(Buffer::Iterator& i, EpsBearer bearerQos) const;
295
302 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;
351 uint32_t DeserializeBearerContextHeader(Buffer::Iterator& i, uint16_t& length) const;
352};
353
359{
360 public:
367 static TypeId GetTypeId();
368 TypeId GetInstanceTypeId() const override;
369 uint32_t GetSerializedSize() const override;
370 void Serialize(Buffer::Iterator start) const override;
371 uint32_t Deserialize(Buffer::Iterator start) override;
372 void Print(std::ostream& os) const override;
373 uint32_t GetMessageSize() const override;
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
430 private:
431 uint64_t m_imsi;
434
436 std::list<BearerContextToBeCreated> m_bearerContextsToBeCreated;
437};
438
444{
445 public:
452 static TypeId GetTypeId();
453 TypeId GetInstanceTypeId() const override;
454 uint32_t GetSerializedSize() const override;
455 void Serialize(Buffer::Iterator start) const override;
456 uint32_t Deserialize(Buffer::Iterator start) override;
457 void Print(std::ostream& os) const override;
458 uint32_t GetMessageSize() const override;
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
505 private:
509 std::list<BearerContextCreated> m_bearerContextsCreated;
510};
511
517{
518 public:
525 static TypeId GetTypeId();
526 TypeId GetInstanceTypeId() const override;
527 uint32_t GetSerializedSize() const override;
528 void Serialize(Buffer::Iterator start) const override;
529 uint32_t Deserialize(Buffer::Iterator start) override;
530 void Print(std::ostream& os) const override;
531 uint32_t GetMessageSize() const override;
532
537 uint64_t GetImsi() const;
542 void SetImsi(uint64_t imsi);
543
548 uint32_t GetUliEcgi() const;
553 void SetUliEcgi(uint32_t uliEcgi);
554
559 {
560 uint8_t epsBearerId;
562 };
563
568 std::list<BearerContextToBeModified> GetBearerContextsToBeModified() const;
573 void SetBearerContextsToBeModified(std::list<BearerContextToBeModified> bearerContexts);
574
575 private:
576 uint64_t m_imsi;
578
580 std::list<BearerContextToBeModified> m_bearerContextsToBeModified;
581};
582
588{
589 public:
596 static TypeId GetTypeId();
597 TypeId GetInstanceTypeId() const override;
598 uint32_t GetSerializedSize() const override;
599 void Serialize(Buffer::Iterator start) const override;
600 uint32_t Deserialize(Buffer::Iterator start) override;
601 void Print(std::ostream& os) const override;
602 uint32_t GetMessageSize() const override;
603
608 Cause_t GetCause() const;
613 void SetCause(Cause_t cause);
614
615 private:
617};
618
624{
625 public:
632 static TypeId GetTypeId();
633 TypeId GetInstanceTypeId() const override;
634 uint32_t GetSerializedSize() const override;
635 void Serialize(Buffer::Iterator start) const override;
636 uint32_t Deserialize(Buffer::Iterator start) override;
637 void Print(std::ostream& os) const override;
638 uint32_t GetMessageSize() const override;
639
642 {
644 };
645
650 std::list<BearerContext> GetBearerContexts() const;
655 void SetBearerContexts(std::list<BearerContext> bearerContexts);
656
657 private:
658 std::list<BearerContext> m_bearerContexts;
659};
660
666{
667 public:
674 static TypeId GetTypeId();
675 TypeId GetInstanceTypeId() const override;
676 uint32_t GetSerializedSize() const override;
677 void Serialize(Buffer::Iterator start) const override;
678 uint32_t Deserialize(Buffer::Iterator start) override;
679 void Print(std::ostream& os) const override;
680 uint32_t GetMessageSize() const override;
681
686 std::list<uint8_t> GetEpsBearerIds() const;
691 void SetEpsBearerIds(std::list<uint8_t> epsBearerIds);
692
693 private:
694 std::list<uint8_t> m_epsBearerIds;
695};
696
702{
703 public:
710 static TypeId GetTypeId();
711 TypeId GetInstanceTypeId() const override;
712 uint32_t GetSerializedSize() const override;
713 void Serialize(Buffer::Iterator start) const override;
714 uint32_t Deserialize(Buffer::Iterator start) override;
715 void Print(std::ostream& os) const override;
716 uint32_t GetMessageSize() const override;
717
722 Cause_t GetCause() const;
727 void SetCause(Cause_t cause);
728
733 std::list<uint8_t> GetEpsBearerIds() const;
738 void SetEpsBearerIds(std::list<uint8_t> epsBearerIds);
739
740 private:
742 std::list<uint8_t> m_epsBearerIds;
743};
744
745} // namespace ns3
746
747#endif // EPC_GTPC_HEADER_H
iterator in a Buffer instance
Definition: buffer.h:100
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
GTP-C Create Session Request Message.
std::list< BearerContextToBeCreated > m_bearerContextsToBeCreated
Bearer Context list.
static TypeId GetTypeId()
Get the type ID.
uint64_t GetImsi() const
Get the IMSI.
uint32_t Deserialize(Buffer::Iterator start) override
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 GetMessageSize() const override
Get the message size.
uint32_t GetSerializedSize() const override
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.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Serialize(Buffer::Iterator start) const override
void SetImsi(uint64_t imsi)
Set the IMSI.
void Print(std::ostream &os) const override
void SetSenderCpFteid(GtpcHeader::Fteid_t fteid)
Set the Sender CpFteid.
GTP-C Create Session Response Message.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetCause(Cause_t cause)
Set the Cause.
static TypeId GetTypeId()
Get the type ID.
uint32_t Deserialize(Buffer::Iterator start) override
void SetBearerContextsCreated(std::list< BearerContextCreated > bearerContexts)
Set the Bearer Contexts.
Cause_t GetCause() const
Get the Cause.
void Print(std::ostream &os) const override
void SetSenderCpFteid(GtpcHeader::Fteid_t fteid)
Set the Sender CpFteid.
void Serialize(Buffer::Iterator start) const override
uint32_t GetSerializedSize() const override
std::list< BearerContextCreated > m_bearerContextsCreated
Container of Bearer Contexts.
std::list< BearerContextCreated > GetBearerContextsCreated() const
Get the Container of Bearer Contexts.
uint32_t GetMessageSize() const override
Get the message size.
GtpcHeader::Fteid_t m_senderCpFteid
Sender CpFteid.
GtpcHeader::Fteid_t GetSenderCpFteid() const
Get the Sender CpFteid.
GTP-C Delete Bearer Command Message.
void Print(std::ostream &os) const override
std::list< BearerContext > GetBearerContexts() const
Get the Bearer contexts.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
std::list< BearerContext > m_bearerContexts
Container of Bearer Contexts.
void SetBearerContexts(std::list< BearerContext > bearerContexts)
Set the Bearer contexts.
uint32_t GetMessageSize() const override
Get the message size.
static TypeId GetTypeId()
Get the type ID.
uint32_t GetSerializedSize() const override
uint32_t Deserialize(Buffer::Iterator start) override
void Serialize(Buffer::Iterator start) const override
GTP-C Delete Bearer Request Message.
uint32_t GetSerializedSize() const override
uint32_t GetMessageSize() const override
Get the message size.
static TypeId GetTypeId()
Get the type ID.
void Print(std::ostream &os) const override
std::list< uint8_t > m_epsBearerIds
Container of Bearers IDs.
uint32_t Deserialize(Buffer::Iterator start) override
void Serialize(Buffer::Iterator start) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
std::list< uint8_t > GetEpsBearerIds() const
Get the Bearers IDs.
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
GTP-C Delete Bearer Response Message.
void Serialize(Buffer::Iterator start) const override
uint32_t GetSerializedSize() const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetCause(Cause_t cause)
Set the Cause.
Cause_t GetCause() const
Get the Cause.
std::list< uint8_t > m_epsBearerIds
Container of Bearers IDs.
uint32_t GetMessageSize() const override
Get the message size.
std::list< uint8_t > GetEpsBearerIds() const
Get the Bearers IDs.
void Print(std::ostream &os) const override
uint32_t Deserialize(Buffer::Iterator start) override
static TypeId GetTypeId()
Get the type ID.
void SetEpsBearerIds(std::list< uint8_t > epsBearerIds)
Set the Bearers IDs.
Header of the GTPv2-C protocol.
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.
static TypeId GetTypeId()
Get the type ID.
uint16_t GetMessageLength() const
Get message length.
uint8_t m_messageType
Message type field.
void Serialize(Buffer::Iterator start) const override
uint8_t GetMessageType() const
Get message type.
void SetMessageType(uint8_t messageType)
Set message type.
virtual uint32_t GetMessageSize() const
Get the message size.
InterfaceType_t
Interface Type enumeration.
uint32_t GetSequenceNumber() const
Get sequence number.
uint32_t m_sequenceNumber
GTP Sequence number field.
void Print(std::ostream &os) const override
uint32_t m_teid
Tunnel Endpoint Identifier (TEID) field.
bool m_teidFlag
TEID flag.
uint32_t GetSerializedSize() const override
uint32_t Deserialize(Buffer::Iterator start) override
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.
void ComputeMessageLength()
Compute the message length according to the message type.
~GtpcHeader() override
void SetIesLength(uint16_t iesLength)
Set IEs length.
void SetTeid(uint32_t teid)
Set TEID.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetTeid() const
Get TEID.
GTP-C Information Elements.
uint32_t DeserializeFteid(Buffer::Iterator &i, GtpcHeader::Fteid_t &fteid) const
Deserialize the Fteid.
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 DeserializeImsi(Buffer::Iterator &i, uint64_t &imsi) const
Deserialize the IMSI.
uint32_t DeserializeEbi(Buffer::Iterator &i, uint8_t &epsBearerId) const
Deserialize the eps Bearer Id.
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.
uint32_t DeserializeUliEcgi(Buffer::Iterator &i, uint32_t &uliEcgi) const
Deserialize the UliEcgi.
const uint32_t serializedSizeBearerContextHeader
Fteid serialized size.
uint32_t DeserializeCause(Buffer::Iterator &i, Cause_t &cause) const
Deserialize the Cause.
uint32_t GetSerializedSizeBearerTft(std::list< EpcTft::PacketFilter > packetFilters) const
void SerializeFteid(Buffer::Iterator &i, GtpcHeader::Fteid_t fteid) const
Serialize the Fteid_t.
uint32_t DeserializeBearerTft(Buffer::Iterator &i, Ptr< EpcTft > epcTft) const
Deserialize the Bearer TFT.
const uint32_t serializedSizePacketFilter
Packet filter serialized size.
uint64_t ReadNtohU40(Buffer::Iterator &i)
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.
uint32_t DeserializeBearerContextHeader(Buffer::Iterator &i, uint16_t &length) const
Deserialize the Bearer Context Header.
void SerializeCause(Buffer::Iterator &i, Cause_t cause) const
Serialize the Cause.
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.
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 Print(std::ostream &os) const override
void SetBearerContextsToBeModified(std::list< BearerContextToBeModified > bearerContexts)
Set the Bearer Contexts.
uint32_t GetUliEcgi() const
Get the UliEcgi.
void SetUliEcgi(uint32_t uliEcgi)
Set the UliEcgi.
uint32_t Deserialize(Buffer::Iterator start) override
std::list< BearerContextToBeModified > GetBearerContextsToBeModified() const
Get the Bearer Contexts.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetMessageSize() const override
Get the message size.
static TypeId GetTypeId()
Get the type ID.
void SetImsi(uint64_t imsi)
Set the IMSI.
std::list< BearerContextToBeModified > m_bearerContextsToBeModified
Bearer Context list.
uint32_t GetSerializedSize() const override
void Serialize(Buffer::Iterator start) const override
GTP-C Modify Bearer Response Message.
uint32_t Deserialize(Buffer::Iterator start) override
uint32_t GetSerializedSize() const override
uint32_t GetMessageSize() const override
Get the message size.
void SetCause(Cause_t cause)
Set the Cause.
static TypeId GetTypeId()
Get the type ID.
void Print(std::ostream &os) const override
Cause_t GetCause() const
Get the Cause.
void Serialize(Buffer::Iterator start) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Protocol header serialization and deserialization.
Definition: header.h:44
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t data[writeSize]
Ptr< EpcTft > tft
Bearer traffic flow template.
Ipv4Address addr
IPv4 address.
InterfaceType_t interfaceType
Interface type.