res_querydomain()

Query the local Internet domain name server

Synopsis:

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

int res_querydomain( const char * name,
                     const char * domain,
                     int class,
                     int type,
                     u_char * answer,
                     int anslen );

Arguments:

name
The host name that you want to query.
domain
The domain name that you want to query.
class
The class of information that you want; one of:

You typically use C_IN.

type
The type of information that you want. You typically use T_PTR, but you can use any of the T_* constants defined in <arpa/nameser.h>.
answer
A pointer to a buffer where the function can store the answer to the query.
anslen
The length of the buffer.

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The res_querydomain() function provides an interface to the server query mechanism. It constructs a query, sends it to the local server, waits for a response, and makes preliminary checks on the reply. The query requests information of the specified type and class for the host specified by concatenating name and domain. The trailing dot is removed from name if domain is 0.

The reply message is left in the answer buffer with length anslen supplied by the caller.

Returns:

0
Success.
-1
An error occurred.

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:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No

See also:

res_init(), res_query()