1 /* $NetBSD: rpcbind.h,v 1.1 2000/06/03 00:47:21 fvdl Exp $ */
5 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
6 * unrestricted use provided that this legend is included on all tape
7 * media and as a part of the software program in whole or part. Users
8 * may copy or modify Sun RPC without charge, but are not authorized
9 * to license or distribute it to anyone else except as part of a product or
10 * program developed by the user.
12 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
13 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
14 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
16 * Sun RPC is provided with no support and without any obligation on the
17 * part of Sun Microsystems, Inc. to assist in its use, correction,
18 * modification or enhancement.
20 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
21 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
22 * OR ANY PART THEREOF.
24 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
25 * or profits or other special, indirect and consequential damages, even if
26 * Sun has been advised of the possibility of such damages.
28 * Sun Microsystems, Inc.
30 * Mountain View, California 94043
33 * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
36 /* #ident "@(#)rpcbind.h 1.4 90/04/12 SMI" */
40 * The common header declarations
47 #include <rpc/pmap_prot.h>
49 #include <rpc/rpcb_prot.h>
52 * Stuff for the rmtcall service
59 struct r_rmtcall_args {
63 int rmt_localvers; /* whether to send port # or uaddr */
65 struct encap_parms rmt_args;
70 extern int verboselog;
72 extern int oldstyle_local;
73 extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */
76 extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */
77 extern char *udptrans; /* Name of UDP transport */
78 extern char *tcptrans; /* Name of TCP transport */
79 extern char *udp_uaddr; /* Universal UDP address */
80 extern char *tcp_uaddr; /* Universal TCP address */
83 int add_bndlist(struct netconfig *, struct netbuf *);
84 bool_t is_bound(char *, char *);
85 char *mergeaddr(SVCXPRT *, char *, char *, char *);
86 struct netconfig *rpcbind_get_conf(const char *);
88 void rpcbs_init(void);
89 void rpcbs_procinfo(rpcvers_t, rpcproc_t);
90 void rpcbs_set(rpcvers_t, bool_t);
91 void rpcbs_unset(rpcvers_t, bool_t);
92 void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, char *, char *);
93 void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t,
94 char *, rpcblist_ptr);
95 void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
97 void rpcb_service_3(struct svc_req *, SVCXPRT *);
98 void rpcb_service_4(struct svc_req *, SVCXPRT *);
100 /* Common functions shared between versions */
101 void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
102 void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t);
103 bool_t map_set(RPCB *, char *);
104 bool_t map_unset(RPCB *, char *);
105 void delete_prog(unsigned int);
106 void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t,
108 void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *,
110 void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *,
111 SVCXPRT *, rpcvers_t);
112 void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *,
114 int create_rmtcall_fd(struct netconfig *);
115 void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t,
117 void my_svc_run(void);
119 void rpcbind_abort(void);
121 void toggle_verboselog(int);
123 int check_access(SVCXPRT *, rpcproc_t, void *, unsigned int);
124 int check_callit(SVCXPRT *, struct r_rmtcall_args *, int);
125 void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *);
126 int is_loopback(struct netbuf *);
129 extern void pmap_service(struct svc_req *, SVCXPRT *);
132 void write_warmstart(void);
133 void read_warmstart(void);
135 char *addrmerge(struct netbuf *caller, const char *serv_uaddr,
136 const char *clnt_uaddr, char const *netid);
137 int listen_addr(const struct sockaddr *sa);
138 void network_init(void);
139 struct sockaddr *local_sa(int);
141 /* For different getaddr semantics */
142 #define RPCB_ALLVERS 0
143 #define RPCB_ONEVERS 1
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)
149 #define SA2SIN6(sa) ((struct sockaddr_in6 *)(sa))
150 #define SA2SIN6ADDR(sa) (SA2SIN6(sa)->sin6_addr)
153 #endif /* rpcbind_h */