std1.0.0-beta-7 SafeC docs

std :: net::net_core

Struct std::NetIf

#include <std/net/net_core.h> source

struct NetIf {
    unsigned char mac[NET_MAC_LEN];
    unsigned int ip4;
    unsigned int gateway;
    unsigned int netmask;
    ?fn int(&Erased, []const unsigned char) tx_fn;
    ?&Erased iface_ctx;
}

Fields

§unsigned char mac[NET_MAC_LEN]source

hardware MAC address

§unsigned int ip4source

assigned IPv4, numeric form (see net_ip4)

§unsigned int gatewaysource

default gateway IPv4 (numeric form, see net_ip4)

§unsigned int netmasksource

subnet mask (numeric form, see net_ip4)

§?fn int(&Erased, []const unsigned char) tx_fnsource

The driver's transmit and context, stored type-erased (one stack may run interfaces from different drivers); NetIf::new<T> is the only writer and always pairs T's thunk with a &T (see std/erased.h).

null for an interface with no driver

§?&Erased iface_ctxsource

the &T

Methods

§generic<T: NetDriver> static struct NetIf new(&T drv)source · definition

An interface whose tx() calls drv.transmit(frame). drv must outlive it.

Transmit a packet. Returns 0 on success.