174462Salfred/*	$NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $	*/
274462Salfred
3258581Shrs/*-
4258581Shrs * Copyright (c) 2010, Oracle America, Inc.
5258581Shrs * All rights reserved.
699775Salfred *
7258581Shrs * Redistribution and use in source and binary forms, with or without
8258581Shrs * modification, are permitted provided that the following conditions are met:
9258581Shrs * - Redistributions of source code must retain the above copyright notice,
10258581Shrs *   this list of conditions and the following disclaimer.
11258581Shrs * - Redistributions in binary form must reproduce the above copyright notice,
12258581Shrs *   this list of conditions and the following disclaimer in the documentation
13258581Shrs *   and/or other materials provided with the distribution.
14258581Shrs * - Neither the name of the "Oracle America, Inc." nor the names of its
15258581Shrs *   contributors may be used to endorse or promote products derived
16258581Shrs *   from this software without specific prior written permission.
1799775Salfred *
18258581Shrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19258581Shrs * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20258581Shrs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21258581Shrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22258581Shrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23258581Shrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24258581Shrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25258581Shrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26258581Shrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27258581Shrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28258581Shrs * POSSIBILITY OF SUCH DAMAGE.
2999775Salfred *
3074462Salfred *	from: @(#)clnt.h 1.31 94/04/29 SMI
311903Swollman *	from: @(#)clnt.h	2.1 88/07/29 4.0 RPCSRC
3250473Speter * $FreeBSD$
331839Swollman */
341839Swollman
351839Swollman/*
361839Swollman * clnt.h - Client side remote procedure call interface.
371839Swollman */
381839Swollman
391903Swollman#ifndef _RPC_CLNT_H_
401903Swollman#define _RPC_CLNT_H_
4174462Salfred#include <rpc/clnt_stat.h>
421903Swollman#include <sys/cdefs.h>
4374462Salfred#include <netconfig.h>
4426211Swpaul#include <sys/un.h>
451839Swollman
461839Swollman/*
4774462Salfred * Well-known IPV6 RPC broadcast address.
481839Swollman */
4974462Salfred#define RPCB_MULTICAST_ADDR "ff02::202"
501839Swollman
5174462Salfred/*
5274462Salfred * the following errors are in general unrecoverable.  The caller
5374462Salfred * should give up rather than retry.
5474462Salfred */
5574462Salfred#define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \
5674462Salfred	((s) == RPC_CANTENCODEARGS) || \
5774462Salfred	((s) == RPC_CANTDECODERES) || \
5874462Salfred	((s) == RPC_VERSMISMATCH) || \
5974462Salfred	((s) == RPC_PROCUNAVAIL) || \
6074462Salfred	((s) == RPC_PROGUNAVAIL) || \
6174462Salfred	((s) == RPC_PROGVERSMISMATCH) || \
6274462Salfred	((s) == RPC_CANTDECODEARGS))
631839Swollman
641839Swollman/*
651839Swollman * Error info.
661839Swollman */
671839Swollmanstruct rpc_err {
681839Swollman	enum clnt_stat re_status;
691839Swollman	union {
7013771Smpp		int RE_errno;		/* related system error */
711839Swollman		enum auth_stat RE_why;	/* why the auth error occurred */
721839Swollman		struct {
7374462Salfred			rpcvers_t low;	/* lowest version supported */
7474462Salfred			rpcvers_t high;	/* highest version supported */
751839Swollman		} RE_vers;
761839Swollman		struct {		/* maybe meaningful if RPC_FAILED */
7721059Speter			int32_t s1;
7821059Speter			int32_t s2;
791839Swollman		} RE_lb;		/* life boot & debugging only */
801839Swollman	} ru;
811839Swollman#define	re_errno	ru.RE_errno
821839Swollman#define	re_why		ru.RE_why
831839Swollman#define	re_vers		ru.RE_vers
841839Swollman#define	re_lb		ru.RE_lb
851839Swollman};
861839Swollman
871839Swollman
881839Swollman/*
891839Swollman * Client rpc handle.
9074462Salfred * Created by individual implementations
911839Swollman * Client is responsible for initializing auth, see e.g. auth_none.c.
921839Swollman */
9321059Spetertypedef struct __rpc_client {
941839Swollman	AUTH	*cl_auth;			/* authenticator */
951839Swollman	struct clnt_ops {
9621059Speter		/* call remote procedure */
9793032Simp		enum clnt_stat	(*cl_call)(struct __rpc_client *,
9895658Sdes				    rpcproc_t, xdrproc_t, void *, xdrproc_t,
9995658Sdes				        void *, struct timeval);
10021059Speter		/* abort a call */
10193032Simp		void		(*cl_abort)(struct __rpc_client *);
10221059Speter		/* get specific error code */
10393032Simp		void		(*cl_geterr)(struct __rpc_client *,
10493032Simp					struct rpc_err *);
10521059Speter		/* frees results */
10693032Simp		bool_t		(*cl_freeres)(struct __rpc_client *,
10795658Sdes					xdrproc_t, void *);
10821059Speter		/* destroy this structure */
10993032Simp		void		(*cl_destroy)(struct __rpc_client *);
11021059Speter		/* the ioctl() of rpc */
11193032Simp		bool_t          (*cl_control)(struct __rpc_client *, u_int,
11295658Sdes				    void *);
1131839Swollman	} *cl_ops;
11474462Salfred	void 			*cl_private;	/* private stuff */
11574462Salfred	char			*cl_netid;	/* network token */
11674462Salfred	char			*cl_tp;		/* device name */
1171839Swollman} CLIENT;
1181839Swollman
1191839Swollman
1201839Swollman/*
12174462Salfred * Timers used for the pseudo-transport protocol when using datagrams
12274462Salfred */
12374462Salfredstruct rpc_timers {
12474462Salfred	u_short		rt_srtt;	/* smoothed round-trip time */
12574462Salfred	u_short		rt_deviate;	/* estimated deviation */
12674462Salfred	u_long		rt_rtxcur;	/* current (backed-off) rto */
12774462Salfred};
12874462Salfred
12974462Salfred/*
13074462Salfred * Feedback values used for possible congestion and rate control
13174462Salfred */
13274462Salfred#define FEEDBACK_REXMIT1	1	/* first retransmit */
13374462Salfred#define FEEDBACK_OK		2	/* no retransmits */
13474462Salfred
13574462Salfred/* Used to set version of portmapper used in broadcast */
13674462Salfred
13774462Salfred#define CLCR_SET_LOWVERS	3
13874462Salfred#define CLCR_GET_LOWVERS	4
13974462Salfred
14074462Salfred#define RPCSMALLMSGSIZE 400	/* a more reasonable packet size */
14174462Salfred
14274462Salfred/*
1431839Swollman * client side rpc interface ops
1441839Swollman *
1451839Swollman * Parameter types are:
1461839Swollman *
1471839Swollman */
1481839Swollman
1491839Swollman/*
1501839Swollman * enum clnt_stat
1511839Swollman * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)
1521839Swollman * 	CLIENT *rh;
15374462Salfred *	rpcproc_t proc;
1541839Swollman *	xdrproc_t xargs;
15595658Sdes *	void *argsp;
1561839Swollman *	xdrproc_t xres;
15795658Sdes *	void *resp;
1581839Swollman *	struct timeval timeout;
1591839Swollman */
16074462Salfred#define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
16174462Salfred	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
16295658Sdes		argsp, xres, resp, secs))
16374462Salfred#define	clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
16474462Salfred	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \
16595658Sdes		argsp, xres, resp, secs))
1661839Swollman
1671839Swollman/*
1681839Swollman * void
1691839Swollman * CLNT_ABORT(rh);
1701839Swollman * 	CLIENT *rh;
1711839Swollman */
1721839Swollman#define	CLNT_ABORT(rh)	((*(rh)->cl_ops->cl_abort)(rh))
1731839Swollman#define	clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
1741839Swollman
1751839Swollman/*
1761839Swollman * struct rpc_err
1771839Swollman * CLNT_GETERR(rh);
1781839Swollman * 	CLIENT *rh;
1791839Swollman */
1801839Swollman#define	CLNT_GETERR(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
1811839Swollman#define	clnt_geterr(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
1821839Swollman
1831839Swollman
1841839Swollman/*
1851839Swollman * bool_t
1861839Swollman * CLNT_FREERES(rh, xres, resp);
1871839Swollman * 	CLIENT *rh;
1881839Swollman *	xdrproc_t xres;
18995658Sdes *	void *resp;
1901839Swollman */
1911839Swollman#define	CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
1921839Swollman#define	clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
1931839Swollman
1941839Swollman/*
1951839Swollman * bool_t
1961839Swollman * CLNT_CONTROL(cl, request, info)
1971839Swollman *      CLIENT *cl;
1981839Swollman *      u_int request;
1991839Swollman *      char *info;
2001839Swollman */
2011839Swollman#define	CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
2021839Swollman#define	clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
2031839Swollman
2041839Swollman/*
20574462Salfred * control operations that apply to both udp and tcp transports
2061839Swollman */
20774462Salfred#define CLSET_TIMEOUT		1	/* set timeout (timeval) */
20874462Salfred#define CLGET_TIMEOUT		2	/* get timeout (timeval) */
20974462Salfred#define CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
21074462Salfred#define CLGET_FD		6	/* get connections file descriptor */
21174462Salfred#define CLGET_SVC_ADDR		7	/* get server's address (netbuf) */
21274462Salfred#define CLSET_FD_CLOSE		8	/* close fd while clnt_destroy */
21374462Salfred#define CLSET_FD_NCLOSE		9	/* Do not close fd while clnt_destroy */
21474462Salfred#define CLGET_XID 		10	/* Get xid */
21574462Salfred#define CLSET_XID		11	/* Set xid */
21674462Salfred#define CLGET_VERS		12	/* Get version number */
21774462Salfred#define CLSET_VERS		13	/* Set version number */
21874462Salfred#define CLGET_PROG		14	/* Get program number */
21974462Salfred#define CLSET_PROG		15	/* Set program number */
22074462Salfred#define CLSET_SVC_ADDR		16	/* get server's address (netbuf) */
22174462Salfred#define CLSET_PUSH_TIMOD	17	/* push timod if not already present */
22274462Salfred#define CLSET_POP_TIMOD		18	/* pop timod */
2231839Swollman/*
22474462Salfred * Connectionless only control operations
2251839Swollman */
2261839Swollman#define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */
2271839Swollman#define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */
22874879Swpaul#define CLSET_ASYNC		19
22978678Siedowse#define CLSET_CONNECT		20	/* Use connect() for UDP. (int) */
2301839Swollman
2311839Swollman/*
2321839Swollman * void
2331839Swollman * CLNT_DESTROY(rh);
2341839Swollman * 	CLIENT *rh;
2351839Swollman */
2361839Swollman#define	CLNT_DESTROY(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
2371839Swollman#define	clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
2381839Swollman
2391839Swollman
2401839Swollman/*
24113771Smpp * RPCTEST is a test program which is accessible on every rpc
2421839Swollman * transport/port.  It is used for testing, performance evaluation,
2431839Swollman * and network administration.
2441839Swollman */
2451839Swollman
24674462Salfred#define RPCTEST_PROGRAM		((rpcprog_t)1)
24774462Salfred#define RPCTEST_VERSION		((rpcvers_t)1)
24874462Salfred#define RPCTEST_NULL_PROC	((rpcproc_t)2)
24974462Salfred#define RPCTEST_NULL_BATCH_PROC	((rpcproc_t)3)
2501839Swollman
2511839Swollman/*
2521839Swollman * By convention, procedure 0 takes null arguments and returns them
2531839Swollman */
2541839Swollman
25574462Salfred#define NULLPROC ((rpcproc_t)0)
2561839Swollman
2571839Swollman/*
2581839Swollman * Below are the client handle creation routines for the various
2598858Srgrimes * implementations of client side rpc.  They can return NULL if a
2601839Swollman * creation failure occurs.
2611839Swollman */
2621839Swollman
2631839Swollman/*
26474462Salfred * Generic client creation routine. Supported protocols are those that
26574462Salfred * belong to the nettype namespace (/etc/netconfig).
2661839Swollman */
2671903Swollman__BEGIN_DECLS
26893032Simpextern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t,
26993032Simp			   const char *);
27074462Salfred/*
27174462Salfred *
27274462Salfred * 	const char *hostname;			-- hostname
27374462Salfred *	const rpcprog_t prog;			-- program number
27474462Salfred *	const rpcvers_t vers;			-- version number
27574462Salfred *	const char *nettype;			-- network type
27674462Salfred */
2771839Swollman
27899775Salfred /*
27999775Salfred * Generic client creation routine. Just like clnt_create(), except
28099775Salfred * it takes an additional timeout parameter.
28199775Salfred */
28299775Salfredextern CLIENT * clnt_create_timed(const char *, const rpcprog_t,
28399775Salfred	const rpcvers_t, const char *, const struct timeval *);
2841839Swollman/*
28599775Salfred *
28699775Salfred *	const char *hostname;			-- hostname
28799775Salfred *	const rpcprog_t prog;			-- program number
28899775Salfred *	const rpcvers_t vers;			-- version number
28999775Salfred *	const char *nettype;			-- network type
29099775Salfred *	const struct timeval *tp;		-- timeout
29199775Salfred */
29299775Salfred
29399775Salfred/*
29474462Salfred * Generic client creation routine. Supported protocols are which belong
29574462Salfred * to the nettype name space.
2961839Swollman */
29793032Simpextern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,
29893032Simp				const rpcvers_t, const rpcvers_t,
29993032Simp				const char *);
30074462Salfred/*
30174462Salfred *	const char *host;		-- hostname
30274462Salfred *	const rpcprog_t prog;		-- program number
30374462Salfred *	rpcvers_t *vers_out;		-- servers highest available version
30474462Salfred *	const rpcvers_t vers_low;	-- low version number
30574462Salfred *	const rpcvers_t vers_high;	-- high version number
30674462Salfred *	const char *nettype;		-- network type
30774462Salfred */
3081839Swollman
30999775Salfred/*
31099775Salfred * Generic client creation routine. Supported protocols are which belong
31199775Salfred * to the nettype name space.
31299775Salfred */
31399775Salfredextern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,
31499775Salfred	rpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,
31599775Salfred	const struct timeval *);
31699775Salfred/*
31799775Salfred *	const char *host;		-- hostname
31899775Salfred *	const rpcprog_t prog;		-- program number
31999775Salfred *	rpcvers_t *vers_out;		-- servers highest available version
32099775Salfred *	const rpcvers_t vers_low;	-- low version number
32199775Salfred *	const rpcvers_t vers_high;	-- high version number
32299775Salfred *	const char *nettype;		-- network type
32399775Salfred *	const struct timeval *tp	-- timeout
32499775Salfred */
3251839Swollman
3261839Swollman/*
32774462Salfred * Generic client creation routine. It takes a netconfig structure
32874462Salfred * instead of nettype
3291839Swollman */
33093032Simpextern CLIENT *clnt_tp_create(const char *, const rpcprog_t,
33193032Simp			      const rpcvers_t, const struct netconfig *);
33274462Salfred/*
33374462Salfred *	const char *hostname;			-- hostname
33474462Salfred *	const rpcprog_t prog;			-- program number
33574462Salfred *	const rpcvers_t vers;			-- version number
33674462Salfred *	const struct netconfig *netconf; 	-- network config structure
33774462Salfred */
3381839Swollman
33974462Salfred/*
34099775Salfred * Generic client creation routine. Just like clnt_tp_create(), except
34199775Salfred * it takes an additional timeout parameter.
34299775Salfred */
34399775Salfredextern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,
34499775Salfred	const rpcvers_t, const struct netconfig *, const struct timeval *);
34599775Salfred/*
34699775Salfred *	const char *hostname;			-- hostname
34799775Salfred *	const rpcprog_t prog;			-- program number
34899775Salfred *	const rpcvers_t vers;			-- version number
34999775Salfred *	const struct netconfig *netconf; 	-- network config structure
35099775Salfred *	const struct timeval *tp		-- timeout
35199775Salfred */
35299775Salfred
35399775Salfred/*
35474462Salfred * Generic TLI create routine. Only provided for compatibility.
35574462Salfred */
3561903Swollman
35793032Simpextern CLIENT *clnt_tli_create(const int, const struct netconfig *,
35899775Salfred			       struct netbuf *, const rpcprog_t,
35993032Simp			       const rpcvers_t, const u_int, const u_int);
3601839Swollman/*
36174462Salfred *	const register int fd;		-- fd
36274462Salfred *	const struct netconfig *nconf;	-- netconfig structure
36399775Salfred *	struct netbuf *svcaddr;		-- servers address
36474462Salfred *	const u_long prog;			-- program number
36574462Salfred *	const u_long vers;			-- version number
36674462Salfred *	const u_int sendsz;			-- send size
36774462Salfred *	const u_int recvsz;			-- recv size
3681839Swollman */
3691839Swollman
37074462Salfred/*
37174462Salfred * Low level clnt create routine for connectionful transports, e.g. tcp.
37274462Salfred */
37393032Simpextern CLIENT *clnt_vc_create(const int, const struct netbuf *,
37493032Simp			      const rpcprog_t, const rpcvers_t,
375100001Salfred			      u_int, u_int);
37674462Salfred/*
37784487Swpaul * Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create().
37884487Swpaul */
37993032Simpextern CLIENT *clntunix_create(struct sockaddr_un *,
38093032Simp			       u_long, u_long, int *, u_int, u_int);
38184487Swpaul/*
38274462Salfred *	const int fd;				-- open file descriptor
38374462Salfred *	const struct netbuf *svcaddr;		-- servers address
38474462Salfred *	const rpcprog_t prog;			-- program number
38574462Salfred *	const rpcvers_t vers;			-- version number
38674462Salfred *	const u_int sendsz;			-- buffer recv size
38774462Salfred *	const u_int recvsz;			-- buffer send size
38874462Salfred */
3891903Swollman
3901839Swollman/*
39174462Salfred * Low level clnt create routine for connectionless transports, e.g. udp.
39274462Salfred */
39393032Simpextern CLIENT *clnt_dg_create(const int, const struct netbuf *,
39493032Simp			      const rpcprog_t, const rpcvers_t,
39593032Simp			      const u_int, const u_int);
39674462Salfred/*
39774462Salfred *	const int fd;				-- open file descriptor
39874462Salfred *	const struct netbuf *svcaddr;		-- servers address
39974462Salfred *	const rpcprog_t program;		-- program number
40074462Salfred *	const rpcvers_t version;		-- version number
40174462Salfred *	const u_int sendsz;			-- buffer recv size
40274462Salfred *	const u_int recvsz;			-- buffer send size
40374462Salfred */
40474462Salfred
40574462Salfred/*
40674462Salfred * Memory based rpc (for speed check and testing)
40726211Swpaul * CLIENT *
40874462Salfred * clnt_raw_create(prog, vers)
40926211Swpaul *	u_long prog;
41074462Salfred *	u_long vers;
41126211Swpaul */
41293032Simpextern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t);
41374462Salfred
41426211Swpaul__END_DECLS
41526211Swpaul
41626211Swpaul
41726211Swpaul/*
4181839Swollman * Print why creation failed
4191839Swollman */
4201903Swollman__BEGIN_DECLS
42193032Simpextern void clnt_pcreateerror(const char *);			/* stderr */
42293032Simpextern char *clnt_spcreateerror(const char *);			/* string */
4231903Swollman__END_DECLS
4241839Swollman
4251839Swollman/*
4261839Swollman * Like clnt_perror(), but is more verbose in its output
4278858Srgrimes */
4281903Swollman__BEGIN_DECLS
42993032Simpextern void clnt_perrno(enum clnt_stat);		/* stderr */
43093032Simpextern char *clnt_sperrno(enum clnt_stat);		/* string */
4311903Swollman__END_DECLS
4321839Swollman
4331839Swollman/*
4341839Swollman * Print an English error message, given the client error code
4351839Swollman */
4361903Swollman__BEGIN_DECLS
43793032Simpextern void clnt_perror(CLIENT *, const char *);	 	/* stderr */
43893032Simpextern char *clnt_sperror(CLIENT *, const char *);		/* string */
4391903Swollman__END_DECLS
4401839Swollman
4411903Swollman
4428858Srgrimes/*
4431839Swollman * If a creation fails, the following allows the user to figure out why.
4441839Swollman */
4451839Swollmanstruct rpc_createerr {
4461839Swollman	enum clnt_stat cf_stat;
4471839Swollman	struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
4481839Swollman};
4491839Swollman
45074462Salfred__BEGIN_DECLS
45193032Simpextern struct rpc_createerr	*__rpc_createerr(void);
45274462Salfred__END_DECLS
45374462Salfred#define rpc_createerr		(*(__rpc_createerr()))
4541839Swollman
45574462Salfred/*
45674462Salfred * The simplified interface:
45774462Salfred * enum clnt_stat
45874462Salfred * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
45974462Salfred *	const char *host;
46074462Salfred *	const rpcprog_t prognum;
46174462Salfred *	const rpcvers_t versnum;
46274462Salfred *	const rpcproc_t procnum;
46374462Salfred *	const xdrproc_t inproc, outproc;
46474462Salfred *	const char *in;
46574462Salfred *	char *out;
46674462Salfred *	const char *nettype;
46774462Salfred */
46874462Salfred__BEGIN_DECLS
46993032Simpextern enum clnt_stat rpc_call(const char *, const rpcprog_t,
47093032Simp			       const rpcvers_t, const rpcproc_t,
47193032Simp			       const xdrproc_t, const char *,
47293032Simp			       const xdrproc_t, char *, const char *);
47374462Salfred__END_DECLS
4741839Swollman
47574462Salfred/*
47674462Salfred * RPC broadcast interface
47774462Salfred * The call is broadcasted to all locally connected nets.
47874462Salfred *
47974462Salfred * extern enum clnt_stat
48074462Salfred * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
48174462Salfred *			eachresult, nettype)
48274462Salfred *	const rpcprog_t		prog;		-- program number
48374462Salfred *	const rpcvers_t		vers;		-- version number
48474462Salfred *	const rpcproc_t		proc;		-- procedure number
48574462Salfred *	const xdrproc_t	xargs;		-- xdr routine for args
48674462Salfred *	caddr_t		argsp;		-- pointer to args
48774462Salfred *	const xdrproc_t	xresults;	-- xdr routine for results
48874462Salfred *	caddr_t		resultsp;	-- pointer to results
48974462Salfred *	const resultproc_t	eachresult;	-- call with each result
49074462Salfred *	const char		*nettype;	-- Transport type
49174462Salfred *
49274462Salfred * For each valid response received, the procedure eachresult is called.
49374462Salfred * Its form is:
49474462Salfred *		done = eachresult(resp, raddr, nconf)
49574462Salfred *			bool_t done;
49674462Salfred *			caddr_t resp;
49774462Salfred *			struct netbuf *raddr;
49874462Salfred *			struct netconfig *nconf;
49974462Salfred * where resp points to the results of the call and raddr is the
50074462Salfred * address if the responder to the broadcast.  nconf is the transport
50174462Salfred * on which the response was received.
50274462Salfred *
50374462Salfred * extern enum clnt_stat
50474462Salfred * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
50574462Salfred *			eachresult, inittime, waittime, nettype)
50674462Salfred *	const rpcprog_t		prog;		-- program number
50774462Salfred *	const rpcvers_t		vers;		-- version number
50874462Salfred *	const rpcproc_t		proc;		-- procedure number
50974462Salfred *	const xdrproc_t	xargs;		-- xdr routine for args
51074462Salfred *	caddr_t		argsp;		-- pointer to args
51174462Salfred *	const xdrproc_t	xresults;	-- xdr routine for results
51274462Salfred *	caddr_t		resultsp;	-- pointer to results
51374462Salfred *	const resultproc_t	eachresult;	-- call with each result
51474462Salfred *	const int 		inittime;	-- how long to wait initially
51574462Salfred *	const int 		waittime;	-- maximum time to wait
51674462Salfred *	const char		*nettype;	-- Transport type
51774462Salfred */
5181839Swollman
51993032Simptypedef bool_t (*resultproc_t)(caddr_t, ...);
52074462Salfred
52174462Salfred__BEGIN_DECLS
52293032Simpextern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,
52393032Simp				    const rpcproc_t, const xdrproc_t,
52493032Simp				    caddr_t, const xdrproc_t, caddr_t,
52593032Simp				    const resultproc_t, const char *);
52693032Simpextern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,
52793032Simp					const rpcproc_t, const xdrproc_t,
52893032Simp					caddr_t, const xdrproc_t, caddr_t,
52993032Simp					const resultproc_t, const int,
53093032Simp					const int, const char *);
53174462Salfred__END_DECLS
53274462Salfred
53374462Salfred/* For backward compatibility */
53474462Salfred#include <rpc/clnt_soc.h>
53574462Salfred
53674462Salfred#endif /* !_RPC_CLNT_H_ */
537