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

305 lines
8.2 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_nupdate()--Build and Send Dynamic Updates</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_nupdate()--Build and Send Dynamic Updates</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_nupdate(state* <em>res</em>,
ns_updrec *<em>update_record</em>
ns_tsig_key *key)
</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_nupdate()</em> function separates the linked list of update
records into groups so that all records in a group will belong to a single zone
on the nameserver. It creates a dynamic update packet for each zone and sends
it to the nameservers for that zone.</p>
<h3>Parameters</h3>
<dl>
<dt><strong>res</strong></dt>
<dd>(Input) The pointer to the <strong>state</strong> structure.<br>
<br>
</dd>
<dt><strong>update_record</strong></dt>
<dd>(Input) The pointer to the linked list of update records.<br>
<br>
</dd>
<dt><strong>key</strong></dt>
<dd>(Input) The pointer to the key to use for authentication. If it is NULL, no
authentication will be done.</dd>
</dl>
<p>The <strong>ns_updrec</strong> structure is defined in
<strong>&lt;arpa/nameser.h&gt;</strong>.</p>
<pre>
struct ns_updrec {
struct {
struct ns_updrec *prev, *next;
} r_link, r_glink;
ns_sect r_section;
char * r_dname;
ns_class r_class;
ns_type r_type;
uint32 r_ttl;
unsigned char * r_data;
uint32 r_size;
int32 r_opcode;
/* The following fields are ignored by the resolver routines */
struct databuf * r_dp;
struct databuf * r_deldp;
uint32 r_zone;
};
typedef struct ns_updrec ns_updrec;
</pre>
<dl>
<dt><em>r_link</em> and <em>r_glink</em></dt>
<dd>Doubly linked lists of <strong>ns_updrec</strong> records.
<em>res_nupdate()</em> uses <em>r_link</em> as its list of records to process
and ignores <em>r_glink</em>. <em>res_nmkupdate()</em> uses <em>r_glink</em> as
its list of records to process and ignores <em>r_link</em>.<br>
<br>
</dd>
<dt><em>r_section</em></dt>
<dd>See the <em>ns_sect</em> enums in <strong>&lt;arpa/nameser.h&gt;</strong>
for allowed values.<br>
<br>
</dd>
<dt><em>r_dname</em>,<em>r_class</em>,<em>r_type</em>,
<em>r_ttl</em>,<em>r_data</em>, and <em>r_size</em></dt>
<dd>Identify the resource record to the DNS<br>
<br>
</dd>
<dt><em>r_opcode</em></dt>
<dd>Type of update operation. Valid operations are <em>ns_uop_delete</em> or
<em>ns_uop_add</em><br>
<br>
</dd>
<dt>These fields are ignored by the resolver: <em>r_dp</em>, <em>r_deldp</em>,
<em>r_zone</em>.</dt>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p><em>res_nupdate()</em> returns an integer. Possible values are:</p>
<ul>
<li>n (successful), where n is the number of zones updated.<br>
<br>
</li>
<li>-1 (unsuccessful)</li>
</ul>
<br>
<h3>Error Conditions</h3>
<p>When the <em>res_nupdate()</em> function fails, <em>res_nupdate()</em> can
set <em>errno</em> to one of the following:</p>
<dl>
<dt><em>[ECONVERT]</em></dt>
<dd><p>Either the input packet could not be translated
to ASCII or the answer received could not be translated to the coded character
set identifier (CCSID) currently in effect for the job.</p></dd>
<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>One of the following reasons:</p>
<ul>
<li>An invalid length or NULL pointer was passed to <em>res_nupdate()</em><br><br></li>
<li>The <strong>res</strong> appears to be initialized but the reserved field
is not set to zeros.</li>
</ul>
</dd> </dl>
<p><strong>Notes:</strong></p>
<ul>
<li>No attempt is made to initialize the
<strong>res</strong> structure if it was initialized previous to the
<em>res_nupdate()</em> being issued.<br><br></li>
<li><em>res_nupdate()</em> calls <em>res_findzonecut()</em>,
<em>res_nmkupdate()</em> and <em>res_nsend()</em> or <em>res_nsendsigned()</em>
so errnos from those routines may also be set.</li>
</ul>
<br>
<h3>Usage Notes</h3>
<ol>
<li><em>res_nupdate()</em> calls <em>res_ninit()</em> if the
<strong>res</strong> structure has not been initialized.<br>
<br>
</li>
<li><em>res_nupdate()</em> calls <em>res_findzonecut()</em> to find the zone
and name server to be updated for each input record and sorts the records by
zone. Then it makes a zone record for each zone and prepends it to the update
records. It calls <em>res_nmkupdate()</em> to make the update packet and then
calls either <em>res_nsend()</em> or <em>res_nsendsigned()</em> to send the
packet. Note that since <em>res_nupdate()</em> prepends a new zone record, the
input records must only contain pre-requisite and update records, not zone
records.<br>
<br>
</li>
<li><em>res_nupdate()</em> assumes that the data passed to it is EBCDIC and is
in the default coded character set identifier (CCSID) currently in effect for
the job. It translates the data from the default CCSID currently in effect for
the job to ASCII (CCSID 819) before the data is sent out to a name server. The
response that it receives from the name server is returned in the default CCSID
currently in effect for the job.<br>
<br>
</li>
<li><em>res_nupdate()</em> will not use the local cache. It will always send
the packet to the server.<br>
<br>
</li>
<li>When using TSIG, it is important that the QUTCOFFSET system value is set
correctly for the local time zone. The resolver system and name server
timestamps must be within 5 minutes of each other (adjusted by the UTC offset)
or the authentication will fail with <em>ns_r_badtime</em>.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="resnclose.htm">res_nclose()</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="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="resxlt.htm">res_xlate()</a>--Translate DNS Packets</li>
</ul>
<br>
<hr>
API introduced: V5R1
<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>