...
Some parameters should be configured and/or optimized for your project requirements. Please refer to the s ection sections IPv4 Layer Configuration and IPv6 Layer Configuration for further details.
...
Function Name | Description |
---|---|
IPv4 | |
NetIPv4_GetAddrHost | Get an interface’s configured IPv4 host address(es). |
NetIPv4_GetAddrSrc | Get corresponding configured IPv4 host address to use as source address for a remote IPv4 address. |
NetIPv4_GetAddrDfltGateway | Get the default gateway IPv4 address for a host’s configured IPv4 address. |
NetIPv4_GetAddrSubnetMask | Get the IPv4 address subnet mask for a host’s configured IPv4 address. |
NetIPv4_IsAddrHost | Validate an IPv4 address as one the host’s IPv4 address(es). |
NetIPv4_IsAddrHostCfgd() | Validate an IPv4 address as one the host’s configured IPv4 address(es). |
NetIPv4_IsAddrsHostCfgdOnIF() | Check if any IPv4 address(es) are configured on an interface. |
IPv6 | |
NetIPv6_GetAddrHost | Get an interface's configured IPv6 host address(es). |
NetIPv6_GetAddrSrc | Find the best matched source address in the IPv6 configured host addresses for the specified destination address. |
NetIPv6_IsAddrHostCfgd() | Validate an IPv6 address as a configured IPv6 host address on an enabled interface. |
NetIPv6_IsAddrsCfgdOnIF() | Validate if any IPv6 host addresses are configured on a specific interface. |
...
Function Name | Description |
---|---|
IPv4 | |
NetIPv4_IsAddrBroadcast() | Validate an IPv4 address as the limited broadcast IPv4 address. |
NetIPv4_IsAddrClassA() | Validate an IPv4 address as a Class-A IPv4 address. |
NetIPv4_IsAddrClassB() | Validate an IPv4 address as a Class-B IPv4 address. |
NetIPv4_IsAddrClassC() | Validate an IPv4 address as a Class-C IPv4 address. |
NetIPv4_IsAddrLocalHost() | Validate an IPv4 address as a Localhost IPv4 address. |
NetIPv4_IsAddrLocalLink() | Validate an IPv4 address as a link-local IPv4 address. |
NetIPv4_IsAddrThisHost() | Validate an IPv4 address as the ‘This Host’ initialization IPv4 address. |
NetIPv4_IsValidAddrHost() | Validate an IPv4 address as a valid IPv4 host address. |
NetIPv4_IsValidAddrHostCfgd() | Validate an IPv4 address as a valid, configurable IPv4 host address. |
NetIPv4_IsValidAddrSubnetMask() | Validate an IPv4 address subnet mask. |
IPv6 | |
NetIPv6_GetAddrMatchingLen() | Compute the number of identical most significant bits of two IPv6 addresses. |
NetIPv6_GetAddrScope() | Get the scope of a specific IPv6 address. |
NetIPv6_IsValidAddrHost() | Validate an IPv6 host address. |
NetIPv6_IsAddrLinkLocal() | Validate an IPv6 address as a link-local IPv6 address. |
NetIPv6_IsAddrSiteLocal() | Validate an IPv6 address as a site-local address. |
NetIPv6_IsAddrMcast() | Validate an IPv6 address as a multicast address. |
NetIPv6_IsAddrMcastSolNode() | Validate an IPv6 address as a solicited node multicast address. |
NetIPv6_IsAddrMcastAllNodes() | Validate an IPv6 address as the all nodes multicast address. |
NetIPv6_IsAddrMcastAllRouters() | Validate an IPv6 address as the all routers multicast address. |
NetIPv6_IsAddrMcastRsvd() | Validate the IPv6 address as a a reserved multicast IPv6 address. |
NetIPv6_IsAddrUnspecified() | Validate an IPv6 address as the unspecified IPv6 address. |
NetIPv6_IsAddrLoopback() | Validate an IPv6 address as the IPv6 loopback address. |
...
The following example shows how to use the NetASCII module in order to convert IP addresses to and from their dotted-decimal representations:
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
NET_IPv4_ADDR ipv4_addr; NET_IPv6_ADDR ipv6_addr; CPU_INT08U ipv4_str[16]; CPU_INT08U ipv6_str[40]; NET_ERR err; /* IPv4 */ (void)NetASCII_Str_to_IP((CPU_CHAR *)"192.168.1.65", &ipv4_addr, NET_IPv4_ADDR_SIZE, &err); NetASCII_IPv4_to_Str(ipv4_addr, &ipv4_str[0], DEF_NO, &err); /* IPv6 */ (void)NetASCII_Str_to_IP((CPU_CHAR *)"fe80::1111:1111", &ipv6_addr, NET_IPv6_ADDR_SIZE, &err); NetASCII_IPv6_to_Str(&ipv6_addr, &ipv6_str[0], DEF_NO, &err); |
Static IP Address Configuration On An Interface
See section IP Address Configuration for an example on how to configure a static IPv4 or IPv6 on a specific Interface.
...