All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cf_types.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2008-2013 by Aerospike.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  *****************************************************************************/
22 #pragma once
23 
24 #include <stdlib.h>
25 #include <string.h>
26 #include <inttypes.h>
27 #include <unistd.h>
28 #include <asm/byteorder.h>
29 
30 
31 #ifndef CF_WINDOWS
32 /******************************************************************************
33  * LINUX
34  *****************************************************************************/
35 
36 #include <stdbool.h> // A real pity that Linux requires this for bool, true & false:
37 #include <alloca.h> // Use alloca() instead of variable-sized stack arrays for non-gcc portability.
38 
39 #else // CF_WINDOWS
40 /******************************************************************************
41  * WINDOWS
42  *****************************************************************************/
43 
44 #include <malloc.h> // for alloca()
45 
46 #endif // CF_WINDOWS
47 
48 
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /******************************************************************************
55  * CONSTANTS
56  ******************************************************************************/
57 
58 #define CITRUSLEAF_EPOCH 1262304000
59 #define INVALID_FD (-1)
60 #define FALSE 0
61 #define TRUE 1
62 
63 /******************************************************************************
64  * TYPES
65  ******************************************************************************/
66 
67 typedef uint8_t byte;
68 typedef unsigned int uint;
69 
71  uint64_t sz;
72  byte data[];
73 };
74 
75 typedef struct cf_bytearray_t cf_bytearray;
76 
77 /******************************************************************************/
78 
79 #ifdef __cplusplus
80 } // end extern "C"
81 #endif