5.6. network_interface — Network interface

The network interface module has a list of all network interfaces and their states.

Network interface modules:


Source code: src/inet/network_interface.h, src/inet/network_interface.c

Test coverage: src/inet/network_interface.c


Version
7.0.0

Typedefs

typedef int(* network_interface_start_t)(struct network_interface_t *netif_p)
typedef int(* network_interface_stop_t)(struct network_interface_t *netif_p)
typedef int(* network_interface_is_up_t)(struct network_interface_t *netif_p)

Functions

int network_interface_module_init(void)

Initialize the network interface module. This function must be called before calling any other function in this module.

The module will only be initialized once even if this function is called multiple times.

Return
zero(0) or negative error code.

int network_interface_add(struct network_interface_t *netif_p)

Add given network interface to the IP stack.

Return
zero(0) or negative error code.
Parameters
  • netif_p -

    Network interface to add.

int network_interface_start(struct network_interface_t *netif_p)

Enable given network interface.

Return
zero(0) or negative error code.
Parameters
  • netif_p -

    Network interface to enable.

int network_interface_set_ip_address(struct network_interface_t *netif_p, struct inet_ip_addr_t *addr_p)

Get the ip address of given network interface.

Return
zero(0) or negative error code.
Parameters
  • netif_p -

    Network interface to get the ip address of.

int network_interface_get_ip_address(struct network_interface_t *netif_p, struct inet_ip_addr_t *addr_p)

Get the ip address of given network interface.

Return
zero(0) or negative error code.
Parameters
  • netif_p -

    Network interface to get the ip address of.

struct network_interface_t

Public Members

struct netif netif
const char *name_p
struct inet_ip_addr_t ipaddr
struct inet_ip_addr_t netmask
struct inet_ip_addr_t gw
netif_init_fn init
network_interface_start_t start
network_interface_stop_t stop
network_interface_is_up_t is_up
struct network_interface_t *next_p