31 virtual uint8_t*
getDataPtr(
size_t offset = 0)
const = 0;
96 uint8_t*
getData()
const {
return m_Data; }
127 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);
size_t getLayerPayloadSize() const
Definition: Layer.h:111
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:253
uint8_t * getLayerPayload() const
Definition: Layer.h:106
uint8_t * getData() const
Definition: Layer.h:96
Layer * getNextLayer() const
Definition: Layer.h:81
size_t getDataLen() const
Definition: Layer.h:101
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:121
ProtocolType getProtocol() const
Definition: Layer.h:91
virtual uint8_t * getDataPtr(size_t offset=0) const =0
Layer * getPrevLayer() const
Definition: Layer.h:86