PcapPlusPlus  21.05
PayloadLayer.h
Go to the documentation of this file.
1 #ifndef PACKETPP_PAYLOAD_LAYER
2 #define PACKETPP_PAYLOAD_LAYER
3 
4 #include "Layer.h"
5 
7 
12 namespace pcpp
13 {
14 
19  class PayloadLayer : public Layer
20  {
21  public:
28  PayloadLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet) : Layer(data, dataLen, prevLayer, packet) { m_Protocol = GenericPayload; }
29 
37  PayloadLayer(const uint8_t* data, size_t dataLen, bool dummy);
38 
46  PayloadLayer(const std::string& payloadAsHexStream);
47 
48  ~PayloadLayer() {}
49 
54  uint8_t* getPayload() const { return m_Data; }
55 
60  size_t getPayloadLen() const { return m_DataLen; }
61 
62  // implement abstract methods
63 
67  void parseNextLayer() {}
68 
72  size_t getHeaderLen() const { return m_DataLen; }
73 
78 
84  void setPayload(const uint8_t* newPayload, size_t newPayloadLength);
85 
86  std::string toString() const;
87 
89 
90  };
91 
92 } // namespace pcpp
93 
94 #endif /* PACKETPP_PAYLOAD_LAYER */
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:253
void setPayload(const uint8_t *newPayload, size_t newPayloadLength)
void parseNextLayer()
Definition: PayloadLayer.h:67
size_t getHeaderLen() const
Definition: PayloadLayer.h:72
const ProtocolType GenericPayload
Definition: ProtocolType.h:173
Definition: ProtocolType.h:268
Definition: Layer.h:70
Definition: Packet.h:26
PayloadLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: PayloadLayer.h:28
Definition: PayloadLayer.h:19
std::string toString() const
uint8_t * getPayload() const
Definition: PayloadLayer.h:54
size_t getPayloadLen() const
Definition: PayloadLayer.h:60
void computeCalculateFields()
Definition: PayloadLayer.h:77
OsiModelLayer getOsiModelLayer() const
Definition: PayloadLayer.h:88