PcapPlusPlus  Next
DhcpLayer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Layer.h"
4 #include "TLVData.h"
5 #include "IpAddress.h"
6 #include "MacAddress.h"
7 #include <string.h>
8 
10 
13 namespace pcpp
14 {
17 #pragma pack(push, 1)
18  struct dhcp_header
19  {
21  uint8_t opCode;
23  uint8_t hardwareType;
27  uint8_t hops;
29  uint32_t transactionID;
31  uint16_t secondsElapsed;
33  uint16_t flags;
35  uint32_t clientIpAddress;
37  uint32_t yourIpAddress;
39  uint32_t serverIpAddress;
41  uint32_t gatewayIpAddress;
43  uint8_t clientHardwareAddress[16];
45  uint8_t serverName[64];
47  uint8_t bootFilename[128];
49  uint32_t magicNumber;
50  };
51 #pragma pack(pop)
52  static_assert(sizeof(dhcp_header) == 240, "dhcp_header size is not 240 bytes");
53 
56  {
60  DHCP_BOOTREPLY = 2
61  };
62 
65  {
77  DHCP_ACK = 5,
79  DHCP_NAK = 6,
83  DHCP_INFORM = 8
84  };
85 
88  {
296  DHCPOPT_URL = 114,
310  DHCPOPT_CCC = 122,
380  DHCPOPT_END = 255
381  };
382 
386  class DhcpOption : public TLVRecord<uint8_t, uint8_t>
387  {
388  public:
391  explicit DhcpOption(uint8_t* optionRawData) : TLVRecord(optionRawData)
392  {}
393 
395  ~DhcpOption() override = default;
396 
400  {
401  return getValueAs<uint32_t>();
402  }
403 
409  void setValueIpAddr(const IPv4Address& addr, int valueOffset = 0)
410  {
411  setValue<uint32_t>(addr.toInt(), valueOffset);
412  }
413 
419  std::string getValueAsString(int valueOffset = 0) const
420  {
421  if (m_Data == nullptr || m_Data->recordLen - valueOffset < 1)
422  return "";
423 
424  return std::string(reinterpret_cast<const char*>(m_Data->recordValue) + valueOffset,
425  static_cast<int>(m_Data->recordLen) - valueOffset);
426  }
427 
434  void setValueString(const std::string& stringValue, int valueOffset = 0)
435  {
436  // calculate the maximum length of the destination buffer
437  size_t len = static_cast<size_t>(m_Data->recordLen) - static_cast<size_t>(valueOffset);
438 
439  // use the length of input string if a buffer is large enough for whole string
440  if (stringValue.length() < len)
441  len = stringValue.length();
442 
443  memcpy(m_Data->recordValue + valueOffset, stringValue.data(), len);
444  }
445 
450  static bool canAssign(const uint8_t* recordRawData, size_t tlvDataLen)
451  {
452  auto data = reinterpret_cast<TLVRawData const*>(recordRawData);
453  if (data == nullptr)
454  return false;
455 
456  if (tlvDataLen < sizeof(TLVRawData::recordType))
457  return false;
458 
459  if (data->recordType == static_cast<uint8_t>(DHCPOPT_END) ||
460  data->recordType == static_cast<uint8_t>(DHCPOPT_PAD))
461  return true;
462 
463  return TLVRecord<uint8_t, uint8_t>::canAssign(recordRawData, tlvDataLen);
464  }
465 
466  // implement abstract methods
467 
468  size_t getTotalSize() const override
469  {
470  if (m_Data == nullptr)
471  return 0;
472 
473  if (m_Data->recordType == static_cast<uint8_t>(DHCPOPT_END) ||
474  m_Data->recordType == static_cast<uint8_t>(DHCPOPT_PAD))
475  return sizeof(uint8_t);
476 
477  return sizeof(uint8_t) * 2 + static_cast<size_t>(m_Data->recordLen);
478  }
479 
480  size_t getDataSize() const override
481  {
482  if (m_Data == nullptr)
483  return 0;
484 
485  if (m_Data->recordType == static_cast<uint8_t>(DHCPOPT_END) ||
486  m_Data->recordType == static_cast<uint8_t>(DHCPOPT_PAD))
487  return 0;
488 
489  return m_Data->recordLen;
490  }
491  };
492 
497  {
498  public:
505  DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t* optionValue, uint8_t optionValueLen)
506  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue, optionValueLen)
507  {}
508 
513  DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue)
514  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
515  {}
516 
521  DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue)
522  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
523  {}
524 
529  DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue)
530  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
531  {}
532 
537  DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address& optionValue)
538  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
539  {}
540 
545  DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string& optionValue)
546  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
547  {}
548 
552  {}
553 
558  {
559  TLVRecordBuilder::operator=(other);
560  return *this;
561  }
562 
565  DhcpOption build() const;
566  };
567 
570  class DhcpLayer : public Layer
571  {
572  public:
578  DhcpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
579 
584  DhcpLayer(DhcpMessageType msgType, const MacAddress& clientMacAddr);
585 
588 
590  ~DhcpLayer() override = default;
591 
596  {
597  return reinterpret_cast<dhcp_header*>(m_Data);
598  }
599 
602  {
603  return static_cast<BootpOpCodes>(getDhcpHeader()->opCode);
604  }
605 
609  {
610  return getDhcpHeader()->clientIpAddress;
611  }
612 
615  void setClientIpAddress(const IPv4Address& addr)
616  {
617  getDhcpHeader()->clientIpAddress = addr.toInt();
618  }
619 
623  {
624  return getDhcpHeader()->serverIpAddress;
625  }
626 
629  void setServerIpAddress(const IPv4Address& addr)
630  {
631  getDhcpHeader()->serverIpAddress = addr.toInt();
632  }
633 
636  {
637  return getDhcpHeader()->yourIpAddress;
638  }
639 
642  void setYourIpAddress(const IPv4Address& addr)
643  {
644  getDhcpHeader()->yourIpAddress = addr.toInt();
645  }
646 
650  {
652  }
653 
657  {
659  }
660 
665 
670 
675 
684 
688 
695 
701 
703  size_t getOptionsCount() const;
704 
709  DhcpOption addOption(const DhcpOptionBuilder& optionBuilder);
710 
716  DhcpOption addOptionAfter(const DhcpOptionBuilder& optionBuilder, DhcpOptionTypes prevOption);
717 
721  bool removeOption(DhcpOptionTypes optionType);
722 
726 
731  static inline bool isDhcpPorts(uint16_t portSrc, uint16_t portDst);
732 
733  // implement abstract methods
734 
736  void parseNextLayer() override
737  {}
738 
740  size_t getHeaderLen() const override
741  {
742  return m_DataLen;
743  }
744 
753  void computeCalculateFields() override;
754 
755  std::string toString() const override;
756 
758  {
760  }
761 
762  private:
763  uint8_t* getOptionsBasePtr() const
764  {
765  return m_Data + sizeof(dhcp_header);
766  }
767 
768  TLVRecordReader<DhcpOption> m_OptionReader;
769 
770  void initDhcpLayer(size_t numOfBytesToAllocate);
771 
772  DhcpOption addOptionAt(const DhcpOptionBuilder& optionBuilder, int offset);
773  };
774 
775  // implementation of inline methods
776 
777  bool DhcpLayer::isDhcpPorts(uint16_t portSrc, uint16_t portDst)
778  {
779  return ((portSrc == 68 && portDst == 67) || (portSrc == 67 && portDst == 68) ||
780  (portSrc == 67 && portDst == 67));
781  }
782 
783 } // namespace pcpp
Definition: DhcpLayer.h:571
void parseNextLayer() override
Does nothing for this layer (DhcpLayer is always last)
Definition: DhcpLayer.h:736
bool removeAllOptions()
DhcpLayer(DhcpMessageType msgType, const MacAddress &clientMacAddr)
void setClientHardwareAddress(const MacAddress &addr)
static bool isDhcpPorts(uint16_t portSrc, uint16_t portDst)
Definition: DhcpLayer.h:777
void setServerIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:629
BootpOpCodes getOpCode() const
Definition: DhcpLayer.h:601
dhcp_header * getDhcpHeader() const
Definition: DhcpLayer.h:595
~DhcpLayer() override=default
A destructor for this layer.
DhcpOption addOptionAfter(const DhcpOptionBuilder &optionBuilder, DhcpOptionTypes prevOption)
IPv4Address getYourIpAddress() const
Definition: DhcpLayer.h:635
IPv4Address getClientIpAddress() const
Definition: DhcpLayer.h:608
DhcpOption getFirstOptionData() const
void setClientIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:615
size_t getHeaderLen() const override
Definition: DhcpLayer.h:740
std::string toString() const override
void setGatewayIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:656
DhcpOption getNextOptionData(DhcpOption dhcpOption) const
MacAddress getClientHardwareAddress() const
DhcpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
IPv4Address getGatewayIpAddress() const
Definition: DhcpLayer.h:649
bool setMessageType(DhcpMessageType msgType)
size_t getOptionsCount() const
DhcpLayer()
A constructor that creates the layer from scratch with clean data.
void setYourIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:642
DhcpOption addOption(const DhcpOptionBuilder &optionBuilder)
DhcpOption getOptionData(DhcpOptionTypes option) const
IPv4Address getServerIpAddress() const
Definition: DhcpLayer.h:622
OsiModelLayer getOsiModelLayer() const override
Definition: DhcpLayer.h:757
bool removeOption(DhcpOptionTypes optionType)
void computeCalculateFields() override
DhcpMessageType getMessageType() const
Definition: DhcpLayer.h:497
DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue)
Definition: DhcpLayer.h:529
DhcpOption build() const
DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: DhcpLayer.h:505
DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address &optionValue)
Definition: DhcpLayer.h:537
DhcpOptionBuilder & operator=(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:557
DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue)
Definition: DhcpLayer.h:513
DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string &optionValue)
Definition: DhcpLayer.h:545
DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue)
Definition: DhcpLayer.h:521
DhcpOptionBuilder(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:551
Definition: DhcpLayer.h:387
~DhcpOption() override=default
A d'tor for this class, currently does nothing.
void setValueString(const std::string &stringValue, int valueOffset=0)
Definition: DhcpLayer.h:434
std::string getValueAsString(int valueOffset=0) const
Definition: DhcpLayer.h:419
size_t getDataSize() const override
Definition: DhcpLayer.h:480
static bool canAssign(const uint8_t *recordRawData, size_t tlvDataLen)
Definition: DhcpLayer.h:450
void setValueIpAddr(const IPv4Address &addr, int valueOffset=0)
Definition: DhcpLayer.h:409
size_t getTotalSize() const override
Definition: DhcpLayer.h:468
DhcpOption(uint8_t *optionRawData)
Definition: DhcpLayer.h:391
IPv4Address getValueAsIpAddr() const
Definition: DhcpLayer.h:399
Definition: IpAddress.h:28
uint32_t toInt() const
Definition: IpAddress.h:146
Definition: Layer.h:60
Definition: MacAddress.h:21
Definition: Packet.h:22
Definition: TLVData.h:357
Definition: TLVData.h:19
static bool canAssign(const uint8_t *recordRawData, size_t tlvDataLen)
Definition: TLVData.h:66
The main namespace for the PcapPlusPlus lib.
DhcpOptionTypes
DHCP option types.
Definition: DhcpLayer.h:88
@ DHCPOPT_INTERFACE_MTU
Interface MTU Size.
Definition: DhcpLayer.h:144
@ DHCPOPT_CCC
CableLabs Client Configuration.
Definition: DhcpLayer.h:310
@ DHCPOPT_FINGER_SERVER
Finger Server Addresses.
Definition: DhcpLayer.h:238
@ DHCPOPT_OPTION_IPV4_ADDRESS_MOS
A Series Of Suboptions.
Definition: DhcpLayer.h:324
@ DHCPOPT_SMTP_SERVER
Simple Mail Server (SMTP) Addresses.
Definition: DhcpLayer.h:230
@ DHCPOPT_RAPID_COMMIT
Rapid Commit.
Definition: DhcpLayer.h:252
@ DHCPOPT_START_TIME_OF_STATE
Number of seconds in the past when client entered current state.
Definition: DhcpLayer.h:342
@ DHCPOPT_QUERY_END_TIME
Absolute time (seconds since Jan 1, 1970) for end of query.
Definition: DhcpLayer.h:346
@ DHCPOPT_ROUTER_SOLICITATION_ADDRESS
Router Solicitation Address.
Definition: DhcpLayer.h:156
@ DHCPOPT_DHCP_MAX_MESSAGE_SIZE
DHCP Maximum Message Size.
Definition: DhcpLayer.h:206
@ DHCPOPT_DOMAIN_NAME
The DNS domain name of the client.
Definition: DhcpLayer.h:122
@ DHCPOPT_IP_FORWARDING
Enable/Disable IP Forwarding.
Definition: DhcpLayer.h:130
@ DHCPOPT_TRAILER_ENCAPSULATION
Trailer Encapsulation.
Definition: DhcpLayer.h:160
@ DHCPOPT_OPTION_V4_ACCESS_DOMAIN
Access Network Domain Name.
Definition: DhcpLayer.h:374
@ DHCPOPT_SWAP_SERVER
Swap Server address.
Definition: DhcpLayer.h:124
@ DHCPOPT_SERVICE_SCOPE
Service Location Agent Scope.
Definition: DhcpLayer.h:250
@ DHCPOPT_DHCP_CLIENT_IDENTIFIER
Class Identifier.
Definition: DhcpLayer.h:214
@ DHCPOPT_NIS_SERVERS
NIS Server Addresses.
Definition: DhcpLayer.h:174
@ DHCPOPT_DIRECTORY_AGENT
Directory Agent Information.
Definition: DhcpLayer.h:248
@ DHCPOPT_QUERY_START_TIME
Absolute time (seconds since Jan 1, 1970) for beginning of query.
Definition: DhcpLayer.h:344
@ DHCPOPT_TCP_KEEPALIVE_INTERVAL
TCP Keepalive Interval.
Definition: DhcpLayer.h:168
@ DHCPOPT_GEOCONF
GeoConf Option.
Definition: DhcpLayer.h:312
@ DHCPOPT_NAME_SERVICE_SEARCH
Name Service Search.
Definition: DhcpLayer.h:300
@ DHCPOPT_DHCP_OPTION_OVERLOAD
Overload "sname" or "file".
Definition: DhcpLayer.h:196
@ DHCPOPT_NETBIOS_NODE_TYPE
NETBIOS Node Type.
Definition: DhcpLayer.h:184
@ DHCPOPT_POP3_SERVER
Post Office (POP3) Server Addresses.
Definition: DhcpLayer.h:232
@ DHCPOPT_UNKNOWN
Unknown option type.
Definition: DhcpLayer.h:90
@ DHCPOPT_SUBNET_MASK
Subnet Mask Value.
Definition: DhcpLayer.h:94
@ DHCPOPT_DHCP_SERVER_IDENTIFIER
DHCP Server Identification.
Definition: DhcpLayer.h:200
@ DHCPOPT_BOOT_SIZE
Size of boot file in 512 byte chunks.
Definition: DhcpLayer.h:118
@ DHCPOPT_TIME_SERVERS
N/4 Timeserver addresses.
Definition: DhcpLayer.h:100
@ DHCPOPT_URL
URL.
Definition: DhcpLayer.h:296
@ DHCPOPT_SIP_UA_CONFIG
List of domain names to search for SIP User Agent Configuration.
Definition: DhcpLayer.h:328
@ DHCPOPT_BASE_TIME
Absolute time (seconds since Jan 1, 1970) message was sent.
Definition: DhcpLayer.h:340
@ DHCPOPT_NDS_SERVERS
Novell Directory Services.
Definition: DhcpLayer.h:260
@ DHCPOPT_HOST_NAME
Hostname string.
Definition: DhcpLayer.h:116
@ DHCPOPT_STATIC_ROUTES
Static Routing Table.
Definition: DhcpLayer.h:158
@ DHCPOPT_QUOTES_SERVERS
N/4 Quotes Server addresses.
Definition: DhcpLayer.h:108
@ DHCPOPT_REBOOT_TIME
Reboot Time.
Definition: DhcpLayer.h:370
@ DHCPOPT_GEOLOC
Geospatial Location with Uncertainty [RF.
Definition: DhcpLayer.h:332
@ DHCPOPT_CAPTIVE_PORTAL
DHCP Captive-Portal.
Definition: DhcpLayer.h:356
@ DHCPOPT_OPTION_MUD_URL_V4
Manufacturer Usage Descriptions.
Definition: DhcpLayer.h:358
@ DHCPOPT_IRC_SERVER
Chat (IRC) Server Addresses.
Definition: DhcpLayer.h:240
@ DHCPOPT_DHCP_MESSAGE_TYPE
DHCP Message Type.
Definition: DhcpLayer.h:198
@ DHCPOPT_OPTION_IPV4_FQDN_MOS
A Series Of Suboptions.
Definition: DhcpLayer.h:326
@ DEFAULT_IP_TTL
Default IP Time to Live.
Definition: DhcpLayer.h:138
@ DHCPOPT_X_DISPLAY_MANAGER
X Window Display Manager.
Definition: DhcpLayer.h:190
@ DHCPOPT_DHCP_REBINDING_TIME
DHCP Rebinding (T2) Time.
Definition: DhcpLayer.h:210
@ DHCPOPT_SIP_SERVERS
SIP Servers DHCP Option.
Definition: DhcpLayer.h:306
@ DHCPOPT_WWW_SERVER
WWW Server Addresses.
Definition: DhcpLayer.h:236
@ DHCPOPT_OPTION_V4_PORTPARAMS
This option is used to configure a set of ports bound to a shared IPv4 address.
Definition: DhcpLayer.h:354
@ DHCPOPT_OPTION_6RD
OPTION_6RD with N/4 6rd BR addresses.
Definition: DhcpLayer.h:372
@ DHCPOPT_CONFIGURATION_FILE
Configuration file.
Definition: DhcpLayer.h:366
@ DHCPOPT_OPTION_CAPWAP_AC_V4
CAPWAP Access Controller addresses.
Definition: DhcpLayer.h:322
@ DHCPOPT_NON_LOCAL_SOURCE_ROUTING
Enable/Disable Source Routing.
Definition: DhcpLayer.h:132
@ DHCPOPT_MERIT_DUMP
Client to dump and name the file to dump it to.
Definition: DhcpLayer.h:120
@ DHCPOPT_FONT_SERVERS
X Window Font Server.
Definition: DhcpLayer.h:188
@ DHCPOPT_RESOURCE_LOCATION_SERVERS
N/4 RLP Server addresses.
Definition: DhcpLayer.h:114
@ DHCPOPT_DATA_SOURCE
Indicates information came from local or remote server.
Definition: DhcpLayer.h:350
@ DHCPOPT_SUBNET_ALLOCATION
Subnet Allocation Option.
Definition: DhcpLayer.h:376
@ DHCPOPT_TIME_OFFSET
Time Offset in Seconds from UTC.
Definition: DhcpLayer.h:96
@ DHCPOPT_ALL_SUBNETS_LOCAL
All Subnets are Local.
Definition: DhcpLayer.h:146
@ DHCPOPT_TCODE
Reference to the TZ Database.
Definition: DhcpLayer.h:290
@ DHCPOPT_LOG_SERVERS
N/4 Logging Server addresses.
Definition: DhcpLayer.h:106
@ DHCPOPT_NWIP_SUBOPTIONS
NetWare/IP sub Options.
Definition: DhcpLayer.h:218
@ DHCPOPT_STREETTALK_SERVER
StreetTalk Server Addresses.
Definition: DhcpLayer.h:242
@ DHCPOPT_GEOCONF_CIVIC
GEOCONF_CIVIC.
Definition: DhcpLayer.h:286
@ DHCPOPT_NWIP_DOMAIN_NAME
NetWare/IP Domain Name.
Definition: DhcpLayer.h:216
@ DHCPOPT_PXELINUX_MAGIC
Magic string = F1:00:74:7E.
Definition: DhcpLayer.h:364
@ DHCPOPT_IMPRESS_SERVERS
N/4 Quotes Server addresses.
Definition: DhcpLayer.h:112
@ DHCPOPT_ROUTERS
N/4 Router addresses.
Definition: DhcpLayer.h:98
@ DHCPOPT_V_I_VENDOR_CLASS
Vendor-Identifying Vendor Class.
Definition: DhcpLayer.h:314
@ DHCPOPT_STATUS_CODE
Status code and optional N byte text message describing status.
Definition: DhcpLayer.h:338
@ DHCPOPT_DHCP_PARAMETER_REQUEST_LIST
Parameter Request List.
Definition: DhcpLayer.h:202
@ DHCPOPT_BOOTFILE_NAME
Boot File Name.
Definition: DhcpLayer.h:226
@ DHCPOPT_NDS_TREE_NAME
Novell Directory Services.
Definition: DhcpLayer.h:262
@ DHCPOPT_CLIENT_LAST_TXN_TIME
Client Last Transaction Time.
Definition: DhcpLayer.h:272
@ DHCPOPT_FQDN
Fully Qualified Domain Name.
Definition: DhcpLayer.h:254
@ DHCPOPT_PATH_PREFIX
Path Prefix Option.
Definition: DhcpLayer.h:368
@ DHCPOPT_POLICY_FILTER
Routing Policy Filters.
Definition: DhcpLayer.h:134
@ DHCPOPT_DHCP_STATE
State of IP address.
Definition: DhcpLayer.h:348
@ DHCPOPT_PATH_MTU_AGING_TIMEOUT
Path MTU Aging Timeout.
Definition: DhcpLayer.h:140
@ DHCPOPT_NIS_DOMAIN_NAME
NIS+ v3 Client Domain Name.
Definition: DhcpLayer.h:220
@ DHCPOPT_PAD
Pad.
Definition: DhcpLayer.h:92
@ DHCPOPT_NDS_CONTEXT
Novell Directory Services.
Definition: DhcpLayer.h:264
@ DHCPOPT_SUBNET_SELECTION
Subnet Selection Option.
Definition: DhcpLayer.h:302
@ DHCPOPT_NNTP_SERVER
Network News (NNTP) Server Addresses.
Definition: DhcpLayer.h:234
@ DHCPOPT_DEFAULT_TCP_TTL
Default TCP Time to Live.
Definition: DhcpLayer.h:166
@ DHCPOPT_NETBIOS_SCOPE
NETBIOS Scope.
Definition: DhcpLayer.h:186
@ DHCPOPT_OPTION_V4_PCP_SERVER
Includes one or multiple lists of PCP server IP addresses; each list is treated as a separate PCP ser...
Definition: DhcpLayer.h:352
@ DHCPOPT_NETINFO_ADDRESS
NetInfo Parent Server Address.
Definition: DhcpLayer.h:292
@ DHCPOPT_PCODE
IEEE 1003.1 TZ String.
Definition: DhcpLayer.h:288
@ DHCPOPT_NTP_SERVERS
NTP Server Addresses.
Definition: DhcpLayer.h:176
@ DHCPOPT_DHCP_REQUESTED_ADDRESS
Requested IP Address.
Definition: DhcpLayer.h:192
@ DHCPOPT_FORCERENEW_NONCE_CAPABLE
Forcerenew Nonce Capable.
Definition: DhcpLayer.h:334
@ DHCPOPT_ASSOCIATED_IP
Associated IP.
Definition: DhcpLayer.h:274
@ DHCPOPT_NETBIOS_DD_SERVER
NETBIOS Datagram Distribution.
Definition: DhcpLayer.h:182
@ DHCPOPT_ARP_CACHE_TIMEOUT
ARP Cache Timeout.
Definition: DhcpLayer.h:162
@ DHCPOPT_MAX_DGRAM_REASSEMBLY
Max Datagram Reassembly Size.
Definition: DhcpLayer.h:136
@ DHCPOPT_BROADCAST_ADDRESS
Broadcast Address.
Definition: DhcpLayer.h:148
@ DHCPOPT_V_I_VENDOR_OPTS
Vendor-Identifying Vendor-Specific Information.
Definition: DhcpLayer.h:316
@ DHCPOPT_ROUTER_DISCOVERY
Perform Router Discovery.
Definition: DhcpLayer.h:154
@ DHCPOPT_NETBIOS_NAME_SERVERS
NETBIOS Name Servers.
Definition: DhcpLayer.h:180
@ DHCPOPT_NAME_SERVERS
N/4 IEN-116 Server addresses.
Definition: DhcpLayer.h:102
@ DHCPOPT_EXTENSIONS_PATH
Path name for more BOOTP info.
Definition: DhcpLayer.h:128
@ DHCPOPT_IEEE802_3_ENCAPSULATION
IEEE802.3 Encapsulation.
Definition: DhcpLayer.h:164
@ DHCPOPT_ISNS
Internet Storage Name Service.
Definition: DhcpLayer.h:258
@ DHCPOPT_USER_AUTH
Open Group's User Authentication.
Definition: DhcpLayer.h:284
@ DHCPOPT_DHCP_MESSAGE
DHCP Error Message.
Definition: DhcpLayer.h:204
@ DHCPOPT_DHCP_RENEWAL_TIME
DHCP Renewal (T1) Time.
Definition: DhcpLayer.h:208
@ DHCPOPT_BCMCS_CONTROLLER_DOMAIN_NAME_LIST
BCMCS Controller Domain Name list.
Definition: DhcpLayer.h:266
@ DHCPOPT_OPTION_PANA_AGENT
OPTION_PANA_AGENT.
Definition: DhcpLayer.h:318
@ DHCPOPT_DOMAIN_NAME_SERVERS
N/4 DNS Server addresses.
Definition: DhcpLayer.h:104
@ DHCPOPT_NETINFO_TAG
NetInfo Parent Server Tag.
Definition: DhcpLayer.h:294
@ DHCPOPT_NIS_DOMAIN
NIS Domain Name.
Definition: DhcpLayer.h:172
@ DHCPOPT_VENDOR_ENCAPSULATED_OPTIONS
Vendor Specific Information.
Definition: DhcpLayer.h:178
@ DHCPOPT_OPTION_V4_LOST
OPTION_V4_LOST.
Definition: DhcpLayer.h:320
@ DHCPOPT_HOME_AGENT_ADDRESS
Home Agent Addresses.
Definition: DhcpLayer.h:228
@ DHCPOPT_END
End (last option)
Definition: DhcpLayer.h:380
@ DHCPOPT_TCP_KEEPALIVE_GARBAGE
TCP Keepalive Garbage.
Definition: DhcpLayer.h:170
@ DHCPOPT_USER_CLASS
User Class Information.
Definition: DhcpLayer.h:246
@ DHCPOPT_ETHERBOOT
Etherboot.
Definition: DhcpLayer.h:360
@ PATH_MTU_PLATEAU_TABLE
Path MTU Plateau Table.
Definition: DhcpLayer.h:142
@ DHCPOPT_LDAP
Lightweight Directory Access Protocol [.
Definition: DhcpLayer.h:280
@ DHCPOPT_IP_TELEPHONE
IP Telephone.
Definition: DhcpLayer.h:362
@ DHCPOPT_NIS_SERVER_ADDRESS
NIS+ v3 Server Addresses.
Definition: DhcpLayer.h:222
@ DHCPOPT_AUTHENTICATION
Authentication.
Definition: DhcpLayer.h:270
@ DHCPOPT_BCMCS_CONTROLLER_IPV4_ADDRESS
BCMCS Controller IPv4 address option.
Definition: DhcpLayer.h:268
@ DHCPOPT_CLIENT_SYSTEM
Client System Architecture.
Definition: DhcpLayer.h:276
@ DHCPOPT_OPTION_IPV4_ADDRESS_ANDSF
ANDSF IPv4 Address Option for DHCPv4.
Definition: DhcpLayer.h:330
@ DHCPOPT_DHCP_LEASE_TIME
IP Address Lease Time.
Definition: DhcpLayer.h:194
@ DHCPOPT_DHCP_AGENT_OPTIONS
Relay Agent Information.
Definition: DhcpLayer.h:256
@ DHCPOPT_CLASSLESS_STATIC_ROUTE
Classless Static Route Option.
Definition: DhcpLayer.h:308
@ DHCPOPT_TFTP_SERVER_NAME
TFTP Server Name.
Definition: DhcpLayer.h:224
@ DHCPOPT_RDNSS_SELECTION
Information for selecting RDNSS.
Definition: DhcpLayer.h:336
@ DHCPOPT_CLIENT_NDI
Client Network Device Interface.
Definition: DhcpLayer.h:278
@ DHCPOPT_ROOT_PATH
Path name for root disk.
Definition: DhcpLayer.h:126
@ DHCPOPT_VIRTUAL_SUBNET_SELECTION
Virtual Subnet Selection (VSS) Option.
Definition: DhcpLayer.h:378
@ DHCPOPT_LPR_SERVERS
N/4 Quotes Server addresses.
Definition: DhcpLayer.h:110
@ DHCPOPT_PERFORM_MASK_DISCOVERY
Perform Mask Discovery.
Definition: DhcpLayer.h:150
@ DHCPOPT_DOMAIN_SEARCH
DNS Domain Search List.
Definition: DhcpLayer.h:304
@ DHCPOPT_STDA_SERVER
ST Directory Assist. Addresses.
Definition: DhcpLayer.h:244
@ DHCPOPT_VENDOR_CLASS_IDENTIFIER
Class Identifier.
Definition: DhcpLayer.h:212
@ DHCPOPT_MASK_SUPPLIER
Provide Mask to Others.
Definition: DhcpLayer.h:152
@ DHCPOPT_UUID_GUID
UUID/GUID-based Client Identifier.
Definition: DhcpLayer.h:282
@ DHCPOPT_AUTO_CONFIG
DHCP Auto-Configuration.
Definition: DhcpLayer.h:298
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:225
@ OsiModelApplicationLayer
Application layer (layer 7)
Definition: ProtocolType.h:239
DhcpMessageType
DHCP message types.
Definition: DhcpLayer.h:65
@ DHCP_UNKNOWN_MSG_TYPE
Unknown message type.
Definition: DhcpLayer.h:67
@ DHCP_NAK
Non-acknowledge message type.
Definition: DhcpLayer.h:79
@ DHCP_REQUEST
Request message type.
Definition: DhcpLayer.h:73
@ DHCP_OFFER
Offer message type.
Definition: DhcpLayer.h:71
@ DHCP_DECLINE
Decline message type.
Definition: DhcpLayer.h:75
@ DHCP_DISCOVER
Discover message type.
Definition: DhcpLayer.h:69
@ DHCP_ACK
Acknowledge message type.
Definition: DhcpLayer.h:77
@ DHCP_RELEASE
Release message type.
Definition: DhcpLayer.h:81
@ DHCP_INFORM
Inform message type.
Definition: DhcpLayer.h:83
BootpOpCodes
BootP opcodes.
Definition: DhcpLayer.h:56
@ DHCP_BOOTREQUEST
BootP request.
Definition: DhcpLayer.h:58
@ DHCP_BOOTREPLY
BootP reply.
Definition: DhcpLayer.h:60
Definition: DhcpLayer.h:19
uint16_t secondsElapsed
The elapsed time, in seconds since the client sent its first BOOTREQUEST message.
Definition: DhcpLayer.h:31
uint8_t hops
Hop count.
Definition: DhcpLayer.h:27
uint8_t clientHardwareAddress[16]
Client hardware address, by default contains the MAC address (only 6 first bytes are used)
Definition: DhcpLayer.h:43
uint32_t yourIpAddress
Your IPv4 address.
Definition: DhcpLayer.h:37
uint32_t transactionID
DHCP/BootP transaction ID.
Definition: DhcpLayer.h:29
uint8_t opCode
BootP opcode.
Definition: DhcpLayer.h:21
uint8_t bootFilename[128]
BootP boot file name.
Definition: DhcpLayer.h:47
uint32_t clientIpAddress
Client IPv4 address.
Definition: DhcpLayer.h:35
uint32_t magicNumber
DHCP magic number (set to the default value of 0x63538263)
Definition: DhcpLayer.h:49
uint8_t hardwareAddressLength
Hardware address length, set to 6 (MAC address length) by default.
Definition: DhcpLayer.h:25
uint16_t flags
BootP flags.
Definition: DhcpLayer.h:33
uint8_t hardwareType
Hardware type, set to 1 (Ethernet) by default.
Definition: DhcpLayer.h:23
uint32_t serverIpAddress
Server IPv4 address.
Definition: DhcpLayer.h:39
uint32_t gatewayIpAddress
Gateway IPv4 address.
Definition: DhcpLayer.h:41
uint8_t serverName[64]
BootP server name.
Definition: DhcpLayer.h:45