PcapPlusPlus  Next
GtpLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Layer.h"
4 #include "TLVData.h"
5 #include <vector>
6 #include <bitset>
7 
9 
12 namespace pcpp
13 {
14 
15 #pragma pack(push, 1)
18  struct gtpv1_header
19  {
20 #if (BYTE_ORDER == LITTLE_ENDIAN)
22  uint8_t npduNumberFlag : 1,
28  reserved : 1,
32  version : 3;
33 #else
35  uint8_t version : 3,
37  protocolType : 1,
39  reserved : 1,
45  npduNumberFlag : 1;
46 #endif
48  uint8_t messageType;
49 
52  uint16_t messageLength;
53 
56  uint32_t teid;
57  };
58 #pragma pack(pop)
59  static_assert(sizeof(gtpv1_header) == 8, "gtpv1_header size is not 8 bytes");
60 
65  {
203  GtpV1_GPDU = 255
204  };
205 
208  class GtpV1Layer : public Layer
209  {
210  private:
211  struct gtpv1_header_extra
212  {
213  uint16_t sequenceNumber;
214  uint8_t npduNumber;
215  uint8_t nextExtensionHeader;
216  };
217 
218  gtpv1_header_extra* getHeaderExtra() const;
219 
220  void init(GtpV1MessageType messageType, uint32_t teid, bool setSeqNum, uint16_t seqNum, bool setNpduNum,
221  uint8_t npduNum);
222 
223  public:
227  {
228  friend class GtpV1Layer;
229 
230  private:
231  uint8_t* m_Data;
232  size_t m_DataLen;
233  uint8_t m_ExtType;
234 
235  GtpExtension(uint8_t* data, size_t dataLen, uint8_t type);
236 
237  void setNextHeaderType(uint8_t nextHeaderType);
238 
239  static GtpExtension createGtpExtension(uint8_t* data, size_t dataLen, uint8_t extType, uint16_t content);
240 
241  public:
244 
247  GtpExtension(const GtpExtension& other);
248 
253 
256  bool isNull() const;
257 
259  uint8_t getExtensionType() const;
260 
263  size_t getTotalLength() const;
264 
267  size_t getContentLength() const;
268 
271  uint8_t* getContent() const;
272 
275  uint8_t getNextExtensionHeaderType() const;
276 
281  }; // GtpExtension
282 
283  ~GtpV1Layer() override = default;
284 
290  GtpV1Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
291  : Layer(data, dataLen, prevLayer, packet, GTPv1)
292  {}
293 
297  GtpV1Layer(GtpV1MessageType messageType, uint32_t teid);
298 
310  GtpV1Layer(GtpV1MessageType messageType, uint32_t teid, bool setSeqNum, uint16_t seqNum, bool setNpduNum,
311  uint8_t npduNum);
312 
317  static bool isGTPv1(const uint8_t* data, size_t dataSize);
318 
322  {
323  return reinterpret_cast<gtpv1_header*>(m_Data);
324  }
325 
330  bool getSequenceNumber(uint16_t& seqNumber) const;
331 
336  bool setSequenceNumber(uint16_t seqNumber);
337 
342  bool getNpduNumber(uint8_t& npduNum) const;
343 
348  bool setNpduNumber(uint8_t npduNum);
349 
355  bool getNextExtensionHeaderType(uint8_t& nextExtType) const;
356 
360 
369  GtpExtension addExtension(uint8_t extensionType, uint16_t extensionContent);
370 
373 
375  std::string getMessageTypeAsString() const;
376 
378  bool isGTPUMessage() const;
379 
381  bool isGTPCMessage() const;
382 
386  static bool isGTPv1Port(uint16_t port)
387  {
388  return port == 2152 /* GTP-U */ || port == 2123 /* GTP-C */;
389  }
390 
391  // implement abstract methods
392 
394  void parseNextLayer() override;
395 
400  size_t getHeaderLen() const override;
401 
404  void computeCalculateFields() override;
405 
406  std::string toString() const override;
407 
409  {
410  return OsiModelTransportLayer;
411  }
412 
416  {
418  static std::vector<FieldDescriptor> all()
419  {
420  auto result = Layer::SerializedFields::all();
421  std::initializer_list<FieldDescriptor> extra{ Version, ProtocolType, MessageType,
424  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
425  return result;
426  }
427 
429  static const FieldDescriptor Version;
439  static const FieldDescriptor Teid;
448  };
449 
450  protected:
451  void serializeLayer(ObjectScope& serializer) const override;
452  };
453 
457  {
458  public:
460  enum Value : uint8_t
461  {
463  Unknown = 0,
563  CSPaging = 151,
575  ISRStatus = 157,
628  };
629 
630  GtpV2MessageType() = default;
631 
632  // cppcheck-suppress noExplicitConstructor
635  constexpr GtpV2MessageType(Value value) : m_Value(value)
636  {}
637 
639  std::string toString() const;
640 
645  static GtpV2MessageType fromUintValue(uint8_t value);
646 
647  // Allow switch and comparisons.
648  constexpr operator Value() const
649  {
650  return m_Value;
651  }
652 
653  // Prevent usage: if(GtpV2MessageType)
654  explicit operator bool() const = delete;
655 
656  private:
658  };
659 
663  class GtpV2InformationElement : public TLVRecord<uint8_t, uint16_t>
664  {
665  public:
667  enum class Type : uint8_t
668  {
670  Unknown = 0,
672  Imsi = 1,
674  Cause = 2,
676  Recovery = 3,
678  StnSr = 51,
680  Apn = 71,
682  Ambr = 72,
684  Ebi = 73,
686  IpAddress = 74,
688  Mei = 75,
690  Msisdn = 76,
692  Indication = 77,
694  Pco = 78,
696  Paa = 79,
698  BearerQos = 80,
700  FlowQos = 81,
702  RatType = 82,
704  ServingNetwork = 83,
706  BearerTft = 84,
708  Tad = 85,
710  Uli = 86,
712  FTeid = 87,
714  Tmsi = 88,
716  GlobalCnId = 89,
722  DelayValue = 92,
724  BearerContext = 93,
726  ChargingId = 94,
730  TraceInformation = 96,
732  BearerFlags = 97,
734  PdnType = 99,
736  Pti = 100,
738  MmContext1 = 103,
740  MmContext2 = 104,
742  MmContext3 = 105,
744  MmContext4 = 106,
746  MmContext5 = 107,
748  MmContext6 = 108,
750  PdnConnection = 109,
752  PduNumbers = 110,
754  PTmsi = 111,
756  PTmsiSignature = 112,
758  HopCounter = 113,
760  UeTimeZone = 114,
762  TraceReference = 115,
766  Guti = 117,
768  FContainer = 118,
770  FCause = 119,
772  PlmnId = 120,
774  TargetIdentification = 121,
776  PacketFlowId = 123,
778  RabContext = 124,
782  PortNumber = 126,
784  ApnRestriction = 127,
786  SelectionMode = 128,
788  SourceIdentification = 129,
790  ChangeReportingAction = 131,
792  FqCsid = 132,
794  ChannelNeeded = 133,
796  EmlppPriority = 134,
798  NodeType = 135,
800  Fqdn = 136,
802  Ti = 137,
804  MbmsSessionDuration = 138,
806  MbmsServiceArea = 139,
808  MbmsSessionIdentifier = 140,
810  MbmsFlowIdentifier = 141,
816  RfspIndex = 144,
818  Uci = 145,
822  CsgId = 147,
824  Cmi = 148,
826  ServiceIndicator = 149,
828  DetachType = 150,
830  Ldn = 151,
832  NodeFeatures = 152,
836  Throttling = 154,
838  Arp = 155,
840  EpcTimer = 156,
844  Tmgi = 158,
850  MdtConfiguration = 162,
852  Apco = 163,
860  ChangeToReportFlags = 167,
862  ActionIndication = 168,
864  TwanIdentifier = 169,
866  UliTimestamp = 170,
868  MbmsFlags = 171,
870  RanNasCause = 172,
874  Twmi = 174,
876  NodeNumber = 175,
878  NodeIdentifier = 176,
890  Metric = 182,
892  SequenceNumber = 183,
900  IntegerNumber = 187,
902  MillisecondTimeStamp = 188,
906  EcgiList = 190,
908  RemoteUeContext = 191,
910  RemoteUserId = 192,
912  RemoteUeIpInformation = 193,
916  ScefPdnConnection = 195,
920  ExtendedPco = 197,
924  Counter = 199,
926  MappedUeUsageType = 200,
932  MaximumPacketLossRate = 203,
934  ApnRateControlStatus = 204,
942  V2xContext = 208,
944  Pc5QosParameters = 209,
946  ServicesAuthorized = 210,
948  BitRate = 211,
950  Pc5QosFlow = 212,
952  SgiPtpTunnelAddress = 213
953  };
954 
957  explicit GtpV2InformationElement(uint8_t* infoElementRawData) : TLVRecord(infoElementRawData)
958  {}
959 
960  ~GtpV2InformationElement() override = default;
961 
964 
966  uint8_t getCRFlag();
967 
969  uint8_t getInstance();
970 
971  // implement abstract methods
972 
973  size_t getValueOffset() const override
974  {
975  return sizeof(uint8_t);
976  }
977 
978  size_t getTotalSize() const override;
979 
980  size_t getDataSize() const override;
981  };
982 
987  {
988  public:
995  GtpV2InformationElementBuilder(GtpV2InformationElement::Type infoElementType, const std::bitset<4>& crFlag,
996  const std::bitset<4>& instance, const std::vector<uint8_t>& infoElementValue);
997 
1001 
1002  private:
1003  std::bitset<4> m_CRFlag;
1004  std::bitset<4> m_Instance;
1005  };
1006 
1009  class GtpV2Layer : public Layer
1010  {
1011  public:
1012  ~GtpV2Layer() override = default;
1013 
1019  GtpV2Layer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
1020  : Layer(data, dataLen, prevLayer, packet, GTPv2)
1021  {}
1022 
1030  GtpV2Layer(GtpV2MessageType messageType, uint32_t sequenceNumber, bool setTeid = false, uint32_t teid = 0,
1031  bool setMessagePriority = false, std::bitset<4> messagePriority = 0);
1032 
1036  static bool isGTPv2Port(uint16_t port)
1037  {
1038  return port == 2123;
1039  }
1040 
1045  static bool isDataValid(const uint8_t* data, size_t dataSize);
1046 
1049 
1053 
1057  uint16_t getMessageLength() const;
1058 
1061  bool isPiggybacking() const;
1062 
1066  std::pair<bool, uint32_t> getTeid() const;
1067 
1070  void setTeid(uint32_t teid);
1071 
1073  void unsetTeid();
1074 
1076  uint32_t getSequenceNumber() const;
1077 
1080  void setSequenceNumber(uint32_t sequenceNumber);
1081 
1085  std::pair<bool, uint8_t> getMessagePriority() const;
1086 
1089  void setMessagePriority(const std::bitset<4>& messagePriority);
1090 
1093 
1097 
1104 
1110 
1113 
1120 
1128  GtpV2InformationElement::Type infoElementType);
1129 
1134 
1138 
1139  // implement abstract methods
1140 
1142  void parseNextLayer() override;
1143 
1145  size_t getHeaderLen() const override;
1146 
1148  void computeCalculateFields() override;
1149 
1150  std::string toString() const override;
1151 
1153  {
1154  return OsiModelTransportLayer;
1155  }
1156 
1160  {
1162  static std::vector<FieldDescriptor> all()
1163  {
1164  auto result = Layer::SerializedFields::all();
1165  std::initializer_list<FieldDescriptor> extra{
1168  };
1169  std::copy(extra.begin(), extra.end(), std::back_inserter(result));
1170  return result;
1171  }
1172 
1182  static const FieldDescriptor Teid;
1191  };
1192 
1193  protected:
1194  void serializeLayer(ObjectScope& serializer) const override;
1195 
1196  private:
1197 #pragma pack(push, 1)
1198  struct gtpv2_basic_header
1199  {
1200 #if (BYTE_ORDER == LITTLE_ENDIAN)
1201  uint8_t unused : 2, messagePriorityPresent : 1, teidPresent : 1, piggybacking : 1, version : 3;
1202 #else
1203  uint8_t version : 3, piggybacking : 1, teidPresent : 1, messagePriorityPresent : 1, unused : 2;
1204 #endif
1205  uint8_t messageType;
1206  uint16_t messageLength;
1207  };
1208 #pragma pack(pop)
1209 
1211 
1212  gtpv2_basic_header* getHeader() const
1213  {
1214  return reinterpret_cast<gtpv2_basic_header*>(m_Data);
1215  }
1216 
1217  uint8_t* getIEBasePtr() const;
1218 
1219  size_t getIEDataLen(const uint8_t* basePtr) const;
1220 
1221  GtpV2InformationElement addInformationElementAt(const GtpV2InformationElementBuilder& infoElementBuilder,
1222  int offset);
1223  };
1224 } // namespace pcpp
Definition: GtpLayer.h:227
uint8_t getNextExtensionHeaderType() const
GtpExtension & operator=(const GtpExtension &other)
uint8_t getExtensionType() const
GtpExtension(const GtpExtension &other)
GtpExtension()
An empty c'tor that creates an empty object, meaning one that isNull() returns "true")
uint8_t * getContent() const
GtpExtension getNextExtension() const
Definition: GtpLayer.h:209
bool setSequenceNumber(uint16_t seqNumber)
bool isGTPCMessage() const
std::string toString() const override
bool getSequenceNumber(uint16_t &seqNumber) const
bool isGTPUMessage() const
GtpV1Layer(GtpV1MessageType messageType, uint32_t teid)
void computeCalculateFields() override
bool setNpduNumber(uint8_t npduNum)
OsiModelLayer getOsiModelLayer() const override
Definition: GtpLayer.h:408
GtpV1MessageType getMessageType() const
GtpExtension addExtension(uint8_t extensionType, uint16_t extensionContent)
void serializeLayer(ObjectScope &serializer) const override
GtpV1Layer(GtpV1MessageType messageType, uint32_t teid, bool setSeqNum, uint16_t seqNum, bool setNpduNum, uint8_t npduNum)
GtpExtension getNextExtension() const
void parseNextLayer() override
Identifies the following next layers for GTP-U packets: IPv4Layer, IPv6Layer. Otherwise sets PayloadL...
gtpv1_header * getHeader() const
Definition: GtpLayer.h:321
bool getNextExtensionHeaderType(uint8_t &nextExtType) const
static bool isGTPv1Port(uint16_t port)
Definition: GtpLayer.h:386
static bool isGTPv1(const uint8_t *data, size_t dataSize)
GtpV1Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GtpLayer.h:290
std::string getMessageTypeAsString() const
size_t getHeaderLen() const override
bool getNpduNumber(uint8_t &npduNum) const
Definition: GtpLayer.h:987
GtpV2InformationElement build() const
GtpV2InformationElementBuilder(GtpV2InformationElement::Type infoElementType, const std::bitset< 4 > &crFlag, const std::bitset< 4 > &instance, const std::vector< uint8_t > &infoElementValue)
Definition: GtpLayer.h:664
GtpV2InformationElement::Type getIEType()
GtpV2InformationElement(uint8_t *infoElementRawData)
Definition: GtpLayer.h:957
Type
GTPv2 Information Element (IE) types as defined in 3GPP TS 29.274.
Definition: GtpLayer.h:668
@ UpFunctionSelectionIndicationFlags
UP Function Selection Indication Flags.
@ PresenceReportingAreaAction
Presence Reporting Area Action.
@ PresenceReportingAreaInformation
Presence Reporting Area Information.
@ Pc5QosParameters
PC5 QoS Parameters.
@ CompleteRequestMessage
Complete Request Message.
@ CnOperatorSelectionEntity
CN Operator Selection Entity.
@ RatType
Radio Access Technology Type.
@ ServiceIndicator
Service Indicator.
@ SgiPtpTunnelAddress
SGi PtP Tunnel Address.
@ ExtendedTraceInformation
Extended Trace Information.
@ Indication
Indication flags for various features and capabilities.
@ Fqdn
Fully Qualified Domain Name.
@ TraceInformation
Trace Information.
@ CiotOptimizationsSupportIndication
CIoT Optimizations Support Indication.
@ MillisecondTimeStamp
Millisecond Time Stamp.
@ FlowQos
Flow Level Quality of Service.
@ Paa
PDN Address Allocation.
@ TwanIdentifierTimestamp
TWAN Identifier Timestamp.
@ MmContext6
MM Context (UMTS Key, Quadruplets and Quintuplets)
@ ApnRateControlStatus
APN Rate Control Status.
@ MaximumPacketLossRate
Maximum Packet Loss Rate.
@ WlanOffloadabilityIndication
WLAN Offloadability Indication.
@ AbsoluteTimeOfMbmsDataTransfer
Absolute Time of MBMS Data Transfer.
@ SignallingPriorityIndication
Signalling Priority Indication.
@ Pco
Protocol Configuration Options.
@ Ipv4ConfigurationParameters
IPv4 Configuration Parameters.
@ Tmgi
Temporary Mobile Group Identity.
@ MbmsDistributionAcknowledge
MBMS Distribution Acknowledge.
@ AdditionalMmContextForSrvcc
Additional MM Context For SRVCC.
@ Cause
Indicates the result of a procedure.
@ ActionIndication
Action Indication.
@ MmContext2
MM Context (UMTS Key, Used Cipher and Quintuplets)
@ Ti
Transaction Identifier.
@ Tmsi
Temporary Mobile Subscriber Identity.
@ MappedUeUsageType
Mapped UE Usage Type.
@ MbmsTimeToDataTransfer
MBMS Time To Data Transfer.
@ AdditionalRrmPolicyIndex
Additional RRM Policy Index.
@ MbmsIpMulticastDistribution
MBMS IP Multicast Distribution.
@ Ldn
Local Distinguished Name.
@ StnSr
Session Transfer Number for SRVCC.
@ ChargingCharacteristics
Charging Characteristics.
@ Guti
Globally Unique Temporary Identity.
@ S103PdnDataForwardingInfo
S103 PDN Data Forwarding Info.
@ ScefPdnConnection
SCEF PDN Connection.
@ DelayValue
Delay Value in integer multiples of 50 milliseconds.
@ ChangeReportingAction
Change Reporting Action.
@ MmContext1
MM Context (GSM Key and Triplets)
@ SourceRncPdcpContextInfo
Source RNC PDCP Context Info.
@ Arp
Allocation Retention Priority.
@ MbmsSessionDuration
MBMS Session Duration.
@ FqCsid
Fully Qualified PDN Connection Set Identifier.
@ BearerTft
Bearer Traffic Flow Template.
@ PdnType
PDN Type (IPv4, IPv6, IPv4v6)
@ ServingNetwork
Current PLMN and MME identifier.
@ ServingPlmnRateControl
Serving PLMN Rate Control.
@ RemoteUeIpInformation
Remote UE IP Information.
@ AdditionalFlagsForSrvcc
Additional Flags For SRVCC.
@ Tad
Traffic Aggregation Description.
@ Unknown
Unknown or reserved value.
@ ChangeToReportFlags
Change To Report Flags.
@ OverloadControlInformation
Overload Control Information.
@ ChargingId
Charging ID for this PDP context.
@ Uli
User Location Information.
@ RemoteUeContext
Remote UE Context.
@ HenbInformationReporting
H(e)NB Information Reporting.
@ CsgInformationReportingAction
CSG Information Reporting Action.
@ BearerQos
Bearer Level Quality of Service.
@ HeaderCompressionConfiguration
Header Compression Configuration.
@ ApnAndRelativeCapacity
APN and Relative Capacity.
@ Cmi
CSG Membership Indication.
@ Pti
Procedure Transaction ID.
@ FTeid
Fully Qualified TEID.
@ MmContext3
MM Context (GSM Key, Used Cipher and Quintuplets)
@ Imsi
International Mobile Subscriber Identity.
@ PagingAndServiceInformation
Paging and Service Information.
@ MonitoringEventExtensionInformation
Monitoring Event Extension Information.
@ MbmsServiceArea
MBMS Service Area.
@ SourceIdentification
Source Identification.
@ RfspIndex
RF Selection Priority Index.
@ ExtendedPco
Extended Protocol Configuration Options.
@ MdtConfiguration
MDT Configuration.
@ GlobalCnId
Global Core Network ID.
@ MmContext4
MM Context (UMTS Key and Quintuplets)
@ S1UDataForwardingInfo
S1-U Data Forwarding Info.
@ ServicesAuthorized
Services Authorized.
@ Twmi
Trusted WLAN Mode Indication.
@ Recovery
Recovery counter for GTP path management.
@ Apco
Additional Protocol Configuration Options.
@ LoadControlInformation
Load Control Information.
@ MbmsFlowIdentifier
MBMS Flow Identifier.
@ SecondaryRatUsageDataReport
Secondary RAT Usage Data Report.
@ Msisdn
Mobile Station International Subscriber Directory Number.
@ MmContext5
MM Context (EPS Security Context, Quadruplets and Quintuplets)
@ Mei
Mobile Equipment Identity (IMEI or IMEISV)
@ TargetIdentification
Target Identification.
@ MonitoringEventInformation
Monitoring Event Information.
@ MbmsSessionIdentifier
MBMS Session Identifier.
@ Ambr
Aggregate Maximum Bit Rate.
size_t getDataSize() const override
size_t getTotalSize() const override
Definition: GtpLayer.h:1010
OsiModelLayer getOsiModelLayer() const override
Definition: GtpLayer.h:1152
void setSequenceNumber(uint32_t sequenceNumber)
void serializeLayer(ObjectScope &serializer) const override
uint16_t getMessageLength() const
void unsetMessagePriority()
Unset Message Priority if exists in the layer (otherwise does nothing)
GtpV2Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GtpLayer.h:1019
static bool isDataValid(const uint8_t *data, size_t dataSize)
void setMessageType(const GtpV2MessageType &type)
void setTeid(uint32_t teid)
GtpV2InformationElement getFirstInformationElement() const
std::string toString() const override
GtpV2InformationElement addInformationElementAfter(const GtpV2InformationElementBuilder &infoElementBuilder, GtpV2InformationElement::Type infoElementType)
void parseNextLayer() override
Identifies if the next layer is GTPv2 piggyback. Otherwise sets PayloadLayer.
size_t getHeaderLen() const override
size_t getInformationElementCount() const
void unsetTeid()
Unset Tunnel Endpoint Identifier (TEID) if exists in the layer (otherwise does nothing)
std::pair< bool, uint8_t > getMessagePriority() const
void computeCalculateFields() override
Computes the piggybacking flag by checking if the next layer is also a GTPv2 message.
GtpV2MessageType getMessageType() const
bool isPiggybacking() const
GtpV2InformationElement getInformationElement(GtpV2InformationElement::Type infoElementType) const
uint32_t getSequenceNumber() const
static bool isGTPv2Port(uint16_t port)
Definition: GtpLayer.h:1036
bool removeAllInformationElements()
GtpV2Layer(GtpV2MessageType messageType, uint32_t sequenceNumber, bool setTeid=false, uint32_t teid=0, bool setMessagePriority=false, std::bitset< 4 > messagePriority=0)
GtpV2InformationElement getNextInformationElement(GtpV2InformationElement infoElement) const
bool removeInformationElement(GtpV2InformationElement::Type infoElementType)
std::pair< bool, uint32_t > getTeid() const
void setMessagePriority(const std::bitset< 4 > &messagePriority)
GtpV2InformationElement addInformationElement(const GtpV2InformationElementBuilder &infoElementBuilder)
Definition: GtpLayer.h:457
Value
Define enum types and the corresponding int values.
Definition: GtpLayer.h:461
@ EchoResponse
Echo Response message.
Definition: GtpLayer.h:467
@ CreateForwardingRequest
Create Forwarding Request message.
Definition: GtpLayer.h:577
@ DeleteBearerFailure
Delete Bearer Failure message.
Definition: GtpLayer.h:497
@ MMBSSessionUpdateRequest
MMBS Session Update Request message.
Definition: GtpLayer.h:621
@ ContextAcknowledge
Context Acknowledge message.
Definition: GtpLayer.h:539
@ PGWDownlinkNotification
PGW Downlink Notification message.
Definition: GtpLayer.h:527
@ SuspendAcknowledge
Suspend Acknowledge message.
Definition: GtpLayer.h:583
@ RemoteUEReportAcknowledge
Remote UE Report Acknowledge message.
Definition: GtpLayer.h:489
@ CreateBearerRequest
Create Bearer Request message.
Definition: GtpLayer.h:511
@ MMBSSessionStartRequest
MMBS Session Start Request message.
Definition: GtpLayer.h:617
@ CreateIndirectDataTunnelRequest
Create Indirect Data Tunnel Request message.
Definition: GtpLayer.h:589
@ ForwardRelocationRequest
Forward Relocation Request message.
Definition: GtpLayer.h:541
@ CreateForwardingResponse
Create Forwarding Response message.
Definition: GtpLayer.h:579
@ DownlinkDataNotification
Downlink Data Notification message.
Definition: GtpLayer.h:601
@ CreateSessionResponse
Create Session Response message.
Definition: GtpLayer.h:473
@ UpdatePDNConnectionRequest
Update PDN Connection Request message.
Definition: GtpLayer.h:609
@ UpdateBearerRequest
Update Bearer Request message.
Definition: GtpLayer.h:515
@ DeleteBearerResponse
Delete Bearer Response message.
Definition: GtpLayer.h:521
@ DeleteBearerCommand
Delete Bearer Command message.
Definition: GtpLayer.h:495
@ ForwardAccessNotification
Forward Access Notification message.
Definition: GtpLayer.h:549
@ PGWRestartNotification
PGW Restart Notification message.
Definition: GtpLayer.h:605
@ PGWDownlinkAcknowledge
PGW Downlink Acknowledge message.
Definition: GtpLayer.h:529
@ IdentificationRequest
Identification Request message.
Definition: GtpLayer.h:531
@ DetachNotification
Detach Notification message.
Definition: GtpLayer.h:559
@ ChangeNotificationRequest
Change Notification Request message.
Definition: GtpLayer.h:483
@ DeleteSessionResponse
Delete Session Response message.
Definition: GtpLayer.h:481
@ TraceSessionActivation
Trace Session Activation message.
Definition: GtpLayer.h:505
@ ModifyAccessBearersResponse
Modify Access Bearers Response message.
Definition: GtpLayer.h:615
@ ReleaseAccessBearersResponse
Release Access Bearers Response message.
Definition: GtpLayer.h:599
@ BearerResourceCommand
Bearer Resource Command message.
Definition: GtpLayer.h:499
@ ContextRequest
Context Request message.
Definition: GtpLayer.h:535
@ BearerResourceFailure
Bearer Resource Failure message.
Definition: GtpLayer.h:501
@ Unknown
Unknown message.
Definition: GtpLayer.h:463
@ UpdatePDNConnectionResponse
Update PDN Connection Response message.
Definition: GtpLayer.h:611
@ RANInformationRelay
RAN Information Relay message.
Definition: GtpLayer.h:565
@ ReleaseAccessBearersRequest
Release Access Bearers Request message.
Definition: GtpLayer.h:597
@ IdentificationResponse
Identification Response message.
Definition: GtpLayer.h:533
@ RemoteUEReportNotifications
Remote UE Report Notifications message.
Definition: GtpLayer.h:487
@ TraceSessionDeactivation
Trace Session Deactivation message.
Definition: GtpLayer.h:507
@ DeleteIndirectDataTunnelRequest
Delete Indirect Data Tunnel Request message.
Definition: GtpLayer.h:593
@ RelocationCancelRequest
Relocation Cancel Request message.
Definition: GtpLayer.h:553
@ DownlinkDataAcknowledge
Downlink Data Acknowledge message.
Definition: GtpLayer.h:603
@ ModifyBearerFailure
Modify Bearer Failure message.
Definition: GtpLayer.h:493
@ DeletePDNRequest
Delete PDN Request message.
Definition: GtpLayer.h:523
@ VersionNotSupported
Version Not Supported message.
Definition: GtpLayer.h:469
@ ForwardRelocationNotification
Forward Relocation Notification message.
Definition: GtpLayer.h:545
@ CreateBearerResponse
Create Bearer Response message.
Definition: GtpLayer.h:513
@ StopPagingIndication
Stop Paging Indication message.
Definition: GtpLayer.h:509
@ DeleteSessionRequest
Delete Session Request message.
Definition: GtpLayer.h:479
@ SuspendNotification
Suspend Notification message.
Definition: GtpLayer.h:581
@ ForwardRelocationResponse
Forward Relocation Response message.
Definition: GtpLayer.h:543
@ DeletePDNResponse
Delete PDN Response message.
Definition: GtpLayer.h:525
@ ModifyBearerResponse
Modify Bearer Response message.
Definition: GtpLayer.h:477
@ RelocationCancelResponse
Relocation Cancel Response message.
Definition: GtpLayer.h:555
@ MMBSSessionStopResponse
MMBS Session Stop Response message.
Definition: GtpLayer.h:627
@ PGWRestartAcknowledge
PGW Restart Acknowledge message.
Definition: GtpLayer.h:607
@ ContextResponse
Context Response message.
Definition: GtpLayer.h:537
@ MMBSSessionStartResponse
MMBS Session Start Response message.
Definition: GtpLayer.h:619
@ ResumeAcknowledge
Resume Acknowledge message.
Definition: GtpLayer.h:587
@ ModifyBearerRequest
Modify Bearer Request message.
Definition: GtpLayer.h:475
@ AlertMMENotification
Alert MME Notification message.
Definition: GtpLayer.h:567
@ ModifyAccessBearersRequest
Modify Access Bearers Request message.
Definition: GtpLayer.h:613
@ MMBSSessionStopRequest
MMBS Session Stop Request message.
Definition: GtpLayer.h:625
@ ForwardRelocationAcknowledge
Forward Relocation Acknowledge message.
Definition: GtpLayer.h:547
@ EchoRequest
Echo Request message.
Definition: GtpLayer.h:465
@ MMBSSessionUpdateResponse
MMBS Session Update Response message.
Definition: GtpLayer.h:623
@ UEActivityAcknowledge
UE Activity Acknowledge message.
Definition: GtpLayer.h:573
@ ConfigurationTransferTunnel
Configuration Transfer Tunnel message.
Definition: GtpLayer.h:557
@ DetachAcknowledge
Detach Acknowledge message.
Definition: GtpLayer.h:561
@ ChangeNotificationResponse
Change Notification Response message.
Definition: GtpLayer.h:485
@ UEActivityNotification
UE Activity Notification message.
Definition: GtpLayer.h:571
@ DownlinkDataNotificationFailure
Downlink Data Notification Failure message.
Definition: GtpLayer.h:503
@ ModifyBearerCommand
Modify Bearer Command message.
Definition: GtpLayer.h:491
@ CreateIndirectDataTunnelResponse
Create Indirect Data Tunnel Response message.
Definition: GtpLayer.h:591
@ ISRStatus
ISR Status message.
Definition: GtpLayer.h:575
@ UpdateBearerResponse
Update Bearer Response message.
Definition: GtpLayer.h:517
@ ResumeNotification
Resume Notification message.
Definition: GtpLayer.h:585
@ CSPaging
CS Paging message.
Definition: GtpLayer.h:563
@ DeleteBearerRequest
Delete Bearer Request message.
Definition: GtpLayer.h:519
@ ForwardAccessAcknowledge
Forward Access Acknowledge message.
Definition: GtpLayer.h:551
@ DeleteIndirectDataTunnelResponse
Delete Indirect Data Tunnel Response message.
Definition: GtpLayer.h:595
@ CreateSessionRequest
Create Session Request message.
Definition: GtpLayer.h:471
@ AlertMMEAcknowledge
Alert MME Acknowledge message.
Definition: GtpLayer.h:569
std::string toString() const
constexpr GtpV2MessageType(Value value)
Definition: GtpLayer.h:635
static GtpV2MessageType fromUintValue(uint8_t value)
Definition: Layer.h:117
Definition: Serializers.h:230
Definition: Packet.h:49
Definition: TLVData.h:374
Definition: TLVData.h:20
Definition: TLVData.h:219
const ProtocolType GTPv1
GTPv1 protocol.
Definition: ProtocolType.h:159
const ProtocolType GTPv2
GTPv2 protocol.
Definition: ProtocolType.h:243
The main namespace for the PcapPlusPlus lib.
Definition: AssertionUtils.h:19
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:425
@ OsiModelTransportLayer
Transport layer (layer 4)
Definition: ProtocolType.h:433
GtpV1MessageType
Definition: GtpLayer.h:65
@ GtpV1_MessageTypeUnknown
GTPv1 Message Type Unknown.
Definition: GtpLayer.h:67
@ GtpV1_MBMSNotificationResponse
MBMS Notification Response.
Definition: GtpLayer.h:155
@ GtpV1_DeletePDPContextResponse
Delete PDP Context Response.
Definition: GtpLayer.h:91
@ GtpV1_InitiatePDPContextActivationResponse
Initiate PDP Context Activation Response.
Definition: GtpLayer.h:95
@ GtpV1_RANInformationRelay
RAN Information Relay.
Definition: GtpLayer.h:151
@ GtpV1_MBMSSessionStopRequest
MBMS Session Stop Request.
Definition: GtpLayer.h:185
@ GtpV1_MBMSSessionUpdateRequest
MBMS Session Update Request.
Definition: GtpLayer.h:189
@ GtpV1_SupportedExtensionsHeaderNotification
Supported Extensions Header Notification.
Definition: GtpLayer.h:107
@ GtpV1_PDUNotificationRejectRequest
PDU Notification Reject Request.
Definition: GtpLayer.h:103
@ GtpV1_GPDU
G-PDU.
Definition: GtpLayer.h:203
@ GtpV1_MBMSSessionUpdateResponse
MBMS Session Update Response.
Definition: GtpLayer.h:191
@ GtpV1_DeletePDPContextRequest
Delete PDP Context Request.
Definition: GtpLayer.h:89
@ GtpV1_InitiatePDPContextActivationRequest
Initiate PDP Context Activation Request.
Definition: GtpLayer.h:93
@ GtpV1_PDUNotificationRequest
PDU Notification Request.
Definition: GtpLayer.h:99
@ GtpV1_EchoRequest
Echo Request.
Definition: GtpLayer.h:69
@ GtpV1_ForwardRelocationComplete
Forward Relocation Complete.
Definition: GtpLayer.h:135
@ GtpV1_MBMSRegistrationRequest
MBMS Registration Request.
Definition: GtpLayer.h:173
@ GtpV1_MBMSNotificationRejectRequest
MBMS Notification Reject Request.
Definition: GtpLayer.h:157
@ GtpV1_SGSNContextAcknowledge
SGSN Context Acknowledge.
Definition: GtpLayer.h:129
@ GtpV1_MBMSSessionStartRequest
MBMS Session Start Request.
Definition: GtpLayer.h:181
@ GtpV1_DeleteMBMSNotificationRequest
Delete MBMS Notification Request.
Definition: GtpLayer.h:169
@ GtpV1_ForwardRelocationResponse
Forward Relocation Response.
Definition: GtpLayer.h:133
@ GtpV1_NodeAliveResponse
Node Alive Response.
Definition: GtpLayer.h:77
@ GtpV1_UERegistrationRequest
UE Registration Request.
Definition: GtpLayer.h:147
@ GtpV1_ForwardSRNSContextAcknowledge
Forward SRNS Context Acknowledge.
Definition: GtpLayer.h:145
@ GtpV1_MBMSNotificationRejectResponse
MBMS Notification Reject Response.
Definition: GtpLayer.h:159
@ GtpV1_UERegistrationResponse
UE Registration Response.
Definition: GtpLayer.h:149
@ GtpV1_CreatePDPContextResponse
Create PDP Context Response.
Definition: GtpLayer.h:83
@ GtpV1_FailureReportResponse
Failure Report Response.
Definition: GtpLayer.h:115
@ GtpV1_NoteMSPresentResponse
Note MS Present Response.
Definition: GtpLayer.h:119
@ GtpV1_IdentificationRequest
Identification Request.
Definition: GtpLayer.h:121
@ GtpV1_MBMSDeRegistrationResponse
MBMS De-Registration Response.
Definition: GtpLayer.h:179
@ GtpV1_MSInfoChangeResponse
MS Info Change Response.
Definition: GtpLayer.h:195
@ GtpV1_ForwardRelocationCompleteAcknowledge
Forward Relocation Complete Acknowledge.
Definition: GtpLayer.h:143
@ GtpV1_UpdatePDPContextRequest
Update PDP Context Request.
Definition: GtpLayer.h:85
@ GtpV1_SendRoutingforGPRSRequest
Send Routing for GPRS Request.
Definition: GtpLayer.h:109
@ GtpV1_PDUNotificationRejectResponse
PDU Notification Reject Response.
Definition: GtpLayer.h:105
@ GtpV1_UpdatePDPContextResponse
Update PDP Context Response.
Definition: GtpLayer.h:87
@ GtpV1_SendRoutingforGPRSResponse
Send Routing for GPRS Response.
Definition: GtpLayer.h:111
@ GtpV1_VersionNotSupported
Version Not Supported.
Definition: GtpLayer.h:73
@ GtpV1_MSInfoChangeRequest
MS Info Change Request.
Definition: GtpLayer.h:193
@ GtpV1_ErrorIndication
Error Indication.
Definition: GtpLayer.h:97
@ GtpV1_UpdateMBMSNotificationResponse
Update MBMS Notification Response.
Definition: GtpLayer.h:167
@ GtpV1_RelocationCancelResponse
Relocation Cancel Response.
Definition: GtpLayer.h:139
@ GtpV1_DataRecordTransferRequest
Data Record Transfer Request.
Definition: GtpLayer.h:197
@ GtpV1_MBMSNotificationRequest
MBMS Notification Request.
Definition: GtpLayer.h:153
@ GtpV1_MBMSSessionStartResponse
MBMS Session Start Response.
Definition: GtpLayer.h:183
@ GtpV1_FailureReportRequest
Failure Report Request.
Definition: GtpLayer.h:113
@ GtpV1_CreateMBMSNotificationResponse
Create MBMS Notification Response.
Definition: GtpLayer.h:163
@ GtpV1_MBMSDeRegistrationRequest
MBMS De-Registration Request.
Definition: GtpLayer.h:177
@ GtpV1_CreateMBMSNotificationRequest
Create MBMS Notification Request.
Definition: GtpLayer.h:161
@ GtpV1_DataRecordTransferResponse
Data Record Transfer Response.
Definition: GtpLayer.h:199
@ GtpV1_MBMSSessionStopResponse
MBMS Session Stop Response.
Definition: GtpLayer.h:187
@ GtpV1_UpdateMBMSNotificationRequest
Update MBMS Notification Request.
Definition: GtpLayer.h:165
@ GtpV1_SGSNContextRequest
SGSN Context Request.
Definition: GtpLayer.h:125
@ GtpV1_RedirectionRequest
Redirection Request.
Definition: GtpLayer.h:79
@ GtpV1_EndMarker
End Marker.
Definition: GtpLayer.h:201
@ GtpV1_IdentificationResponse
Identification Response.
Definition: GtpLayer.h:123
@ GtpV1_EchoResponse
Echo Response.
Definition: GtpLayer.h:71
@ GtpV1_RelocationCancelRequest
Relocation Cancel Request.
Definition: GtpLayer.h:137
@ GtpV1_NodeAliveRequest
Node Alive Request.
Definition: GtpLayer.h:75
@ GtpV1_SGSNContextResponse
SGSN Context Response.
Definition: GtpLayer.h:127
@ GtpV1_ForwardRelocationRequest
Forward Relocation Request.
Definition: GtpLayer.h:131
@ GtpV1_NoteMSPresentRequest
Note MS Present Request.
Definition: GtpLayer.h:117
@ GtpV1_MBMSRegistrationResponse
MBMS Registration Response.
Definition: GtpLayer.h:175
@ GtpV1_DeleteMBMSNotificationResponse
Delete MBMS Notification Response.
Definition: GtpLayer.h:171
@ GtpV1_CreatePDPContextRequest
Create PDP Context Request.
Definition: GtpLayer.h:81
@ GtpV1_ForwardSRNSContext
Forward SRNS Context.
Definition: GtpLayer.h:141
@ GtpV1_PDUNotificationResponse
PDU Notification Response.
Definition: GtpLayer.h:101
Definition: Serializers.h:18
Definition: GtpLayer.h:416
static const FieldDescriptor MessageTypeName
GTP message type name, as returned by getMessageTypeAsString()
Definition: GtpLayer.h:435
static const FieldDescriptor MessageLength
Message length field in bytes (host byte order), excluding the mandatory 8-byte header.
Definition: GtpLayer.h:437
static const FieldDescriptor Teid
Tunnel endpoint identifier in hexadecimal (host byte order)
Definition: GtpLayer.h:439
static const FieldDescriptor MessageType
GTP message type, as an integer.
Definition: GtpLayer.h:433
static const FieldDescriptor ProtocolType
Protocol type bit, as an integer: 1 for GTP, 0 for GTP'.
Definition: GtpLayer.h:431
static const FieldDescriptor NpduNumber
N-PDU number, only when the N-PDU number flag is set.
Definition: GtpLayer.h:443
static std::vector< FieldDescriptor > all()
Definition: GtpLayer.h:418
static const FieldDescriptor Extension
A single header extension type, as an integer.
Definition: GtpLayer.h:447
static const FieldDescriptor Extensions
List of header extension types, only when the extension header flag is set.
Definition: GtpLayer.h:445
static const FieldDescriptor Version
GTP version, as an integer.
Definition: GtpLayer.h:429
static const FieldDescriptor SequenceNumber
Sequence number (host byte order), only when the sequence number flag is set.
Definition: GtpLayer.h:441
Definition: GtpLayer.h:1160
static const FieldDescriptor MessageTypeName
GTPv2 message type name, as returned by GtpV2MessageType::toString()
Definition: GtpLayer.h:1176
static const FieldDescriptor InformationElements
List of information element (IE) types present in the message.
Definition: GtpLayer.h:1188
static const FieldDescriptor MessagePriority
4-bit message priority, only when the message priority flag is set
Definition: GtpLayer.h:1186
static const FieldDescriptor InformationElement
A single information element (IE) type, as an integer.
Definition: GtpLayer.h:1190
static const FieldDescriptor SequenceNumber
24-bit sequence number (host byte order)
Definition: GtpLayer.h:1184
static const FieldDescriptor Piggybacking
Whether another GTPv2 message is piggybacked on this one, as a boolean.
Definition: GtpLayer.h:1180
static const FieldDescriptor MessageLength
Message length field in bytes (host byte order), excluding the first 4 octets of the header.
Definition: GtpLayer.h:1178
static std::vector< FieldDescriptor > all()
Definition: GtpLayer.h:1162
static const FieldDescriptor MessageType
GTPv2 message type, as the raw integer value from the header.
Definition: GtpLayer.h:1174
static const FieldDescriptor Teid
Tunnel endpoint identifier in hexadecimal (host byte order), only when the TEID flag is set.
Definition: GtpLayer.h:1182
Definition: Layer.h:212
static std::vector< FieldDescriptor > all()
Definition: Layer.h:214
Definition: GtpLayer.h:19
uint8_t version
GTP version.
Definition: GtpLayer.h:32
uint8_t messageType
An 8-bit field that indicates the type of GTP message.
Definition: GtpLayer.h:48
uint16_t messageLength
Definition: GtpLayer.h:52
uint8_t reserved
Reserved bit.
Definition: GtpLayer.h:28
uint8_t npduNumberFlag
A 1-bit value that states whether there is a N-PDU number optional field.
Definition: GtpLayer.h:22
uint32_t teid
Definition: GtpLayer.h:56
uint8_t sequenceNumberFlag
A 1-bit value that states whether there is a Sequence Number optional field.
Definition: GtpLayer.h:24
uint8_t extensionHeaderFlag
A 1-bit value that states whether there is an extension header optional field.
Definition: GtpLayer.h:26
uint8_t protocolType
A 1-bit value that differentiates GTP (value 1) from GTP' (value 0)
Definition: GtpLayer.h:30