Network Dual-Stack Component  Version 7.0 (Beta)
MDK-Professional Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Enumerations Groups Pages
User API

Functions of the Ethernet Interface. More...

Functions of the Ethernet Interface.

In the Network Component, the Ethernet interface API is responsible for various Application/Internet/Link layer protocols such as ARP, NDP, IGMP, and DHCP. In the dual-stack implementation, these protocols are supported for IPv4 and IPv6 connections (where applicable).

To get or set Ethernet options, use the generic netIF_GetOption and netIF_SetOption. The available options are as follows:

Option Description
netIF_OptionMAC_Address Ethernet MAC Address
netIF_OptionIP4_Address IPv4 Address
netIF_OptionIP4_SubnetMask IPv4 Subnet mask
netIF_OptionIP4_DefaultGateway IPv4 Default Gateway
netIF_OptionIP4_PrimaryDNS IPv4 Primary DNS
netIF_OptionIP4_SecondaryDNS IPv4 Secondary DNS
netIF_OptionIP6_LinkLocalAddress IPv6 Link-local Address
netIF_OptionIP6_StaticAddress IPv6 Static Address
netIF_OptionIP6_DynamicAddress IPv6 Dynamic Address
netIF_OptionIP6_SubnetPrefixLengthIPv6 Subnet Prefix-length
netIF_OptionIP6_DefaultGateway IPv6 Default Gateway
netIF_OptionIP6_PrimaryDNS IPv6 Primary DNS
netIF_OptionIP6_SecondaryDNS IPv6 Secondary DNS

The callback function netETH_Notify informs the user application about state changes on the Ethernet link.

Address Resolution Protocol (ARP, IPv4 only)

The Address Resolution Protocol (ARP) is used to resolve network layer (IP) addresses to link layer (MAC) addresses. It is being used in IPv4 networks only. In IPv6 networks, Neighbor Discovery Protocol (NDP) is used instead.

The Network Component provides four functions for ARP. Two functions are working on the ARP table, while the other two functions actually resolve the IP or MAC address. netARP_CacheIP determines whether the ARP table has a MAC address resolved for a certain IP address. netARP_CacheMAC determines whether the ARP table has an IP address resolved for a certain MAC address. To retrieve the MAC address for an IP address from the ARP table, use netARP_GetMAC, while netARP_GetIP provides the IP address for a given MAC address.

Neighbor Discovery Protocol (NDP, IPv6 only)

The Neighbor Discovery Protocol (NDP) operates on the link layer and is responsible for

It is available for IPv6 only.

The function netNDP_CacheIP checks if the NDP table has a MAC address resolved for a certain IPv6 address. To retrieve this MAC address, use netNDP_GetMAC. To retrieve an IPv6 address for any given MAC address, use netNDP_GetIP.

Internet Group Management Protocol (IGMP, IPv4 only)

The Internet Group Management Protocol (IGMP) is used to do IP Multicasting. This means that an IP datagram is sent to a "host group". A multicast datagram is delivered to all the members of its destination host group. IGMPv1 and IGMPv2 protocol specification are supported in the Network Component. It is available for IPv4 only.

To add a host to a certain host group, use netIGMP_Join. To leave a host group, netIGMP_Leave is used.

Dynamic Host Configuration Protocol (DHCP, IPv4 only)

The Dynamic Host Configuration Protocol (DHCP) is used for dynamically distributing network configuration parameters, such as IP addresses for interfaces and services. Using DHCP, network nodes request IP addresses and networking parameters automatically from a DHCP server, eliminating the need to configure these settings manually (refer to IP Address Assignment for more information). Although DHCP is specified for IPv4 and IPv6 networks, the Network Component is only supporting IPv4 networks at the moment.

Like all services, the DHCP is normally started automatically if Start System Service is enabled in the Net_Config.c configuration file. If it is disabled, DHCP needs to be started manually in the user application using netDHCP_Enable. At runtime, it is always possible to stop DHCP using the function netDHCP_Disable. In this case, the Network Core will revert the IP address of the node to the static IP address specified in the Net_Config_ETH_n.h file.

The callback function netDHCP_Notify notifies the user application of DHCP events or extended DHCP options. This function is optional and not required for a default DHCP client configuration. However, if your application requires the ability to react on changes of the IP address, you need to implement this function in the user code.