[Previous] [Contents] [Index] [Next]

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 u_char * data,
                 int datalen,
                 const u_char * newrr,
                 u_char * buf,
                 int buflen );

Library:

socket3r.lib, socket3s.lib

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; or -1 if an error occurs.

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()

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

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


[Previous] [Contents] [Index] [Next]