24 #if (BYTE_ORDER == LITTLE_ENDIAN)
182 template <
class TIPv6Extension> TIPv6Extension*
addExtension(
const TIPv6Extension& extensionHeader);
200 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen);
223 return sizeof(
ip6_hdr) + m_ExtensionsLen;
244 void parseExtensions();
245 void deleteExtensions();
249 size_t m_ExtensionsLen;
255 while (curExt !=
nullptr &&
dynamic_cast<TIPv6Extension*
>(curExt) ==
nullptr)
258 return static_cast<TIPv6Extension*
>(curExt);
263 int offsetToAddHeader =
static_cast<int>(
getHeaderLen());
264 if (!extendLayer(offsetToAddHeader, extensionHeader.getExtensionLen()))
269 TIPv6Extension* newHeader =
new TIPv6Extension(
this,
static_cast<size_t>(offsetToAddHeader));
270 (*newHeader) = extensionHeader;
272 if (m_FirstExtension !=
nullptr)
274 newHeader->getBaseHeader()->nextHeader = m_LastExtension->getBaseHeader()->nextHeader;
275 m_LastExtension->getBaseHeader()->nextHeader = newHeader->getExtensionType();
276 m_LastExtension->setNextHeader(newHeader);
277 m_LastExtension = newHeader;
281 m_FirstExtension = newHeader;
282 m_LastExtension = newHeader;
287 m_ExtensionsLen += newHeader->getExtensionLen();
296 return data && dataLen >=
sizeof(
ip6_hdr);
Definition: IpAddress.h:358
Definition: IpAddress.h:199
void copyTo(uint8_t **arr, size_t &length) const
Definition: IPv6Extensions.h:23
IPv6Extension * getNextHeader() const
Definition: IPv6Extensions.h:70
Definition: IPv6Layer.h:55
IPv6Address getSrcIPv6Address() const
Definition: IPv6Layer.h:118
IPAddress getDstIPAddress() const
Definition: IPv6Layer.h:146
std::string toString() const
IPv6Layer(const IPv6Address &srcIP, const IPv6Address &dstIP)
IPv6Layer(const IPv6Layer &other)
IPv6Address getDstIPv6Address() const
Definition: IPv6Layer.h:155
void removeAllExtensions()
OsiModelLayer getOsiModelLayer() const
Definition: IPv6Layer.h:237
TIPv6Extension * getExtensionOfType() const
Definition: IPv6Layer.h:252
ip6_hdr * getIPv6Header() const
Definition: IPv6Layer.h:99
void setDstIPv6Address(const IPv6Address &ipAddr)
Definition: IPv6Layer.h:136
IPv6Layer & operator=(const IPv6Layer &other)
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: IPv6Layer.h:294
void computeCalculateFields()
IPAddress getSrcIPAddress() const
Definition: IPv6Layer.h:109
void setSrcIPv6Address(const IPv6Address &ipAddr)
Definition: IPv6Layer.h:127
IPv6Layer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
size_t getExtensionCount() const
TIPv6Extension * addExtension(const TIPv6Extension &extensionHeader)
Definition: IPv6Layer.h:261
size_t getHeaderLen() const
Definition: IPv6Layer.h:221
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelNetworkLayer
Definition: ProtocolType.h:360
Definition: IPv6Layer.h:23
uint8_t trafficClass
Definition: IPv6Layer.h:26
uint8_t flowLabel[3]
Definition: IPv6Layer.h:36
uint8_t hopLimit
Definition: IPv6Layer.h:42
uint8_t ipSrc[16]
Definition: IPv6Layer.h:44
uint16_t payloadLength
Definition: IPv6Layer.h:38
uint8_t ipVersion
Definition: IPv6Layer.h:28
uint8_t nextHeader
Definition: IPv6Layer.h:40
uint8_t ipDst[16]
Definition: IPv6Layer.h:46