#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int res_search(char *domain_name, int class, int type, char *answer_buffer, int answer_buffer_length)
The res_search() function is used to make a query message and wait for a response.
res_search() returns an integer. Possible values are:
Authorization of *R (allow access to the object) to the host aliases file specified by the HOSTALIASES environment variable.
You also need *X authority to each directory in the path of the host aliases file.
When the res_search() function fails, errno can be set to one of the following:
Permission denied. The process does not have the appropriate privileges to the host aliases file specified by the HOSTALIASES environment variable.
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_search() function fails, h_errno (defined in <netdb.h>) can be set to one of the following:
(Set by the call to res_query() ) 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.
(Set by the call to res_query() ) 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.
(Set by the call to res_query() ) The domain name exists but there is no data of the requested type.
Top | UNIX-Type APIs | APIs by category |