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); }
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) { }
173 Layer(uint8_t* data,
size_t dataLen, Layer* prevLayer, Packet* packet) :
174 m_Data(data), m_DataLen(dataLen),
176 m_NextLayer(NULL), m_PrevLayer(prevLayer), m_IsAllocatedInPacket(false) {}
179 Layer(
const Layer& other);
180 Layer& operator=(
const Layer& other);
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);