Source File modules/ca/ca_defs.h

    1    | /************************************************************************
    2    |  * This is the definitions header file for the configuration module.  It
    3    |  * includes the definitions of data structures, external declarations and
    4    |  * definitions, defitinitions of sybolic constants.
    5    |  *
    6    |  ************************************************************************/
    7    |
    8    | #include <pthread.h>
    9    | #include <glib.h>
    10   |
    11   | /* Number of configurations variables. */
    12   | #define VARS 86
    13   |
    14   | #define SCOPE_GLOBAL 1
    15   | #define SCOPE_LOCAL 99
    16   |
    17   | /*
    18   |  * Define the length of a string to be 160 to cope with the
    19   |  * copyright statement.
    20   |  *
    21   |  */
    22   | #define STRLENGTH 160
    23   |
    24   | /*
    25   | 	* Define the length of strings to cope with the values of
    26   |  * various types of string variables.
    27   | 	*/
    28   | #define STRLENGTH_S 40
    29   | #define STRLENGTH_M 80
    30   | #define STRLENGTH_L 160
    31   | #define STRLENGTH_XL 320
    32   |
    33   |
    34   | /**********************************************
    35   |  * Default values for the SOURCE variables		*
    36   | 	*															*
    37   |  **********************************************/
    38   |
    39   |  #define CA_DEFHOST "rowan"
    40   |  #define CA_DEFPORT "4343"
    41   |  #define CA_DEFUSER "dbase"
    42   |  #define CA_DEFPASSWORD "encrypt1"
    43   |  #define CA_DEFDBNAME	"default-db"
    44   |
    45   |
    46   |
    47   | /**********************************************
    48   |  * Defintion of the dictionary structures.		*
    49   | 	*															*
    50   |  **********************************************/
    51   |
    52   | typedef struct dict_s	{
    53   | 				char varName[STRLENGTH];
    54   | 				char varSym[STRLENGTH];
    55   | 				char varType[STRLENGTH];
    56   | 				int varScope;
    57   | 				int varNum;
    58   | } dict_t;
    59   |
    60   | extern dict_t dictionary[];
    61   |
    62   |
    63   |
    64   |
    65   | /**********************************************
    66   |  * Definition of the values structures.			*
    67   |  *															*
    68   | 	**********************************************/
    69   |
    70   | typedef struct values_s	{
    71   | 				char *strPtr;	/* Pointer to the string that contains the value. */
    72   | 				void *valPtr;	/* Pointer to the actual value. */
    73   | } values_t;
    74   |
    75   | /*
    76   |  * "extern" definition of variables that are defined elsewhere.
    77   |  */
    78   |
    79   |
    80   | extern values_t globals[];
    81   | extern values_t locals[];
    82   |
    83   | /*
    84   |  * "extern" definition of configuration variables, defined elsewhere.
    85   |  */
    86   | extern values_t confVars[];
    87   |
    88   | /* Mutex lock; used for synchronising changes. */
    89   | pthread_mutex_t Lock;
    90   |
    91   | /*
    92   | 	* New value of the bindport.
    93   | 	* This must be a global variable.
    94   | 	*/
    95   |
    96   | char newPort[16];
    97   |
    98   | /*
    99   |  * The following is needed for the SOURCE variable.  First,
    100  |  * we define the "database" structure.  Then, we define the
    101  |  * structure of an element of the linked list.  Lastly, we
    102  |  * define the linked list itself.
    103  |  */
    104  |
    105  | typedef struct ca_database_s	{
    106  |
    107  | 			char host[64];
    108  | 			char port[16];
    109  | 			char user[16];
    110  | 			char password[9];
    111  | 			char dbName[16];
    112  | 		} ca_database_t;
    113  |
    114  | extern ca_database_t ripe;
    115  | extern ca_database_t arin;
    116  | extern ca_database_t radb;
    117  |
    118  | typedef struct ca_database_list_s		{
    119  | 			char name[16];
    120  | 			ca_database_t db;
    121  | 		} ca_database_list_t;
    122  |
    123  | extern ca_database_list_t ripeComponent;
    124  | extern ca_database_list_t arinComponent;
    125  | extern ca_database_list_t radbComponent;
    126  |
    127  | typedef struct GSList {
    128  | 		gpointer src;		/* This points to a ca_database_list_t varialbe */
    129  | 		GSList *next;
    130  | 		} ca_source_t;
    131  |
    132  |
    133  | /*************************************************************
    134  |  * Definition of the default values for the SOURCE variable.	*
    135  |  *																				*
    136  |  *************************************************************/
    137  |
    138  | /*
    139  |  * char ca_defHost[64];
    140  |  * char ca_defPort[16];
    141  |  * char ca_defUser[16];
    142  |  * char ca_defPassword[9];
    143  |  * char ca_defdbName[16];
    144  |  */
    145  |
    146  | /*
    147  |  * extern char ca_defPort[16];
    148  |  * extern char ca_defHost[64];
    149  |  * extern char ca_defUser[16];
    150  |  * extern char ca_defPassword[9];
    151  |  * extern char ca_defdbName[16];
    152  |  */
    153  |
    154  | /*
    155  |  * The linked-list of sources.
    156  |  *
    157  |  */
    158  | extern GSList *sourceList;
    159  | extern ca_source_t *srcList;
    160  |
    161  | /*
    162  |  * 20000609
    163  |  * Experiment:
    164  |  * define the variable mySrcList as type GSList;
    165  |  * use the extern modifier and put the "real" definition
    166  |  * of the variable elsewhere.
    167  |  *
    168  |  * extern GSList *mySrcList;
    169  |  */
    170  |
    171  | /*
    172  | 	* The test configuration file.
    173  |  * This is defined using a constant string, cf. Oualline, p.145.
    174  |  */
    175  | extern const char *testFile;
    176  | extern const char *tempFile;
    177  | extern const char *dictFile;
    178  | extern const char *confFile;
    179  |
    180  | /*
    181  |  * Value returned by ca_getStorageLocation if the symbol for
    182  |  * a configuration variable cannot be found.
    183  |  *
    184  | 	* This value is also returned by ca_getType, if it cannot map
    185  |  * the name of a configuration variable to a data type.
    186  |  *
    187  |  */
    188  | #define NOT_FOUND -1
    189  |
    190  | /*
    191  |  * Symbolic constants defined to represent data types.
    192  |
    193  |  * #define CA_INT 			11
    194  |  * #define CA_STRING 		12
    195  |  * #define CA_DIRLIST 	13
    196  |  * #define CA_BOOLEAN 	14
    197  |  * #define CA_SOURCETYPE		15
    198  | 	*/
    199  |
    200  |