283 lines
7.0 KiB
HTML
283 lines
7.0 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_reg()--Associate Program and Version with Dispatch</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 -->
|
|
<!--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 language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
|
</script>
|
|
|
|
<h2>svc_reg()--Associate Program and Version with Dispatch</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
<pre>
|
|
#include <rpc/rpc.h>
|
|
#include <netconfig.h>
|
|
|
|
bool_t svc_reg(const SVCXPRT *<em>xprt</em>,
|
|
const u_long <em>prognum</em>,
|
|
const u_long <em>versnum</em>,
|
|
const void (*dispatch)(const svc_req *,
|
|
const SVCXPRT *),
|
|
const struct netconfig *<em>netconf</em>);
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QZNFTRPC<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: No<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>svc_reg()</strong> API associates <em>prognum</em> and
|
|
<em>versnum</em> with the service dispatch procedure <em>dispatch</em>. If
|
|
<em>netconf</em> is NULL, the service is not registered with the RPC service
|
|
package (RPCBind). If <em>netconf</em> is non-null, then a mapping of the
|
|
triple (<em>prognum, versnum, netconf->nc_netid</em>) to
|
|
<em>xprt->xp_ltaddr</em> is established with the local RPCBind service.</p>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong>xprt</strong> (I/O) </dt>
|
|
|
|
<dd>A pointer to a Remote Procedure Call (RPC) service transport handle.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>prognum</strong> (Input) </dt>
|
|
|
|
<dd>The program number of the remote program.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>versnum</strong> (Input) </dt>
|
|
|
|
<dd>The version number of the remote program.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>dispatch</strong> (Input) </dt>
|
|
|
|
<dd>The server dispatch function.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>netconf</strong> (Input) </dt>
|
|
|
|
<dd>The transport protocol.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Authorities</h3>
|
|
|
|
<p>The caller of the <strong>svc_reg()</strong> API must have execute (*X)
|
|
authority to the /etc directory and must have read (*R) authority to the
|
|
netconfig file.</p>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Return Value</h3>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>TRUE (1)</em></td>
|
|
<td align="left" valign="top"><strong>svc_reg()</strong> was successful.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>FALSE (0)</em></td>
|
|
<td align="left" valign="top"><strong>svc_reg()</strong> was not successful.
|
|
The <em>errno</em> variable is set to indicate the reason.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
|
|
|
|
<h3>Error Conditions</h3>
|
|
|
|
<p>This API calls the <strong>setnetconfig()</strong> and
|
|
<strong>getnetconfig()</strong> functions in order to perform its task. The API
|
|
inherits all error conditions from those functions. It also calls
|
|
<strong>rpcb_set()</strong> for registering in RPCBind inheriting all error
|
|
conditions from the API, except RPC_UNKNOWNPROTO.</p>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>[EINVAL]</em></td>
|
|
<td align="left" valign="top">Attempt to register a dispatcher with prognum and
|
|
versnum, which are already used by another dispatcher.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>[EALREADY]</em></td>
|
|
<td align="left" valign="top">Attempting to register a service which is already
|
|
registered.</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">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">CPIA1B8 I</td>
|
|
<td align="left" valign="top">A problem occurred while trying to contact the
|
|
RPCBind daemon.</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 &1
|
|
API.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPF9872 E</td>
|
|
<td align="left" valign="top">Program or service program &1 in library
|
|
&2 ended. Reason code &3.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPIA1B2 I</td>
|
|
<td align="left" valign="top">TI-RPC encountered a problem with the transport
|
|
protocol.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPIA1B8 I</td>
|
|
<td align="left" valign="top">A problem occurred while trying to contact the
|
|
RPCBind daemon.</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>svc_reg()</strong> is used:</p>
|
|
|
|
<pre>
|
|
/* Define remote program number and version */
|
|
#define RMTPROGNUM (u_long)0x3fffffffL
|
|
#define RMTPROGVER (u_long)0x1
|
|
|
|
#include <stdio.h>
|
|
#include <rpc/rpc.h>
|
|
#include <netconfig.h>
|
|
|
|
static void exm_proc();
|
|
|
|
main()
|
|
{
|
|
SVCXPRT *xprt;
|
|
struct netconfig *nconf;
|
|
int result;
|
|
|
|
...
|
|
/* Returns a pointer to nconf corresponding to NETCONF */
|
|
if ((nconf = getnetconfigent("UDP")) ==
|
|
(struct netconfig *)NULL) {
|
|
fprintf(stderr, "Cannot get netconfig entry for UDP\n");
|
|
exit(1);
|
|
}
|
|
|
|
...
|
|
|
|
result = <strong>svc_reg</strong>(xprt, RMTPROGNUM, RMTPROGVER,
|
|
exm_proc, nconf);
|
|
if ( !result){
|
|
fprintf(stderr, "<strong>svc_reg</strong> failed!!\n");
|
|
exit(1);
|
|
}
|
|
...
|
|
}
|
|
|
|
/* The server dispatch function */
|
|
static void exm_proc(struct svc_req *rqstp, SVCXPRT *transp)
|
|
{
|
|
|
|
...
|
|
|
|
}
|
|
</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>
|
|
|