...
This hook function, if set, will be called each time a IPv6 address auto-configuration process ends.
Prototype
Code Block | ||
---|---|---|
| ||
void NetIPv6_AutoCfgHookFnct( NET_IF_NBR if_nbr,
const NET_IPv6_ADDR *p_addr_local_cfgd,
const NET_IPv6_ADDR *p_addr_global_cfgd,
NET_IPv6_AUTO_CFG_STATUS auto_cfg_result); |
Arguments
if_nbr
Network Interface number on which Auto-Configuration took place.
...
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, shows Listing - IPv6 Auto-Configuration Hook Function Example Code shows a possible implementation of the hook function. That code simply print in the debug console the IPv6 addresses configured and the final result of the IPv6 Auto-Configuration process.
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
#if (NET_IPv6_CFG_ADDR_AUTO_CFG_EN == DEF_ENABLED) static void App_AutoCfgResult( NET_IF_NBR if_nbr, const NET_IPv6_ADDR *p_addr_local, const NET_IPv6_ADDR *p_addr_global, NET_IPv6_AUTO_CFG_STATUS auto_cfg_result) { CPU_CHAR ip_string[NET_ASCII_LEN_MAX_ADDR_IPv6]; NET_ERR err_net; if (p_addr_local != DEF_NULL) { NetASCII_IPv6_to_Str(p_addr_local, ip_string, DEF_NO, DEF_YES, &err_net); APP_TRACE_INFO(("IPv6 Address Link Local: %s\n", ip_string)); } if (p_addr_global != DEF_NULL) { NetASCII_IPv6_to_Str(p_addr_global, ip_string, DEF_NO, DEF_YES, &err_net); APP_TRACE_INFO(("IPv6 Address Global: %s\n", ip_string)); } switch (auto_cfg_result) { case NET_IPv6_AUTO_CFG_STATUS_FAILED: APP_TRACE_INFO(("Auto-Configuration failed.\n")); break; case NET_IPv6_AUTO_CFG_STATUS_SUCCEEDED: APP_TRACE_INFO(("Auto-Configuration succeeded.\n")); break; case NET_IPv6_AUTO_CFG_STATUS_LINK_LOCAL: APP_TRACE_INFO(("Auto-Configuration with Link-Local address only.\n")); break; default: APP_TRACE_INFO(("Invalid Auto-Configuration result.\n")); break; } } #endif |