Skip to content

<net/protocols/netd.h>

netd's service protocol: driver handshake and network interface queries.

#include <net/protocols/netd.h>

Types

Type Definition Description
Ipv4Addr uint32_t IPv4 address in network byte order.
NetPort uint16_t TCP or UDP port.
MacAddr uint8_t Ethernet MAC address.

Constants

Name Value Description
IP4(x) Expands an IPv4 address in network byte order into four printf arguments, for "%u.%u.%u.%u".

Enumerations

NetdOpcode

One-byte opcodes on netd's service port.

Name Value Description
NETD_GET_NETIF 1 Read the interface configuration (NetdNetif).
NETD_DRVHANDSHAKE_INIT 2 Driver begins: grants its doorbell and sends its MAC.
NETD_DRVHANDSHAKE_STAGE2 3 Grants the tx ring's memory.
NETD_DRVHANDSHAKE_STAGE3 4 Grants the rx ring's memory; the reply holds the name.
NETD_DRVNOTIFY 5 Reserved; unused.
NETD_DRVWATCH 6 Reserved; unused.
SOCKET_UDP 7 Reserved; sockets use the SOCK_* commands in net/socket.h.
SOCKET_UDP_RECV 8 Reserved.
SOCKET_UDP_SENDTO 9 Reserved.
SOCKET_TCP 10 Reserved.
SOCKET_TCP_RECV 11 Reserved.
SOCKET_TCP_SEND 12 Reserved.
SOCKET_TCP_ACCEPT 13 Reserved.
SOCKET_BIND 14 Reserved.
SOCKET_CONNECT 15 Reserved.
SOCKET_LISTEN 16 Reserved.
SOCKET_CLOSE 17 Reserved.
SOCKET_IP 18 Reserved: raw IP sockets.
SOCKET_FRAME 19 Reserved: raw Ethernet sockets.
NETD_OPCODE_COUNT 20 Number of opcodes.

Structures

NetdHandshakeData

Request carrying a bare NetdOpcode; currently unused.

Field Type Description
op NetdOpcode The opcode.

NetdNetif

One network interface's configuration, as NETD_GET_NETIF returns it.

Field Type Description
ip Ipv4Addr Interface address.
netmask Ipv4Addr Subnet mask.
gateway Ipv4Addr Default gateway.
dns Ipv4Addr DNS server.
mac MacAddr Hardware address.
name char Interface name, NUL-terminated.