Blame src/api/arpa_inet.c
|
nsz |
e19254 |
#include <arpa/inet.h>
|
|
nsz |
e19254 |
#define T(t) (t*)0;
|
|
nsz |
e19254 |
#define C(n) switch(n){case n:;}
|
|
Szabolcs Nagy |
338079 |
#define I(t,e) {t x[sizeof(t)==sizeof(e)] = {e};}
|
|
nsz |
e19254 |
static void f()
|
|
nsz |
e19254 |
{
|
|
nsz |
e19254 |
T(in_port_t)
|
|
nsz |
e19254 |
T(in_addr_t)
|
|
nsz |
e19254 |
T(struct in_addr)
|
|
nsz |
e19254 |
T(uint32_t)
|
|
nsz |
e19254 |
T(uint16_t)
|
|
nsz |
e19254 |
|
|
nsz |
e19254 |
C(INET_ADDRSTRLEN)
|
|
nsz |
e19254 |
C(INET6_ADDRSTRLEN)
|
|
nsz |
e19254 |
|
|
nsz |
e19254 |
#ifdef htonl
|
|
Szabolcs Nagy |
338079 |
I(uint32_t, htonl(0LL))
|
|
nsz |
e19254 |
#else
|
|
nsz |
0ef264 |
{uint32_t(*p)(uint32_t) = htonl;}
|
|
nsz |
e19254 |
#endif
|
|
nsz |
e19254 |
#ifdef htons
|
|
Szabolcs Nagy |
f58c4e |
I(uint16_t, htons(0LL))
|
|
nsz |
e19254 |
#else
|
|
nsz |
0ef264 |
{uint16_t(*p)(uint16_t) = htons;}
|
|
nsz |
e19254 |
#endif
|
|
nsz |
e19254 |
#ifdef ntohl
|
|
Szabolcs Nagy |
338079 |
I(uint32_t, ntohl(0LL))
|
|
nsz |
e19254 |
#else
|
|
nsz |
0ef264 |
{uint32_t(*p)(uint32_t) = ntohl;}
|
|
nsz |
e19254 |
#endif
|
|
nsz |
e19254 |
#ifdef ntohs
|
|
Szabolcs Nagy |
338079 |
I(uint16_t, ntohs(0LL))
|
|
nsz |
e19254 |
#else
|
|
nsz |
0ef264 |
{uint16_t(*p)(uint16_t) = ntohs;}
|
|
nsz |
e19254 |
#endif
|
|
nsz |
e19254 |
|
|
nsz |
0ef264 |
{in_addr_t(*p)(const char*) = inet_addr;}
|
|
nsz |
0ef264 |
{char*(*p)(struct in_addr) = inet_ntoa;}
|
|
nsz |
0ef264 |
{const char*(*p)(int,const void*restrict,char*restrict,socklen_t) = inet_ntop;}
|
|
nsz |
0ef264 |
{int(*p)(int,const char*restrict,void*restrict) = inet_pton;}
|
|
nsz |
e19254 |
}
|