pub struct Message {Show 16 fields
pub op: Ops,
pub htype: HTypes,
pub hlen: u8,
pub hops: u8,
pub xid: u32,
pub secs: u16,
pub flags: Flags,
pub ciaddr: Ipv4Addr,
pub yiaddr: Ipv4Addr,
pub siaddr: Ipv4Addr,
pub giaddr: Ipv4Addr,
pub chaddr: [u8; 16],
pub sname: SName,
pub file: File,
pub magic: [u8; 4],
pub options: Vec<MessageOptions>,
}Expand description
Wraps all the data sent between DHCP clients and servers.
Formally defined in RFC-2131 as:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| op (1) | htype (1) | hlen (1) | hops (1) |
+---------------+---------------+---------------+---------------+
| xid (4) |
+-------------------------------+-------------------------------+
| secs (2) | flags (2) |
+-------------------------------+-------------------------------+
| ciaddr (4) |
+---------------------------------------------------------------+
| yiaddr (4) |
+---------------------------------------------------------------+
| siaddr (4) |
+---------------------------------------------------------------+
| giaddr (4) |
+---------------------------------------------------------------+
| chaddr (16) |
+---------------------------------------------------------------+
| sname (64) |
+---------------------------------------------------------------+
| file (128) |
+---------------------------------------------------------------+
| options (variable) |
+---------------------------------------------------------------+Fields§
§op: OpsMessage type (not to be confused with a MessageOptions’s MessageTypes)
htype: HTypesHardware address type
hlen: u8Hardware address length
hops: u8Optionally used by relay agents when booting via a relay agent. Client sets to zero.
xid: u32The transaction id. A random number chosen by the client. Used by the client and server to associate messages and responses between a client and a server.
secs: u16Seconds elapsed since client started address acquisition/renewal process. Filled in by client.
flags: FlagsThe leftmost bit is defined as the Broadcast flag. The remaining bits are reserved for future use, and must be set to zero by clients and ignored by servers and relay agents.
ciaddr: Ipv4AddrClient IP address. Only filled in if the client is in BOUND, RENEW, or REBINDING state and can respond to ARP requests.
yiaddr: Ipv4AddrYour IP address
siaddr: Ipv4AddrIP address of the next server to use in bootstrap. Returned in DHCPOFFER, DHCPACK by server.
giaddr: Ipv4AddrRelay agent IP address. Used in booting via a relay agent.
chaddr: [u8; 16]Client hardware address
If using an ethernet hardware type you can get the value for this field with the mac_address crate. A Client will automatically use mac_address.
sname: SNameServer host name (optional). Null terminated string. 64 bytes in length.
file: FileBoot file name. Null terminated string. Generic name or null in DHCPDISCOVER. Fully qualified directory path name in DHCPOFFER. 128 bytes in length.
magic: [u8; 4]The first four octets of options field with values 99, 130, 83, 99
options: Vec<MessageOptions>A variable length field with a minimum of 312 octets. Options use Tag-Length-Value (TLV) encoding, where multi-byte quantities are in network byte order. The last option must be MessageOptions::End