UbixOS  2.0
netif.h File Reference
#include <net/opt.h>
#include <net/err.h>
#include <net/ip_addr.h>
#include <net/def.h>
#include <net/pbuf.h>
#include <net/stats.h>
Include dependency graph for netif.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  netif
 
struct  nicBuffer
 

Macros

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

Enumerations

enum  lwip_internal_netif_client_data_index { LWIP_NETIF_CLIENT_DATA_INDEX_MAX }
 
enum  netif_mac_filter_action { NETIF_DEL_MAC_FILTER = 0, NETIF_ADD_MAC_FILTER = 1 }
 

Functions

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

Variables

struct netifnetif_default
 
struct netifnetif_list
 
struct nicBuffertmpBuf
 

Detailed Description

netif API (to be used from TCPIP thread)

Definition in file netif.h.

Macro Definition Documentation

◆ ENABLE_LOOPBACK

#define ENABLE_LOOPBACK   (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF)

Definition at line 42 of file netif.h.

◆ IF__NETIF_CHECKSUM_ENABLED

#define IF__NETIF_CHECKSUM_ENABLED (   netif,
  chksumflag 
)

Definition at line 357 of file netif.h.

◆ netif_is_link_up

#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 421 of file netif.h.

◆ NETIF_MAX_HWADDR_LEN

#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 71 of file netif.h.

◆ NETIF_SET_CHECKSUM_CTRL

#define NETIF_SET_CHECKSUM_CTRL (   netif,
  chksumflags 
)

Definition at line 356 of file netif.h.

◆ NETIF_SET_HWADDRHINT

#define NETIF_SET_HWADDRHINT (   netif,
  hint 
)

Definition at line 475 of file netif.h.

Typedef Documentation

◆ netif_init_fn

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 163 of file netif.h.

◆ netif_input_fn

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 170 of file netif.h.

◆ netif_linkoutput_fn

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 204 of file netif.h.

◆ netif_status_callback_fn

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

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

Definition at line 206 of file netif.h.

Enumeration Type Documentation

◆ lwip_internal_netif_client_data_index

Enumerator
LWIP_NETIF_CLIENT_DATA_INDEX_MAX 

Definition at line 115 of file netif.h.

◆ netif_mac_filter_action

MAC Filter Actions, these are passed to a netif's igmp_mac_filter or mld_mac_filter callback function.

Enumerator
NETIF_DEL_MAC_FILTER 

Delete a filter entry

NETIF_ADD_MAC_FILTER 

Add a filter entry

Definition at line 151 of file netif.h.

Function Documentation

◆ ethernetif_input()

void ethernetif_input ( struct netif netif)

This function should be called when a packet is ready to be read from the interface. It uses the function low_level_input() that should handle the actual reception of bytes from the network interface. Then the type of the received packet is determined and the appropriate input function is called.

Parameters
netifthe lwip network interface structure for this ethernetif

Definition at line 270 of file ethernetif.c.

References netif::state.

Referenced by lnc_thread().

◆ netif_init()

void netif_init ( void  )

Definition at line 163 of file netif.c.

References IP_ADDR6_HOST, netif_add(), netif_set_link_up(), netif_set_up(), NULL, and tcpip_input().

Referenced by lwip_init().

Here is the call graph for this function:

◆ netif_input()

err_t netif_input ( struct pbuf p,
struct netif inp 
)

Forwards a received packet for input processing with ethernet_input() or ip_input() depending on netif flags. Don't call directly, pass to netif_add() and call netif->input(). Only works if the netif driver correctly sets NETIF_FLAG_ETHARP and/or NETIF_FLAG_ETHERNET flag!

Definition at line 203 of file netif.c.

References netif::flags, NETIF_FLAG_ETHARP, and NETIF_FLAG_ETHERNET.

Variable Documentation

◆ netif_default

struct netif* netif_default

The default network interface.

Definition at line 105 of file netif.c.

Referenced by netif_remove(), and netif_set_default().

◆ netif_list

struct netif* netif_list

The list of network interfaces.

Definition at line 104 of file netif.c.

Referenced by netif_find(), and netif_remove().

◆ tmpBuf

struct nicBuffer* tmpBuf

Definition at line 63 of file ethernetif.c.

Referenced by lnc_rxINT(), lnc_thread(), ne2kAllocBuffer(), and ne2kGetBuffer().