|
PcapPlusPlus
19.12
|
Go to the documentation of this file. 1 #ifndef PACKETPP_IPV4_LAYER
2 #define PACKETPP_IPV4_LAYER
25 #if (BYTE_ORDER == LITTLE_ENDIAN)
157 #define PCPP_IP_DONT_FRAGMENT 0x40
158 #define PCPP_IP_MORE_FRAGMENTS 0x20
233 std::vector<IPv4Address> res;
242 uint8_t valueOffset = (uint8_t)(1);
244 while (valueOffset < dataSize)
247 memcpy(&curValue, m_Data->
recordValue + valueOffset,
sizeof(uint32_t));
253 valueOffset += (uint8_t)(4);
283 uint8_t valueOffset = (uint8_t)(2);
286 while (valueOffset < dataSize)
289 memcpy(&curValue, m_Data->
recordValue + valueOffset,
sizeof(uint32_t));
299 readIPAddr = !readIPAddr;
301 valueOffset += (uint8_t)(4);
327 return sizeof(uint8_t);
340 return (
size_t)m_Data->
recordLen - (2*
sizeof(uint8_t));
353 bool m_BuilderParamsValid;
367 TLVRecordBuilder((uint8_t)optionType, optionValue, optionValueLen) { m_BuilderParamsValid =
true; }
376 TLVRecordBuilder((uint8_t)optionType, optionValue) { m_BuilderParamsValid =
true; }
428 IPv4Layer(uint8_t* data,
size_t dataLen,
Layer* prevLayer,
Packet* packet,
bool setTotalLenAsDataLen);
604 static bool isDataValid(
const uint8_t* data,
size_t dataLen);
607 int m_NumOfTrailingBytes;
608 int m_TempHeaderExtension;
611 void copyLayerData(
const IPv4Layer& other);
612 uint8_t* getOptionsBasePtr()
const {
return m_Data +
sizeof(
iphdr); }
613 IPv4Option addOptionAt(
const IPv4OptionBuilder& optionBuilder,
int offset);
614 void adjustOptionsTrailer(
size_t totalOptSize);
616 void initLayerInPacket(uint8_t* data,
size_t dataLen, Layer* prevLayer, Packet* packet,
bool setTotalLenAsDataLen);
Definition: IPv4Layer.h:76
OsiModelLayer
Definition: ProtocolType.h:224
Definition: IPv4Layer.h:154
Definition: IPv4Layer.h:70
Definition: IpAddress.h:119
std::vector< IPv4Address > ipAddresses
Definition: IPv4Layer.h:188
Definition: IPv4Layer.h:116
Definition: IPv4Layer.h:176
IPv4Option getFirstOption() const
Definition: IPv4Layer.h:96
Definition: IPv4Layer.h:98
uint16_t fragmentOffset
Definition: IPv4Layer.h:43
IPv4OptionTypes
Definition: IPv4Layer.h:111
size_t getTotalSize() const
Definition: IPv4Layer.h:321
bool removeOption(IPv4OptionTypes option)
Definition: IPv4Layer.h:130
Definition: IPv4Layer.h:138
TimestampType
Definition: IPv4Layer.h:169
Definition: IPv4Layer.h:126
std::string toString() const
Definition: IPv4Layer.h:148
Definition: IPv4Layer.h:152
void clear()
Definition: IPv4Layer.h:196
uint8_t recordType
Definition: TLVData.h:31
void setDstIpAddress(const IPv4Address &ipAddr)
Definition: IPv4Layer.h:481
size_t getOptionCount() const
OsiModelLayer getOsiModelLayer() const
Definition: IPv4Layer.h:596
Definition: IPv4Layer.h:164
uint8_t protocol
Definition: IPv4Layer.h:47
Definition: IPv4Layer.h:140
bool isLastFragment() const
std::vector< IPv4Address > getValueAsIpList() const
Definition: IPv4Layer.h:231
Definition: IPv4Layer.h:405
Definition: IPv4Layer.h:124
uint16_t headerChecksum
Definition: IPv4Layer.h:49
uint16_t getFragmentOffset() const
static bool isDataValid(const uint8_t *data, size_t dataLen)
void computeCalculateFields()
Definition: IPv4Layer.h:114
IPv4OptionBuilder(IPv4OptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: IPv4Layer.h:366
Definition: ProtocolType.h:231
Definition: IPv4Layer.h:80
Definition: IPv4Layer.h:146
std::vector< uint32_t > timestamps
Definition: IPv4Layer.h:185
TimestampType type
Definition: IPv4Layer.h:182
Definition: IPv4Layer.h:68
IPv4OptionTypes getIPv4OptionType() const
Definition: IPv4Layer.h:310
Definition: IPv4Layer.h:86
Definition: IPv4Layer.h:178
Definition: IPv4Layer.h:90
Definition: IPv4Layer.h:174
IPv4Address getDstIpAddress() const
Definition: IPv4Layer.h:475
Definition: IPv4Layer.h:118
Definition: IPv4Layer.h:88
size_t getDataSize() const
Definition: IPv4Layer.h:332
uint32_t ipSrc
Definition: IPv4Layer.h:51
IPProtocolTypes
Definition: IPv4Layer.h:61
size_t getHeaderLen() const
Definition: IPv4Layer.h:583
IPv4Option getOption(IPv4OptionTypes option) const
Definition: IPv4Layer.h:82
Definition: IPv4Layer.h:350
Definition: IPv4Layer.h:94
Definition: IPv4Layer.h:150
Definition: IPv4Layer.h:172
Definition: IPv4Layer.h:120
Definition: IPv4Layer.h:72
IPv4Option(uint8_t *optionRawData)
Definition: IPv4Layer.h:218
Definition: IPv4Layer.h:24
Definition: IPv4Layer.h:128
IPv4Option addOption(const IPv4OptionBuilder &optionBuilder)
uint16_t totalLength
Definition: IPv4Layer.h:39
~IPv4Option()
Definition: IPv4Layer.h:223
IPv4TimestampOptionValue()
Definition: IPv4Layer.h:191
bool isFirstFragment() const
uint8_t getFragmentFlags() const
Definition: IPv4Layer.h:210
Definition: IPv4Layer.h:136
iphdr * getIPv4Header() const
Definition: IPv4Layer.h:457
uint8_t internetHeaderLength
Definition: IPv4Layer.h:27
The main namespace for the PcapPlusPlus lib.
Definition: TLVData.h:351
IPv4Layer & operator=(const IPv4Layer &other)
uint32_t ipDst
Definition: IPv4Layer.h:53
Definition: IPv4Layer.h:78
Definition: IPv4Layer.h:100
Definition: TLVData.h:197
uint8_t timeToLive
Definition: IPv4Layer.h:45
uint8_t typeOfService
Definition: IPv4Layer.h:37
uint8_t recordValue[]
Definition: TLVData.h:35
Definition: IPv4Layer.h:92
Definition: IPv4Layer.h:84
IPv4TimestampOptionValue getTimestampOptionValue() const
Definition: IPv4Layer.h:266
Definition: IPv4Layer.h:64
uint16_t ipId
Definition: IPv4Layer.h:41
void setSrcIpAddress(const IPv4Address &ipAddr)
Definition: IPv4Layer.h:469
Definition: IPv4Layer.h:144
Definition: IPv4Layer.h:66
Definition: IPv4Layer.h:74
IPv4OptionBuilder(IPv4OptionTypes optionType, uint16_t optionValue)
Definition: IPv4Layer.h:375
Definition: IPv4Layer.h:104
Definition: IPv4Layer.h:134
uint8_t recordLen
Definition: TLVData.h:33
Definition: IPv4Layer.h:142
Definition: IPv4Layer.h:122
IPv4Option getNextOption(IPv4Option &option) const
Definition: IPv4Layer.h:102
IPv4Address getSrcIpAddress() const
Definition: IPv4Layer.h:463
IPv4Option addOptionAfter(const IPv4OptionBuilder &optionBuilder, IPv4OptionTypes prevOptionType=IPV4OPT_Unknown)
uint8_t ipVersion
Definition: IPv4Layer.h:27
Definition: IPv4Layer.h:132