IPv6 Static Address Configuration Hook Function
Description
This hook function, if set, will be called each time a non-blocking IPv6 static address configuration process ends.
Prototype
void NetIPv6_AddrCfgHookFnct( NET_IF_NBR if_nbr, const NET_IPv6_ADDR *p_addr_cfgd, NET_IPv6_ADDR_CFG_STATUS addr_cfg_result);
Arguments
if_nbr
Network Interface number on which Static Address Configuration took place.
p_addr_cfgd
Pointer to IPv6 address configured, if any.DEF_NULL
, otherwise.
addr_cfg_result
Result status of the IPv6 Static Address Configuration process.
Return Values
None.
Required Configuration
NET_IPv6_CFG_ADDR_AUTO_CFG_EN
macro must be enabled in the net_cfg.h file.
Notes / Warnings
p_addr_cfgd
is for read-only. It must not be modified at any point in this hook function.
This hook function is called with the Network Lock already acquired, therefore no network API functions can be called will inside this hook function.
Example Template
Below, Listing - IPv6 Static Address Configuration Hook Function Example Code shows a possible implementation of the hook function. That code simply print in the debug console the IPv6 address configured and the final result of the IPv6 Static Address Configuration process.
static void App_AddrCfgResult( NET_IF_NBR if_nbr, const NET_IPv6_ADDR *p_addr, NET_IPv6_ADDR_CFG_STATUS addr_cfg_result) { CPU_CHAR ip_string[NET_ASCII_LEN_MAX_ADDR_IPv6]; NET_ERR err_net; if (p_addr != DEF_NULL) { NetASCII_IPv6_to_Str(p_addr, ip_string, DEF_NO, DEF_YES, &err_net); APP_TRACE_INFO(("IPv6 Address: %s\n", ip_string)); } switch (result) { case NET_IPv6_ADDR_CFG_STATUS_SUCCEED: APP_TRACE_INFO(("IPv6 Address Configuration succeeded.\n")); break; case NET_IPv6_ADDR_CFG_STATUS_FAIL: APP_TRACE_INFO(("IPv6 Address Configuration failed.\n")); break; case NET_IPv6_ADDR_CFG_STATUS_DUPLICATE: APP_TRACE_INFO(("IPv6 Address Configuration failed because address was duplicated.\n")); break; default: APP_TRACE_INFO(("Invalid Address configuration state.\n")); break; } }