modules/ca/ca_defs.h

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

FUNCTIONS

This source file includes following functions.

   1 /***************************************
   2   $Revision: 
   3 
   4   CA module: definitions header file for the configuration module.
   5 
   6   Status: NOT REVIEWED, NOT TESTED
   7 
   8   Author(s):       Ambrose Magee
   9 
  10 ******************/ /******************
  11 Modification History:
  12 
  13 ******************/
  14 
  15 /************************************
  16   Copyright (c) 2000,2001,2002                    RIPE NCC
  17  
  18   All Rights Reserved
  19   
  20   Permission to use, copy, modify, and distribute this software and its
  21   documentation for any purpose and without fee is hereby granted,
  22   provided that the above copyright notice appear in all copies and that
  23   both that copyright notice and this permission notice appear in
  24   supporting documentation, and that the name of the author not be
  25   used in advertising or publicity pertaining to distribution of the
  26   software without specific, written prior permission.
  27   
  28   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  29   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
  30   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
  31   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  32   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  33   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  34  ***************************************/
  35 
  36 #ifndef CA_DEFS
  37 #define CA_DEFS
  38 
  39 /************************************************************************
  40  * This is the definitions header file for the configuration module.  It
  41  * includes the definitions of data structures, external declarations and
  42  * definitions, definitions of sybolic constants.
  43  *
  44  ************************************************************************/
  45 
  46 #include <pthread.h>
  47 #include <glib.h>
  48 
  49 #ifdef __cplusplus
  50 extern "C" {
  51 #endif
  52 
  53 /* Number of configurations variables. */
  54 #define VARS 120
  55 
  56 #define SCOPE_GLOBAL 1
  57 #define SCOPE_LOCAL 99
  58 
  59 /* 
  60  * Define the length of a string to be 160 to cope with the 
  61  * copyright statement.
  62  *
  63  */
  64 #define STRLENGTH 256
  65 
  66 /*
  67         * Define the length of strings to cope with the values of 
  68  * various types of string variables.
  69         */
  70 #define STRLENGTH_XS 40
  71 #define STRLENGTH_S 80
  72 #define STRLENGTH_M 160
  73 #define STRLENGTH_L 320
  74 #define STRLENGTH_XL 640
  75 #define STRLENGTH_XXL 2560
  76 
  77 
  78 /**********************************************
  79  * Default values for the SOURCE variables              *
  80         *                                                                                                                       *
  81  **********************************************/
  82 
  83  #define CA_DEFHOST "rowan"                                             
  84  #define CA_DEFPORT "4343"
  85  #define CA_DEFUSER "dbase"                                             
  86  #define CA_DEFPASSWORD "encrypt1"                              
  87  #define CA_DEFDBNAME   "default-db"                    
  88                                                                                                                         
  89 
  90 
  91 /**********************************************
  92  * Defintion of the dictionary structures.              *
  93         *                                                                                                                       *
  94  **********************************************/
  95 
  96 typedef struct dict_s   {
  97                                 char varName[STRLENGTH];
  98                                 char varSym[STRLENGTH];
  99                                 char varType[STRLENGTH];
 100                                 int varNum;
 101                                 int varMandatory;
 102                                 int varScope;
 103 } dict_t;
 104 
 105 extern dict_t dictionary[];
 106 
 107 
 108 
 109 
 110 /**********************************************
 111  * Definition of the values structures.                 *
 112  *                                                                                                                      *
 113         **********************************************/
 114 
 115 typedef struct values_s {
 116                            GString *strPtr;     /* Pointer to the GString that contains the value. */
 117                                 void *valPtr;   /* Pointer to the actual value. */
 118 } values_t;                                                                     
 119 
 120 /*
 121  * "extern" definition of variables that are defined elsewhere.
 122  */
 123 
 124 
 125 extern values_t globals[];
 126 extern values_t locals[];
 127 
 128 /*
 129  * "extern" definition of configuration variables, defined elsewhere.
 130  */
 131 extern values_t confVars[];
 132 
 133 /* Mutex lock; used for synchronising changes. */
 134 pthread_mutex_t Lock;
 135 
 136 /* 
 137         * New value of the bindport.
 138         * This must be a global variable.
 139  * This variable is no longer needed.
 140  * char newPort[16];
 141         */
 142 
 143 /*
 144  * The following is needed for the SOURCE variable.  First,
 145  * we define the "database" structure.  Then, we define the
 146  * structure of an element of the linked list.  Lastly, we 
 147  * define the linked list itself.
 148  */
 149 
 150 typedef struct ca_database_s    {
 151 
 152                         char host[64];
 153                         int port;
 154                         char user[16];
 155                         char password[9];
 156                         char dbName[16];
 157                 } ca_database_t;
 158 
 159 typedef struct ca_mirror_s              {
 160                         char host[64];
 161                         int port;
 162                         char log[64];
 163                         int delay;
 164                         int protocolVer;
 165                         char mrName[16];
 166                 } ca_mirror_t;
 167 
 168 typedef struct ca_ripadmin_s    {
 169                         char host[64];
 170                         int port;
 171                         char user[16];
 172                         char password[9];
 173                         char tableName[72];
 174                 } ca_ripadmin_t;
 175 
 176 extern ca_database_t ripe;
 177 extern ca_database_t arin;
 178 extern ca_database_t radb;
 179 
 180 typedef struct ca_database_list_s               {
 181                         char name[16];  
 182                         ca_database_t db;
 183                         int opMode;
 184                         ca_mirror_t nrtm;
 185                         int updPort;
 186                         char canupd[2];
 187                         char deflook[2];
 188                 } ca_database_list_t;
 189 
 190 /*
 191         * Define the type of a source.
 192  * This is the name of a source and
 193  * the details of the database which 
 194  * makes this source.
 195  */
 196 typedef struct ca_dbSource_s    {
 197                         char name[16];
 198                         ca_database_t db;
 199                         int opMode;
 200                         ca_mirror_t nrtm;
 201                         int updPort;
 202                         char canupd[2];
 203                         char deflook[2];
 204                 } ca_dbSource_t;
 205 
 206 /*
 207  * Define the source handle:
 208  * this is a pointer to a source;
 209  * i.e. it is of type ca_dbSource_t.
 210  */
 211 typedef ca_dbSource_t ca_SrcHdl_t;
 212 
 213 
 214 /*
 215  * Define an updateSource.  This is used by dbupdate.
 216  *
 217  */
 218 typedef struct ca_updDbSource_s {
 219                         char name[16];
 220                         ca_database_t updDb;
 221                         char whoisd_host[32];
 222                         int qryPort;
 223                         int updPort;
 224                 } ca_updDbSource_t;
 225 
 226 
 227 
 228 extern ca_database_list_t ripeComponent;
 229 extern ca_database_list_t arinComponent;
 230 extern ca_database_list_t radbComponent;
 231 
 232 /*
 233  * typedef struct GSList {
 234         *       gpointer src;           
 235         *       GSList *next;
 236         *       } ca_source_t;
 237  */
 238  /* gpointer src;               This points to a ca_database_list_t varialbe */
 239 
 240 
 241 /*************************************************************
 242  * Definition of the default values for the SOURCE variable.    *
 243  *                                                                                                                                                              *
 244  *************************************************************/
 245 
 246 /*
 247  * char ca_defHost[64];
 248  * char ca_defPort[16];
 249  * char ca_defUser[16];
 250  * char ca_defPassword[9];
 251  * char ca_defdbName[16];
 252  */
 253 
 254 /*
 255  * extern char ca_defPort[16];
 256  * extern char ca_defHost[64];
 257  * extern char ca_defUser[16];
 258  * extern char ca_defPassword[9];
 259  * extern char ca_defdbName[16];
 260  */
 261 
 262 /*
 263  * The linked-list of sources.
 264  *
 265  */
 266 extern GSList *sourceList;
 267 
 268 /*
 269         * The linked-list of databases and mirrors used by ca_readSources()
 270  */
 271 extern GSList *dbList;
 272 extern GSList *nrtmList;
 273 
 274 /*
 275  */
 276 
 277 /*
 278  * extern ca_source_t *srcList;
 279  */
 280 
 281 /*
 282  * A varialbe of type GSList
 283  */
 284 extern ca_dbSource_t *testSource;
 285 
 286 
 287 /*
 288  * 20000609
 289  * Experiment:
 290  * define the variable mySrcList as type GSList;
 291  * use the extern modifier and put the "real" definition
 292  * of the variable elsewhere.
 293  *
 294  * extern GSList *mySrcList;
 295  */
 296 
 297 /*
 298         * The test configuration file.
 299  * This is defined using a constant string, cf. Oualline, p.145.
 300  */
 301 extern const char *testFile;
 302 extern const char *tempFile;
 303 extern const char *dictFile;
 304 extern const char *confFile;
 305 extern const char *sourcesFile;
 306 
 307 /* 
 308  * Value returned by ca_getStorageLocation if the symbol for
 309  * a configuration variable cannot be found.
 310  *
 311         * This value is also returned by ca_getType, if it cannot map 
 312  * the name of a configuration variable to a data type.
 313  *
 314  */
 315 #define NOT_FOUND -1    
 316 #define INCOMPLETE -1
 317 
 318 /*
 319  * Definition of the identifiers used in the sources configuration file.
 320  */
 321 #define DATABASE_KEY    "DATABASE"
 322 #define NRTM_KEY        "NRTM"
 323 #define SOURCE_KEY "SOURCE"
 324 
 325 /*
 326  * Symbolic constants defined to represent data types.
 327 
 328  * #define CA_INT                       11
 329  * #define CA_STRING            12
 330  * #define CA_DIRLIST   13
 331  * #define CA_BOOLEAN   14
 332  * #define CA_SOURCETYPE                15
 333         */
 334 
 335 extern ca_dbSource_t *theSrc;
 336 
 337 /*
 338         * Macros and const char * definitions for warning and error 
 339  * messages.
 340  */
 341 
 342 extern const char *configWarningStr;
 343 extern const char *configError_1Str;
 344 extern const char *configError_2Str;
 345 extern const char *configVarChk_OK_Str;
 346 
 347 
 348 #ifdef __cplusplus
 349 }
 350 #endif
 351 
 352 
 353 #endif /* CA_DEFS */

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