res_mkquery()

construct an Internet domain name query

Synopsis:

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>

int res_mkquery( int op, 
                 const char *dname, 
                 int class,
                 int type, 
                 const char *data, 
                 int datalen,
                 const struct rrec *newrr,
                 char *buf, 
                 int buflen );

Description:

The res_mkquery() function is a low-level routine that's used by res_query() to construct an Internet domain name query. This routine constructs a standard query message and places it in buf. It returns the size of the query, or -1 if the query is larger than buflen.

The query type, op, is usually QUERY, but can be any of the query types defined in <arpa/nameser.h>. The domain name for the query is given by dname. The newrr parameter is currently unused but is intended for making update messages.

The resolver routines are used for making, sending, and interpreting query and reply messages with Internet domain name servers. Global configuration and state information used by the resolver routines is kept in the structure _res. For more information on the options, see res_init().

Returns:

The size of the prepared query, in bytes. If an error occurs, -1 is returned.

Files:

/etc/resolv.conf
Resolver configuration file.

Environment variables:

LOCALDOMAIN
When set, LOCALDOMAIN contains a domain name that overrides the current domain name.

Classification:

UNIX

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

dn_comp(), dn_expand(), gethostbyname(), res_init(), res_query(), res_search(), res_send()

/etc/resolv.conf, hostname, named in the TCP/IP User's Guide

RFC 1032, RFC 1033, RFC 1034, RFC 1035, RFC 974