check for struct sizes and use those sizes if the NS_* defines are lacking
[platform/upstream/c-ares.git] / inet_net_pton.h
1 /* $Id$ */
2
3 /*
4  * Permission to use, copy, modify, and distribute this
5  * software and its documentation for any purpose and without
6  * fee is hereby granted, provided that the above copyright
7  * notice appear in all copies and that both that copyright
8  * notice and this permission notice appear in supporting
9  * documentation, and that the name of M.I.T. not be used in
10  * advertising or publicity pertaining to distribution of the
11  * software without specific, written prior permission.
12  * M.I.T. makes no representations about the suitability of
13  * this software for any purpose.  It is provided "as is"
14  * without express or implied warranty.
15  */
16
17 #ifndef INET_NET_PTON_H
18 #define INET_NET_PTON_H
19
20 #ifndef HAVE_PF_INET6
21 #define PF_INET6 AF_INET6
22 #endif
23
24 #ifndef HAVE_STRUCT_IN6_ADDR
25 struct in6_addr
26 {
27   unsigned char s6_addr[16];
28 };
29 #endif
30
31 #if defined(HAVE_INET_PTON) && defined(HAVE_INET_PTON_IPV6)
32 #define ares_inet_pton(x,y,z) inet_pton(x,y,z)
33 #else
34 int ares_inet_pton(int af, const char *src, void *dst);
35 #endif
36 #if defined(HAVE_INET_NET_PTON) && defined(HAVE_INET_NET_PTON_IPV6)
37 #define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
38 #else
39 int ares_inet_net_pton(int af, const char *src, void *dst, size_t size);
40 #endif
41
42 #ifndef NS_IN6ADDRSZ
43 #define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR
44 #endif
45
46 #ifndef NS_INADDRSZ
47 #define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR
48 #endif
49
50 #ifndef NS_INT16SZ
51 #define NS_INT16SZ 2
52 #endif
53
54 #endif /* INET_NET_PTON_H */