DHCP

DHCP protocol layer

Constructor

new DHCP()

Properties
NameTypeDescription
srcnumberSource DHCP port.
dstnumberDestination DHCP port.
totalLengthnumberThis field specifies the length in bytes of the DHCP datagram (the header fields and Data field) in octets.
checksumnumberThe 16-bit checksum field is used for error-checking of the header and data.
Implements

Members

bootFilename :string

BootP boot file name.
Type:
  • string

clientHardwareAddress :string

Usually the client MAC
Type:
  • string

clientIpAddress :string

The destination IP address in human-readable format.
Type:
  • string

gatewayIpAddress :string

The destination IP address in human-readable format.
Type:
  • string

length :number

Number of bytes occupied by the layer.
Type:
  • number
Implements

options :Iterable.<TLVOption>

TLV options;
Type:

osi :OsiModelLayers

Respective protocol OSI layer.
Implements

serverName :string

BootP server name.
Type:
  • string

yourIpAddress :string

The destination IP address in human-readable format.
Type:
  • string

Methods

calculateChecksum()

Calculates and updates the checksum for the DHCP layer. This method mutates the object by setting the `checksum` property based on the current state of the `buffer` and `prev` field.

toObject() → {Object}

Retrieves all fields of the DHCP layer.
Implements
Returns:
The DHCP layer fields as an object.
Type: 
Object
Example
udp.toObject();
// {
//   src: 52622,
//   dst: 24043,
//   seq: 3994458414,
//   totalLength: 2048,
//   checksum: 3346,
// }