res_query() — Resolver query for domain name servers
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
BSD 4.3 |
both | OS/390 V2R8 |
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int res_query(const char *dname, int class, int type, u_char *answer, int anslen);
General description
This routine is one of several functions used for making, sending and interpreting query and reply messages with Internet domain name servers (DNS).
The res_query() function provides an interface to the server query mechanism. It constructs a query, sends it to the local server, awaits a response, and makes preliminary checks on the reply. The query requests information of the specified type and class for the specified fully-qualified domain name dname. The reply message is left in the answer buffer with length anslen supplied by the caller.
Note: The res_query() function has a dependency
on the level of the Enhanced ASCII Extensions. See Enhanced ASCII support for details.
Returned value
If successful, res_query() returns the reply message in the answer buffer with length anslen.
If unsuccessful,
res_query() returns -1 and sets herrno to one of the following values:
- Error Code
- Description
- HOST_NOT_FOUND
- The host name provided is not known at any of the domain name servers queried for this request.
- NO_DATA
- An answer was received but no data was supplied in the answer buffer.
- NO_RECOVERY
- An error occurred that will continue to fail if tried again.
- TRY_AGAIN
- A error occurred querying the name selected, which can be retried.
Related information
- arpa/nameser.h
- netinet/in.h
- resolv.h
- sys/types.h
- dn_comp() — Resolver domain name compression
- dn_expand() — Resolver domain name expansion
- dn_find() — Resolver domain name find
- dn_skipname() — Resolver domain name skipping
- res_init() — Domain name resolver initialization
- res_mkquery() — Make resolver query for domain name servers
- res_querydomain() — Build domain name and resolver query
- res_search() — Resolver query for domain name servers
- res_send() — Send resolver query for domain name servers