xref: /onnv-gate/usr/src/cmd/rpcbind/rpcbind.h (revision 2128:6403b9743e73)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52104Sjjj  * Common Development and Distribution License (the "License").
62104Sjjj  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
202104Sjjj  *
212104Sjjj  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
220Sstevel@tonic-gate  * Use is subject to license terms.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
250Sstevel@tonic-gate /* All Rights Reserved */
260Sstevel@tonic-gate /*
270Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
280Sstevel@tonic-gate  * The Regents of the University of California
290Sstevel@tonic-gate  * All Rights Reserved
300Sstevel@tonic-gate  *
310Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
320Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
330Sstevel@tonic-gate  * contributors.
340Sstevel@tonic-gate  */
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * rpcbind.h
380Sstevel@tonic-gate  * The common header declarations
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #ifndef _RPCBIND_H
420Sstevel@tonic-gate #define	_RPCBIND_H
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
450Sstevel@tonic-gate 
460Sstevel@tonic-gate #ifdef PORTMAP
470Sstevel@tonic-gate #include <rpc/pmap_prot.h>
480Sstevel@tonic-gate #endif
490Sstevel@tonic-gate #include <rpc/rpcb_prot.h>
50*2128Sjjj #include <signal.h>
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #include <tcpd.h>
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #ifdef	__cplusplus
550Sstevel@tonic-gate extern "C" {
560Sstevel@tonic-gate #endif
570Sstevel@tonic-gate 
580Sstevel@tonic-gate extern int debugging;
590Sstevel@tonic-gate extern int doabort;
600Sstevel@tonic-gate extern rpcblist_ptr list_rbl;	/* A list of version 3 & 4 rpcbind services */
610Sstevel@tonic-gate extern char *loopback_dg;	/* CLTS loopback transport, for set/unset */
620Sstevel@tonic-gate extern char *loopback_vc;	/* COTS loopback transport, for set/unset */
630Sstevel@tonic-gate extern char *loopback_vc_ord;	/* COTS_ORD loopback transport, for set/unset */
64*2128Sjjj extern volatile sig_atomic_t sigrefresh; /* Did we receive a SIGHUP recently? */
650Sstevel@tonic-gate 
660Sstevel@tonic-gate #ifdef PORTMAP
670Sstevel@tonic-gate extern pmaplist *list_pml;	/* A list of version 2 rpcbind services */
680Sstevel@tonic-gate extern char *udptrans;		/* Name of UDP transport */
690Sstevel@tonic-gate extern char *tcptrans;		/* Name of TCP transport */
700Sstevel@tonic-gate extern char *udp_uaddr;		/* Universal UDP address */
710Sstevel@tonic-gate extern char *tcp_uaddr;		/* Universal TCP address */
720Sstevel@tonic-gate #endif
730Sstevel@tonic-gate 
740Sstevel@tonic-gate extern char *mergeaddr();
750Sstevel@tonic-gate extern int add_bndlist();
760Sstevel@tonic-gate extern int create_rmtcall_fd();
770Sstevel@tonic-gate extern bool_t is_bound();
780Sstevel@tonic-gate extern void my_svc_run();
79*2128Sjjj extern void rpcb_check_init(void);
800Sstevel@tonic-gate 
810Sstevel@tonic-gate /* TCP wrapper functions and variables. */
820Sstevel@tonic-gate extern boolean_t localxprt(SVCXPRT *, boolean_t);
830Sstevel@tonic-gate extern void qsyslog(int pri, const char *fmt, ...);
840Sstevel@tonic-gate extern boolean_t rpcb_check(SVCXPRT *, rpcproc_t, boolean_t);
850Sstevel@tonic-gate extern void rpcb_log(boolean_t, SVCXPRT *, rpcproc_t, rpcprog_t, boolean_t);
862104Sjjj extern boolean_t allow_indirect, wrap_enabled, verboselog, local_only;
870Sstevel@tonic-gate 
880Sstevel@tonic-gate #define	svc_getgencaller(transp) \
890Sstevel@tonic-gate 	((struct sockaddr_gen *)svc_getrpccaller((transp))->buf)
900Sstevel@tonic-gate 
910Sstevel@tonic-gate #define	RPCB_CHECK(xprt, proc) \
922104Sjjj 	if ((wrap_enabled || local_only) && \
932104Sjjj 	    !rpcb_check((xprt), (proc), B_FALSE)) \
940Sstevel@tonic-gate 		return
950Sstevel@tonic-gate 
960Sstevel@tonic-gate #define	PMAP_CHECK(xprt, proc) \
972104Sjjj 	if ((wrap_enabled || local_only) && \
982104Sjjj 	    !rpcb_check((xprt), (proc), B_TRUE)) \
990Sstevel@tonic-gate 		return
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate #define	PMAP_CHECK_RET(xprt, proc, ret) \
1022104Sjjj 	if ((wrap_enabled || local_only) && \
1032104Sjjj 	    !rpcb_check((xprt), (proc), B_TRUE)) \
1040Sstevel@tonic-gate 		return (ret)
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate #define	RPCB_LOG(xprt, proc, prog) \
1070Sstevel@tonic-gate 	if (wrap_enabled) \
1080Sstevel@tonic-gate 	    rpcb_log(B_TRUE, (xprt), (proc), (prog), B_FALSE)
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate #define	PMAP_LOG(ans, xprt, proc, prog) \
1110Sstevel@tonic-gate 	if (wrap_enabled) \
1120Sstevel@tonic-gate 	    rpcb_log(ans, (xprt), (proc), (prog), B_TRUE)
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate extern bool_t map_set(), map_unset();
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate /* Statistics gathering functions */
1170Sstevel@tonic-gate extern void rpcbs_procinfo();
1180Sstevel@tonic-gate extern void rpcbs_set();
1190Sstevel@tonic-gate extern void rpcbs_unset();
1200Sstevel@tonic-gate extern void rpcbs_getaddr();
1210Sstevel@tonic-gate extern void rpcbs_rmtcall();
1220Sstevel@tonic-gate extern rpcb_stat_byvers *rpcbproc_getstat();
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate extern struct netconfig *rpcbind_get_conf();
125482Sssdevi extern void rpcbind_abort() __NORETURN;
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate /* Common functions shared between versions */
1280Sstevel@tonic-gate extern void rpcbproc_callit_com();
1290Sstevel@tonic-gate extern bool_t *rpcbproc_set_com();
1300Sstevel@tonic-gate extern bool_t *rpcbproc_unset_com();
1310Sstevel@tonic-gate extern ulong_t *rpcbproc_gettime_com();
1320Sstevel@tonic-gate extern struct netbuf *rpcbproc_uaddr2taddr_com();
1330Sstevel@tonic-gate extern char **rpcbproc_taddr2uaddr_com();
1340Sstevel@tonic-gate extern char **rpcbproc_getaddr_com();
1350Sstevel@tonic-gate extern void delete_prog();
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate extern uid_t rpcb_caller_uid(SVCXPRT *);
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate /* For different getaddr semantics */
1400Sstevel@tonic-gate #define	RPCB_ALLVERS 0
1410Sstevel@tonic-gate #define	RPCB_ONEVERS 1
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate #ifdef	__cplusplus
1440Sstevel@tonic-gate }
1450Sstevel@tonic-gate #endif
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate #endif /* _RPCBIND_H */
148