PcapPlusPlus  20.08
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 */
pcpp::OsiModelLayer
OsiModelLayer
Definition: ProtocolType.h:233
pcpp::Packet
Definition: Packet.h:26
pcpp::PayloadLayer
Definition: PayloadLayer.h:19
pcpp::OsiModelApplicationLayer
@ OsiModelApplicationLayer
Definition: ProtocolType.h:248
Layer.h
pcpp::PayloadLayer::getOsiModelLayer
OsiModelLayer getOsiModelLayer() const
Definition: PayloadLayer.h:88
pcpp::GenericPayload
const ProtocolType GenericPayload
Definition: ProtocolType.h:173
pcpp::PayloadLayer::setPayload
void setPayload(const uint8_t *newPayload, size_t newPayloadLength)
pcpp::PayloadLayer::getHeaderLen
size_t getHeaderLen() const
Definition: PayloadLayer.h:72
pcpp::PayloadLayer::computeCalculateFields
void computeCalculateFields()
Definition: PayloadLayer.h:77
pcpp::PayloadLayer::getPayloadLen
size_t getPayloadLen() const
Definition: PayloadLayer.h:60
pcpp
The main namespace for the PcapPlusPlus lib.
pcpp::Layer
Definition: Layer.h:70
pcpp::PayloadLayer::PayloadLayer
PayloadLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: PayloadLayer.h:28
pcpp::PayloadLayer::parseNextLayer
void parseNextLayer()
Definition: PayloadLayer.h:67
pcpp::PayloadLayer::toString
std::string toString() const
pcpp::PayloadLayer::getPayload
uint8_t * getPayload() const
Definition: PayloadLayer.h:54