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

314 lines
7.6 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>netdir_options()--Access Transport-Specific Capabilities</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: -->
<!-- YYMMDD USERID Change description -->
<!-- RPCMST SCRIPT A converted by B2H R4.1 (346) (CMS) by PMHALL at -->
<!-- RCHVMW2 on 7 Oct 1998 at 23:43:14 -->
<!-- Edited by Kersten Feb 02 -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>netdir_options()--Access Transport-Specific Capabilities</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<!-- iddvc RMBR -->
<br>
<pre>
#include &lt;netdir.h&gt;
int netdir_options(struct netconfig <em>*nconf</em>,
int <em>option</em>,
int <em>fd</em>,
char <em>*point_to_args</em>);
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QZNFTRPC<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: No<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>netdir_options()</strong> function provides interfaces to
transport-specific capabilities such as the broadcast address and reserved port
facilities of TCP and UDP.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>nconf</strong> &nbsp;(Input)&nbsp;</dt>
<dd>A pointer to a netconfig structure that specifies a transport.<br>
<br>
</dd>
<dt><strong>option</strong> &nbsp;(Input)&nbsp;</dt>
<dd>Specifies the transport-specific action to take. The following values may
be used for <em>option</em>:<br>
<br>
<table cellpadding="5">
<!-- cols="30 70" -->
<tr>
<td valign="top"><em>ND_SET_BROADCAST</em></td>
<td valign="top">Set the transport for broadcast if supported.</td>
</tr>
<tr>
<td valign="top"><em>ND_SET_RESERVEDPORT</em></td>
<td valign="top">Let the application bind to a reserved port if allowed by the
transport.</td>
</tr>
<tr>
<td valign="top"><em>ND_CHECK_RESERVEDPORT</em></td>
<td valign="top">Verify that an address corresponds to a reserved port if the
transport supports reserved ports.</td>
</tr>
<tr>
<td valign="top"><em>ND_MERGEADDR</em></td>
<td valign="top">Transform a locally meaningful address into an address that
the client host can connect to.</td>
</tr>
</table><br></dd>
<dt><strong>fd (Input)</strong></dt>
<dd>The file descriptor that may or may not be used based on the
option. The only value supported for this field is <strong>RPC_ANYFD</strong>.
The file descriptor value is used only if the specified option is
ND_SET_BROADCAST or ND_SET_RESERVEDPORT.<br><br></dd>
<dt><strong>point_to_args (Input)</strong></dt>
<dd>A pointer to the operation-specific data.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>The caller must have the *IOSYSCFG special authority to bind to a reserved
port.</p>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="5 95" -->
<tr>
<td valign="top"><em>0</em></td>
<td valign="top">netdir_options() was successful.</td>
</tr>
<tr>
<td valign="top"><em>-1</em></td>
<td valign="top"><strong>netdir_options()</strong> was not successful. The
<em>nd_errno</em> global variable (defined in
<strong>&lt;netdir.h&gt;</strong>) is set to indicate the error.</td>
</tr>
</table>
<br>
<br>
<h3>Error Conditions</h3>
<p>If <strong>netdir_options()</strong> is not successful, <em>nd_errno</em>
indicates one of the following errors:</p>
<table cellpadding="5">
<!-- cols="25 75" -->
<tr>
<td valign="top"><em>[ND_ACCESS]</em></td>
<td valign="top">The user does not have permission to use the specified
address.</td>
</tr>
<tr>
<td valign="top"><em>[ND_BADARG]</em></td>
<td valign="top">Bad argument passed.
<p>A file descriptor that was not valid was passed to the API.</p>
</td>
</tr>
<tr>
<td valign="top"><em>[ND_FAILCTRL]</em></td>
<td valign="top">Control operation failed.</td>
</tr>
<tr>
<td valign="top"><em>[ND_NO_ADDRESS]</em></td>
<td valign="top">Bad address.</td>
</tr>
<tr>
<td valign="top"><em>[ND_NOCONVERT]</em></td>
<td valign="top">Conversion error. One or more characters could not be
converted from the source CCSID to the target CCSID.</td>
</tr>
<tr>
<td valign="top"><em>[ND_NOCTRL]</em></td>
<td valign="top">The function was used in the wrong sequence.
<p>An incorrect option was specified.</p>
</td>
</tr>
<tr>
<td valign="top"><em>[ND_NO_DATA]</em></td>
<td valign="top">Incorret amount of data.</td>
</tr>
<tr>
<td valign="top"><em>[ND_NOHOST]</em></td>
<td valign="top">The host that was specified by the host name was not
found.</td>
</tr>
<tr>
<td valign="top"><em>[ND_NOMEM]</em></td>
<td valign="top">Not enough memory left.</td>
</tr>
<tr>
<td valign="top"><em>[ND_NO_RECOVERY]</em></td>
<td valign="top">An unrecoverable error has occurred.</td>
</tr>
<tr>
<td valign="top"><em>[ND_OPEN]</em></td>
<td valign="top">File could not be opened.</td>
</tr>
<tr>
<td valign="top"><em>[ND_SYSTEM]</em></td>
<td valign="top">A damaged object was encountered. The damaged object cannot be
used.
<p>The system detected an address that was not valid.</p>
</td>
</tr>
<tr>
<td valign="top"><em>[ND_TRY_AGAIN]</em></td>
<td valign="top">The local server did not receive a response from an
authoritative server. An attempt at a later time may succeed.</td>
</tr>
</table>
<br>
<br>
<h3>Error Messages</h3>
<table width="100%" cellpadding="5">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPF9872 E</td>
<td width="85%" valign="top">Program or service program &amp;1 in library
&amp;2 ended. Reason code &amp;3.</td>
</tr>
</table>
<br>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example shows how <strong>netdir_options()</strong> is
used:</p>
<pre>
#include &lt;netdir.h&gt;
#include &lt;rpc/rpc_com.h&gt; /* for RPC_ANYFD definition */
main()
{
void *handlep;
struct netconfig *nconf;
/* Initialize the network selection mechanism */
if (handlep = setnetconfig()) == (void *)NULL)
{
exit(1);
}
/* Get a netconfig structure from the netconfig file */
if ((nconf = getnetconfig(handlep)) == (struct netconf *)NULL)
{
printf(&quot;Unable to obtain a netconfig structure\n&quot;);
}
/* Set the protocol specific negotiation for broadcast */
if (netdir_options(nconf, ND_SET_BROADCAST, RPC_ANYFD, NULL))
{
printf(&quot;Error setting the broadcasting option\n&quot;);
}
/* Release the netconfig handle allocated by setnetconfig() */
endnetconfig(handlep);
}
</pre>
<br>
<hr>
API introduced: V4R2
<hr>
<table cellpadding="2" cellspacing="2" align="center">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"rpc1.htm">Remote Procedure Call (RPC) APIs</a> | <a href="aplist.htm">APIs by
category</a></td>
</tr>
</table>
</body>
</html>