1 /* @(#)types.h 2.3 88/08/15 4.0 RPCSRC */
3 * Copyright (c) 2010, Oracle America, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
18 * * Neither the name of the “Oracle America, Inc.” nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
23 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 /* @(#)types.h 1.18 87/07/24 SMI */
37 * Rpc additions to <sys/types.h>
39 #ifndef GSSRPC_TYPES_H
40 #define GSSRPC_TYPES_H
42 #include <sys/types.h>
44 @GSSRPC__SYS_SELECT_H@
49 * Try to get MAXHOSTNAMELEN from somewhere.
54 /* Get htonl(), ntohl(), etc. */
55 #include <netinet/in.h>
60 * Pull in typedefs for fixed-width integers somehow, if they weren't
65 /* Define if there is no uint32_t in system headers. */
70 #ifndef GSSRPC__BEGIN_DECLS
72 #define GSSRPC__BEGIN_DECLS extern "C" {
73 #define GSSRPC__END_DECLS }
75 #define GSSRPC__BEGIN_DECLS
76 #define GSSRPC__END_DECLS
82 #if defined(CHAR_BIT) && CHAR_BIT != 8
83 #error "Bytes must be exactly 8 bits."
87 * If no uint32_t in system headers, fake it by looking for a 32-bit
88 * two's-complement type. Yes, this stomps on POSIX namespace, but if
89 * we get here, we're on a system that's far from being
90 * POSIX-compliant anyway.
92 #if GSSRPC__FAKE_UINT32
93 #if (UINT_MAX == 0xffffffffUL) && (INT_MAX == 0x7fffffffL) \
94 && (INT_MIN == -INT_MAX-1)
96 typedef unsigned int uint32_t;
98 #if (ULONG_MAX == 0xffffffffUL) && (LONG_MAX == 0x7fffffffL) \
99 && (LONG_MIN == -LONG_MAX-1)
100 typedef long int32_t;
101 typedef unsigned long uint32_t;
103 #if (USHRT_MAX == 0xffffffffUL) && (SHRT_MAX == 0x7fffffffL) \
104 && (SHRT_MIN == -SHRT_MAX-1)
105 typedef short int32_t;
106 typedef unsigned short uint32_t;
108 #error "Can't fake up uint32_t."
112 #endif /* GSSRPC__FAKE_UINT32 */
114 #if (LONG_MIN != -LONG_MAX-1) || (INT_MIN != -INT_MAX-1) \
115 || (SHRT_MIN != -SHRT_MAX-1)
116 #error "Integer types must be two's-complement."
119 /* Define if we need to fake up some BSD type aliases. */
120 #ifndef GSSRPC__BSD_TYPEALIASES /* Allow application to override. */
121 @GSSRPC__BSD_TYPEALIASES@
123 #if GSSRPC__BSD_TYPEALIASES
124 typedef unsigned char u_char;
125 typedef unsigned short u_short;
126 typedef unsigned int u_int;
127 typedef unsigned long u_long;
130 typedef uint32_t rpcprog_t;
131 typedef uint32_t rpcvers_t;
132 typedef uint32_t rpcprot_t;
133 typedef uint32_t rpcproc_t;
134 typedef uint32_t rpcport_t;
135 typedef int32_t rpc_inline_t;
137 /* This is for rpc/netdb.h */
149 #define __dontcare__ -1
155 * The below should probably be internal-only, but seem to be
156 * traditionally exported in RPC implementations.
158 #define mem_alloc(bsize) malloc(bsize)
159 #define mem_free(ptr, bsize) free(ptr)
162 #include <netdb.h> /* XXX This should not have to be here.
163 * I got sick of seeing the warnings for MAXHOSTNAMELEN
164 * and the two values were different. -- shanzer
168 #ifndef INADDR_LOOPBACK
169 #define INADDR_LOOPBACK (uint32_t)0x7F000001
171 #ifndef MAXHOSTNAMELEN
172 #define MAXHOSTNAMELEN 64
177 #include <gssrpc/rename.h>
179 #endif /* !defined(GSSRPC_TYPES_H) */