Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 495 lines (408 sloc) 17.322 kB
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
1 /* $Id$ */
2
a5b204d @bagder - Jakub Hrozek added ares_parse_srv_reply() for SRV parsing
bagder authored
3 /* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
28531de @bagder - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but in…
bagder authored
4 * Copyright (C) 2007-2009 by Daniel Stenberg
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
5 *
6 * Permission to use, copy, modify, and distribute this
7 * software and its documentation for any purpose and without
8 * fee is hereby granted, provided that the above copyright
9 * notice appear in all copies and that both that copyright
10 * notice and this permission notice appear in supporting
11 * documentation, and that the name of M.I.T. not be used in
12 * advertising or publicity pertaining to distribution of the
13 * software without specific, written prior permission.
14 * M.I.T. makes no representations about the suitability of
15 * this software for any purpose. It is provided "as is"
16 * without express or implied warranty.
17 */
18
19 #ifndef ARES__H
20 #define ARES__H
21
5b17412 @yangtse - Provide in external interface preprocessor symbol definitions for
yangtse authored
22 #include "ares_version.h" /* c-ares version defines */
23 #include "ares_build.h" /* c-ares build definitions */
24 #include "ares_rules.h" /* c-ares rules enforcement */
5fc305a @yangtse Initial step towards a configure time ares_socklen_t definition
yangtse authored
25
7cd35ce @yangtse Define WIN32 when build target is Win32 API.
yangtse authored
26 /*
27 * Define WIN32 when build target is Win32 API
28 */
29
de18bf7 @yangtse External API function linkage decoration adjustment
yangtse authored
30 #if (defined(_WIN32) || defined(__WIN32__)) && \
31 !defined(WIN32) && !defined(__SYMBIAN32__)
32 # define WIN32
7cd35ce @yangtse Define WIN32 when build target is Win32 API.
yangtse authored
33 #endif
34
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
35 #include <sys/types.h>
36
ff2794f @bagder Don't check for HAVE_ defines in this header file, it is meant to be …
bagder authored
37 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
38 libc5-based Linux systems. Only include it on system that are known to
39 require it! */
20e7876 @dfandrich Bring the sys/include.h include test in line with curl's.
dfandrich authored
40 #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
41 defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY)
27126cb @bagder include sys/select.h
bagder authored
42 #include <sys/select.h>
43 #endif
9837d91 @gknauf added NetWare CLIB-own header to solve gcc warnings.
gknauf authored
44 #if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
45 #include <sys/bsdskt.h>
46 #endif
27126cb @bagder include sys/select.h
bagder authored
47
6deb40a Changes for Watt-32 on Windows. I've assumed Configure
Gisle Vanem authored
48 #if defined(WATT32)
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
49 # include <netinet/in.h>
50 # include <sys/socket.h>
51 # include <tcp.h>
298541c @yangtse Remove redundant __CYGWIN__ symbol check
yangtse authored
52 #elif defined(WIN32)
8627b23 @yangtse Needed now that in6_addr is referenced in ares.h
yangtse authored
53 # ifndef WIN32_LEAN_AND_MEAN
54 # define WIN32_LEAN_AND_MEAN
55 # endif
56 # include <windows.h>
57 # include <winsock2.h>
58 # include <ws2tcpip.h>
c43edeb @yangtse Undo previous change. This header file belongs to the public
yangtse authored
59 #else
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
60 # include <sys/socket.h>
61 # include <netinet/in.h>
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
62 #endif
63
7319c3a Adapted for C++.
Gisle Vanem authored
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
68 /*
69 ** c-ares external API function linkage decorations.
70 */
71
72 #if !defined(CARES_STATICLIB) && \
de18bf7 @yangtse External API function linkage decoration adjustment
yangtse authored
73 (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
74 /* __declspec function decoration for Win32 and Symbian DLL's */
de18bf7 @yangtse External API function linkage decoration adjustment
yangtse authored
75 # if defined(CARES_BUILDING_LIBRARY)
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
76 # define CARES_EXTERN __declspec(dllexport)
77 # else
78 # define CARES_EXTERN __declspec(dllimport)
79 # endif
80 #else
81 /* visibility function decoration for other cases */
f77839e @yangtse Symbol hiding configure options renamed to the hopefully less ambiguous
yangtse authored
82 # if !defined(CARES_SYMBOL_HIDING) || \
de18bf7 @yangtse External API function linkage decoration adjustment
yangtse authored
83 defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
84 # define CARES_EXTERN
de18bf7 @yangtse External API function linkage decoration adjustment
yangtse authored
85 # else
f77839e @yangtse Symbol hiding configure options renamed to the hopefully less ambiguous
yangtse authored
86 # define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
87 # endif
88 #endif
89
90
3e748f4 @bagder removed tabs and trailing whitespace from source
bagder authored
91 #define ARES_SUCCESS 0
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
92
93 /* Server error codes (ARES_ENODATA indicates no relevant answer) */
3e748f4 @bagder removed tabs and trailing whitespace from source
bagder authored
94 #define ARES_ENODATA 1
95 #define ARES_EFORMERR 2
96 #define ARES_ESERVFAIL 3
97 #define ARES_ENOTFOUND 4
98 #define ARES_ENOTIMP 5
99 #define ARES_EREFUSED 6
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
100
101 /* Locally generated error codes */
3e748f4 @bagder removed tabs and trailing whitespace from source
bagder authored
102 #define ARES_EBADQUERY 7
103 #define ARES_EBADNAME 8
104 #define ARES_EBADFAMILY 9
105 #define ARES_EBADRESP 10
106 #define ARES_ECONNREFUSED 11
107 #define ARES_ETIMEOUT 12
108 #define ARES_EOF 13
109 #define ARES_EFILE 14
110 #define ARES_ENOMEM 15
111 #define ARES_EDESTRUCTION 16
112 #define ARES_EBADSTR 17
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
113
aba0b77 Added ares_getnameinfo which mimics the getnameinfo API
Dominick Meglio authored
114 /* ares_getnameinfo error codes */
b117fef @bagder detabified
bagder authored
115 #define ARES_EBADFLAGS 18
aba0b77 Added ares_getnameinfo which mimics the getnameinfo API
Dominick Meglio authored
116
6afd5c1 Added constants that will be used by ares_getaddrinfo. Made ares_getn…
Dominick Meglio authored
117 /* ares_getaddrinfo error codes */
8d63eb7 @bagder Added ares_getsock() to extract sockets to wait for action on, withou…
bagder authored
118 #define ARES_ENONAME 19
119 #define ARES_EBADHINTS 20
6afd5c1 Added constants that will be used by ares_getaddrinfo. Made ares_getn…
Dominick Meglio authored
120
cf3301f @yangtse Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOT…
yangtse authored
121 /* Uninitialized library error code */
612a293 @yangtse Daniel wants upcoming release to be 1.7.0
yangtse authored
122 #define ARES_ENOTINITIALIZED 21 /* introduced in 1.7.0 */
cf3301f @yangtse Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOT…
yangtse authored
123
b7c7bab @yangtse Introduction of ares_library_init() and ares_library_cleanup()
yangtse authored
124 /* ares_library_init error codes */
612a293 @yangtse Daniel wants upcoming release to be 1.7.0
yangtse authored
125 #define ARES_ELOADIPHLPAPI 22 /* introduced in 1.7.0 */
126 #define ARES_EADDRGETNETWORKPARAMS 23 /* introduced in 1.7.0 */
b53526b @yangtse John Engelhart noticed an unreleased problem relative to a duplicate
yangtse authored
127
128 /* More error codes */
612a293 @yangtse Daniel wants upcoming release to be 1.7.0
yangtse authored
129 #define ARES_ECANCELLED 24 /* introduced in 1.7.0 */
b7c7bab @yangtse Introduction of ares_library_init() and ares_library_cleanup()
yangtse authored
130
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
131 /* Flag values */
3e748f4 @bagder removed tabs and trailing whitespace from source
bagder authored
132 #define ARES_FLAG_USEVC (1 << 0)
133 #define ARES_FLAG_PRIMARY (1 << 1)
134 #define ARES_FLAG_IGNTC (1 << 2)
135 #define ARES_FLAG_NORECURSE (1 << 3)
136 #define ARES_FLAG_STAYOPEN (1 << 4)
137 #define ARES_FLAG_NOSEARCH (1 << 5)
138 #define ARES_FLAG_NOALIASES (1 << 6)
139 #define ARES_FLAG_NOCHECKRESP (1 << 7)
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
140
141 /* Option mask values */
3e748f4 @bagder removed tabs and trailing whitespace from source
bagder authored
142 #define ARES_OPT_FLAGS (1 << 0)
143 #define ARES_OPT_TIMEOUT (1 << 1)
144 #define ARES_OPT_TRIES (1 << 2)
145 #define ARES_OPT_NDOTS (1 << 3)
146 #define ARES_OPT_UDP_PORT (1 << 4)
147 #define ARES_OPT_TCP_PORT (1 << 5)
148 #define ARES_OPT_SERVERS (1 << 6)
149 #define ARES_OPT_DOMAINS (1 << 7)
150 #define ARES_OPT_LOOKUPS (1 << 8)
22e34b5 @bagder Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set …
bagder authored
151 #define ARES_OPT_SOCK_STATE_CB (1 << 9)
f1440b2 @bagder Brad House added ares_save_options() and ares_destroy_options() that …
bagder authored
152 #define ARES_OPT_SORTLIST (1 << 10)
56ffdce @sesse Support a few more socket options, and refactor the option setting a …
sesse authored
153 #define ARES_OPT_SOCK_SNDBUF (1 << 11)
154 #define ARES_OPT_SOCK_RCVBUF (1 << 12)
46dbd94 @bagder - Introducing millisecond resolution support for the timeout option. See
bagder authored
155 #define ARES_OPT_TIMEOUTMS (1 << 13)
1a1b4eb @bagder - Carlo Contavalli added support for the glibc "rotate" option, as do…
bagder authored
156 #define ARES_OPT_ROTATE (1 << 14)
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
157
aba0b77 Added ares_getnameinfo which mimics the getnameinfo API
Dominick Meglio authored
158 /* Nameinfo flag values */
b117fef @bagder detabified
bagder authored
159 #define ARES_NI_NOFQDN (1 << 0)
160 #define ARES_NI_NUMERICHOST (1 << 1)
161 #define ARES_NI_NAMEREQD (1 << 2)
162 #define ARES_NI_NUMERICSERV (1 << 3)
163 #define ARES_NI_DGRAM (1 << 4)
164 #define ARES_NI_TCP 0
165 #define ARES_NI_UDP ARES_NI_DGRAM
166 #define ARES_NI_SCTP (1 << 5)
167 #define ARES_NI_DCCP (1 << 6)
168 #define ARES_NI_NUMERICSCOPE (1 << 7)
169 #define ARES_NI_LOOKUPHOST (1 << 8)
170 #define ARES_NI_LOOKUPSERVICE (1 << 9)
aba0b77 Added ares_getnameinfo which mimics the getnameinfo API
Dominick Meglio authored
171 /* Reserved for future use */
8d63eb7 @bagder Added ares_getsock() to extract sockets to wait for action on, withou…
bagder authored
172 #define ARES_NI_IDN (1 << 10)
173 #define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11)
6afd5c1 Added constants that will be used by ares_getaddrinfo. Made ares_getn…
Dominick Meglio authored
174 #define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12)
175
176 /* Addrinfo flag values */
8d63eb7 @bagder Added ares_getsock() to extract sockets to wait for action on, withou…
bagder authored
177 #define ARES_AI_CANONNAME (1 << 0)
178 #define ARES_AI_NUMERICHOST (1 << 1)
179 #define ARES_AI_PASSIVE (1 << 2)
180 #define ARES_AI_NUMERICSERV (1 << 3)
181 #define ARES_AI_V4MAPPED (1 << 4)
182 #define ARES_AI_ALL (1 << 5)
183 #define ARES_AI_ADDRCONFIG (1 << 6)
6afd5c1 Added constants that will be used by ares_getaddrinfo. Made ares_getn…
Dominick Meglio authored
184 /* Reserved for future use */
8d63eb7 @bagder Added ares_getsock() to extract sockets to wait for action on, withou…
bagder authored
185 #define ARES_AI_IDN (1 << 10)
186 #define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11)
6afd5c1 Added constants that will be used by ares_getaddrinfo. Made ares_getn…
Dominick Meglio authored
187 #define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12)
8d63eb7 @bagder Added ares_getsock() to extract sockets to wait for action on, withou…
bagder authored
188 #define ARES_AI_CANONIDN (1 << 13)
6afd5c1 Added constants that will be used by ares_getaddrinfo. Made ares_getn…
Dominick Meglio authored
189
8d63eb7 @bagder Added ares_getsock() to extract sockets to wait for action on, withou…
bagder authored
190 #define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \
191 ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \
192 ARES_AI_ADDRCONFIG)
193 #define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this
194 many sockets */
195 #define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
196 #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
197 ARES_GETSOCK_MAXNUM)))
aba0b77 Added ares_getnameinfo which mimics the getnameinfo API
Dominick Meglio authored
198
b7c7bab @yangtse Introduction of ares_library_init() and ares_library_cleanup()
yangtse authored
199 /* c-ares library initialization flag values */
200 #define ARES_LIB_INIT_NONE (0)
201 #define ARES_LIB_INIT_WIN32 (1 << 0)
202 #define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32)
203
8c35c65 @bagder added ares_process_fd() to allow applications to ask for processing on
bagder authored
204
205 /*
206 * Typedef our socket type
207 */
208
209 #ifndef ares_socket_typedef
210 #ifdef WIN32
211 typedef SOCKET ares_socket_t;
212 #define ARES_SOCKET_BAD INVALID_SOCKET
213 #else
214 typedef int ares_socket_t;
215 #define ARES_SOCKET_BAD -1
216 #endif
217 #define ares_socket_typedef
218 #endif /* ares_socket_typedef */
219
22e34b5 @bagder Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set …
bagder authored
220 typedef void (*ares_sock_state_cb)(void *data,
e2d8092 @yangtse Avoid shadowing a global declaration
yangtse authored
221 ares_socket_t socket_fd,
22e34b5 @bagder Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set …
bagder authored
222 int readable,
223 int writable);
224
f1440b2 @bagder Brad House added ares_save_options() and ares_destroy_options() that …
bagder authored
225 struct apattern;
226
e61d4b9 @bagder Introduce ares_dup(3) and new thoughts about API/ABI and how to move …
bagder authored
227 /* NOTE about the ares_options struct to users and developers.
228
229 This struct will remain looking like this. It will not be extended nor
230 shrunk in future releases, but all new options will be set by ares_set_*()
231 options instead of with the ares_init_options() function.
232
233 Eventually (in a galaxy far far away), all options will be settable by
234 ares_set_*() options and the ares_init_options() function will become
235 deprecated.
236
413f8dd @bagder Let's not call ares_save_options() deprecated just yet
bagder authored
237 When new options are added to c-ares, they are not added to this
238 struct. And they are not "saved" with the ares_save_options() function but
239 instead we encourage the use of the ares_dup() function. Needless to say,
240 if you add config options to c-ares you need to make sure ares_dup()
241 duplicates this new option.
e61d4b9 @bagder Introduce ares_dup(3) and new thoughts about API/ABI and how to move …
bagder authored
242
243 */
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
244 struct ares_options {
245 int flags;
46dbd94 @bagder - Introducing millisecond resolution support for the timeout option. See
bagder authored
246 int timeout; /* in seconds or milliseconds, depending on options */
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
247 int tries;
248 int ndots;
249 unsigned short udp_port;
250 unsigned short tcp_port;
56ffdce @sesse Support a few more socket options, and refactor the option setting a …
sesse authored
251 int socket_send_buffer_size;
252 int socket_receive_buffer_size;
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
253 struct in_addr *servers;
254 int nservers;
255 char **domains;
256 int ndomains;
257 char *lookups;
22e34b5 @bagder Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set …
bagder authored
258 ares_sock_state_cb sock_state_cb;
259 void *sock_state_cb_data;
f1440b2 @bagder Brad House added ares_save_options() and ares_destroy_options() that …
bagder authored
260 struct apattern *sortlist;
261 int nsort;
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
262 };
263
264 struct hostent;
265 struct timeval;
aba0b77 Added ares_getnameinfo which mimics the getnameinfo API
Dominick Meglio authored
266 struct sockaddr;
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
267 struct ares_channeldata;
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
268
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
269 typedef struct ares_channeldata *ares_channel;
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
270
271 typedef void (*ares_callback)(void *arg,
272 int status,
273 int timeouts,
274 unsigned char *abuf,
275 int alen);
276
277 typedef void (*ares_host_callback)(void *arg,
278 int status,
279 int timeouts,
3e748f4 @bagder removed tabs and trailing whitespace from source
bagder authored
280 struct hostent *hostent);
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
281
282 typedef void (*ares_nameinfo_callback)(void *arg,
283 int status,
284 int timeouts,
285 char *node,
286 char *service);
287
f61fa37 @bagder Gregor Jasny provided the patch that introduces ares_set_socket_callb…
bagder authored
288 typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
289 int type,
290 void *data);
291
292 CARES_EXTERN int ares_library_init(int flags);
293
294 CARES_EXTERN void ares_library_cleanup(void);
295
296 CARES_EXTERN const char *ares_version(int *version);
297
298 CARES_EXTERN int ares_init(ares_channel *channelptr);
299
300 CARES_EXTERN int ares_init_options(ares_channel *channelptr,
301 struct ares_options *options,
302 int optmask);
303
304 CARES_EXTERN int ares_save_options(ares_channel channel,
305 struct ares_options *options,
306 int *optmask);
307
308 CARES_EXTERN void ares_destroy_options(struct ares_options *options);
309
310 CARES_EXTERN int ares_dup(ares_channel *dest,
311 ares_channel src);
312
313 CARES_EXTERN void ares_destroy(ares_channel channel);
314
315 CARES_EXTERN void ares_cancel(ares_channel channel);
316
7a7befd @yangtse Add missing external API decoration for ares_set_socket_callback()
yangtse authored
317 CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
318 ares_sock_create_callback callback,
319 void *user_data);
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
320
321 CARES_EXTERN void ares_send(ares_channel channel,
322 const unsigned char *qbuf,
323 int qlen,
324 ares_callback callback,
325 void *arg);
326
327 CARES_EXTERN void ares_query(ares_channel channel,
328 const char *name,
329 int dnsclass,
330 int type,
331 ares_callback callback,
332 void *arg);
333
334 CARES_EXTERN void ares_search(ares_channel channel,
335 const char *name,
336 int dnsclass,
337 int type,
338 ares_callback callback,
339 void *arg);
340
341 CARES_EXTERN void ares_gethostbyname(ares_channel channel,
342 const char *name,
343 int family,
344 ares_host_callback callback,
345 void *arg);
346
347 CARES_EXTERN int ares_gethostbyname_file(ares_channel channel,
348 const char *name,
349 int family,
350 struct hostent **host);
351
352 CARES_EXTERN void ares_gethostbyaddr(ares_channel channel,
353 const void *addr,
354 int addrlen,
355 int family,
356 ares_host_callback callback,
357 void *arg);
358
359 CARES_EXTERN void ares_getnameinfo(ares_channel channel,
360 const struct sockaddr *sa,
361 ares_socklen_t salen,
362 int flags,
363 ares_nameinfo_callback callback,
364 void *arg);
365
366 CARES_EXTERN int ares_fds(ares_channel channel,
367 fd_set *read_fds,
368 fd_set *write_fds);
369
370 CARES_EXTERN int ares_getsock(ares_channel channel,
371 int *socks,
372 int numsocks);
373
374 CARES_EXTERN struct timeval *ares_timeout(ares_channel channel,
375 struct timeval *maxtv,
376 struct timeval *tv);
377
378 CARES_EXTERN void ares_process(ares_channel channel,
379 fd_set *read_fds,
380 fd_set *write_fds);
381
382 CARES_EXTERN void ares_process_fd(ares_channel channel,
383 ares_socket_t read_fd,
384 ares_socket_t write_fd);
385
386 CARES_EXTERN int ares_mkquery(const char *name,
387 int dnsclass,
388 int type,
389 unsigned short id,
390 int rd,
391 unsigned char **buf,
392 int *buflen);
393
394 CARES_EXTERN int ares_expand_name(const unsigned char *encoded,
395 const unsigned char *abuf,
396 int alen,
397 char **s,
398 long *enclen);
399
400 CARES_EXTERN int ares_expand_string(const unsigned char *encoded,
401 const unsigned char *abuf,
402 int alen,
403 unsigned char **s,
404 long *enclen);
b4bdb6d @sesse Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inc…
sesse authored
405
28531de @bagder - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but in…
bagder authored
406 /*
612a293 @yangtse Daniel wants upcoming release to be 1.7.0
yangtse authored
407 * NOTE: before c-ares 1.7.0 we would most often use the system in6_addr
28531de @bagder - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but in…
bagder authored
408 * struct below when ares itself was built, but many apps would use this
409 * private version since the header checked a HAVE_* define for it. Starting
612a293 @yangtse Daniel wants upcoming release to be 1.7.0
yangtse authored
410 * with 1.7.0 we always declare and use our own to stop relying on the
28531de @bagder - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but in…
bagder authored
411 * system's one.
412 */
413 struct ares_in6_addr {
8627b23 @yangtse Needed now that in6_addr is referenced in ares.h
yangtse authored
414 union {
415 unsigned char _S6_u8[16];
416 } _S6_un;
417 };
418
36b2603 @yangtse - Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and
yangtse authored
419 struct ares_addrttl {
b4bdb6d @sesse Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inc…
sesse authored
420 struct in_addr ipaddr;
421 int ttl;
422 };
36b2603 @yangtse - Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and
yangtse authored
423
424 struct ares_addr6ttl {
28531de @bagder - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but in…
bagder authored
425 struct ares_in6_addr ip6addr;
b4bdb6d @sesse Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inc…
sesse authored
426 int ttl;
427 };
428
9ff3cb7 @bagder use 'ares_srv_reply' for proper name-spacing
bagder authored
429 struct ares_srv_reply {
2a916ce @yangtse Initial support for the generic ares_free_data() function that will a…
yangtse authored
430 struct ares_srv_reply *next;
431 char *host;
432 unsigned short priority;
433 unsigned short weight;
434 unsigned short port;
a5b204d @bagder - Jakub Hrozek added ares_parse_srv_reply() for SRV parsing
bagder authored
435 };
436
9cbd5ed @bagder Jakub Hrozek added ares_parse_txt_reply() for TXT parsing
bagder authored
437 struct ares_txt_reply {
2a916ce @yangtse Initial support for the generic ares_free_data() function that will a…
yangtse authored
438 struct ares_txt_reply *next;
439 unsigned char *txt;
440 size_t length; /* length excludes null termination */
9cbd5ed @bagder Jakub Hrozek added ares_parse_txt_reply() for TXT parsing
bagder authored
441 };
442
b4bdb6d @sesse Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inc…
sesse authored
443 /*
444 ** Parse the buffer, starting at *abuf and of length alen bytes, previously
445 ** obtained from an ares_search call. Put the results in *host, if nonnull.
446 ** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with
447 ** their TTLs in that array, and set *naddrttls to the number of addresses
448 ** so written.
449 */
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
450
451 CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf,
452 int alen,
453 struct hostent **host,
36b2603 @yangtse - Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and
yangtse authored
454 struct ares_addrttl *addrttls,
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
455 int *naddrttls);
456
457 CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf,
458 int alen,
459 struct hostent **host,
36b2603 @yangtse - Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and
yangtse authored
460 struct ares_addr6ttl *addrttls,
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
461 int *naddrttls);
462
463 CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf,
464 int alen,
465 const void *addr,
466 int addrlen,
467 int family,
468 struct hostent **host);
469
470 CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf,
471 int alen,
472 struct hostent **host);
473
474 CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf,
475 int alen,
5d62fe7 @yangtse Jakub Hrozek modified ares_parse_srv_reply() and ares_parse_txt_reply…
yangtse authored
476 struct ares_srv_reply** srv_out);
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
477
9cbd5ed @bagder Jakub Hrozek added ares_parse_txt_reply() for TXT parsing
bagder authored
478 CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf,
479 int alen,
5d62fe7 @yangtse Jakub Hrozek modified ares_parse_srv_reply() and ares_parse_txt_reply…
yangtse authored
480 struct ares_txt_reply** txt_out);
9cbd5ed @bagder Jakub Hrozek added ares_parse_txt_reply() for TXT parsing
bagder authored
481
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
482 CARES_EXTERN void ares_free_string(void *str);
483
484 CARES_EXTERN void ares_free_hostent(struct hostent *host);
485
2a916ce @yangtse Initial support for the generic ares_free_data() function that will a…
yangtse authored
486 CARES_EXTERN void ares_free_data(void *dataptr);
487
9cac6a4 @yangtse Initial step towards the ability to reduce c-ares exported symbols
yangtse authored
488 CARES_EXTERN const char *ares_strerror(int code);
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
489
7319c3a Adapted for C++.
Gisle Vanem authored
490 #ifdef __cplusplus
491 }
492 #endif
493
5e847a1 @bagder ares 1.1.1 with collected applied patches
bagder authored
494 #endif /* ARES__H */
Something went wrong with that request. Please try again.