PcapPlusPlus  24.09
PayloadLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Layer.h"
4 
6 
11 namespace pcpp
12 {
13 
18  class PayloadLayer : public Layer
19  {
20  public:
27  PayloadLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet)
28  : Layer(data, dataLen, prevLayer, packet, GenericPayload)
29  {}
30 
36  PayloadLayer(const uint8_t* data, size_t dataLen);
37 
46  explicit PayloadLayer(const std::string& payloadAsHexStream);
47 
48  ~PayloadLayer()
49  {}
50 
55  uint8_t* getPayload() const
56  {
57  return m_Data;
58  }
59 
64  size_t getPayloadLen() const
65  {
66  return m_DataLen;
67  }
68 
69  // implement abstract methods
70 
75  {}
76 
80  size_t getHeaderLen() const
81  {
82  return m_DataLen;
83  }
84 
89  {}
90 
97  void setPayload(const uint8_t* newPayload, size_t newPayloadLength);
98 
99  std::string toString() const;
100 
102  {
104  }
105  };
106 
107 } // namespace pcpp
Definition: Layer.h:70
Definition: Packet.h:27
Definition: PayloadLayer.h:19
void computeCalculateFields()
Definition: PayloadLayer.h:88
uint8_t * getPayload() const
Definition: PayloadLayer.h:55
PayloadLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: PayloadLayer.h:27
PayloadLayer(const std::string &payloadAsHexStream)
void parseNextLayer()
Definition: PayloadLayer.h:74
size_t getHeaderLen() const
Definition: PayloadLayer.h:80
PayloadLayer(const uint8_t *data, size_t dataLen)
void setPayload(const uint8_t *newPayload, size_t newPayloadLength)
size_t getPayloadLen() const
Definition: PayloadLayer.h:64
OsiModelLayer getOsiModelLayer() const
Definition: PayloadLayer.h:101
std::string toString() const
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelApplicationLayer
Definition: ProtocolType.h:368
const ProtocolType GenericPayload
Definition: ProtocolType.h:178