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

396 lines
10 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>clnt_call()--Call a Remote Procedure Associated with the Client</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>clnt_call()--Call a Remote Procedure Associated with the Client</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<!-- iddvc RMBR -->
<br>
<pre>
#include &lt;rpc/rpc.h&gt;
enum clnt_stat clnt_call(CLIENT *<em>clnt</em>,
const u_long <em>procnum</em>,
const xdrproc_t <em>inproc</em>,
const caddr_t <em>in</em>,
const xdrproc_t <em>outproc</em>,
caddr_t <em>out</em>,
const struct timeval <em>tout</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>clnt_call()</strong> API calls the remote procedure that is
associated with the client handle pointed to by the <em>clnt</em>
parameter.</p>
<p>The caller of the <strong>clnt_call()</strong> API must pass a valid client
handle obtained from a successful call to the <strong>clnt_create()</strong>
API.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>clnt</strong> &nbsp;(Input)&nbsp;</dt>
<dd>A pointer to the client handle structure that results from calling a client
creation function that uses a Remote Procedure Call (RPC) such as the
<strong>clnt_create()</strong> API.<br>
<br>
</dd>
<dt><strong>procnum</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The procedure on the host machine.<br>
<br>
</dd>
<dt><strong>inproc</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The name of the XDR procedure that encodes the procedure parameters.<br>
<br>
</dd>
<dt><strong>in</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The address of the procedure arguments.<br>
<br>
</dd>
<dt><strong>outproc</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The name of the XDR procedure that decodes the procedure results.<br>
<br>
</dd>
<dt><strong>out</strong> &nbsp;(Output)&nbsp;</dt>
<dd>The address where results are placed.<br>
<br>
</dd>
<dt><strong>tout</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The time allowed for the server to respond.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>None</p>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em>RPC_SUCCESS (0)</em></td>
<td align="left" valign="top">Successful</td>
</tr>
<tr>
<td align="left" valign="top"><em>Non-zero value</em></td>
<td align="left" valign="top"><strong>clnt_call()</strong> was not
successful.</td>
</tr>
</table>
<br>
<br>
<h3>Error Conditions</h3>
<p>Upon failure, <strong>clnt_call()</strong> sets a private field in the
client handle. This field has a type 'struct rpc_err', and can be accessed by
the <strong>clnt_geterr()</strong> function.</p>
<p>The <em>re_status</em> field can be set to one of the following values:</p>
<table cellpadding="5">
<!-- cols="30 70" -->
<tr>
<td align="left" valign="top"><em>[RPC_AUTHERROR]</em></td>
<td align="left" valign="top">Authentication error. Server's response did not
pass authentication validation.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_CANTDECODERES]</em></td>
<td align="left" valign="top">The <em>outproc</em> XDR function has
failed.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_CANTENCODEARGS]</em></td>
<td align="left" valign="top">The <em>inproc</em> XDR function has failed.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_CANTRECV]</em></td>
<td align="left" valign="top">Failure in receiving result. RPC is unable to
receive server's response. The <em>re_errno</em> field is set to the value
returned from the failed call.
<table cellpadding="5">
<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>client</em> parameter is not valid or the file descriptor associated with
it is already closed or damaged.</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 the lower transport levels.</td>
</tr>
<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>[EOPNOTSUPP]</em></td>
<td align="left" valign="top">Operation is not supported. This value is set
when <em>client</em> is not valid or the file descriptor associated with it has
a limited capabilities.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EUNKNOWN]</em></td>
<td align="left" valign="top">Unknown system state.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_CANTSEND]</em></td>
<td align="left" valign="top">Failure in sending call. RPC is unable to send a
request. The <em>re_errno</em> field is set to the value returned from the
failed call.
<table cellpadding="5">
<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>client</em> parameter is not valid or the file descriptor associated with
it is already closed or damaged.</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 the lower transport levels.</td>
</tr>
<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>[EOPNOTSUPP]</em></td>
<td align="left" valign="top">Operation is not supported. This value is set
when <em>client</em> is not valid or the file descriptor associated with it has
a limited capabilities.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EUNKNOWN]</em></td>
<td align="left" valign="top">Unknown system state.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_FAILED]</em></td>
<td align="left" valign="top">The <em>tout</em> parameter is not set
properly.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_INTR]</em></td>
<td align="left" valign="top">Interrupted RPC call. An exception has occurred
in the RPC API. The <em>re_errno</em> field is set to EUNKNOWN.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_TIMEDOUT]</em></td>
<td align="left" valign="top">RPC call is timed out. The client cannot receive
a response in the specified timeout period.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_PROGVERSMISNATCH]</em></td>
<td align="left" valign="top">There are no registered versions for the
program.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_PROGNOTREGISTERED]</em></td>
<td align="left" valign="top">The program is not registered with the
server.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[RPC_PROGUNAVAIL]</em></td>
<td align="left" valign="top">The program is not registered with the
server.</td>
</tr>
</table>
<br>
<br>
<h3>Error Messages</h3>
<table width="100%" cellpadding="5">
<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">CPIA1B1 I</td>
<td width="85%" valign="top">A problem was encountered in the RPC client.</td>
</tr>
<tr>
<td align="left" valign="top">CPIA1B2 I</td>
<td align="left" valign="top">TI-RPC encountered a problem in the transport
protocol.</td>
</tr>
<tr>
<td align="left" valign="top">CPE3418 E</td>
<td align="left" valign="top">Possible APAR condition or hardware failure.</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="rpc_call.htm">rpc_call()--Call a Remote Procedure on the Specified
System</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>clnt_call()</strong> is used:</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;rpc/rpc.h&gt;
#include &lt;sys/time.h&gt;
main()
{
u_long procnum;
CLIENT *clnt;
enum clnt_stat cs;
struct rpc_err client_error;
struct timeval total_timeout;
int intsend, intrecv;
...
/* Call the remote procedure that is associated with client */
cs = <strong>clnt_call</strong>(clnt, procnum, xdr_int,
(caddr_t)&amp;intsend, xdr_int,
(caddr_t)&amp;intrecv, total_timeout);
if (cs != RPC_SUCCESS){
clnt_geterr(client,&amp;client_error);
...
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>