181 lines
5.1 KiB
HTML
181 lines
5.1 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>sethostent_r()--Open Host Database</title>
|
|
<!-- 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. -->
|
|
<!-- Begin Header Records ========================================== -->
|
|
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
|
<!--End Header Records -->
|
|
<!-- Edited by Kersten Feb 02 -->
|
|
<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>sethostent_r()--Open Host Database</h2>
|
|
|
|
<div class="box" style="width: 60%;"><br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <netdb.h>
|
|
|
|
int sethostent_r(int <em>stay_open</em>,
|
|
struct hostent_data *<em>hostent_data_struct_addr</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>sethostent_r()</em> function is used in preparation for sequential
|
|
access to the host database file. The <em>sethostent_r()</em> function opens
|
|
the file and repositions the file marker to the beginning of the file. In
|
|
addition, this call affects what type of transport service (connectionless
|
|
versus connection-oriented) that is to be used when <em>gethostbyname_r()</em>
|
|
and <em>gethostbyaddr_r()</em> need to retrieve host information from the
|
|
domain name server.</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt>int <strong>stay_open</strong> (input) </dt>
|
|
|
|
<dd>Specifies whether to leave the database file open after each call to
|
|
<em>gethostbyname_r()</em> and <em>gethostbyaddr_r()</em>. A non-zero value
|
|
will result in the database file being left open. Also, a non-zero value will
|
|
result in the use of a connection-oriented transport service (for example, TCP)
|
|
being used by <em>gethostbyname_r()</em> and <em>gethostbyaddr_r()</em> when
|
|
host information is to be obtained from the domain name server.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt>struct hostent_data *<strong>hostent_data_struct_addr</strong>
|
|
(input/output) </dt>
|
|
|
|
<dd>Specifies the pointer to the hostent_data structure, which is used to pass
|
|
and preserve results between function calls. The field host_control_blk in the
|
|
hostent_data structure must be initialized with hexadecimal zeros before its
|
|
initial use. If compatibility with other platforms is required, then the entire
|
|
hostent_data structure must be initialized to hexadecimal zeros before initial
|
|
use.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
<h3>Authorities</h3>
|
|
|
|
<p>No authorization is required.</p>
|
|
|
|
<br>
|
|
<h3>Return Value</h3>
|
|
|
|
<p>The <em>sethostent_r()</em> function returns an integer. Possible values
|
|
are:</p>
|
|
|
|
<ul>
|
|
<li>-1 (unsuccessful call)</li>
|
|
|
|
<li>0 (successful call)</li>
|
|
</ul>
|
|
|
|
<p>The <strong>struct hostent_data</strong>denoted by
|
|
<strong><em>hostent_data_struct_addr</em></strong> is defined in
|
|
<strong><netdb.h></strong>.</p>
|
|
|
|
<br>
|
|
<h3>Error Conditions</h3>
|
|
|
|
<p>When the <em>sethostent_r()</em> function fails, <em>h_errno</em> (defined
|
|
in <strong><netdb.h></strong>) can be set to:</p>
|
|
|
|
<dl>
|
|
<dt><em>[NO_RECOVERY]</em></dt>
|
|
<dd><p>An unrecoverable error has occurred.</p></dd>
|
|
</dl>
|
|
|
|
|
|
<p>When the <em>sethostent_r()</em> function fails, <em>errno</em> can be set
|
|
to:</p>
|
|
<dl>
|
|
<dt><em>[EINVAL]</em></dt>
|
|
<dd><p>The hostent_data structure was not properly initialized to hexadecimal zeros before initial
|
|
use. For corrective action, see the description for structure hostent_data.</p></dd>
|
|
|
|
</dl>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Usage Notes</h3>
|
|
|
|
<p>The iSeries Navigator or the following CL commands can be
|
|
used to access the host database file:</p>
|
|
|
|
<ul>
|
|
<li>ADDTCPHTE (Add TCP/IP Host Table Entry)</li>
|
|
|
|
<li>RMVTCPHTE (Remove TCP/IP Host Table Entry)</li>
|
|
|
|
<li>CHGTCPHTE (Change TCP/IP Host Table Entry)</li>
|
|
|
|
<li>RNMTCPHTE (Rename TCP/IP Host Table Entry)</li>
|
|
|
|
<li>MRGTCPHT (Merge TCP/IP Host Tables)</li>
|
|
</ul>
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li><a href="tsghosta.htm">gethostbyaddr_r()</a>--Get Host Information for IP
|
|
Address<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="tsghostb.htm">gethostbyname_r()</a>--Get Host Information for Host
|
|
Name<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="tsehoste.htm">endhostent_r()</a>--Close Host Database<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="tsghoste.htm">gethostent_r()</a>--Get Next Entry from Host
|
|
Database</li>
|
|
</ul>
|
|
|
|
<br>
|
|
<hr>
|
|
API introduced: V4R2
|
|
|
|
<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>
|
|
|