Standards / Extensions | C or C++ | Dependencies |
---|---|---|
BSD 4.3 |
both | OS/390 V2R8 |
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
int res_mkquery(int op, const char *dname, int class, int type, const u_char *data,
int datalen, const u_char *newrr_in, u_char *buf, int buflen);
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_mkquery() function constructs a standard query message and places it in buf. It returns the size of the query, or -1 if the query is larger than buflen. The query type op is usually QUERY, but can be any of the query types defined in <arpa/nameser.h>. The domain name for the query given by dname. The argument newrr_in is currently unused but is intended for making update messages.
If successful, res_mkquery() returns the size of the query.
If unsuccessful, res_mkquery() returns -1. The errors defined in <arpa/nameser.h> can be found in the buf.rcode, if an answer was supplied in the buf buffer.