xref: /dflybsd-src/lib/libc/rpc/rpc_com.h (revision 48ba28f4cab36fe4e3f3985e5e793cbb3df4aafa)
1ba96d07fShrs /*-
2ba96d07fShrs  * Copyright (c) 2009, Sun Microsystems, Inc.
3ba96d07fShrs  * All rights reserved.
4ce0e08e2SPeter Avalos  *
5ba96d07fShrs  * Redistribution and use in source and binary forms, with or without
6ba96d07fShrs  * modification, are permitted provided that the following conditions are met:
7ba96d07fShrs  * - Redistributions of source code must retain the above copyright notice,
8ba96d07fShrs  *   this list of conditions and the following disclaimer.
9ba96d07fShrs  * - Redistributions in binary form must reproduce the above copyright notice,
10ba96d07fShrs  *   this list of conditions and the following disclaimer in the documentation
11ba96d07fShrs  *   and/or other materials provided with the distribution.
12ba96d07fShrs  * - Neither the name of Sun Microsystems, Inc. nor the names of its
13ba96d07fShrs  *   contributors may be used to endorse or promote products derived
14ba96d07fShrs  *   from this software without specific prior written permission.
15ce0e08e2SPeter Avalos  *
16ba96d07fShrs  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17ba96d07fShrs  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18ba96d07fShrs  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ba96d07fShrs  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20ba96d07fShrs  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21ba96d07fShrs  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22ba96d07fShrs  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23ba96d07fShrs  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24ba96d07fShrs  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25ba96d07fShrs  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26ba96d07fShrs  * POSSIBILITY OF SUCH DAMAGE.
27ce0e08e2SPeter Avalos  *
28ce0e08e2SPeter Avalos  * @(#)rpc_com.h	1.11	93/07/05 SMI
29ce0e08e2SPeter Avalos  * $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $
30ce0e08e2SPeter Avalos  * $FreeBSD: src/lib/libc/rpc/rpc_com.h,v 1.8 2006/02/27 22:10:59 deischen Exp $
31ce0e08e2SPeter Avalos  */
32ce0e08e2SPeter Avalos /*
33ce0e08e2SPeter Avalos  * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
34ce0e08e2SPeter Avalos  */
35ce0e08e2SPeter Avalos 
36ce0e08e2SPeter Avalos /*
37ce0e08e2SPeter Avalos  * rpc_com.h, Common definitions for both the server and client side.
38ce0e08e2SPeter Avalos  * All for the topmost layer of rpc
39ce0e08e2SPeter Avalos  *
40ce0e08e2SPeter Avalos  * In Sun's tirpc distribution, this was installed as <rpc/rpc_com.h>,
41ce0e08e2SPeter Avalos  * but as it contains only non-exported interfaces, it was moved here.
42ce0e08e2SPeter Avalos  */
43ce0e08e2SPeter Avalos 
44ce0e08e2SPeter Avalos #ifndef _RPC_RPC_COM_H_
45ce0e08e2SPeter Avalos #define	_RPC_RPC_COM_H_
46ce0e08e2SPeter Avalos 
47ce0e08e2SPeter Avalos #include <sys/cdefs.h>
48ce0e08e2SPeter Avalos 
49ce0e08e2SPeter Avalos /*
50ce0e08e2SPeter Avalos  * The max size of the transport, if the size cannot be determined
51ce0e08e2SPeter Avalos  * by other means.
52ce0e08e2SPeter Avalos  */
53ce0e08e2SPeter Avalos #define	RPC_MAXDATASIZE 9000
54ce0e08e2SPeter Avalos #define	RPC_MAXADDRSIZE 1024
55ce0e08e2SPeter Avalos 
56ce0e08e2SPeter Avalos #define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \
57ce0e08e2SPeter Avalos     (u_int32_t)(now)->tv_usec)
58ce0e08e2SPeter Avalos 
59ce0e08e2SPeter Avalos __BEGIN_DECLS
60ce0e08e2SPeter Avalos extern u_int __rpc_get_a_size(int);
61ce0e08e2SPeter Avalos extern int __rpc_dtbsize(void);
62ce0e08e2SPeter Avalos extern struct netconfig * __rpcgettp(int);
63ce0e08e2SPeter Avalos extern  int  __rpc_get_default_domain(char **);
64ce0e08e2SPeter Avalos 
65ce0e08e2SPeter Avalos char *__rpc_taddr2uaddr_af(int, const struct netbuf *);
66ce0e08e2SPeter Avalos struct netbuf *__rpc_uaddr2taddr_af(int, const char *);
67ce0e08e2SPeter Avalos int __rpc_fixup_addr(struct netbuf *, const struct netbuf *);
68ce0e08e2SPeter Avalos int __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **);
69ce0e08e2SPeter Avalos int __rpc_seman2socktype(int);
70ce0e08e2SPeter Avalos int __rpc_socktype2seman(int);
71ce0e08e2SPeter Avalos void *rpc_nullproc(CLIENT *);
72ce0e08e2SPeter Avalos int __rpc_sockisbound(int);
73ce0e08e2SPeter Avalos 
74ce0e08e2SPeter Avalos struct netbuf *__rpcb_findaddr_timed(rpcprog_t, rpcvers_t,
75ce0e08e2SPeter Avalos     const struct netconfig *, const char *host, CLIENT **clpp,
76ce0e08e2SPeter Avalos     struct timeval *tp);
77ce0e08e2SPeter Avalos 
78ce0e08e2SPeter Avalos bool_t __rpc_control(int,void *);
79ce0e08e2SPeter Avalos 
80ce0e08e2SPeter Avalos char *_get_next_token(char *, int);
81ce0e08e2SPeter Avalos 
82ce0e08e2SPeter Avalos bool_t __svc_clean_idle(fd_set *, int, bool_t);
83ce0e08e2SPeter Avalos bool_t __xdrrec_setnonblock(XDR *, int);
84ce0e08e2SPeter Avalos bool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t);
85ce0e08e2SPeter Avalos void __xprt_unregister_unlocked(SVCXPRT *);
86ce0e08e2SPeter Avalos 
87*48ba28f4SSascha Wildner extern SVCXPRT **__svc_xports;
88*48ba28f4SSascha Wildner extern int __svc_maxrec;
89ce0e08e2SPeter Avalos 
90ce0e08e2SPeter Avalos __END_DECLS
91ce0e08e2SPeter Avalos 
92ce0e08e2SPeter Avalos #endif /* _RPC_RPC_COM_H_ */
93