KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
netif_t Struct Reference

Structure describing one usable network device. More...

#include <kos/net.h>

Public Member Functions

 LIST_ENTRY (knetif) if_list
 Device list handle (not a function!)
 

Data Fields

const char * name
 Device name ("bba", "la", etc)
 
const char * descr
 Long description of the device.
 
int index
 Unit index (starts at zero and counts upwards for multiple network devices of the same type)
 
uint32 dev_id
 Internal device ID (for whatever the driver wants)
 
uint32 flags
 Interface flags.
 
uint8 mac_addr [6]
 The device's MAC address.
 
uint8 ip_addr [4]
 The device's IP address (if any)
 
uint8 netmask [4]
 The device's netmask.
 
uint8 gateway [4]
 The device's gateway's IP address.
 
uint8 broadcast [4]
 The device's broadcast address.
 
uint8 dns [4]
 The device's DNS server address.
 
int mtu
 The device's MTU.
 
struct in6_addr ip6_lladdr
 The device's Link-local IPv6 address.
 
struct in6_addrip6_addrs
 Any further IPv6 addresses the device has.
 
int ip6_addr_count
 
struct in6_addr ip6_gateway
 The device's gateway's IPv6 address.
 
uint32 mtu6
 Default MTU over IPv6.
 
int hop_limit
 Default hop limit over IPv6.
 
int(* if_detect )(struct knetif *self)
 Attempt to detect the device.
 
int(* if_init )(struct knetif *self)
 Initialize the device.
 
int(* if_shutdown )(struct knetif *self)
 Shutdown the device.
 
int(* if_start )(struct knetif *self)
 Start the device (after init or stop).
 
int(* if_stop )(struct knetif *self)
 Stop (hibernate) the device.
 
int(* if_tx )(struct knetif *self, const uint8 *data, int len, int blocking)
 Queue a packet for transmission.
 
int(* if_tx_commit )(struct knetif *self)
 Commit any queued output packets.
 
int(* if_rx_poll )(struct knetif *self)
 Poll for queued receive packets, if necessary.
 
int(* if_set_flags )(struct knetif *self, uint32 flags_and, uint32 flags_or)
 Set flags; you should generally manipulate flags through here so that the driver gets a chance to act on the info.
 
int(* if_set_mc )(struct knetif *self, const uint8 *list, int count)
 Set the device's multicast list.
 

Detailed Description

Structure describing one usable network device.

Each usable network device should have one of these describing it. These must be registered to the network layer before the device is usable.

Member Function Documentation

◆ LIST_ENTRY()

netif_t::LIST_ENTRY ( knetif )

Device list handle (not a function!)

Field Documentation

◆ broadcast

uint8 netif_t::broadcast[4]

The device's broadcast address.

◆ descr

const char* netif_t::descr

Long description of the device.

◆ dev_id

uint32 netif_t::dev_id

Internal device ID (for whatever the driver wants)

◆ dns

uint8 netif_t::dns[4]

The device's DNS server address.

◆ flags

uint32 netif_t::flags

Interface flags.

◆ gateway

uint8 netif_t::gateway[4]

The device's gateway's IP address.

◆ hop_limit

int netif_t::hop_limit

Default hop limit over IPv6.

◆ if_detect

int(* netif_t::if_detect) (struct knetif *self)

Attempt to detect the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ if_init

int(* netif_t::if_init) (struct knetif *self)

Initialize the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ if_rx_poll

int(* netif_t::if_rx_poll) (struct knetif *self)

Poll for queued receive packets, if necessary.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ if_set_flags

int(* netif_t::if_set_flags) (struct knetif *self, uint32 flags_and, uint32 flags_or)

Set flags; you should generally manipulate flags through here so that the driver gets a chance to act on the info.

Parameters
selfThe network device in question.
flags_andBitmask to and with the flags.
flags_orBitmask to or with the flags.

◆ if_set_mc

int(* netif_t::if_set_mc) (struct knetif *self, const uint8 *list, int count)

Set the device's multicast list.

Parameters
selfThe network device in question.
listThe list of MAC addresses (6 * count bytes).
countThe number of addresses in list.

◆ if_shutdown

int(* netif_t::if_shutdown) (struct knetif *self)

Shutdown the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ if_start

int(* netif_t::if_start) (struct knetif *self)

Start the device (after init or stop).

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ if_stop

int(* netif_t::if_stop) (struct knetif *self)

Stop (hibernate) the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure

◆ if_tx

int(* netif_t::if_tx) (struct knetif *self, const uint8 *data, int len, int blocking)

Queue a packet for transmission.

Parameters
selfThe network device in question.
dataThe packet to transmit.
lenThe length of the packet in bytes.
blocking1 if we should block if needed, 0 otherwise.
Return values
NETIF_TX_OKOn success.
NETIF_TX_ERROROn general failure.
NETIF_TX_AGAINIf non-blocking and we must block to send.

◆ if_tx_commit

int(* netif_t::if_tx_commit) (struct knetif *self)

Commit any queued output packets.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.

◆ index

int netif_t::index

Unit index (starts at zero and counts upwards for multiple network devices of the same type)

◆ ip6_addr_count

int netif_t::ip6_addr_count

◆ ip6_addrs

struct in6_addr* netif_t::ip6_addrs

Any further IPv6 addresses the device has.

The first address in this list will always be used, unless otherwise specified.

◆ ip6_gateway

struct in6_addr netif_t::ip6_gateway

The device's gateway's IPv6 address.

◆ ip6_lladdr

struct in6_addr netif_t::ip6_lladdr

The device's Link-local IPv6 address.

◆ ip_addr

uint8 netif_t::ip_addr[4]

The device's IP address (if any)

◆ mac_addr

uint8 netif_t::mac_addr[6]

The device's MAC address.

◆ mtu

int netif_t::mtu

The device's MTU.

◆ mtu6

uint32 netif_t::mtu6

Default MTU over IPv6.

◆ name

const char* netif_t::name

Device name ("bba", "la", etc)

◆ netmask

uint8 netif_t::netmask[4]

The device's netmask.


The documentation for this struct was generated from the following file: