238 lines
5.7 KiB
HTML
238 lines
5.7 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_query()--Send Domain Query</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_query()--Send Domain Query</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_query(char *<em>domain_name</em>,
|
||
|
int <em>class</em>,
|
||
|
int <em>type</em>,
|
||
|
char *<em>answer_buffer</em>,
|
||
|
int <em>answer_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_query()</em> function is used to interface to the server query
|
||
|
mechanism.</p>
|
||
|
|
||
|
<br>
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>domain_name</strong></dt>
|
||
|
|
||
|
<dd>(Input) The pointer to the domain name.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>class</strong></dt>
|
||
|
|
||
|
<dd>(Input) The class of data being looked for. See <a href=
|
||
|
"resmkq.htm">res_mkquery()</a> or <arpa/nameser.h> for possible
|
||
|
values.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>type</strong></dt>
|
||
|
|
||
|
<dd>(Input) The type of request being made. See <a href=
|
||
|
"resmkq.htm">res_mkquery()</a> or <arpa/nameser.h> for possible
|
||
|
values.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>answer_buffer</strong></dt>
|
||
|
|
||
|
<dd>(Output) The pointer to an address where the response is stored.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong>answer_buffer_length</strong></dt>
|
||
|
|
||
|
<dd>(Input) The size of the answer area.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
<h3>Authorities</h3>
|
||
|
|
||
|
<p>No authorization is required.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Return Value</h3>
|
||
|
|
||
|
<p><em>res_query()</em> returns an integer. Possible values are:</p>
|
||
|
|
||
|
<ul>
|
||
|
<li>-1 (unsuccessful)<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li>n (successful), where n is the actual size of the answer returned.</li>
|
||
|
</ul>
|
||
|
|
||
|
<br>
|
||
|
<h3>Error Conditions</h3>
|
||
|
<p>When the <em>res_query()</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>
|
||
|
|
||
|
|
||
|
<dd><p>When the <em>res_query()</em> function fails, <em>h_errno</em> (defined in
|
||
|
<strong><netdb.h></strong>) can be set to one of the following:</p>
|
||
|
<dl>
|
||
|
<dt><em>[HOST_NOT_FOUND]</em></dt>
|
||
|
<dd><p>The domain name specified by the <em>domain_name</em> parameter was not found. The
|
||
|
return code in the response packet was NXDOMAIN.</p></dd>
|
||
|
|
||
|
<dt><em>[TRY_AGAIN]</em></dt>
|
||
|
<dd><p>Either the name server is not running or the name
|
||
|
server returned SERVFAIL in the response packet.</p></dd>
|
||
|
|
||
|
<dt><em>[NO_RECOVERY]</em></dt>
|
||
|
<dd><p>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.</p></dd>
|
||
|
|
||
|
|
||
|
<dt><em>[NO_DATA]</em></dt>
|
||
|
<dd><p>The domain name exists but there is no data of
|
||
|
the requested type.</p></dd>
|
||
|
|
||
|
</dl></dd>
|
||
|
</dl>
|
||
|
<br>
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Usage Notes</h3>
|
||
|
|
||
|
<ol>
|
||
|
<li><em>res_query()</em> makes a query packet by calling
|
||
|
<em>res_mkquery()</em>, sends the query by calling <em>res_send()</em>, and
|
||
|
makes preliminary checks on the reply. The reply message is left in
|
||
|
<em>answer_buffer</em>.<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><em>res_query()</em> calls <em>res_init()</em> if the <strong>_res</strong>
|
||
|
structure has not been initialized.<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><em>res_query()</em> expects EBCDIC data as input. The output from
|
||
|
<em>res_query()</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>
|
||
|
<li><a href="hstrerror.htm">hstrerror()</a>--Retrieve Resolver Error
|
||
|
Message<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="resnquery.htm">res_nquery()</a>--Send Domain Query<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="resmkq.htm">res_mkquery()</a>--Place Domain Query in Buffer<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li><a href="resclo.htm">res_close()</a>--Close Socket and Reset _res
|
||
|
Structure<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>
|
||
|
|