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