Sun switched these files to a 3-clause BSD license in 2009.
[dragonfly.git] / usr.sbin / rpcbind / rpcbind.h
blobd434fe97378b27c008aad596eecf75c2771203f4
1 /*
2 * Copyright (c) 2009, Sun Microsystems, Inc.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * - Neither the name of Sun Microsystems, Inc. nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
28 * @(#)rpcbind.h 1.4 90/04/12 SMI
29 * $NetBSD: rpcbind.h,v 1.1 2000/06/03 00:47:21 fvdl Exp $
30 * $FreeBSD: src/usr.sbin/rpcbind/rpcbind.h,v 1.3 2007/11/07 10:53:39 kevlo Exp $
33 * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
37 * rpcbind.h
38 * The common header declarations
41 #ifndef _RPCBIND_H_
42 #define _RPCBIND_H_
44 #ifdef PORTMAP
45 #include <rpc/pmap_prot.h>
46 #endif
47 #include <rpc/rpcb_prot.h>
50 * Stuff for the rmtcall service
52 struct encap_parms {
53 u_int32_t arglen;
54 char *args;
57 struct r_rmtcall_args {
58 u_int32_t rmt_prog;
59 u_int32_t rmt_vers;
60 u_int32_t rmt_proc;
61 int rmt_localvers; /* whether to send port # or uaddr */
62 char *rmt_uaddr;
63 struct encap_parms rmt_args;
66 extern int debugging;
67 extern int doabort;
68 extern int verboselog;
69 extern int insecure;
70 extern int oldstyle_local;
71 extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */
73 #ifdef PORTMAP
74 extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */
75 extern char *udptrans; /* Name of UDP transport */
76 extern char *tcptrans; /* Name of TCP transport */
77 extern char *udp_uaddr; /* Universal UDP address */
78 extern char *tcp_uaddr; /* Universal TCP address */
79 #endif
81 int add_bndlist(struct netconfig *, struct netbuf *);
82 bool_t is_bound(char *, char *);
83 char *mergeaddr(SVCXPRT *, char *, char *, char *);
84 struct netconfig *rpcbind_get_conf(char *);
86 void rpcbs_init(void);
87 void rpcbs_procinfo(rpcvers_t, rpcproc_t);
88 void rpcbs_set(rpcvers_t, bool_t);
89 void rpcbs_unset(rpcvers_t, bool_t);
90 void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, char *, char *);
91 void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t,
92 char *, rpcblist_ptr);
93 void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
95 void rpcb_service_3(struct svc_req *, SVCXPRT *);
96 void rpcb_service_4(struct svc_req *, SVCXPRT *);
98 /* Common functions shared between versions */
99 void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
100 void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
101 bool_t map_set(RPCB *, char *);
102 bool_t map_unset(RPCB *, char *);
103 void delete_prog(unsigned int);
104 void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t,
105 rpcvers_t);
106 void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *,
107 rpcvers_t);
108 void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *,
109 SVCXPRT *, rpcvers_t);
110 void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *,
111 rpcvers_t);
112 int create_rmtcall_fd(struct netconfig *);
113 void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t,
114 rpcvers_t);
115 void my_svc_run(void);
117 void rpcbind_abort(void);
118 void reap(int);
119 void toggle_verboselog(int);
121 int check_access(SVCXPRT *, rpcproc_t, void *, unsigned int);
122 int check_callit(SVCXPRT *, struct r_rmtcall_args *, int);
123 void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *);
124 int is_loopback(struct netbuf *);
126 #ifdef PORTMAP
127 extern void pmap_service(struct svc_req *, SVCXPRT *);
128 #endif
130 void write_warmstart(void);
131 void read_warmstart(void);
133 char *addrmerge(struct netbuf *, char *, char *, char *);
134 void network_init(void);
135 struct sockaddr *local_sa(int);
137 /* For different getaddr semantics */
138 #define RPCB_ALLVERS 0
139 #define RPCB_ONEVERS 1
140 #endif /* _RPCBIND_H_ */