From df49c60c9671e4a28e636964d744c1f59fb6cb68 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 12 Jun 2000 15:00:15 +0000 Subject: Merged from 4.5.0-beta3a --- c/src/exec/librpc/include/rpc/svc.h | 153 ++++++++++++++++++++++-------------- 1 file changed, 93 insertions(+), 60 deletions(-) (limited to 'c/src/exec/librpc/include/rpc/svc.h') diff --git a/c/src/exec/librpc/include/rpc/svc.h b/c/src/exec/librpc/include/rpc/svc.h index c576b5538b..e57a7454be 100644 --- a/c/src/exec/librpc/include/rpc/svc.h +++ b/c/src/exec/librpc/include/rpc/svc.h @@ -1,8 +1,3 @@ - -#ifndef RPC_SVC_H -#define RPC_SVC_H - -/* @(#)svc.h 2.2 88/07/29 4.0 RPCSRC; from 1.20 88/02/08 SMI */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -10,26 +5,30 @@ * 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 + * WARRANTIES OF DESIGN, MERCHANTABILITY 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 + * + * from: @(#)svc.h 1.20 88/02/08 SMI + * from: @(#)svc.h 2.2 88/07/29 4.0 RPCSRC + * $FreeBSD: src/include/rpc/svc.h,v 1.16 1999/12/29 05:00:43 peter Exp $ */ /* @@ -38,8 +37,9 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef __SVC_HEADER__ -#define __SVC_HEADER__ +#ifndef _RPC_SVC_H +#define _RPC_SVC_H +#include /* * This interface must manage two items concerning remote procedure calling: @@ -69,19 +69,31 @@ enum xprt_stat { XPRT_IDLE }; +struct rpc_msg; + /* * Server side transport handle */ -typedef struct { +typedef struct __rpc_svcxprt { 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 */ + /* receive incoming requests */ + bool_t (*xp_recv) __P((struct __rpc_svcxprt *, + struct rpc_msg *)); + /* get transport status */ + enum xprt_stat (*xp_stat) __P((struct __rpc_svcxprt *)); + /* get arguments */ + bool_t (*xp_getargs) __P((struct __rpc_svcxprt *, xdrproc_t, + caddr_t)); + /* send reply */ + bool_t (*xp_reply) __P((struct __rpc_svcxprt *, + struct rpc_msg *)); + /* free mem allocated for args */ + bool_t (*xp_freeargs) __P((struct __rpc_svcxprt *, xdrproc_t, + caddr_t)); + /* destroy this struct */ + void (*xp_destroy) __P((struct __rpc_svcxprt *)); } *xp_ops; int xp_addrlen; /* length of remote address */ struct sockaddr_in xp_raddr; /* remote address */ @@ -138,9 +150,9 @@ typedef struct { * Service request */ struct svc_req { - u_long rq_prog; /* service program number */ - u_long rq_vers; /* service protocol version */ - u_long rq_proc; /* the desired procedure */ + u_int32_t rq_prog; /* service program number */ + u_int32_t rq_vers; /* service protocol version */ + u_int32_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ caddr_t rq_clntcred; /* read only cooked cred */ SVCXPRT *rq_xprt; /* associated transport */ @@ -155,9 +167,12 @@ struct svc_req { * u_long prog; * u_long vers; * void (*dispatch)(); - * int protocol; (like TCP or UDP, zero means do not register) + * int protocol; (like TCP or UDP, zero means do not register) */ -extern bool_t svc_register(); +__BEGIN_DECLS +extern bool_t svc_register __P((SVCXPRT *, u_long, u_long, + void (*) __P((struct svc_req *, SVCXPRT *)), int)); +__END_DECLS /* * Service un-registration @@ -166,7 +181,9 @@ extern bool_t svc_register(); * u_long prog; * u_long vers; */ -extern void svc_unregister(); +__BEGIN_DECLS +extern void svc_unregister __P((u_long, u_long)); +__END_DECLS /* * Transport registration. @@ -174,7 +191,9 @@ extern void svc_unregister(); * xprt_register(xprt) * SVCXPRT *xprt; */ -extern void xprt_register(); +__BEGIN_DECLS +extern void xprt_register __P((SVCXPRT *)); +__END_DECLS /* * Transport un-register @@ -182,7 +201,9 @@ extern void xprt_register(); * xprt_unregister(xprt) * SVCXPRT *xprt; */ -extern void xprt_unregister(); +__BEGIN_DECLS +extern void xprt_unregister __P((SVCXPRT *)); +__END_DECLS @@ -190,7 +211,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 @@ -201,7 +222,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 @@ -213,15 +234,17 @@ 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(); - +__BEGIN_DECLS +extern bool_t svc_sendreply __P((SVCXPRT *, xdrproc_t, char *)); +extern void svcerr_decode __P((SVCXPRT *)); +extern void svcerr_weakauth __P((SVCXPRT *)); +extern void svcerr_noproc __P((SVCXPRT *)); +extern void svcerr_progvers __P((SVCXPRT *, u_long, u_long)); +extern void svcerr_auth __P((SVCXPRT *, enum auth_stat)); +extern void svcerr_noprog __P((SVCXPRT *)); +extern void svcerr_systemerr __P((SVCXPRT *)); +__END_DECLS + /* * Lowest level dispatching -OR- who owns this process anyway. * Somebody has to wait for incoming requests and then call the correct @@ -235,24 +258,26 @@ 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 int svc_maxfd; extern fd_set svc_fdset; #define svc_fds svc_fdset.fds_bits[0] /* compatibility */ -#else -extern int svc_fds; -#endif /* def FD_SETSIZE */ +#ifndef _KERNEL /* * a small program implemented by the svc_rpc implementation itself; * also see clnt.h for protocol numbers. */ extern void rpctest_service(); +#endif -extern void svc_getreq(); -extern void svc_getreqset(); /* takes fdset instead of int */ -extern void svc_run(); /* never returns */ +__BEGIN_DECLS +extern void svc_getreq __P((int)); +extern void svc_getreqset __P((fd_set *)); +extern void svc_getreqset2 __P((fd_set *, int)); /* XXX: nonstd, undoc */ +extern void svc_run __P((void)); +__END_DECLS /* * Socket to use on svcxxx_create call to get default socket @@ -266,26 +291,34 @@ extern void svc_run(); /* never returns */ /* * Memory based rpc for testing and timing. */ -extern SVCXPRT *svcraw_create(); +__BEGIN_DECLS +extern SVCXPRT *svcraw_create __P((void)); +__END_DECLS + /* * Udp based rpc. */ -extern SVCXPRT *svcudp_create(); -extern SVCXPRT *svcudp_bufcreate(); -extern int svcudp_enablecache(SVCXPRT *transp, u_long size); +__BEGIN_DECLS +extern SVCXPRT *svcudp_create __P((int)); +extern SVCXPRT *svcudp_bufcreate __P((int, u_int, u_int)); +__END_DECLS + /* * Tcp based rpc. */ -extern SVCXPRT *svctcp_create(); - +__BEGIN_DECLS +extern SVCXPRT *svctcp_create __P((int, u_int, u_int)); +extern SVCXPRT *svcfd_create __P((int, u_int, u_int)); +__END_DECLS +/* + * AF_UNIX socket based rpc. + */ +__BEGIN_DECLS +extern SVCXPRT *svcunix_create __P((int, u_int, u_int, char *)); +extern SVCXPRT *svcunixfd_create __P((int, u_int, u_int)); +__END_DECLS -#endif /* !__SVC_HEADER__ */ - -extern int _rpcsvccount; -extern int _rpcsvcstate; -extern int _SERVED; - -#endif /* RPC_SVC_H */ +#endif /* !_RPC_SVC_H */ -- cgit v1.2.3