code wiki / (root) / mac48.nx

mac48.nx

buildroot/runtime/mac48.nx

4327 B140 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

mac48.nx -- IEEE 48-bit Ethernet MAC address parse + format. 6-byte unique identifier, printed as six hex pairs separated by ':' (IETF canonical) or '-' (Microsoft) or '.' (Cisco three-group form -- rare, not produced by us). Use cases: NAS monitoring, firewall rule generation, DHCP static leases, Wake-on-LAN packet construction, switch port lookup, Nishi-controller device identity. OUI lookups (first 3 bytes = manufacturer) are a future mac48_oui.nx if Nishi-monitoring needs them -- that's a data table problem, not algorithm. Invariants: M1 Parse accepts both ':' and '-' separators, case-insensitive hex. Three-group Cisco notation (dotted) NOT accepted. M2 Format emits lowercase hex with ':' separators (IETF canonical). A mac48_format_upper / mac48_format_dash can be added later if needed. M3 Output length fixed at 17 bytes (6*2 hex + 5 separators).

dependencies 1 imports · 0 importers

syscalls.nx mac48.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mac48_parse mac_nibble mac48_format mac48_is_broadcast mac48_is_multicast

structs

none

consts

25const MAC_ERR_SHORT: i64 = -1
26const MAC_ERR_FORMAT: i64 = -2

functions

29func mac_nibble(c: i64) -> i64 {
called by 1: mac48_parse
44func mac48_parse(buf: *u8, n: i64, out: *u8) -> i64 {
called by 1: main calls 1: mac_nibble
68func mac48_format(mac: *u8, out: *u8) -> i64 {
called by 1: main
82func mac48_is_broadcast(mac: *u8) -> i64 {
called by 1: main
92func mac48_is_multicast(mac: *u8) -> i64 {
called by 1: main
99func mac48_is_local(mac: *u8) -> i64 {
104func main() -> i64 {