![]() |
Network Dual-Stack Component
Version 7.0 (Beta)
MDK-Professional Middleware for IP Networking
|
Structures of the Network Component. More...
Structures | |
struct | NET_ADDR |
struct | NET_ADDR4 |
Structures of the Network Component.
struct NET_ADDR |
NET_ADDR allows to store IPv4 and IPv6 addresses along with the internet socket port number. addr_type indicates the IP address format for addr. addr contains the IP address in binary format, whereby the MSB is stored first.
Example:
IP Address (ASCII) | addr_type | addr |
---|---|---|
192.168.0.1 | NET_ADDR_IP4 | 0xC0 0xA8 0x00 0x01 |
fe80:0000:0000:0000:1c30:6cff:fea2:455e | NET_ADDR_IP6 | 0xFE 0x80 0x00 0x00 0x00 0x00 0x00 0x1C 0x30 0x6C 0xFF 0xFE 0xA2 0x45 0x5E |
fe80::1c30:6cff:fea2:455e | NET_ADDR_IP6 | 0xFE 0x80 0x00 0x00 0x00 0x00 0x00 0x1C 0x30 0x6C 0xFF 0xFE 0xA2 0x45 0x5E |
The functions netIP_ntoa and netIP_aton can be used to convert IP addresses from ASCII to binary and vice versa.
struct NET_ADDR4 |
NET_ADDR4 allows to store only IPv4 addresses along with the Internet socket port number. addr_type indicates the IP address format for addr. addr contains the IP address in binary format, whereby the MSB is stored first. Since only IPv4 addresses can be stored, the value for addr_type should be set to NET_ADDR_IP4.