xref: /illumos-gate/usr/src/uts/common/rpc/types.h (revision 03100a6332bd4edc7a53091fcf7c9a7131bcdaa7)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
39 
40 /*
41  * Rpc additions to <sys/types.h>
42  */
43 #include <sys/types.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 typedef int bool_t;
50 typedef int enum_t;
51 
52 /*
53  * The ulonglong_t type was introduced to workaround an rpcgen bug
54  * that has been fixed, this next typedef will be removed in a future release.
55  * Do *NOT* use!
56  */
57 typedef u_longlong_t ulonglong_t;
58 
59 #if defined(_LP64) || defined(_I32LPx)
60 typedef	uint32_t rpcprog_t;
61 typedef	uint32_t rpcvers_t;
62 typedef	uint32_t rpcproc_t;
63 typedef uint32_t rpcprot_t;
64 typedef uint32_t rpcport_t;
65 typedef int32_t rpc_inline_t;
66 #else
67 typedef	unsigned long rpcprog_t;
68 typedef	unsigned long rpcvers_t;
69 typedef	unsigned long rpcproc_t;
70 typedef unsigned long rpcprot_t;
71 typedef unsigned long rpcport_t;
72 typedef long rpc_inline_t;
73 #endif
74 
75 
76 #define	__dontcare__	-1
77 
78 #ifndef	FALSE
79 #define	FALSE	(0)
80 #endif
81 
82 #ifndef	TRUE
83 #define	TRUE	(1)
84 #endif
85 
86 #ifndef	NULL
87 #define	NULL	0
88 #endif
89 
90 #ifndef	_KERNEL
91 #define	mem_alloc(bsize)	malloc(bsize)
92 #define	mem_free(ptr, bsize)	free(ptr)
93 #else
94 #include <sys/kmem.h>		/* XXX */
95 
96 #define	mem_alloc(bsize)	kmem_alloc(bsize, KM_SLEEP)
97 #define	mem_free(ptr, bsize)	kmem_free(ptr, bsize)
98 
99 extern const char *rpc_tpiprim2name(uint_t prim);
100 extern const char *rpc_tpierr2name(uint_t err);
101 
102 #if defined(DEBUG) && !defined(RPCDEBUG)
103 #define	RPCDEBUG
104 #endif
105 
106 #ifdef RPCDEBUG
107 extern uint_t	rpclog;
108 
109 #define	RPCLOG(A, B, C)	\
110 	((void)((rpclog) && (rpclog & (A)) && (printf((B), (C)), TRUE)))
111 #define	RPCLOG0(A, B)	\
112 	((void)((rpclog) && (rpclog & (A)) && (printf(B), TRUE)))
113 #else
114 #define		RPCLOG(A, B, C)
115 #define		RPCLOG0(A, B)
116 #endif
117 
118 #endif
119 
120 /* messaging stuff. */
121 #ifndef _KERNEL
122 #ifdef __STDC__
123 extern const char __nsl_dom[];
124 #else
125 extern char __nsl_dom[];
126 #endif
127 #endif
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #include <sys/time.h>
134 
135 #endif	/* _RPC_TYPES_H */
136