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

305 lines
7.5 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>svc_tli_create()--Create a Server Handle</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 ========================================== -->
<!-- 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>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>svc_tli_create()--Create a Server Handle</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<!-- iddvc RMBR -->
<br>
<pre>
#include &lt;rpc/rpc.h&gt;
#include &lt;netconfig.h&gt;
SVCXPRT svc_tli_create(const int <em>fildes</em>,
const struct netconfig
*<em>netconf</em>,
const struct t_bind
*<em>bindaddr</em>,
const u_int <em>sendsz</em>,
const u_int <em>recvsz</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>svc_tli_create()</strong> function creates an RPC server
handle.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>fildes</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The file descriptor on which the service is listening. The only permitted
value for a user application is RPC_ANYFD. If the file descriptor
<em>fildes</em> is RPC_ANYFD, it opens a file descriptor on the transport
specified by <em>netconf</em>.<br>
<br>
</dd>
<dt><strong>netconf</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The transport protocol.<br>
<br>
</dd>
<dt><strong>bindaddr</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The address where <em>fildes</em> is bound if it is unbound.<br>
<br>
</dd>
<dt><strong>sendsz</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The size of the send buffer. When a value of zero is specified, a suitable
default value will be chosen by the system.<br>
<br>
</dd>
<dt><strong>recvsz</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The size of the receive buffer. When a value of zero is specified, a
suitable default value will be chosen by the system.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em>xprt</em></td>
<td align="left" valign="top">Upon successful completion, this function returns
a pointer to the created RPC server handle.</td>
</tr>
<tr>
<td align="left" valign="top"><em>NULL</em></td>
<td align="left" valign="top"><strong>svc_tli_create()</strong> was not
successful. The <em>errno</em> variable is set to indicate the reason.</td>
</tr>
</table>
<br>
<br>
<h3>Error Conditions</h3>
<table cellpadding="5">
<!-- cols="25 75" -->
<tr>
<td align="left" valign="top"><em>[ENOMEM]</em></td>
<td align="left" valign="top">Out of memory.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EUNKNOWN]</em></td>
<td align="left" valign="top">Unknown system state.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EADDRNOTAVAIL]</em></td>
<td align="left" valign="top">Address not available. This value is set when
<em>bindaddr</em> is rejected by the transport layer.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EIO]</em></td>
<td align="left" valign="top">Input/output error. This value is set as a result
of network transport failure. It indicates that RPC cannot handle an error that
occurred in lower transport levels.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EACCES]</em></td>
<td align="left" valign="top">Permission denied.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EBADF]</em></td>
<td align="left" valign="top">Bad file descriptor. This value is set when the
<em>fildes</em> parameter is <em>not valid</em> or cannot be used as a
transport endpoint.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EFAULT]</em></td>
<td align="left" valign="top">The address used for a <em>bindaddr</em> was not
available.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOBUFS]</em></td>
<td align="left" valign="top">There is not enough buffer space available for
the API.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EINVAL]</em></td>
<td align="left" valign="top">An invalid value was supplied for the input
parameter <em>nconf</em>.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EADDRINUSE]</em></td>
<td align="left" valign="top">Local address is in use. This value is set when
<em>fildes</em> cannot be bound to any local address.</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">CPIA1B2 I</td>
<td width="85%" valign="top">TI-RPC encountered a problem in the transport
protocol.</td>
</tr>
<tr>
<td align="left" valign="top">CPIA1B3 I</td>
<td align="left" valign="top">TI-RPC encountered a problem in the server.</td>
</tr>
<tr>
<td align="left" valign="top">CPF3CF2 E</td>
<td align="left" valign="top">Error(s) occurred during running of &amp;1
API.</td>
</tr>
<tr>
<td align="left" valign="top">CPF9872 E</td>
<td align="left" valign="top">Program or service program &amp;1 in library
&amp;2 ended. Reason code &amp;3.</td>
</tr>
</table>
<br>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="svc_create.htm">svc_create()--Create a Server Handle</a></li>
<li><a href="svc_tp_create.htm">svc_tp_create()--Create a Server
Handle</a></li>
</ul>
<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>svc_tli_create</strong> is used:</p>
<pre>
/* Define remote program number and version */
#define RMTPROGNUM (u_long)0x3fffffffL
#define RMTPROGVER (u_long)0x1
#include &lt;stdio.h&gt;
#include &lt;rpc/rpc.h&gt;
#include &lt;netconfig.h&gt;
main()
{
SVCXPRT *svc;
struct netconfig *nconf;
int fd;
...
/* Returns a pointer to nconf corresponding to UDP */
if ((nconf = getnetconfigent(&quot;UDP&quot;)) ==
(struct netconfig *)NULL) {
fprintf(stderr, &quot;Cannot get netconfig entry for UDP\n&quot;);
exit(1);
}
...
svc = <strong>svc_tli_create</strong>(RPC_ANYFD,nconf,
(struct t_bind *)NULL,
0, 0);
if (svc == (SVCXPRT *)NULL){
fprintf(stderr, &quot;<strong>svc_tli_create</strong> failed!!\n&quot;);
exit(1);
}
...
}
</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>