KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Data Fields
knetif 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!) More...
 

Data Fields

const char * name
 Device name ("bba", "la", etc) More...
 
const char * descr
 Long description of the device. More...
 
int index
 Unit index (starts at zero and counts upwards for multiple network devices of the same type) More...
 
uint32 dev_id
 Internal device ID (for whatever the driver wants) More...
 
uint32 flags
 Interface flags. More...
 
uint8 mac_addr [6]
 The device's MAC address. More...
 
uint8 ip_addr [4]
 The device's IP address (if any) More...
 
uint8 netmask [4]
 The device's netmask. More...
 
uint8 gateway [4]
 The device's gateway's IP address. More...
 
uint8 broadcast [4]
 The device's broadcast address. More...
 
uint8 dns [4]
 The device's DNS server address. More...
 
int mtu
 The device's MTU. More...
 
struct in6_addr ip6_lladdr
 The device's Link-local IPv6 address. More...
 
struct in6_addrip6_addrs
 Any further IPv6 addresses the device has. The first address in this list will always be used, unless otherwise specified. More...
 
int ip6_addr_count
 
struct in6_addr ip6_gateway
 The device's gateway's IPv6 address. More...
 
uint32 mtu6
 Default MTU over IPv6. More...
 
int hop_limit
 Default hop limit over IPv6. More...
 
int(* if_detect )(struct knetif *self)
 Attempt to detect the device. More...
 
int(* if_init )(struct knetif *self)
 Initialize the device. More...
 
int(* if_shutdown )(struct knetif *self)
 Shutdown the device. More...
 
int(* if_start )(struct knetif *self)
 Start the device (after init or stop). More...
 
int(* if_stop )(struct knetif *self)
 Stop (hibernate) the device. More...
 
int(* if_tx )(struct knetif *self, const uint8 *data, int len, int blocking)
 Queue a packet for transmission. More...
 
int(* if_tx_commit )(struct knetif *self)
 Commit any queued output packets. More...
 
int(* if_rx_poll )(struct knetif *self)
 Poll for queued receive packets, if neccessary. More...
 
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. More...
 
int(* if_set_mc )(struct knetif *self, const uint8 *list, int count)
 Set the device's multicast list. More...
 

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 useable.

Member Function Documentation

knetif::LIST_ENTRY ( knetif  )

Device list handle (not a function!)

Field Documentation

uint8 knetif::broadcast[4]

The device's broadcast address.

const char* knetif::descr

Long description of the device.

uint32 knetif::dev_id

Internal device ID (for whatever the driver wants)

uint8 knetif::dns[4]

The device's DNS server address.

uint32 knetif::flags

Interface flags.

uint8 knetif::gateway[4]

The device's gateway's IP address.

int knetif::hop_limit

Default hop limit over IPv6.

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

Attempt to detect the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
int(* knetif::if_init)(struct knetif *self)

Initialize the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
int(* knetif::if_rx_poll)(struct knetif *self)

Poll for queued receive packets, if neccessary.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
int(* knetif::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.
int(* knetif::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.
int(* knetif::if_shutdown)(struct knetif *self)

Shutdown the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
int(* knetif::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.
int(* knetif::if_stop)(struct knetif *self)

Stop (hibernate) the device.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure
int(* knetif::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.
int(* knetif::if_tx_commit)(struct knetif *self)

Commit any queued output packets.

Parameters
selfThe network device in question.
Returns
0 on success, <0 on failure.
int knetif::index

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

int knetif::ip6_addr_count
struct in6_addr* knetif::ip6_addrs

Any further IPv6 addresses the device has. The first address in this list will always be used, unless otherwise specified.

struct in6_addr knetif::ip6_gateway

The device's gateway's IPv6 address.

struct in6_addr knetif::ip6_lladdr

The device's Link-local IPv6 address.

uint8 knetif::ip_addr[4]

The device's IP address (if any)

uint8 knetif::mac_addr[6]

The device's MAC address.

int knetif::mtu

The device's MTU.

uint32 knetif::mtu6

Default MTU over IPv6.

const char* knetif::name

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

uint8 knetif::netmask[4]

The device's netmask.


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