const DHCP_READY
pub const DHCP_READY = 0Purpose
Constant DHCP_READY, defining protocol or algorithm parameters.
#embedded/wifi/ipv4IDs are network-order byte strings, independent of the target int width. Input LLC bytes must already have passed 802.11/CCMP authentication, replay checking and deaggregation. These functions do not establish a radio link.
const DHCP_READYpub const DHCP_READY = 0Constant DHCP_READY, defining protocol or algorithm parameters.
const DHCP_SELECTINGpub const DHCP_SELECTING = 1Constant DHCP_SELECTING, defining protocol or algorithm parameters.
const DHCP_REQUESTINGpub const DHCP_REQUESTING = 2Constant DHCP_REQUESTING, defining protocol or algorithm parameters.
const DHCP_LEASEDpub const DHCP_LEASED = 3Constant DHCP_LEASED, defining protocol or algorithm parameters.
const DHCP_FAILEDpub const DHCP_FAILED = 4Constant DHCP_FAILED, defining protocol or algorithm parameters.
struct Clientpub struct Client {
pub state int
pub mac string
pub xid string
pub offered string
pub server string
pub address string // empty until a matching, valid DHCPACK
pub mask string
pub router string
pub lease_seconds string // network-order uint32; not a host-width int
}Ipv4 Client session maintaining connection and operations.
state intmac stringxid stringoffered stringserver stringaddress string // empty until a matching, valid DHCPACKmask stringrouter stringlease_seconds string // network-order uint32; not a host-width intcreatepub fn create(mac string, xid string) ClientThe caller supplies an unpredictable four-byte XID for each new exchange. This is initial acquisition only. Retry clocks, lease expiration, renewal, duplicate-address detection and DHCPDECLINE belong to the caller.
mac stringxid stringClient — a value of this type
($&Client) discoverpub fn (c $&Client) discover() stringExecute discover on $&Client.
c $&ClientClient instance used by this call (exclusive borrow).string — result string
($&Client) requestpub fn (c $&Client) request() stringExecute request on $&Client.
c $&ClientClient instance used by this call (exclusive borrow).string — result string
($&Client) receive_llcpub fn (c $&Client) receive_llc(payload &string) boolTrue means one accepted state transition, including a matching DHCPNAK. The caller checks state == DHCP_LEASED before using address/mask/router.
c $&ClientClient instance used by this call (exclusive borrow).payload &stringbool — true or false
($&Client) receive_ethernetpub fn (c $&Client) receive_ethernet(frame &string) boolEthernet II without FCS or VLAN tags; intended for host packet fixtures or an independently authenticated bridge. 802.11 callers use receive_llc.
c $&ClientClient instance used by this call (exclusive borrow).frame &stringbool — true or false
arp_requestpub fn arp_request(mac &string, source_ip &string, target_ip &string) stringThe caller uses a successfully ACKed configuration and performs conflict detection before enabling application traffic. An ARP response alone is evidence of a neighbor, not proof of Internet reachability.
mac &stringsource_ip &stringtarget_ip &stringstring — result string
arp_reply_macpub fn arp_reply_mac(payload &string, own_mac &string, own_ip &string, target_ip &string) stringReturn the matched responder's six-byte MAC, or empty on malformed, unsolicited, multicast/zero sender, or another target's reply.
payload &stringown_mac &stringown_ip &stringtarget_ip &stringstring — result string
echo_requestpub fn echo_request(source_ip &string, target_ip &string, id int, sequence int, body &string) stringEcho request.
source_ip &stringtarget_ip &stringid intsequence intbody &stringstring — result string
echo_reply_validpub fn echo_reply_valid(payload &string, source_ip &string, target_ip &string, id int, sequence int, body &string) boolsource_ip is our local address and target_ip is the peer we queried. Validate the full returned body in addition to identifier and sequence.
payload &stringsource_ip &stringtarget_ip &stringid intsequence intbody &stringbool — true or false
struct ArpResponsepub struct ArpResponse {
pub valid bool
pub destination string
pub payload string
}Ipv4 Server response payload containing status, headers, and body.
valid booldestination stringpayload stringarp_responsepub fn arp_response(payload &string, own_mac &string, own_ip &string) ArpResponseAnswer an ordinary IPv4 peer's request for our acquired address. ARP probes (sender IP zero), conflicts and other targets need separate policy.
payload &stringown_mac &stringown_ip &stringArpResponse — a value of this type
echo_responsepub fn echo_response(payload &string, own_ip &string) stringValidate an Echo Request before constructing an exact-length reply. Link padding is excluded, and both checksums are recomputed after the changes.
payload &stringown_ip &stringstring — result string