version 1.6, 2006/01/24 17:40:32 |
version 1.6.6.1, 2007/06/03 17:25:59 |
|
|
#if defined(LIBC_SCCS) && !defined(lint) |
#if defined(LIBC_SCCS) && !defined(lint) |
#ifdef notdef |
#ifdef notdef |
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; |
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; |
static const char rcsid[] = "Id: res_mkquery.c,v 1.1.2.2.4.2 2004/03/16 12:34:18 marka Exp"; |
static const char rcsid[] = "Id: res_mkquery.c,v 1.5.18.1 2005/04/27 05:01:11 sra Exp"; |
#else |
#else |
__RCSID("$NetBSD$"); |
__RCSID("$NetBSD$"); |
#endif |
#endif |
Line 107 __weak_alias(res_nopt,_res_nopt) |
|
Line 107 __weak_alias(res_nopt,_res_nopt) |
|
|
|
extern const char *_res_opcodes[]; |
extern const char *_res_opcodes[]; |
|
|
/* |
/*% |
* Form all types of queries. |
* Form all types of queries. |
* Returns the size of the result or -1. |
* Returns the size of the result or -1. |
*/ |
*/ |
int |
int |
res_nmkquery(res_state statp, |
res_nmkquery(res_state statp, |
int op, /* opcode of query */ |
int op, /*!< opcode of query */ |
const char *dname, /* domain name */ |
const char *dname, /*!< domain name */ |
int class, int type, /* class and type of query */ |
int class, int type, /*!< class and type of query */ |
const u_char *data, /* resource record data */ |
const u_char *data, /*!< resource record data */ |
int datalen, /* length of data */ |
int datalen, /*!< length of data */ |
const u_char *newrr_in, /* new rr for modify or append */ |
const u_char *newrr_in, /*!< new rr for modify or append */ |
u_char *buf, /* buffer to put query */ |
u_char *buf, /*!< buffer to put query */ |
int buflen) /* size of buffer */ |
int buflen) /*!< size of buffer */ |
{ |
{ |
register HEADER *hp; |
register HEADER *hp; |
register u_char *cp, *ep; |
register u_char *cp, *ep; |
Line 197 res_nmkquery(res_state statp, |
|
Line 197 res_nmkquery(res_state statp, |
|
*/ |
*/ |
if (ep - cp < 1 + RRFIXEDSZ + datalen) |
if (ep - cp < 1 + RRFIXEDSZ + datalen) |
return (-1); |
return (-1); |
*cp++ = '\0'; /* no domain name */ |
*cp++ = '\0'; /*%< no domain name */ |
ns_put16(type, cp); |
ns_put16(type, cp); |
cp += INT16SZ; |
cp += INT16SZ; |
ns_put16(class, cp); |
ns_put16(class, cp); |
Line 227 res_nmkquery(res_state statp, |
|
Line 227 res_nmkquery(res_state statp, |
|
|
|
int |
int |
res_nopt(res_state statp, |
res_nopt(res_state statp, |
int n0, /* current offset in buffer */ |
int n0, /*%< current offset in buffer */ |
u_char *buf, /* buffer to put query */ |
u_char *buf, /*%< buffer to put query */ |
int buflen, /* size of buffer */ |
int buflen, /*%< size of buffer */ |
int anslen) /* UDP answer buffer size */ |
int anslen) /*%< UDP answer buffer size */ |
{ |
{ |
register HEADER *hp; |
register HEADER *hp; |
register u_char *cp, *ep; |
register u_char *cp, *ep; |
Line 248 res_nopt(res_state statp, |
|
Line 248 res_nopt(res_state statp, |
|
if ((ep - cp) < 1 + RRFIXEDSZ) |
if ((ep - cp) < 1 + RRFIXEDSZ) |
return (-1); |
return (-1); |
|
|
*cp++ = 0; /* "." */ |
*cp++ = 0; /*%< "." */ |
|
ns_put16(T_OPT, cp); /*%< TYPE */ |
ns_put16(T_OPT, cp); /* TYPE */ |
|
cp += INT16SZ; |
cp += INT16SZ; |
ns_put16(anslen & 0xffff, cp); /* CLASS = UDP payload size */ |
ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */ |
cp += INT16SZ; |
cp += INT16SZ; |
*cp++ = NOERROR; /* extended RCODE */ |
*cp++ = NOERROR; /*%< extended RCODE */ |
*cp++ = 0; /* EDNS version */ |
*cp++ = 0; /*%< EDNS version */ |
if (statp->options & RES_USE_DNSSEC) { |
if (statp->options & RES_USE_DNSSEC) { |
#ifdef DEBUG |
#ifdef DEBUG |
if (statp->options & RES_DEBUG) |
if (statp->options & RES_DEBUG) |
Line 265 res_nopt(res_state statp, |
|
Line 264 res_nopt(res_state statp, |
|
} |
} |
ns_put16(flags, cp); |
ns_put16(flags, cp); |
cp += INT16SZ; |
cp += INT16SZ; |
ns_put16(0, cp); /* RDLEN */ |
ns_put16(0, cp); /*%< RDLEN */ |
cp += INT16SZ; |
cp += INT16SZ; |
hp->arcount = htons(ntohs(hp->arcount) + 1); |
hp->arcount = htons(ntohs(hp->arcount) + 1); |
|
|
return (cp - buf); |
return (cp - buf); |
} |
} |
#endif |
#endif |
|
|
|
/*! \file */ |