rpc_com.h revision 213103
1275970Scy/*	$NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $	*/
2275970Scy
3275970Scy/*
4275970Scy * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5275970Scy * unrestricted use provided that this legend is included on all tape
6275970Scy * media and as a part of the software program in whole or part.  Users
7275970Scy * may copy or modify Sun RPC without charge, but are not authorized
8275970Scy * to license or distribute it to anyone else except as part of a product or
9275970Scy * program developed by the user.
10275970Scy *
11275970Scy * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12275970Scy * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13275970Scy * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14275970Scy *
15275970Scy * Sun RPC is provided with no support and without any obligation on the
16275970Scy * part of Sun Microsystems, Inc. to assist in its use, correction,
17275970Scy * modification or enhancement.
18275970Scy *
19275970Scy * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20275970Scy * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21275970Scy * OR ANY PART THEREOF.
22275970Scy *
23275970Scy * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24275970Scy * or profits or other special, indirect and consequential damages, even if
25275970Scy * Sun has been advised of the possibility of such damages.
26275970Scy *
27275970Scy * Sun Microsystems, Inc.
28275970Scy * 2550 Garcia Avenue
29275970Scy * Mountain View, California  94043
30275970Scy *
31275970Scy * $FreeBSD: head/sys/rpc/rpc_com.h 213103 2010-09-24 15:01:45Z attilio $
32275970Scy */
33275970Scy/*
34275970Scy * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
35275970Scy */
36275970Scy
37275970Scy/*
38275970Scy * rpc_com.h, Common definitions for both the server and client side.
39275970Scy * All for the topmost layer of rpc
40275970Scy *
41275970Scy * In Sun's tirpc distribution, this was installed as <rpc/rpc_com.h>,
42275970Scy * but as it contains only non-exported interfaces, it was moved here.
43275970Scy */
44275970Scy
45275970Scy#ifndef _RPC_RPCCOM_H
46275970Scy#define	_RPC_RPCCOM_H
47275970Scy
48275970Scy#include <sys/cdefs.h>
49275970Scy
50275970Scy/* #pragma ident	"@(#)rpc_com.h	1.11	93/07/05 SMI" */
51275970Scy
52275970Scy/*
53275970Scy * The max size of the transport, if the size cannot be determined
54275970Scy * by other means.
55275970Scy */
56275970Scy#define	RPC_MAXDATASIZE 9000
57275970Scy#define	RPC_MAXADDRSIZE 1024
58275970Scy
59275970Scy#ifdef _KERNEL
60275970Scy
61275970Scy#define __RPC_GETXID(now) ((uint32_t)curproc->p_pid ^ (uint32_t)(now)->tv_sec ^ \
62275970Scy    (uint32_t)(now)->tv_usec)
63275970Scy
64275970Scy#else
65275970Scy
66275970Scy#define __RPC_GETXID(now) ((uint32_t)getpid() ^ (uint32_t)(now)->tv_sec ^ \
67275970Scy    (uint32_t)(now)->tv_usec)
68275970Scy
69275970Scy#endif
70275970Scy
71275970Scy__BEGIN_DECLS
72275970Scy#ifndef _KERNEL
73275970Scyextern u_int __rpc_get_a_size(int);
74275970Scyextern int __rpc_dtbsize(void);
75275970Scyextern struct netconfig * __rpcgettp(int);
76275970Scyextern  int  __rpc_get_default_domain(char **);
77275970Scy
78275970Scychar *__rpc_taddr2uaddr_af(int, const struct netbuf *);
79275970Scystruct netbuf *__rpc_uaddr2taddr_af(int, const char *);
80275970Scyint __rpc_fixup_addr(struct netbuf *, const struct netbuf *);
81275970Scyint __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **);
82275970Scyint __rpc_seman2socktype(int);
83275970Scyint __rpc_socktype2seman(int);
84275970Scyvoid *rpc_nullproc(CLIENT *);
85275970Scyint __rpc_sockisbound(int);
86275970Scy
87275970Scystruct netbuf *__rpcb_findaddr_timed(rpcprog_t, rpcvers_t,
88275970Scy    const struct netconfig *, const char *host, CLIENT **clpp,
89275970Scy    struct timeval *tp);
90275970Scy
91275970Scybool_t __rpc_control(int,void *);
92275970Scy
93275970Scychar *_get_next_token(char *, int);
94275970Scy
95275970Scybool_t __svc_clean_idle(fd_set *, int, bool_t);
96275970Scybool_t __xdrrec_setnonblock(XDR *, int);
97275970Scybool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t);
98275970Scyvoid __xprt_unregister_unlocked(SVCXPRT *);
99275970Scy
100275970ScySVCXPRT **__svc_xports;
101275970Scyint __svc_maxrec;
102275970Scy
103275970Scy#else
104275970Scy
105275970Scy#define SUN_LEN(su) \
106275970Scy	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
107275970Scy
108275970Scyextern u_int __rpc_get_a_size(int);
109275970Scyextern char *__rpc_taddr2uaddr_af(int, const struct netbuf *);
110275970Scyextern struct netbuf *__rpc_uaddr2taddr_af(int, const char *);
111275970Scyextern int __rpc_seman2socktype(int);
112275970Scyextern int __rpc_socktype2seman(int);
113275970Scyextern int __rpc_sockisbound(struct socket*);
114275970Scyextern int bindresvport(struct socket *so, struct sockaddr *sa);
115275970Scy
116275970Scystruct xucred;
117275970Scystruct __rpc_xdr;
118275970Scybool_t xdr_authunix_parms(struct __rpc_xdr *xdrs, uint32_t *time, struct xucred *cred);
119275970Scy#endif
120275970Scy
121275970Scy__END_DECLS
122275970Scy
123275970Scy#endif /* _RPC_RPCCOM_H */
124275970Scy