Embedded TCP/IP stack  4.7.0
Network Interfaces API

Detailed Description

The Network Interface API allows an application to control various interface parameters, such as the IP address, the gateway address, the subnet mask, and others.

Modules

 Wi-Fi Interface API
 
 Ethernet Interface API
 

Data Structures

struct  fnet_netif_statistics
 Network interface statistics, used by the fnet_netif_get_statistics(). More...
 
struct  fnet_netif_ip6_addr_info
 Interface IPv6 address information structure. More...
 
struct  fnet_netif_ip6_prefix
 Interface IPv6 Prefix structure. More...
 
struct  fnet_netif_ip6_neighbor_cache
 Interface IPv6 Neighbor Cache structure. More...
 

Macros

#define FNET_MAC_ADDR_STR_SIZE   (18)
 Size of the string buffer that will contain null-terminated ASCII string of MAC address, represented by six groups of two hexadecimal digits, separated by colons (:). More...
 
#define FNET_ETH_MTU   (1500u)
 The largest allowed MTU by Ethernet at the network layer.

. More...

 
#define FNET_MAC_ADDR_INIT(a, b, c, d, e, f)
 Converts the standard notation a:b:c:d:e:f to fnet_mac_addr_t value. More...
 
#define FNET_NETIF_NAMELEN
 The maximum length of a network interface name. More...
 
#define FNET_NETIF_LL_ADDR_COPY(from_addr, to_addr, ll_size)
 Copying Link-layer address. More...
 
#define FNET_NETIF_LL_ADDR_ARE_EQUAL(a, b, size)
 Check Link-layer address Equality. More...
 

Typedefs

typedef fnet_uint8_t fnet_mac_addr_t[6]
 Media Access Control (MAC) address type. More...
 
typedef void * fnet_netif_desc_t
 Network interface descriptor. More...
 
typedef fnet_uint8_t fnet_netif_ll_addr_t[FNET_NETIF_LL_ADDR_MAX]
 Link-layer address. For example, Ethernet interafce uses the address with size set to 6. More...
 
typedef struct fnet_netif_ip6_addr_info fnet_netif_ip6_addr_info_t
 Interface IPv6 address information structure. More...
 
typedef struct fnet_netif_ip6_prefix fnet_netif_ip6_prefix_t
 Interface IPv6 Prefix structure. More...
 
typedef struct fnet_netif_ip6_neighbor_cache fnet_netif_ip6_neighbor_cache_t
 Interface IPv6 Neighbor Cache structure. More...
 
typedef void(* fnet_netif_callback_ip4_addr_conflict_t) (fnet_netif_desc_t netif)
 Event handler callback function prototype, that is called when there is an IP address conflict with another system on the network. More...
 

Enumerations

enum  fnet_netif_type_t {
  FNET_NETIF_TYPE_OTHER,
  FNET_NETIF_TYPE_ETHERNET,
  FNET_NETIF_TYPE_WIFI,
  FNET_NETIF_TYPE_LOOPBACK
}
 Network interface types. More...
 
enum  fnet_netif_ip6_addr_state_t {
  FNET_NETIF_IP6_ADDR_STATE_NOT_USED,
  FNET_NETIF_IP6_ADDR_STATE_TENTATIVE,
  FNET_NETIF_IP6_ADDR_STATE_PREFERRED
}
 Possible IPv6 address states. More...
 
enum  fnet_netif_ip_addr_type_t {
  FNET_NETIF_IP_ADDR_TYPE_MANUAL,
  FNET_NETIF_IP_ADDR_TYPE_AUTOCONFIGURABLE,
  FNET_NETIF_IP_ADDR_TYPE_DHCP
}
 Possible IPv6 address types. More...
 

Functions

fnet_char_tfnet_mac_to_str (const fnet_mac_addr_t addr, fnet_char_t *str_mac)
 Converts a 6 byte MAC address into a null terminated string. More...
 
fnet_return_t fnet_str_to_mac (const fnet_char_t *str_mac, fnet_mac_addr_t addr)
 Converts a null terminated string to a 6 byte MAC address. More...
 
