Defines | Functions | Variables

alexb/lib/lwip/contrib/src/core/netif.c File Reference

lwIP network interface abstraction More...

#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/tcp_impl.h"
#include "lwip/snmp.h"
#include "lwip/igmp.h"
#include "netif/etharp.h"
#include "lwip/stats.h"

Defines

#define NETIF_STATUS_CALLBACK(n)
#define NETIF_LINK_CALLBACK(n)

Functions

void netif_init (void)
struct netifnetif_add (struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
 Add a network interface to the list of lwIP netifs.
void netif_set_addr (struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
 Change IP address configuration for a network interface (including netmask and default gateway).
void netif_remove (struct netif *netif)
 Remove a network interface from the list of lwIP netifs.
struct netifnetif_find (char *name)
 Find a network interface by searching for its name.
void netif_set_ipaddr (struct netif *netif, ip_addr_t *ipaddr)
 Change the IP address of a network interface.
void netif_set_gw (struct netif *netif, ip_addr_t *gw)
 Change the default gateway for a network interface.
void netif_set_netmask (struct netif *netif, ip_addr_t *netmask)
 Change the netmask of a network interface.
void netif_set_default (struct netif *netif)
 Set a network interface as the default network interface (used to output all packets for which no specific route is found).
void netif_set_up (struct netif *netif)
 Bring an interface up, available for processing traffic.
void netif_set_down (struct netif *netif)
 Bring an interface down, disabling any traffic processing.
void netif_set_link_up (struct netif *netif)
 Called by a driver when its link goes up.
void netif_set_link_down (struct netif *netif)
 Called by a driver when its link goes down.

Variables

struct netifnetif_list
 The list of network interfaces.
struct netifnetif_default
 The default network interface.

Detailed Description

lwIP network interface abstraction


Define Documentation

#define NETIF_LINK_CALLBACK (   n  ) 
#define NETIF_STATUS_CALLBACK (   n  ) 

Function Documentation

struct netif* netif_add ( struct netif netif,
ip_addr_t ipaddr,
ip_addr_t netmask,
ip_addr_t gw,
void *  state,
netif_init_fn  init,
netif_input_fn  input 
) [read]

Add a network interface to the list of lwIP netifs.

Parameters:
netif a pre-allocated netif structure
ipaddr IP address for the new netif
netmask network mask for the new netif
gw default gateway IP address for the new netif
state opaque data passed to the new netif
init callback function that initializes the interface
input callback function that is called to pass ingress packets up in the protocol layer stack.
Returns:
netif, or NULL if failed.
struct netif* netif_find ( char *  name  )  [read]

Find a network interface by searching for its name.

Parameters:
name the name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0')
void netif_init ( void   ) 
void netif_remove ( struct netif netif  ) 

Remove a network interface from the list of lwIP netifs.

Parameters:
netif the network interface to remove
void netif_set_addr ( struct netif netif,
ip_addr_t ipaddr,
ip_addr_t netmask,
ip_addr_t gw 
)

Change IP address configuration for a network interface (including netmask and default gateway).

Parameters:
netif the network interface to change
ipaddr the new IP address
netmask the new netmask
gw the new default gateway
void netif_set_default ( struct netif netif  ) 

Set a network interface as the default network interface (used to output all packets for which no specific route is found).

Parameters:
netif the default network interface
void netif_set_down ( struct netif netif  ) 

Bring an interface down, disabling any traffic processing.

Note:
: Enabling DHCP on a down interface will make it come up once configured.
See also:
dhcp_start()
void netif_set_gw ( struct netif netif,
ip_addr_t gw 
)

Change the default gateway for a network interface.

Parameters:
netif the network interface to change
gw the new default gateway
Note:
call netif_set_addr() if you also want to change ip address and netmask
void netif_set_ipaddr ( struct netif netif,
ip_addr_t ipaddr 
)

Change the IP address of a network interface.

Parameters:
netif the network interface to change
ipaddr the new IP address
Note:
call netif_set_addr() if you also want to change netmask and default gateway
void netif_set_link_down ( struct netif netif  ) 

Called by a driver when its link goes down.

void netif_set_link_up ( struct netif netif  ) 

Called by a driver when its link goes up.

void netif_set_netmask ( struct netif netif,
ip_addr_t netmask 
)

Change the netmask of a network interface.

Parameters:
netif the network interface to change
netmask the new netmask
Note:
call netif_set_addr() if you also want to change ip address and default gateway
void netif_set_up ( struct netif netif  ) 

Bring an interface up, available for processing traffic.

Note:
: Enabling DHCP on a down interface will make it come up once configured.
See also:
dhcp_start()

Variable Documentation

The default network interface.

struct netif* netif_list

The list of network interfaces.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines