24 #if (BYTE_ORDER == LITTLE_ENDIAN)
219 struct gtpv1_header_extra
221 uint16_t sequenceNumber;
223 uint8_t nextExtensionHeader;
226 gtpv1_header_extra* getHeaderExtra()
const;
228 void init(
GtpV1MessageType messageType, uint32_t teid,
bool setSeqNum, uint16_t seqNum,
bool setNpduNum,
245 GtpExtension(uint8_t* data,
size_t dataLen, uint8_t type);
247 void setNextHeaderType(uint8_t nextHeaderType);
249 static GtpExtension createGtpExtension(uint8_t* data,
size_t dataLen, uint8_t extType, uint16_t content);
322 :
Layer(data, dataLen, prevLayer, packet,
GTPv1)
354 static bool isGTPv1(
const uint8_t* data,
size_t dataSize);
451 return port == 2152 || port == 2123 ;
687 constexpr
operator Value()
const
693 explicit operator bool()
const =
delete;
1024 size_t getValueOffset()
const override
1026 return sizeof(uint8_t);
1051 const std::bitset<4>& instance,
const std::vector<uint8_t>& infoElementValue);
1060 std::bitset<4> m_CRFlag;
1061 std::bitset<4> m_Instance;
1081 :
Layer(data, dataLen, prevLayer, packet,
GTPv2)
1103 return port == 2123;
1271 #pragma pack(push, 1)
1272 struct gtpv2_basic_header
1274 #if (BYTE_ORDER == LITTLE_ENDIAN)
1275 uint8_t unused : 2, messagePriorityPresent : 1, teidPresent : 1, piggybacking : 1, version : 3;
1277 uint8_t version : 3, piggybacking : 1, teidPresent : 1, messagePriorityPresent : 1, unused : 2;
1279 uint8_t messageType;
1280 uint16_t messageLength;
1284 TLVRecordReader<GtpV2InformationElement> m_IEReader;
1286 gtpv2_basic_header* getHeader()
const
1288 return reinterpret_cast<gtpv2_basic_header*
>(m_Data);
1291 uint8_t* getIEBasePtr()
const;
1293 GtpV2InformationElement addInformationElementAt(
const GtpV2InformationElementBuilder& infoElementBuilder,
Definition: GtpLayer.h:237
uint8_t getNextExtensionHeaderType() const
GtpExtension & operator=(const GtpExtension &other)
uint8_t getExtensionType() const
GtpExtension(const GtpExtension &other)
size_t getContentLength() const
size_t getTotalLength() const
uint8_t * getContent() const
GtpExtension getNextExtension() const
Definition: GtpLayer.h:217
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:477
GtpV1MessageType getMessageType() const
GtpExtension addExtension(uint8_t extensionType, uint16_t extensionContent)
GtpV1Layer(GtpV1MessageType messageType, uint32_t teid, bool setSeqNum, uint16_t seqNum, bool setNpduNum, uint8_t npduNum)
GtpExtension getNextExtension() const
void parseNextLayer() override
gtpv1_header * getHeader() const
Definition: GtpLayer.h:360
bool getNextExtensionHeaderType(uint8_t &nextExtType) const
static bool isGTPv1Port(uint16_t port)
Definition: GtpLayer.h:449
static bool isGTPv1(const uint8_t *data, size_t dataSize)
GtpV1Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GtpLayer.h:321
std::string getMessageTypeAsString() const
size_t getHeaderLen() const override
bool getNpduNumber(uint8_t &npduNum) const
Definition: GtpLayer.h:1069
OsiModelLayer getOsiModelLayer() const override
Definition: GtpLayer.h:1265
void setSequenceNumber(uint32_t sequenceNumber)
uint16_t getMessageLength() const
void unsetMessagePriority()
GtpV2Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: GtpLayer.h:1080
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
size_t getHeaderLen() const override
size_t getInformationElementCount() const
std::pair< bool, uint8_t > getMessagePriority() const
void computeCalculateFields() override
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:1101
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:488
Value
Definition: GtpLayer.h:494
@ EchoResponse
Definition: GtpLayer.h:500
@ CreateForwardingRequest
Definition: GtpLayer.h:610
@ DeleteBearerFailure
Definition: GtpLayer.h:530
@ MMBSSessionUpdateRequest
Definition: GtpLayer.h:654
@ ContextAcknowledge
Definition: GtpLayer.h:572
@ PGWDownlinkNotification
Definition: GtpLayer.h:560
@ SuspendAcknowledge
Definition: GtpLayer.h:616
@ RemoteUEReportAcknowledge
Definition: GtpLayer.h:522
@ CreateBearerRequest
Definition: GtpLayer.h:544
@ MMBSSessionStartRequest
Definition: GtpLayer.h:650
@ CreateIndirectDataTunnelRequest
Definition: GtpLayer.h:622
@ ForwardRelocationRequest
Definition: GtpLayer.h:574
@ CreateForwardingResponse
Definition: GtpLayer.h:612
@ DownlinkDataNotification
Definition: GtpLayer.h:634
@ CreateSessionResponse
Definition: GtpLayer.h:506
@ UpdatePDNConnectionRequest
Definition: GtpLayer.h:642
@ UpdateBearerRequest
Definition: GtpLayer.h:548
@ DeleteBearerResponse
Definition: GtpLayer.h:554
@ DeleteBearerCommand
Definition: GtpLayer.h:528
@ ForwardAccessNotification
Definition: GtpLayer.h:582
@ PGWRestartNotification
Definition: GtpLayer.h:638
@ PGWDownlinkAcknowledge
Definition: GtpLayer.h:562
@ IdentificationRequest
Definition: GtpLayer.h:564
@ DetachNotification
Definition: GtpLayer.h:592
@ ChangeNotificationRequest
Definition: GtpLayer.h:516
@ DeleteSessionResponse
Definition: GtpLayer.h:514
@ TraceSessionActivation
Definition: GtpLayer.h:538
@ ModifyAccessBearersResponse
Definition: GtpLayer.h:648
@ ReleaseAccessBearersResponse
Definition: GtpLayer.h:632
@ BearerResourceCommand
Definition: GtpLayer.h:532
@ ContextRequest
Definition: GtpLayer.h:568
@ BearerResourceFailure
Definition: GtpLayer.h:534
@ Unknown
Definition: GtpLayer.h:496
@ UpdatePDNConnectionResponse
Definition: GtpLayer.h:644
@ RANInformationRelay
Definition: GtpLayer.h:598
@ ReleaseAccessBearersRequest
Definition: GtpLayer.h:630
@ IdentificationResponse
Definition: GtpLayer.h:566
@ RemoteUEReportNotifications
Definition: GtpLayer.h:520
@ TraceSessionDeactivation
Definition: GtpLayer.h:540
@ DeleteIndirectDataTunnelRequest
Definition: GtpLayer.h:626
@ RelocationCancelRequest
Definition: GtpLayer.h:586
@ DownlinkDataAcknowledge
Definition: GtpLayer.h:636
@ ModifyBearerFailure
Definition: GtpLayer.h:526
@ DeletePDNRequest
Definition: GtpLayer.h:556
@ VersionNotSupported
Definition: GtpLayer.h:502
@ ForwardRelocationNotification
Definition: GtpLayer.h:578
@ CreateBearerResponse
Definition: GtpLayer.h:546
@ StopPagingIndication
Definition: GtpLayer.h:542
@ DeleteSessionRequest
Definition: GtpLayer.h:512
@ SuspendNotification
Definition: GtpLayer.h:614
@ ForwardRelocationResponse
Definition: GtpLayer.h:576
@ DeletePDNResponse
Definition: GtpLayer.h:558
@ ModifyBearerResponse
Definition: GtpLayer.h:510
@ RelocationCancelResponse
Definition: GtpLayer.h:588
@ MMBSSessionStopResponse
Definition: GtpLayer.h:660
@ PGWRestartAcknowledge
Definition: GtpLayer.h:640
@ ContextResponse
Definition: GtpLayer.h:570
@ MMBSSessionStartResponse
Definition: GtpLayer.h:652
@ ResumeAcknowledge
Definition: GtpLayer.h:620
@ ModifyBearerRequest
Definition: GtpLayer.h:508
@ AlertMMENotification
Definition: GtpLayer.h:600
@ ModifyAccessBearersRequest
Definition: GtpLayer.h:646
@ MMBSSessionStopRequest
Definition: GtpLayer.h:658
@ ForwardRelocationAcknowledge
Definition: GtpLayer.h:580
@ EchoRequest
Definition: GtpLayer.h:498
@ MMBSSessionUpdateResponse
Definition: GtpLayer.h:656
@ UEActivityAcknowledge
Definition: GtpLayer.h:606
@ ConfigurationTransferTunnel
Definition: GtpLayer.h:590
@ DetachAcknowledge
Definition: GtpLayer.h:594
@ ChangeNotificationResponse
Definition: GtpLayer.h:518
@ UEActivityNotification
Definition: GtpLayer.h:604
@ DownlinkDataNotificationFailure
Definition: GtpLayer.h:536
@ ModifyBearerCommand
Definition: GtpLayer.h:524
@ CreateIndirectDataTunnelResponse
Definition: GtpLayer.h:624
@ ISRStatus
Definition: GtpLayer.h:608
@ UpdateBearerResponse
Definition: GtpLayer.h:550
@ ResumeNotification
Definition: GtpLayer.h:618
@ CSPaging
Definition: GtpLayer.h:596
@ DeleteBearerRequest
Definition: GtpLayer.h:552
@ ForwardAccessAcknowledge
Definition: GtpLayer.h:584
@ DeleteIndirectDataTunnelResponse
Definition: GtpLayer.h:628
@ CreateSessionRequest
Definition: GtpLayer.h:504
@ AlertMMEAcknowledge
Definition: GtpLayer.h:602
std::string toString() const
constexpr GtpV2MessageType(Value value)
Definition: GtpLayer.h:670
static GtpV2MessageType fromUintValue(uint8_t value)
Definition: TLVData.h:419
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelTransportLayer
Definition: ProtocolType.h:372
const ProtocolType GTPv1
Definition: ProtocolType.h:218
const ProtocolType GTPv2
Definition: ProtocolType.h:358
GtpV1MessageType
Definition: GtpLayer.h:71
@ GtpV1_MessageTypeUnknown
Definition: GtpLayer.h:73
@ GtpV1_MBMSNotificationResponse
Definition: GtpLayer.h:161
@ GtpV1_DeletePDPContextResponse
Definition: GtpLayer.h:97
@ GtpV1_InitiatePDPContextActivationResponse
Definition: GtpLayer.h:101
@ GtpV1_RANInformationRelay
Definition: GtpLayer.h:157
@ GtpV1_MBMSSessionStopRequest
Definition: GtpLayer.h:191
@ GtpV1_MBMSSessionUpdateRequest
Definition: GtpLayer.h:195
@ GtpV1_SupportedExtensionsHeaderNotification
Definition: GtpLayer.h:113
@ GtpV1_PDUNotificationRejectRequest
Definition: GtpLayer.h:109
@ GtpV1_GPDU
Definition: GtpLayer.h:209
@ GtpV1_MBMSSessionUpdateResponse
Definition: GtpLayer.h:197
@ GtpV1_DeletePDPContextRequest
Definition: GtpLayer.h:95
@ GtpV1_InitiatePDPContextActivationRequest
Definition: GtpLayer.h:99
@ GtpV1_PDUNotificationRequest
Definition: GtpLayer.h:105
@ GtpV1_EchoRequest
Definition: GtpLayer.h:75
@ GtpV1_ForwardRelocationComplete
Definition: GtpLayer.h:141
@ GtpV1_MBMSRegistrationRequest
Definition: GtpLayer.h:179
@ GtpV1_MBMSNotificationRejectRequest
Definition: GtpLayer.h:163
@ GtpV1_SGSNContextAcknowledge
Definition: GtpLayer.h:135
@ GtpV1_MBMSSessionStartRequest
Definition: GtpLayer.h:187
@ GtpV1_DeleteMBMSNotificationRequest
Definition: GtpLayer.h:175
@ GtpV1_ForwardRelocationResponse
Definition: GtpLayer.h:139
@ GtpV1_NodeAliveResponse
Definition: GtpLayer.h:83
@ GtpV1_UERegistrationRequest
Definition: GtpLayer.h:153
@ GtpV1_ForwardSRNSContextAcknowledge
Definition: GtpLayer.h:151
@ GtpV1_MBMSNotificationRejectResponse
Definition: GtpLayer.h:165
@ GtpV1_UERegistrationResponse
Definition: GtpLayer.h:155
@ GtpV1_CreatePDPContextResponse
Definition: GtpLayer.h:89
@ GtpV1_FailureReportResponse
Definition: GtpLayer.h:121
@ GtpV1_NoteMSPresentResponse
Definition: GtpLayer.h:125
@ GtpV1_IdentificationRequest
Definition: GtpLayer.h:127
@ GtpV1_MBMSDeRegistrationResponse
Definition: GtpLayer.h:185
@ GtpV1_MSInfoChangeResponse
Definition: GtpLayer.h:201
@ GtpV1_ForwardRelocationCompleteAcknowledge
Definition: GtpLayer.h:149
@ GtpV1_UpdatePDPContextRequest
Definition: GtpLayer.h:91
@ GtpV1_SendRoutingforGPRSRequest
Definition: GtpLayer.h:115
@ GtpV1_PDUNotificationRejectResponse
Definition: GtpLayer.h:111
@ GtpV1_UpdatePDPContextResponse
Definition: GtpLayer.h:93
@ GtpV1_SendRoutingforGPRSResponse
Definition: GtpLayer.h:117
@ GtpV1_VersionNotSupported
Definition: GtpLayer.h:79
@ GtpV1_MSInfoChangeRequest
Definition: GtpLayer.h:199
@ GtpV1_ErrorIndication
Definition: GtpLayer.h:103
@ GtpV1_UpdateMBMSNotificationResponse
Definition: GtpLayer.h:173
@ GtpV1_RelocationCancelResponse
Definition: GtpLayer.h:145
@ GtpV1_DataRecordTransferRequest
Definition: GtpLayer.h:203
@ GtpV1_MBMSNotificationRequest
Definition: GtpLayer.h:159
@ GtpV1_MBMSSessionStartResponse
Definition: GtpLayer.h:189
@ GtpV1_FailureReportRequest
Definition: GtpLayer.h:119
@ GtpV1_CreateMBMSNotificationResponse
Definition: GtpLayer.h:169
@ GtpV1_MBMSDeRegistrationRequest
Definition: GtpLayer.h:183
@ GtpV1_CreateMBMSNotificationRequest
Definition: GtpLayer.h:167
@ GtpV1_DataRecordTransferResponse
Definition: GtpLayer.h:205
@ GtpV1_MBMSSessionStopResponse
Definition: GtpLayer.h:193
@ GtpV1_UpdateMBMSNotificationRequest
Definition: GtpLayer.h:171
@ GtpV1_SGSNContextRequest
Definition: GtpLayer.h:131
@ GtpV1_RedirectionRequest
Definition: GtpLayer.h:85
@ GtpV1_EndMarker
Definition: GtpLayer.h:207
@ GtpV1_IdentificationResponse
Definition: GtpLayer.h:129
@ GtpV1_EchoResponse
Definition: GtpLayer.h:77
@ GtpV1_RelocationCancelRequest
Definition: GtpLayer.h:143
@ GtpV1_NodeAliveRequest
Definition: GtpLayer.h:81
@ GtpV1_SGSNContextResponse
Definition: GtpLayer.h:133
@ GtpV1_ForwardRelocationRequest
Definition: GtpLayer.h:137
@ GtpV1_NoteMSPresentRequest
Definition: GtpLayer.h:123
@ GtpV1_MBMSRegistrationResponse
Definition: GtpLayer.h:181
@ GtpV1_DeleteMBMSNotificationResponse
Definition: GtpLayer.h:177
@ GtpV1_CreatePDPContextRequest
Definition: GtpLayer.h:87
@ GtpV1_ForwardSRNSContext
Definition: GtpLayer.h:147
@ GtpV1_PDUNotificationResponse
Definition: GtpLayer.h:107