There’s a lot of stuff going on behind the scenes in DHCP, and while this library tries to make it accessible, it is impossible to hide. At least, not without removing what makes the library worth using.
Keep this around as a reference when messing with internals, but most of this is used internally to do the right thing with whatever you throw at a packet. Check back when things don’t go as expected, but go with your instinct first.
The DHCP operation type (Request or Response).
The type of hardware involved.
The length of the hardware address.
The number of hops across which the packet has been transmitted.
The transaction ID.
The number of seconds that have elapsed since the packet was first emitted.
DHCP flags set on the packet.
The client’s address.
The issued address.
The server’s address.
The gateway’s address.
The hardware address.
BOOTP server hostname.
BOOTP filename.
Byte-offset and size definitions for DHCP fields.
Information about how to validate basic DHCP types.
The human-readable format-name is mapped against a (fixed_length, minimum_length, multiple) tuple, which is handled by the following pseudocode:
if fixed_length == 0:
if (
len(value) < minimum_length or
len(value) % (multiple * minimum_length) != 0
):
fail
elif len(value) != fixed_length:
fail
Maps DHCP option-numbers to DHCP fields specs.
All values derived from http://www.iana.org/assignments/bootp-dhcp-parameters
Reading the source for this element is VERY strongly recommended.
Maps human-readable DHCP option names to integer values.
Reading the source for this element is VERY strongly recommended.
Maps integer values to human-readable DHCP option names.
Mapping from DHCP operation types to human-readable names.
Mapping from DHCP option values to human-readable names.
All DHCP fields for which data should be padded as needed
The DHCP magic cookie, per RFC 1048.
The DHCP magic cookie as an array of bytes.
Four bytes in network-byte-order.
At least one multiple of four bytes in network-byte-order.
Multiples of four bytes in network-byte-order.
A single byte.
At least one byte.
Any number of bytes.
A single byte, constrained to the values 0 (false) and 1 (true).
Two bytes in network-byte-order.
At least one multiple of two bytes in network-byte-order.
Four bytes in network-byte-order.
At least one multiple of four bytes in network-byte-order.
Two bytes in small-endian order.
A zero-length sequence.