PcapPlusPlus  Next
PacketTrailerLayer.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include "Layer.h"
6 
7 namespace pcpp
8 {
31  class PacketTrailerLayer : public Layer
32  {
33  public:
40  PacketTrailerLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
41  : Layer(data, dataLen, prevLayer, packet, PacketTrailer)
42  {}
43 
44  ~PacketTrailerLayer() override = default;
45 
50  uint8_t* getTrailerData() const
51  {
52  return m_Data;
53  }
54 
58  std::string getTrailerDataAsHexString() const;
59 
64  size_t getTrailerLen() const
65  {
66  return m_DataLen;
67  }
68 
69  // implement abstract methods
70 
74  void parseNextLayer() override
75  {}
76 
80  size_t getHeaderLen() const override
81  {
82  return m_DataLen;
83  }
84 
88  void computeCalculateFields() override
89  {}
90 
91  std::string toString() const override;
92 
94  {
95  return OsiModelDataLinkLayer;
96  }
97  };
98 
99 } // namespace pcpp
Definition: Layer.h:69
Definition: Packet.h:27
Definition: PacketTrailerLayer.h:32
OsiModelLayer getOsiModelLayer() const override
Definition: PacketTrailerLayer.h:93
size_t getTrailerLen() const
Definition: PacketTrailerLayer.h:64
void parseNextLayer() override
Definition: PacketTrailerLayer.h:74
void computeCalculateFields() override
Definition: PacketTrailerLayer.h:88
std::string toString() const override
uint8_t * getTrailerData() const
Definition: PacketTrailerLayer.h:50
size_t getHeaderLen() const override
Definition: PacketTrailerLayer.h:80
std::string getTrailerDataAsHexString() const
PacketTrailerLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: PacketTrailerLayer.h:40
The main namespace for the PcapPlusPlus lib.
const ProtocolType PacketTrailer
Definition: ProtocolType.h:208
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelDataLinkLayer
Definition: ProtocolType.h:368