xref: /illumos-gate/usr/src/uts/common/rpc/types.h (revision 7c478bd9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  *
22  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
26 /* All Rights Reserved */
27 /*
28  * Portions of this source code were derived from Berkeley
29  * 4.3 BSD under license from the Regents of the University of
30  * California.
31  */
32 
33 #ifndef _RPC_TYPES_H
34 #define	_RPC_TYPES_H
35 
36 #pragma ident	"%Z%%M%	%I%	%E% SMI"
37 
38 /*
39  * Rpc additions to <sys/types.h>
40  */
41 #include <sys/types.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 typedef int bool_t;
48 typedef int enum_t;
49 
50 /*
51  * The following is part of a workaround for bug #1128007.
52  * When it is fixed, this next typedef should be removed.
53  */
54 typedef u_longlong_t ulonglong_t;
55 
56 #if defined(_LP64) || defined(_I32LPx)
57 typedef	uint32_t rpcprog_t;
58 typedef	uint32_t rpcvers_t;
59 typedef	uint32_t rpcproc_t;
60 typedef uint32_t rpcprot_t;
61 typedef uint32_t rpcport_t;
62 typedef int32_t rpc_inline_t;
63 #else
64 typedef	unsigned long rpcprog_t;
65 typedef	unsigned long rpcvers_t;
66 typedef	unsigned long rpcproc_t;
67 typedef unsigned long rpcprot_t;
68 typedef unsigned long rpcport_t;
69 typedef long rpc_inline_t;
70 #endif
71 
72 
73 #define	__dontcare__	-1
74 
75 #ifndef	FALSE
76 #define	FALSE	(0)
77 #endif
78 
79 #ifndef	TRUE
80 #define	TRUE	(1)
81 #endif
82 
83 #ifndef	NULL
84 #define	NULL	0
85 #endif
86 
87 #ifndef	_KERNEL
88 #define	mem_alloc(bsize)	malloc(bsize)
89 #define	mem_free(ptr, bsize)	free(ptr)
90 #else
91 #include <sys/kmem.h>		/* XXX */
92 
93 #define	mem_alloc(bsize)	kmem_alloc(bsize, KM_SLEEP)
94 #define	mem_free(ptr, bsize)	kmem_free(ptr, bsize)
95 
96 extern const char *rpc_tpiprim2name(uint_t prim);
97 extern const char *rpc_tpierr2name(uint_t err);
98 
99 #if defined(DEBUG) && !defined(RPCDEBUG)
100 #define	RPCDEBUG
101 #endif
102 
103 #ifdef RPCDEBUG
104 extern uint_t	rpclog;
105 
106 #define	RPCLOG(A, B, C)	\
107 	((void)((rpclog) && (rpclog & (A)) && (printf((B), (C)), TRUE)))
108 #define	RPCLOG0(A, B)	\
109 	((void)((rpclog) && (rpclog & (A)) && (printf(B), TRUE)))
110 #else
111 #define		RPCLOG(A, B, C)
112 #define		RPCLOG0(A, B)
113 #endif
114 
115 #endif
116 
117 /* messaging stuff. */
118 #ifndef _KERNEL
119 #ifdef __STDC__
120 extern const char __nsl_dom[];
121 #else
122 extern char __nsl_dom[];
123 #endif
124 #endif
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #include <sys/time.h>
131 
132 #endif	/* _RPC_TYPES_H */
133