summaryrefslogtreecommitdiffstats
path: root/include/rpc/svc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rpc/svc.h')
-rw-r--r--include/rpc/svc.h217
1 files changed, 156 insertions, 61 deletions
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index 9ef76cf..dc03f59 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -1,3 +1,5 @@
+/* $NetBSD: svc.h,v 1.17 2000/06/02 22:57:56 fvdl Exp $ */
+
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -26,15 +28,15 @@
* 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
+ * from: @(#)svc.h 1.35 88/12/17 SMI
+ * from: @(#)svc.h 1.27 94/04/25 SMI
* $FreeBSD$
*/
/*
* svc.h, Server-side remote procedure call interface.
*
- * Copyright (C) 1984, Sun Microsystems, Inc.
+ * Copyright (C) 1986-1993 by Sun Microsystems, Inc.
*/
#ifndef _RPC_SVC_H
@@ -63,21 +65,26 @@
* parameters, struct svc_req * and SVCXPRT *, defined below.
*/
+/*
+ * Service control requests
+ */
+#define SVCGET_VERSQUIET 1
+#define SVCSET_VERSQUIET 2
+
+
enum xprt_stat {
XPRT_DIED,
XPRT_MOREREQS,
XPRT_IDLE
};
-struct rpc_msg;
-
/*
* Server side transport handle
*/
typedef struct __rpc_svcxprt {
- int xp_sock;
+ int xp_fd;
u_short xp_port; /* associated port number */
- struct xp_ops {
+ const struct xp_ops {
/* receive incoming requests */
bool_t (*xp_recv) __P((struct __rpc_svcxprt *,
struct rpc_msg *));
@@ -96,16 +103,45 @@ typedef struct __rpc_svcxprt {
void (*xp_destroy) __P((struct __rpc_svcxprt *));
} *xp_ops;
int xp_addrlen; /* length of remote address */
- struct sockaddr_in xp_raddr; /* remote address */
+ struct sockaddr_in xp_raddr; /* remote addr. (backward ABI compat) */
+ /* XXX - fvdl stick this here for ABI backward compat reasons */
+ const struct xp_ops2 {
+ /* catch-all function */
+ bool_t (*xp_control) __P((struct __rpc_svcxprt *, const u_int,
+ void *));
+ } *xp_ops2;
+ char *xp_tp; /* transport provider device name */
+ char *xp_netid; /* network token */
+ struct netbuf xp_ltaddr; /* local transport address */
+ struct netbuf xp_rtaddr; /* remote transport address */
struct opaque_auth xp_verf; /* raw response verifier */
- caddr_t xp_p1; /* private */
- caddr_t xp_p2; /* private */
+ void *xp_p1; /* private: for use by svc ops */
+ void *xp_p2; /* private: for use by svc ops */
+ void *xp_p3; /* private: for use by svc lib */
+ int xp_type; /* transport type */
} SVCXPRT;
/*
+ * Service request
+ */
+struct svc_req {
+ 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 */
+ void *rq_clntcred; /* read only cooked cred */
+ SVCXPRT *rq_xprt; /* associated transport */
+};
+
+/*
* Approved way of getting address of caller
*/
-#define svc_getcaller(x) (&(x)->xp_raddr)
+#define svc_getrpccaller(x) (&(x)->xp_rtaddr)
+
+/*
+ * FreeBSD-only definition to get the creds of the caller (AF_LOCAL).
+ */
+#define __svc_getcallercreds(x) ((struct cmsgcred *)(x)->xp_p2)
/*
* Operations defined on an SVCXPRT handle
@@ -145,44 +181,36 @@ typedef struct __rpc_svcxprt {
#define svc_destroy(xprt) \
(*(xprt)->xp_ops->xp_destroy)(xprt)
-
-/*
- * Service request
- */
-struct svc_req {
- 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 */
-};
-
+#define SVC_CONTROL(xprt, rq, in) \
+ (*(xprt)->xp_ops2->xp_control)((xprt), (rq), (in))
/*
* Service registration
*
- * svc_register(xprt, prog, vers, dispatch, protocol)
- * SVCXPRT *xprt;
- * u_long prog;
- * u_long vers;
- * void (*dispatch)();
- * int protocol; (like TCP or UDP, zero means do not register)
+ * svc_reg(xprt, prog, vers, dispatch, nconf)
+ * const SVCXPRT *xprt;
+ * const rpcprog_t prog;
+ * const rpcvers_t vers;
+ * const void (*dispatch)();
+ * const struct netconfig *nconf;
*/
+
__BEGIN_DECLS
-extern bool_t svc_register __P((SVCXPRT *, u_long, u_long,
- void (*) __P((struct svc_req *, SVCXPRT *)), int));
+extern bool_t svc_reg __P((SVCXPRT *, const rpcprog_t, const rpcvers_t,
+ void (*) __P((struct svc_req *, SVCXPRT *)),
+ const struct netconfig *));
__END_DECLS
/*
* Service un-registration
*
- * svc_unregister(prog, vers)
- * u_long prog;
- * u_long vers;
+ * svc_unreg(prog, vers)
+ * const rpcprog_t prog;
+ * const rpcvers_t vers;
*/
+
__BEGIN_DECLS
-extern void svc_unregister __P((u_long, u_long));
+extern void svc_unreg __P((const rpcprog_t, const rpcvers_t));
__END_DECLS
/*
@@ -206,8 +234,6 @@ extern void xprt_unregister __P((SVCXPRT *));
__END_DECLS
-
-
/*
* 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
@@ -239,10 +265,13 @@ 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_progvers __P((SVCXPRT *, rpcvers_t, rpcvers_t));
extern void svcerr_auth __P((SVCXPRT *, enum auth_stat));
extern void svcerr_noprog __P((SVCXPRT *));
extern void svcerr_systemerr __P((SVCXPRT *));
+extern int rpc_reg __P((rpcprog_t, rpcvers_t, rpcproc_t,
+ char *(*) __P((char *)), xdrproc_t, xdrproc_t,
+ char *));
__END_DECLS
/*
@@ -261,64 +290,130 @@ __END_DECLS
* dynamic; must be inspected before each call to select
*/
extern int svc_maxfd;
+#ifdef FD_SETSIZE
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
+__BEGIN_DECLS
+extern void rpctest_service __P((void));
+__END_DECLS
__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_getreq_common __P((int));
+struct pollfd;
+extern void svc_getreq_poll __P((struct pollfd *, int));
+
extern void svc_run __P((void));
+extern void svc_exit __P((void));
__END_DECLS
/*
* Socket to use on svcxxx_create call to get default socket
*/
#define RPC_ANYSOCK -1
+#define RPC_ANYFD RPC_ANYSOCK
/*
* These are the existing service side transport implementations
*/
+__BEGIN_DECLS
/*
- * Memory based rpc for testing and timing.
+ * Transport independent svc_create routine.
+ */
+extern int svc_create __P((void (*) __P((struct svc_req *, SVCXPRT *)),
+ const rpcprog_t, const rpcvers_t, const char *));
+/*
+ * void (*dispatch)(); -- dispatch routine
+ * const rpcprog_t prognum; -- program number
+ * const rpcvers_t versnum; -- version number
+ * const char *nettype; -- network type
*/
-__BEGIN_DECLS
-extern SVCXPRT *svcraw_create __P((void));
-__END_DECLS
/*
- * Udp based rpc.
+ * Generic server creation routine. It takes a netconfig structure
+ * instead of a nettype.
*/
-__BEGIN_DECLS
-extern SVCXPRT *svcudp_create __P((int));
-extern SVCXPRT *svcudp_bufcreate __P((int, u_int, u_int));
-__END_DECLS
+
+extern SVCXPRT *svc_tp_create __P((void (*) __P((struct svc_req *, SVCXPRT *)),
+ const rpcprog_t, const rpcvers_t,
+ const struct netconfig *));
+ /*
+ * void (*dispatch)(); -- dispatch routine
+ * const rpcprog_t prognum; -- program number
+ * const rpcvers_t versnum; -- version number
+ * const struct netconfig *nconf; -- netconfig structure
+ */
/*
- * Tcp based rpc.
+ * Generic TLI create routine
+ */
+extern SVCXPRT *svc_tli_create __P((const int, const struct netconfig *,
+ const struct t_bind *, const u_int,
+ const u_int));
+/*
+ * const int fd; -- connection end point
+ * const struct netconfig *nconf; -- netconfig structure for network
+ * const struct t_bind *bindaddr; -- local bind address
+ * const u_int sendsz; -- max sendsize
+ * const u_int recvsz; -- max recvsize
*/
-__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.
+ * Connectionless and connectionful create routines
*/
-__BEGIN_DECLS
-extern SVCXPRT *svcunix_create __P((int, u_int, u_int, char *));
-extern SVCXPRT *svcunixfd_create __P((int, u_int, u_int));
+
+extern SVCXPRT *svc_vc_create __P((const int, const u_int, const u_int));
+/*
+ * const int fd; -- open connection end point
+ * const u_int sendsize; -- max send size
+ * const u_int recvsize; -- max recv size
+ */
+
+extern SVCXPRT *svc_dg_create __P((const int, const u_int, const u_int));
+ /*
+ * const int fd; -- open connection
+ * const u_int sendsize; -- max send size
+ * const u_int recvsize; -- max recv size
+ */
+
+
+/*
+ * the routine takes any *open* connection
+ * descriptor as its first input and is used for open connections.
+ */
+extern SVCXPRT *svc_fd_create __P((const int, const u_int, const u_int));
+/*
+ * const int fd; -- open connection end point
+ * const u_int sendsize; -- max send size
+ * const u_int recvsize; -- max recv size
+ */
+
+/*
+ * Memory based rpc (for speed check and testing)
+ */
+extern SVCXPRT *svc_raw_create __P((void));
+
+/*
+ * svc_dg_enable_cache() enables the cache on dg transports.
+ */
+int svc_dg_enablecache __P((SVCXPRT *, const u_int));
+
__END_DECLS
+
+/* for backward compatibility */
+#include <rpc/svc_soc.h>
+
#endif /* !_RPC_SVC_H */
OpenPOWER on IntegriCloud