Makes query messages for name servers.
#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h>
int res_mkquery (Operation, DomName, Class, Type, Data, DataLength) int res_mkquery (Reserved, Buffer, BufferLength) int Operation; char *DomName; int Class, Type; char *Data; int DataLength; struct rrec *Reserved; char *Buffer; int BufferLength;
The res_mkquery subroutine creates packets for name servers in the Internet domain. The subroutine also creates a standard query message. The Buffer parameter determines the location of this message.
The res_mkquery subroutine is one of a set of subroutines that form the resolver, a set of functions that resolve domain names. Global information used by the resolver subroutines is kept in the _res data structure. The /usr/include/resolv.h file contains the _res structure definition.
Operation | Specifies a query type. The usual type is QUERY, but the parameter can be set to any of the query types defined in the arpa/nameser.h file. | ||||||||||||||||||||||||||||||||||||
DomName | Points to the name of the domain. If the DomName parameter points to a single label and the RES_DEFNAMES structure is set, as it is by default, the subroutine appends the DomName parameter to the current domain name. The current domain name is defined by the name server in use or in the /etc/resolv.conf file. | ||||||||||||||||||||||||||||||||||||
Class | Specifies one of the following parameters:
| ||||||||||||||||||||||||||||||||||||
Type | Requires one of the following values:
| ||||||||||||||||||||||||||||||||||||
Data | Points to the data that is sent to the name server as a search key. The data is stored as a character array. | ||||||||||||||||||||||||||||||||||||
DataLength | Defines the size of the array pointed to by the Data parameter. | ||||||||||||||||||||||||||||||||||||
Reserved | Specifies a reserved and currently unused parameter. | ||||||||||||||||||||||||||||||||||||
Buffer | Points to a location containing the query message. | ||||||||||||||||||||||||||||||||||||
BufferLength | Specifies the length of the message pointed to by the Buffer parameter. |
Upon successful completion, the res_mkquery subroutine returns the size of the query. If the query is larger than the value of the BufferLength parameter, the subroutine is unsuccessful and returns a value of -1.
The res_mkquery subroutine is part of Base Operating System (BOS) Runtime.
All applications containing the res_mkquery subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.
/etc/resolv.conf | |
Contains the name server and domain name. |
The finger command.
The dn_comp subroutine, dn_expand subroutine, _getlong subroutine, _getshort subroutine, putlong subroutine, putshort subroutine, res_init subroutine, res_query subroutine, res_search subroutine, res_send subroutine.
Sockets Overview and Understanding Domain Name Resolution in AIX Version 4.3 Communications Programming Concepts.