xref: /illumos-gate/usr/src/uts/common/rpc/types.h (revision 4870e0a7)
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 
23 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29 /*
30  * Portions of this source code were derived from Berkeley
31  * 4.3 BSD under license from the Regents of the University of
32  * California.
33  */
34 
35 #ifndef _RPC_TYPES_H
36 #define	_RPC_TYPES_H
37 
38 /*
39  * Rpc additions to <sys/types.h>
40  */
41 #include <sys/types.h>
42 #include <sys/null.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef int bool_t;
49 typedef int enum_t;
50 
51 /*
52  * The ulonglong_t type was introduced to workaround an rpcgen bug
53  * that has been fixed, this next typedef will be removed in a future release.
54  * Do *NOT* use!
55  */
56 typedef u_longlong_t ulonglong_t;
57 
58 #if defined(_LP64) || defined(_I32LPx)
59 typedef	uint32_t rpcprog_t;
60 typedef	uint32_t rpcvers_t;
61 typedef	uint32_t rpcproc_t;
62 typedef uint32_t rpcprot_t;
63 typedef uint32_t rpcport_t;
64 typedef int32_t rpc_inline_t;
65 #else
66 typedef	unsigned long rpcprog_t;
67 typedef	unsigned long rpcvers_t;
68 typedef	unsigned long rpcproc_t;
69 typedef unsigned long rpcprot_t;
70 typedef unsigned long rpcport_t;
71 typedef long rpc_inline_t;
72 #endif
73 
74 
75 #define	__dontcare__	-1
76 
77 #ifndef	FALSE
78 #define	FALSE	(0)
79 #endif
80 
81 #ifndef	TRUE
82 #define	TRUE	(1)
83 #endif
84 
85 #ifndef	_KERNEL
86 #define	mem_alloc(bsize)	malloc(bsize)
87 #define	mem_free(ptr, bsize)	free(ptr)
88 #else
89 #include <sys/kmem.h>		/* XXX */
90 
91 #define	mem_alloc(bsize)	kmem_alloc(bsize, KM_SLEEP)
92 #define	mem_free(ptr, bsize)	kmem_free(ptr, bsize)
93 
94 extern const char *rpc_tpiprim2name(uint_t prim);
95 extern const char *rpc_tpierr2name(uint_t err);
96 
97 #if defined(DEBUG) && !defined(RPCDEBUG)
98 #define	RPCDEBUG
99 #endif
100 
101 #ifdef RPCDEBUG
102 extern uint_t	rpclog;
103 
104 #define	RPCLOG(A, B, C)	\
105 	((void)((rpclog) && (rpclog & (A)) && (printf((B), (C)), TRUE)))
106 #define	RPCLOG0(A, B)	\
107 	((void)((rpclog) && (rpclog & (A)) && (printf(B), TRUE)))
108 #else
109 #define		RPCLOG(A, B, C)
110 #define		RPCLOG0(A, B)
111 #endif
112 
113 #endif
114 
115 /* messaging stuff. */
116 #ifndef _KERNEL
117 #ifdef __STDC__
118 extern const char __nsl_dom[];
119 #else
120 extern char __nsl_dom[];
121 #endif
122 #endif
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #include <sys/time.h>
129 
130 #endif	/* _RPC_TYPES_H */
131