#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int res_query(char *domain_name, int class, int type, char *answer_buffer, int answer_buffer_length)
The res_query() function is used to interface to the server query mechanism.
No authorization is required.
res_query() returns an integer. Possible values are:
When the res_query() function fails, errno can be set to one of the following:
The system detected a pointer that was invalid while attempting to access an input pointer.
The _res appears to be initialized but the reserved field is not set to zeros.
When the res_query() function fails, h_errno (defined in <netdb.h>) can be set to one of the following:
The domain name specified by the domain_name parameter was not found. The return code in the response packet was NXDOMAIN.
Either the name server is not running or the name server returned SERVFAIL in the response packet.
An unrecoverable error has occurred. Either the domain name could not be compressed because it was invalid or the name server returned FORMERR, NOTIMP, or REFUSED.
The domain name exists but there is no data of the requested type.
Top | UNIX-Type APIs | APIs by category |