xref: /freebsd/krb5/include/gssrpc/types.h (revision ee3960cba1068e12fb032a68c46d74841d9edab3)
1 /* @(#)types.h	2.3 88/08/15 4.0 RPCSRC */
2 /*
3  * Copyright (c) 2010, Oracle America, Inc.
4  *
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *
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
16  *       distribution.
17  *
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.
21  *
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.
33  */
34 /*      @(#)types.h 1.18 87/07/24 SMI      */
35 
36 /*
37  * Rpc additions to <sys/types.h>
38  */
39 #ifndef GSSRPC_TYPES_H
40 #define GSSRPC_TYPES_H
41 
42 #include <sys/types.h>
43 
44 #include <sys/select.h>
45 #include <sys/time.h>
46 #include <unistd.h>
47 
48 /*
49  * Try to get MAXHOSTNAMELEN from somewhere.
50  */
51 #include <sys/param.h>
52 /* #include <netdb.h> */
53 
54 /* Get htonl(), ntohl(), etc. */
55 #include <netinet/in.h>
56 
57 #include <stdlib.h>
58 #include <stdint.h>
59 #include <limits.h>
60 
61 #ifndef GSSRPC__BEGIN_DECLS
62 #ifdef __cplusplus
63 #define GSSRPC__BEGIN_DECLS	extern "C" {
64 #define GSSRPC__END_DECLS	}
65 #else
66 #define GSSRPC__BEGIN_DECLS
67 #define GSSRPC__END_DECLS
68 #endif
69 #endif
70 
71 GSSRPC__BEGIN_DECLS
72 
73 #if defined(CHAR_BIT) && CHAR_BIT != 8
74 #error "Bytes must be exactly 8 bits."
75 #endif
76 
77 /* Define if we need to fake up some BSD type aliases. */
78 #ifndef GSSRPC__BSD_TYPEALIASES	/* Allow application to override. */
79 /* #undef GSSRPC__BSD_TYPEALIASES */
80 #endif
81 #if GSSRPC__BSD_TYPEALIASES
82 typedef unsigned char	u_char;
83 typedef unsigned short	u_short;
84 typedef unsigned int	u_int;
85 typedef unsigned long	u_long;
86 #endif
87 
88 typedef uint32_t	rpcprog_t;
89 typedef uint32_t	rpcvers_t;
90 typedef uint32_t	rpcprot_t;
91 typedef uint32_t	rpcproc_t;
92 typedef uint32_t	rpcport_t;
93 typedef int32_t		rpc_inline_t;
94 
95 /* This is for rpc/netdb.h */
96 #define STRUCT_RPCENT_IN_RPC_NETDB_H
97 
98 typedef int bool_t;
99 typedef int enum_t;
100 #ifndef FALSE
101 #	define	FALSE	(0)
102 #endif
103 #ifndef TRUE
104 #	define	TRUE	(1)
105 #endif
106 /* XXX namespace */
107 #define __dontcare__	-1
108 #ifndef NULL
109 #	define NULL 0
110 #endif
111 
112 /*
113  * The below should probably be internal-only, but seem to be
114  * traditionally exported in RPC implementations.
115  */
116 #define mem_alloc(bsize)	malloc(bsize)
117 #define mem_free(ptr, bsize)	free(ptr)
118 
119 #ifndef INADDR_LOOPBACK
120 #define       INADDR_LOOPBACK         (uint32_t)0x7F000001
121 #endif
122 #ifndef MAXHOSTNAMELEN
123 #define        MAXHOSTNAMELEN  64
124 #endif
125 
126 GSSRPC__END_DECLS
127 
128 #include <gssrpc/rename.h>
129 
130 #endif /* !defined(GSSRPC_TYPES_H) */
131