Network Component  Version 7.19.0
MDK Middleware for IPv4 and IPv6 Networking
Common Interface

Generic functions for all kinds of interfaces help to get or set interface options. More...

Content

 User API
 Common functions for all Interfaces.
 
 User Callbacks
 Functions to notify the user application about events on the interface.
 
 Enumerations
 Common enumerations for all Interfaces.
 
 Structures
 Common structures for all Interfaces.
 

Description

Generic functions for all kinds of interfaces help to get or set interface options.

These functions are used to read various interface settings (such as the IP4 address, subnet mask, default gateway etc.), and to change these settings at run time. For example, you can read the IP address assigned via DHCP using the netIF_GetOption function, or change a static IP address using the netIF_SetOption function.

This documentation is separated as follows:

Interface Identification Number

Several functions have a parameter if_id to indicate the network interface. It is composed of the network interface class identifier and an interface number (or-ed).

The interface class identifier is specified with the following defines:

The interface number is a zero-based number to identify the interface within the class.

Note
Currently two Ethernet interfaces and two WiFi interfaces are supported, so the interface number in if_id is set to 0 or 1.

Code Example

// Ethernet interface 0
uint32_t if_id = NET_IF_CLASS_ETH | 0;
// Ethernet interface 1
uint32_t if_id = NET_IF_CLASS_ETH | 1;
// WiFi interface 0
uint32_t if_id = NET_IF_CLASS_WIFI | 0;
// WiFi interface 1
uint32_t if_id = NET_IF_CLASS_WIFI | 1;
// PPP interface
uint32_t if_id = NET_IF_CLASS_PPP;
// SLIP interface
uint32_t if_id = NET_IF_CLASS_SLIP;

Interface Number

Several functions have a parameter if_num, which indicates an instance of the Ethernet or Wifi interface. The interface number is a zero-based number to identify the interface within the Ethernet or WiFi class.

Note
Currently two Ethernet interfaces and two WiFi interfaces are supported, so if_num is set to 0 or 1.