30 virtual uint8_t*
getDataPtr(
size_t offset = 0)
const = 0;
155 return m_Packet !=
nullptr;
168 return static_cast<uint8_t*
>(m_Data + offset);
206 bool m_IsAllocatedInPacket;
209 : m_Data(nullptr), m_DataLen(0), m_Packet(nullptr), m_Protocol(
UnknownProtocol), m_NextLayer(nullptr),
210 m_PrevLayer(nullptr), m_IsAllocatedInPacket(false)
214 : m_Data(data), m_DataLen(dataLen), m_Packet(packet), m_Protocol(protocol), m_NextLayer(nullptr),
215 m_PrevLayer(prevLayer), m_IsAllocatedInPacket(false)
219 Layer(
const Layer& other);
220 Layer& operator=(
const Layer& other);
222 void setNextLayer(Layer* nextLayer)
224 m_NextLayer = nextLayer;
226 void setPrevLayer(Layer* prevLayer)
228 m_PrevLayer = prevLayer;
231 virtual bool extendLayer(
int offsetInLayer,
size_t numOfBytesToExtend);
232 virtual bool shortenLayer(
int offsetInLayer,
size_t numOfBytesToShorten);
237 inline std::ostream& operator<<(std::ostream& os,
const pcpp::Layer& layer)
virtual uint8_t * getDataPtr(size_t offset=0) const =0
void copyData(uint8_t *toArr) const
uint8_t * getLayerPayload() const
Definition: Layer.h:129
virtual std::string toString() const =0
size_t getDataLen() const
Definition: Layer.h:121
uint8_t * getDataPtr(size_t offset=0) const override
Definition: Layer.h:166
uint8_t * getData() const
Definition: Layer.h:113
virtual void parseNextLayer()=0
bool isMemberOfProtocolFamily(ProtocolTypeFamily protocolTypeFamily) const
Layer * getNextLayer() const
Definition: Layer.h:82
bool isAllocatedToPacket() const
Definition: Layer.h:153
Layer * getPrevLayer() const
Definition: Layer.h:90
ProtocolType getProtocol() const
Definition: Layer.h:98
size_t getLayerPayloadSize() const
Definition: Layer.h:137
virtual void computeCalculateFields()=0
virtual size_t getHeaderLen() const =0
virtual OsiModelLayer getOsiModelLayer() const =0
The main namespace for the PcapPlusPlus lib.
uint8_t ProtocolType
Definition: ProtocolType.h:17
OsiModelLayer
Definition: ProtocolType.h:364
uint32_t ProtocolTypeFamily
Definition: ProtocolType.h:23
const ProtocolType UnknownProtocol
Definition: ProtocolType.h:28