STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
Data Structures | Macros | Typedefs | Functions | Variables
netif.h File Reference
#include "lwip/opt.h"
#include "lwip/err.h"
#include "lwip/ip_addr.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"

Go to the source code of this file.

Data Structures

struct  netif
 

Macros

#define ENABLE_LOOPBACK   (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)
 
#define NETIF_MAX_HWADDR_LEN   6U
 
#define NETIF_FLAG_UP   0x01U
 
#define NETIF_FLAG_BROADCAST   0x02U
 
#define NETIF_FLAG_LINK_UP   0x04U
 
#define NETIF_FLAG_ETHARP   0x08U
 
#define NETIF_FLAG_ETHERNET   0x10U
 
#define NETIF_FLAG_IGMP   0x20U
 
#define NETIF_FLAG_MLD6   0x40U
 
#define NETIF_SET_CHECKSUM_CTRL(netif, chksumflags)
 
#define IF__NETIF_CHECKSUM_ENABLED(netif, chksumflag)
 
#define netif_is_up(netif)   (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)
 
#define netif_is_link_up(netif)   (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)
 
#define NETIF_SET_HWADDRHINT(netif, hint)
 

Typedefs

typedef err_t(* netif_init_fn) (struct netif *netif)
 
typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)
 
typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)
 
typedef void(* netif_status_callback_fn) (struct netif *netif)
 

Functions

void netif_init (void)
 
struct netifnetif_add (struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
 
void netif_remove (struct netif *netif)
 
struct netifnetif_find (const char *name)
 
void netif_set_default (struct netif *netif)
 
void netif_set_up (struct netif *netif)
 
void netif_set_down (struct netif *netif)
 
void netif_set_link_up (struct netif *netif)
 
void netif_set_link_down (struct netif *netif)
 

Variables

struct netifnetif_list
 
struct netifnetif_default
 

Macro Definition Documentation

#define ENABLE_LOOPBACK   (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)

Definition at line 37 of file netif.h.

#define IF__NETIF_CHECKSUM_ENABLED (   netif,
  chksumflag 
)

Definition at line 313 of file netif.h.

#define NETIF_FLAG_BROADCAST   0x02U

If set, the netif has broadcast capability. Set by the netif driver in its init function.

Definition at line 80 of file netif.h.

#define NETIF_FLAG_ETHARP   0x08U

If set, the netif is an ethernet device using ARP. Set by the netif driver in its init function. Used to check input packet types and use of DHCP.

Definition at line 90 of file netif.h.

#define NETIF_FLAG_ETHERNET   0x10U

If set, the netif is an ethernet device. It might not use ARP or TCP/IP if it is used for PPPoE only.

Definition at line 94 of file netif.h.

#define NETIF_FLAG_IGMP   0x20U

If set, the netif has IGMP capability. Set by the netif driver in its init function.

Definition at line 97 of file netif.h.

#define NETIF_FLAG_LINK_UP   0x04U

If set, the interface has an active link (set by the network interface driver). Either set by the netif driver in its init function (if the link is up at that time) or at a later point once the link comes up (if link detection is supported by the hardware).

Definition at line 86 of file netif.h.

#define NETIF_FLAG_MLD6   0x40U

If set, the netif has MLD6 capability. Set by the netif driver in its init function.

Definition at line 100 of file netif.h.

#define NETIF_FLAG_UP   0x01U

Whether the network interface is 'up'. This is a software flag used to control whether this network interface is enabled and processes traffic. It must be set by the startup code before this netif can be used (also for dhcp/autoip).

Definition at line 77 of file netif.h.

#define netif_is_link_up (   netif)    (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0)

Ask if a link is up

Definition at line 368 of file netif.h.

#define netif_is_up (   netif)    (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)

Ask if an interface is up

Definition at line 356 of file netif.h.

#define NETIF_MAX_HWADDR_LEN   6U

Must be the maximum of all used hardware address lengths across all types of interfaces in use. This does not have to be changed, normally.

Definition at line 68 of file netif.h.

#define NETIF_SET_CHECKSUM_CTRL (   netif,
  chksumflags 
)

Definition at line 312 of file netif.h.

#define NETIF_SET_HWADDRHINT (   netif,
  hint 
)

Definition at line 411 of file netif.h.

Typedef Documentation

typedef err_t(* netif_init_fn) (struct netif *netif)

Function prototype for netif init functions. Set up flags and output/linkoutput callback functions in this function.

Parameters
netifThe netif to initialize

Definition at line 124 of file netif.h.

typedef err_t(* netif_input_fn) (struct pbuf *p, struct netif *inp)

Function prototype for netif->input functions. This function is saved as 'input' callback function in the netif struct. Call it when a packet has been received.

Parameters
pThe received packet, copied into a pbuf
inpThe netif which received the packet

Definition at line 131 of file netif.h.

typedef err_t(* netif_linkoutput_fn) (struct netif *netif, struct pbuf *p)

Function prototype for netif->linkoutput functions. Only used for ethernet netifs. This function is called by ARP when a packet shall be sent.

Parameters
netifThe netif which shall send a packet
pThe packet to send (raw ethernet packet)

Definition at line 165 of file netif.h.

typedef void(* netif_status_callback_fn) (struct netif *netif)

Function prototype for netif status- or link-callback functions.

Definition at line 167 of file netif.h.

Function Documentation

struct netif* netif_add ( struct netif netif,
void *  state,
netif_init_fn  init,
netif_input_fn  input 
)

Add a network interface to the list of lwIP netifs.

Parameters
netifa pre-allocated netif structure
ipaddrIP address for the new netif
netmasknetwork mask for the new netif
gwdefault gateway IP address for the new netif
stateopaque data passed to the new netif
initcallback function that initializes the interface
inputcallback function that is called to pass ingress packets up in the protocol layer stack.
Returns
netif, or NULL if failed.

Definition at line 184 of file netif.c.

struct netif* netif_find ( const char *  name)

Find a network interface by searching for its name

Parameters
namethe name of the netif (like netif->name) plus concatenated number in ascii representation (e.g. 'en0')

Definition at line 389 of file netif.c.

void netif_init ( void  )

Definition at line 139 of file netif.c.

void netif_remove ( struct netif netif)

Remove a network interface from the list of lwIP netifs.

Parameters
netifthe network interface to remove

Definition at line 319 of file netif.c.

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
netifthe default network interface

Definition at line 511 of file netif.c.

void netif_set_down ( struct netif netif)

Bring an interface down, disabling any traffic processing.

Definition at line 587 of file netif.c.

void netif_set_link_down ( struct netif netif)

Called by a driver when its link goes down

Definition at line 660 of file netif.c.

void netif_set_link_up ( struct netif netif)

Called by a driver when its link goes up

Definition at line 632 of file netif.c.

void netif_set_up ( struct netif netif)

Bring an interface up, available for processing traffic.

Definition at line 530 of file netif.c.

Variable Documentation

struct netif* netif_default

The default network interface.

Definition at line 85 of file netif.c.

struct netif* netif_list

The list of network interfaces.

Definition at line 84 of file netif.c.