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