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

182 lines
4.8 KiB
HTML
Raw 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>getprotoent()--Get Next Entry from Protocol Database</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. -->
<!-- Change History: -->
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--End Header Records --><!-- Edited by Kersten Feb 02 -->
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>getprotoent()--Get Next Entry from Protocol Database</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;netdb.h&gt;
struct protoent *getprotoent()
</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: No; see <a href="#USAGE_NOTES">Usage Notes</a>.<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <em>getprotoent()</em> function is used to retrieve protocol information
from the protocol database file. When <em>getprotoent()</em> is first called,
the file is opened, and the first entry is returned. Each subsequent call to
<em>getprotoent()</em> results in the next entry in the file being returned. To
close the file, use <em>endprotoent()</em>.</p>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<p><em>getprotoent()</em> returns a pointer. Possible values are: </p>
<ul>
<li>NULL (unsuccessful or end-of-file)<br>
<br>
</li>
<li>p (successful), where p is a pointer to <strong>struct
protoent</strong>.</li>
</ul>
<p>The structure <strong>struct protoent</strong> is defined in
<strong>&lt;netdb.h&gt;</strong>.</p>
<pre>
struct protoent {
char *p_name;
char **p_aliases;
int p_proto;
};
</pre>
<p><em>p_name</em> points to the character string that contains the name of the
protocol. <em>p_aliases</em> is a pointer to a NULL-terminated array of
alternate names for the protocol. <em>p_proto</em> is the protocol number.</p>
<br>
<h3><a name="USAGE_NOTES">Usage Notes</a></h3>
<ol>
<li>The iSeries Navigator or the following CL commands can be
used to access the protocol database file:<br>
<br>
<ul>
<li>WRKPCLTBLE (Work with Protocol Table Entries)<br>
<br>
</li>
<li>ADDPCLTBLE (Add Protocol Table Entry)<br>
<br>
</li>
<li>RMVPCLTBLE (Remove Protocol Table Entry)</li>
</ul>
<br>
</li>
<li>The pointer returned by <em>getprotoent()</em> points to static storage
that is overwritten on subsequent calls to the <em>getprotoent()</em>,
<em>getprotobynumber()</em>, or <em>getprotobyname()</em> functions.<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 protocol
names returned in the protoent structure, the job CCSID must be something other
than 65535.<br>
<br>
</li>
<li>Do not use the <em>getprotoent()</em> function in a multithreaded
environment. See the multithread alternative <em>getprotoent_r()</em>
function.<br>
<br>
</li>
<li>When you develop in C-based
languages and an application is compiled with the _XOPEN_SOURCE macro defined
to the value 520 or greater, the <em>getprotoent()</em> API is mapped to
<em>qso_getprotoent98()</em>.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="_xopen_source.htm">_XOPEN_SOURCE</a>--Using _XOPEN_SOURCE for the UNIX 98
compatible interface<br>
<br>
</li>
<li><a href="gprotnm.htm">getprotobyname()</a>--Get Protocol Information for
Protocol Name<br>
<br>
</li>
<li><a href="gprotnu.htm">getprotobynumber()</a>--Get Protocol Information for
Protocol Number<br>
<br>
</li>
<li><a href="eprotnt.htm">endprotoent()</a>--Close Protocol Database<br>
<br>
</li>
<li><a href="sprotnt.htm">setprotoent()</a>--Open Protocol 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>