mac48.nx
buildroot/runtime/mac48.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 25 | const MAC_ERR_SHORT: i64 = -1 |
| 26 | const MAC_ERR_FORMAT: i64 = -2 |
functions
| 29 | func mac_nibble(c: i64) -> i64 {
called by 1: mac48_parse |
| 44 | func mac48_parse(buf: *u8, n: i64, out: *u8) -> i64 { |
| 68 | func mac48_format(mac: *u8, out: *u8) -> i64 {
called by 1: main |
| 82 | func mac48_is_broadcast(mac: *u8) -> i64 {
called by 1: main |
| 92 | func mac48_is_multicast(mac: *u8) -> i64 {
called by 1: main |
| 99 | func mac48_is_local(mac: *u8) -> i64 { |
| 104 | func main() -> i64 { |