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