src/net/dhcp.bend checks
raw source on the hub · import 0x2cb44898b57f05c48f38583063e077bf/src/net/dhcp.bend as Dhcp
2 imports
import Base import ../lib/bytes.bend as B
Types
type Dhcp.Step source · line 33 · raw
Data
One step of the walk: the answer, or the options left to walk and their count (counted once, then down, so the walk stays linear).
Dhcp.Done@t:Maybe<&2, U32> -> Dhcp.Step
Dhcp.Next@left:Nat -> @rest:List<&2, U32> -> Dhcp.Step
Definitions
def Dhcp.type_of source · line 24 · raw
@ok:Bool -> @body:List<&2, U32> -> Maybe<&2, U32>
The value of a message-type option: its length must be 1.
def Dhcp.step.body source · line 39 · raw
@fits:Bool -> @typ:Bool -> @one:Bool -> @+n:Nat -> @left:Nat -> @+body:List<&2, U32> -> Dhcp.Step
An option's data (left: the bytes after its length byte): complete, then either the type or skipped.
def Dhcp.step.code source · line 52 · raw
@pad:Bool -> @end:Bool -> @typ:Bool -> @+left:Nat -> @+rest:List<&2, U32> -> Dhcp.Step
One option (left: the bytes after its code byte): pad, end, message type, or another option to skip.
def Dhcp.step source · line 70 · raw
@+left:Nat -> @opts:List<&2, U32> -> Dhcp.Step
One step over opts, left of them.
def Dhcp.walk source · line 77 · raw
@fuel:Nat -> @st:Dhcp.Step -> Maybe<&2, U32>
def Dhcp.max_options source · line 88 · raw
Nat
The most option bytes a message may carry (RFC 2131's minimum message, 576 bytes, bounds what a client needs).
def Dhcp.walk_opts source · line 91 · raw
@short:Bool -> @+n:Nat -> @opts:List<&2, U32> -> Maybe<&2, U32>
def Dhcp.msg_type source · line 100 · raw
@ok:Bool -> @+msg:List<&2, U32> -> Maybe<&2, U32>
The message type of a BOOTREQUEST with the magic cookie, if it has one; a message with more than Dhcp.max_options option bytes has none.
def Dhcp.is_request source · line 109 · raw
@+msg:List<&2, U32> -> Bool
def Dhcp.options source · line 115 · raw
@t:U32 -> List<&2, U32>
The options of a reply of type t, after the magic cookie.
def Dhcp.build source · line 119 · raw
@t:U32 -> @+msg:List<&2, U32> -> List<&2, U32>
The reply of type t (2 OFFER, 5 ACK) to msg: xid, flags and chaddr copied.
def Dhcp.answer.pick source · line 128 · raw
@discover:Bool -> @request:Bool -> @+msg:List<&2, U32> -> Maybe<&2, List<&2, U32>>
def Dhcp.answer source · line 140 · raw
@t:Maybe<&2, U32> -> @+msg:List<&2, U32> -> Maybe<&2, List<&2, U32>>
DISCOVER (1) gets OFFER (2); REQUEST (3) gets ACK (5); else nothing.
def Dhcp.reply source · line 147 · raw
@msg:List<&2, U32> -> Maybe<&2, List<&2, U32>>