31 virtual uint8_t*
getDataPtr(
size_t offset = 0)
const = 0;
97 uint8_t*
getData()
const {
return m_Data; }
128 void copyData(uint8_t* toArr)
const;
132 uint8_t*
getDataPtr(
size_t offset = 0)
const {
return (uint8_t*)(m_Data + offset); }
140 virtual void parseNextLayer() = 0;
145 virtual size_t getHeaderLen()
const = 0;
150 virtual void computeCalculateFields() = 0;
155 virtual std::string toString()
const = 0;
169 bool m_IsAllocatedInPacket;
171 Layer() : m_Data(NULL), m_DataLen(0), m_Packet(NULL), m_Protocol(
UnknownProtocol), m_NextLayer(NULL), m_PrevLayer(NULL), m_IsAllocatedInPacket(
false) { }
174 m_Data(data), m_DataLen(dataLen),
176 m_NextLayer(NULL), m_PrevLayer(prevLayer), m_IsAllocatedInPacket(
false) {}
182 void setNextLayer(
Layer* nextLayer) { m_NextLayer = nextLayer; }
183 void setPrevLayer(
Layer* prevLayer) { m_PrevLayer = prevLayer; }
185 virtual bool extendLayer(
int offsetInLayer,
size_t numOfBytesToExtend);
186 virtual bool shortenLayer(
int offsetInLayer,
size_t numOfBytesToShorten);
191 inline std::ostream& operator<<(std::ostream& os,
const pcpp::Layer &layer)
size_t getLayerPayloadSize() const
Definition: Layer.h:112
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:298
uint8_t * getLayerPayload() const
Definition: Layer.h:107
uint8_t * getData() const
Definition: Layer.h:97
Layer * getNextLayer() const
Definition: Layer.h:82
size_t getDataLen() const
Definition: Layer.h:102
uint8_t * getDataPtr(size_t offset=0) const
Definition: Layer.h:132
const ProtocolType UnknownProtocol
Definition: ProtocolType.h:23
uint64_t ProtocolType
Definition: ProtocolType.h:18
bool isAllocatedToPacket() const
Definition: Layer.h:122
ProtocolType getProtocol() const
Definition: Layer.h:92
virtual std::string toString() const =0
virtual uint8_t * getDataPtr(size_t offset=0) const =0
Layer * getPrevLayer() const
Definition: Layer.h:87