1 | /***************************************
2 | $Revision:
3 |
4 | CA module: function prototypes.
5 |
6 | Status: NOT REVIEWED, NOT TESTED
7 |
8 | Author(s): Ambrose Magee
9 |
10 | ******************/ /******************
11 | Modification History:
12 | ******************/
13 |
14 | /************************************
15 | Copyright (c) 2000 RIPE NCC
16 |
17 | All Rights Reserved
18 |
19 | Permission to use, copy, modify, and distribute this software and its
20 | documentation for any purpose and without fee is hereby granted,
21 | provided that the above copyright notice appear in all copies and that
22 | both that copyright notice and this permission notice appear in
23 | supporting documentation, and that the name of the author not be
24 | used in advertising or publicity pertaining to distribution of the
25 | software without specific, written prior permission.
26 |
27 | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
28 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
29 | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
30 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
31 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
32 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33 | ***************************************/
34 |
35 | #ifndef CA_CONFIGFNS_H
36 | #define CA_CONFIGFNS_H
37 |
38 | #include "ca_defs.h"
39 | #include <memwrap.h>
40 | #include <erroutines.h>
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 |
47 | /**********************************************************************
48 | * This file contains the all the functions prototypes. *
49 | **********************************************************************/
50 |
51 |
52 | void stringPack(char *, const char *);
53 |
54 | /*
55 | * This function prototype is for a function which reads a file and
56 | * splits it into tokens.
57 | *
58 | */
59 | void opSplitsen(FILE *, gchar **);
60 |
61 | /*********************************************************************
62 | * ca_populateDictionary() function -- populates the dictionary with the
63 | * contents of the dictionary file.
64 | *
65 | * Parameters
66 | * woordenbook[] -- an array of dictionary structures.
67 | * size -- the size of the array.
68 | *
69 | * Returns
70 | * Nothing.
71 | *
72 | *********************************************************************/
73 |
74 | void ca_populateDictionary(dict_t [], int);
75 |
76 | void getDictionary(dict_t [], int);
77 |
78 | /*
79 | * readConfig()
80 | * Reads the configuration text file.
81 | */
82 |
83 | void ca_readConfig(const char *, values_t [], int);
84 |
85 | /*
86 | * void ca_init(values_t [], values_t []);
87 | */
88 | void ca_init(const char *);
89 |
90 | /*
91 | * The get functions.
92 | */
93 | int ca_get_int(int);
94 | char *ca_get_dirlist(int);
95 | char *ca_get_string(int);
96 | int ca_get_boolean(int symbol);
97 |
98 | /*
99 | * The set functions.
100 | */
101 | void ca_set_int(int);
102 | void ca_set_dirlist(int);
103 | void ca_set_string(int);
104 | void ca_set_boolean(int symbol);
105 |
106 | /*
107 | * The get functions for the database and SOURCE variables.
108 | */
109 | void ca_getDatabase(ca_database_t);
110 | void ca_getSource(ca_database_list_t);
111 | void ca_getSourcePtr(ca_database_list_t *);
112 | void ca_getAllSources(GSList *);
113 |
114 | /*
115 | * The get function for the Dictionary.
116 | *
117 | */
118 | void ca_getDictionary(dict_t [], int);
119 |
120 | /*
121 | * The get function for the string elements of the
122 | * the configuration structure.
123 | */
124 | void ca_getConfig(values_t [], int);
125 |
126 | /*
127 | * A function that walks through the linked list of sources
128 | * and compares the name of each source with a user-supplied
129 | * name. If it finds the name of the source, it prints the
130 | * details of the source.
131 | */
132 | void ca_getAsource(char *, GSList *);
133 |
134 |
135 | /*
136 | * A function that walks through the linked list of sources
137 | * and compares the name of each source with a user-supplied
138 | * name. If it finds the name of the source, it returns a
139 | * pointer to the structure that represents the source.
140 | */
141 | ca_dbSource_t *ca_getSourceDetails(char *, GSList *);
142 |
143 | /*
144 | * A function that returns a handle to a Source,
145 | * given its position in the linked-list of sources.
146 | *
147 | */
148 | ca_SrcHdl_t *ca_get_SourceHandleByPosition(int);
149 |
150 | /* ca_get_SourceHandleByName(char *);
151 | *
152 | * A function that returns a handle to a Source,
153 | * given its name in the linked-list of sources.
154 | *
155 | */
156 | ca_SrcHdl_t *ca_get_SourceHandleByName(char *);
157 |
158 | /*
159 | * Given a source-handle and an attribute, returns a
160 | * pointer to a character variable.
161 | */
162 | char *ca_srchandle2Strelement(ca_SrcHdl_t *, int );
163 |
164 | /*
165 | * Given a source-handle and an attribute, returns an
166 | * integer.
167 | */
168 | int ca_srchandle2Intelement(ca_SrcHdl_t *ah, int srcAttrib);
169 |
170 | /*
171 | * Returns a string element of the admin db structure.
172 | */
173 | char *ca_get_adminStrElement(int symbol, int adminAttrib);
174 |
175 | /*
176 | * Returns an int element of the admin db structure.
177 | */
178 | int ca_get_adminIntElement(int symbol, int adminAttrib);
179 |
180 | /*
181 | * Writes a new value of a variable back to the configuration file;
182 | * returns 0 on successful completion; otherwise it dies.
183 | */
184 | int ca_writeNewValue(int, char *);
185 |
186 | /*
187 | * Given a symbol from the list of symbols of variable types,
188 | * this returns a handle (pointer) to the Update Source.
189 | */
190 | ca_updDbSource_t *ca_get_UpdSourceHandle(int );
191 |
192 | /*
193 | * Given a pointer to the Update Source and a symbol from the list
194 | * of symbols of attributes, this returns a copy of a string
195 | * attribute of the Update Source variable.
196 | */
197 | char *ca_UpdSrcHandle2StrElement(ca_updDbSource_t *, int);
198 |
199 | /*
200 | * Given a pointer to the Update Source and a symbol from the list
201 | * of symbols of attributes, this returns the value of an integer
202 | * attribute of the Update Source variable.
203 | */
204 | int ca_UpdSrcHandle2IntElement(ca_updDbSource_t *, int);
205 |
206 | /*
207 | * Given the name of the sources file and the array of values,
208 | * this function reads the definitions of databases, mirrors, etc.
209 | * and loads the SOURCE variable.
210 | */
211 | void ca_readSources(const char *, values_t []);
212 |
213 | /*
214 | * Given a pointer to the linked list of databases,
215 | * this function returns the details of every database
216 | * in the list.
217 | */
218 | void ca_getAllDatabases(GSList *);
219 |
220 |
221 | /*
222 | * Given a pointer to the linked list of mirrors,
223 | * this function returns the details of every mirror
224 | * in the list.
225 | */
226 | void ca_getAllMirrors(GSList *);
227 |
228 | /* ca_get_DbHandleByName(char *);
229 | *
230 | * A function that returns a handle to a Database
231 | * given its name in the linked-list of databases.
232 | *
233 | */
234 | ca_database_t *ca_getDbHandleByName(char *);
235 | ca_SrcHdl_t *ca_get_SourceHandleByName(char *);
236 | ca_mirror_t *ca_getNrtmHandleByName(char *);
237 |
238 | /*
239 | * ca_sanityChk()
240 | * -- Checks if all variables in the dictionary have been defined
241 | * in the configuration file.
242 | *
243 | */
244 | int ca_sanityChk(values_t []);
245 | int ca_sanityCheck(values_t []);
246 |
247 |
248 | /*
249 | * ca_mandVarChk()
250 | * - checks if all the mandatory variables in the dictionary have
251 | * been defined in the configuration file.
252 | */
253 | int ca_mandVarChk();
254 |
255 |
256 | /*
257 | * ca_conifigCheck()
258 | * - wrapper for the ca_sanityCheck() function.
259 | */
260 | int ca_conifigCheck();
261 |
262 | #ifdef __cplusplus
263 | }
264 | #endif
265 |
266 |
267 |
268 | #endif