10#ifndef __WS_INET_ADDR_H__
11#define __WS_INET_ADDR_H__
19typedef uint32_t ws_in4_addr;
31#define in4_addr_is_local_network_control_block(addr) \
32 ((addr & 0xffffff00) == 0xe0000000)
38#define in4_addr_is_multicast(addr) \
39 ((addr & 0xf0000000) == 0xe0000000)
47#define in4_addr_is_private(addr) \
48 (((addr & 0xff000000) == 0x0a000000) || \
49 ((addr & 0xfff00000) == 0xac100000) || \
50 ((addr & 0xffff0000) == 0xc0a80000))
56#define in4_addr_is_link_local(addr) \
57 ((addr & 0xffff0000) == 0xa9fe0000)
66 return (a->bytes[0] == 0xfe) && ((a->bytes[1] & 0xc0) == 0x80);
72 return (a->bytes[0] == 0xfe) && ((a->bytes[1] & 0xc0) == 0xc0);
75static inline bool in6_addr_is_uniquelocal(
const ws_in6_addr *a)
77 return (a->bytes[0] & 0xfe) == 0xfc;
86 return a->bytes[0] == 0xff;
119#define WS_INET_ADDRSTRLEN 16
120#define WS_INET6_ADDRSTRLEN 46
125#define WS_INET_CIDRADDRSTRLEN 19
131WS_DLL_PUBLIC WS_RETNONNULL
133ws_inet_ntop4(
const void *src,
char *dst,
size_t dst_size);
135WS_DLL_PUBLIC WS_RETNONNULL
137ws_inet_ntop6(
const void *src,
char *dst,
size_t dst_size);
141ws_inet_pton4(
const char *src, ws_in4_addr *dst);
Definition inet_addr.h:21