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 "ns3/epc-tft.h"
24#include "ns3/eps-bearer.h"
25#include "ns3/header.h"
26
27namespace ns3
28{
29
38class GtpcHeader : public Header
39{
40 public:
41 GtpcHeader();
42 ~GtpcHeader() override;
47 static TypeId GetTypeId();
48 TypeId GetInstanceTypeId() const override;
49 uint32_t GetSerializedSize() const override;
50 void Serialize(Buffer::Iterator start) const override;
52 void Print(std::ostream& os) const override;
53
61 virtual uint32_t GetMessageSize() 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
114
117 {
124 };
125
127 struct Fteid_t
128 {
132 };
133
136 {
147 };
148
149 private:
174
175 protected:
180 void PreSerialize(Buffer::Iterator& i) const;
187};
188
194{
195 public:
200 {
203 };
204
210 3 + 9 + 9 + 5 + 5 + 3;
215 uint32_t GetSerializedSizeBearerTft(std::list<EpcTft::PacketFilter> packetFilters) const;
219
225 void SerializeImsi(Buffer::Iterator& i, uint64_t imsi) const;
232 uint32_t DeserializeImsi(Buffer::Iterator& i, uint64_t& imsi) const;
233
239 void SerializeCause(Buffer::Iterator& i, Cause_t cause) const;
247
253 void SerializeEbi(Buffer::Iterator& i, uint8_t epsBearerId) const;
260 uint32_t DeserializeEbi(Buffer::Iterator& i, uint8_t& epsBearerId) const;
261
270 void WriteHtonU40(Buffer::Iterator& i, uint64_t data) const;
279 uint64_t ReadNtohU40(Buffer::Iterator& i);
280
286 void SerializeBearerQos(Buffer::Iterator& i, EpsBearer bearerQos) const;
294
301 std::list<EpcTft::PacketFilter> packetFilters) const;
309
315 void SerializeUliEcgi(Buffer::Iterator& i, uint32_t uliEcgi) const;
323
337
343 void SerializeBearerContextHeader(Buffer::Iterator& i, uint16_t length) const;
350 uint32_t DeserializeBearerContextHeader(Buffer::Iterator& i, uint16_t& length) const;
351};
352
358{
359 public:
366 static TypeId GetTypeId();
367 TypeId GetInstanceTypeId() const override;
368 uint32_t GetSerializedSize() const override;
369 void Serialize(Buffer::Iterator start) const override;
370 uint32_t Deserialize(Buffer::Iterator start) override;
371 void Print(std::ostream& os) const override;
372 uint32_t GetMessageSize() const override;
373
378 uint64_t GetImsi() const;
383 void SetImsi(uint64_t imsi);
384
389 uint32_t GetUliEcgi() const;
394 void SetUliEcgi(uint32_t uliEcgi);
395
406
411 {
413 uint8_t epsBearerId;
416 };
417
422 std::list<BearerContextToBeCreated> GetBearerContextsToBeCreated() const;
427 void SetBearerContextsToBeCreated(std::list<BearerContextToBeCreated> bearerContexts);
428
429 private:
430 uint64_t m_imsi;
433
435 std::list<BearerContextToBeCreated> m_bearerContextsToBeCreated;
436};
437
443{
444 public:
451 static TypeId GetTypeId();
452 TypeId GetInstanceTypeId() const override;
453 uint32_t GetSerializedSize() const override;
454 void Serialize(Buffer::Iterator start) const override;
455 uint32_t Deserialize(Buffer::Iterator start) override;
456 void Print(std::ostream& os) const override;
457 uint32_t GetMessageSize() const override;
458
463 Cause_t GetCause() const;
468 void SetCause(Cause_t cause);
469
480
485 {
486 uint8_t epsBearerId;
487 uint8_t cause;
491 };
492
497 std::list<BearerContextCreated> GetBearerContextsCreated() const;
502 void SetBearerContextsCreated(std::list<BearerContextCreated> bearerContexts);
503
504 private:
508 std::list<BearerContextCreated> m_bearerContextsCreated;
509};
510
516{
517 public:
524 static TypeId GetTypeId();
525 TypeId GetInstanceTypeId() const override;
526 uint32_t GetSerializedSize() const override;
527 void Serialize(Buffer::Iterator start) const override;
528 uint32_t Deserialize(Buffer::Iterator start) override;
529 void Print(std::ostream& os) const override;
530 uint32_t GetMessageSize() const override;
531
536 uint64_t GetImsi() const;
541 void SetImsi(uint64_t imsi);
542
547 uint32_t GetUliEcgi() const;
552 void SetUliEcgi(uint32_t uliEcgi);
553
558 {
559 uint8_t epsBearerId;
561 };
562
567 std::list<BearerContextToBeModified> GetBearerContextsToBeModified() const;
572 void SetBearerContextsToBeModified(std::list<BearerContextToBeModified> bearerContexts);
573
574 private:
575 uint64_t m_imsi;
577
579 std::list<BearerContextToBeModified> m_bearerContextsToBeModified;
580};
581
587{
588 public:
595 static TypeId GetTypeId();
596 TypeId GetInstanceTypeId() const override;
597 uint32_t GetSerializedSize() const override;
598 void Serialize(Buffer::Iterator start) const override;
599 uint32_t Deserialize(Buffer::Iterator start) override;
600 void Print(std::ostream& os) const override;
601 uint32_t GetMessageSize() const override;
602
607 Cause_t GetCause() const;
612 void SetCause(Cause_t cause);
613
614 private:
616};
617
623{
624 public:
631 static TypeId GetTypeId();
632 TypeId GetInstanceTypeId() const override;
633 uint32_t GetSerializedSize() const override;
634 void Serialize(Buffer::Iterator start) const override;
635 uint32_t Deserialize(Buffer::Iterator start) override;
636 void Print(std::ostream& os) const override;
637 uint32_t GetMessageSize() const override;
638
641 {
643 };
644
649 std::list<BearerContext> GetBearerContexts() const;
654 void SetBearerContexts(std::list<BearerContext> bearerContexts);
655
656 private:
657 std::list<BearerContext> m_bearerContexts;
658};
659
665{
666 public:
673 static TypeId GetTypeId();
674 TypeId GetInstanceTypeId() const override;
675 uint32_t GetSerializedSize() const override;
676 void Serialize(Buffer::Iterator start) const override;
677 uint32_t Deserialize(Buffer::Iterator start) override;
678 void Print(std::ostream& os) const override;
679 uint32_t GetMessageSize() const override;
680
685 std::list<uint8_t> GetEpsBearerIds() const;
690 void SetEpsBearerIds(std::list<uint8_t> epsBearerIds);
691
692 private:
693 std::list<uint8_t> m_epsBearerIds;
694};
695
701{
702 public:
709 static TypeId GetTypeId();
710 TypeId GetInstanceTypeId() const override;
711 uint32_t GetSerializedSize() const override;
712 void Serialize(Buffer::Iterator start) const override;
713 uint32_t Deserialize(Buffer::Iterator start) override;
714 void Print(std::ostream& os) const override;
715 uint32_t GetMessageSize() const override;
716
721 Cause_t GetCause() const;
726 void SetCause(Cause_t cause);
727
732 std::list<uint8_t> GetEpsBearerIds() const;
737 void SetEpsBearerIds(std::list<uint8_t> epsBearerIds);
738
739 private:
741 std::list<uint8_t> m_epsBearerIds;
742};
743
744} // namespace ns3
745
746#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:43
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:60
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.