2 Integer types. These types should be be used in all
3 contexts in which the length of an integer stored on
4 removable media must be known regardless of the
5 architecture of the platform.
9 int8_t, int16_t, int32_t, int64_t
10 uint8_t, uint16_t, uint32_t, uint64_t
12 Also, we define types such as file address lengths.
18 Copyright (C) 2000-2006 Kern Sibbald
20 This program is free software; you can redistribute it and/or
21 modify it under the terms of the GNU General Public License
22 version 2 as amended with additional clauses defined in the
23 file LICENSE in the main source directory.
25 This program is distributed in the hope that it will be useful,
26 but WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 the file LICENSE for additional details.
33 #ifndef __bc_types_INCLUDED
34 #define __bc_types_INCLUDED
41 /* If sys/types.h does not supply intXX_t, supply them ourselves */
45 typedef unsigned int u_int;
49 # if (SIZEOF_CHAR == 1)
52 # error "8 bit int type not found."
54 # if (SIZEOF_SHORT_INT == 2)
55 typedef short int int16_t;
57 # error "16 bit int type not found."
59 # if (SIZEOF_INT == 4)
62 # error "32 bit int type not found."
66 /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
67 #ifndef HAVE_U_INTXX_T
69 typedef uint8_t u_int8_t;
70 typedef uint16_t u_int16_t;
71 typedef uint32_t u_int32_t;
72 # define HAVE_U_INTXX_T 1
74 # if (SIZEOF_CHAR == 1)
75 typedef unsigned char u_int8_t;
77 # error "8 bit int type not found. Required!"
79 # if (SIZEOF_SHORT_INT == 2)
80 typedef unsigned short int u_int16_t;
82 # error "16 bit int type not found. Required!"
84 # if (SIZEOF_INT == 4)
85 typedef unsigned int u_int32_t;
87 # error "32 bit int type not found. Required!"
94 # if (SIZEOF_LONG_LONG_INT == 8)
95 typedef long long int int64_t;
96 # define HAVE_INT64_T 1
98 # if (SIZEOF_LONG_INT == 8)
99 typedef long int int64_t;
100 # define HAVE_INT64_T 1
105 #ifndef HAVE_INTMAX_T
107 typedef int64_t intmax_t;
109 # error "64 bit type not found. Required!"
113 #ifndef HAVE_U_INT64_T
114 # if (SIZEOF_LONG_LONG_INT == 8)
115 typedef unsigned long long int u_int64_t;
116 # define HAVE_U_INT64_T 1
118 # if (SIZEOF_LONG_INT == 8)
119 typedef unsigned long int u_int64_t;
120 # define HAVE_U_INT64_T 1
122 # error "64 bit type not found. Required!"
127 #ifndef HAVE_U_INTMAX_T
128 # ifdef HAVE_U_INT64_T
129 typedef u_int64_t u_intmax_t;
131 # error "64 bit type not found. Required!"
136 /* Limits for the above types. */
147 #define INT8_MIN (-127-1)
148 #define INT8_MAX (127)
149 #define UINT8_MAX (255u)
150 #define INT16_MIN (-32767-1)
151 #define INT16_MAX (32767)
152 #define UINT16_MAX (65535u)
153 #define INT32_MIN (-2147483647-1)
154 #define INT32_MAX (2147483647)
155 #define UINT32_MAX (4294967295u)
157 typedef double float64_t;
158 typedef float float32_t;
160 #endif /* __bc_types_INCLUDED */
162 /* Define the uint versions actually used in Bacula */
164 #define uint8_t u_int8_t
165 #define uint16_t u_int16_t
166 #define uint32_t u_int32_t
167 #define uint64_t u_int64_t
168 #define uintmax_t u_intmax_t
171 /* Bacula time -- Unix time with microseconds */
172 #define btime_t int64_t
173 /* Unix time (time_t) widened to 64 bits */
174 #define utime_t int64_t
176 #ifndef HAVE_SOCKLEN_T
177 #define socklen_t int
180 #ifdef HAVE_OLD_SOCKOPT
181 #define sockopt_val_t char *
183 #define sockopt_val_t void *