2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 Define integer types for Bacula -- Kern Sibbald
31 Integer types. These types should be be used in all
32 contexts in which the length of an integer stored on
33 removable media must be known regardless of the
34 architecture of the platform.
38 int8_t, int16_t, int32_t, int64_t
39 uint8_t, uint16_t, uint32_t, uint64_t
41 Also, we define types such as file address lengths.
48 #ifndef __bc_types_INCLUDED
49 #define __bc_types_INCLUDED
56 /* If sys/types.h does not supply intXX_t, supply them ourselves */
60 typedef unsigned int u_int;
64 # if (SIZEOF_CHAR == 1)
65 typedef signed char int8_t;
67 # error "8 bit int type not found."
69 # if (SIZEOF_SHORT_INT == 2)
70 typedef short int int16_t;
72 # error "16 bit int type not found."
74 # if (SIZEOF_INT == 4)
77 # error "32 bit int type not found."
81 /* If sys/types.h does not supply u_intXX_t, supply them ourselves */
82 #ifndef HAVE_U_INTXX_T
84 typedef uint8_t u_int8_t;
85 typedef uint16_t u_int16_t;
86 typedef uint32_t u_int32_t;
87 # define HAVE_U_INTXX_T 1
89 # if (SIZEOF_CHAR == 1)
90 typedef unsigned char u_int8_t;
92 # error "8 bit int type not found. Required!"
94 # if (SIZEOF_SHORT_INT == 2)
95 typedef unsigned short int u_int16_t;
97 # error "16 bit int type not found. Required!"
99 # if (SIZEOF_INT == 4)
100 typedef unsigned int u_int32_t;
102 # error "32 bit int type not found. Required!"
109 # if (SIZEOF_LONG_LONG_INT == 8)
110 typedef long long int int64_t;
111 # define HAVE_INT64_T 1
113 # if (SIZEOF_LONG_INT == 8)
114 typedef long int int64_t;
115 # define HAVE_INT64_T 1
120 #ifndef HAVE_INTMAX_T
122 typedef int64_t intmax_t;
124 # error "64 bit type not found. Required!"
128 #ifndef HAVE_U_INT64_T
129 # if (SIZEOF_LONG_LONG_INT == 8)
130 typedef unsigned long long int u_int64_t;
131 # define HAVE_U_INT64_T 1
133 # if (SIZEOF_LONG_INT == 8)
134 typedef unsigned long int u_int64_t;
135 # define HAVE_U_INT64_T 1
137 # error "64 bit type not found. Required!"
142 #ifndef HAVE_U_INTMAX_T
143 # ifdef HAVE_U_INT64_T
144 typedef u_int64_t u_intmax_t;
146 # error "64 bit type not found. Required!"
151 /* Limits for the above types. */
162 #define INT8_MIN (-127-1)
163 #define INT8_MAX (127)
164 #define UINT8_MAX (255u)
165 #define INT16_MIN (-32767-1)
166 #define INT16_MAX (32767)
167 #define UINT16_MAX (65535u)
168 #define INT32_MIN (-2147483647-1)
169 #define INT32_MAX (2147483647)
170 #define UINT32_MAX (4294967295u)
172 typedef double float64_t;
173 typedef float float32_t;
176 /* Define the uint versions actually used in Bacula */
178 #define uint8_t u_int8_t
179 #define uint16_t u_int16_t
180 #define uint32_t u_int32_t
181 #define uint64_t u_int64_t
182 #define uintmax_t u_intmax_t
185 /* Bacula time -- Unix time with microseconds */
186 #define btime_t int64_t
187 /* Unix time (time_t) widened to 64 bits */
188 #define utime_t int64_t
190 #ifndef HAVE_SOCKLEN_T
191 #define socklen_t int
194 #ifdef HAVE_OLD_SOCKOPT
195 #define sockopt_val_t char *
197 #define sockopt_val_t void *
201 * Status codes returned by create_file()
202 * Used in findlib, filed, and plugins
205 CF_SKIP = 1, /* skip file (not newer or something) */
206 CF_ERROR, /* error creating file */
207 CF_EXTRACT, /* file created, data to extract */
208 CF_CREATED /* file created, no data to extract */
212 #endif /* __bc_types_INCLUDED */