1 /*
2  * Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
3  * Copyright (c) 2014 .SE (The Internet Infrastructure Foundation).
4  * Copyright (c) 2014 OpenDNSSEC AB (svb)
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
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __db_type_h
31 #define __db_type_h
32 
33 #include <stdint.h>
34 
35 /**
36  * A signed 32bit integer.
37  */
38 typedef int32_t db_type_int32_t;
39 /**
40  * An unsigned 32bit integer.
41  */
42 typedef uint32_t db_type_uint32_t;
43 /**
44  * A signed 64bit integer.
45  */
46 typedef int64_t db_type_int64_t;
47 /**
48  * An unsigned 64bit integer.
49  */
50 typedef uint64_t db_type_uint64_t;
51 /**
52  * The type of a database value.
53  */
54 typedef enum {
55     /**
56      * No value, empty, not set.
57      */
58     DB_TYPE_EMPTY,
59     /**
60      * This will make the value a primary key / ID that can be any type.
61      */
62     DB_TYPE_PRIMARY_KEY,
63     /**
64      * A db_type_int32_t.
65      */
66     DB_TYPE_INT32,
67     /**
68      * A db_type_uint32_t.
69      */
70     DB_TYPE_UINT32,
71     /**
72      * A db_type_int64_t.
73      */
74     DB_TYPE_INT64,
75     /**
76      * A db_type_uint64_t.
77      */
78     DB_TYPE_UINT64,
79     /**
80      * A null terminated character string.
81      */
82     DB_TYPE_TEXT,
83     /**
84      * A enumerate value that can be represented as an integer or string.
85      */
86     DB_TYPE_ENUM,
87     /**
88      * This can be any type, primarily used for ID fields.
89      */
90     DB_TYPE_ANY,
91     /**
92      * This is a special revision type that can be used to track revisions of
93      * objects and only do changes against the current revision and in so will
94      * fail if someone else has changed the object. The revision type can be
95      * any type.
96      */
97     DB_TYPE_REVISION
98 } db_type_t;
99 
100 #endif
101