Struct smoltcp::wire::DhcpPacket [−][src]
Expand description
A read/write wrapper around a Dynamic Host Configuration Protocol packet buffer.
Implementations
Imbue a raw octet buffer with DHCP packet structure.
Shorthand for a combination of new_unchecked and check_len.
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated)
if the buffer is too short.
Consume the packet, returning the underlying buffer.
Returns the hardware protocol type (e.g. ethernet).
Returns the length of a hardware address in bytes (e.g. 6 for ethernet).
Returns the transaction ID.
The transaction ID (called xid
in the specification) is a random number used to
associate messages and responses between client and server. The number is chosen by
the client.
Returns the hardware address of the client (called chaddr
in the specification).
Only ethernet is supported by smoltcp
, so this functions returns
an EthernetAddress
.
Returns the value of the hops
field.
The hops
field is set to zero by clients and optionally used by relay agents.
Returns the value of the secs
field.
The secs field is filled by clients and describes the number of seconds elapsed since client began process.
Returns the value of the magic cookie
field in the DHCP options.
This field should be always be 0x63825363
.
Returns the Ipv4 address of the client, zero if not set.
This corresponds to the ciaddr
field in the DHCP specification. According to it,
this field is “only filled in if client is in BOUND
, RENEW
or REBINDING
state
and can respond to ARP requests”.
Returns the value of the yiaddr
field, zero if not set.
Returns the value of the siaddr
field, zero if not set.
Returns the value of the giaddr
field, zero if not set.
Sets the optional sname
(“server name”) and file
(“boot file name”) fields to zero.
The fields are not commonly used, so we set their value always to zero. This method must be called when creating a packet, otherwise the emitted values for these fields are undefined!
Sets the OpCode
for the packet.
Sets the hardware address type (only ethernet is supported).
Sets the hardware address length.
Only ethernet is supported, so this field should be set to the value 6
.
Sets the transaction ID.
The transaction ID (called xid
in the specification) is a random number used to
associate messages and responses between client and server. The number is chosen by
the client.
Sets the ethernet address of the client.
Sets the chaddr
field.
Sets the hops field.
The hops
field is set to zero by clients and optionally used by relay agents.
Sets the secs
field.
The secs field is filled by clients and describes the number of seconds elapsed since client began process.
Sets the value of the magic cookie
field in the DHCP options.
This field should be always be 0x63825363
.
Sets the Ipv4 address of the client.
This corresponds to the ciaddr
field in the DHCP specification. According to it,
this field is “only filled in if client is in BOUND
, RENEW
or REBINDING
state
and can respond to ARP requests”.
Sets the value of the yiaddr
field.
Sets the value of the siaddr
field.
Sets the value of the giaddr
field.