OpenDNSSEC-enforcer  1.4.5
db_fields.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  */
26 
27 #ifndef KSM_DB_FIELDS_H
28 #define KSM_DB_FIELDS_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*+
35  * db_fields.h - KSM database Field Definitions
36  *
37  * Description:
38  * Gives the relative positions of fields with a table.
39  *
40  * Each constant is of the form
41  *
42  * DB_<table name>_<field name>
43  *
44  * Also defined are:
45  *
46  * DB_INVALID A value that is always an invalid field value
47  * DB_<table>_NFIELD Number of fields in the given table
48 -*/
49 
50 /* Invalid field number */
51 
52 #define DB_INVALID -1
53 
54 /* Keydata_view fields */
55 
56 #define DB_KEYDATA_FIELDS "id, state, generate, publish, ready, active, retire, dead, keytype, algorithm, location, zone_id, fixedDate"
57 #define DB_KEYDATA_ID 0
58 #define DB_KEYDATA_STATE 1
59 #define DB_KEYDATA_GENERATE 2
60 #define DB_KEYDATA_PUBLISH 3
61 #define DB_KEYDATA_READY 4
62 #define DB_KEYDATA_ACTIVE 5
63 #define DB_KEYDATA_RETIRE 6
64 #define DB_KEYDATA_DEAD 7
65 #define DB_KEYDATA_KEYTYPE 8
66 #define DB_KEYDATA_ALGORITHM 9
67 #define DB_KEYDATA_LOCATION 10
68 #define DB_KEYDATA_ZONE_ID 11
69 #define DB_KEYDATA_FIXED_DATE 12
70 
71 #define DB_KEYDATA_NFIELD 13
72 
73 /* Parameter_view (and list) fields */
74 
75 #define DB_PARAMETER_VIEW_FIELDS "name, category, parameter_id, value, policy_id"
76 #define DB_PARAMETER_LIST_FIELDS "name, category, parameter_id"
77 #define DB_PARAMETER_NAME 0
78 #define DB_PARAMETER_CATEGORY 1
79 #define DB_PARAMETER_ID 2
80 #define DB_PARAMETER_VALUE 3
81 #define DB_PARAMETER_POLICY_ID 4
82 
83 #define DB_PARAMETER_VIEW_NFIELD 5
84 #define DB_PARAMETER_LIST_NFIELD 3
85 
86 #define DB_POLICY_PARAMETER_NAME 0
87 #define DB_POLICY_PARAMETER_CATEGORY 1
88 #define DB_POLICY_PARAMETER_VALUE 2
89 
90 #define DB_SECURITY_MODULE_TABLE "securitymodules"
91 #define DB_SECURITY_MODULE_FIELDS "id, name, capacity, requirebackup"
92 #define DB_SECURITY_MODULE_ID 0
93 #define DB_SECURITY_MODULE_NAME 1
94 #define DB_SECURITY_MODULE_CAPACITY 2
95 #define DB_SECURITY_MODULE_REQUIREBACKUP 3
96 
97 #define DB_ZONE_TABLE "zones"
98 #define DB_ZONE_FIELDS "id, name, policy_id, signconf, input, output, in_type, out_type"
99 #define DB_ZONE_ID 0
100 #define DB_ZONE_NAME 1
101 #define DB_ZONE_POLICY_ID 2
102 #define DB_ZONE_SIGNCONF 3
103 #define DB_ZONE_INPUT 4
104 #define DB_ZONE_OUTPUT 5
105 #define DB_ZONE_IN_TYPE 6
106 #define DB_ZONE_OUT_TYPE 7
107 
108 /* policy select variables, including salt */
109 #define DB_POLICY_ID 0
110 #define DB_POLICY_NAME 1
111 #define DB_POLICY_DESCRIPTION 2
112 #define DB_POLICY_SALT 1
113 #define DB_POLICY_SALT_STAMP 2
114 
115 
116 /* when selecting count(*) from ... */
117 #define DB_COUNT 0
118 
119 #ifdef __cplusplus
120 };
121 #endif
122 
123 #endif /* KSM_DB_FIELDS_H */