1 #ifndef __NETDEV_IPADDR_H__ 2 #define __NETDEV_IPADDR_H__ 3 4 #include <stdint.h> 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 /* Only supports the IPV4 protocol */ 11 #ifndef NETDEV_IPV4 12 #define NETDEV_IPV4 1 13 #endif 14 15 #ifndef NETDEV_IPV6 16 #define NETDEV_IPV6 0 17 #endif 18 19 #ifdef NETDEV_IPV4 20 /** IPv4 only: set the IP address given as an u32_t */ 21 #define ip4_addr_set_u32(dest_ipaddr, src_u32) ((dest_ipaddr)->addr = (src_u32)) 22 /** IPv4 only: get the IP address as an u32_t */ 23 #define ip4_addr_get_u32(src_ipaddr) ((src_ipaddr)->addr) 24 25 #define IP4ADDR_STRLEN_MAX 16 26 #endif /* NETIF_IPV4 */ 27 28 #if NETDEV_IPV4 && NETDEV_IPV6 29 /* IP address types for use in ip_addr_t.type member */ 30 enum netdev_ip_addr_type 31 { 32 /** IPv4 */ 33 IPADDR_TYPE_V4 = 0U, 34 /** IPv6 */ 35 IPADDR_TYPE_V6 = 6U, 36 /** IPv4+IPv6 ("dual-stack") */ 37 IPADDR_TYPE_ANY = 46U 38 }; 39 40 #endif /* NETIF_IPV4 && NETIF_IPV6 */ 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif /* __NETDEV_IPADDR_H__ */ 47