1 #ifndef PACKETPP_DHCP_LAYER 2 #define PACKETPP_DHCP_LAYER 10 #ifndef PCPP_DEPRECATED 11 #if defined(__GNUC__) || defined(__clang__) 12 #define PCPP_DEPRECATED __attribute__((deprecated)) 13 #elif defined(_MSC_VER) 14 #define PCPP_DEPRECATED __declspec(deprecated) 16 #pragma message("WARNING: DEPRECATED feature is not implemented for this compiler") 17 #define PCPP_DEPRECATED 433 return getValueAs<uint32_t>();
445 setValue<uint32_t>(addr.
toInt(), valueOffset);
457 if (m_Data->recordLen - valueOffset < 1)
460 return std::string((
const char*)m_Data->recordValue + valueOffset, (
int)m_Data->recordLen - valueOffset);
474 size_t len = (size_t)m_Data->recordLen - (
size_t)valueOffset;
477 if (stringValue.length() < len)
478 len = stringValue.length();
480 memcpy(m_Data->recordValue + valueOffset, stringValue.data(), len);
489 return sizeof(uint8_t);
491 return sizeof(uint8_t) * 2 + (
size_t)m_Data->recordLen;
499 return m_Data->recordLen;
582 TLVRecordBuilder::operator=(other);
696 void setClientHardwareAddress(
const MacAddress& addr);
750 size_t getOptionsCount()
const;
780 bool removeAllOptions();
803 void computeCalculateFields();
805 std::string toString()
const;
811 uint8_t* getOptionsBasePtr()
const {
return m_Data +
sizeof(
dhcp_header); }
815 void initDhcpLayer(
size_t numOfBytesToAllocate);
Definition: DhcpLayer.h:167
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:263
Definition: DhcpLayer.h:287
Definition: DhcpLayer.h:311
Definition: DhcpLayer.h:337
Definition: DhcpLayer.h:183
Definition: DhcpLayer.h:343
Definition: DhcpLayer.h:241
IPv4Address getValueAsIpAddr() const
Definition: DhcpLayer.h:431
Definition: DhcpLayer.h:227
Definition: DhcpLayer.h:157
Definition: DhcpLayer.h:275
Definition: DhcpLayer.h:349
std::string getValueAsString(int valueOffset=0) const
Definition: DhcpLayer.h:455
Definition: DhcpLayer.h:313
Definition: DhcpLayer.h:121
Definition: DhcpLayer.h:371
Definition: DhcpLayer.h:221
Definition: DhcpLayer.h:373
Definition: DhcpLayer.h:277
DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue)
Definition: DhcpLayer.h:529
Definition: DhcpLayer.h:155
DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue)
Definition: DhcpLayer.h:538
Definition: DhcpLayer.h:381
Definition: DhcpLayer.h:389
Definition: DhcpLayer.h:94
Definition: DhcpLayer.h:397
Definition: DhcpLayer.h:102
Definition: ProtocolType.h:278
Definition: DhcpLayer.h:169
DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: DhcpLayer.h:520
Definition: DhcpLayer.h:293
Definition: TLVData.h:363
Definition: DhcpLayer.h:79
Definition: DhcpLayer.h:141
Definition: DhcpLayer.h:331
Definition: DhcpLayer.h:377
Definition: DhcpLayer.h:231
void setGatewayIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:683
Definition: DhcpLayer.h:239
Definition: DhcpLayer.h:98
Definition: DhcpLayer.h:329
Definition: DhcpLayer.h:217
IPv4Address getGatewayIpAddress() const
Definition: DhcpLayer.h:677
Definition: DhcpLayer.h:412
Definition: DhcpLayer.h:369
Definition: DhcpLayer.h:399
Definition: DhcpLayer.h:161
void setYourIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:672
Definition: DhcpLayer.h:355
Definition: DhcpLayer.h:131
Definition: DhcpLayer.h:333
Definition: DhcpLayer.h:357
Definition: DhcpLayer.h:395
Definition: DhcpLayer.h:325
Definition: DhcpLayer.h:257
Definition: DhcpLayer.h:261
void setValueIpAddr(const IPv4Address &addr, int valueOffset=0)
Definition: DhcpLayer.h:443
Definition: DhcpLayer.h:137
Definition: DhcpLayer.h:92
Definition: DhcpLayer.h:279
Definition: DhcpLayer.h:393
DhcpOptionTypes
Definition: DhcpLayer.h:110
Definition: DhcpLayer.h:347
Definition: DhcpLayer.h:375
Definition: DhcpLayer.h:365
Definition: DhcpLayer.h:295
Definition: DhcpLayer.h:245
Definition: TLVData.h:207
void parseNextLayer()
Definition: DhcpLayer.h:787
Definition: DhcpLayer.h:193
Definition: DhcpLayer.h:299
Definition: DhcpLayer.h:281
size_t getTotalSize() const
Definition: DhcpLayer.h:486
Definition: DhcpLayer.h:171
Definition: DhcpLayer.h:88
Definition: DhcpLayer.h:599
Definition: DhcpLayer.h:165
Definition: DhcpLayer.h:159
Definition: DhcpLayer.h:163
Definition: DhcpLayer.h:403
Definition: DhcpLayer.h:215
Definition: DhcpLayer.h:187
Definition: DhcpLayer.h:255
IPv4Address getYourIpAddress() const
Definition: DhcpLayer.h:666
Definition: DhcpLayer.h:271
Definition: DhcpLayer.h:367
Definition: DhcpLayer.h:125
Definition: DhcpLayer.h:387
BootpOpCodes getOpCode() const
Definition: DhcpLayer.h:639
Definition: DhcpLayer.h:219
Definition: DhcpLayer.h:305
DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string &optionValue)
Definition: DhcpLayer.h:565
Definition: DhcpLayer.h:213
Definition: DhcpLayer.h:385
BootpOpCodes
Definition: DhcpLayer.h:74
Definition: DhcpLayer.h:249
Definition: DhcpLayer.h:173
void setClientIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:650
dhcp_header * getDhcpHeader() const
Definition: DhcpLayer.h:634
Definition: IpAddress.h:27
Definition: DhcpLayer.h:283
Definition: DhcpLayer.h:117
Definition: DhcpLayer.h:135
virtual ~DhcpOption()
Definition: DhcpLayer.h:425
DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue)
Definition: DhcpLayer.h:547
Definition: DhcpLayer.h:309
Definition: DhcpLayer.h:153
Definition: DhcpLayer.h:209
Definition: DhcpLayer.h:115
Definition: DhcpLayer.h:269
size_t getHeaderLen() const
Definition: DhcpLayer.h:792
Definition: DhcpLayer.h:119
void setServerIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:661
Definition: DhcpLayer.h:143
Definition: DhcpLayer.h:323
Definition: DhcpLayer.h:253
Definition: DhcpLayer.h:363
Definition: DhcpLayer.h:211
Definition: DhcpLayer.h:237
Definition: DhcpLayer.h:383
bool setMesageType(DhcpMessageType msgType)
Definition: DhcpLayer.h:712
Definition: DhcpLayer.h:199
DhcpMessageType
Definition: DhcpLayer.h:85
Definition: DhcpLayer.h:195
Definition: DhcpLayer.h:339
DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address &optionValue)
Definition: DhcpLayer.h:556
Definition: DhcpLayer.h:149
IPv4Address getClientIpAddress() const
Definition: DhcpLayer.h:644
Definition: DhcpLayer.h:235
Definition: DhcpLayer.h:263
Definition: DhcpLayer.h:401
Definition: DhcpLayer.h:77
DhcpOptionBuilder(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:572
Definition: DhcpLayer.h:243
Definition: DhcpLayer.h:225
Definition: DhcpLayer.h:151
Definition: DhcpLayer.h:133
Definition: DhcpLayer.h:317
Definition: DhcpLayer.h:189
Definition: DhcpLayer.h:203
Definition: DhcpLayer.h:351
Definition: DhcpLayer.h:335
Definition: DhcpLayer.h:223
Definition: DhcpLayer.h:96
Definition: DhcpLayer.h:307
Definition: DhcpLayer.h:509
Definition: DhcpLayer.h:289
Definition: DhcpLayer.h:359
Definition: DhcpLayer.h:301
Definition: DhcpLayer.h:251
Definition: DhcpLayer.h:129
Definition: DhcpLayer.h:379
Definition: DhcpLayer.h:139
Definition: DhcpLayer.h:321
Definition: DhcpLayer.h:259
size_t getDataSize() const
Definition: DhcpLayer.h:494
Definition: DhcpLayer.h:391
Definition: DhcpLayer.h:123
Definition: DhcpLayer.h:267
Definition: DhcpLayer.h:191
Definition: DhcpLayer.h:327
Definition: DhcpLayer.h:147
Definition: DhcpLayer.h:145
Definition: DhcpLayer.h:273
Definition: DhcpLayer.h:229
OsiModelLayer getOsiModelLayer() const
Definition: DhcpLayer.h:807
Definition: DhcpLayer.h:201
virtual ~DhcpLayer()
Definition: DhcpLayer.h:628
Definition: DhcpLayer.h:104
void setValueString(const std::string &stringValue, int valueOffset=0)
Definition: DhcpLayer.h:471
Definition: DhcpLayer.h:181
Definition: DhcpLayer.h:205
DhcpOptionBuilder & operator=(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:580
Definition: DhcpLayer.h:233
Definition: DhcpLayer.h:100
DhcpOption(uint8_t *optionRawData)
Definition: DhcpLayer.h:420
Definition: DhcpLayer.h:265
Definition: DhcpLayer.h:315
Definition: DhcpLayer.h:185
Definition: DhcpLayer.h:90
Definition: DhcpLayer.h:127
Definition: DhcpLayer.h:175
Definition: MacAddress.h:28
Definition: DhcpLayer.h:179
Definition: DhcpLayer.h:345
Definition: DhcpLayer.h:303
Definition: DhcpLayer.h:207
Definition: DhcpLayer.h:247
Definition: DhcpLayer.h:291
Definition: DhcpLayer.h:353
Definition: DhcpLayer.h:197
uint32_t toInt() const
Definition: IpAddress.h:156
IPv4Address getServerIpAddress() const
Definition: DhcpLayer.h:655
Definition: DhcpLayer.h:297
Definition: DhcpLayer.h:113
Definition: DhcpLayer.h:285
Definition: DhcpLayer.h:319
Definition: DhcpLayer.h:177
Definition: DhcpLayer.h:361
Definition: DhcpLayer.h:341