Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Fnet_netif
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... | |
Typedefs | |
typedef fnet_uint8_t | fnet_mac_addr_t [6] |
Media Access Control (MAC) address type. | |
typedef void * | fnet_netif_desc_t |
Network interface descriptor. | |
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. | |
typedef struct fnet_netif_ip6_addr_info | fnet_netif_ip6_addr_info_t |
Interface IPv6 address information structure. | |
typedef struct fnet_netif_ip6_prefix | fnet_netif_ip6_prefix_t |
Interface IPv6 Prefix structure. | |
typedef struct fnet_netif_ip6_neighbor_cache | fnet_netif_ip6_neighbor_cache_t |
Interface IPv6 Neighbor Cache structure. | |
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. | |
Enumerations | |
enum | fnet_netif_type_t { FNET_NETIF_TYPE_OTHER, FNET_NETIF_TYPE_ETHERNET, FNET_NETIF_TYPE_LOOPBACK } |
Network interface types. More... | |
enum | fnet_netif_ip6_addr_state_t { FNET_NETIF_IP6_ADDR_STATE_NOT_USED = 0, FNET_NETIF_IP6_ADDR_STATE_TENTATIVE = 1, FNET_NETIF_IP6_ADDR_STATE_PREFERRED = 2 } |
Possible IPv6 address states. More... | |
enum | fnet_netif_ip_addr_type_t { FNET_NETIF_IP_ADDR_TYPE_MANUAL = 0, FNET_NETIF_IP_ADDR_TYPE_AUTOCONFIGURABLE = 1, FNET_NETIF_IP_ADDR_TYPE_DHCP = 2 } |
Possible IPv6 address types. More... | |
Functions | |
fnet_char_t * | fnet_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. | |
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. | |
fnet_netif_desc_t | fnet_netif_get_by_name (fnet_char_t *name) |
Looks for a network interface according to the specified name. | |
fnet_netif_desc_t | fnet_netif_get_by_number (fnet_index_t n) |
Looks for a network interface according to its number. | |
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_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. | |
void | fnet_netif_set_default (fnet_netif_desc_t netif_desc) |
Assigns the default network interface. | |
fnet_netif_desc_t | fnet_netif_get_default (void) |
Retrieves the default 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_ip4_addr_t | fnet_netif_get_ip4_addr (fnet_netif_desc_t netif_desc) |
Retrieves an IPv4 address of the specified network interface. | |
void | fnet_netif_set_ip4_subnet_mask (fnet_netif_desc_t netif_desc, fnet_ip4_addr_t subnet_mask) |
Sets the subnet mask of the specified 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. | |
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. | |
fnet_ip4_addr_t | fnet_netif_get_ip4_gateway (fnet_netif_desc_t netif_desc) |
Retrieves a 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 IP address of the specified 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_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. | |
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. | |
fnet_netif_type_t | fnet_netif_get_type (fnet_netif_desc_t netif_desc) |
Retrieves the type of the specified network interface. | |
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. | |
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_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. | |
void | fnet_netif_set_callback_on_ip4_addr_conflict (fnet_netif_callback_ip4_addr_conflict_t callback) |
Registers the "IPv4 address conflict" event handler. | |
fnet_bool_t | fnet_netif_is_ip4_addr_conflict (fnet_netif_desc_t netif_desc) |
Determines if there is IPv4 address conflict. | |
void | fnet_netif_clear_ip4_addr_conflict (fnet_netif_desc_t netif_desc) |
Clears IPv4 address conflict flag. | |
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. | |
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_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. | |
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. | |
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. | |
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_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_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. | |
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. | |
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. | |
fnet_scope_id_t | fnet_netif_get_scope_id (fnet_netif_desc_t netif_desc) |
Retrieves an Scope ID of the specified network interface. | |
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_scope_id (fnet_scope_id_t scope_id) |
Looks for a network interface according to the specified Scope ID. | |
fnet_netif_desc_t | fnet_netif_get_by_sockaddr (const struct sockaddr *addr) |
Looks for a network interface according to the specified socket address. | |
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_release (fnet_netif_desc_t netif_desc) |
Releases network interface and removes it from FNET stack. | |
fnet_bool_t | fnet_netif_is_initialized (fnet_netif_desc_t netif_desc) |
Determines if the network interface is initialized. |
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.
Typedef Documentation
typedef fnet_uint8_t fnet_mac_addr_t[6] |
Media Access Control (MAC) address type.
Definition at line 51 of file fnet_eth.h.
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.
- Parameters:
-
netif Network interface descriptor that has duplicated IP address.
- See also:
- fnet_socket_rx_handler_init()
Definition at line 612 of file fnet_netif.h.
typedef void* fnet_netif_desc_t |
Network interface descriptor.
Definition at line 71 of file fnet_netif.h.
typedef struct fnet_netif_ip6_addr_info fnet_netif_ip6_addr_info_t |
Interface IPv6 address information structure.
- See also:
- fnet_netif_get_ip6_addr()
typedef struct fnet_netif_ip6_neighbor_cache fnet_netif_ip6_neighbor_cache_t |
Interface IPv6 Neighbor Cache structure.
- See also:
- fnet_netif_get_ip6_neighbor_cache()
typedef struct fnet_netif_ip6_prefix fnet_netif_ip6_prefix_t |
Interface IPv6 Prefix structure.
- See also:
- fnet_netif_get_ip6_prefix()
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.
Definition at line 78 of file fnet_netif.h.
Enumeration Type Documentation
Possible IPv6 address states.
- Enumerator:
Definition at line 96 of file fnet_netif.h.
Possible IPv6 address types.
- Enumerator:
Definition at line 117 of file fnet_netif.h.
enum fnet_netif_type_t |
Network interface types.
- Enumerator:
FNET_NETIF_TYPE_OTHER Unspecified interface.
FNET_NETIF_TYPE_ETHERNET Ethernet interface.
FNET_NETIF_TYPE_LOOPBACK Loopback interface.
Definition at line 47 of file fnet_netif.h.
Function Documentation
fnet_char_t* fnet_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.
- Parameters:
-
[in] addr MAC address. [out] str_mac Pointer to a character buffer will contain the resulting text address in standard ":" notation.
Thestr_mac
buffer must be at least 18 bytes long (FNET_MAC_ADDR_STR_SIZE).
- Returns:
- This function always returns the
str_mac
.
- See also:
- fnet_str_to_mac()
This function takes an MAC-48 address, specified by the addr
parameter, and returns a null-terminated ASCII string, represented by six groups of two hexadecimal digits, separated by colons (:), in transmission order (e.g. 01:23:45:67:89:ab ), into buffer pointed to by the str_mac
.
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.
- Parameters:
-
netif_desc Network interface descriptor. addr The IPv6 address for the network interface. addr_type The IPv6 address type that defines the way the IPv6 address to be assigned to the interface.
- See also:
- fnet_netif_unbind_ip6_addr()
This function binds the IPv6 address to the netif
interface.
The addr_type
parameter defines the way the IPv6 address is assigned to the interface:
FNET_NETIF_IP_ADDR_TYPE_AUTOCONFIGURABLE:
value of theaddr
parameter defines the first 64bits of the bind IPv6 address. The last 64bits of the IPv6 address are overwritten with the Interface Identifier. In case of Ethernet interface, the Interface Identifier is formed from 48-bit MAC address, according to [RFC2464].!FNET_NETIF_IP_ADDR_TYPE_AUTOCONFIGURABLE
: value of theaddr
parameter defines the whole IPv6 address to be bind to the interface.
void fnet_netif_clear_ip4_addr_conflict | ( | fnet_netif_desc_t | netif_desc ) |
Clears IPv4 address conflict flag.
- Parameters:
-
netif_desc Network interface descriptor.
This function clears the netif
interface IPv4 address conflict flag.
The address conflict is detected by ARP protocol.
The conflict flag is also cleared on changing of the interface IPv4 address, using fnet_netif_set_ip4_addr().
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.
- Parameters:
-
addr The IPv4 address of a network interface.
- Returns:
- This function returns:
- Network interface descriptor that matches the
addr
parameter. - FNET_NULL if there is no match.
- Network interface descriptor that matches the
- See also:
- fnet_netif_get_by_name()
This function scans the global network interface list looking for a network interface matching the addr
parameter.
fnet_netif_desc_t fnet_netif_get_by_name | ( | fnet_char_t * | name ) |
Looks for a network interface according to the specified name.
- Parameters:
-
name The name string of a network interface.
Maximum length of the interface name is defined by the FNET_NETIF_NAMELEN.
- Returns:
- This function returns:
- Network interface descriptor that matches the
name
parameter. - FNET_NULL if there is no match.
- Network interface descriptor that matches the
- See also:
- fnet_netif_get_by_ip4_addr()
This function scans the global network interface list looking for a network interface matching the name
parameter (for example "eth0", "loop").
fnet_netif_desc_t fnet_netif_get_by_number | ( | fnet_index_t | n ) |
Looks for a network interface according to its number.
- Parameters:
-
n Number of a network interface (from zero).
- Returns:
- This function returns:
- Network interface descriptor that matches the n-th interface.
- FNET_NULL if n-th interface is not available..
- See also:
- fnet_netif_get_by_name()
This function scans the global network interface list looking for a network interface matching the n
parameter.
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.
- Parameters:
-
scope_id The Scope ID of a network interface.
- Returns:
- This function returns:
- Network interface descriptor that matches the
scope_id
parameter. - FNET_NULL if there is no match.
- Network interface descriptor that matches the
- See also:
- fnet_netif_get_scope_id()
This function scans the global network interface list looking for a network interface matching the specified Scope ID.
fnet_netif_desc_t fnet_netif_get_by_sockaddr | ( | const struct sockaddr * | addr ) |
Looks for a network interface according to the specified socket address.
- Parameters:
-
addr The socket address of a network interface.
- Returns:
- This function returns:
- Network interface descriptor that matches the
addr
parameter. - FNET_NULL if there is no match.
- Network interface descriptor that matches the
- See also:
- fnet_netif_get_by_scope_id()
This function scans the global network interface list looking for a network interface matching the specified socket address.
fnet_netif_desc_t fnet_netif_get_default | ( | void | ) |
Retrieves the default network interface.
- Returns:
- This function returns the descriptor of the default network interface.
- See also:
- fnet_netif_set_default(), FNET_CFG_DEFAULT_IF
This function returns the descriptor of the default network interface.
By default, during the FNET stack initialization, the default network interface is assigned to the Ethernet.
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.
- Parameters:
-
netif_desc Network interface descriptor. hw_addr Buffer that receives a hardware address (for FNET_NETIF_TYPE_ETHERNET interface type, it will contain the MAC address). hw_addr_size Size of the hardware address in the hw_addr
(for the FNET_NETIF_TYPE_ETHERNET interface type, it equals6
).
- See also:
- fnet_netif_set_hw_addr()
This function reads the hardware address of the netif
interface and puts it into the hw_addr
buffer.
For the FNET_NETIF_TYPE_ETHERNET interface type, this hardware address is the MAC address.
fnet_ip4_addr_t fnet_netif_get_ip4_addr | ( | fnet_netif_desc_t | netif_desc ) |
Retrieves an IPv4 address of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns the IPv4 address of the
netif
interface.
- See also:
- fnet_netif_set_ip4_addr()
This function returns the IPv4 address of the netif
interface.
Definition at line 55 of file ns_fnet_port.c.
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.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns type of IPv4 address parameters bound to the interface.
- See also:
- fnet_netif_set_ip4_addr_type
This function determines if the IPv4 parameters of the netif
interface were set manually, or obtained by the DHCP client or set during link-local autoconfiguartion (AutoIP - TBD)
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.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns the DNS server IP address of the
netif
interface.
- See also:
- fnet_netif_set_ip4_dns(), FNET_CFG_DNS
This function is used to retrieve all DNS IPv4 addresses registered with the given interface.
It is present only if FNET_CFG_DNS is set to 1.
fnet_ip4_addr_t fnet_netif_get_ip4_gateway | ( | fnet_netif_desc_t | netif_desc ) |
Retrieves a gateway IP address of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns the gateway IP address of the
netif
interface.
- See also:
- fnet_netif_set_ip4_gateway()
This function returns the gateway IP address of the netif
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.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns the subnet mask of the
netif
interface.
- See also:
- fnet_netif_set_ip4_subnet_mask()
This function returns the subnet mask of the netif
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.
- Parameters:
-
netif_desc Network interface descriptor. n Sequence number of IPv6 address to retrieve (from 0
).addr_info Pointer to address information structure will contain the result.
- Returns:
- This function returns:
- FNET_TRUE if no error occurs and data structure is filled.
- FNET_FALSE in case of error or
n-th
address is not available.
This function is used to retrieve all IPv6 addresses registered with the given interface.
Definition at line 61 of file ns_fnet_port.c.
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.
- Parameters:
-
netif_desc Network interface descriptor. n Sequence number of DNS IPv6 address to retrieve (from 0
).addr_dns Pointer to DNS IPv6 address that will contain the result.
- Returns:
- This function returns:
- FNET_TRUE if no error occurs and
addr_dns
is filled. - FNET_FALSE in case of error or
n-th
DNS address is not available.
- FNET_TRUE if no error occurs and
- See also:
- FNET_CFG_ND6_RDNSS, FNET_CFG_DNS
This function is used to retrieve all DNS IPv6 addresses registered with the given interface.
It is present only if FNET_CFG_DNS is set to 1.
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.
- Parameters:
-
netif_desc Network interface descriptor. n Sequence number of IPv6 neighbor cache entry to retrieve (from 0
).ip6_neighbor_cache Pointer to neighbor cache entry that will contain the result.
- Returns:
- This function returns:
- FNET_TRUE if no error occurs and
ip6_neighbor_cache
is filled. - FNET_FALSE in case of error or
n-th
neighbor cache entry is not available.
- FNET_TRUE if no error occurs and
- See also:
- fnet_netif_ip6_neighbor_cache_t
This function is used to retrieve the Ipv6 neighbor cache for the given interface.
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.
- Parameters:
-
netif_desc Network interface descriptor. n Sequence number of IPv6 prefix to retrieve (from 0
).ip6_prefix Pointer to prefix entry structure that will contain the result.
- Returns:
- This function returns:
- FNET_TRUE if no error occurs and
ip6_prefix
is filled. - FNET_FALSE in case of error or
n-th
prefix is not available.
- FNET_TRUE if no error occurs and
- See also:
- Ffnet_netif_ip6_prefix_t
This function is used to retrieve the IPv6 prefix list for the given interface.
fnet_size_t fnet_netif_get_mtu | ( | fnet_netif_desc_t | netif_desc ) |
Retrieves a Maximum Transmission Unit (MTU) of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns:
- MTU value.
This function is used to retrieve Maximum Transmission Unit (MTU) of the given 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.
- Parameters:
-
netif_desc Network interface descriptor. name String buffer that receives a name of the interface netif_desc
.name_size Size of the name
buffer.
Maximum length of the interface name is defined by the FNET_NETIF_NAMELEN.
- See also:
- fnet_netif_get_by_name()
This function retrieves the name of the specified network interface netif_desc
and stores it in the name
(for example "eth0", "loop").
fnet_scope_id_t fnet_netif_get_scope_id | ( | fnet_netif_desc_t | netif_desc ) |
Retrieves an Scope ID of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns:
- Scope ID value.
0
if no Scope ID was assigned to the interface.
This function is used to retrieve Scope ID assigned to the given interface.
Definition at line 48 of file ns_fnet_port.c.
fnet_return_t fnet_netif_get_statistics | ( | fnet_netif_desc_t | netif_desc, |
struct fnet_netif_statistics * | statistics | ||
) |
Retrieves the network interface statistics.
- Parameters:
-
netif_desc Network interface descriptor. statistics Structure that receives the network interface statistics defined by the fnet_netif_statistics structure.
- Returns:
- This function returns:
This function retrieves the network statistics of the netif
interface and puts it into the statistics
defined by the fnet_netif_statistics structure.
fnet_netif_type_t fnet_netif_get_type | ( | fnet_netif_desc_t | netif_desc ) |
Retrieves the type of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns the type of the
netif
interface.
The type is defined by the fnet_netif_type_t.
This function returns the type of the netif
interface that is defined by the fnet_netif_type_t.
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.
- Parameters:
-
netif_desc Network interface descriptor to be initialized (FNET_CPU_ETH0_IF,FNET_CPU_ETH1_IF). hw_addr Buffer containing the hardware address (for the Ethernet interface, it contains the MAC address). hw_addr_size Size of the hardware address in the hw_addr
(for the Ethernet interface, it equals6
).
- See also:
- fnet_init(), fnet_netif_release()
This function initializes network interface defined by netif_desc
and adds it to the FNET stack.
FNET declares descriptors for Ethernet interfaces (FNET_CPU_ETH0_IF, FNET_CPU_ETH1_IF).
- Note:
- Loop-back interface (if set FNET_CFG_LOOPBACK) is initialized automatically during stack initialization.
fnet_bool_t fnet_netif_is_connected | ( | fnet_netif_desc_t | netif_desc ) |
Determines the link status of the network interface.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns:
FNET_FALSE
if the network link is unconnected.FNET_TRUE
if the network link is connected.
This function determines if the netif
interface is marked as connected to a network or not. The Ethernet network interface gets this status from the PHY.
fnet_bool_t fnet_netif_is_initialized | ( | fnet_netif_desc_t | netif_desc ) |
Determines if the network interface is initialized.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns:
FNET_FALSE
if the network link is released or not initialized.FNET_TRUE
if the network link is initialized.
This function determines if the netif
interface is initialized and added to the FNET stack using ref fnet_netif_init().
fnet_bool_t fnet_netif_is_ip4_addr_conflict | ( | fnet_netif_desc_t | netif_desc ) |
Determines if there is IPv4 address conflict.
- Parameters:
-
netif_desc Network interface descriptor.
- Returns:
- This function returns:
FNET_FALSE
if the IPv4 address conflict is not detected.FNET_TRUE
if the IPv4 address conflict is detected.
This function determines if there is the netif
interface IPv4 address conflict with another system on the network.
The address conflict is detected by ARP protocol.
The conflict flag is cleared on changing of the interface IPv4 address, using fnet_netif_set_ip4_addr() or calling fnet_netif_clear_ip4_addr_conflict().
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.
- Parameters:
-
netif_desc Network interface descriptor. multicast_addr Multicast-group address to be joined by the interface.
- See also:
- fnet_netif_leave_ip4_multicast()
This function configures the HW interface to receive particular multicast address. When the network interface picks up a packet which has a destination that matches any of the joined-multicast addresses, it will pass it to the upper layers for further processing.
- Note:
- User application should not call this function.
This function is available only if FNET_CFG_MULTICAST and FNET_CFG_IP4 are set to1
.
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.
- Parameters:
-
netif_desc Network interface descriptor. multicast_addr Multicast-group address to be joined by the interface.
- See also:
- fnet_netif_leave_ip6_multicast()
This function configures the HW interface to receive particular multicast address. When the network interface picks up a packet which has a destination that matches any of the joined-multicast addresses, it will pass it to the upper layers for further processing.
- Note:
- User application should not call this function.
This function is available only if FNET_CFG_IP6 is set to1
.
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.
- Parameters:
-
netif_desc Network interface descriptor. multicast_addr Multicast-group address to be leaved by the interface.
- See also:
- fnet_netif_join_ip4_multicast()
This function configures the HW interface to ignore particular multicast address.
- Note:
- User application should not call this function.
This function is available only if FNET_CFG_MULTICAST and FNET_CFG_IP4 are set to1
.
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.
- Parameters:
-
netif_desc Network interface descriptor. multicast_addr Multicast-group address to be leaved by the interface.
- See also:
- fnet_netif_join_ip6_multicast()
This function configures the HW interface to ignore particular multicast address.
- Note:
- User application should not call this function.
This function is available only if FNET_CFG_IP6 is set to1
.
void fnet_netif_release | ( | fnet_netif_desc_t | netif_desc ) |
Releases network interface and removes it from FNET stack.
- Parameters:
-
netif_desc Network interface descriptor to be released (FNET_CPU_ETH0_IF,FNET_CPU_ETH1_IF).
- See also:
- fnet_init(), fnet_netif_init()
This function releases network interface defined by netif_desc
and removes it from the FNET stack.
FNET declares descriptors for Ethernet interfaces (FNET_CPU_ETH0_IF, FNET_CPU_ETH1_IF).
- Note:
- fnet_release() automatically releases all initialized interfaces.
void fnet_netif_set_callback_on_ip4_addr_conflict | ( | fnet_netif_callback_ip4_addr_conflict_t | callback ) |
Registers the "IPv4 address conflict" event handler.
- Parameters:
-
callback Pointer to the event-handler callback function defined by fnet_netif_callback_ip4_addr_conflict_t.
- See also:
- fnet_netif_is_ip4_addr_conflict()
This function registers the handler
callback function for the "IP4 address conflict" event. This event occurs when there is an IPv4 address conflict with another system on the network. It is detected by ARP protocol.
To stop the event handling, set callback
parameter to zero value.
void fnet_netif_set_default | ( | fnet_netif_desc_t | netif_desc ) |
Assigns the default network interface.
- Parameters:
-
netif_desc Network interface descriptor to be assigned as default.
- See also:
- fnet_netif_get_default(), FNET_CFG_DEFAULT_IF
This function sets the netif
as the default network interface.
By default, during the FNET stack initialization, the default network interface is assigned to the Ethernet.
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.
- Parameters:
-
netif_desc Network interface descriptor. hw_addr Buffer containing the hardware address (for the FNET_NETIF_TYPE_ETHERNET interface type, it contains the MAC address). hw_addr_size Size of the hardware address in the hw_addr
(for the FNET_NETIF_TYPE_ETHERNET interface type, it equals6
).
- See also:
- fnet_netif_get_hw_addr()
This function sets the hardware address of the netif
interface to the hw_addr
value.
For the FNET_NETIF_TYPE_ETHERNET interface type, this hardware address is the MAC address.
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.
- Parameters:
-
netif_desc Network interface descriptor. ipaddr The IPv4 address of the network interface. subnet_mask The subnet mask of the network interface.
This function sets the IPv4 address and the subnet mask of the netif
interface.
If subnet_mask is INADDR_ANY, the function makes a recalculation of the subnet mask automatically.
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.
- Parameters:
-
netif_desc Network interface descriptor. ipaddr_type Type of IPv4 address parameters.
- See also:
- fnet_netif_get_ip4_addr_type()
This function sets type of the interface IPv4 address parameters, if they were set manually, or obtained by the DHCP client or set during link-local autoconfiguartion (AutoIP).
fnet_netif_set_ip4_addr(), fnet_netif_set_ip4_gateway() and fnet_netif_set_ip4_dns() sets the type to FNET_NETIF_IP_ADDR_TYPE_MANUAL automatically.
void fnet_netif_set_ip4_dns | ( | fnet_netif_desc_t | netif_desc, |
fnet_ip4_addr_t | dns | ||
) |
Sets the DNS server IP address of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor. dns The DNS server IP address of the network interface.
- See also:
- fnet_netif_get_ip4_dns(), FNET_CFG_DNS
This function sets the DNS server IP address of the netif
interface to the dns
value.
It is present only if FNET_CFG_DNS is set to 1.
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.
- Parameters:
-
netif_desc Network interface descriptor. gw The gateway IP address of the network interface.
- See also:
- fnet_netif_get_ip4_gateway()
This function sets the gateway IP address of the netif
interface to the gw
value.
void fnet_netif_set_ip4_subnet_mask | ( | fnet_netif_desc_t | netif_desc, |
fnet_ip4_addr_t | subnet_mask | ||
) |
Sets the subnet mask of the specified network interface.
- Parameters:
-
netif_desc Network interface descriptor. subnet_mask The subnet mask of the network interface.
- See also:
- fnet_netif_get_ip4_subnet_mask()
This function sets the subnet mask of the netif
interface to the netmask
value.
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.
- Parameters:
-
netif_desc Network interface descriptor. addr The IPv6 address to unbind.
- See also:
- fnet_netif_bind_ip6_addr()
This function unbinds the IPv6 address from the netif
interface.
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.
- Parameters:
-
[in] str_mac Null-terminated MAC address string as pairs of hexadecimal numbers separated by colons. [out] addr Buffer will contain a suitable binary representation of the str_mac
MAC address .
- Returns:
- This function returns:
- See also:
- fnet_mac_to_str()
This function interprets the character string specified by the str_mac
parameter. This string represents a numeric MAC address expressed in six groups of two hexadecimal digits, separated by colons (:), in transmission order. The value returned, pointed to by the addr
, is a number suitable for use as an MAC address.
Generated on Tue Jul 12 2022 13:55:26 by
