1 #ifndef PACKETPP_PACKET 2 #define PACKETPP_PACKET 32 uint64_t m_ProtocolTypes;
33 size_t m_MaxPacketLen;
43 Packet(
size_t maxPacketLen = 1);
175 template<
class TLayer>
186 template<
class TLayer>
208 std::string
toString(
bool timeAsLocalTime =
true);
215 void toStringList(std::vector<std::string>& result,
bool timeAsLocalTime =
true);
218 void copyDataFrom(
const Packet& other);
220 void destructPacketData();
222 bool extendLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToExtend);
223 bool shortenLayer(
Layer* layer,
int offsetInLayer,
size_t numOfBytesToShorten);
225 void reallocateRawData(
size_t newSize);
227 std::string printPacketInfo(
bool timeAsLocalTime);
230 template<
class TLayer>
233 if (dynamic_cast<TLayer*>(m_FirstLayer) != NULL)
234 return (TLayer*)m_FirstLayer;
236 return getNextLayerOfType<TLayer>(m_FirstLayer);
239 template<
class TLayer>
246 while ((curLayer != NULL) && (dynamic_cast<TLayer*>(curLayer) == NULL))
251 return (TLayer*)curLayer;
bool removeLayer(Layer *layer)
bool isPacketOfType(ProtocolType protocolType)
Definition: Packet.h:194
void setRawPacket(RawPacket *rawPacket, bool freeRawPacket, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
TLayer * getNextLayerOfType(Layer *after)
Definition: Packet.h:240
TLayer * getLayerOfType()
Definition: Packet.h:231
Definition: RawPacket.h:220
Layer * getLastLayer()
Definition: Packet.h:139
The main namespace for the PcapPlusPlus lib.
Layer * getNextLayer()
Definition: Layer.h:81
Definition: ProtocolType.h:21
OsiModelLayer
Definition: ProtocolType.h:208
bool insertLayer(Layer *prevLayer, Layer *newLayer)
std::string toString(bool timeAsLocalTime=true)
bool addLayer(Layer *newLayer)
Packet(size_t maxPacketLen=1)
ProtocolType
Definition: ProtocolType.h:16
Layer * getFirstLayer()
Definition: Packet.h:133
RawPacket * getRawPacket()
Definition: Packet.h:110
Definition: ProtocolType.h:225
RawPacket * getRawPacketReadOnly() const
Definition: Packet.h:127
void toStringList(std::vector< std::string > &result, bool timeAsLocalTime=true)
Packet & operator=(const Packet &other)
void computeCalculateFields()