ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/resxlt.htm

280 lines
7.1 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!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_xlate()--Translate DNS Packets</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_xlate()--Translate DNS Packets</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/nameser.h&gt;
#include &lt;resolv.h&gt;
int res_xlate(int <em>input_ccsid</em>,
char *<em>input_packet</em>,
int <em>input_length</em>,
int <em>output_ccsid</em>,
char *<em>output_packet</em>,
int <em>output_length</em>)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV2<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <em>res_xlate()</em> function is used to translate a standard DNS packet
between ASCII and EBCDIC.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>input_ccsid</strong></dt>
<dd>(Input) The CCSID value of the input packet to be translated.<br>
<br>
</dd>
<dt><strong>input_packet</strong></dt>
<dd>(Input) The pointer to where the standard DNS packet to be translated
resides.<br>
<br>
</dd>
<dt><strong>input_length</strong></dt>
<dd>(Input) The length of <em>input_packet</em>.<br>
<br>
</dd>
<dt><strong>output_ccsid</strong></dt>
<dd>(Input) The CCSID value for the output packet.<br>
<br>
</dd>
<dt><strong>output_packet</strong></dt>
<dd>(Output) The pointer to where the translated DNS packet will be stored.<br>
<br>
</dd>
<dt><strong>output_length</strong></dt>
<dd>(Input) The length of <em>output_packet</em>.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p><em>res_xlate()</em> returns an integer. Possible values are:</p>
<ul>
<li>1 (successful)<br>
<br>
</li>
<li>0 (unsuccessful - translation error)<br>
<br>
</li>
<li>-1 (unsuccessful - errors other than translation)</li>
</ul>
<br>
<h3>Error Conditions</h3>
<p>When the <em>res_xlate()</em> function fails, it does not set specific
<em>errno</em> or <em>h_errno</em> values. An error occurs under the following
conditions:</p>
<ul>
<li>NULL pointer(s) passed to the function.<br><br></li>
<li>Invalid pointer(s) passed to the function.<br><br></li>
<li>Invalid lengths passed to the function.<br><br></li>
<li>An invalid packet format encountered.</li>
</ul>
<br>
<h3>Usage Notes</h3>
<ol>
<li><em>res_xlate()</em> parses through <em>input_packet</em>, determining
which fields need translation. The packet is copied into <em>output_packet</em>
as it is parsed, translating the fields as needed from <em>input_ccsid</em> to
<em>output_ccsid</em>. If a bad format is encountered or a user-supplied length
is too small, <em>res_xlate()</em> returns a -1.<br>
<br>
</li>
<li>If there is an error in the translation of
<strong><em>input_packet</em></strong> from
<strong><em>input_ccsid</em></strong> to
<strong><em>output_ccsid</em></strong>, <em>res_xlate()</em> returns a value of
0 to the caller.<br>
<br>
</li>
<li><em>res_xlate()</em> expects a value of 819 (ASCII) for either the input or
output coded character set identifier (CCSID). If translation from an EBCDIC
CCSID is to occur, the output CCSID needs to be set to 819.
<strong><em>input_packet</em></strong> is then translated to ASCII, and the
result is placed in <strong><em>output_packet</em></strong> If translation to
an EBCDIC CCSID is to occur, the input CCSID needs to be set to 819.
<strong><em>input_packet</em></strong> is then translated from ASCII to the
EBCDIC CCSID specified in <strong><em>output_ccsid</em></strong>, and the
result is placed in <strong><em>output_packet</em></strong>.
<p><em>res_xlate()</em> returns unsuccessfully with a value of -1 if CCSID 819
is not used for either <strong><em>input_ccsid</em></strong> or
<strong><em>output_ccsid</em></strong>. Also, if both
<strong><em>input_ccsid</em></strong> and
<strong><em>output_ccsid</em></strong> values are 819, <em>res_xlate()</em>
returns a -1.</p>
</li>
<li>In a thread-enabled environment, the <strong>_res</strong> 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="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="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="resclo.htm">res_close()</a>--Close Socket and Reset _res
Structure<br>
<br>
</li>
<li><a href="resfindzonecut.htm">res_findzonecut()</a>--Find the Enclosing Zone and
Servers<br>
<br>
</li>
<li><a href="reshostalias.htm">res_hostalias()</a>--Retrieve the host alias<br>
<br>
</li>
<li><a href="resninit.htm">res_ninit()</a>--Initialize res Structure<br>
<br>
</li>
<li><a href="resnclose.htm">res_nclose()</a>--Close Socket and Reset res
Structure<br>
<br>
</li>
<li><a href="resnmkquery.htm">res_nmkquery()</a>--Place Domain Query in
Buffer<br>
<br>
</li>
<li><a href="resnmkupdate.htm">res_nmkupdate()</a>--Construct an Update
Packet<br>
<br>
</li>
<li><a href="resnquery.htm">res_nquery()</a>--Send Domain Query<br>
<br>
</li>
<li><a href="resnsearch.htm">res_nsearch()</a>--Search for Domain Name<br>
<br>
</li>
<li><a href="resnsend.htm">res_nsend()</a>--Send Buffered Domain Query<br>
<br>
</li>
<li><a href="resnsendsigned.htm">res_nsendsigned()</a>--Send Authenticated Domain
Query<br>
<br>
</li>
<li><a href="resnupdate.htm">res_nupdate()</a>--Build and Send Dynamic
Updates<br>
<br>
</li>
</ul>
<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>