/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following functions.
- R_SQL
- R_RADIX
- R_END
- R_Type_t
- Q_LOOKUP
- Q_INVERSE
- Q_Type_t
- Query_t
- DF_Load_t
- UD_AUX__
- UD_AX_PR
- UD_AX_MT
- UD_AX_MO
- UD_AX_MR
- UD_AX_MU
- UD_AX_IT
- UD_LEAF_
- UD_LF_IF
- UD_LF_RF
- UD_LF_AT
- UD_LF_OT
- UD_LF_AY
- UD_MAIN_
- UD_MA_RT
- UD_MA_OR
- UD_MA_PR
- UD_MA_U2
- UD_MA_IN
- UD_MA_I6
- UD_MA_AK
- UD_NULL_
- UD_qtype
- UD_query
1 #ifndef READ_DEFS
2 #define READ_DEFS
3
4 /***************************************
5 $Revision: 1.16 $
6
7 Objects module (ob) - this _should_ eventually get merged in with the
8 config module.
9
10 Status: NOT REVUED, NOT TESTED
11
12 ******************/ /******************
13 Copyright (c) 1999,2000,2001,2002 RIPE NCC
14
15 All Rights Reserved
16
17 Permission to use, copy, modify, and distribute this software and its
18 documentation for any purpose and without fee is hereby granted,
19 provided that the above copyright notice appear in all copies and that
20 both that copyright notice and this permission notice appear in
21 supporting documentation, and that the name of the author not be
22 used in advertising or publicity pertaining to distribution of the
23 software without specific, written prior permission.
24
25 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
26 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
27 AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
28 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
29 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
30 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 ***************************************/
32 #include <glib.h>
33 #include "bitmask.h"
34
35 #include "DF_class_enum.def"
36 #include "DF_class_mask.def"
37
38 #include "DF_attribute_enum.def"
39 #include "DF_attribute_inv_attr_mask.def"
40
41 typedef enum _R_Type_t {
42 R_SQL=0,
/* [<][>][^][v][top][bottom][index][help] */
43 R_RADIX,
/* [<][>][^][v][top][bottom][index][help] */
44 R_END
/* [<][>][^][v][top][bottom][index][help] */
45 } R_Type_t;
/* [<][>][^][v][top][bottom][index][help] */
46
47 typedef enum _Q_Type_t {
48 Q_LOOKUP=0,
/* [<][>][^][v][top][bottom][index][help] */
49 Q_INVERSE
/* [<][>][^][v][top][bottom][index][help] */
50 } Q_Type_t;
/* [<][>][^][v][top][bottom][index][help] */
51
52 #include "which_keytypes.h"
53 #include "iproutines.h"
54 #include "rxroutines.h"
55
56 typedef struct {
57 R_Type_t refer;
58 Q_Type_t querytype;
59 WK_Type keytype;
60 A_Type_t attribute;
61 C_Type_t class;
62 char * const query;
63 char * const descr;
64 } Query_t;
/* [<][>][^][v][top][bottom][index][help] */
65
66 #ifdef DEFS_IMPL
67 #include "QI_queries.def"
68 #else
69 extern Query_t Query[];
70 #endif
71
72
73 typedef struct {
74 A_Type_t attr;
75 rx_fam_t family;
76 char * ipv4_load;
77 char * ipv6_load;
78 } DF_Load_t;
/* [<][>][^][v][top][bottom][index][help] */
79 #ifdef DEFS_IMPL
80 #include "DF_radix_load.def"
81 #else
82 extern DF_Load_t DF_radix_load[];
83 #endif
84
85
86
87 typedef enum UD_qtype_t {
88 UD_AUX__,
/* [<][>][^][v][top][bottom][index][help] */
89 UD_AX_PR,
/* [<][>][^][v][top][bottom][index][help] */
90 UD_AX_MT,
/* [<][>][^][v][top][bottom][index][help] */
91 UD_AX_MO,
/* [<][>][^][v][top][bottom][index][help] */
92 UD_AX_MR,
/* [<][>][^][v][top][bottom][index][help] */
93 UD_AX_MU,
/* [<][>][^][v][top][bottom][index][help] */
94 UD_AX_IT,
/* [<][>][^][v][top][bottom][index][help] */
95 UD_LEAF_,
/* [<][>][^][v][top][bottom][index][help] */
96 UD_LF_IF,
/* [<][>][^][v][top][bottom][index][help] */
97 UD_LF_RF,
/* [<][>][^][v][top][bottom][index][help] */
98 UD_LF_AT,
/* [<][>][^][v][top][bottom][index][help] */
99 UD_LF_OT,
/* [<][>][^][v][top][bottom][index][help] */
100 UD_LF_AY,
/* [<][>][^][v][top][bottom][index][help] */
101 UD_MAIN_,
/* [<][>][^][v][top][bottom][index][help] */
102 UD_MA_RT,
/* [<][>][^][v][top][bottom][index][help] */
103 UD_MA_OR,
/* [<][>][^][v][top][bottom][index][help] */
104 UD_MA_PR,
/* [<][>][^][v][top][bottom][index][help] */
105 UD_MA_U2,
/* [<][>][^][v][top][bottom][index][help] */
106 UD_MA_IN,
/* [<][>][^][v][top][bottom][index][help] */
107 UD_MA_I6,
/* [<][>][^][v][top][bottom][index][help] */
108 UD_MA_AK,
/* [<][>][^][v][top][bottom][index][help] */
109 UD_NULL_
/* [<][>][^][v][top][bottom][index][help] */
110 } UD_qtype;
/* [<][>][^][v][top][bottom][index][help] */
111
112 typedef struct UD_query_t {
113 UD_qtype qtype;
114 char * const qry;
115 } UD_query;
/* [<][>][^][v][top][bottom][index][help] */
116
117 /* take nothing, return array of strings */
118 char * const *DF_get_filter_names(void);
119 char * const *DF_get_class_names(void);
120 char * const *DF_get_class_aliases(void);
121 char * const *DF_get_attribute_aliases(void);
122 char * const *DF_get_attribute_names(void);
123 char * const *DF_get_server_queries(void);
124
125
126 /* take class type enum, return the corresponding string */
127 char * const DF_get_class_sql_table(C_Type_t index);
128 const char *DF_get_class_template(C_Type_t index);
129 const char *DF_get_class_template_v(C_Type_t index);
130 const char *DF_class_type2name(C_Type_t index);
131 char * const DF_get_class_code(C_Type_t index);
132
133 /* take index to class alias array */
134 int DF_get_class_index(int alias_index);
135
136 /* index to attribute alias array */
137 int DF_get_attribute_index(int alias_index);
138
139 /* take attribute type enum, return the corresponding string */
140 const char *DF_get_attribute_name(A_Type_t index);
141 const char *DF_get_attribute_code(A_Type_t index);
142
143 /* take attribute type enum, return UD related data: */
144 /* return the corresponding UD query string */
145 const char *DF_get_update_query(A_Type_t index);
146 const char *DF_get_select_query(A_Type_t index);
147 const char *DF_get_insert_query(A_Type_t index);
148 const char *DF_get_dummy_query(A_Type_t index);
149 /* return the corresponding UD query type */
150 UD_qtype DF_get_update_query_type(A_Type_t index);
151 UD_qtype DF_get_insert_query_type(A_Type_t index);
152 UD_qtype DF_get_select_query_type(A_Type_t index);
153 UD_qtype DF_get_dummy_query_type(A_Type_t index);
154
155 /* take attribute type enum, return radix related data: */
156 /* return boolean if attribute has a radix tree */
157 int DF_attrcode_has_radix_lookup(A_Type_t attr);
158 /* return radix family */
159 rx_fam_t DF_attrcode_radix_family(A_Type_t attr);
160 /* return query string to load the v4/v6 radix tree*/
161 char * DF_attrcode_radix_load_v4(A_Type_t attr);
162 char * DF_attrcode_radix_load_v6(A_Type_t attr);
163
164 /* take string, return corresponding enum code */
165 A_Type_t DF_attribute_code2type(const gchar *token);
166 A_Type_t DF_attribute_name2type (const gchar *token);
167 C_Type_t DF_class_code2type(const gchar *token);
168 C_Type_t DF_class_name2type(const gchar *token);
169
170 #endif /* READ_DEFS */
171