Home | History | Annotate | Line # | Download | only in rpc
clnt.h revision 1.14
      1  1.14      fvdl /*	$NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $	*/
      2   1.4       cgd 
      3   1.1   deraadt /*
      4   1.1   deraadt  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
      5   1.1   deraadt  * unrestricted use provided that this legend is included on all tape
      6   1.1   deraadt  * media and as a part of the software program in whole or part.  Users
      7   1.1   deraadt  * may copy or modify Sun RPC without charge, but are not authorized
      8   1.1   deraadt  * to license or distribute it to anyone else except as part of a product or
      9   1.1   deraadt  * program developed by the user.
     10   1.1   deraadt  *
     11   1.1   deraadt  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
     12   1.1   deraadt  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
     13   1.1   deraadt  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
     14   1.1   deraadt  *
     15   1.1   deraadt  * Sun RPC is provided with no support and without any obligation on the
     16   1.1   deraadt  * part of Sun Microsystems, Inc. to assist in its use, correction,
     17   1.1   deraadt  * modification or enhancement.
     18   1.1   deraadt  *
     19   1.1   deraadt  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
     20   1.1   deraadt  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
     21   1.1   deraadt  * OR ANY PART THEREOF.
     22   1.1   deraadt  *
     23   1.1   deraadt  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
     24   1.1   deraadt  * or profits or other special, indirect and consequential damages, even if
     25   1.1   deraadt  * Sun has been advised of the possibility of such damages.
     26   1.1   deraadt  *
     27   1.1   deraadt  * Sun Microsystems, Inc.
     28   1.1   deraadt  * 2550 Garcia Avenue
     29   1.1   deraadt  * Mountain View, California  94043
     30   1.3   mycroft  *
     31  1.14      fvdl  *	from: @(#)clnt.h 1.31 94/04/29 SMI
     32   1.4       cgd  *	@(#)clnt.h	2.1 88/07/29 4.0 RPCSRC
     33   1.1   deraadt  */
     34   1.1   deraadt 
     35   1.1   deraadt /*
     36   1.1   deraadt  * clnt.h - Client side remote procedure call interface.
     37   1.1   deraadt  *
     38   1.1   deraadt  * Copyright (C) 1984, Sun Microsystems, Inc.
     39   1.1   deraadt  */
     40   1.1   deraadt 
     41   1.2    brezak #ifndef _RPC_CLNT_H_
     42   1.2    brezak #define _RPC_CLNT_H_
     43   1.2    brezak #include <sys/cdefs.h>
     44   1.1   deraadt 
     45   1.1   deraadt /*
     46  1.14      fvdl  * Well-known IPV6 RPC broadcast address.
     47  1.14      fvdl  */
     48  1.14      fvdl #define RPCB_MULTICAST_ADDR "ff02::202"
     49  1.14      fvdl 
     50  1.14      fvdl /*
     51  1.10     lukem  * Rpc calls return an enum clnt_stat.  This should be looked at more,
     52   1.1   deraadt  * since each implementation is required to live with this (implementation
     53   1.1   deraadt  * independent) list of errors.
     54   1.1   deraadt  */
     55   1.1   deraadt enum clnt_stat {
     56   1.1   deraadt 	RPC_SUCCESS=0,			/* call succeeded */
     57   1.1   deraadt 	/*
     58   1.1   deraadt 	 * local errors
     59   1.1   deraadt 	 */
     60   1.1   deraadt 	RPC_CANTENCODEARGS=1,		/* can't encode arguments */
     61   1.1   deraadt 	RPC_CANTDECODERES=2,		/* can't decode results */
     62   1.1   deraadt 	RPC_CANTSEND=3,			/* failure in sending call */
     63   1.1   deraadt 	RPC_CANTRECV=4,			/* failure in receiving result */
     64   1.1   deraadt 	RPC_TIMEDOUT=5,			/* call timed out */
     65   1.1   deraadt 	/*
     66   1.1   deraadt 	 * remote errors
     67   1.1   deraadt 	 */
     68  1.10     lukem 	RPC_VERSMISMATCH=6,		/* rpc versions not compatible */
     69   1.1   deraadt 	RPC_AUTHERROR=7,		/* authentication error */
     70   1.1   deraadt 	RPC_PROGUNAVAIL=8,		/* program not available */
     71   1.1   deraadt 	RPC_PROGVERSMISMATCH=9,		/* program version mismatched */
     72   1.1   deraadt 	RPC_PROCUNAVAIL=10,		/* procedure unavailable */
     73   1.1   deraadt 	RPC_CANTDECODEARGS=11,		/* decode arguments error */
     74   1.1   deraadt 	RPC_SYSTEMERROR=12,		/* generic "other problem" */
     75   1.1   deraadt 
     76   1.1   deraadt 	/*
     77  1.14      fvdl 	 * rpc_call & clnt_create errors
     78   1.1   deraadt 	 */
     79   1.1   deraadt 	RPC_UNKNOWNHOST=13,		/* unknown host name */
     80   1.1   deraadt 	RPC_UNKNOWNPROTO=17,		/* unkown protocol */
     81  1.14      fvdl 	RPC_UNKNOWNADDR = 19,		/* Remote address unknown */
     82  1.14      fvdl 	RPC_NOBROADCAST = 21,		/* Broadcasting not supported */
     83   1.1   deraadt 
     84   1.1   deraadt 	/*
     85  1.14      fvdl 	 * rpcbind errors
     86   1.1   deraadt 	 */
     87  1.14      fvdl 	RPC_RPCBFAILURE=14,		/* the pmapper failed in its call */
     88  1.14      fvdl #define RPC_PMAPFAILURE RPC_RPCBFAILURE
     89   1.1   deraadt 	RPC_PROGNOTREGISTERED=15,	/* remote program is not registered */
     90  1.14      fvdl 	RPC_N2AXLATEFAILURE = 22,	/* name -> addr translation failed */
     91  1.14      fvdl 
     92  1.14      fvdl 	/*
     93  1.14      fvdl 	 * Misc error in the TLI library (provided for compatibility)
     94  1.14      fvdl 	 */
     95  1.14      fvdl 	RPC_TLIERROR = 20,
     96  1.14      fvdl 
     97   1.1   deraadt 	/*
     98   1.1   deraadt 	 * unspecified error
     99   1.1   deraadt 	 */
    100  1.14      fvdl 	RPC_FAILED=16,
    101  1.14      fvdl 
    102  1.14      fvdl 	/*
    103  1.14      fvdl 	 * asynchronous errors
    104  1.14      fvdl 	 */
    105  1.14      fvdl 	RPC_INPROGRESS = 24,
    106  1.14      fvdl 	RPC_STALERACHANDLE = 25
    107   1.1   deraadt };
    108   1.1   deraadt 
    109   1.1   deraadt 
    110   1.1   deraadt /*
    111   1.1   deraadt  * Error info.
    112   1.1   deraadt  */
    113   1.1   deraadt struct rpc_err {
    114   1.1   deraadt 	enum clnt_stat re_status;
    115   1.1   deraadt 	union {
    116  1.11     lukem 		int RE_errno;		/* related system error */
    117   1.1   deraadt 		enum auth_stat RE_why;	/* why the auth error occurred */
    118   1.1   deraadt 		struct {
    119  1.14      fvdl 			rpcvers_t low;	/* lowest version supported */
    120  1.14      fvdl 			rpcvers_t high;	/* highest version supported */
    121   1.1   deraadt 		} RE_vers;
    122   1.1   deraadt 		struct {		/* maybe meaningful if RPC_FAILED */
    123   1.6       cgd 			int32_t s1;
    124   1.6       cgd 			int32_t s2;
    125   1.1   deraadt 		} RE_lb;		/* life boot & debugging only */
    126   1.1   deraadt 	} ru;
    127   1.1   deraadt #define	re_errno	ru.RE_errno
    128   1.1   deraadt #define	re_why		ru.RE_why
    129   1.1   deraadt #define	re_vers		ru.RE_vers
    130   1.1   deraadt #define	re_lb		ru.RE_lb
    131   1.1   deraadt };
    132   1.1   deraadt 
    133   1.1   deraadt 
    134   1.1   deraadt /*
    135  1.10     lukem  * Client rpc handle.
    136  1.14      fvdl  * Created by individual implementations
    137   1.1   deraadt  * Client is responsible for initializing auth, see e.g. auth_none.c.
    138   1.1   deraadt  */
    139   1.5       cgd typedef struct __rpc_client {
    140   1.1   deraadt 	AUTH	*cl_auth;			/* authenticator */
    141  1.12   mycroft 	const struct clnt_ops {
    142  1.10     lukem 		/* call remote procedure */
    143   1.5       cgd 		enum clnt_stat	(*cl_call) __P((struct __rpc_client *,
    144  1.14      fvdl 				    rpcproc_t, xdrproc_t, caddr_t, xdrproc_t,
    145  1.10     lukem 				    caddr_t, struct timeval));
    146  1.10     lukem 		/* abort a call */
    147   1.5       cgd 		void		(*cl_abort) __P((struct __rpc_client *));
    148  1.10     lukem 		/* get specific error code */
    149   1.5       cgd 		void		(*cl_geterr) __P((struct __rpc_client *,
    150  1.10     lukem 				    struct rpc_err *));
    151  1.10     lukem 		/* frees results */
    152   1.5       cgd 		bool_t		(*cl_freeres) __P((struct __rpc_client *,
    153  1.10     lukem 				    xdrproc_t, caddr_t));
    154  1.10     lukem 		/* destroy this structure */
    155   1.5       cgd 		void		(*cl_destroy) __P((struct __rpc_client *));
    156  1.10     lukem 		/* the ioctl() of rpc */
    157  1.10     lukem 		bool_t          (*cl_control) __P((struct __rpc_client *, u_int,
    158  1.10     lukem 				    char *));
    159   1.1   deraadt 	} *cl_ops;
    160  1.13  christos 	void 			*cl_private;	/* private stuff */
    161  1.14      fvdl 	char			*cl_netid;	/* network token */
    162  1.14      fvdl 	char			*cl_tp;		/* device name */
    163   1.1   deraadt } CLIENT;
    164   1.1   deraadt 
    165   1.1   deraadt 
    166   1.1   deraadt /*
    167  1.14      fvdl  * Timers used for the pseudo-transport protocol when using datagrams
    168  1.14      fvdl  */
    169  1.14      fvdl struct rpc_timers {
    170  1.14      fvdl 	u_short		rt_srtt;	/* smoothed round-trip time */
    171  1.14      fvdl 	u_short		rt_deviate;	/* estimated deviation */
    172  1.14      fvdl 	u_long		rt_rtxcur;	/* current (backed-off) rto */
    173  1.14      fvdl };
    174  1.14      fvdl 
    175  1.14      fvdl /*
    176  1.14      fvdl  * Feedback values used for possible congestion and rate control
    177  1.14      fvdl  */
    178  1.14      fvdl #define FEEDBACK_REXMIT1	1	/* first retransmit */
    179  1.14      fvdl #define FEEDBACK_OK		2	/* no retransmits */
    180  1.14      fvdl 
    181  1.14      fvdl /* Used to set version of portmapper used in broadcast */
    182  1.14      fvdl 
    183  1.14      fvdl #define CLCR_SET_LOWVERS	3
    184  1.14      fvdl #define CLCR_GET_LOWVERS	4
    185  1.14      fvdl 
    186  1.14      fvdl #define RPCSMALLMSGSIZE 400	/* a more reasonable packet size */
    187  1.14      fvdl 
    188  1.14      fvdl /*
    189  1.10     lukem  * client side rpc interface ops
    190   1.1   deraadt  *
    191   1.1   deraadt  * Parameter types are:
    192   1.1   deraadt  *
    193   1.1   deraadt  */
    194   1.1   deraadt 
    195   1.1   deraadt /*
    196   1.1   deraadt  * enum clnt_stat
    197   1.1   deraadt  * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
    198  1.10     lukem  * 	CLIENT *rh;
    199  1.14      fvdl  *	rpcproc_t proc;
    200  1.10     lukem  *	xdrproc_t xargs;
    201  1.10     lukem  *	caddr_t argsp;
    202  1.10     lukem  *	xdrproc_t xres;
    203  1.10     lukem  *	caddr_t resp;
    204  1.10     lukem  *	struct timeval timeout;
    205   1.1   deraadt  */
    206   1.5       cgd #define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)		\
    207  1.13  christos 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, 			\
    208  1.13  christos 	(caddr_t)(void *)argsp,	xres, (caddr_t)(void *)resp, secs))
    209   1.5       cgd #define	clnt_call(rh, proc, xargs, argsp, xres, resp, secs)		\
    210  1.13  christos 	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, 			\
    211  1.13  christos 	 (caddr_t)(void *)argsp, xres, (caddr_t)(void *)resp, secs))
    212   1.1   deraadt 
    213   1.1   deraadt /*
    214   1.1   deraadt  * void
    215   1.1   deraadt  * CLNT_ABORT(rh);
    216  1.10     lukem  * 	CLIENT *rh;
    217   1.1   deraadt  */
    218   1.1   deraadt #define	CLNT_ABORT(rh)	((*(rh)->cl_ops->cl_abort)(rh))
    219   1.1   deraadt #define	clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
    220   1.1   deraadt 
    221   1.1   deraadt /*
    222   1.1   deraadt  * struct rpc_err
    223   1.1   deraadt  * CLNT_GETERR(rh);
    224  1.10     lukem  * 	CLIENT *rh;
    225   1.1   deraadt  */
    226   1.1   deraadt #define	CLNT_GETERR(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
    227   1.1   deraadt #define	clnt_geterr(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
    228   1.1   deraadt 
    229   1.1   deraadt 
    230   1.1   deraadt /*
    231   1.1   deraadt  * bool_t
    232   1.1   deraadt  * CLNT_FREERES(rh, xres, resp);
    233  1.10     lukem  * 	CLIENT *rh;
    234  1.10     lukem  *	xdrproc_t xres;
    235  1.10     lukem  *	caddr_t resp;
    236   1.1   deraadt  */
    237   1.1   deraadt #define	CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
    238   1.1   deraadt #define	clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
    239   1.1   deraadt 
    240   1.1   deraadt /*
    241   1.1   deraadt  * bool_t
    242   1.1   deraadt  * CLNT_CONTROL(cl, request, info)
    243  1.10     lukem  *      CLIENT *cl;
    244  1.10     lukem  *      u_int request;
    245  1.10     lukem  *      char *info;
    246   1.1   deraadt  */
    247   1.1   deraadt #define	CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
    248   1.1   deraadt #define	clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
    249   1.1   deraadt 
    250   1.1   deraadt /*
    251   1.1   deraadt  * control operations that apply to both udp and tcp transports
    252   1.1   deraadt  */
    253  1.14      fvdl #define CLSET_TIMEOUT		1	/* set timeout (timeval) */
    254  1.14      fvdl #define CLGET_TIMEOUT		2	/* get timeout (timeval) */
    255  1.14      fvdl #define CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
    256  1.14      fvdl #define	CLGET_FD		6	/* get connections file descriptor */
    257  1.14      fvdl #define	CLGET_SVC_ADDR		7	/* get server's address (netbuf) */
    258  1.14      fvdl #define	CLSET_FD_CLOSE		8	/* close fd while clnt_destroy */
    259  1.14      fvdl #define	CLSET_FD_NCLOSE		9	/* Do not close fd while clnt_destroy */
    260  1.14      fvdl #define	CLGET_XID 		10	/* Get xid */
    261  1.14      fvdl #define	CLSET_XID		11	/* Set xid */
    262  1.14      fvdl #define	CLGET_VERS		12	/* Get version number */
    263  1.14      fvdl #define	CLSET_VERS		13	/* Set version number */
    264  1.14      fvdl #define	CLGET_PROG		14	/* Get program number */
    265  1.14      fvdl #define	CLSET_PROG		15	/* Set program number */
    266  1.14      fvdl #define	CLSET_SVC_ADDR		16	/* get server's address (netbuf) */
    267  1.14      fvdl #define	CLSET_PUSH_TIMOD	17	/* push timod if not already present */
    268  1.14      fvdl #define	CLSET_POP_TIMOD		18	/* pop timod */
    269   1.1   deraadt /*
    270  1.14      fvdl  * Connectionless only control operations
    271   1.1   deraadt  */
    272   1.1   deraadt #define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
    273   1.1   deraadt #define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
    274   1.1   deraadt 
    275   1.1   deraadt /*
    276   1.1   deraadt  * void
    277   1.1   deraadt  * CLNT_DESTROY(rh);
    278  1.10     lukem  * 	CLIENT *rh;
    279   1.1   deraadt  */
    280   1.1   deraadt #define	CLNT_DESTROY(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
    281   1.1   deraadt #define	clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
    282   1.1   deraadt 
    283   1.1   deraadt 
    284   1.1   deraadt /*
    285  1.10     lukem  * RPCTEST is a test program which is accessable on every rpc
    286   1.1   deraadt  * transport/port.  It is used for testing, performance evaluation,
    287   1.1   deraadt  * and network administration.
    288   1.1   deraadt  */
    289   1.1   deraadt 
    290  1.14      fvdl #define RPCTEST_PROGRAM		((rpcprog_t)1)
    291  1.14      fvdl #define RPCTEST_VERSION		((rpcvers_t)1)
    292  1.14      fvdl #define RPCTEST_NULL_PROC	((rpcproc_t)2)
    293  1.14      fvdl #define RPCTEST_NULL_BATCH_PROC	((rpcproc_t)3)
    294   1.1   deraadt 
    295   1.1   deraadt /*
    296   1.1   deraadt  * By convention, procedure 0 takes null arguments and returns them
    297   1.1   deraadt  */
    298   1.1   deraadt 
    299  1.14      fvdl #define NULLPROC ((rpcproc_t)0)
    300   1.1   deraadt 
    301   1.1   deraadt /*
    302   1.1   deraadt  * Below are the client handle creation routines for the various
    303  1.14      fvdl  * implementations of client side rpc.  They can return NULL if a
    304  1.14      fvdl  * creation failure occurs.
    305  1.14      fvdl  */
    306   1.1   deraadt 
    307   1.1   deraadt /*
    308  1.14      fvdl  * Generic client creation routine. Supported protocols are those that
    309  1.14      fvdl  * belong to the nettype namespace (/etc/netconfig).
    310   1.1   deraadt  * CLIENT *
    311  1.14      fvdl  * clnt_create(host, prog, vers, prot);
    312  1.14      fvdl  *	const char *host; 	-- hostname
    313  1.14      fvdl  *	const rpcprog_t prog;	-- program number
    314  1.14      fvdl  *	const rpcvers_t vers;	-- version number
    315  1.14      fvdl  *	const char *prot;	-- protocol
    316   1.1   deraadt  */
    317   1.2    brezak __BEGIN_DECLS
    318  1.14      fvdl extern CLIENT *clnt_create __P((const char *, const rpcprog_t, const rpcvers_t,
    319  1.14      fvdl 				const char *));
    320  1.14      fvdl /*
    321  1.14      fvdl  *
    322  1.14      fvdl  * 	const char *hostname;			-- hostname
    323  1.14      fvdl  *	const rpcprog_t prog;			-- program number
    324  1.14      fvdl  *	const rpcvers_t vers;			-- version number
    325  1.14      fvdl  *	const char *nettype;			-- network type
    326  1.14      fvdl  */
    327  1.14      fvdl 
    328  1.14      fvdl /*
    329  1.14      fvdl  * Generic client creation routine. Supported protocols are which belong
    330  1.14      fvdl  * to the nettype name space.
    331  1.14      fvdl  */
    332  1.14      fvdl extern CLIENT *clnt_create_vers __P((const char *, const rpcprog_t, rpcvers_t *,
    333  1.14      fvdl 				     const rpcvers_t, const rpcvers_t,
    334  1.14      fvdl 				     const char *));
    335  1.14      fvdl /*
    336  1.14      fvdl  *	const char *host;		-- hostname
    337  1.14      fvdl  *	const rpcprog_t prog;		-- program number
    338  1.14      fvdl  *	rpcvers_t *vers_out;		-- servers highest available version
    339  1.14      fvdl  *	const rpcvers_t vers_low;	-- low version number
    340  1.14      fvdl  *	const rpcvers_t vers_high;	-- high version number
    341  1.14      fvdl  *	const char *nettype;		-- network type
    342  1.14      fvdl  */
    343   1.1   deraadt 
    344   1.1   deraadt 
    345   1.1   deraadt /*
    346  1.14      fvdl  * Generic client creation routine. It takes a netconfig structure
    347  1.14      fvdl  * instead of nettype
    348  1.14      fvdl  */
    349  1.14      fvdl extern CLIENT *clnt_tp_create __P((const char *, const rpcprog_t,
    350  1.14      fvdl 				   const rpcvers_t, const struct netconfig *));
    351  1.14      fvdl /*
    352  1.14      fvdl  *	const char *hostname;			-- hostname
    353  1.14      fvdl  *	const rpcprog_t prog;			-- program number
    354  1.14      fvdl  *	const rpcvers_t vers;			-- version number
    355  1.14      fvdl  *	const struct netconfig *netconf; 	-- network config structure
    356  1.14      fvdl  */
    357  1.14      fvdl 
    358  1.14      fvdl /*
    359  1.14      fvdl  * Generic TLI create routine. Only provided for compatibility.
    360   1.2    brezak  */
    361   1.1   deraadt 
    362  1.14      fvdl extern CLIENT *clnt_tli_create __P((const int, const struct netconfig *,
    363  1.14      fvdl 				    const struct netbuf *, const rpcprog_t,
    364  1.14      fvdl 				    const rpcvers_t, const u_int, const u_int));
    365  1.14      fvdl /*
    366  1.14      fvdl  *	const register int fd;		-- fd
    367  1.14      fvdl  *	const struct netconfig *nconf;	-- netconfig structure
    368  1.14      fvdl  *	const struct netbuf *svcaddr;		-- servers address
    369  1.14      fvdl  *	const u_long prog;			-- program number
    370  1.14      fvdl  *	const u_long vers;			-- version number
    371  1.14      fvdl  *	const u_int sendsz;			-- send size
    372  1.14      fvdl  *	const u_int recvsz;			-- recv size
    373  1.14      fvdl  */
    374   1.1   deraadt 
    375   1.1   deraadt /*
    376  1.14      fvdl  * Low level clnt create routine for connectionful transports, e.g. tcp.
    377  1.14      fvdl  */
    378  1.14      fvdl extern CLIENT *clnt_vc_create __P((const int, const struct netbuf *,
    379  1.14      fvdl 				   const rpcprog_t, const rpcvers_t,
    380  1.14      fvdl 				   const u_int, const u_int));
    381  1.14      fvdl /*
    382  1.14      fvdl  *	const int fd;				-- open file descriptor
    383  1.14      fvdl  *	const struct netbuf *svcaddr;		-- servers address
    384  1.14      fvdl  *	const rpcprog_t prog;			-- program number
    385  1.14      fvdl  *	const rpcvers_t vers;			-- version number
    386  1.14      fvdl  *	const u_int sendsz;			-- buffer recv size
    387  1.14      fvdl  *	const u_int recvsz;			-- buffer send size
    388   1.1   deraadt  */
    389   1.1   deraadt 
    390  1.14      fvdl /*
    391  1.14      fvdl  * Low level clnt create routine for connectionless transports, e.g. udp.
    392  1.14      fvdl  */
    393  1.14      fvdl extern CLIENT *clnt_dg_create __P((const int, const struct netbuf *,
    394  1.14      fvdl 				   const rpcprog_t, const rpcvers_t,
    395  1.14      fvdl 				   const u_int, const u_int));
    396  1.14      fvdl /*
    397  1.14      fvdl  *	const int fd;				-- open file descriptor
    398  1.14      fvdl  *	const struct netbuf *svcaddr;		-- servers address
    399  1.14      fvdl  *	const rpcprog_t program;		-- program number
    400  1.14      fvdl  *	const rpcvers_t version;		-- version number
    401  1.14      fvdl  *	const u_int sendsz;			-- buffer recv size
    402  1.14      fvdl  *	const u_int recvsz;			-- buffer send size
    403  1.14      fvdl  */
    404   1.2    brezak 
    405   1.1   deraadt /*
    406  1.14      fvdl  * Memory based rpc (for speed check and testing)
    407   1.1   deraadt  * CLIENT *
    408  1.14      fvdl  * clnt_raw_create(prog, vers)
    409  1.14      fvdl  *	u_long prog;
    410  1.14      fvdl  *	u_long vers;
    411   1.1   deraadt  */
    412  1.14      fvdl extern CLIENT *clnt_raw_create	__P((rpcprog_t, rpcvers_t));
    413  1.14      fvdl 
    414   1.2    brezak __END_DECLS
    415   1.2    brezak 
    416   1.1   deraadt 
    417   1.1   deraadt /*
    418   1.1   deraadt  * Print why creation failed
    419   1.1   deraadt  */
    420   1.2    brezak __BEGIN_DECLS
    421  1.10     lukem extern void clnt_pcreateerror	__P((char *));			/* stderr */
    422  1.10     lukem extern char *clnt_spcreateerror	__P((char *));			/* string */
    423   1.2    brezak __END_DECLS
    424   1.1   deraadt 
    425   1.1   deraadt /*
    426   1.1   deraadt  * Like clnt_perror(), but is more verbose in its output
    427   1.1   deraadt  */
    428   1.2    brezak __BEGIN_DECLS
    429   1.2    brezak extern void clnt_perrno		__P((enum clnt_stat));		/* stderr */
    430   1.2    brezak extern char *clnt_sperrno	__P((enum clnt_stat));		/* string */
    431   1.2    brezak __END_DECLS
    432   1.1   deraadt 
    433   1.1   deraadt /*
    434   1.1   deraadt  * Print an English error message, given the client error code
    435   1.1   deraadt  */
    436   1.2    brezak __BEGIN_DECLS
    437  1.10     lukem extern void clnt_perror		__P((CLIENT *, char *)); 	/* stderr */
    438  1.10     lukem extern char *clnt_sperror	__P((CLIENT *, char *));	/* string */
    439   1.2    brezak __END_DECLS
    440   1.2    brezak 
    441   1.1   deraadt 
    442   1.1   deraadt /*
    443   1.1   deraadt  * If a creation fails, the following allows the user to figure out why.
    444   1.1   deraadt  */
    445   1.1   deraadt struct rpc_createerr {
    446   1.1   deraadt 	enum clnt_stat cf_stat;
    447   1.1   deraadt 	struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
    448   1.1   deraadt };
    449   1.1   deraadt 
    450  1.14      fvdl #ifdef _REENTRANT
    451  1.14      fvdl __BEGIN_DECLS
    452  1.14      fvdl extern struct rpc_createerr	*__rpc_createerr __P((void));
    453  1.14      fvdl __END_DECLS
    454  1.14      fvdl #define rpc_createerr		(*(__rpc_createerr()))
    455  1.14      fvdl #else
    456   1.1   deraadt extern struct rpc_createerr rpc_createerr;
    457  1.14      fvdl #endif /* _REENTRANT */
    458  1.14      fvdl 
    459  1.14      fvdl /*
    460  1.14      fvdl  * The simplified interface:
    461  1.14      fvdl  * enum clnt_stat
    462  1.14      fvdl  * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
    463  1.14      fvdl  *	const char *host;
    464  1.14      fvdl  *	const rpcprog_t prognum;
    465  1.14      fvdl  *	const rpcvers_t versnum;
    466  1.14      fvdl  *	const rpcproc_t procnum;
    467  1.14      fvdl  *	const xdrproc_t inproc, outproc;
    468  1.14      fvdl  *	const char *in;
    469  1.14      fvdl  *	char *out;
    470  1.14      fvdl  *	const char *nettype;
    471  1.14      fvdl  */
    472  1.14      fvdl __BEGIN_DECLS
    473  1.14      fvdl extern enum clnt_stat rpc_call __P((const char *, const rpcprog_t,
    474  1.14      fvdl 				    const rpcvers_t, const rpcproc_t,
    475  1.14      fvdl 				    const xdrproc_t, const char *,
    476  1.14      fvdl 				    const xdrproc_t, char *, const char *));
    477  1.14      fvdl __END_DECLS
    478   1.1   deraadt 
    479  1.14      fvdl /*
    480  1.14      fvdl  * RPC broadcast interface
    481  1.14      fvdl  * The call is broadcasted to all locally connected nets.
    482  1.14      fvdl  *
    483  1.14      fvdl  * extern enum clnt_stat
    484  1.14      fvdl  * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
    485  1.14      fvdl  *			eachresult, nettype)
    486  1.14      fvdl  *	const rpcprog_t		prog;		-- program number
    487  1.14      fvdl  *	const rpcvers_t		vers;		-- version number
    488  1.14      fvdl  *	const rpcproc_t		proc;		-- procedure number
    489  1.14      fvdl  *	const xdrproc_t	xargs;		-- xdr routine for args
    490  1.14      fvdl  *	caddr_t		argsp;		-- pointer to args
    491  1.14      fvdl  *	const xdrproc_t	xresults;	-- xdr routine for results
    492  1.14      fvdl  *	caddr_t		resultsp;	-- pointer to results
    493  1.14      fvdl  *	const resultproc_t	eachresult;	-- call with each result
    494  1.14      fvdl  *	const char		*nettype;	-- Transport type
    495  1.14      fvdl  *
    496  1.14      fvdl  * For each valid response received, the procedure eachresult is called.
    497  1.14      fvdl  * Its form is:
    498  1.14      fvdl  *		done = eachresult(resp, raddr, nconf)
    499  1.14      fvdl  *			bool_t done;
    500  1.14      fvdl  *			caddr_t resp;
    501  1.14      fvdl  *			struct netbuf *raddr;
    502  1.14      fvdl  *			struct netconfig *nconf;
    503  1.14      fvdl  * where resp points to the results of the call and raddr is the
    504  1.14      fvdl  * address if the responder to the broadcast.  nconf is the transport
    505  1.14      fvdl  * on which the response was received.
    506  1.14      fvdl  *
    507  1.14      fvdl  * extern enum clnt_stat
    508  1.14      fvdl  * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
    509  1.14      fvdl  *			eachresult, inittime, waittime, nettype)
    510  1.14      fvdl  *	const rpcprog_t		prog;		-- program number
    511  1.14      fvdl  *	const rpcvers_t		vers;		-- version number
    512  1.14      fvdl  *	const rpcproc_t		proc;		-- procedure number
    513  1.14      fvdl  *	const xdrproc_t	xargs;		-- xdr routine for args
    514  1.14      fvdl  *	caddr_t		argsp;		-- pointer to args
    515  1.14      fvdl  *	const xdrproc_t	xresults;	-- xdr routine for results
    516  1.14      fvdl  *	caddr_t		resultsp;	-- pointer to results
    517  1.14      fvdl  *	const resultproc_t	eachresult;	-- call with each result
    518  1.14      fvdl  *	const int 		inittime;	-- how long to wait initially
    519  1.14      fvdl  *	const int 		waittime;	-- maximum time to wait
    520  1.14      fvdl  *	const char		*nettype;	-- Transport type
    521  1.14      fvdl  */
    522  1.14      fvdl 
    523  1.14      fvdl typedef bool_t (*resultproc_t) __P((caddr_t, ...));
    524  1.14      fvdl 
    525  1.14      fvdl __BEGIN_DECLS
    526  1.14      fvdl extern enum clnt_stat rpc_broadcast __P((const rpcprog_t, const rpcvers_t,
    527  1.14      fvdl 					 const rpcproc_t, const xdrproc_t,
    528  1.14      fvdl 					 caddr_t, const xdrproc_t, caddr_t,
    529  1.14      fvdl 					 const resultproc_t, const char *));
    530  1.14      fvdl extern enum clnt_stat rpc_broadcast_exp __P((const rpcprog_t, const rpcvers_t,
    531  1.14      fvdl 					     const rpcproc_t, const xdrproc_t,
    532  1.14      fvdl 					     caddr_t, const xdrproc_t, caddr_t,
    533  1.14      fvdl 					     const resultproc_t, const int,
    534  1.14      fvdl 					     const int, const char *));
    535  1.14      fvdl __END_DECLS
    536   1.1   deraadt 
    537  1.14      fvdl /* For backward compatibility */
    538  1.14      fvdl #include <rpc/clnt_soc.h>
    539   1.1   deraadt 
    540   1.7     perry #endif /* !_RPC_CLNT_H_ */
    541