1177633Sdfr/*	$NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $	*/
2177633Sdfr
3258578Shrs/*-
4258578Shrs * Copyright (c) 2009, Sun Microsystems, Inc.
5258578Shrs * All rights reserved.
6258578Shrs *
7258578Shrs * Redistribution and use in source and binary forms, with or without
8258578Shrs * modification, are permitted provided that the following conditions are met:
9258578Shrs * - Redistributions of source code must retain the above copyright notice,
10258578Shrs *   this list of conditions and the following disclaimer.
11258578Shrs * - Redistributions in binary form must reproduce the above copyright notice,
12258578Shrs *   this list of conditions and the following disclaimer in the documentation
13258578Shrs *   and/or other materials provided with the distribution.
14258578Shrs * - Neither the name of Sun Microsystems, Inc. nor the names of its
15258578Shrs *   contributors may be used to endorse or promote products derived
16258578Shrs *   from this software without specific prior written permission.
17177633Sdfr *
18258578Shrs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19258578Shrs * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20258578Shrs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21258578Shrs * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22258578Shrs * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23258578Shrs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24258578Shrs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25258578Shrs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26258578Shrs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27258578Shrs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28258578Shrs * POSSIBILITY OF SUCH DAMAGE.
29177633Sdfr *
30177633Sdfr * $FreeBSD$
31177633Sdfr */
32177633Sdfr/*
33177633Sdfr * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
34177633Sdfr */
35177633Sdfr
36177633Sdfr/*
37177633Sdfr * rpc_com.h, Common definitions for both the server and client side.
38177633Sdfr * All for the topmost layer of rpc
39177633Sdfr *
40177633Sdfr * In Sun's tirpc distribution, this was installed as <rpc/rpc_com.h>,
41177633Sdfr * but as it contains only non-exported interfaces, it was moved here.
42177633Sdfr */
43177633Sdfr
44177633Sdfr#ifndef _RPC_RPCCOM_H
45177633Sdfr#define	_RPC_RPCCOM_H
46177633Sdfr
47177633Sdfr#include <sys/cdefs.h>
48177633Sdfr
49177633Sdfr/* #pragma ident	"@(#)rpc_com.h	1.11	93/07/05 SMI" */
50177633Sdfr
51177633Sdfr/*
52177633Sdfr * The max size of the transport, if the size cannot be determined
53177633Sdfr * by other means.
54177633Sdfr */
55177633Sdfr#define	RPC_MAXDATASIZE 9000
56177633Sdfr#define	RPC_MAXADDRSIZE 1024
57177633Sdfr
58177633Sdfr#ifdef _KERNEL
59177633Sdfr
60177633Sdfr#define __RPC_GETXID(now) ((uint32_t)curproc->p_pid ^ (uint32_t)(now)->tv_sec ^ \
61177633Sdfr    (uint32_t)(now)->tv_usec)
62177633Sdfr
63177633Sdfr#else
64177633Sdfr
65177633Sdfr#define __RPC_GETXID(now) ((uint32_t)getpid() ^ (uint32_t)(now)->tv_sec ^ \
66177633Sdfr    (uint32_t)(now)->tv_usec)
67177633Sdfr
68177633Sdfr#endif
69177633Sdfr
70177633Sdfr__BEGIN_DECLS
71177633Sdfr#ifndef _KERNEL
72177633Sdfrextern u_int __rpc_get_a_size(int);
73177633Sdfrextern int __rpc_dtbsize(void);
74177633Sdfrextern struct netconfig * __rpcgettp(int);
75177633Sdfrextern  int  __rpc_get_default_domain(char **);
76177633Sdfr
77177633Sdfrchar *__rpc_taddr2uaddr_af(int, const struct netbuf *);
78177633Sdfrstruct netbuf *__rpc_uaddr2taddr_af(int, const char *);
79177633Sdfrint __rpc_fixup_addr(struct netbuf *, const struct netbuf *);
80177633Sdfrint __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **);
81177633Sdfrint __rpc_seman2socktype(int);
82177633Sdfrint __rpc_socktype2seman(int);
83177633Sdfrvoid *rpc_nullproc(CLIENT *);
84177633Sdfrint __rpc_sockisbound(int);
85177633Sdfr
86177633Sdfrstruct netbuf *__rpcb_findaddr_timed(rpcprog_t, rpcvers_t,
87177633Sdfr    const struct netconfig *, const char *host, CLIENT **clpp,
88177633Sdfr    struct timeval *tp);
89177633Sdfr
90177633Sdfrbool_t __rpc_control(int,void *);
91177633Sdfr
92177633Sdfrchar *_get_next_token(char *, int);
93177633Sdfr
94177633Sdfrbool_t __svc_clean_idle(fd_set *, int, bool_t);
95177633Sdfrbool_t __xdrrec_setnonblock(XDR *, int);
96177633Sdfrbool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t);
97177633Sdfrvoid __xprt_unregister_unlocked(SVCXPRT *);
98177633Sdfr
99177633SdfrSVCXPRT **__svc_xports;
100177633Sdfrint __svc_maxrec;
101177633Sdfr
102177633Sdfr#else
103177633Sdfr
104177633Sdfr#define SUN_LEN(su) \
105177633Sdfr	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
106177633Sdfr
107177633Sdfrextern u_int __rpc_get_a_size(int);
108177633Sdfrextern char *__rpc_taddr2uaddr_af(int, const struct netbuf *);
109177633Sdfrextern struct netbuf *__rpc_uaddr2taddr_af(int, const char *);
110177633Sdfrextern int __rpc_seman2socktype(int);
111177633Sdfrextern int __rpc_socktype2seman(int);
112177633Sdfrextern int __rpc_sockisbound(struct socket*);
113184588Sdfrextern int bindresvport(struct socket *so, struct sockaddr *sa);
114177633Sdfr
115177633Sdfrstruct xucred;
116240060Spfgstruct XDR;
117240060Spfgbool_t xdr_authunix_parms(struct XDR *xdrs, uint32_t *time, struct xucred *cred);
118177633Sdfr#endif
119177633Sdfr
120177633Sdfr__END_DECLS
121177633Sdfr
122177633Sdfr#endif /* _RPC_RPCCOM_H */
123