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 dynamic_cast<TLayer*
>(curLayer);
357 template<
class TLayer>
360 if (curLayer == NULL)
364 while (curLayer != NULL && dynamic_cast<TLayer*>(curLayer) == NULL)
369 return dynamic_cast<TLayer*
>(curLayer);
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:253
void toStringList(std::vector< std::string > &result, bool timeAsLocalTime=true) const
TLayer * getNextLayerOfType(Layer *startLayer) const
Definition: Packet.h:343
Layer * getNextLayer() const
Definition: Layer.h:81
Definition: RawPacket.h:252
Packet(const Packet &other)
Definition: Packet.h:96
Layer * getFirstLayer() const
Definition: Packet.h:134
bool insertLayer(Layer *prevLayer, Layer *newLayer, bool ownInPacket=false)
RawPacket * getRawPacket() const
Definition: Packet.h:111
bool removeAllLayersAfter(Layer *layer)
const ProtocolType UnknownProtocol
Definition: ProtocolType.h:23
Definition: ProtocolType.h:270
virtual ~Packet()
Definition: Packet.h:89
uint64_t ProtocolType
Definition: ProtocolType.h:18
Layer * getLastLayer() const
Definition: Packet.h:140
bool addLayer(Layer *newLayer, bool ownInPacket=false)
Definition: Packet.h:151
Packet(size_t maxPacketLen=1)
Layer * getLayerOfType(ProtocolType layerType, int index=0) const
void computeCalculateFields()
std::string toString(bool timeAsLocalTime=true)
void setRawPacket(RawPacket *rawPacket, bool freeRawPacket, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
LinkLayerType
Definition: RawPacket.h:25
bool isPacketOfType(ProtocolType protocolType) const
Definition: Packet.h:281
Layer * detachLayer(ProtocolType layerType, int index=0)
RawPacket * getRawPacketReadOnly() const
Definition: Packet.h:128
Packet & operator=(const Packet &other)
bool detachLayer(Layer *layer)
Definition: Packet.h:234
Layer * getPrevLayer() const
Definition: Layer.h:86
TLayer * getPrevLayerOfType(Layer *startLayer) const
Definition: Packet.h:358
bool removeLayer(ProtocolType layerType, int index=0)