PcapPlusPlus
22.05
|
#include <PacketTrailerLayer.h>
Public Member Functions | |
PacketTrailerLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
uint8_t * | getTrailerData () const |
std::string | getTrailerDataAsHexString () const |
size_t | getTrailerLen () const |
void | parseNextLayer () |
size_t | getHeaderLen () const |
void | computeCalculateFields () |
std::string | toString () const |
OsiModelLayer | getOsiModelLayer () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () 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 |
A class for representing packet tailer (a.k.a footer or padding) which refers to supplemental data placed at the end of a block of data being stored or transmitted, which may contain information for the handling of the data block, or just mark its end (taken from Wikipedia: https://en.wikipedia.org/wiki/Trailer_(computing) )
There are various reasons for adding a packet trailer, one of the most famous is FCS (Frame check sequence) which refers to the extra error-detecting code added to a frame. Another usage is padding which means adding data to reach a minimum required packet length.
Although this layer inherits from the Layer class, it is not a standard layer in the sense that it can't be constructed by the user. This layer may be only be constructed in the Packet class, in the process of parsing the packet and creating the layers; if at the end of the parsing process there is data left that is not allocated to any layer, it's assumed to be the packet trailer and an instance of this class is created. This means this layer can only exist as the last layer in a packet, if a packet trailer indeed exists.
No layer can be added by the user after this layer (trying to do that will result with an error).
This layer can be removed by the user or extended/shortened, as any layer.
It also contains method to extract the trailer data
|
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 |
|
inlinevirtual |
Does nothing for this layer
Implements pcpp::Layer.
|
inlinevirtual |
Implements pcpp::Layer.
|
inlinevirtual |
Implements pcpp::Layer.
|
inline |
Get a pointer to the trailer data
std::string pcpp::PacketTrailerLayer::getTrailerDataAsHexString | ( | ) | const |
|
inline |
Get the trailer data length
|
inlinevirtual |
Does nothing for this layer (PacketTrailerLayer is always last)
Implements pcpp::Layer.
|
virtual |
Implements pcpp::Layer.