1 #ifndef PACKETPP_PACKET 2 #define PACKETPP_PACKET 32 uint64_t m_ProtocolTypes;
33 size_t m_MaxPacketLen;
43 Packet(
size_t maxPacketLen = 1);
249 template<
class TLayer>
260 template<
class TLayer>
282 std::string
toString(
bool timeAsLocalTime =
true);
289 void toStringList(std::vector<std::string>& result,
bool timeAsLocalTime =
true);
292 void copyDataFrom(
const Packet& other);
294 void destructPacketData();
296 bool extendLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToExtend);
297 bool shortenLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToShorten);
299 void reallocateRawData(
size_t newSize);
303 std::string printPacketInfo(
bool timeAsLocalTime);
308 template<
class TLayer>
311 if (dynamic_cast<TLayer*>(m_FirstLayer) != NULL)
312 return (TLayer*)m_FirstLayer;
314 return getNextLayerOfType<TLayer>(m_FirstLayer);
317 template<
class TLayer>
324 while ((curLayer != NULL) && (dynamic_cast<TLayer*>(curLayer) == NULL))
329 return (TLayer*)curLayer;
std::string toString(bool timeAsLocalTime=true)
Definition: ProtocolType.h:21
bool insertLayer(Layer *prevLayer, Layer *newLayer, bool ownInPacket=false)
Layer * getLastLayer()
Definition: Packet.h:139
void setRawPacket(RawPacket *rawPacket, bool freeRawPacket, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
bool addLayer(Layer *newLayer, bool ownInPacket=false)
TLayer * getNextLayerOfType(Layer *after)
Definition: Packet.h:318
bool removeAllLayersAfter(Layer *layer)
Layer * detachLayer(ProtocolType layerType, int index=0)
Definition: RawPacket.h:219
Packet & operator=(const Packet &other)
RawPacket * getRawPacketReadOnly() const
Definition: Packet.h:127
Layer * getFirstLayer()
Definition: Packet.h:133
OsiModelLayer
Definition: ProtocolType.h:213
Layer * getNextLayer()
Definition: Layer.h:81
Definition: ProtocolType.h:230
RawPacket * getRawPacket()
Definition: Packet.h:110
void computeCalculateFields()
ProtocolType
Definition: ProtocolType.h:16
bool isPacketOfType(ProtocolType protocolType)
Definition: Packet.h:268
Packet(size_t maxPacketLen=1)
void toStringList(std::vector< std::string > &result, bool timeAsLocalTime=true)
The main namespace for the PcapPlusPlus lib.
LinkLayerType
Definition: RawPacket.h:24
bool removeLayer(ProtocolType layerType, int index=0)
TLayer * getLayerOfType()
Definition: Packet.h:309