fnet_netif_desc_t fnet_netif_get_by_name (const fnet_char_t *name)
 Looks for a network interface according to the specified name. More...
 
fnet_netif_desc_t fnet_netif_get_by_number (fnet_index_t n)
 Looks for a network interface according to its number. More...
 
fnet_netif_desc_t fnet_netif_get_by_ip4_addr (fnet_ip4_addr_t addr)
 Looks for a network interface according to the specified IPv4 address. More...
 
void fnet_netif_get_name (fnet_netif_desc_t netif_desc, fnet_char_t *name, fnet_size_t name_size)
 Retrieves a name of the specified network interface. More...
 
void fnet_netif_set_default (fnet_netif_desc_t netif_desc)
 Assigns the default network interface. More...
 
fnet_netif_desc_t fnet_netif_get_default (void)
 Retrieves the default network interface. More...
 
void fnet_netif_set_ip4_addr (fnet_netif_desc_t netif_desc, fnet_ip4_addr_t ipaddr, fnet_ip4_addr_t subnet_mask)
 Sets the IPv4 address of the specified network interface. More...
 
fnet_ip4_addr_t fnet_netif_get_ip4_addr (fnet_netif_desc_t netif_desc)
 Retrieves an IPv4 address of the specified network interface. More...
 
fnet_ip4_addr_t fnet_netif_get_ip4_subnet_mask (fnet_netif_desc_t netif_desc)
 Retrieves a subnet mask of the specified network interface. More...
 
void fnet_netif_set_ip4_gateway (fnet_netif_desc_t netif_desc, fnet_ip4_addr_t gw)
 Sets the gateway IP address of the specified network interface. More...
 
fnet_ip4_addr_t fnet_netif_get_ip4_gateway (fnet_netif_desc_t netif_desc)
 Retrieves a gateway IPv4 address of the specified network interface. More...
 
void fnet_netif_set_ip4_dns (fnet_netif_desc_t netif_desc, fnet_ip4_addr_t dns)
 Sets the DNS server IPv4 address of the specified network interface. More...
 
fnet_ip4_addr_t fnet_netif_get_ip4_dns (fnet_netif_desc_t netif_desc)
 Retrieves the DNS server IP address of the specified network interface. More...
 
fnet_return_t fnet_netif_set_hw_addr (fnet_netif_desc_t netif_desc, fnet_uint8_t *hw_addr, fnet_size_t hw_addr_size)
 Sets the hardware address of the specified network interface. More...
 
fnet_return_t fnet_netif_get_hw_addr (fnet_netif_desc_t netif_desc, fnet_uint8_t *hw_addr, fnet_size_t hw_addr_size)
 Retrieves a hardware address of the specified network interface. More...
 
fnet_netif_type_t fnet_netif_get_type (fnet_netif_desc_t netif_desc)
 Retrieves the type of the specified network interface. More...
 
fnet_netif_ip_addr_type_t fnet_netif_get_ip4_addr_type (fnet_netif_desc_t netif_desc)
 Determines the way IPv4 address parameters were obtained. More...
 
void fnet_netif_set_ip4_addr_type (fnet_netif_desc_t netif_desc, fnet_netif_ip_addr_type_t ipaddr_type)
 Sets the way IPv4 address parameters were obtained. More...
 
fnet_bool_t fnet_netif_is_connected (fnet_netif_desc_t netif_desc)
 Determines the link status of the network interface. More...
 
fnet_return_t fnet_netif_get_statistics (fnet_netif_desc_t netif_desc, struct fnet_netif_statistics *statistics)
 Retrieves the network interface statistics. More...
 
void fnet_netif_set_callback_on_ip4_addr_conflict (fnet_netif_callback_ip4_addr_conflict_t callback)
 Registers the "IPv4 address conflict" event handler. More...
 
fnet_bool_t fnet_netif_is_ip4_addr_conflict (fnet_netif_desc_t netif_desc)
 Determines if there is IPv4 address conflict. More...
 
