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 232 std::vector<IPv4Address> res;
241 uint8_t valueOffset = (uint8_t)(1);
243 while (valueOffset < dataSize)
246 memcpy(&curValue, m_Data->
recordValue + valueOffset,
sizeof(uint32_t));
252 valueOffset += (uint8_t)(4);
282 uint8_t valueOffset = (uint8_t)(2);
285 while (valueOffset < dataSize)
288 memcpy(&curValue, m_Data->
recordValue + valueOffset,
sizeof(uint32_t));
298 readIPAddr = !readIPAddr;
300 valueOffset += (uint8_t)(4);
326 return sizeof(uint8_t);
339 return (
size_t)m_Data->
recordLen - (2*
sizeof(uint8_t));
352 bool m_BuilderParamsValid;
366 TLVRecordBuilder((uint8_t)optionType, optionValue, optionValueLen) { m_BuilderParamsValid =
true; }
375 TLVRecordBuilder((uint8_t)optionType, optionValue) { m_BuilderParamsValid =
true; }
427 IPv4Layer(uint8_t* data,
size_t dataLen,
Layer* prevLayer,
Packet* packet,
bool setTotalLenAsDataLen);
598 int m_NumOfTrailingBytes;
599 int m_TempHeaderExtension;
602 void copyLayerData(
const IPv4Layer& other);
603 inline uint8_t* getOptionsBasePtr() {
return m_Data +
sizeof(
iphdr); }
604 IPv4Option addOptionAt(
const IPv4OptionBuilder& optionBuilder,
int offset);
605 void adjustOptionsTrailer(
size_t totalOptSize);
607 void initLayerInPacket(uint8_t* data,
size_t dataLen, Layer* prevLayer, Packet* packet,
bool setTotalLenAsDataLen);
Definition: IPv4Layer.h:70
Definition: IPv4Layer.h:98
Definition: IPv4Layer.h:64
Definition: IPv4Layer.h:84
uint8_t recordLen
Definition: TLVData.h:33
Definition: IPv4Layer.h:150
uint8_t recordType
Definition: TLVData.h:31
Definition: IPv4Layer.h:152
Definition: IPv4Layer.h:72
IPv4Layer & operator=(const IPv4Layer &other)
uint8_t typeOfService
Definition: IPv4Layer.h:37
Definition: IPv4Layer.h:82
Definition: IPv4Layer.h:130
iphdr * getIPv4Header()
Definition: IPv4Layer.h:456
Definition: TLVData.h:333
~IPv4Option()
Definition: IPv4Layer.h:222
void clear()
Definition: IPv4Layer.h:195
IPv4OptionBuilder(IPv4OptionTypes optionType, uint16_t optionValue)
Definition: IPv4Layer.h:374
Definition: IPv4Layer.h:176
uint8_t recordValue[]
Definition: TLVData.h:35
Definition: IPv4Layer.h:78
IPv4Option addOption(const IPv4OptionBuilder &optionBuilder)
Definition: IPv4Layer.h:68
Definition: IPv4Layer.h:126
Definition: IpAddress.h:113
IPv4Option getFirstOption()
Definition: IPv4Layer.h:178
uint8_t getFragmentFlags()
Definition: IPv4Layer.h:144
uint32_t ipSrc
Definition: IPv4Layer.h:51
Definition: IPv4Layer.h:138
IPv4Option(uint8_t *optionRawData)
Definition: IPv4Layer.h:217
uint16_t ipId
Definition: IPv4Layer.h:41
Definition: IPv4Layer.h:96
size_t getTotalSize() const
Definition: IPv4Layer.h:320
Definition: IPv4Layer.h:140
Definition: IPv4Layer.h:94
IPv4Option getOption(IPv4OptionTypes option)
Definition: IPv4Layer.h:404
Definition: IPv4Layer.h:134
Definition: IPv4Layer.h:114
Definition: IPv4Layer.h:164
Definition: IPv4Layer.h:80
Definition: TLVData.h:189
Definition: IPv4Layer.h:74
uint8_t internetHeaderLength
Definition: IPv4Layer.h:27
Definition: IPv4Layer.h:128
Definition: IPv4Layer.h:120
uint16_t fragmentOffset
Definition: IPv4Layer.h:43
void setDstIpAddress(const IPv4Address &ipAddr)
Definition: IPv4Layer.h:480
IPv4Option getNextOption(IPv4Option &option)
Definition: IPv4Layer.h:174
OsiModelLayer
Definition: ProtocolType.h:213
Definition: IPv4Layer.h:116
Definition: IPv4Layer.h:66
Definition: ProtocolType.h:220
std::vector< uint32_t > timestamps
Definition: IPv4Layer.h:187
Definition: IPv4Layer.h:86
IPv4Address getSrcIpAddress()
Definition: IPv4Layer.h:462
std::vector< IPv4Address > getValueAsIpList()
Definition: IPv4Layer.h:230
uint16_t headerChecksum
Definition: IPv4Layer.h:49
size_t getDataSize()
Definition: IPv4Layer.h:331
uint8_t timeToLive
Definition: IPv4Layer.h:45
IPv4OptionTypes getIPv4OptionType() const
Definition: IPv4Layer.h:309
IPv4Address getDstIpAddress()
Definition: IPv4Layer.h:474
std::vector< IPv4Address > ipAddresses
Definition: IPv4Layer.h:190
Definition: IPv4Layer.h:90
IPv4OptionBuilder(IPv4OptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: IPv4Layer.h:365
void setSrcIpAddress(const IPv4Address &ipAddr)
Definition: IPv4Layer.h:468
uint16_t totalLength
Definition: IPv4Layer.h:39
Definition: IPv4Layer.h:104
Definition: IPv4Layer.h:142
Definition: IPv4Layer.h:154
Definition: IPv4Layer.h:118
TimestampType type
Definition: IPv4Layer.h:184
Definition: IPv4Layer.h:122
uint8_t protocol
Definition: IPv4Layer.h:47
Definition: IPv4Layer.h:349
bool removeOption(IPv4OptionTypes option)
Definition: IPv4Layer.h:24
Definition: IPv4Layer.h:124
uint8_t ipVersion
Definition: IPv4Layer.h:27
Definition: IPv4Layer.h:136
Definition: IPv4Layer.h:180
TimestampType
Definition: IPv4Layer.h:171
IPv4TimestampOptionValue getTimestampOptionValue()
Definition: IPv4Layer.h:265
Definition: IPv4Layer.h:76
uint16_t getFragmentOffset()
Definition: IPv4Layer.h:92
void computeCalculateFields()
Definition: IPv4Layer.h:88
IPv4Option addOptionAfter(const IPv4OptionBuilder &optionBuilder, IPv4OptionTypes prevOptionType=IPV4OPT_Unknown)
Definition: IPv4Layer.h:148
Definition: IPv4Layer.h:209
Definition: IPv4Layer.h:132
IPProtocolTypes
Definition: IPv4Layer.h:61
Definition: IPv4Layer.h:100
The main namespace for the PcapPlusPlus lib.
Definition: IPv4Layer.h:146
size_t getHeaderLen()
Definition: IPv4Layer.h:582
OsiModelLayer getOsiModelLayer()
Definition: IPv4Layer.h:595
uint32_t ipDst
Definition: IPv4Layer.h:53
IPv4OptionTypes
Definition: IPv4Layer.h:111
Definition: IPv4Layer.h:102