#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int res_mkquery(int operation,
char *domain_name,
int class,
int type,
char *search_data,
int search_data_length,
struct rrec *reserved,
char *query_buffer,
int query_buffer_length)
The res_mkquery() function is used to make standard query messages (DNS packets) for name servers.
| ns_o_query or QUERY | Standard query request. (This value is almost always used.) |
| ns_c_in or C_IN | Specifies the ARPA Internet. |
| ns_c_any or C_ANY | This is the wildcard match. |
| ns_t_a or T_A | Host address. |
| ns_t_aaaa | IPv6 address. |
| ns_t_ns or T_NS | Authoritative server. |
| ns_t_cname or T_CNAME | Canonical name. |
| ns_t_soa or T_SOA | Start of authority zone. |
| ns_t_wks or T_WKS | Well-known service. |
| ns_t_ptr or T_PTR | Domain name pointer. |
| ns_t_hinfo or T_HINFO | Host information. |
| ns_t_mx or T_MX | Mail routing information. |
| ns_t_txt or T_TXT | Text strings. |
| ns_t_any or T_ANY | Wildcard match. |
No authorization is required.
res_mkquery() returns an integer. Possible values are:
When the res_mkquery() 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.
The message buffer was too small. The query was larger than the value of query_buffer_length
| Top | UNIX-Type APIs | APIs by category |