329 lines
8.0 KiB
HTML
329 lines
8.0 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
|
<title>res_mkquery()--Place Domain Query in Buffer</title>
|
|
<!-- Begin Header Records ========================================== -->
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
|
<!-- Edited by Kersten Feb 02 -->
|
|
<!--End Header Records -->
|
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</head>
|
|
<body>
|
|
<a name="Top_Of_Page"></a>
|
|
<!-- Java sync-link -->
|
|
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
|
|
</script>
|
|
|
|
<h2>res_mkquery()--Place Domain Query in Buffer</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <sys/types.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/nameser.h>
|
|
#include <resolv.h>
|
|
|
|
int res_mkquery(int <em>operation</em>,
|
|
char *<em>domain_name</em>,
|
|
int <em>class</em>,
|
|
int <em>type</em>,
|
|
char *<em>search_data</em>,
|
|
int <em>search_data_length</em>,
|
|
struct rrec *<em>reserved</em>,
|
|
char *<em>query_buffer</em>,
|
|
int <em>query_buffer_length</em>)
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QSOSRV2<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: Yes<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <em>res_mkquery()</em> function is used to make standard query messages
|
|
(DNS packets) for name servers.</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong>operation</strong></dt>
|
|
|
|
<dd>(Input) The query operation desired. This gets put into OPCODE in the
|
|
header of the packet. Common values are listed below (see
|
|
<arpa/nameser.h> for all possible values):
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_o_query</em> or <em>QUERY</em></td>
|
|
<td align="left" valign="top">Standard query request. (This value is almost
|
|
always used.)</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>domain_name</strong></dt>
|
|
|
|
<dd>(Input) The pointer to the name of the domain.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>class</strong></dt>
|
|
|
|
<dd>(Input) The class of data being looked for. Common values are listed below
|
|
(see <arpa/nameser.h> for all possible values):
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_c_in</em> or <em>C_IN</em></td>
|
|
<td align="left" valign="top">Specifies the ARPA Internet.
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_c_any</em> or <em>C_ANY</em></td>
|
|
<td align="left" valign="top">This is the wildcard match.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>type</strong></dt>
|
|
|
|
<dd>(Input) The type of request being made. Common values are listed below (see
|
|
<arpa/nameser.h> for all possible values):
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_a</em> or <em>T_A</em></td>
|
|
<td align="left" valign="top">Host address.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_aaaa</em></td>
|
|
<td align="left" valign="top">IPv6 address.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_ns</em> or <em>T_NS</em></td>
|
|
<td align="left" valign="top">Authoritative server.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_cname</em> or <em>T_CNAME</em></td>
|
|
<td align="left" valign="top">Canonical name.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_soa</em> or <em>T_SOA</em></td>
|
|
<td align="left" valign="top">Start of authority zone.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_wks</em> or <em>T_WKS</em></td>
|
|
<td align="left" valign="top">Well-known service.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_ptr</em> or <em>T_PTR</em></td>
|
|
<td align="left" valign="top">Domain name pointer.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_hinfo</em> or <em>T_HINFO</em></td>
|
|
<td align="left" valign="top">Host information.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_mx</em> or <em>T_MX</em></td>
|
|
<td align="left" valign="top">Mail routing information.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_txt</em> or <em>T_TXT</em></td>
|
|
<td align="left" valign="top">Text strings.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>ns_t_any</em> or <em>T_ANY</em></td>
|
|
<td align="left" valign="top">Wildcard match.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>search_data</strong></dt>
|
|
|
|
<dd>(Input) A buffer containing the data for inverse queries. It is NULL for
|
|
types other than IQUERY.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>search_data_length</strong></dt>
|
|
|
|
<dd>(Input) The length of <em>search_data</em>. It is NULL for types other than
|
|
IQUERY.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>reserved</strong></dt>
|
|
|
|
<dd>(Input) A reserved and currently unused parameter. It is always a NULL
|
|
pointer (defined for compatibility).<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>query_buffer</strong></dt>
|
|
|
|
<dd>(Output) A pointer to a user-supplied location containing the query
|
|
message.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>query_buffer_length</strong></dt>
|
|
|
|
<dd>(Input) The length of <em>query_buffer</em>.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
<h3>Authorities:</h3>
|
|
|
|
<p>No authorization is required.</p>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Return Value</h3>
|
|
|
|
<p><em>res_mkquery()</em> returns an integer. Possible values are:</p>
|
|
|
|
<ul>
|
|
<li>-1 (unsuccessful)<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li>n (successful), where n is the size of the query.</li>
|
|
</ul>
|
|
|
|
<br>
|
|
<h3>Error Conditions</h3>
|
|
<p>When the <em>res_mkquery()</em> function fails, <em>errno</em> can be set to
|
|
one of the following:</p>
|
|
<dl>
|
|
|
|
<dt><em>[EFAULT]</em></dt>
|
|
<dd><p>The system detected a pointer that was invalid
|
|
while attempting to access an input pointer.</p></dd>
|
|
|
|
<dt><em>[EINVAL]</em></dt>
|
|
<dd><p>The <strong>_res</strong> appears to be
|
|
initialized but the reserved field is not set to zeros.</p></dd>
|
|
|
|
<dt><em>[EMSGSIZE]</em></dt>
|
|
<dd><p>The message buffer was too small. The query was
|
|
larger than the value of <em>query_buffer_length</em></p></dd>
|
|
|
|
</dl>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Usage Notes</h3>
|
|
|
|
<ol>
|
|
<li><em>res_mkquery()</em> creates a standard query message (DNS packet). It
|
|
fills in the header fields, compresses the domain name into the question
|
|
section, and fills in the other question fields. This query message is placed
|
|
in <em>query_buffer</em>.<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><em>res_mkquery()</em> calls <em>res_init()</em> if the
|
|
<strong>_res</strong> structure has not been initialized.<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><em>res_mkquery()</em> expects EBCDIC data as input. The output from
|
|
<em>res_mkquery()</em> is also EBCDIC.<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li>In a thread-enabled environment, the <strong>_res</strong> structure is
|
|
shared among all threads within a process.</li>
|
|
</ol>
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul class="noindent">
|
|
<li><a href="resnmkquery.htm">res_nmkquery()</a>--Place Domain Query in
|
|
Buffer<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="reshostalias.htm">res_hostalias()</a>--Retrieve the host alias<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resini.htm">res_init()</a>--Initialize _res Structure<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resclo.htm">res_close()</a>--Close Socket and Reset _res
|
|
Structure<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resqry.htm">res_query()</a>--Send Domain Query<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="ressch.htm">res_search()</a>--Search for Domain Name<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="ressnd.htm">res_send()</a>--Send Buffered Domain Query<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="resxlt.htm">res_xlate()</a>--Translate DNS Packets</li>
|
|
</ul>
|
|
|
|
<br>
|
|
<hr>
|
|
API introduced: V3R1
|
|
|
|
<hr>
|
|
<center>
|
|
<table cellpadding="2" cellspacing="2">
|
|
<tr align="center">
|
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
|
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a> </td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</body>
|
|
</html>
|
|
|