+Major changes in release 1.1.1:
+* ares should now compile as C++ code (no longer uses reserved word
+ "class").
+* Added SRV support to adig test program.
+* Fixed a few error handling bugs in query processing.
+
Major changes in release 1.1.0:
* Added ares_free_string() function so that memory can be freed in the
same layer as it is allocated, a desirable feature in some
* without express or implied warranty.
*/
-static const char rcsid[] = "$Id: ahost.c,v 1.3 1999/10/23 19:28:13 danw Exp $";
+static const char rcsid[] = "$Id: ahost.c,v 1.4 2001/04/02 17:39:42 ghudson Exp $";
#include <sys/types.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
-/* $Id: ares.h,v 1.2 2000/01/05 16:29:43 ghudson Exp $ */
+/* $Id: ares.h,v 1.3 2000/09/21 19:15:48 ghudson Exp $ */
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
ares_callback callback, void *arg);
-void ares_query(ares_channel channel, const char *name, int class,
+void ares_query(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg);
-void ares_search(ares_channel channel, const char *name, int class,
+void ares_search(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg);
void ares_gethostbyname(ares_channel channel, const char *name, int family,
ares_host_callback callback, void *arg);
struct timeval *tv);
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
-int ares_mkquery(const char *name, int class, int type, unsigned short id,
+int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen);
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
int alen, char **s, int *enclen);
-.\" $Id: ares_mkquery.3,v 1.2 2000/01/05 16:29:43 ghudson Exp $
+.\" $Id: ares_mkquery.3,v 1.5 2000/09/21 19:15:50 ghudson Exp $
.\"
.\" Copyright 1998, 2000 by the Massachusetts Institute of Technology.
.\"
.B #include <ares.h>
.PP
.B
-int ares_mkquery(const char *\fIname\fP, int \fIclass\fP, int \fItype\fP,
+int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
.B
- unsigned short \fIid\fP, char **\fIbuf\fP, int *\fIbuflen\fP)
+ unsigned short \fIid\fP, int \fIrd\fP, char **\fIbuf\fP,
+ int *\fIbuflen\fP)
.fi
.SH DESCRIPTION
The
gives the query name as a NUL-terminated C string of period-separated
labels optionally ending with a period; periods and backslashes within
a label must be escaped with a backlash. The parameters
-.I class
+.I dnsclass
and
.I type
give the class and type of the query using the values defined in
.BR <arpa/nameser.h> .
The parameter
.I id
-gives a 16-bit identifier for the query. The query will be placed in
-an allocated buffer, a pointer to which will be stored in the variable
-pointed to by
+gives a 16-bit identifier for the query. The parameter
+.I rd
+should be nonzero if recursion is desired, zero if not. The query
+will be placed in an allocated buffer, a pointer to which will be
+stored in the variable pointed to by
.IR buf ,
and the length of which will be stored in the variable pointed to by
.IR buflen .
.B ares_free_string
when it is no longer needed.
.SH RETURN VALUES
-.B ares_expand_name
+.B ares_mkquery
can return any of the following values:
.TP 15
.B ARES_SUCCESS
* without express or implied warranty.
*/
-static const char rcsid[] = "$Id: ares_mkquery.c,v 1.2 1999/10/23 19:28:14 danw Exp $";
+static const char rcsid[] = "$Id: ares_mkquery.c,v 1.3 2000/09/21 19:15:51 ghudson Exp $";
#include <sys/types.h>
#include <netinet/in.h>
* be thought of as the root domain).
*/
-int ares_mkquery(const char *name, int class, int type, unsigned short id,
+int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen)
{
int len;
/* Finish off the question with the type and class. */
DNS_QUESTION_SET_TYPE(q, type);
- DNS_QUESTION_SET_CLASS(q, class);
+ DNS_QUESTION_SET_CLASS(q, dnsclass);
return ARES_SUCCESS;
}
* without express or implied warranty.
*/
-static const char rcsid[] = "$Id: ares_process.c,v 1.5 2000/02/17 18:27:27 ghudson Exp $";
+static const char rcsid[] = "$Id: ares_process.c,v 1.7 2001/03/17 16:43:36 ghudson Exp $";
#include <sys/types.h>
#include <sys/socket.h>
{
query->skip_server[query->server] = 1;
next_server(channel, query, now);
+ return;
}
}
sendreq = malloc(sizeof(struct send_request));
{
query->skip_server[query->server] = 1;
next_server(channel, query, now);
+ return;
}
}
if (send(server->udp_socket, query->qbuf, query->qlen, 0) == -1)
{
query->skip_server[query->server] = 1;
next_server(channel, query, now);
+ return;
}
query->timeout = now
+ ((query->try == 0) ? channel->timeout
char *name;
int namelen;
int type;
- int class;
+ int dnsclass;
} q, a;
int i, j;
return 0;
}
q.type = DNS_QUESTION_TYPE(q.p);
- q.class = DNS_QUESTION_CLASS(q.p);
+ q.dnsclass = DNS_QUESTION_CLASS(q.p);
q.p += QFIXEDSZ;
/* Search for this question in the answer. */
return 0;
}
a.type = DNS_QUESTION_TYPE(a.p);
- a.class = DNS_QUESTION_CLASS(a.p);
+ a.dnsclass = DNS_QUESTION_CLASS(a.p);
a.p += QFIXEDSZ;
/* Compare the decoded questions. */
if (strcasecmp(q.name, a.name) == 0 && q.type == a.type
- && q.class == a.class)
+ && q.dnsclass == a.dnsclass)
{
free(a.name);
break;
-.\" $Id: ares_query.3,v 1.1 1998/08/13 18:07:34 ghudson Exp $
+.\" $Id: ares_query.3,v 1.2 2000/09/21 19:15:56 ghudson Exp $
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.B unsigned char *\fIabuf\fP, int \fIalen\fP)
.PP
.B void ares_query(ares_channel \fIchannel\fP, const char *\fIname\fP,
-.B int \fIclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
+.B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
.B void *\fIarg\fP)
.fi
.SH DESCRIPTION
gives the query name as a NUL-terminated C string of period-separated
labels optionally ending with a period; periods and backslashes within
a label must be escaped with a backslash. The parameters
-.I class
+.I dnsclass
and
.I type
give the class and type of the query using the values defined in
* without express or implied warranty.
*/
-static const char rcsid[] = "$Id: ares_query.c,v 1.4 2000/01/05 16:29:44 ghudson Exp $";
+static const char rcsid[] = "$Id: ares_query.c,v 1.5 2000/09/21 19:15:58 ghudson Exp $";
#include <sys/types.h>
#include <netinet/in.h>
static void qcallback(void *arg, int status, unsigned char *abuf, int alen);
-void ares_query(ares_channel channel, const char *name, int class,
+void ares_query(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg)
{
struct qquery *qquery;
/* Compose the query. */
rd = !(channel->flags & ARES_FLAG_NORECURSE);
- status = ares_mkquery(name, class, type, channel->next_id, rd, &qbuf, &qlen);
+ status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf,
+ &qlen);
channel->next_id++;
if (status != ARES_SUCCESS)
{
-.\" $Id: ares_search.3,v 1.1 1998/08/13 18:07:35 ghudson Exp $
+.\" $Id: ares_search.3,v 1.2 2000/09/21 19:16:00 ghudson Exp $
.\"
.\" Copyright 1998 by the Massachusetts Institute of Technology.
.\"
.B unsigned char *\fIabuf\fP, int \fIalen\fP)
.PP
.B void ares_search(ares_channel \fIchannel\fP, const char *\fIname\fP,
-.B int \fIclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
+.B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
.B void *\fIarg\fP)
.fi
.SH DESCRIPTION
C string of period-separated labels; if it ends with a period, the
channel's search domains will not be used. Periods and backslashes
within a label must be escaped with a backslash. The parameters
-.I class
+.I dnsclass
and
.I type
give the class and type of the query using the values defined in
* without express or implied warranty.
*/
-static const char rcsid[] = "$Id: ares_search.c,v 1.2 1999/10/23 19:28:14 danw Exp $";
+static const char rcsid[] = "$Id: ares_search.c,v 1.3 2000/09/21 19:16:02 ghudson Exp $";
#include <stdio.h>
#include <stdlib.h>
/* Arguments passed to ares_search */
ares_channel channel;
char *name; /* copied into an allocated buffer */
- int class;
+ int dnsclass;
int type;
ares_callback callback;
void *arg;
static int cat_domain(const char *name, const char *domain, char **s);
static int single_domain(ares_channel channel, const char *name, char **s);
-void ares_search(ares_channel channel, const char *name, int class,
+void ares_search(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg)
{
struct search_query *squery;
}
if (s)
{
- ares_query(channel, s, class, type, callback, arg);
+ ares_query(channel, s, dnsclass, type, callback, arg);
free(s);
return;
}
callback(arg, ARES_ENOMEM, NULL, 0);
return;
}
- squery->class = class;
+ squery->dnsclass = dnsclass;
squery->type = type;
squery->status_as_is = -1;
squery->callback = callback;
/* Try the name as-is first. */
squery->next_domain = 0;
squery->trying_as_is = 1;
- ares_query(channel, name, class, type, search_callback, squery);
+ ares_query(channel, name, dnsclass, type, search_callback, squery);
}
else
{
status = cat_domain(name, channel->domains[0], &s);
if (status == ARES_SUCCESS)
{
- ares_query(channel, s, class, type, search_callback, squery);
+ ares_query(channel, s, dnsclass, type, search_callback, squery);
free(s);
}
else
{
squery->trying_as_is = 0;
squery->next_domain++;
- ares_query(channel, s, squery->class, squery->type,
+ ares_query(channel, s, squery->dnsclass, squery->type,
search_callback, squery);
free(s);
}
{
/* Try the name as-is at the end. */
squery->trying_as_is = 1;
- ares_query(channel, squery->name, squery->class, squery->type,
+ ares_query(channel, squery->name, squery->dnsclass, squery->type,
search_callback, squery);
}
else