• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* MIT License
2  *
3  * Copyright (c) 2005 Dominick Meglio
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  *
24  * SPDX-License-Identifier: MIT
25  */
26 
27 #ifndef ARES_IPV6_H
28 #define ARES_IPV6_H
29 
30 #ifndef HAVE_PF_INET6
31 #  define PF_INET6 AF_INET6
32 #endif
33 
34 #ifndef HAVE_STRUCT_SOCKADDR_IN6
35 struct sockaddr_in6 {
36   unsigned short       sin6_family;
37   unsigned short       sin6_port;
38   unsigned long        sin6_flowinfo;
39   struct ares_in6_addr sin6_addr;
40   unsigned int         sin6_scope_id;
41 };
42 #endif
43 
44 typedef union {
45   struct sockaddr     sa;
46   struct sockaddr_in  sa4;
47   struct sockaddr_in6 sa6;
48 } ares_sockaddr;
49 
50 #ifndef HAVE_STRUCT_ADDRINFO
51 struct addrinfo {
52   int              ai_flags;
53   int              ai_family;
54   int              ai_socktype;
55   int              ai_protocol;
56   ares_socklen_t   ai_addrlen; /* Follow rfc3493 struct addrinfo */
57   char            *ai_canonname;
58   struct sockaddr *ai_addr;
59   struct addrinfo *ai_next;
60 };
61 #endif
62 
63 #ifndef NS_IN6ADDRSZ
64 #  ifndef HAVE_STRUCT_IN6_ADDR
65 /* We cannot have it set to zero, so we pick a fixed value here */
66 #    define NS_IN6ADDRSZ 16
67 #  else
68 #    define NS_IN6ADDRSZ sizeof(struct in6_addr)
69 #  endif
70 #endif
71 
72 #ifndef NS_INADDRSZ
73 #  define NS_INADDRSZ sizeof(struct in_addr)
74 #endif
75 
76 #ifndef NS_INT16SZ
77 #  define NS_INT16SZ 2
78 #endif
79 
80 #ifndef IF_NAMESIZE
81 #  ifdef IFNAMSIZ
82 #    define IF_NAMESIZE IFNAMSIZ
83 #  else
84 #    define IF_NAMESIZE 256
85 #  endif
86 #endif
87 
88 /* Defined in inet_net_pton.c for no particular reason. */
89 extern const struct ares_in6_addr ares_in6addr_any; /* :: */
90 
91 
92 #endif /* ARES_IPV6_H */
93