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  // TODO: This will burn if valueOffset is negative.
422  // Should negative offsets even be allowed? Potentially change it to size_t?
423  if (m_Data == nullptr || getDataSize() < static_cast<size_t>(valueOffset) + 1)
424  return "";
425 
426  return std::string(reinterpret_cast<const char*>(m_Data->recordValue) + valueOffset,
427  static_cast<int>(m_Data->recordLen) - valueOffset);
428  }
429 
436  void setValueString(const std::string& stringValue, int valueOffset = 0)
437  {
438  // calculate the maximum length of the destination buffer
439  size_t len = static_cast<size_t>(m_Data->recordLen) - static_cast<size_t>(valueOffset);
440 
441  // use the length of input string if a buffer is large enough for whole string
442  if (stringValue.length() < len)
443  len = stringValue.length();
444 
445  memcpy(m_Data->recordValue + valueOffset, stringValue.data(), len);
446  }
447 
452  static bool canAssign(const uint8_t* recordRawData, size_t tlvDataLen)
453  {
454  auto data = reinterpret_cast<TLVRawData const*>(recordRawData);
455  if (data == nullptr)
456  return false;
457 
458  if (tlvDataLen < sizeof(TLVRawData::recordType))
459  return false;
460 
461  if (data->recordType == static_cast<uint8_t>(DHCPOPT_END) ||
462  data->recordType == static_cast<uint8_t>(DHCPOPT_PAD))
463  return true;
464 
465  return TLVRecord<uint8_t, uint8_t>::canAssign(recordRawData, tlvDataLen);
466  }
467 
468  // implement abstract methods
469 
470  size_t getTotalSize() const override
471  {
472  if (m_Data == nullptr)
473  return 0;
474 
475  if (m_Data->recordType == static_cast<uint8_t>(DHCPOPT_END) ||
476  m_Data->recordType == static_cast<uint8_t>(DHCPOPT_PAD))
477  return sizeof(uint8_t);
478 
479  return sizeof(uint8_t) * 2 + static_cast<size_t>(m_Data->recordLen);
480  }
481 
482  size_t getDataSize() const override
483  {
484  if (m_Data == nullptr)
485  return 0;
486 
487  if (m_Data->recordType == static_cast<uint8_t>(DHCPOPT_END) ||
488  m_Data->recordType == static_cast<uint8_t>(DHCPOPT_PAD))
489  return 0;
490 
491  return m_Data->recordLen;
492  }
493  };
494 
499  {
500  public:
507  DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t* optionValue, uint8_t optionValueLen)
508  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue, optionValueLen)
509  {}
510 
515  DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue)
516  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
517  {}
518 
523  DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue)
524  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
525  {}
526 
531  DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue)
532  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
533  {}
534 
539  DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address& optionValue)
540  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
541  {}
542 
547  DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string& optionValue)
548  : TLVRecordBuilder(static_cast<uint8_t>(optionType), optionValue)
549  {}
550 
554  {}
555 
560  {
561  TLVRecordBuilder::operator=(other);
562  return *this;
563  }
564 
567  DhcpOption build() const;
568  };
569 
572  class DhcpLayer : public Layer
573  {
574  public:
580  DhcpLayer(uint8_t* data, size_t dataLen, Layer* prevLayer, Packet* packet);
581 
586  DhcpLayer(DhcpMessageType msgType, const MacAddress& clientMacAddr);
587 
590 
592  ~DhcpLayer() override = default;
593 
594  static bool isDataValid(uint8_t const* data, size_t dataLen)
595  {
596  return canReinterpretAs<dhcp_header>(data, dataLen);
597  }
598 
603  {
604  return reinterpret_cast<dhcp_header*>(m_Data);
605  }
606 
609  {
610  return static_cast<BootpOpCodes>(getDhcpHeader()->opCode);
611  }
612 
616  {
617  return getDhcpHeader()->clientIpAddress;
618  }
619 
622  void setClientIpAddress(const IPv4Address& addr)
623  {
624  getDhcpHeader()->clientIpAddress = addr.toInt();
625  }
626 
630  {
631  return getDhcpHeader()->serverIpAddress;
632  }
633 
636  void setServerIpAddress(const IPv4Address& addr)
637  {
638  getDhcpHeader()->serverIpAddress = addr.toInt();
639  }
640 
643  {
644  return getDhcpHeader()->yourIpAddress;
645  }
646 
649  void setYourIpAddress(const IPv4Address& addr)
650  {
651  getDhcpHeader()->yourIpAddress = addr.toInt();
652  }
653 
657  {
659  }
660 
664  {
666  }
667 
672 
677 
682 
691 
695 
702 
708 
710  size_t getOptionsCount() const;
711 
716  DhcpOption addOption(const DhcpOptionBuilder& optionBuilder);
717 
723  DhcpOption addOptionAfter(const DhcpOptionBuilder& optionBuilder, DhcpOptionTypes prevOption);
724 
728  bool removeOption(DhcpOptionTypes optionType);
729 
733 
738  static inline bool isDhcpPorts(uint16_t portSrc, uint16_t portDst);
739 
740  // implement abstract methods
741 
743  void parseNextLayer() override
744  {}
745 
747  size_t getHeaderLen() const override
748  {
749  return m_DataLen;
750  }
751 
760  void computeCalculateFields() override;
761 
762  std::string toString() const override;
763 
765  {
767  }
768 
769  private:
770  uint8_t* getOptionsBasePtr() const
771  {
772  return m_Data + sizeof(dhcp_header);
773  }
774 
775  TLVRecordReader<DhcpOption> m_OptionReader;
776 
777  void initDhcpLayer(size_t numOfBytesToAllocate);
778 
779  DhcpOption addOptionAt(const DhcpOptionBuilder& optionBuilder, int offset);
780  };
781 
782  // implementation of inline methods
783 
784  bool DhcpLayer::isDhcpPorts(uint16_t portSrc, uint16_t portDst)
785  {
786  return ((portSrc == 68 && portDst == 67) || (portSrc == 67 && portDst == 68) ||
787  (portSrc == 67 && portDst == 67));
788  }
789 
790 } // namespace pcpp
Definition: DhcpLayer.h:573
void parseNextLayer() override
Does nothing for this layer (DhcpLayer is always last)
Definition: DhcpLayer.h:743
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:784
void setServerIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:636
BootpOpCodes getOpCode() const
Definition: DhcpLayer.h:608
dhcp_header * getDhcpHeader() const
Definition: DhcpLayer.h:602
~DhcpLayer() override=default
A destructor for this layer.
DhcpOption addOptionAfter(const DhcpOptionBuilder &optionBuilder, DhcpOptionTypes prevOption)
IPv4Address getYourIpAddress() const
Definition: DhcpLayer.h:642
IPv4Address getClientIpAddress() const
Definition: DhcpLayer.h:615
DhcpOption getFirstOptionData() const
void setClientIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:622
size_t getHeaderLen() const override
Definition: DhcpLayer.h:747
std::string toString() const override
void setGatewayIpAddress(const IPv4Address &addr)
Definition: DhcpLayer.h:663
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:656
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:649
DhcpOption addOption(const DhcpOptionBuilder &optionBuilder)
DhcpOption getOptionData(DhcpOptionTypes option) const
IPv4Address getServerIpAddress() const
Definition: DhcpLayer.h:629
OsiModelLayer getOsiModelLayer() const override
Definition: DhcpLayer.h:764
bool removeOption(DhcpOptionTypes optionType)
void computeCalculateFields() override
DhcpMessageType getMessageType() const
Definition: DhcpLayer.h:499
DhcpOptionBuilder(DhcpOptionTypes optionType, uint32_t optionValue)
Definition: DhcpLayer.h:531
DhcpOption build() const
DhcpOptionBuilder(DhcpOptionTypes optionType, const uint8_t *optionValue, uint8_t optionValueLen)
Definition: DhcpLayer.h:507
DhcpOptionBuilder(DhcpOptionTypes optionType, const IPv4Address &optionValue)
Definition: DhcpLayer.h:539
DhcpOptionBuilder & operator=(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:559
DhcpOptionBuilder(DhcpOptionTypes optionType, uint8_t optionValue)
Definition: DhcpLayer.h:515
DhcpOptionBuilder(DhcpOptionTypes optionType, const std::string &optionValue)
Definition: DhcpLayer.h:547
DhcpOptionBuilder(DhcpOptionTypes optionType, uint16_t optionValue)
Definition: DhcpLayer.h:523
DhcpOptionBuilder(const DhcpOptionBuilder &other)
Definition: DhcpLayer.h:553
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:436
std::string getValueAsString(int valueOffset=0) const
Definition: DhcpLayer.h:419
size_t getDataSize() const override
Definition: DhcpLayer.h:482
static bool canAssign(const uint8_t *recordRawData, size_t tlvDataLen)
Definition: DhcpLayer.h:452
void setValueIpAddr(const IPv4Address &addr, int valueOffset=0)
Definition: DhcpLayer.h:409
size_t getTotalSize() const override
Definition: DhcpLayer.h:470
DhcpOption(uint8_t *optionRawData)
Definition: DhcpLayer.h:391
IPv4Address getValueAsIpAddr() const
Definition: DhcpLayer.h:399
Definition: IpAddress.h:30
uint32_t toInt() const
Definition: IpAddress.h:155
Definition: Layer.h:115
Definition: MacAddress.h:24
Definition: Packet.h:48
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.
Definition: AssertionUtils.h:19
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:264
@ OsiModelApplicationLayer
Application layer (layer 7)
Definition: ProtocolType.h:278
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