|
PcapPlusPlus
20.08
|
Go to the documentation of this file. 1 #ifndef PACKETPP_PACKET
2 #define PACKETPP_PACKET
33 uint64_t m_ProtocolTypes;
34 size_t m_MaxPacketLen;
44 Packet(
size_t maxPacketLen = 1);
89 virtual ~Packet() { destructPacketData(); }
251 template<
class TLayer>
262 template<
class TLayer>
273 template<
class TLayer>
295 std::string
toString(
bool timeAsLocalTime =
true);
302 void toStringList(std::vector<std::string>& result,
bool timeAsLocalTime =
true)
const;
305 void copyDataFrom(
const Packet& other);
307 void destructPacketData();
309 bool extendLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToExtend);
310 bool shortenLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToShorten);
312 void reallocateRawData(
size_t newSize);
316 std::string printPacketInfo(
bool timeAsLocalTime)
const;
324 template<
class TLayer>
342 template<
class TLayer>
345 if (curLayer == NULL)
349 while ((curLayer != NULL) && (
dynamic_cast<TLayer*
>(curLayer) == NULL))
354 return (TLayer*)curLayer;
357 template<
class TLayer>
360 if (curLayer == NULL)
364 while (curLayer != NULL &&
dynamic_cast<TLayer*
>(curLayer) == NULL)
369 return static_cast<TLayer*
>(curLayer);
OsiModelLayer
Definition: ProtocolType.h:233
Layer * getFirstLayer() const
Definition: Packet.h:134
Layer * getLastLayer() const
Definition: Packet.h:140
Layer * getLayerOfType(ProtocolType layerType, int index=0) const
bool insertLayer(Layer *prevLayer, Layer *newLayer, bool ownInPacket=false)
Packet(const Packet &other)
Definition: Packet.h:96
void toStringList(std::vector< std::string > &result, bool timeAsLocalTime=true) const
TLayer * getNextLayerOfType(Layer *startLayer) const
Definition: Packet.h:343
bool removeAllLayersAfter(Layer *layer)
bool detachLayer(Layer *layer)
Definition: Packet.h:234
virtual ~Packet()
Definition: Packet.h:89
TLayer * getPrevLayerOfType(Layer *startLayer) const
Definition: Packet.h:358
void setRawPacket(RawPacket *rawPacket, bool freeRawPacket, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
std::string toString(bool timeAsLocalTime=true)
uint64_t ProtocolType
Definition: ProtocolType.h:18
@ OsiModelLayerUnknown
Definition: ProtocolType.h:250
const ProtocolType UnknownProtocol
Definition: ProtocolType.h:23
RawPacket * getRawPacketReadOnly() const
Definition: Packet.h:128
Packet(size_t maxPacketLen=1)
bool addLayer(Layer *newLayer, bool ownInPacket=false)
Definition: Packet.h:151
The main namespace for the PcapPlusPlus lib.
void computeCalculateFields()
bool isPacketOfType(ProtocolType protocolType) const
Definition: Packet.h:281
LinkLayerType
Definition: RawPacket.h:25
Packet & operator=(const Packet &other)
RawPacket * getRawPacket() const
Definition: Packet.h:111
Layer * detachLayer(ProtocolType layerType, int index=0)
bool removeLayer(ProtocolType layerType, int index=0)
Definition: RawPacket.h:252
Layer * getNextLayer() const
Definition: Layer.h:81
Layer * getPrevLayer() const
Definition: Layer.h:86