summaryrefslogtreecommitdiff
path: root/include/rpc/svc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rpc/svc.h')
-rw-r--r--include/rpc/svc.h142
1 files changed, 90 insertions, 52 deletions
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index a36a24ba0..4ac2a5cdf 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -6,23 +6,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -34,8 +34,13 @@
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
-#ifndef __SVC_HEADER__
-#define __SVC_HEADER__
+#ifndef _RPC_SVC_H
+#define _RPC_SVC_H 1
+
+#include <features.h>
+#include <rpc/rpc_msg.h>
+
+__BEGIN_DECLS
/*
* This interface must manage two items concerning remote procedure calling:
@@ -68,23 +73,31 @@ enum xprt_stat {
/*
* Server side transport handle
*/
-typedef struct {
- int xp_sock;
- u_short xp_port; /* associated port number */
- struct xp_ops {
- bool_t (*xp_recv)(); /* receive incomming requests */
- enum xprt_stat (*xp_stat)(); /* get transport status */
- bool_t (*xp_getargs)(); /* get arguments */
- bool_t (*xp_reply)(); /* send reply */
- bool_t (*xp_freeargs)();/* free mem allocated for args */
- void (*xp_destroy)(); /* destroy this struct */
- } *xp_ops;
- int xp_addrlen; /* length of remote address */
- struct sockaddr_in xp_raddr; /* remote address */
- struct opaque_auth xp_verf; /* raw response verifier */
- caddr_t xp_p1; /* private */
- caddr_t xp_p2; /* private */
-} SVCXPRT;
+typedef struct SVCXPRT SVCXPRT;
+struct SVCXPRT {
+ int xp_sock;
+ u_short xp_port; /* associated port number */
+ const struct xp_ops {
+ bool_t (*xp_recv) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+ /* receive incoming requests */
+ enum xprt_stat (*xp_stat) __PMT ((SVCXPRT *__xprt));
+ /* get transport status */
+ bool_t (*xp_getargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+ caddr_t args_ptr)); /* get arguments */
+ bool_t (*xp_reply) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
+ /* send reply */
+ bool_t (*xp_freeargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
+ caddr_t args_ptr));
+ /* free mem allocated for args */
+ void (*xp_destroy) __PMT ((SVCXPRT *__xprt));
+ /* destroy this struct */
+ } *xp_ops;
+ int xp_addrlen; /* length of remote address */
+ struct sockaddr_in xp_raddr; /* remote address */
+ struct opaque_auth xp_verf; /* raw response verifier */
+ caddr_t xp_p1; /* private */
+ caddr_t xp_p2; /* private */
+};
/*
* Approved way of getting address of caller
@@ -142,6 +155,10 @@ struct svc_req {
SVCXPRT *rq_xprt; /* associated transport */
};
+#ifndef __DISPATCH_FN_T
+#define __DISPATCH_FN_T
+typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
+#endif
/*
* Service registration
@@ -151,8 +168,11 @@ struct svc_req {
* u_long prog;
* u_long vers;
* void (*dispatch)();
- * int protocol; */ /* like TCP or UDP, zero means do not register*/
-extern bool_t svc_register();
+ * u_long protocol; like TCP or UDP, zero means do not register
+ */
+extern bool_t svc_register __P ((SVCXPRT *__xprt, u_long __prog,
+ u_long __vers, __dispatch_fn_t __dispatch,
+ u_long __protocol));
/*
* Service un-registration
@@ -161,7 +181,7 @@ extern bool_t svc_register();
* u_long prog;
* u_long vers;
*/
-extern void svc_unregister();
+extern void svc_unregister __P ((u_long __prog, u_long __vers));
/*
* Transport registration.
@@ -169,7 +189,7 @@ extern void svc_unregister();
* xprt_register(xprt)
* SVCXPRT *xprt;
*/
-extern void xprt_register();
+extern void xprt_register __P ((SVCXPRT *__xprt));
/*
* Transport un-register
@@ -177,7 +197,7 @@ extern void xprt_register();
* xprt_unregister(xprt)
* SVCXPRT *xprt;
*/
-extern void xprt_unregister();
+extern void xprt_unregister __P ((SVCXPRT *__xprt));
@@ -185,7 +205,7 @@ extern void xprt_unregister();
/*
* When the service routine is called, it must first check to see if it
* knows about the procedure; if not, it should call svcerr_noproc
- * and return. If so, it should deserialize its arguments via
+ * and return. If so, it should deserialize its arguments via
* SVC_GETARGS (defined above). If the deserialization does not work,
* svcerr_decode should be called followed by a return. Successful
* decoding of the arguments should be followed the execution of the
@@ -196,7 +216,7 @@ extern void xprt_unregister();
* Note: do not confuse access-control failure with weak authentication!
*
* NB: In pure implementations of rpc, the caller always waits for a reply
- * msg. This message is sent when svc_sendreply is called.
+ * msg. This message is sent when svc_sendreply is called.
* Therefore pure service implementations should always call
* svc_sendreply even if the function logically returns void; use
* xdr.h - xdr_void for the xdr routine. HOWEVER, tcp based rpc allows
@@ -208,21 +228,30 @@ extern void xprt_unregister();
* deadlock the caller and server processes!
*/
-extern bool_t svc_sendreply();
-extern void svcerr_decode();
-extern void svcerr_weakauth();
-extern void svcerr_noproc();
-extern void svcerr_progvers();
-extern void svcerr_auth();
-extern void svcerr_noprog();
-extern void svcerr_systemerr();
-
+extern bool_t svc_sendreply __P ((SVCXPRT *xprt, xdrproc_t __xdr_results,
+ caddr_t __xdr_location));
+
+extern void svcerr_decode __P ((SVCXPRT *__xprt));
+
+extern void svcerr_weakauth __P ((SVCXPRT *__xprt));
+
+extern void svcerr_noproc __P ((SVCXPRT *__xprt));
+
+extern void svcerr_progvers __P ((SVCXPRT *__xprt, u_long __low_vers,
+ u_long __high_vers));
+
+extern void svcerr_auth __P ((SVCXPRT *__xprt, enum auth_stat __why));
+
+extern void svcerr_noprog __P ((SVCXPRT *__xprt));
+
+extern void svcerr_systemerr __P ((SVCXPRT *__xprt));
+
/*
* Lowest level dispatching -OR- who owns this process anyway.
* Somebody has to wait for incoming requests and then call the correct
* service routine. The routine svc_run does infinite waiting; i.e.,
* svc_run never returns.
- * Since another (co-existant) package may wish to selectively wait for
+ * Since another (coexistent) package may wish to selectively wait for
* incoming calls or other events outside of the rpc architecture, the
* routine svc_getreq is provided. It must be passed readfds, the
* "in-place" results of a select system call (see select, section 2).
@@ -230,7 +259,7 @@ extern void svcerr_systemerr();
/*
* Global keeper of rpc service descriptors in use
- * dynamic; must be inspected before each call to select
+ * dynamic; must be inspected before each call to select
*/
#ifdef FD_SETSIZE
extern fd_set svc_fdset;
@@ -243,11 +272,10 @@ extern int svc_fds;
* a small program implemented by the svc_rpc implementation itself;
* also see clnt.h for protocol numbers.
*/
-extern void rpctest_service();
-
-extern void svc_getreq();
-extern void svc_getreqset(); /* takes fdset instead of int */
-extern void svc_run(); /* never returns */
+extern void svc_getreq __P ((int __rdfds));
+extern void svc_getreqset __P ((fd_set *__readfds));
+extern void svc_exit __P ((void));
+extern void svc_run __P ((void));
/*
* Socket to use on svcxxx_create call to get default socket
@@ -261,19 +289,29 @@ extern void svc_run(); /* never returns */
/*
* Memory based rpc for testing and timing.
*/
-extern SVCXPRT *svcraw_create();
+extern SVCXPRT *svcraw_create __P ((void));
/*
* Udp based rpc.
*/
-extern SVCXPRT *svcudp_create();
-extern SVCXPRT *svcudp_bufcreate();
+extern SVCXPRT *svcudp_create __P ((int __sock));
+extern SVCXPRT *svcudp_bufcreate __P ((int __sock, u_int __sendsz,
+ u_int __recvsz));
/*
* Tcp based rpc.
*/
-extern SVCXPRT *svctcp_create();
+extern SVCXPRT *svctcp_create __P ((int __sock, u_int __sendsize,
+ u_int __recvsize));
+
+
+/*
+ * Unix based rpc.
+ */
+extern SVCXPRT *svcunix_create __P ((int __sock, u_int __sendsize,
+ u_int __recvsize, char *__path));
+__END_DECLS
-#endif !__SVC_HEADER__
+#endif /* rpc/svc.h */