204 lines
5.9 KiB
HTML
204 lines
5.9 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>getnetbyname_r()--Get Network Information for Domain Name</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>getnetbyname_r()--Get Network Information for Domain Name</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <netdb.h>
|
|
int getnetbyname_r(char *<em>network_name</em>,
|
|
struct netent *<em>netent_struct_addr</em>,
|
|
struct netent_data
|
|
*<em>netent_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>getnetbyname_r()</em> function is used to retrieve information about
|
|
a network. The information is retrieved from the network database file.</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt>char *<strong>network_name</strong> (input/output) </dt>
|
|
|
|
<dd>Specifies the pointer to the character string that contains the name of the
|
|
network for which information is to be retrieved.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt>struct netent *<strong>netent_struct_addr</strong>
|
|
(input/output) </dt>
|
|
|
|
<dd>Specifies the pointer to a netent structure where the results will be
|
|
placed. All results must be referenced through this structure.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt>struct netent_data *<strong>netent_data_struct_addr</strong>
|
|
(input/output) </dt>
|
|
|
|
<dd>Specifies the pointer to the netent_data structure, which is used to pass
|
|
and preserve results between function calls. The field net_control_blk in the
|
|
netent_data structure must be initialized with hexadecimal zeros before its
|
|
initial use. If compatibility with other platforms is required, then the entire
|
|
netent_data structure must initialized with 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>getnetbyname_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 netent</strong> denoted by
|
|
<strong><em>netent_struct_addr</em></strong> and <strong>struct
|
|
netent_data</strong>denoted by
|
|
<strong><em>netent_data_struct_addr</em></strong> are both defined in
|
|
<strong><netdb.h></strong>. The structure <strong>struct
|
|
netent</strong>is defined as:</p>
|
|
|
|
<pre>
|
|
struct netent [
|
|
char *n_name;
|
|
char **n_aliases;
|
|
int n_addrtype;
|
|
unsigned long n_net;
|
|
];
|
|
</pre>
|
|
|
|
<p><em>n_name</em> points to the character string that contains the name of the
|
|
network. <em>n_aliases</em> is a pointer to a NULL-terminated list of pointers,
|
|
each of which points to a character string that represents an alternative name
|
|
for the network. <em>n_addrtype</em> contains the address type of the network
|
|
(that is, AF_INET). <em>n_net</em> is the 32-bit network address (that is, an
|
|
IP address in network byte order with host part set to zero).</p>
|
|
|
|
<br>
|
|
<h3>Error Conditions</h3>
|
|
|
|
<p>When the <em>getnetbyname_r()</em> function fails, <em>errno</em> can be set
|
|
to:</p>
|
|
<dl>
|
|
<dt><em>[EINVAL]</em></dt>
|
|
<dd><p>The netent_data structure was not properly
|
|
initialized to hexadecimal zeros before initial use. For corrective action, see
|
|
the description for structure netent_data.</p></dd>
|
|
|
|
</dl>
|
|
|
|
|
|
<br>
|
|
<h3>Usage Notes</h3>
|
|
|
|
<ol>
|
|
<li>The iSeries Navigator or the following CL commands can be
|
|
used to access the network database file:<br>
|
|
<br>
|
|
<ul>
|
|
<li>WRKNETTBLE (Work with Network Table Entries)</li>
|
|
|
|
<li>ADDNETTBLE (Add Network Table Entry)</li>
|
|
|
|
<li>RMVNETTBLE (Remove Network Table Entry)</li>
|
|
</ul>
|
|
|
|
<br>
|
|
</li>
|
|
|
|
<li>When the network information is obtained from the network database file,
|
|
the file is opened and the network information is retrieved (if it exists) from
|
|
the file. The file is then closed only if a <em>setnetent_r()</em> call with a
|
|
non-zero parameter value was not previously done.<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li>A coded character set identifier (CCSID) of 65535 for the job requests that
|
|
no database translation be performed. For translation to occur for the network
|
|
name specified by the <em>network_name</em> parameter, and for the network
|
|
names returned in the netent structure, the job CCSID must be something other
|
|
than 65535.</li>
|
|
</ol>
|
|
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li><a href="tsgnete.htm">getnetent_r()</a>--Get Next Entry from Network
|
|
Database<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="tsgneta.htm">getnetbyaddr_r()</a>--Get Network Information for IP
|
|
Address<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="tssnete.htm">setnetent_r()</a>--Open Network Database<br>
|
|
<br>
|
|
</li>
|
|
|
|
<li><a href="tsenete.htm">endnetent_r()</a>--Close Network Database</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>
|
|
|