## include/ca_configFns.h

/* [<][>][^][v][top][bottom][index][help] */

## FUNCTIONS

This source file includes following functions.

       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
      40 #ifdef __cplusplus
      41 extern "C" {
      42 #endif
      43
      44
      45 /**********************************************************************
      46         * This file contains the all the functions prototypes.                                  *
      47  **********************************************************************/
      48
      49
      50 void stringPack(char *, const char *);
      51
      52 /*
      53  * This function prototype is for a function which reads a file and
      54  * splits it into tokens.
      55  *
      56  */
      57 void opSplitsen(FILE *, gchar **);
      58
      59 /*********************************************************************
      60  * ca_populateDictionary() function -- populates the dictionary with the
      61  * contents of the dictionary file.
      62  *
      63  * Parameters
      64  *    woordenbook[] -- an array of dictionary structures.
      65    *  size -- the size of the array.
      66  *
      67  * Returns
      68  *  Nothing.
      69  *
      70  *********************************************************************/
      71
      72 void ca_populateDictionary(dict_t [], int);
      73
      74 void getDictionary(dict_t [], int);
      75
      76 /*
      77  * readConfig()
      78  * Reads the configuration text file.
      79  */
      80
      81 void ca_readConfig(const char *, values_t [], int);
      82
      83 /*
      84  * void ca_init(values_t [], values_t []);
      85  */
      86 void ca_init(const char *);
      87
      88 /*
      89  * The get functions.
      90  */
      91 int ca_get_int(int);
      92 char *ca_get_dirlist(int);
      93 char *ca_get_string(int);
      94 int ca_get_boolean(int symbol);
      95
      96 /*
      97  * The set functions.
      98         */
      99 void ca_set_int(int);
     100 void ca_set_dirlist(int);
     101 void ca_set_string(int);
     102 void ca_set_boolean(int symbol);
     103
     104 /*
     105  * The get functions for the database and SOURCE variables.
     106  */
     107 void ca_getDatabase(ca_database_t);
     108 void ca_getSource(ca_database_list_t);
     109 void ca_getSourcePtr(ca_database_list_t *);
     110 void ca_getAllSources(GSList *);
     111
     112 /*
     113  * The get function for the Dictionary.
     114  *
     115  */
     116 void ca_getDictionary(dict_t [], int);
     117
     118 /*
     119         * The get function for the string elements of the
     120  * the configuration structure.
     121  */
     122 void ca_getConfig(values_t [], int);
     123
     124 /*
     125         * A function that walks through the linked list of sources
     126  * and compares the name of each source with a user-supplied
     127  * name.  If it finds the name of the source, it prints the
     128  * details of the source.
     129  */
     130 void ca_getAsource(char *, GSList *);
     131
     132
     133 /*
     134         * A function that walks through the linked list of sources
     135  * and compares the name of each source with a user-supplied
     136  * name.  If it finds the name of the source, it returns a
     137  * pointer to the structure that represents the source.
     138  */
     139 ca_dbSource_t *ca_getSourceDetails(char *, GSList *);
     140
     141 /*
     142         * A function that returns a handle to a Source,
     143  * given its position in the linked-list of sources.
     144  *
     145  */
     146 ca_SrcHdl_t *ca_get_SourceHandleByPosition(int);
     147
     148 /* ca_get_SourceHandleByName(char *);
     149         *
     150         * A function that returns a handle to a Source,
     151  * given its name in the linked-list of sources.
     152  *
     153  */
     154 ca_SrcHdl_t *ca_get_SourceHandleByName(char *);
     155
     156 /*
     157         * Given a source-handle and an attribute, returns a
     158  * pointer to a character variable.
     159  */
     160 char *ca_srchandle2Strelement(ca_SrcHdl_t *, int );
     161
     162 /*
     163         * Given a source-handle and an attribute, returns an
     164  * integer.
     165  */
     166 int ca_srchandle2Intelement(ca_SrcHdl_t *ah, int srcAttrib);
     167
     168 /*
     169  * Returns a string element of the admin db structure.
     170  */
     171 char *ca_get_adminStrElement(int symbol, int adminAttrib);
     172
     173 /*
     174         * Returns an int element of the admin db structure.
     175  */
     176 int ca_get_adminIntElement(int symbol, int adminAttrib);
     177
     178 /*
     179  * Writes a new value of a variable back to the configuration file;
     180  * returns 0 on successful completion; otherwise it dies.
     181  */
     182 int ca_writeNewValue(int, char *);
     183
     184 /*
     185         * Given a symbol from the list of symbols of variable types,
     186         * this returns a handle (pointer) to the Update Source.
     187  */
     188 ca_updDbSource_t *ca_get_UpdSourceHandle(int );
     189
     190 /*
     191         * Given a pointer to the Update Source and a symbol from the list
     192  * of symbols of attributes, this returns a copy of a string
     193  * attribute of the Update Source variable.
     194  */
     195 char *ca_UpdSrcHandle2StrElement(ca_updDbSource_t *, int);
     196
     197 /*
     198         * Given a pointer to the Update Source and a symbol from the list
     199         * of symbols of attributes, this returns the value of an integer
     200         * attribute of the Update Source variable.
     201  */
     202 int ca_UpdSrcHandle2IntElement(ca_updDbSource_t *, int);
     203
     204 /*
     205  * Given the name of the sources file and the array of values,
     206  * this function reads the definitions of databases, mirrors, etc.
     207  * and loads the SOURCE variable.
     208  */
     209 void ca_readSources(const char *, values_t []);
     210
     211 /*
     212         * Given a pointer to the linked list of databases,
     213  * this function returns the details of every database
     214  * in the list.
     215  */
     216 void ca_getAllDatabases(GSList *);
     217
     218
     219 /*
     220         * Given a pointer to the linked list of mirrors,
     221  * this function returns the details of every mirror
     222  * in the list.
     223  */
     224 void ca_getAllMirrors(GSList *);
     225
     226 /* ca_get_DbHandleByName(char *);
     227         *
     228         * A function that returns a handle to a Database
     229  * given its name in the linked-list of databases.
     230  *
     231  */
     232 ca_database_t *ca_getDbHandleByName(char *);
     233 ca_SrcHdl_t *ca_get_SourceHandleByName(char *);
     234 ca_mirror_t *ca_getNrtmHandleByName(char *);
     235
     236 /*
     237         * ca_sanityChk()
     238  *      -- Checks if all variables in the dictionary have been defined
     239  *              in the configuration file.
     240  *
     241  */
     242 int ca_sanityChk(values_t []);
     243 int ca_sanityCheck(values_t []);
     244
     245
     246 /*
     247         * ca_mandVarChk()
     248         * - checks if all the mandatory variables in the dictionary have
     249  *   been defined in the configuration file.
     250  */
     251 int ca_mandVarChk();
     252
     253
     254 /*
     255         * ca_conifigCheck()
     256         *       - wrapper for the ca_sanityCheck() function.
     257  */
     258 int ca_conifigCheck();
     259
     260 #ifdef __cplusplus
     261 }
     262 #endif
     263
     264
     265
     266 #endif

/* [<][>][^][v][top][bottom][index][help] */