xref: /minix3/tests/fs/nfs/nfsservice/rpcbind/rpcbind.h (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc /*	$NetBSD: rpcbind.h,v 1.1 2010/07/26 15:53:00 pooka Exp $	*/
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc /*
4*11be35a1SLionel Sambuc  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5*11be35a1SLionel Sambuc  * unrestricted use provided that this legend is included on all tape
6*11be35a1SLionel Sambuc  * media and as a part of the software program in whole or part.  Users
7*11be35a1SLionel Sambuc  * may copy or modify Sun RPC without charge, but are not authorized
8*11be35a1SLionel Sambuc  * to license or distribute it to anyone else except as part of a product or
9*11be35a1SLionel Sambuc  * program developed by the user.
10*11be35a1SLionel Sambuc  *
11*11be35a1SLionel Sambuc  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12*11be35a1SLionel Sambuc  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13*11be35a1SLionel Sambuc  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14*11be35a1SLionel Sambuc  *
15*11be35a1SLionel Sambuc  * Sun RPC is provided with no support and without any obligation on the
16*11be35a1SLionel Sambuc  * part of Sun Microsystems, Inc. to assist in its use, correction,
17*11be35a1SLionel Sambuc  * modification or enhancement.
18*11be35a1SLionel Sambuc  *
19*11be35a1SLionel Sambuc  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20*11be35a1SLionel Sambuc  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21*11be35a1SLionel Sambuc  * OR ANY PART THEREOF.
22*11be35a1SLionel Sambuc  *
23*11be35a1SLionel Sambuc  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24*11be35a1SLionel Sambuc  * or profits or other special, indirect and consequential damages, even if
25*11be35a1SLionel Sambuc  * Sun has been advised of the possibility of such damages.
26*11be35a1SLionel Sambuc  *
27*11be35a1SLionel Sambuc  * Sun Microsystems, Inc.
28*11be35a1SLionel Sambuc  * 2550 Garcia Avenue
29*11be35a1SLionel Sambuc  * Mountain View, California  94043
30*11be35a1SLionel Sambuc  */
31*11be35a1SLionel Sambuc /*
32*11be35a1SLionel Sambuc  * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
33*11be35a1SLionel Sambuc  */
34*11be35a1SLionel Sambuc 
35*11be35a1SLionel Sambuc /* #ident	"@(#)rpcbind.h 1.4 90/04/12 SMI" */
36*11be35a1SLionel Sambuc 
37*11be35a1SLionel Sambuc /*
38*11be35a1SLionel Sambuc  * rpcbind.h
39*11be35a1SLionel Sambuc  * The common header declarations
40*11be35a1SLionel Sambuc  */
41*11be35a1SLionel Sambuc 
42*11be35a1SLionel Sambuc #ifndef rpcbind_h
43*11be35a1SLionel Sambuc #define	rpcbind_h
44*11be35a1SLionel Sambuc 
45*11be35a1SLionel Sambuc #ifdef PORTMAP
46*11be35a1SLionel Sambuc #include <rpc/pmap_prot.h>
47*11be35a1SLionel Sambuc #endif
48*11be35a1SLionel Sambuc #include <rpc/rpcb_prot.h>
49*11be35a1SLionel Sambuc 
50*11be35a1SLionel Sambuc /*
51*11be35a1SLionel Sambuc  * Stuff for the rmtcall service
52*11be35a1SLionel Sambuc  */
53*11be35a1SLionel Sambuc struct encap_parms {
54*11be35a1SLionel Sambuc 	u_int32_t arglen;
55*11be35a1SLionel Sambuc 	char *args;
56*11be35a1SLionel Sambuc };
57*11be35a1SLionel Sambuc 
58*11be35a1SLionel Sambuc struct r_rmtcall_args {
59*11be35a1SLionel Sambuc 	u_int32_t  rmt_prog;
60*11be35a1SLionel Sambuc 	u_int32_t  rmt_vers;
61*11be35a1SLionel Sambuc 	u_int32_t  rmt_proc;
62*11be35a1SLionel Sambuc 	int     rmt_localvers;  /* whether to send port # or uaddr */
63*11be35a1SLionel Sambuc 	char    *rmt_uaddr;
64*11be35a1SLionel Sambuc 	struct encap_parms rmt_args;
65*11be35a1SLionel Sambuc };
66*11be35a1SLionel Sambuc 
67*11be35a1SLionel Sambuc extern int debugging;
68*11be35a1SLionel Sambuc extern int doabort;
69*11be35a1SLionel Sambuc extern int verboselog;
70*11be35a1SLionel Sambuc extern int insecure;
71*11be35a1SLionel Sambuc extern int oldstyle_local;
72*11be35a1SLionel Sambuc extern rpcblist_ptr list_rbl;	/* A list of version 3 & 4 rpcbind services */
73*11be35a1SLionel Sambuc 
74*11be35a1SLionel Sambuc #ifdef PORTMAP
75*11be35a1SLionel Sambuc extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */
76*11be35a1SLionel Sambuc extern const char *udptrans;	/* Name of UDP transport */
77*11be35a1SLionel Sambuc extern const char *tcptrans;	/* Name of TCP transport */
78*11be35a1SLionel Sambuc extern const char *udp_uaddr;	/* Universal UDP address */
79*11be35a1SLionel Sambuc extern const char *tcp_uaddr;	/* Universal TCP address */
80*11be35a1SLionel Sambuc #endif
81*11be35a1SLionel Sambuc 
82*11be35a1SLionel Sambuc extern const char rpcbind_superuser[];
83*11be35a1SLionel Sambuc extern const char rpcbind_unknown[];
84*11be35a1SLionel Sambuc 
85*11be35a1SLionel Sambuc int add_bndlist(struct netconfig *, struct netbuf *);
86*11be35a1SLionel Sambuc bool_t is_bound(const char *, const char *);
87*11be35a1SLionel Sambuc char *mergeaddr(SVCXPRT *, char *, char *, char *);
88*11be35a1SLionel Sambuc struct netconfig *rpcbind_get_conf(const char *);
89*11be35a1SLionel Sambuc 
90*11be35a1SLionel Sambuc void rpcbs_init(void);
91*11be35a1SLionel Sambuc void rpcbs_procinfo(rpcvers_t, rpcproc_t);
92*11be35a1SLionel Sambuc void rpcbs_set(rpcvers_t, bool_t);
93*11be35a1SLionel Sambuc void rpcbs_unset(rpcvers_t, bool_t);
94*11be35a1SLionel Sambuc void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, const char *, const char *);
95*11be35a1SLionel Sambuc void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t,
96*11be35a1SLionel Sambuc 			char *, rpcblist_ptr);
97*11be35a1SLionel Sambuc void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
98*11be35a1SLionel Sambuc 
99*11be35a1SLionel Sambuc void rpcb_service_3(struct svc_req *, SVCXPRT *);
100*11be35a1SLionel Sambuc void rpcb_service_4(struct svc_req *, SVCXPRT *);
101*11be35a1SLionel Sambuc 
102*11be35a1SLionel Sambuc /* Common functions shared between versions */
103*11be35a1SLionel Sambuc void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
104*11be35a1SLionel Sambuc void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
105*11be35a1SLionel Sambuc bool_t map_set(RPCB *, char *);
106*11be35a1SLionel Sambuc bool_t map_unset(RPCB *, const char *);
107*11be35a1SLionel Sambuc void delete_prog(int);
108*11be35a1SLionel Sambuc void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t,
109*11be35a1SLionel Sambuc 				 rpcvers_t);
110*11be35a1SLionel Sambuc void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *,
111*11be35a1SLionel Sambuc 				rpcvers_t);
112*11be35a1SLionel Sambuc void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *,
113*11be35a1SLionel Sambuc 					     SVCXPRT *, rpcvers_t);
114*11be35a1SLionel Sambuc void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *,
115*11be35a1SLionel Sambuc 				    rpcvers_t);
116*11be35a1SLionel Sambuc int create_rmtcall_fd(struct netconfig *);
117*11be35a1SLionel Sambuc void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t,
118*11be35a1SLionel Sambuc 			      rpcvers_t);
119*11be35a1SLionel Sambuc void my_svc_run(void);
120*11be35a1SLionel Sambuc 
121*11be35a1SLionel Sambuc void rpcbind_abort(void);
122*11be35a1SLionel Sambuc void reap(int);
123*11be35a1SLionel Sambuc void toggle_verboselog(int);
124*11be35a1SLionel Sambuc 
125*11be35a1SLionel Sambuc int check_access(SVCXPRT *, rpcproc_t, void *, int);
126*11be35a1SLionel Sambuc int check_callit(SVCXPRT *, struct r_rmtcall_args *, int);
127*11be35a1SLionel Sambuc void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *);
128*11be35a1SLionel Sambuc int is_loopback(struct netbuf *);
129*11be35a1SLionel Sambuc 
130*11be35a1SLionel Sambuc #ifdef PORTMAP
131*11be35a1SLionel Sambuc extern void pmap_service(struct svc_req *, SVCXPRT *);
132*11be35a1SLionel Sambuc #endif
133*11be35a1SLionel Sambuc 
134*11be35a1SLionel Sambuc void write_warmstart(void);
135*11be35a1SLionel Sambuc void read_warmstart(void);
136*11be35a1SLionel Sambuc 
137*11be35a1SLionel Sambuc char *addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr,
138*11be35a1SLionel Sambuc 		     char *netid);
139*11be35a1SLionel Sambuc void network_init(void);
140*11be35a1SLionel Sambuc struct sockaddr *local_sa(int);
141*11be35a1SLionel Sambuc 
142*11be35a1SLionel Sambuc /* For different getaddr semantics */
143*11be35a1SLionel Sambuc #define	RPCB_ALLVERS 0
144*11be35a1SLionel Sambuc #define	RPCB_ONEVERS 1
145*11be35a1SLionel Sambuc 
146*11be35a1SLionel Sambuc #endif /* rpcbind_h */
147