1 #ifndef PACKETPP_IPV6_LAYER 2 #define PACKETPP_IPV6_LAYER 9 #ifndef PCPP_DEPRECATED 10 #if defined(__GNUC__) || defined(__clang__) 11 #define PCPP_DEPRECATED __attribute__((deprecated)) 12 #elif defined(_MSC_VER) 13 #define PCPP_DEPRECATED __declspec(deprecated) 15 #pragma message("WARNING: DEPRECATED feature is not implemented for this compiler") 16 #define PCPP_DEPRECATED 35 #if (BYTE_ORDER == LITTLE_ENDIAN) 121 PCPP_DEPRECATED
IPv6Address getSrcIpAddress()
const {
return getSrcIPv6Address(); }
139 PCPP_DEPRECATED
IPv6Address getDstIpAddress()
const {
return getDstIPv6Address(); }
150 size_t getExtensionCount()
const;
157 template<
class TIPv6Extension>
158 TIPv6Extension* getExtensionOfType()
const;
169 template<
class TIPv6Extension>
170 TIPv6Extension* addExtension(
const TIPv6Extension& extensionHeader);
175 void removeAllExtensions();
180 bool isFragment()
const;
188 static inline bool isDataValid(
const uint8_t* data,
size_t dataLen);
205 void parseNextLayer();
218 void computeCalculateFields();
220 std::string toString()
const;
226 void parseExtensions();
227 void deleteExtensions();
231 size_t m_ExtensionsLen;
235 template<
class TIPv6Extension>
239 while (curExt != NULL && dynamic_cast<TIPv6Extension*>(curExt) == NULL)
242 return (TIPv6Extension*)curExt;
245 template<
class TIPv6Extension>
248 int offsetToAddHeader = (int)getHeaderLen();
249 if (!extendLayer(offsetToAddHeader, extensionHeader.getExtensionLen()))
254 TIPv6Extension* newHeader =
new TIPv6Extension(
this, (
size_t)offsetToAddHeader);
255 (*newHeader) = extensionHeader;
257 if (m_FirstExtension != NULL)
259 newHeader->getBaseHeader()->nextHeader = m_LastExtension->getBaseHeader()->nextHeader;
260 m_LastExtension->getBaseHeader()->nextHeader = newHeader->getExtensionType();
261 m_LastExtension->setNextHeader(newHeader);
262 m_LastExtension = newHeader;
266 m_FirstExtension = newHeader;
267 m_LastExtension = newHeader;
268 newHeader->getBaseHeader()->nextHeader = getIPv6Header()->nextHeader;
269 getIPv6Header()->nextHeader = newHeader->getExtensionType();
272 m_ExtensionsLen += newHeader->getExtensionLen();
281 return dataLen >=
sizeof(
ip6_hdr);
IPAddress getSrcIPAddress() const
Definition: IPv6Layer.h:116
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:253
Definition: IPv6Extensions.h:23
uint8_t ipSrc[16]
Definition: IPv6Layer.h:55
uint16_t payloadLength
Definition: IPv6Layer.h:49
TIPv6Extension * addExtension(const TIPv6Extension &extensionHeader)
Definition: IPv6Layer.h:246
Definition: IPv6Layer.h:34
Definition: IPv6Layer.h:66
uint8_t trafficClass
Definition: IPv6Layer.h:37
Definition: ProtocolType.h:260
uint8_t flowLabel[3]
Definition: IPv6Layer.h:47
uint8_t ipDst[16]
Definition: IPv6Layer.h:57
size_t getHeaderLen() const
Definition: IPv6Layer.h:210
Definition: IpAddress.h:160
uint8_t hopLimit
Definition: IPv6Layer.h:53
IPv6Extension * getNextHeader() const
Definition: IPv6Extensions.h:66
TIPv6Extension * getExtensionOfType() const
Definition: IPv6Layer.h:236
IPv6Address getDstIPv6Address() const
Definition: IPv6Layer.h:145
ip6_hdr * getIPv6Header() const
Definition: IPv6Layer.h:109
uint8_t ipVersion
Definition: IPv6Layer.h:37
static bool isDataValid(const uint8_t *data, size_t dataLen)
Definition: IPv6Layer.h:279
IPAddress getDstIPAddress() const
Definition: IPv6Layer.h:134
Definition: IpAddress.h:265
IPv6Address getSrcIPv6Address() const
Definition: IPv6Layer.h:127
OsiModelLayer getOsiModelLayer() const
Definition: IPv6Layer.h:222
uint8_t nextHeader
Definition: IPv6Layer.h:51