25 #ifndef _FNET_NETIF_H_ 27 #define _FNET_NETIF_H_ 31 #include "fnet_socket.h" 63 #define FNET_NETIF_NAMELEN (8U) 70 #define FNET_NETIF_LL_ADDR_MAX (16) 80 #define FNET_NETIF_LL_ADDR_COPY(from_addr, to_addr, ll_size) \ 81 (fnet_memcpy(&(to_addr)[0], &(from_addr)[0], (ll_size))) 86 #define FNET_NETIF_LL_ADDR_ARE_EQUAL(a, b, size) \ 87 (fnet_memcmp(&(a)[0], &(b)[0], (size)) == 0) 153 #if defined(__cplusplus) 373 #if FNET_CFG_DNS || defined(__DOXYGEN__) 577 #if FNET_CFG_IP4 || defined(__DOXYGEN__) 653 #if (FNET_CFG_MULTICAST & FNET_CFG_IP4) || defined(__DOXYGEN__) 702 #if FNET_CFG_IP6 || defined(__DOXYGEN__) 769 #if FNET_CFG_DNS || defined(__DOXYGEN__) 1058 #if defined(__cplusplus) fnet_netif_desc_t fnet_netif_get_by_name(const fnet_char_t *name)
Looks for a network interface according to the specified name.
fnet_ip6_addr_t address
IPv6 address.
struct fnet_netif_ip6_addr_info fnet_netif_ip6_addr_info_t
Interface IPv6 address information structure.
struct fnet_netif_ip6_prefix fnet_netif_ip6_prefix_t
Interface IPv6 Prefix structure.
fnet_scope_id_t fnet_netif_get_scope_id(fnet_netif_desc_t netif_desc)
Retrieves an Scope ID of the specified network interface.
struct fnet_netif_ip6_neighbor_cache fnet_netif_ip6_neighbor_cache_t
Interface IPv6 Neighbor Cache structure.
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.
Interface IPv6 address information structure.
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.
fnet_netif_ip_addr_type_t
Possible IPv6 address types.
Interface IPv6 Neighbor Cache structure.
fnet_netif_desc_t fnet_netif_get_default(void)
Retrieves the default network interface.
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.
fnet_uint32_t fnet_scope_id_t
cope zone index type, defining network interface.
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.
fnet_bool_t fnet_netif_is_initialized(fnet_netif_desc_t netif_desc)
Determines if the network interface is initialized.
fnet_netif_ip6_addr_state_t state
Address current state.
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.
fnet_netif_ll_addr_t ll_addr
Its link-layer address. Actual size is defiined by ll_addr_size.
fnet_size_t prefix_length
Prefix length (in bits). The number of leading bits in the Prefix that are valid. ...
fnet_netif_type_t fnet_netif_get_type(fnet_netif_desc_t netif_desc)
Retrieves the type of the specified network interface.
fnet_return_t
General return codes, used by most of API functions.
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.
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.
Preferred address - (RFC4862) an address assigned to an interface whose use by upper-layer protocols ...
The address is set using "Auto-IP" link-local autoconfiguration.
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.
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.
fnet_size_t ll_addr_size
Size of link-layer address.
fnet_ip6_addr_t prefix
Prefix of an IPv6 address.
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
128-bit IPv6 address type.
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.
void fnet_netif_set_default(fnet_netif_desc_t netif_desc)
Assigns the default network interface.
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.
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.
fnet_uint32_t tx_packet
Tx packet count.
fnet_ip4_addr_t fnet_netif_get_ip4_addr(fnet_netif_desc_t netif_desc)
Retrieves an IPv4 address of the specified network interface.
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.
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.
fnet_netif_ip6_addr_state_t
Possible IPv6 address states.
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.
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.
Interface IPv6 Prefix structure.
void fnet_netif_clear_ip4_addr_conflict(fnet_netif_desc_t netif_desc)
Clears IPv4 address conflict flag.
Network interface statistics, used by the fnet_netif_get_statistics().
fnet_uint32_t rx_packet
Rx packet count.
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.
Tentative address - (RFC4862) an address whose uniqueness on a link is being verified, prior to its assignment to an interface. A tentative address is not considered assigned to an interface in the usual sense. An interface discards received packets addressed to a tentative address, but accepts Neighbor Discovery packets related to Duplicate Address Detection for the tentative address.
The address is set using DHCP.
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...
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.
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.
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.
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.
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.
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.
fnet_bool_t is_router
A flag indicating whether the neighbor is a router (FNET_TRUE) or a host (FNET_FALSE).
fnet_ip6_addr_t ip_addr
Neighbor’s on-link unicast IP address.
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.
unsigned int fnet_index_t
Unsigned integer type representing the index.
fnet_uint32_t fnet_ip4_addr_t
32-bit IPv4 address type.
char fnet_char_t
Type representing the charecter.
void fnet_netif_release(fnet_netif_desc_t netif_desc)
Releases network interface and removes it from FNET stack.
fnet_bool_t fnet_netif_is_connected(fnet_netif_desc_t netif_desc)
Determines the link status of the network interface.
fnet_return_t fnet_netif_get_statistics(fnet_netif_desc_t netif_desc, struct fnet_netif_statistics *statistics)
Retrieves the network interface statistics.
fnet_size_t fnet_netif_get_mtu(fnet_netif_desc_t netif_desc)
Retrieves a Maximum Transmission Unit (MTU) of the specified network interface.
fnet_netif_desc_t fnet_netif_get_by_number(fnet_index_t n)
Looks for a network interface according to its number.
void * fnet_netif_desc_t
Network interface descriptor.
fnet_netif_ip_addr_type_t type
How the address was acquired.
The address is set manually.
Socket address structure.
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.
fnet_netif_type_t
Network interface types.
fnet_bool_t fnet_netif_is_ip4_addr_conflict(fnet_netif_desc_t netif_desc)
Determines if there is IPv4 address conflict.
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.
void fnet_netif_set_callback_on_ip4_addr_conflict(fnet_netif_callback_ip4_addr_conflict_t callback)
Registers the "IPv4 address conflict" event handler.
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 a...