|
PcapPlusPlus
19.12
|
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);
250 template<
class TLayer>
261 template<
class TLayer>
283 std::string
toString(
bool timeAsLocalTime =
true);
290 void toStringList(std::vector<std::string>& result,
bool timeAsLocalTime =
true)
const;
293 void copyDataFrom(
const Packet& other);
295 void destructPacketData();
297 bool extendLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToExtend);
298 bool shortenLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToShorten);
300 void reallocateRawData(
size_t newSize);
304 std::string printPacketInfo(
bool timeAsLocalTime)
const;
309 template<
class TLayer>
312 if (dynamic_cast<TLayer*>(m_FirstLayer) != NULL)
313 return (TLayer*)m_FirstLayer;
315 return getNextLayerOfType<TLayer>(m_FirstLayer);
318 template<
class TLayer>
325 while ((curLayer != NULL) && (dynamic_cast<TLayer*>(curLayer) == NULL))
330 return (TLayer*)curLayer;
OsiModelLayer
Definition: ProtocolType.h:224
Layer * getFirstLayer() const
Definition: Packet.h:134
Layer * getLastLayer() const
Definition: Packet.h:140
bool insertLayer(Layer *prevLayer, Layer *newLayer, bool ownInPacket=false)
void toStringList(std::vector< std::string > &result, bool timeAsLocalTime=true) const
bool removeAllLayersAfter(Layer *layer)
void setRawPacket(RawPacket *rawPacket, bool freeRawPacket, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
std::string toString(bool timeAsLocalTime=true)
ProtocolType
Definition: ProtocolType.h:16
Definition: ProtocolType.h:241
TLayer * getLayerOfType() const
Definition: Packet.h:310
TLayer * getNextLayerOfType(Layer *after) const
Definition: Packet.h:319
RawPacket * getRawPacketReadOnly() const
Definition: Packet.h:128
Packet(size_t maxPacketLen=1)
bool addLayer(Layer *newLayer, bool ownInPacket=false)
The main namespace for the PcapPlusPlus lib.
void computeCalculateFields()
bool isPacketOfType(ProtocolType protocolType) const
Definition: Packet.h:269
Definition: ProtocolType.h:21
LinkLayerType
Definition: RawPacket.h:24
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:219
Layer * getNextLayer() const
Definition: Layer.h:81