1ce0e08e2SPeter Avalos /* 2bd91f5c3SJustin C. Sherrill * Copyright (c) 2009, Sun Microsystems, Inc. 3bd91f5c3SJustin C. Sherrill * All rights reserved. 4ce0e08e2SPeter Avalos * 5bd91f5c3SJustin C. Sherrill * Redistribution and use in source and binary forms, with or without 6bd91f5c3SJustin C. Sherrill * modification, are permitted provided that the following conditions are met: 7bd91f5c3SJustin C. Sherrill * - Redistributions of source code must retain the above copyright notice, 8bd91f5c3SJustin C. Sherrill * this list of conditions and the following disclaimer. 9bd91f5c3SJustin C. Sherrill * - Redistributions in binary form must reproduce the above copyright notice, 10bd91f5c3SJustin C. Sherrill * this list of conditions and the following disclaimer in the documentation 11bd91f5c3SJustin C. Sherrill * and/or other materials provided with the distribution. 12bd91f5c3SJustin C. Sherrill * - Neither the name of Sun Microsystems, Inc. nor the names of its 13bd91f5c3SJustin C. Sherrill * contributors may be used to endorse or promote products derived 14bd91f5c3SJustin C. Sherrill * from this software without specific prior written permission. 15ce0e08e2SPeter Avalos * 16bd91f5c3SJustin C. Sherrill * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17bd91f5c3SJustin C. Sherrill * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18bd91f5c3SJustin C. Sherrill * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19bd91f5c3SJustin C. Sherrill * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20bd91f5c3SJustin C. Sherrill * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21bd91f5c3SJustin C. Sherrill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22bd91f5c3SJustin C. Sherrill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23bd91f5c3SJustin C. Sherrill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24bd91f5c3SJustin C. Sherrill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25bd91f5c3SJustin C. Sherrill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26bd91f5c3SJustin C. Sherrill * POSSIBILITY OF SUCH DAMAGE. 27ce0e08e2SPeter Avalos * 28ce0e08e2SPeter Avalos * @(#)rpcbind.h 1.4 90/04/12 SMI 29ce0e08e2SPeter Avalos * $NetBSD: rpcbind.h,v 1.1 2000/06/03 00:47:21 fvdl Exp $ 30ce0e08e2SPeter Avalos * $FreeBSD: src/usr.sbin/rpcbind/rpcbind.h,v 1.3 2007/11/07 10:53:39 kevlo Exp $ 31ce0e08e2SPeter Avalos */ 32ce0e08e2SPeter Avalos /* 33ce0e08e2SPeter Avalos * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 34ce0e08e2SPeter Avalos */ 35ce0e08e2SPeter Avalos 36ce0e08e2SPeter Avalos /* 37ce0e08e2SPeter Avalos * rpcbind.h 38ce0e08e2SPeter Avalos * The common header declarations 39ce0e08e2SPeter Avalos */ 40ce0e08e2SPeter Avalos 41ce0e08e2SPeter Avalos #ifndef _RPCBIND_H_ 42ce0e08e2SPeter Avalos #define _RPCBIND_H_ 43ce0e08e2SPeter Avalos 44ce0e08e2SPeter Avalos #ifdef PORTMAP 45ce0e08e2SPeter Avalos #include <rpc/pmap_prot.h> 46ce0e08e2SPeter Avalos #endif 47ce0e08e2SPeter Avalos #include <rpc/rpcb_prot.h> 48ce0e08e2SPeter Avalos 49ce0e08e2SPeter Avalos /* 50ce0e08e2SPeter Avalos * Stuff for the rmtcall service 51ce0e08e2SPeter Avalos */ 52ce0e08e2SPeter Avalos struct encap_parms { 53ce0e08e2SPeter Avalos u_int32_t arglen; 54ce0e08e2SPeter Avalos char *args; 55ce0e08e2SPeter Avalos }; 56ce0e08e2SPeter Avalos 57ce0e08e2SPeter Avalos struct r_rmtcall_args { 58ce0e08e2SPeter Avalos u_int32_t rmt_prog; 59ce0e08e2SPeter Avalos u_int32_t rmt_vers; 60ce0e08e2SPeter Avalos u_int32_t rmt_proc; 61ce0e08e2SPeter Avalos int rmt_localvers; /* whether to send port # or uaddr */ 62ce0e08e2SPeter Avalos char *rmt_uaddr; 63ce0e08e2SPeter Avalos struct encap_parms rmt_args; 64ce0e08e2SPeter Avalos }; 65ce0e08e2SPeter Avalos 66ce0e08e2SPeter Avalos extern int debugging; 67ce0e08e2SPeter Avalos extern int doabort; 68ce0e08e2SPeter Avalos extern int verboselog; 69ce0e08e2SPeter Avalos extern int insecure; 70ce0e08e2SPeter Avalos extern int oldstyle_local; 71ce0e08e2SPeter Avalos extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */ 72ce0e08e2SPeter Avalos 73ce0e08e2SPeter Avalos #ifdef PORTMAP 74ce0e08e2SPeter Avalos extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ 75ce0e08e2SPeter Avalos extern char *udptrans; /* Name of UDP transport */ 76ce0e08e2SPeter Avalos extern char *tcptrans; /* Name of TCP transport */ 77ce0e08e2SPeter Avalos extern char *udp_uaddr; /* Universal UDP address */ 78ce0e08e2SPeter Avalos extern char *tcp_uaddr; /* Universal TCP address */ 79ce0e08e2SPeter Avalos #endif 80ce0e08e2SPeter Avalos 81ce0e08e2SPeter Avalos int add_bndlist(struct netconfig *, struct netbuf *); 82ce0e08e2SPeter Avalos bool_t is_bound(char *, char *); 83ce0e08e2SPeter Avalos char *mergeaddr(SVCXPRT *, char *, char *, char *); 84ce0e08e2SPeter Avalos struct netconfig *rpcbind_get_conf(char *); 85ce0e08e2SPeter Avalos 86ce0e08e2SPeter Avalos void rpcbs_init(void); 87ce0e08e2SPeter Avalos void rpcbs_procinfo(rpcvers_t, rpcproc_t); 88ce0e08e2SPeter Avalos void rpcbs_set(rpcvers_t, bool_t); 89ce0e08e2SPeter Avalos void rpcbs_unset(rpcvers_t, bool_t); 90ce0e08e2SPeter Avalos void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, char *, char *); 91ce0e08e2SPeter Avalos void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t, 92ce0e08e2SPeter Avalos char *, rpcblist_ptr); 93ce0e08e2SPeter Avalos void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t); 94ce0e08e2SPeter Avalos 95ce0e08e2SPeter Avalos void rpcb_service_3(struct svc_req *, SVCXPRT *); 96ce0e08e2SPeter Avalos void rpcb_service_4(struct svc_req *, SVCXPRT *); 97ce0e08e2SPeter Avalos 98ce0e08e2SPeter Avalos /* Common functions shared between versions */ 99ce0e08e2SPeter Avalos void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); 100ce0e08e2SPeter Avalos void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); 101ce0e08e2SPeter Avalos bool_t map_set(RPCB *, char *); 102ce0e08e2SPeter Avalos bool_t map_unset(RPCB *, char *); 103ce0e08e2SPeter Avalos void delete_prog(unsigned int); 104ce0e08e2SPeter Avalos void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t, 105ce0e08e2SPeter Avalos rpcvers_t); 106ce0e08e2SPeter Avalos void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *, 107ce0e08e2SPeter Avalos rpcvers_t); 108ce0e08e2SPeter Avalos void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *, 109ce0e08e2SPeter Avalos SVCXPRT *, rpcvers_t); 110ce0e08e2SPeter Avalos void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *, 111ce0e08e2SPeter Avalos rpcvers_t); 112ce0e08e2SPeter Avalos int create_rmtcall_fd(struct netconfig *); 113ce0e08e2SPeter Avalos void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t, 114ce0e08e2SPeter Avalos rpcvers_t); 115*fe08e20dSSascha Wildner void my_svc_run(void) __dead2; 116ce0e08e2SPeter Avalos 117*fe08e20dSSascha Wildner void rpcbind_abort(void) __dead2; 118ce0e08e2SPeter Avalos void reap(int); 119ce0e08e2SPeter Avalos void toggle_verboselog(int); 120ce0e08e2SPeter Avalos 121ce0e08e2SPeter Avalos int check_access(SVCXPRT *, rpcproc_t, void *, unsigned int); 122ce0e08e2SPeter Avalos int check_callit(SVCXPRT *, struct r_rmtcall_args *, int); 123ce0e08e2SPeter Avalos void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *); 124ce0e08e2SPeter Avalos int is_loopback(struct netbuf *); 125ce0e08e2SPeter Avalos 126ce0e08e2SPeter Avalos #ifdef PORTMAP 127ce0e08e2SPeter Avalos extern void pmap_service(struct svc_req *, SVCXPRT *); 128ce0e08e2SPeter Avalos #endif 129ce0e08e2SPeter Avalos 130ce0e08e2SPeter Avalos void write_warmstart(void); 131ce0e08e2SPeter Avalos void read_warmstart(void); 132ce0e08e2SPeter Avalos 133ce0e08e2SPeter Avalos char *addrmerge(struct netbuf *, char *, char *, char *); 134ce0e08e2SPeter Avalos void network_init(void); 135ce0e08e2SPeter Avalos struct sockaddr *local_sa(int); 136ce0e08e2SPeter Avalos 137ce0e08e2SPeter Avalos /* For different getaddr semantics */ 138ce0e08e2SPeter Avalos #define RPCB_ALLVERS 0 139ce0e08e2SPeter Avalos #define RPCB_ONEVERS 1 140ce0e08e2SPeter Avalos #endif /* _RPCBIND_H_ */ 141