10#ifndef __WS_INET_ADDR_H__
11#define __WS_INET_ADDR_H__
37#define in4_addr_is_local_network_control_block(addr) \
38 ((addr & 0xffffff00) == 0xe0000000)
44#define in4_addr_is_multicast(addr) \
45 ((addr & 0xf0000000) == 0xe0000000)
53#define in4_addr_is_private(addr) \
54 (((addr & 0xff000000) == 0x0a000000) || \
55 ((addr & 0xfff00000) == 0xac100000) || \
56 ((addr & 0xffff0000) == 0xc0a80000))
62#define in4_addr_is_link_local(addr) \
63 ((addr & 0xffff0000) == 0xa9fe0000)
72 return (a->
bytes[0] == 0xfe) && ((a->
bytes[1] & 0xc0) == 0x80);
78 return (a->
bytes[0] == 0xfe) && ((a->
bytes[1] & 0xc0) == 0xc0);
81static inline bool in6_addr_is_uniquelocal(
const ws_in6_addr *a)
83 return (a->
bytes[0] & 0xfe) == 0xfc;
92 return a->
bytes[0] == 0xff;
125#define WS_INET_ADDRSTRLEN 16
126#define WS_INET6_ADDRSTRLEN 46
131#define WS_INET_CIDRADDRSTRLEN 19
137WS_DLL_PUBLIC WS_RETNONNULL
139ws_inet_ntop4(
const void *src,
char *dst,
size_t dst_size);
141WS_DLL_PUBLIC WS_RETNONNULL
143ws_inet_ntop6(
const void *src,
char *dst,
size_t dst_size);
WS_DLL_PUBLIC bool ws_inet_pton6(const char *src, ws_in6_addr *dst)
Definition inet_addr.c:99
struct e_in6_addr ws_in6_addr
uint32_t ws_in4_addr
Definition inet_addr.h:22
WS_DLL_PUBLIC bool ws_inet_pton4(const char *src, ws_in4_addr *dst)
Definition inet_addr.c:87
Definition inet_addr.h:27
uint8_t bytes[16]
Definition inet_addr.h:28