modules/df/defs.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
1 #ifndef READ_DEFS
2 #define READ_DEFS
3
4 /***************************************
5 $Revision: 1.14 $
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 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,
43 R_RADIX,
44 R_END
45 } R_Type_t;
46
47 typedef enum _Q_Type_t {
48 Q_LOOKUP=0,
49 Q_INVERSE
50 } Q_Type_t;
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;
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;
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__,
89 UD_AX_PR,
90 UD_AX_MT,
91 UD_AX_MO,
92 UD_AX_MR,
93 UD_AX_MU,
94 UD_LEAF_,
95 UD_LF_IF,
96 UD_LF_RF,
97 UD_LF_AT,
98 UD_LF_OT,
99 UD_LF_AY,
100 UD_MAIN_,
101 UD_MA_RT,
102 UD_MA_OR,
103 UD_MA_PR,
104 UD_MA_U2,
105 UD_MA_IN,
106 UD_MA_I6,
107 UD_MA_AK,
108 UD_NULL_
109 } UD_qtype;
110
111 typedef struct UD_query_t {
112 UD_qtype qtype;
113 char * const qry;
114 } UD_query;
115
116 /* take nothing, return array of strings */
117 char * const *DF_get_filter_names(void);
118 char * const *DF_get_class_names(void);
119 char * const *DF_get_class_aliases(void);
120 char * const *DF_get_attribute_aliases(void);
121 char * const *DF_get_attribute_names(void);
122 char * const *DF_get_server_queries(void);
123
124
125 /* take class type enum, return the corresponding string */
126 char * const DF_get_class_sql_table(C_Type_t index);
127 const char *DF_get_class_template(C_Type_t index);
128 const char *DF_get_class_template_v(C_Type_t index);
129 const char *DF_class_type2name(C_Type_t index);
130 char * const DF_get_class_code(C_Type_t index);
131
132 /* take index to class alias array */
133 int DF_get_class_index(int alias_index);
134
135 /* index to attribute alias array */
136 int DF_get_attribute_index(int alias_index);
137
138 /* take attribute type enum, return the corresponding string */
139 const char *DF_get_attribute_name(A_Type_t index);
140 const char *DF_get_attribute_code(A_Type_t index);
141
142 /* take attribute type enum, return UD related data: */
143 /* return the corresponding UD query string */
144 const char *DF_get_update_query(A_Type_t index);
145 const char *DF_get_select_query(A_Type_t index);
146 const char *DF_get_insert_query(A_Type_t index);
147 const char *DF_get_dummy_query(A_Type_t index);
148 /* return the corresponding UD query type */
149 UD_qtype DF_get_update_query_type(A_Type_t index);
150 UD_qtype DF_get_insert_query_type(A_Type_t index);
151 UD_qtype DF_get_select_query_type(A_Type_t index);
152 UD_qtype DF_get_dummy_query_type(A_Type_t index);
153
154 /* take attribute type enum, return radix related data: */
155 /* return boolean if attribute has a radix tree */
156 int DF_attrcode_has_radix_lookup(A_Type_t attr);
157 /* return radix family */
158 rx_fam_t DF_attrcode_radix_family(A_Type_t attr);
159 /* return query string to load the v4/v6 radix tree*/
160 char * DF_attrcode_radix_load_v4(A_Type_t attr);
161 char * DF_attrcode_radix_load_v6(A_Type_t attr);
162
163 /* take string, return corresponding enum code */
164 A_Type_t DF_attribute_code2type(const gchar *token);
165 A_Type_t DF_attribute_name2type (const gchar *token);
166 C_Type_t DF_class_code2type(const gchar *token);
167 C_Type_t DF_class_name2type(const gchar *token);
168
169 #endif /* READ_DEFS */
170