protocol.addrs

Read, write, and manipulate address data.

Reader functions take [buf start ctx] and return [end value] where end is the offset in buf after the read value(s).

Writer functions take [buf value-or-values start ctx] and return end where end is the offset in buf after the written value(s).

broadcast

(broadcast ip netmask)

Return last/broadcast IPv4 addr based on ip and netmask

first-ip

(first-ip ip netmask)

Return first IPv4 addr based on ip and netmask

int->ip

(int->ip num)

Convert IPv4 uint32 value to IPv4 string

int->mac

(int->mac num)

Convert MAC int value to IPv4 string

ip->int

(ip->int ip)

Convert IPv4 string to uint32 value

ip->octet

(ip->octet ip)

Convert IPv4 string to bytes/octets

ip-seq

(ip-seq start end)

Return a sequence of IPv4 addresses between start and end

mac->int

(mac->int ip)

Convert MAC string to int value

mac->octet

(mac->octet mac)

Convert MAC addr string to bytes/octets

mask-int->prefix

(mask-int->prefix mask-int)

Convert network mask as uint32 IPv4 value to CIDR prefix value

mask-ip->prefix

(mask-ip->prefix mask-ip)

Convert network mask as IP string to CIDR prefix value

network-start-end

(network-start-end ip netmask & [usable?])

Return pair of first and last IPv4 address based on ip and netmask. If usable? is true then omit the network and broadcast addresses.

octet->ip

(octet->ip os)

convert bytes/octets to IPv4 string

octet->mac

(octet->mac os)

Convert bytes/octets to MAC addr string

readers

Network address (IPv4 and MAC) readers

writers

Network address (IPv4 and MAC) writers