1169092Sdeischen/* $NetBSD: rpcbind.h,v 1.1 2000/06/03 00:47:21 fvdl Exp $ */ 2169092Sdeischen/* $FreeBSD$ */ 3169092Sdeischen 4156608Sdeischen/* 5156608Sdeischen * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 6156608Sdeischen * unrestricted use provided that this legend is included on all tape 7156608Sdeischen * media and as a part of the software program in whole or part. Users 8156608Sdeischen * may copy or modify Sun RPC without charge, but are not authorized 9156608Sdeischen * to license or distribute it to anyone else except as part of a product or 10156608Sdeischen * program developed by the user. 11156608Sdeischen * 12156608Sdeischen * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 13156608Sdeischen * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 14156608Sdeischen * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 15156608Sdeischen * 16156608Sdeischen * Sun RPC is provided with no support and without any obligation on the 17156608Sdeischen * part of Sun Microsystems, Inc. to assist in its use, correction, 18156608Sdeischen * modification or enhancement. 19156608Sdeischen * 20156608Sdeischen * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 21156608Sdeischen * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 22156608Sdeischen * OR ANY PART THEREOF. 23156608Sdeischen * 24156608Sdeischen * In no event will Sun Microsystems, Inc. be liable for any lost revenue 25156608Sdeischen * or profits or other special, indirect and consequential damages, even if 26156608Sdeischen * Sun has been advised of the possibility of such damages. 27156608Sdeischen * 28156608Sdeischen * Sun Microsystems, Inc. 29156608Sdeischen * 2550 Garcia Avenue 30156608Sdeischen * Mountain View, California 94043 31156608Sdeischen */ 32156608Sdeischen/* 33156608Sdeischen * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. 34156608Sdeischen */ 35156608Sdeischen 36156608Sdeischen/* #ident "@(#)rpcbind.h 1.4 90/04/12 SMI" */ 37156608Sdeischen 38156608Sdeischen/* 39156608Sdeischen * rpcbind.h 40156608Sdeischen * The common header declarations 41156608Sdeischen */ 42156608Sdeischen 43156608Sdeischen#ifndef rpcbind_h 44156608Sdeischen#define rpcbind_h 45156608Sdeischen 46156608Sdeischen#ifdef PORTMAP 47156608Sdeischen#include <rpc/pmap_prot.h> 48156608Sdeischen#endif 49156608Sdeischen#include <rpc/rpcb_prot.h> 50156608Sdeischen 51156608Sdeischen/* 52156608Sdeischen * Stuff for the rmtcall service 53156608Sdeischen */ 54156608Sdeischenstruct encap_parms { 55156608Sdeischen u_int32_t arglen; 56156608Sdeischen char *args; 57156608Sdeischen}; 58156608Sdeischen 59156608Sdeischenstruct r_rmtcall_args { 60156608Sdeischen u_int32_t rmt_prog; 61156608Sdeischen u_int32_t rmt_vers; 62156608Sdeischen u_int32_t rmt_proc; 63156608Sdeischen int rmt_localvers; /* whether to send port # or uaddr */ 64156608Sdeischen char *rmt_uaddr; 65156608Sdeischen struct encap_parms rmt_args; 66156608Sdeischen}; 67192586Strasz 68192586Straszextern int debugging; 69194955Straszextern int doabort; 70192586Straszextern int verboselog; 71194955Straszextern int insecure; 72194955Straszextern int oldstyle_local; 73194955Straszextern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */ 74194955Strasz 75192586Strasz#ifdef PORTMAP 76194955Straszextern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ 77194955Straszextern char *udptrans; /* Name of UDP transport */ 78194955Straszextern char *tcptrans; /* Name of TCP transport */ 79194955Straszextern char *udp_uaddr; /* Universal UDP address */ 80192586Straszextern char *tcp_uaddr; /* Universal TCP address */ 81194955Strasz#endif 82194955Strasz 83194955Straszint add_bndlist(struct netconfig *, struct netbuf *); 84194955Straszbool_t is_bound(char *, char *); 85194955Straszchar *mergeaddr(SVCXPRT *, char *, char *, char *); 86192586Straszstruct netconfig *rpcbind_get_conf(const char *); 87 88void rpcbs_init(void); 89void rpcbs_procinfo(rpcvers_t, rpcproc_t); 90void rpcbs_set(rpcvers_t, bool_t); 91void rpcbs_unset(rpcvers_t, bool_t); 92void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, char *, char *); 93void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t, 94 char *, rpcblist_ptr); 95void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t); 96 97void rpcb_service_3(struct svc_req *, SVCXPRT *); 98void rpcb_service_4(struct svc_req *, SVCXPRT *); 99 100/* Common functions shared between versions */ 101void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); 102void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); 103bool_t map_set(RPCB *, char *); 104bool_t map_unset(RPCB *, char *); 105void delete_prog(unsigned int); 106void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t, 107 rpcvers_t); 108void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *, 109 rpcvers_t); 110void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *, 111 SVCXPRT *, rpcvers_t); 112void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *, 113 rpcvers_t); 114int create_rmtcall_fd(struct netconfig *); 115void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t, 116 rpcvers_t); 117void my_svc_run(void); 118 119void rpcbind_abort(void); 120void reap(int); 121void toggle_verboselog(int); 122 123int check_access(SVCXPRT *, rpcproc_t, void *, unsigned int); 124int check_callit(SVCXPRT *, struct r_rmtcall_args *, int); 125void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *); 126int is_loopback(struct netbuf *); 127 128#ifdef PORTMAP 129extern void pmap_service(struct svc_req *, SVCXPRT *); 130#endif 131 132void write_warmstart(void); 133void read_warmstart(void); 134 135char *addrmerge(struct netbuf *caller, const char *serv_uaddr, 136 const char *clnt_uaddr, char const *netid); 137int listen_addr(const struct sockaddr *sa); 138void network_init(void); 139struct sockaddr *local_sa(int); 140 141/* For different getaddr semantics */ 142#define RPCB_ALLVERS 0 143#define RPCB_ONEVERS 1 144 145/* To convert a struct sockaddr to IPv4 or IPv6 address */ 146#define SA2SIN(sa) ((struct sockaddr_in *)(sa)) 147#define SA2SINADDR(sa) (SA2SIN(sa)->sin_addr) 148#ifdef INET6 149#define SA2SIN6(sa) ((struct sockaddr_in6 *)(sa)) 150#define SA2SIN6ADDR(sa) (SA2SIN6(sa)->sin6_addr) 151#endif 152 153#endif /* rpcbind_h */ 154