1 /* $Id: ares_private.h,v 1.3 1998/09/22 01:46:11 ghudson Exp $ */
3 /* Copyright 1998 by the Massachusetts Institute of Technology.
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for any purpose and without
7 * fee is hereby granted, provided that the above copyright
8 * notice appear in all copies and that both that copyright
9 * notice and this permission notice appear in supporting
10 * documentation, and that the name of M.I.T. not be used in
11 * advertising or publicity pertaining to distribution of the
12 * software without specific, written prior permission.
13 * M.I.T. makes no representations about the suitability of
14 * this software for any purpose. It is provided "as is"
15 * without express or implied warranty.
19 #include <sys/types.h>
20 #include <netinet/in.h>
22 #define DEFAULT_TIMEOUT 5
23 #define DEFAULT_TRIES 4
25 #define INADDR_NONE 0xffffffff
28 #define PATH_RESOLV_CONF "/etc/resolv.conf"
30 #define PATH_HOSTS "/etc/inet/hosts"
32 #define PATH_HOSTS "/etc/hosts"
36 /* Remaining data to send */
40 /* Next request in queue */
41 struct send_request *next;
49 /* Mini-buffer for reading the length word */
50 unsigned char tcp_lenbuf[2];
54 /* Buffer for reading actual TCP data */
55 unsigned char *tcp_buffer;
58 /* TCP output queue */
59 struct send_request *qhead;
60 struct send_request *qtail;
64 /* Query ID from qbuf, for faster lookup, and current timeout */
68 /* Query buf with length at beginning, for TCP transmission */
72 /* Arguments passed to ares_send() (qbuf points into tcpbuf) */
75 ares_callback callback;
85 /* Next query in chain */
89 /* An IP address pattern; matches an IP address X if X & mask == addr */
95 struct ares_channeldata {
96 /* Configuration data */
105 struct apattern *sortlist;
109 /* Server addresses and communications state */
110 struct server_state *servers;
113 /* ID to use for next query */
114 unsigned short next_id;
117 struct query *queries;
120 void ares__send_query(ares_channel channel, struct query *query, time_t now);
121 void ares__close_sockets(struct server_state *server);
122 int ares__get_hostent(FILE *fp, struct hostent **host);
123 int ares__read_line(FILE *fp, char **buf, int *bufsize);