void fnet_netif_clear_ip4_addr_conflict (fnet_netif_desc_t netif_desc)
 Clears IPv4 address conflict flag. More...
 
void fnet_netif_join_ip4_multicast (fnet_netif_desc_t netif_desc, fnet_ip4_addr_t multicast_addr)
 Joins the specified network interface to IPv4 multicast group. More...
 
void fnet_netif_leave_ip4_multicast (fnet_netif_desc_t netif_desc, fnet_ip4_addr_t multicast_addr)
 Leaves the specified network interface from IPv4 multicast group. More...
 
void fnet_netif_join_ip6_multicast (fnet_netif_desc_t netif_desc, const fnet_ip6_addr_t *multicast_addr)
 Joins the specified network interface to IPv6 multicast group. More...
 
void fnet_netif_leave_ip6_multicast (fnet_netif_desc_t netif_desc, fnet_ip6_addr_t *multicast_addr)
 Leaves the specified network interface from IPv6 multicast group. More...
 
fnet_bool_t fnet_netif_get_ip6_addr (fnet_netif_desc_t netif_desc, fnet_index_t n, fnet_netif_ip6_addr_info_t *addr_info)
 Retrieves an IPv6 address of the specified network interface. More...
 
fnet_bool_t fnet_netif_get_ip6_dns (fnet_netif_desc_t netif_desc, fnet_index_t n, fnet_ip6_addr_t *addr_dns)
 Retrieves the n-th DNS IPv6 address of the specified network interface. More...
 
fnet_return_t fnet_netif_bind_ip6_addr (fnet_netif_desc_t netif_desc, const fnet_ip6_addr_t *addr, fnet_netif_ip_addr_type_t addr_type)
 Binds the IPv6 address to the specified network interface. More...
 
fnet_return_t fnet_netif_unbind_ip6_addr (fnet_netif_desc_t netif_desc, const fnet_ip6_addr_t *addr)
 Unbinds the IPv6 address from the specified network interface. More...
 
fnet_bool_t fnet_netif_get_ip6_prefix (fnet_netif_desc_t netif_desc, fnet_index_t n, fnet_netif_ip6_prefix_t *ip6_prefix)
 Retrieves the n-th IPv6 prefix of the specified network interface. More...
 
fnet_bool_t fnet_netif_get_ip6_neighbor_cache (fnet_netif_desc_t netif_desc, fnet_index_t n, fnet_netif_ip6_neighbor_cache_t *ip6_neighbor_cache)
 Retrieves the n-th IPv6 neighbor cache entry of the specified network interface. More...
 
fnet_netif_desc_t fnet_netif_get_by_ip6_addr (const fnet_ip6_addr_t *ip_addr)
 Looks for a network interface according to the specified IPv6 address. More...
 
fnet_scope_id_t fnet_netif_get_scope_id (fnet_netif_desc_t netif_desc)
 Retrieves an Scope ID of the specified network interface. More...
 
fnet_size_t fnet_netif_get_mtu (fnet_netif_desc_t netif_desc)
 Retrieves a Maximum Transmission Unit (MTU) of the specified network interface. More...
 
fnet_netif_desc_t fnet_netif_get_by_scope_id (fnet_scope_id_t scope_id)
 Looks for a network interface according to the specified Scope ID. More...
 
fnet_netif_desc_t fnet_netif_get_by_sockaddr (const struct fnet_sockaddr *addr)
 Looks for a network interface according to the specified socket address. More...
 
fnet_return_t fnet_netif_init (fnet_netif_desc_t netif_desc, fnet_uint8_t *hw_addr, fnet_size_t hw_addr_size)
 Initializes network interface and adds it to FNET stack. More...
 
void fnet_netif_release (fnet_netif_desc_t netif_desc)
 Releases network interface and removes it from FNET stack. More...
 
fnet_bool_t fnet_netif_is_initialized (fnet_netif_desc_t netif_desc)
 Determines if the network interface is initialized. More...
 

© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net