diff options
Diffstat (limited to 'lib/libc/resolv/res_data.c')
-rw-r--r-- | lib/libc/resolv/res_data.c | 87 |
1 files changed, 56 insertions, 31 deletions
diff --git a/lib/libc/resolv/res_data.c b/lib/libc/resolv/res_data.c index e3dcbf0..ab6d575 100644 --- a/lib/libc/resolv/res_data.c +++ b/lib/libc/resolv/res_data.c @@ -16,8 +16,10 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: res_data.c,v 1.3.18.1 2005/04/27 05:01:10 sra Exp $"; +static const char rcsid[] = "$Id: res_data.c,v 1.1.206.2 2004/03/16 12:34:18 marka Exp $"; #endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include "port_before.h" @@ -40,14 +42,13 @@ static const char rcsid[] = "$Id: res_data.c,v 1.3.18.1 2005/04/27 05:01:10 sra #include <unistd.h> #include "port_after.h" -#undef _res const char *_res_opcodes[] = { "QUERY", "IQUERY", "CQUERYM", - "CQUERYU", /*%< experimental */ - "NOTIFY", /*%< experimental */ + "CQUERYU", /* experimental */ + "NOTIFY", /* experimental */ "UPDATE", "6", "7", @@ -71,11 +72,6 @@ const char *_res_sectioncodes[] = { #endif #ifndef __BIND_NOSTATIC -struct __res_state _res -# if defined(__BIND_RES_TEXT) - = { RES_TIMEOUT, } /*%< Motorola, et al. */ -# endif - ; /* Proto. */ @@ -107,7 +103,7 @@ res_init(void) { if (!_res.retrans) _res.retrans = RES_TIMEOUT; if (!_res.retry) - _res.retry = 4; + _res.retry = RES_DFLRETRY; if (!(_res.options & RES_INIT)) _res.options = RES_DEFAULT; @@ -140,14 +136,14 @@ fp_nquery(const u_char *msg, int len, FILE *file) { } int -res_mkquery(int op, /*!< opcode of query */ - const char *dname, /*!< domain name */ - int class, int type, /*!< class and type of query */ - const u_char *data, /*!< resource record data */ - int datalen, /*!< length of data */ - const u_char *newrr_in, /*!< new rr for modify or append */ - u_char *buf, /*!< buffer to put query */ - int buflen) /*!< size of buffer */ +res_mkquery(int op, /* opcode of query */ + const char *dname, /* domain name */ + int class, int type, /* class and type of query */ + const u_char *data, /* resource record data */ + int datalen, /* length of data */ + const u_char *newrr_in, /* new rr for modify or append */ + u_char *buf, /* buffer to put query */ + int buflen) /* size of buffer */ { if ((_res.options & RES_INIT) == 0U && res_init() == -1) { RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); @@ -169,10 +165,10 @@ res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) { } int -res_query(const char *name, /*!< domain name */ - int class, int type, /*!< class and type of query */ - u_char *answer, /*!< buffer to put answer */ - int anslen) /*!< size of answer buffer */ +res_query(const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer buffer */ { if ((_res.options & RES_INIT) == 0U && res_init() == -1) { RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); @@ -181,6 +177,7 @@ res_query(const char *name, /*!< domain name */ return (res_nquery(&_res, name, class, type, answer, anslen)); } +#ifndef _LIBC void res_send_setqhook(res_send_qhook hook) { _res.qhook = hook; @@ -190,6 +187,7 @@ void res_send_setrhook(res_send_rhook hook) { _res.rhook = hook; } +#endif int res_isourserver(const struct sockaddr_in *inp) { @@ -206,6 +204,7 @@ res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) { return (res_nsend(&_res, buf, buflen, ans, anssiz)); } +#ifndef _LIBC int res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key, u_char *ans, int anssiz) @@ -217,6 +216,7 @@ res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key, return (res_nsendsigned(&_res, buf, buflen, key, ans, anssiz)); } +#endif void res_close(void) { @@ -234,10 +234,10 @@ res_update(ns_updrec *rrecp_in) { } int -res_search(const char *name, /*!< domain name */ - int class, int type, /*!< class and type of query */ - u_char *answer, /*!< buffer to put answer */ - int anslen) /*!< size of answer */ +res_search(const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer */ { if ((_res.options & RES_INIT) == 0U && res_init() == -1) { RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); @@ -250,9 +250,9 @@ res_search(const char *name, /*!< domain name */ int res_querydomain(const char *name, const char *domain, - int class, int type, /*!< class and type of query */ - u_char *answer, /*!< buffer to put answer */ - int anslen) /*!< size of answer */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer */ { if ((_res.options & RES_INIT) == 0U && res_init() == -1) { RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); @@ -264,6 +264,12 @@ res_querydomain(const char *name, answer, anslen)); } +int +res_opt(int n0, u_char *buf, int buflen, int anslen) +{ + return (res_nopt(&_res, n0, buf, buflen, anslen)); +} + const char * hostalias(const char *name) { static char abuf[MAXDNAME]; @@ -288,6 +294,25 @@ local_hostname_length(const char *hostname) { } #endif /*ultrix*/ -#endif +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include <resolv.h>. + */ +#undef res_init +__weak_reference(__res_init, res_init); +#undef p_query +__weak_reference(__p_query, p_query); +#undef res_mkquery +__weak_reference(__res_mkquery, res_mkquery); +#undef res_query +__weak_reference(__res_query, res_query); +#undef res_send +__weak_reference(__res_send, res_send); +#undef res_close +__weak_reference(__res_close, _res_close); +#undef res_search +__weak_reference(__res_search, res_search); +#undef res_querydomain +__weak_reference(__res_querydomain, res_querydomain); -/*! \file */ +#endif |