Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If the function is made none blocking, it is possible to set a hook function to advertise the application when the address configuration process has finished. The API function NetIPv6_CfgAddrHookSet can be used to set the hook function. Refer to section IPv6 Static Address Configuration Hook Function for all the details on the hook function format and usage. Listing - Non-Blocking IPv6 Address Configuration Example shows an example of a non-blocking IPv6 static address configuration.

Anchor
#Listing - Non-Blocking IPv6 Address Configuration Example
#Listing - Non-Blocking IPv6 Address Configuration Example

Code Block
languagecpp
themeConfluence
firstline1
titleListing - Non-Blocking IPv6 Address Configuration Example
linenumberstrue
CPU_BOOLEAN    cfg_success;
NET_IPv6_ADDR  ipv6_addr;
NET_FLAGS      ipv6_flags;
NET_ERR        err;
           
           
(void)NetASCII_Str_to_IP((CPU_CHAR *)"fe80::1111:1111", 	/* Convert IPv6 string address to 128 bit address.      */
                                     &ipv6_addr, 
                                      NET_IPv6_ADDR_SIZE, 
                                     &err);

NetIPv6_AddrAutoCfgHookSet(if_nbr,                          /* Set hook function to received addr cfg result.       */
                          &App_AddrCfgResult,				/* TODO update pointer to hook fnct implemented in App. */
                          &err);  
 
ipv6_flags = 0;                                             
DEF_BIT_CLR(ipv6_flags, NET_IPv6_FLAG_BLOCK_EN);            /* Set Address Configuration as non-blocking.           */
DEF_BIT_SET(ipv6_flags, NET_IPv6_FLAG_DAD_EN);              /* Enable DAD with Address Configuration.               */
 
cfg_success = NetIPv6_CfgAddrAdd(if_nbr,         			/* Add a statically-configured IPv6 host address to ... */
                                &ipv6_addr,      			/* ... the interface.                                   */
                                 64,             			
                                 ipv6_flags,               
                                &err);      

...