xref: /illumos-gate/usr/src/cmd/rpcbind/rpcbind.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */
28*7c478bd9Sstevel@tonic-gate /*
29*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
30*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
31*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
32*7c478bd9Sstevel@tonic-gate  *
33*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
34*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
35*7c478bd9Sstevel@tonic-gate  * contributors.
36*7c478bd9Sstevel@tonic-gate  */
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /*
39*7c478bd9Sstevel@tonic-gate  * rpcbind.h
40*7c478bd9Sstevel@tonic-gate  * The common header declarations
41*7c478bd9Sstevel@tonic-gate  */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #ifndef _RPCBIND_H
44*7c478bd9Sstevel@tonic-gate #define	_RPCBIND_H
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #ifdef PORTMAP
49*7c478bd9Sstevel@tonic-gate #include <rpc/pmap_prot.h>
50*7c478bd9Sstevel@tonic-gate #endif
51*7c478bd9Sstevel@tonic-gate #include <rpc/rpcb_prot.h>
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate #include <tcpd.h>
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
56*7c478bd9Sstevel@tonic-gate extern "C" {
57*7c478bd9Sstevel@tonic-gate #endif
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate extern int debugging;
60*7c478bd9Sstevel@tonic-gate extern int doabort;
61*7c478bd9Sstevel@tonic-gate extern rpcblist_ptr list_rbl;	/* A list of version 3 & 4 rpcbind services */
62*7c478bd9Sstevel@tonic-gate extern char *loopback_dg;	/* CLTS loopback transport, for set/unset */
63*7c478bd9Sstevel@tonic-gate extern char *loopback_vc;	/* COTS loopback transport, for set/unset */
64*7c478bd9Sstevel@tonic-gate extern char *loopback_vc_ord;	/* COTS_ORD loopback transport, for set/unset */
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate #ifdef PORTMAP
67*7c478bd9Sstevel@tonic-gate extern pmaplist *list_pml;	/* A list of version 2 rpcbind services */
68*7c478bd9Sstevel@tonic-gate extern char *udptrans;		/* Name of UDP transport */
69*7c478bd9Sstevel@tonic-gate extern char *tcptrans;		/* Name of TCP transport */
70*7c478bd9Sstevel@tonic-gate extern char *udp_uaddr;		/* Universal UDP address */
71*7c478bd9Sstevel@tonic-gate extern char *tcp_uaddr;		/* Universal TCP address */
72*7c478bd9Sstevel@tonic-gate #endif
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate extern char *mergeaddr();
75*7c478bd9Sstevel@tonic-gate extern int add_bndlist();
76*7c478bd9Sstevel@tonic-gate extern int create_rmtcall_fd();
77*7c478bd9Sstevel@tonic-gate extern bool_t is_bound();
78*7c478bd9Sstevel@tonic-gate extern void my_svc_run();
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /* TCP wrapper functions and variables. */
81*7c478bd9Sstevel@tonic-gate extern boolean_t localxprt(SVCXPRT *, boolean_t);
82*7c478bd9Sstevel@tonic-gate extern void qsyslog(int pri, const char *fmt, ...);
83*7c478bd9Sstevel@tonic-gate extern boolean_t rpcb_check(SVCXPRT *, rpcproc_t, boolean_t);
84*7c478bd9Sstevel@tonic-gate extern void rpcb_log(boolean_t, SVCXPRT *, rpcproc_t, rpcprog_t, boolean_t);
85*7c478bd9Sstevel@tonic-gate extern boolean_t allow_indirect, wrap_enabled, verboselog;
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate #define	svc_getgencaller(transp) \
88*7c478bd9Sstevel@tonic-gate 	((struct sockaddr_gen *)svc_getrpccaller((transp))->buf)
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate #define	RPCB_CHECK(xprt, proc) \
91*7c478bd9Sstevel@tonic-gate 	if (wrap_enabled && !rpcb_check((xprt), (proc), B_FALSE)) \
92*7c478bd9Sstevel@tonic-gate 		return
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate #define	PMAP_CHECK(xprt, proc) \
95*7c478bd9Sstevel@tonic-gate 	if (wrap_enabled && !rpcb_check((xprt), (proc), B_TRUE)) \
96*7c478bd9Sstevel@tonic-gate 		return
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate #define	PMAP_CHECK_RET(xprt, proc, ret) \
99*7c478bd9Sstevel@tonic-gate 	if (wrap_enabled && !rpcb_check((xprt), (proc), B_TRUE)) \
100*7c478bd9Sstevel@tonic-gate 		return (ret)
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate #define	RPCB_LOG(xprt, proc, prog) \
103*7c478bd9Sstevel@tonic-gate 	if (wrap_enabled) \
104*7c478bd9Sstevel@tonic-gate 	    rpcb_log(B_TRUE, (xprt), (proc), (prog), B_FALSE)
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate #define	PMAP_LOG(ans, xprt, proc, prog) \
107*7c478bd9Sstevel@tonic-gate 	if (wrap_enabled) \
108*7c478bd9Sstevel@tonic-gate 	    rpcb_log(ans, (xprt), (proc), (prog), B_TRUE)
109*7c478bd9Sstevel@tonic-gate 
110*7c478bd9Sstevel@tonic-gate extern bool_t map_set(), map_unset();
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate /* Statistics gathering functions */
113*7c478bd9Sstevel@tonic-gate extern void rpcbs_procinfo();
114*7c478bd9Sstevel@tonic-gate extern void rpcbs_set();
115*7c478bd9Sstevel@tonic-gate extern void rpcbs_unset();
116*7c478bd9Sstevel@tonic-gate extern void rpcbs_getaddr();
117*7c478bd9Sstevel@tonic-gate extern void rpcbs_rmtcall();
118*7c478bd9Sstevel@tonic-gate extern rpcb_stat_byvers *rpcbproc_getstat();
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate extern struct netconfig *rpcbind_get_conf();
121*7c478bd9Sstevel@tonic-gate extern void rpcbind_abort();
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate /* Common functions shared between versions */
124*7c478bd9Sstevel@tonic-gate extern void rpcbproc_callit_com();
125*7c478bd9Sstevel@tonic-gate extern bool_t *rpcbproc_set_com();
126*7c478bd9Sstevel@tonic-gate extern bool_t *rpcbproc_unset_com();
127*7c478bd9Sstevel@tonic-gate extern ulong_t *rpcbproc_gettime_com();
128*7c478bd9Sstevel@tonic-gate extern struct netbuf *rpcbproc_uaddr2taddr_com();
129*7c478bd9Sstevel@tonic-gate extern char **rpcbproc_taddr2uaddr_com();
130*7c478bd9Sstevel@tonic-gate extern char **rpcbproc_getaddr_com();
131*7c478bd9Sstevel@tonic-gate extern void delete_prog();
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate extern uid_t rpcb_caller_uid(SVCXPRT *);
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate /* For different getaddr semantics */
136*7c478bd9Sstevel@tonic-gate #define	RPCB_ALLVERS 0
137*7c478bd9Sstevel@tonic-gate #define	RPCB_ONEVERS 1
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
140*7c478bd9Sstevel@tonic-gate }
141*7c478bd9Sstevel@tonic-gate #endif
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate #endif /* _RPCBIND_H */
144