4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22 * Use is subject to license terms.
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 * The Regents of the University of California
34 * University Acknowledgment- Portions of this document are derived from
35 * software developed by the University of California, Berkeley, and its
41 * The common header declarations
48 #include <rpc/pmap_prot.h>
50 #include <rpc/rpcb_prot.h>
59 extern rwlock_t list_rbl_lock
; /* Protects list_rbl */
60 extern rpcblist_ptr list_rbl
; /* A list of version 3 & 4 rpcbind services */
61 extern char *loopback_dg
; /* CLTS loopback transport, for set/unset */
62 extern char *loopback_vc
; /* COTS loopback transport, for set/unset */
63 extern char *loopback_vc_ord
; /* COTS_ORD loopback transport, for set/unset */
66 extern rwlock_t list_pml_lock
; /* Protects list_pml */
67 extern pmaplist
*list_pml
; /* A list of version 2 rpcbind services */
68 extern char *udptrans
; /* Name of UDP transport */
69 extern char *tcptrans
; /* Name of TCP transport */
70 extern char *udp_uaddr
; /* Universal UDP address */
71 extern char *tcp_uaddr
; /* Universal TCP address */
74 char *mergeaddr(SVCXPRT
*, char *, char *, char *);
75 int add_bndlist(struct netconfig
*, struct t_bind
*, struct t_bind
*);
76 int create_rmtcall_fd(struct netconfig
*);
77 bool_t
is_bound(char *, char *);
78 void set_rpcb_rmtcalls_max(int);
80 /* TCP wrapper functions and variables. */
81 boolean_t
localxprt(SVCXPRT
*, boolean_t
);
82 void qsyslog(int pri
, const char *fmt
, ...);
83 boolean_t
rpcb_check(SVCXPRT
*, rpcproc_t
, boolean_t
);
84 void rpcb_log(boolean_t
, SVCXPRT
*, rpcproc_t
, rpcprog_t
, boolean_t
);
85 extern volatile boolean_t allow_indirect
;
86 extern volatile boolean_t wrap_enabled
;
87 extern volatile boolean_t verboselog
;
88 extern volatile boolean_t local_only
;
90 #define svc_getgencaller(transp) \
91 ((struct sockaddr_gen *)svc_getrpccaller((transp))->buf)
93 #define RPCB_CHECK(xprt, proc) \
94 if ((wrap_enabled || local_only) && \
95 !rpcb_check((xprt), (proc), B_FALSE)) \
98 #define PMAP_CHECK(xprt, proc) \
99 if ((wrap_enabled || local_only) && \
100 !rpcb_check((xprt), (proc), B_TRUE)) \
103 #define PMAP_CHECK_RET(xprt, proc, ret) \
104 if ((wrap_enabled || local_only) && \
105 !rpcb_check((xprt), (proc), B_TRUE)) \
108 #define RPCB_LOG(xprt, proc, prog) \
110 rpcb_log(B_TRUE, (xprt), (proc), (prog), B_FALSE)
112 #define PMAP_LOG(ans, xprt, proc, prog) \
114 rpcb_log(ans, (xprt), (proc), (prog), B_TRUE)
116 bool_t
map_set(RPCB
*, char *);
117 bool_t
map_unset(RPCB
*, char *);
119 /* Statistics gathering functions */
120 void rpcbs_procinfo(int, rpcproc_t
);
121 void rpcbs_set(int, bool_t
);
122 void rpcbs_unset(int, bool_t
);
123 void rpcbs_getaddr(int, rpcprog_t
, rpcvers_t
, char *, char *);
124 void rpcbs_rmtcall(int, rpcproc_t
, rpcprog_t
, rpcvers_t
, rpcproc_t
, char *,
126 bool_t
rpcbproc_getstat(void *, rpcb_stat_byvers
**);
127 bool_t
xdr_rpcb_stat_byvers_ptr(XDR
*, rpcb_stat_byvers
**);
129 struct netconfig
*rpcbind_get_conf();
130 void rpcbind_abort() __NORETURN
;
133 void pmap_service(struct svc_req
*, SVCXPRT
*xprt
);
135 void rpcb_service_3(struct svc_req
*, SVCXPRT
*xprt
);
136 void rpcb_service_4(struct svc_req
*, SVCXPRT
*xprt
);
137 void read_warmstart(void);
138 void write_warmstart(void);
139 int Is_ipv6present(void);
141 extern zoneid_t myzone
;
143 /* Common functions shared between versions */
144 void rpcbproc_callit_com(struct svc_req
*, SVCXPRT
*, ulong_t
, int);
145 bool_t
rpcbproc_set_com(RPCB
*, bool_t
*, struct svc_req
*, int);
146 bool_t
rpcbproc_unset_com(RPCB
*, bool_t
*, struct svc_req
*, int);
147 bool_t
rpcbproc_gettime_com(void *, ulong_t
*);
148 bool_t
rpcbproc_uaddr2taddr_com(char **, struct netbuf
*, struct svc_req
*);
149 bool_t
rpcbproc_taddr2uaddr_com(struct netbuf
*, char **, struct svc_req
*);
150 bool_t
rpcbproc_getaddr_com(RPCB
*, char **, struct svc_req
*, ulong_t
);
151 void delete_prog(rpcprog_t
);
152 bool_t
rpcbproc_dump_com(void *, rpcblist_ptr
**);
153 char *getowner(SVCXPRT
*, char *);
155 int del_pmaplist(RPCB
*);
156 void delete_rbl(rpcblist_ptr
);
158 uid_t
rpcb_caller_uid(SVCXPRT
*);
161 bool_t
xdr_rpcblist_ptr_ptr(XDR
*, rpcblist_ptr
**);
163 /* For different getaddr semantics */
164 #define RPCB_ALLVERS 0
165 #define RPCB_ONEVERS 1
171 #endif /* _RPCBIND_H */