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