PcapPlusPlus
Next
|
#include <GtpLayer.h>
Classes | |
class | GtpExtension |
Public Member Functions | |
GtpV1Layer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
GtpV1Layer (GtpV1MessageType messageType, uint32_t teid) | |
GtpV1Layer (GtpV1MessageType messageType, uint32_t teid, bool setSeqNum, uint16_t seqNum, bool setNpduNum, uint8_t npduNum) | |
gtpv1_header * | getHeader () const |
bool | getSequenceNumber (uint16_t &seqNumber) const |
bool | setSequenceNumber (uint16_t seqNumber) |
bool | getNpduNumber (uint8_t &npduNum) const |
bool | setNpduNumber (uint8_t npduNum) |
bool | getNextExtensionHeaderType (uint8_t &nextExtType) const |
GtpExtension | getNextExtension () const |
GtpExtension | addExtension (uint8_t extensionType, uint16_t extensionContent) |
GtpV1MessageType | getMessageType () const |
std::string | getMessageTypeAsString () const |
bool | isGTPUMessage () const |
bool | isGTPCMessage () const |
void | parseNextLayer () override |
Identifies the following next layers for GTP-U packets: IPv4Layer, IPv6Layer. Otherwise sets PayloadLayer. | |
size_t | getHeaderLen () const override |
void | computeCalculateFields () override |
std::string | toString () const override |
OsiModelLayer | getOsiModelLayer () const override |
![]() | |
~Layer () override | |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
bool | isMemberOfProtocolFamily (ProtocolTypeFamily protocolTypeFamily) const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const override |
Static Public Member Functions | |
static bool | isGTPv1 (const uint8_t *data, size_t dataSize) |
static bool | isGTPv1Port (uint16_t port) |
Additional Inherited Members | |
![]() | |
template<typename T , typename... Args> | |
Layer * | constructNextLayer (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
template<typename T , typename TFallback , typename... Args> | |
Layer * | tryConstructNextLayerWithFallback (uint8_t *data, size_t dataLen, Packet *packet, Args &&... extraArgs) |
![]() | |
template<typename T > | |
static bool | canReinterpretAs (const uint8_t *data, size_t dataLen) |
Check if the data is large enough to reinterpret as a type. More... | |
A class representing the GTP v1 protocol.
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
pcpp::GtpV1Layer::GtpV1Layer | ( | GtpV1MessageType | messageType, |
uint32_t | teid | ||
) |
A constructor that creates a new GTPv1 layer and sets the message type and the TEID value
[in] | messageType | The GTPv1 message type to be set in the newly created layer |
[in] | teid | The TEID value to be set in the newly created layer |
pcpp::GtpV1Layer::GtpV1Layer | ( | GtpV1MessageType | messageType, |
uint32_t | teid, | ||
bool | setSeqNum, | ||
uint16_t | seqNum, | ||
bool | setNpduNum, | ||
uint8_t | npduNum | ||
) |
A constructor that creates a new GTPv1 layer and sets various parameters
[in] | messageType | The GTPv1 message type to be set in the newly created layer |
[in] | teid | The TEID value to be set in the newly created layer |
[in] | setSeqNum | A flag indicating whether to set a sequence number. If set to "false" then the parameter "seqNum" will be ignored |
[in] | seqNum | The sequence number to be set in the newly created later. If "setSeqNum" is set to false this parameter will be ignored |
[in] | setNpduNum | A flag indicating whether to set the N-PDU number. If set to "false" then the parameter "npduNum" will be ignored |
[in] | npduNum | The N-PDU number to be set in the newly created later. If "setNpduNum" is set to false this parameter will be ignored |
GtpExtension pcpp::GtpV1Layer::addExtension | ( | uint8_t | extensionType, |
uint16_t | extensionContent | ||
) |
Add a GTPv1 header extension. It is assumed that the extension is 4 bytes in length and its content is 2 bytes in length. If you need a different content size please reach out to me. This method takes care of extending the layer to make room for the new extension and also sets the relevant flags and fields
[in] | extensionType | The type of the new extension |
[in] | extensionContent | A 2-byte long content |
|
overridevirtual |
|
inline |
|
overridevirtual |
Implements pcpp::Layer.
GtpV1MessageType pcpp::GtpV1Layer::getMessageType | ( | ) | const |
std::string pcpp::GtpV1Layer::getMessageTypeAsString | ( | ) | const |
GtpExtension pcpp::GtpV1Layer::getNextExtension | ( | ) | const |
bool pcpp::GtpV1Layer::getNextExtensionHeaderType | ( | uint8_t & | nextExtType | ) | const |
Get the type of the next header extension if exists on the message (extensions are optional in GTP messages)
[out] | nextExtType | Set with the next header extension type if exists in layer. Otherwise remains unchanged |
bool pcpp::GtpV1Layer::getNpduNumber | ( | uint8_t & | npduNum | ) | const |
Get the N-PDU number if exists on the message (N-PDU number is an optional field in GTP messages)
[out] | npduNum | Set with the N-PDU number value if exists in the layer. Otherwise remains unchanged |
|
inlineoverridevirtual |
Implements pcpp::Layer.
bool pcpp::GtpV1Layer::getSequenceNumber | ( | uint16_t & | seqNumber | ) | const |
Get the sequence number if exists on the message (sequence number is an optional field in GTP messages)
[out] | seqNumber | Set with the sequence number value if exists in the layer. Otherwise remains unchanged |
bool pcpp::GtpV1Layer::isGTPCMessage | ( | ) | const |
bool pcpp::GtpV1Layer::isGTPUMessage | ( | ) | const |
|
static |
A static method that takes a byte array and detects whether it is a GTP v1 message
[in] | data | A byte array |
[in] | dataSize | The byte array size (in bytes) |
|
inlinestatic |
A static method that checks whether the port is considered as GTPv1
[in] | port | The port number to be checked |
bool pcpp::GtpV1Layer::setNpduNumber | ( | uint8_t | npduNum | ) |
Set an N-PDU number
[in] | npduNum | The N-PDU number to set |
bool pcpp::GtpV1Layer::setSequenceNumber | ( | uint16_t | seqNumber | ) |
Set a sequence number
[in] | seqNumber | The sequence number to set |
|
overridevirtual |
Implements pcpp::Layer.