1 /* $NetBSD: rpcbind.h,v 1.1 2000/06/03 00:47:21 fvdl Exp $ */
5 * Copyright (c) 2009, Sun Microsystems, Inc.
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.
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.
32 * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
35 /* #ident "@(#)rpcbind.h 1.4 90/04/12 SMI" */
39 * The common header declarations
46 #include <rpc/pmap_prot.h>
48 #include <rpc/rpcb_prot.h>
51 * Stuff for the rmtcall service
58 struct r_rmtcall_args {
62 int rmt_localvers; /* whether to send port # or uaddr */
64 struct encap_parms rmt_args;
72 extern int verboselog;
74 extern int oldstyle_local;
75 extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */
78 extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */
79 extern char *udptrans; /* Name of UDP transport */
80 extern char *tcptrans; /* Name of TCP transport */
81 extern char *udp_uaddr; /* Universal UDP address */
82 extern char *tcp_uaddr; /* Universal TCP address */
85 int add_bndlist(struct netconfig *, struct netbuf *);
86 bool_t is_bound(char *, char *);
87 char *mergeaddr(SVCXPRT *, char *, char *, char *);
88 struct netconfig *rpcbind_get_conf(const char *);
90 void rpcbs_init(void);
91 void rpcbs_procinfo(rpcvers_t, rpcproc_t);
92 void rpcbs_set(rpcvers_t, bool_t);
93 void rpcbs_unset(rpcvers_t, bool_t);
94 void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, char *, char *);
95 void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t,
96 char *, rpcblist_ptr);
97 void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
99 void rpcb_service_3(struct svc_req *, SVCXPRT *);
100 void rpcb_service_4(struct svc_req *, SVCXPRT *);
102 /* Common functions shared between versions */
103 void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
104 void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
105 bool_t map_set(RPCB *, char *);
106 bool_t map_unset(RPCB *, char *);
107 void delete_prog(unsigned int);
108 void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t,
110 void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *,
112 void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *,
113 SVCXPRT *, rpcvers_t);
114 void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *,
116 int create_rmtcall_fd(struct netconfig *);
117 void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t,
119 void my_svc_run(void);
121 void rpcbind_abort(void);
123 void toggle_verboselog(int);
125 int check_access(SVCXPRT *, rpcproc_t, void *, unsigned int);
126 int check_callit(SVCXPRT *, struct r_rmtcall_args *, int);
127 void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *);
128 int is_loopback(struct netbuf *);
131 extern void pmap_service(struct svc_req *, SVCXPRT *);
134 void write_warmstart(void);
135 void read_warmstart(void);
137 char *addrmerge(struct netbuf *caller, const char *serv_uaddr,
138 const char *clnt_uaddr, char const *netid);
139 int listen_addr(const struct sockaddr *sa);
140 void network_init(void);
141 struct sockaddr *local_sa(int);
143 /* For different getaddr semantics */
144 #define RPCB_ALLVERS 0
145 #define RPCB_ONEVERS 1
147 /* To convert a struct sockaddr to IPv4 or IPv6 address */
148 #define SA2SIN(sa) ((struct sockaddr_in *)(sa))
149 #define SA2SINADDR(sa) (SA2SIN(sa)->sin_addr)
151 #define SA2SIN6(sa) ((struct sockaddr_in6 *)(sa))
152 #define SA2SIN6ADDR(sa) (SA2SIN6(sa)->sin6_addr)
155 #endif /* rpcbind_h */