clnt.h revision 100001
174462Salfred/*	$NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $	*/
274462Salfred
31839Swollman/*
499775Salfred * The contents of this file are subject to the Sun Standards
599775Salfred * License Version 1.0 the (the "License";) You may not use
699775Salfred * this file except in compliance with the License.  You may
799775Salfred * obtain a copy of the License at lib/libc/rpc/LICENSE
899775Salfred *
999775Salfred * Software distributed under the License is distributed on
1099775Salfred * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
1199775Salfred * express or implied.  See the License for the specific
1299775Salfred * language governing rights and limitations under the License.
1399775Salfred *
1499775Salfred * The Original Code is Copyright 1998 by Sun Microsystems, Inc
1599775Salfred *
1699775Salfred * The Initial Developer of the Original Code is:  Sun
1799775Salfred * Microsystems, Inc.
1899775Salfred *
1999775Salfred * All Rights Reserved.
2099775Salfred *
211839Swollman * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
221839Swollman * unrestricted use provided that this legend is included on all tape
231839Swollman * media and as a part of the software program in whole or part.  Users
241839Swollman * may copy or modify Sun RPC without charge, but are not authorized
251839Swollman * to license or distribute it to anyone else except as part of a product or
261839Swollman * program developed by the user.
278858Srgrimes *
281839Swollman * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
2913771Smpp * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
301839Swollman * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
318858Srgrimes *
321839Swollman * Sun RPC is provided with no support and without any obligation on the
331839Swollman * part of Sun Microsystems, Inc. to assist in its use, correction,
341839Swollman * modification or enhancement.
358858Srgrimes *
361839Swollman * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
371839Swollman * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
381839Swollman * OR ANY PART THEREOF.
398858Srgrimes *
401839Swollman * In no event will Sun Microsystems, Inc. be liable for any lost revenue
411839Swollman * or profits or other special, indirect and consequential damages, even if
421839Swollman * Sun has been advised of the possibility of such damages.
438858Srgrimes *
441839Swollman * Sun Microsystems, Inc.
451839Swollman * 2550 Garcia Avenue
461839Swollman * Mountain View, California  94043
471903Swollman *
4874462Salfred *	from: @(#)clnt.h 1.31 94/04/29 SMI
491903Swollman *	from: @(#)clnt.h	2.1 88/07/29 4.0 RPCSRC
5050473Speter * $FreeBSD: head/include/rpc/clnt.h 100001 2002-07-14 23:35:04Z alfred $
511839Swollman */
521839Swollman
531839Swollman/*
541839Swollman * clnt.h - Client side remote procedure call interface.
551839Swollman *
5699775Salfred * Copyright (c) 1986-1991,1994-1999 by Sun Microsystems, Inc.
5799775Salfred * All rights reserved.
581839Swollman */
591839Swollman
601903Swollman#ifndef _RPC_CLNT_H_
611903Swollman#define _RPC_CLNT_H_
6274462Salfred#include <rpc/clnt_stat.h>
631903Swollman#include <sys/cdefs.h>
6474462Salfred#include <netconfig.h>
6526211Swpaul#include <sys/un.h>
661839Swollman
671839Swollman/*
6874462Salfred * Well-known IPV6 RPC broadcast address.
691839Swollman */
7074462Salfred#define RPCB_MULTICAST_ADDR "ff02::202"
711839Swollman
7274462Salfred/*
7374462Salfred * the following errors are in general unrecoverable.  The caller
7474462Salfred * should give up rather than retry.
7574462Salfred */
7674462Salfred#define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \
7774462Salfred	((s) == RPC_CANTENCODEARGS) || \
7874462Salfred	((s) == RPC_CANTDECODERES) || \
7974462Salfred	((s) == RPC_VERSMISMATCH) || \
8074462Salfred	((s) == RPC_PROCUNAVAIL) || \
8174462Salfred	((s) == RPC_PROGUNAVAIL) || \
8274462Salfred	((s) == RPC_PROGVERSMISMATCH) || \
8374462Salfred	((s) == RPC_CANTDECODEARGS))
841839Swollman
851839Swollman/*
861839Swollman * Error info.
871839Swollman */
881839Swollmanstruct rpc_err {
891839Swollman	enum clnt_stat re_status;
901839Swollman	union {
9113771Smpp		int RE_errno;		/* related system error */
921839Swollman		enum auth_stat RE_why;	/* why the auth error occurred */
931839Swollman		struct {
9474462Salfred			rpcvers_t low;	/* lowest version supported */
9574462Salfred			rpcvers_t high;	/* highest version supported */
961839Swollman		} RE_vers;
971839Swollman		struct {		/* maybe meaningful if RPC_FAILED */
9821059Speter			int32_t s1;
9921059Speter			int32_t s2;
1001839Swollman		} RE_lb;		/* life boot & debugging only */
1011839Swollman	} ru;
1021839Swollman#define	re_errno	ru.RE_errno
1031839Swollman#define	re_why		ru.RE_why
1041839Swollman#define	re_vers		ru.RE_vers
1051839Swollman#define	re_lb		ru.RE_lb
1061839Swollman};
1071839Swollman
1081839Swollman
1091839Swollman/*
1101839Swollman * Client rpc handle.
11174462Salfred * Created by individual implementations
1121839Swollman * Client is responsible for initializing auth, see e.g. auth_none.c.
1131839Swollman */
11421059Spetertypedef struct __rpc_client {
1151839Swollman	AUTH	*cl_auth;			/* authenticator */
1161839Swollman	struct clnt_ops {
11721059Speter		/* call remote procedure */
11893032Simp		enum clnt_stat	(*cl_call)(struct __rpc_client *,
11995658Sdes				    rpcproc_t, xdrproc_t, void *, xdrproc_t,
12095658Sdes				        void *, struct timeval);
12121059Speter		/* abort a call */
12293032Simp		void		(*cl_abort)(struct __rpc_client *);
12321059Speter		/* get specific error code */
12493032Simp		void		(*cl_geterr)(struct __rpc_client *,
12593032Simp					struct rpc_err *);
12621059Speter		/* frees results */
12793032Simp		bool_t		(*cl_freeres)(struct __rpc_client *,
12895658Sdes					xdrproc_t, void *);
12921059Speter		/* destroy this structure */
13093032Simp		void		(*cl_destroy)(struct __rpc_client *);
13121059Speter		/* the ioctl() of rpc */
13293032Simp		bool_t          (*cl_control)(struct __rpc_client *, u_int,
13395658Sdes				    void *);
1341839Swollman	} *cl_ops;
13574462Salfred	void 			*cl_private;	/* private stuff */
13674462Salfred	char			*cl_netid;	/* network token */
13774462Salfred	char			*cl_tp;		/* device name */
1381839Swollman} CLIENT;
1391839Swollman
1401839Swollman
1411839Swollman/*
14274462Salfred * Timers used for the pseudo-transport protocol when using datagrams
14374462Salfred */
14474462Salfredstruct rpc_timers {
14574462Salfred	u_short		rt_srtt;	/* smoothed round-trip time */
14674462Salfred	u_short		rt_deviate;	/* estimated deviation */
14774462Salfred	u_long		rt_rtxcur;	/* current (backed-off) rto */
14874462Salfred};
14974462Salfred
15074462Salfred/*
15174462Salfred * Feedback values used for possible congestion and rate control
15274462Salfred */
15374462Salfred#define FEEDBACK_REXMIT1	1	/* first retransmit */
15474462Salfred#define FEEDBACK_OK		2	/* no retransmits */
15574462Salfred
15674462Salfred/* Used to set version of portmapper used in broadcast */
15774462Salfred
15874462Salfred#define CLCR_SET_LOWVERS	3
15974462Salfred#define CLCR_GET_LOWVERS	4
16074462Salfred
16174462Salfred#define RPCSMALLMSGSIZE 400	/* a more reasonable packet size */
16274462Salfred
16374462Salfred/*
1641839Swollman * client side rpc interface ops
1651839Swollman *
1661839Swollman * Parameter types are:
1671839Swollman *
1681839Swollman */
1691839Swollman
1701839Swollman/*
1711839Swollman * enum clnt_stat
1721839Swollman * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
1731839Swollman * 	CLIENT *rh;
17474462Salfred *	rpcproc_t proc;
1751839Swollman *	xdrproc_t xargs;
17695658Sdes *	void *argsp;
1771839Swollman *	xdrproc_t xres;
17895658Sdes *	void *resp;
1791839Swollman *	struct timeval timeout;
1801839Swollman */
18174462Salfred#define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
18274462Salfred	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
18395658Sdes		argsp, xres, resp, secs))
18474462Salfred#define	clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
18574462Salfred	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
18695658Sdes		argsp, xres, resp, secs))
1871839Swollman
1881839Swollman/*
1891839Swollman * void
1901839Swollman * CLNT_ABORT(rh);
1911839Swollman * 	CLIENT *rh;
1921839Swollman */
1931839Swollman#define	CLNT_ABORT(rh)	((*(rh)->cl_ops->cl_abort)(rh))
1941839Swollman#define	clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
1951839Swollman
1961839Swollman/*
1971839Swollman * struct rpc_err
1981839Swollman * CLNT_GETERR(rh);
1991839Swollman * 	CLIENT *rh;
2001839Swollman */
2011839Swollman#define	CLNT_GETERR(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
2021839Swollman#define	clnt_geterr(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
2031839Swollman
2041839Swollman
2051839Swollman/*
2061839Swollman * bool_t
2071839Swollman * CLNT_FREERES(rh, xres, resp);
2081839Swollman * 	CLIENT *rh;
2091839Swollman *	xdrproc_t xres;
21095658Sdes *	void *resp;
2111839Swollman */
2121839Swollman#define	CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
2131839Swollman#define	clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
2141839Swollman
2151839Swollman/*
2161839Swollman * bool_t
2171839Swollman * CLNT_CONTROL(cl, request, info)
2181839Swollman *      CLIENT *cl;
2191839Swollman *      u_int request;
2201839Swollman *      char *info;
2211839Swollman */
2221839Swollman#define	CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
2231839Swollman#define	clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
2241839Swollman
2251839Swollman/*
22674462Salfred * control operations that apply to both udp and tcp transports
2271839Swollman */
22874462Salfred#define CLSET_TIMEOUT		1	/* set timeout (timeval) */
22974462Salfred#define CLGET_TIMEOUT		2	/* get timeout (timeval) */
23074462Salfred#define CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
23174462Salfred#define CLGET_FD		6	/* get connections file descriptor */
23274462Salfred#define CLGET_SVC_ADDR		7	/* get server's address (netbuf) */
23374462Salfred#define CLSET_FD_CLOSE		8	/* close fd while clnt_destroy */
23474462Salfred#define CLSET_FD_NCLOSE		9	/* Do not close fd while clnt_destroy */
23574462Salfred#define CLGET_XID 		10	/* Get xid */
23674462Salfred#define CLSET_XID		11	/* Set xid */
23774462Salfred#define CLGET_VERS		12	/* Get version number */
23874462Salfred#define CLSET_VERS		13	/* Set version number */
23974462Salfred#define CLGET_PROG		14	/* Get program number */
24074462Salfred#define CLSET_PROG		15	/* Set program number */
24174462Salfred#define CLSET_SVC_ADDR		16	/* get server's address (netbuf) */
24274462Salfred#define CLSET_PUSH_TIMOD	17	/* push timod if not already present */
24374462Salfred#define CLSET_POP_TIMOD		18	/* pop timod */
2441839Swollman/*
24574462Salfred * Connectionless only control operations
2461839Swollman */
2471839Swollman#define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
2481839Swollman#define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
24974879Swpaul#define CLSET_ASYNC		19
25078678Siedowse#define CLSET_CONNECT		20	/* Use connect() for UDP. (int) */
2511839Swollman
2521839Swollman/*
2531839Swollman * void
2541839Swollman * CLNT_DESTROY(rh);
2551839Swollman * 	CLIENT *rh;
2561839Swollman */
2571839Swollman#define	CLNT_DESTROY(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
2581839Swollman#define	clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
2591839Swollman
2601839Swollman
2611839Swollman/*
26213771Smpp * RPCTEST is a test program which is accessible on every rpc
2631839Swollman * transport/port.  It is used for testing, performance evaluation,
2641839Swollman * and network administration.
2651839Swollman */
2661839Swollman
26774462Salfred#define RPCTEST_PROGRAM		((rpcprog_t)1)
26874462Salfred#define RPCTEST_VERSION		((rpcvers_t)1)
26974462Salfred#define RPCTEST_NULL_PROC	((rpcproc_t)2)
27074462Salfred#define RPCTEST_NULL_BATCH_PROC	((rpcproc_t)3)
2711839Swollman
2721839Swollman/*
2731839Swollman * By convention, procedure 0 takes null arguments and returns them
2741839Swollman */
2751839Swollman
27674462Salfred#define NULLPROC ((rpcproc_t)0)
2771839Swollman
27899775Salfred__BEGIN_DECLS
2791839Swollman/*
2801839Swollman * Below are the client handle creation routines for the various
2818858Srgrimes * implementations of client side rpc.  They can return NULL if a
2821839Swollman * creation failure occurs.
2831839Swollman */
2841839Swollman
2851839Swollman/*
28674462Salfred * Generic client creation routine. Supported protocols are those that
28774462Salfred * belong to the nettype namespace (/etc/netconfig).
2881839Swollman */
2891903Swollman__BEGIN_DECLS
29093032Simpextern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t,
29193032Simp			   const char *);
29274462Salfred/*
29374462Salfred *
29474462Salfred * 	const char *hostname;			-- hostname
29574462Salfred *	const rpcprog_t prog;			-- program number
29674462Salfred *	const rpcvers_t vers;			-- version number
29774462Salfred *	const char *nettype;			-- network type
29874462Salfred */
2991839Swollman
30099775Salfred /*
30199775Salfred * Generic client creation routine. Just like clnt_create(), except
30299775Salfred * it takes an additional timeout parameter.
30399775Salfred */
30499775Salfredextern CLIENT * clnt_create_timed(const char *, const rpcprog_t,
30599775Salfred	const rpcvers_t, const char *, const struct timeval *);
3061839Swollman/*
30799775Salfred *
30899775Salfred *	const char *hostname;			-- hostname
30999775Salfred *	const rpcprog_t prog;			-- program number
31099775Salfred *	const rpcvers_t vers;			-- version number
31199775Salfred *	const char *nettype;			-- network type
31299775Salfred *	const struct timeval *tp;		-- timeout
31399775Salfred */
31499775Salfred
31599775Salfred/*
31674462Salfred * Generic client creation routine. Supported protocols are which belong
31774462Salfred * to the nettype name space.
3181839Swollman */
31993032Simpextern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,
32093032Simp				const rpcvers_t, const rpcvers_t,
32193032Simp				const char *);
32274462Salfred/*
32374462Salfred *	const char *host;		-- hostname
32474462Salfred *	const rpcprog_t prog;		-- program number
32574462Salfred *	rpcvers_t *vers_out;		-- servers highest available version
32674462Salfred *	const rpcvers_t vers_low;	-- low version number
32774462Salfred *	const rpcvers_t vers_high;	-- high version number
32874462Salfred *	const char *nettype;		-- network type
32974462Salfred */
3301839Swollman
33199775Salfred/*
33299775Salfred * Generic client creation routine. Supported protocols are which belong
33399775Salfred * to the nettype name space.
33499775Salfred */
33599775Salfredextern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,
33699775Salfred	rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,
33799775Salfred	const struct timeval *);
33899775Salfred/*
33999775Salfred *	const char *host;		-- hostname
34099775Salfred *	const rpcprog_t prog;		-- program number
34199775Salfred *	rpcvers_t *vers_out;		-- servers highest available version
34299775Salfred *	const rpcvers_t vers_low;	-- low version number
34399775Salfred *	const rpcvers_t vers_high;	-- high version number
34499775Salfred *	const char *nettype;		-- network type
34599775Salfred *	const struct timeval *tp	-- timeout
34699775Salfred */
3471839Swollman
3481839Swollman/*
34974462Salfred * Generic client creation routine. It takes a netconfig structure
35074462Salfred * instead of nettype
3511839Swollman */
35293032Simpextern CLIENT *clnt_tp_create(const char *, const rpcprog_t,
35393032Simp			      const rpcvers_t, const struct netconfig *);
35474462Salfred/*
35574462Salfred *	const char *hostname;			-- hostname
35674462Salfred *	const rpcprog_t prog;			-- program number
35774462Salfred *	const rpcvers_t vers;			-- version number
35874462Salfred *	const struct netconfig *netconf; 	-- network config structure
35974462Salfred */
3601839Swollman
36174462Salfred/*
36299775Salfred * Generic client creation routine. Just like clnt_tp_create(), except
36399775Salfred * it takes an additional timeout parameter.
36499775Salfred */
36599775Salfredextern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,
36699775Salfred	const rpcvers_t, const struct netconfig *, const struct timeval *);
36799775Salfred/*
36899775Salfred *	const char *hostname;			-- hostname
36999775Salfred *	const rpcprog_t prog;			-- program number
37099775Salfred *	const rpcvers_t vers;			-- version number
37199775Salfred *	const struct netconfig *netconf; 	-- network config structure
37299775Salfred *	const struct timeval *tp		-- timeout
37399775Salfred */
37499775Salfred
37599775Salfred/*
37674462Salfred * Generic TLI create routine. Only provided for compatibility.
37774462Salfred */
3781903Swollman
37993032Simpextern CLIENT *clnt_tli_create(const int, const struct netconfig *,
38099775Salfred			       struct netbuf *, const rpcprog_t,
38193032Simp			       const rpcvers_t, const u_int, const u_int);
3821839Swollman/*
38374462Salfred *	const register int fd;		-- fd
38474462Salfred *	const struct netconfig *nconf;	-- netconfig structure
38599775Salfred *	struct netbuf *svcaddr;		-- servers address
38674462Salfred *	const u_long prog;			-- program number
38774462Salfred *	const u_long vers;			-- version number
38874462Salfred *	const u_int sendsz;			-- send size
38974462Salfred *	const u_int recvsz;			-- recv size
3901839Swollman */
3911839Swollman
39274462Salfred/*
39374462Salfred * Low level clnt create routine for connectionful transports, e.g. tcp.
39474462Salfred */
39593032Simpextern CLIENT *clnt_vc_create(const int, const struct netbuf *,
39693032Simp			      const rpcprog_t, const rpcvers_t,
397100001Salfred			      u_int, u_int);
39874462Salfred/*
39984487Swpaul * Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create().
40084487Swpaul */
40193032Simpextern CLIENT *clntunix_create(struct sockaddr_un *,
40293032Simp			       u_long, u_long, int *, u_int, u_int);
40384487Swpaul/*
40474462Salfred *	const int fd;				-- open file descriptor
40574462Salfred *	const struct netbuf *svcaddr;		-- servers address
40674462Salfred *	const rpcprog_t prog;			-- program number
40774462Salfred *	const rpcvers_t vers;			-- version number
40874462Salfred *	const u_int sendsz;			-- buffer recv size
40974462Salfred *	const u_int recvsz;			-- buffer send size
41074462Salfred */
4111903Swollman
4121839Swollman/*
41374462Salfred * Low level clnt create routine for connectionless transports, e.g. udp.
41474462Salfred */
41593032Simpextern CLIENT *clnt_dg_create(const int, const struct netbuf *,
41693032Simp			      const rpcprog_t, const rpcvers_t,
41793032Simp			      const u_int, const u_int);
41874462Salfred/*
41974462Salfred *	const int fd;				-- open file descriptor
42074462Salfred *	const struct netbuf *svcaddr;		-- servers address
42174462Salfred *	const rpcprog_t program;		-- program number
42274462Salfred *	const rpcvers_t version;		-- version number
42374462Salfred *	const u_int sendsz;			-- buffer recv size
42474462Salfred *	const u_int recvsz;			-- buffer send size
42574462Salfred */
42674462Salfred
42774462Salfred/*
42874462Salfred * Memory based rpc (for speed check and testing)
42926211Swpaul * CLIENT *
43074462Salfred * clnt_raw_create(prog, vers)
43126211Swpaul *	u_long prog;
43274462Salfred *	u_long vers;
43326211Swpaul */
43493032Simpextern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t);
43574462Salfred
43626211Swpaul__END_DECLS
43726211Swpaul
43826211Swpaul
43926211Swpaul/*
4401839Swollman * Print why creation failed
4411839Swollman */
4421903Swollman__BEGIN_DECLS
44393032Simpextern void clnt_pcreateerror(const char *);			/* stderr */
44493032Simpextern char *clnt_spcreateerror(const char *);			/* string */
4451903Swollman__END_DECLS
4461839Swollman
4471839Swollman/*
4481839Swollman * Like clnt_perror(), but is more verbose in its output
4498858Srgrimes */
4501903Swollman__BEGIN_DECLS
45193032Simpextern void clnt_perrno(enum clnt_stat);		/* stderr */
45293032Simpextern char *clnt_sperrno(enum clnt_stat);		/* string */
4531903Swollman__END_DECLS
4541839Swollman
4551839Swollman/*
4561839Swollman * Print an English error message, given the client error code
4571839Swollman */
4581903Swollman__BEGIN_DECLS
45993032Simpextern void clnt_perror(CLIENT *, const char *);	 	/* stderr */
46093032Simpextern char *clnt_sperror(CLIENT *, const char *);		/* string */
4611903Swollman__END_DECLS
4621839Swollman
4631903Swollman
4648858Srgrimes/*
4651839Swollman * If a creation fails, the following allows the user to figure out why.
4661839Swollman */
4671839Swollmanstruct rpc_createerr {
4681839Swollman	enum clnt_stat cf_stat;
4691839Swollman	struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
4701839Swollman};
4711839Swollman
47274462Salfred#ifdef _THREAD_SAFE
47374462Salfred__BEGIN_DECLS
47493032Simpextern struct rpc_createerr	*__rpc_createerr(void);
47574462Salfred__END_DECLS
47674462Salfred#define rpc_createerr		(*(__rpc_createerr()))
47774462Salfred#else
4781839Swollmanextern struct rpc_createerr rpc_createerr;
47974462Salfred#endif /* _THREAD_SAFE */
4801839Swollman
48174462Salfred/*
48274462Salfred * The simplified interface:
48374462Salfred * enum clnt_stat
48474462Salfred * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
48574462Salfred *	const char *host;
48674462Salfred *	const rpcprog_t prognum;
48774462Salfred *	const rpcvers_t versnum;
48874462Salfred *	const rpcproc_t procnum;
48974462Salfred *	const xdrproc_t inproc, outproc;
49074462Salfred *	const char *in;
49174462Salfred *	char *out;
49274462Salfred *	const char *nettype;
49374462Salfred */
49474462Salfred__BEGIN_DECLS
49593032Simpextern enum clnt_stat rpc_call(const char *, const rpcprog_t,
49693032Simp			       const rpcvers_t, const rpcproc_t,
49793032Simp			       const xdrproc_t, const char *,
49893032Simp			       const xdrproc_t, char *, const char *);
49974462Salfred__END_DECLS
5001839Swollman
50174462Salfred/*
50274462Salfred * RPC broadcast interface
50374462Salfred * The call is broadcasted to all locally connected nets.
50474462Salfred *
50574462Salfred * extern enum clnt_stat
50674462Salfred * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
50774462Salfred *			eachresult, nettype)
50874462Salfred *	const rpcprog_t		prog;		-- program number
50974462Salfred *	const rpcvers_t		vers;		-- version number
51074462Salfred *	const rpcproc_t		proc;		-- procedure number
51174462Salfred *	const xdrproc_t	xargs;		-- xdr routine for args
51274462Salfred *	caddr_t		argsp;		-- pointer to args
51374462Salfred *	const xdrproc_t	xresults;	-- xdr routine for results
51474462Salfred *	caddr_t		resultsp;	-- pointer to results
51574462Salfred *	const resultproc_t	eachresult;	-- call with each result
51674462Salfred *	const char		*nettype;	-- Transport type
51774462Salfred *
51874462Salfred * For each valid response received, the procedure eachresult is called.
51974462Salfred * Its form is:
52074462Salfred *		done = eachresult(resp, raddr, nconf)
52174462Salfred *			bool_t done;
52274462Salfred *			caddr_t resp;
52374462Salfred *			struct netbuf *raddr;
52474462Salfred *			struct netconfig *nconf;
52574462Salfred * where resp points to the results of the call and raddr is the
52674462Salfred * address if the responder to the broadcast.  nconf is the transport
52774462Salfred * on which the response was received.
52874462Salfred *
52974462Salfred * extern enum clnt_stat
53074462Salfred * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
53174462Salfred *			eachresult, inittime, waittime, nettype)
53274462Salfred *	const rpcprog_t		prog;		-- program number
53374462Salfred *	const rpcvers_t		vers;		-- version number
53474462Salfred *	const rpcproc_t		proc;		-- procedure number
53574462Salfred *	const xdrproc_t	xargs;		-- xdr routine for args
53674462Salfred *	caddr_t		argsp;		-- pointer to args
53774462Salfred *	const xdrproc_t	xresults;	-- xdr routine for results
53874462Salfred *	caddr_t		resultsp;	-- pointer to results
53974462Salfred *	const resultproc_t	eachresult;	-- call with each result
54074462Salfred *	const int 		inittime;	-- how long to wait initially
54174462Salfred *	const int 		waittime;	-- maximum time to wait
54274462Salfred *	const char		*nettype;	-- Transport type
54374462Salfred */
5441839Swollman
54593032Simptypedef bool_t (*resultproc_t)(caddr_t, ...);
54674462Salfred
54774462Salfred__BEGIN_DECLS
54893032Simpextern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,
54993032Simp				    const rpcproc_t, const xdrproc_t,
55093032Simp				    caddr_t, const xdrproc_t, caddr_t,
55193032Simp				    const resultproc_t, const char *);
55293032Simpextern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,
55393032Simp					const rpcproc_t, const xdrproc_t,
55493032Simp					caddr_t, const xdrproc_t, caddr_t,
55593032Simp					const resultproc_t, const int,
55693032Simp					const int, const char *);
55774462Salfred__END_DECLS
55874462Salfred
55974462Salfred/* For backward compatibility */
56074462Salfred#include <rpc/clnt_soc.h>
56174462Salfred
56274462Salfred#endif /* !_RPC_CLNT_H_ */
563