1 #ifndef PACKETPP_DHCP_LAYER 2 #define PACKETPP_DHCP_LAYER 422 return getValueAs<uint32_t>();
434 setValue<uint32_t>(addr.
toInt(), valueOffset);
446 if (m_Data ==
nullptr || m_Data->recordLen - valueOffset < 1)
449 return std::string((
const char*)m_Data->recordValue + valueOffset, (
int)m_Data->recordLen - valueOffset);
463 size_t len = (size_t)m_Data->recordLen - (
size_t)valueOffset;
466 if (stringValue.length() < len)
467 len = stringValue.length();
469 memcpy(m_Data->recordValue + valueOffset, stringValue.data(), len);
477 if (m_Data ==
nullptr)
481 return sizeof(uint8_t);
483 return sizeof(uint8_t) * 2 + (
size_t)m_Data->recordLen;
488 if (m_Data ==
nullptr)
494 return m_Data->recordLen;
577 TLVRecordBuilder::operator=(other);
691 void setClientHardwareAddress(
const MacAddress& addr);
735 size_t getOptionsCount()
const;
765 bool removeAllOptions();
788 void computeCalculateFields();
790 std::string toString()
const;
796 uint8_t* getOptionsBasePtr()
const {
return m_Data +
sizeof(
dhcp_header); }
800 void initDhcpLayer(
size_t numOfBytesToAllocate);
Definition: DhcpLayer.h:156
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:333
Definition: DhcpLayer.h:276
Definition: DhcpLayer.h:300
Definition: DhcpLayer.h:326
Definition: DhcpLayer.h:172
Definition: DhcpLayer.h:332
Definition: DhcpLayer.h:230
IPv4Address getValueAsIpAddr() const
Definition: DhcpLayer.h:420
Definition: DhcpLayer.h:216
Definition: DhcpLayer.h:146
Definition: DhcpLayer.h:264
Definition: DhcpLayer.h:338
std::string getValueAsString(int valueOffset=0) const
Definition: DhcpLayer.h:444
Definition: DhcpLayer.h:302
Definition: DhcpLayer.h:110
Definition: DhcpLayer.h:360
Definition: DhcpLayer.h:210
Definition: DhcpLayer.h:362
Definition: DhcpLayer.h:266
DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue)
Definition: DhcpLayer.h:524
Definition: DhcpLayer.h:144
DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue)
Definition: DhcpLayer.h:533
Definition: DhcpLayer.h:370
Definition: DhcpLayer.h:378
Definition: DhcpLayer.h:83
Definition: DhcpLayer.h:386
Definition: DhcpLayer.h:91
Definition: ProtocolType.h:348
Definition: DhcpLayer.h:158
DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: DhcpLayer.h:515
Definition: DhcpLayer.h:282
Definition: TLVData.h:376
Definition: DhcpLayer.h:68
Definition: DhcpLayer.h:130
Definition: DhcpLayer.h:320
Definition: DhcpLayer.h:366
Definition: DhcpLayer.h:220
void setGatewayIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:678
Definition: DhcpLayer.h:228
Definition: DhcpLayer.h:87
Definition: DhcpLayer.h:318
Definition: DhcpLayer.h:206
IPv4Address getGatewayIpAddress() const
Definition: DhcpLayer.h:672
Definition: DhcpLayer.h:401
Definition: DhcpLayer.h:358
Definition: DhcpLayer.h:388
Definition: DhcpLayer.h:150
void setYourIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:667
Definition: DhcpLayer.h:344
Definition: DhcpLayer.h:120
Definition: DhcpLayer.h:322
Definition: DhcpLayer.h:346
Definition: DhcpLayer.h:384
Definition: DhcpLayer.h:314
Definition: DhcpLayer.h:246
Definition: DhcpLayer.h:250
void setValueIpAddr(const IPv4Address &addr, int valueOffset=0)
Definition: DhcpLayer.h:432
Definition: DhcpLayer.h:126
Definition: DhcpLayer.h:81
Definition: DhcpLayer.h:268
Definition: DhcpLayer.h:382
DhcpOptionTypes
Definition: DhcpLayer.h:99
Definition: DhcpLayer.h:336
Definition: DhcpLayer.h:364
Definition: DhcpLayer.h:354
Definition: DhcpLayer.h:284
Definition: DhcpLayer.h:234
Definition: TLVData.h:217
void parseNextLayer()
Definition: DhcpLayer.h:772
Definition: DhcpLayer.h:182
Definition: DhcpLayer.h:288
Definition: DhcpLayer.h:270
size_t getTotalSize() const
Definition: DhcpLayer.h:475
Definition: DhcpLayer.h:160
Definition: DhcpLayer.h:77
Definition: DhcpLayer.h:594
Definition: DhcpLayer.h:154
Definition: DhcpLayer.h:148
Definition: DhcpLayer.h:152
Definition: DhcpLayer.h:392
Definition: DhcpLayer.h:204
Definition: DhcpLayer.h:176
Definition: DhcpLayer.h:244
IPv4Address getYourIpAddress() const
Definition: DhcpLayer.h:661
Definition: DhcpLayer.h:260
Definition: DhcpLayer.h:356
Definition: DhcpLayer.h:114
Definition: DhcpLayer.h:376
BootpOpCodes getOpCode() const
Definition: DhcpLayer.h:634
Definition: DhcpLayer.h:208
Definition: DhcpLayer.h:294
DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string &optionValue)
Definition: DhcpLayer.h:560
Definition: DhcpLayer.h:202
Definition: DhcpLayer.h:374
BootpOpCodes
Definition: DhcpLayer.h:63
Definition: DhcpLayer.h:238
Definition: DhcpLayer.h:162
void setClientIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:645
dhcp_header * getDhcpHeader() const
Definition: DhcpLayer.h:629
Definition: IpAddress.h:42
Definition: DhcpLayer.h:272
Definition: DhcpLayer.h:106
Definition: DhcpLayer.h:124
virtual ~DhcpOption()
Definition: DhcpLayer.h:414
DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue)
Definition: DhcpLayer.h:542
Definition: DhcpLayer.h:298
Definition: DhcpLayer.h:142
Definition: DhcpLayer.h:198
Definition: DhcpLayer.h:104
Definition: DhcpLayer.h:258
size_t getHeaderLen() const
Definition: DhcpLayer.h:777
Definition: DhcpLayer.h:108
void setServerIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:656
Definition: DhcpLayer.h:132
Definition: DhcpLayer.h:312
Definition: DhcpLayer.h:242
Definition: DhcpLayer.h:352
Definition: DhcpLayer.h:200
Definition: DhcpLayer.h:226
Definition: DhcpLayer.h:372
Definition: DhcpLayer.h:188
DhcpMessageType
Definition: DhcpLayer.h:74
Definition: DhcpLayer.h:184
Definition: DhcpLayer.h:328
DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address &optionValue)
Definition: DhcpLayer.h:551
Definition: DhcpLayer.h:138
IPv4Address getClientIpAddress() const
Definition: DhcpLayer.h:639
Definition: DhcpLayer.h:224
Definition: DhcpLayer.h:252
Definition: DhcpLayer.h:390
Definition: DhcpLayer.h:66
DhcpOptionBuilder(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:567
Definition: DhcpLayer.h:232
Definition: DhcpLayer.h:214
Definition: DhcpLayer.h:140
Definition: DhcpLayer.h:122
Definition: DhcpLayer.h:306
Definition: DhcpLayer.h:178
Definition: DhcpLayer.h:192
Definition: DhcpLayer.h:340
Definition: DhcpLayer.h:324
Definition: DhcpLayer.h:212
Definition: DhcpLayer.h:85
Definition: DhcpLayer.h:296
Definition: DhcpLayer.h:504
Definition: DhcpLayer.h:278
Definition: DhcpLayer.h:348
Definition: DhcpLayer.h:290
Definition: DhcpLayer.h:240
Definition: DhcpLayer.h:118
Definition: DhcpLayer.h:368
Definition: DhcpLayer.h:128
Definition: DhcpLayer.h:310
Definition: DhcpLayer.h:248
size_t getDataSize() const
Definition: DhcpLayer.h:486
Definition: DhcpLayer.h:380
Definition: DhcpLayer.h:112
Definition: DhcpLayer.h:256
Definition: DhcpLayer.h:180
Definition: DhcpLayer.h:316
Definition: DhcpLayer.h:136
Definition: DhcpLayer.h:134
Definition: DhcpLayer.h:262
Definition: DhcpLayer.h:218
OsiModelLayer getOsiModelLayer() const
Definition: DhcpLayer.h:792
Definition: DhcpLayer.h:190
virtual ~DhcpLayer()
Definition: DhcpLayer.h:623
Definition: DhcpLayer.h:93
void setValueString(const std::string &stringValue, int valueOffset=0)
Definition: DhcpLayer.h:460
Definition: DhcpLayer.h:170
Definition: DhcpLayer.h:194
DhcpOptionBuilder & operator=(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:575
Definition: DhcpLayer.h:222
Definition: DhcpLayer.h:89
DhcpOption(uint8_t *optionRawData)
Definition: DhcpLayer.h:409
Definition: DhcpLayer.h:254
Definition: DhcpLayer.h:304
Definition: DhcpLayer.h:174
Definition: DhcpLayer.h:79
Definition: DhcpLayer.h:116
Definition: DhcpLayer.h:164
Definition: MacAddress.h:28
Definition: DhcpLayer.h:168
Definition: DhcpLayer.h:334
Definition: DhcpLayer.h:292
Definition: DhcpLayer.h:196
Definition: DhcpLayer.h:236
Definition: DhcpLayer.h:280
Definition: DhcpLayer.h:342
Definition: DhcpLayer.h:186
uint32_t toInt() const
Definition: IpAddress.h:181
IPv4Address getServerIpAddress() const
Definition: DhcpLayer.h:650
Definition: DhcpLayer.h:286
Definition: DhcpLayer.h:102
Definition: DhcpLayer.h:274
Definition: DhcpLayer.h:308
Definition: DhcpLayer.h:166
Definition: DhcpLayer.h:350
Definition: DhcpLayer.h:330