reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ares_private.h
Go to the documentation of this file.
1/* Copyright 1998 by the Massachusetts Institute of Technology.
2 *
3 * Permission to use, copy, modify, and distribute this
4 * software and its documentation for any purpose and without
5 * fee is hereby granted, provided that the above copyright
6 * notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting
8 * documentation, and that the name of M.I.T. not be used in
9 * advertising or publicity pertaining to distribution of the
10 * software without specific, written prior permission.
11 * M.I.T. makes no representations about the suitability of
12 * this software for any purpose. It is provided "as is"
13 * without express or implied warranty.
14 */
15
16#ifdef HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <sys/types.h>
21#ifndef WIN32
22#include <netinet/in.h>
23#else
24#include <errno.h>
25#include <winsock2.h>
26#include <io.h>
27#endif
28
29#include <string.h>
30#include <stdio.h>
31
32#define DEFAULT_TIMEOUT 5
33#define DEFAULT_TRIES 4
34#ifndef INADDR_NONE
35#define INADDR_NONE 0xffffffff
36#endif
37#ifndef MAX_ADAPTER_ADDRESS_LENGTH
38#define MAX_ADAPTER_ADDRESS_LENGTH 8
39#endif
40
41#define PATH_RESOLV_CONF "/etc/resolv.conf"
42#ifdef ETC_INET
43#define PATH_HOSTS "/etc/inet/hosts"
44#else
45#define PATH_HOSTS "/etc/hosts"
46#endif
47
49 /* Remaining data to send */
50 const char *data;
51 int len;
52
53 /* Next request in queue */
55};
56
58#ifdef USE_IPV6
59 // added by Rohan on 7-Sep-2004
60 // define address and family contructs for IPv6
63#endif
64 struct in_addr addr;
68
71
72 /* Mini-buffer for reading the length word */
73 unsigned char tcp_lenbuf[2];
76
77 /* Buffer for reading actual TCP data */
78 unsigned char *tcp_buffer;
80
81 /* TCP output queue */
84};
85
86struct query {
87 /* Query ID from qbuf, for faster lookup, and current timeout */
88 unsigned short qid;
90
91 /* Query buf with length at beginning, for TCP transmission */
92 char *tcpbuf;
93 int tcplen;
94
95 /* Arguments passed to ares_send() (qbuf points into tcpbuf) */
96 const char *qbuf;
97 int qlen;
99 void *arg;
100
101 /* Query status */
102 int itry;
107
108 /* Next query in chain */
109 struct query *next;
110};
111
112/* An IP address pattern; matches an IP address X if X & mask == addr */
113struct apattern {
114 struct in_addr addr;
115 struct in_addr mask;
116};
117
119 /* Configuration data */
120 int flags;
122 int tries;
123 int ndots;
126 char **domains;
129 int nsort;
130 char *lookups;
131
132 /* Server addresses and communications state */
135
136 /* ID to use for next query */
137 unsigned short next_id;
138
139 /* Active queries */
140 struct query *queries;
141
142 /* post socket creation function pointer */
144
145 /* poll() system support */
148};
149
150void ares__send_query(ares_channel channel, struct query *query, time_t now);
151void ares__close_poll(ares_channel channel, int server_idx);
153int ares__get_hostent(FILE *fp, struct hostent **host);
154int ares__read_line(FILE *fp, char **buf, int *bufsize);
155
156void ares__kill_socket(int s);
157
158#ifdef WIN32
159#define strcasecmp(a,b) _stricmp(a,b)
160#define strncasecmp(a,b,n) _strnicmp(a,b,n)
161#endif
162
void() ares_poll_cb_func(void *cb_data, struct ares_channeldata *chan, int sockidx, int fd, int using_tcp, ares_poll_action_t act)
Definition ares.h:135
void(* ares_callback)(void *arg, int status, unsigned char *abuf, int alen)
Definition ares.h:172
void ares__kill_socket(int s)
int ares__read_line(FILE *fp, char **buf, int *bufsize)
void ares__close_poll(ares_channel channel, int server_idx)
int ares__get_hostent(FILE *fp, struct hostent **host)
#define MAX_ADAPTER_ADDRESS_LENGTH
void ares__close_sockets(struct server_state *server)
void ares__send_query(ares_channel channel, struct query *query, time_t now)
void(* socket_function_ptr)(Socket s, int transportType, const char *file, int line)
struct in_addr mask
struct in_addr addr
struct apattern * sortlist
ares_poll_cb_func * poll_cb_func
struct query * queries
unsigned short next_id
socket_function_ptr socket_function
struct server_state * servers
int using_tcp
const char * qbuf
void * arg
struct query * next
int server
ares_callback callback
int qlen
int * skip_server
unsigned short qid
int tcplen
time_t timeout
char * tcpbuf
int error_status
struct send_request * next
const char * data
int physical_addr_len
u_int8_t family
unsigned char tcp_lenbuf[2]
struct send_request * qhead
struct in6_addr addr6
int default_localhost_server
struct send_request * qtail
unsigned char * tcp_buffer
struct in_addr addr
unsigned char physical_addr[MAX_ADAPTER_ADDRESS_LENGTH]
void list()
Definition userAdmin.cxx:66