Cross reference for co/constants.c of index.

# File co/constants.c

      $Revision: 1.21 $

      Constants module (co) - this _should_ eventually get merged in with the
      config module.

      Status: NOT REVUED, NOT TESTED

    Online References:

      Instructions for use:

        To add a constant:
          0. Add a default value for the constant. (string)
          1. Add the constant declaration to the _Constants struct.
          2. Add a CO_get_function()
          3. Add initializing code to init_constants()

        To access the constant:
          use the CO_get<Constant>() function from your other code.

## Included Files

- `#include ";/home/shane/release/RIP/include/rip.h";`
  - `#include </home/shane/release/RIP/include/config.h>`
  - `#include <sys/param.h>`
  - `#include <glib.h>`
  - `#include ";/home/shane/release/RIP/include/AU_util.h";`
    - `#include <stdio.h>`
    - `#include <stdlib.h>`
    - `#include <string.h>`
    - `#include <sys/types.h>`
    - `#include <unistd.h>`
    - `#include <regex.h>`
    - `#include <glib.h>`
  - `#include ";/home/shane/release/RIP/include/aa.h";`
    - `#include ";/home/shane/release/RIP/include/iproutines.h";`
      - `#include <sys/types.h>`
      - `#include <glib.h>`
      - `#include </home/shane/release/RIP/include/inet6def.h>`
      - `#include </home/shane/release/RIP/include/erroutines.h>`
  - `#include ";/home/shane/release/RIP/include/access_control.h";`
    - `#include ";/home/shane/release/RIP/include/timediff.h";`
      - `#include <sys/time.h>`
    - `#include ";/home/shane/release/RIP/include/erroutines.h";`
    - `#include ";/home/shane/release/RIP/include/iproutines.h";`
    - `#include ";/home/shane/release/RIP/include/rxroutines.h";`
      - `#include <glib.h>`
      - `#include <pthread.h>`
      - `#include <stubs.h>`
      - `#include </home/shane/release/RIP/include/memwrap.h>`
      - `#include <stdio.h>`
      - `#include <iproutines.h>`
      - `#include <erroutines.h>`
      - `#include ";/home/shane/release/RIP/include/sk.h";`
        - `#include ";/home/shane/release/RIP/include/stubs.h";`
        - `#include <sys/time.h>`
        - `#include <unistd.h>`
        - `#include <sys/types.h>`
        - `#include <sys/socket.h>`
        - `#include <netinet/in.h>`
        - `#include <netdb.h>`
        - `#include <pthread.h>`
        - `#include <stdlib.h>`
        - `#include <errno.h>`
        - `#include <fcntl.h>`
        - `#include <signal.h>`
        - `#include <stdio.h>`
        - `#include ";/home/shane/release/RIP/include/iproutines.h";`
      - `#include ";/home/shane/release/RIP/include/thread.h";`
    - `#include ";/home/shane/release/RIP/include/mysql_driver.h";`
      - `#include ";/usr/local/mysql/include/mysql/mysql.h";`
        - `#include <sys/types.h>`
        - `#include ";/usr/local/mysql/include/mysql/mysql_com.h";`
        - `#include ";/usr/local/mysql/include/mysql/mysql_version.h";`
      - `#include ";/usr/local/mysql/include/mysql/mysqld_error.h";`
      - `#include ";/home/shane/release/RIP/include/erroutines.h";`
  - `#include ";/home/shane/release/RIP/include/bitmask.h";`
  - `#include ";/home/shane/release/RIP/include/ca_adminAttribs.h";`
  - `#include ";/home/shane/release/RIP/include/ca_configFns.h";`
    - `#include ";/home/shane/release/RIP/include/ca_defs.h";`
      - `#include <pthread.h>`
      - `#include <glib.h>`
    - `#include <memwrap.h>`
    - `#include <erroutines.h>`
  - `#include ";/home/shane/release/RIP/include/ca_defs.h";`
  - `#include ";/home/shane/release/RIP/include/ca_dictionary.h";`
  - `#include ";/home/shane/release/RIP/include/ca_macros.h";`
    - `#include ";/home/shane/release/RIP/include/ca_adminAttribs.h";`
  - `#include ";/home/shane/release/RIP/include/ca_srcAttribs.h";`
  - `#include ";/home/shane/release/RIP/include/comparisons.h";`
  - `#include ";/home/shane/release/RIP/include/constants.h";`
    - `#include <glib.h>`
  - `#include ";/home/shane/release/RIP/include/defs.h";`
    - `#include <glib.h>`
    - `#include ";/home/shane/release/RIP/include/bitmask.h";`
    - `#include ";/home/shane/release/RIP/include/DF_class_enum.def";`
    - `#include ";/home/shane/release/RIP/include/DF_class_mask.def";`
    - `#include ";/home/shane/release/RIP/include/DF_attribute_enum.def";`
    - `#include ";/home/shane/release/RIP/include/DF_attribute_inv_attr_mask.def";`
    - `#include ";/home/shane/release/RIP/include/which_keytypes.h";`
      - `#include ";/home/shane/release/RIP/include/bitmask.h";`
    - `#include ";/home/shane/release/RIP/include/iproutines.h";`
    - `#include ";/home/shane/release/RIP/include/rxroutines.h";`
  - `#include ";/home/shane/release/RIP/include/er_arrays.h";`
    - `#include ";/home/shane/release/RIP/include/erroutines.h";`
  - `#include ";/home/shane/release/RIP/include/er_aspects.h";`
  - `#include ";/home/shane/release/RIP/include/er_facilities.h";`
  - `#include ";/home/shane/release/RIP/include/er_formats.h";`
  - `#include ";/home/shane/release/RIP/include/er_macro.h";`
    - `#include ";/home/shane/release/RIP/include/sk.h";`
  - `#include ";/home/shane/release/RIP/include/er_paths.h";`
    - `#include <sys/param.h>`
    - `#include <glib.h>`
  - `#include ";/home/shane/release/RIP/include/er_yacc_helper.h";`
  - `#include ";/home/shane/release/RIP/include/erroutines.h";`
  - `#include ";/home/shane/release/RIP/include/fdwrap.h";`
    - `#include <stdio.h>`
  - `#include ";/home/shane/release/RIP/include/mg_getopt.h";`
  - `#include ";/home/shane/release/RIP/include/globaldefs.h";`
  - `#include ";/home/shane/release/RIP/include/gpg.h";`
    - `#include <netdb.h>`
    - `#include <unistd.h>`
    - `#include ";/home/shane/release/RIP/include/mail_parser.h";`
      - `#include ";/home/shane/release/RIP/include/gpg.h";`
      - `#include ";/home/shane/release/RIP/include/memwrap.h";`
  - `#include ";/home/shane/release/RIP/include/inet6def.h";`
  - `#include ";/home/shane/release/RIP/include/iproutines.h";`
  - `#include ";/home/shane/release/RIP/include/mail_parser.h";`
  - `#include ";/home/shane/release/RIP/include/memwrap.h";`
  - `#include ";/home/shane/release/RIP/include/mm.h";`
    - `#include ";/home/dbase/src/orange/imap-2001a/c-client/mail.h";`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/linkage.h";`
    - `#include ";/home/dbase/src/orange/imap-2001a/c-client/osdep.h";`
      - `#include <string.h>`
      - `#include <sys/types.h>`
      - `#include <stdlib.h>`
      - `#include <dirent.h>`
      - `#include <fcntl.h>`
      - `#include <unistd.h>`
      - `#include <time.h>`
      - `#include <utime.h>`
      - `#include <syslog.h>`
      - `#include <sys/file.h>`
      - `#include <ustat.h>`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/env_unix.h";`
        - `#include ";/home/dbase/src/orange/imap-2001a/c-client/env.h";`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/fs.h";`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/ftl.h";`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/nl.h";`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/tcp.h";`
      - `#include ";/home/dbase/src/orange/imap-2001a/c-client/flocksim.h";`
    - `#include ";/home/shane/release/RIP/include/gpg.h";`
    - `#include ";/home/shane/release/RIP/include/mail_parser.h";`
    - `#include ";/home/shane/release/RIP/include/memwrap.h";`
    - `#include ";/usr/local/include/glib-1.2/glib.h";`
  - `#include ";/home/shane/release/RIP/include/mysql_driver.h";`
  - `#include ";/home/shane/release/RIP/include/nh.h";`
    - `#include <mysql_driver.h>`
  - `#include ";/home/shane/release/RIP/include/notification.h";`
    - `#include <stdarg.h>`
    - `#include <stdio.h>`
    - `#include <strings.h>`
    - `#include <unistd.h>`
    - `#include <stdlib.h>`
    - `#include <time.h>`
    - `#include <glib.h>`
    - `#include ";/home/shane/release/RIP/include/UP_util.h";`
      - `#include ";/home/shane/release/RIP/include/syntax_api.h";`
  - `#include ";/home/shane/release/RIP/include/numconv.h";`
  - `#include ";/home/shane/release/RIP/include/pc_commands.h";`
  - `#include ";/home/shane/release/RIP/include/properties.h";`
  - `#include ";/home/shane/release/RIP/include/protocol_config.h";`
  - `#include ";/home/shane/release/RIP/include/protocol_mirror.h";`
    - `#include <glib.h>`
    - `#include ";/home/shane/release/RIP/include/mysql_driver.h";`
    - `#include ";/home/shane/release/RIP/include/iproutines.h";`
    - `#include ";/home/shane/release/RIP/include/aa.h";`
      - `#include ";/home/shane/release/RIP/include/iproutines.h";`
  - `#include ";/home/shane/release/RIP/include/protocol_whois.h";`
    - `#include ";/home/shane/release/RIP/include/query_command.h";`
      - `#include <glib.h>`
      - `#include ";/home/shane/release/RIP/include/bitmask.h";`
      - `#include ";/home/shane/release/RIP/include/sk.h";`
  - `#include ";/home/shane/release/RIP/include/query_command.h";`
  - `#include ";/home/shane/release/RIP/include/query_instructions.h";`
    - `#include ";/home/shane/release/RIP/include/rxroutines.h";`
    - `#include ";/home/shane/release/RIP/include/iproutines.h";`
    - `#include ";/home/shane/release/RIP/include/mysql_driver.h";`
    - `#include ";/home/shane/release/RIP/include/query_command.h";`
    - `#include ";/home/shane/release/RIP/include/defs.h";`
    - `#include ";/home/shane/release/RIP/include/which_keytypes.h";`
    - `#include ";/home/shane/release/RIP/include/access_control.h";`
    - `#include ";/home/shane/release/RIP/include/ca_configFns.h";`
    - `#include ";/home/shane/release/RIP/include/ca_dictionary.h";`
    - `#include ";/home/shane/release/RIP/include/ca_macros.h";`
    - `#include ";/home/shane/release/RIP/include/ca_srcAttribs.h";`
  - `#include ";/home/shane/release/RIP/include/rp.h";`
    - `#include <stddef.h>`
    - `#include <glib.h>`
    - `#include <pthread.h>`
    - `#include <defs.h>`
    - `#include <iproutines.h>`
    - `#include <erroutines.h>`
    - `#include <rxroutines.h>`
    - `#include <mysql_driver.h>`
    - `#include ";/home/shane/release/RIP/include/ca_defs.h";`
    - `#include <thread.h>`
  - `#include ";/home/shane/release/RIP/include/rxroutines.h";`
  - `#include ";/home/shane/release/RIP/include/server.h";`
  - `#include ";/home/shane/release/RIP/include/sk.h";`
  - `#include ";/home/shane/release/RIP/include/stubs.h";`
  - `#include ";/home/shane/release/RIP/include/syntax_api.h";`
  - `#include ";/home/shane/release/RIP/include/ta.h";`
    - `#include <glib.h>`
    - `#include <pthread.h>`
    - `#include <stdio.h>`
    - `#include ";/home/shane/release/RIP/include/stubs.h";`
    - `#include ";/home/shane/release/RIP/include/memwrap.h";`
    - `#include ";/home/shane/release/RIP/include/sk.h";`
    - `#include ";/home/shane/release/RIP/include/timediff.h";`
  - `#include ";/home/shane/release/RIP/include/thread.h";`
  - `#include ";/home/shane/release/RIP/include/timediff.h";`
  - `#include ";/home/shane/release/RIP/include/ud.h";`
  - `#include ";/home/shane/release/RIP/include/ud_int.h";`
    - `#include <stdio.h>`
    - `#include <strings.h>`
    - `#include <glib.h>`
    - `#include <stdlib.h>`
    - `#include <ctype.h>`
    - `#include <unistd.h>`
    - `#include ";/home/shane/release/RIP/include/defs.h";`
    - `#include ";/home/shane/release/RIP/include/mysql_driver.h";`
    - `#include ";/home/shane/release/RIP/include/iproutines.h";`
    - `#include ";/home/shane/release/RIP/include/erroutines.h";`
    - `#include ";/home/shane/release/RIP/include/rp.h";`
    - `#include ";/home/shane/release/RIP/include/nh.h";`
    - `#include ";/home/shane/release/RIP/include/sk.h";`
    - `#include ";/home/shane/release/RIP/include/memwrap.h";`
    - `#include ";/home/shane/release/RIP/include/ca_configFns.h";`
    - `#include ";/home/shane/release/RIP/include/ca_dictionary.h";`
    - `#include ";/home/shane/release/RIP/include/ca_macros.h";`
    - `#include ";/home/shane/release/RIP/include/ca_srcAttribs.h";`
    - `#include ";/home/shane/release/RIP/include/globaldefs.h";`
    - `#include ";/home/shane/release/RIP/include/bitmask.h";`
    - `#include ";/home/shane/release/RIP/include/which_keytypes.h";`
  - `#include ";/home/shane/release/RIP/include/ud_tr.h";`
    - `#include ";/home/shane/release/RIP/include/ud_int.h";`
  - `#include ";/home/shane/release/RIP/include/ut_string.h";`
  - `#include ";/home/shane/release/RIP/include/wh_queries.h";`
    - `#include ";/home/shane/release/RIP/include/sk.h";`
  - `#include ";/home/shane/release/RIP/include/which_keytypes.h";`

- `#include <stdio.h>`

- `#include <stdlib.h>`

- `#include <string.h>`

- `#include <glib.h>`

## Preprocessor definitions

Maximum number of constants.

`#define MAX_CONSTS 100`

Default values for constants.

`#define DEFLT_AUTHENTICATE "0"`

`#define DEFLT_WHOIS_SUSPENDED "0"`

`#define DEFLT_DO_SERVER "1"`

`#define DEFLT_WELCOME "Welcome to the whois R.I.P. server.\n"`

`#define DEFLT_PROMPT "whois R.I.P. config> "`

`#define DEFLT_CLEAR_SCREEN "0"`

`#define DEFLT_ACCOUNTING "0"`

`#define DEFLT_CONFIG_FILE "rip.config"`

## Type struct _constant

Each constant has a

`struct _constant`

`struct _constant` |
`{` |
`const char* token;` | Token to be found in properties file.
`const char* deflt;` | Default value for the constant.
`int (*set_func)(void*,const char*);` | Function to set the constant.
`void* constant_ptr;` | Pointer to the constant value
`char* (*show_func)(const void*);` | Function to show the constant.
`}` |

## Typedef Constants

The Constants array has a

`typedef struct _Constants* Constants`

`struct _Constants` |
`{` |
`int authenticate[1];` | Authenticate users.
`int whois_suspended[1];` | Suspend the whois server.
`char welcome[1024];` | Welcome for config protocol.
`char prompt[1024];` | Prompt for config protocol.
`int clear_screen[1];` | Clear screen after config commands.
`int accounting[1];` | Conduct accounting on whois queries.
`int do_server[1];` | turns off execution of the all servers(threads)
`int do_update[1];` | switches on and off the updates
`}` |

## Global Variable Lock

`pthread_mutex_t Lock`

Included from | /home/shane/release/RIP/include/ca_defs.h
Visible in: |  | aa/aa.c
|  | ac/ac_persistence.c
|  | ac/access_control.c
|  | au/AU_util.c
|  | ca/ca_configFns.c
|  | ca/ca_initFn.c
|  | ca/ca_sanityCheck.c
|  | ca/ca_sourceLoader.c
|  | ca/ca_values.c
|  | co/constants.c
Used in: | ca_get_adminIntElement() | ca/ca_configFns.c
| ca_get_adminStrElement() | ca/ca_configFns.c
| ca_get_boolean() | ca/ca_configFns.c
| ca_get_dirlist() | ca/ca_configFns.c
| ca_get_int() | ca/ca_configFns.c
| ca_get_string() | ca/ca_configFns.c
| ca_set_boolean() | ca/ca_configFns.c
| ca_srchandle2Intelement() | ca/ca_configFns.c
| ca_srchandle2Strelement() | ca/ca_configFns.c

## Local Variables

Global_constants
The array of Global Constants.

`static Constants Global_constants`

Used in: | CO_get_accounting()
| CO_get_authenticate()
| CO_get_clear_screen()
| CO_get_do_server()
| CO_get_do_update()
| CO_get_prompt()
| CO_get_welcome()
| CO_get_whois_suspended()
| CO_set()
| init_constants()

constant
* Contains the constant definitions for the Token, set_function, show_function. * (See: _constant)

`static struct _constant constant[100]`

Used in: | CO_const_to_string()
| CO_set()
| CO_set_const()
| CO_to_string()
| init_constants()

## Global Function CO_const_to_string()

`char* CO_const_to_string ( const char* name )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
Calls: | strcmp()
References Variables: | constant | co/constants.c

## Global Function CO_get_accounting()

`int CO_get_accounting ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_authenticate()

`int CO_get_authenticate ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_clear_screen()

`int CO_get_clear_screen ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_do_server()

`int CO_get_do_server ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
Called by: | AC_decay() | ac/access_control.c
| AC_persistence_daemon() | ac/ac_persistence.c
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_do_update()

`int CO_get_do_update ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_prompt()

`char* CO_get_prompt ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_welcome()

`char* CO_get_welcome ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_get_whois_suspended()

`int CO_get_whois_suspended ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
References Variables: | Global_constants | co/constants.c

## Global Function CO_set()

      Sets the constants from the properties module.
      Returns the number of constants set.

      More:

      Authors:
            ottrey

    Online References:

      .properties

`char* CO_set ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
Calls: | init_constants() | co/constants.c
| PR_get_property(), UT_calloc_real(), UT_free_real(), sprintf(), strcpy(), strlen()
References Variables: | Global_constants | co/constants.c
| constant | co/constants.c

## Global Function CO_set_const()

      Sets the value of one constant.  Returns 0 if no error.

      More:

      Authors:
            ottrey

    Online References:

`int CO_set_const ( const char* name, const char* value )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
Calls: | strcmp()
References Variables: | constant | co/constants.c

## Global Function CO_to_string()

      Returns the constants as a string.

      More:

      Authors:
            ottrey

    Online References:

`char* CO_to_string ( void )`

Prototyped in: | /home/shane/release/RIP/include/constants.h
Calls: | UT_free_real(), UT_strdup_real(), g_string_append_c(), g_string_free(), g_string_new(), g_string_sprintfa()
References Variables: | constant | co/constants.c

## Local Function asctime_r()

`static char* asctime_r ( const struct tm* __tm, char* __buf )`

Included from: | /usr/include/time.h
Calls: | __posix_asctime_r()

## Local Function ctime_r()

`static char* ctime_r ( const time_t* __time, char* __buf )`

Included from: | /usr/include/time.h
Calls: | __posix_ctime_r()

## Local Function getlogin_r()

`static int getlogin_r ( char* __name, int __len )`

Included from: | /usr/include/unistd.h
Calls: | __posix_getlogin_r()

## Local Function init_constants()

      Initialize all the constants.

      More:

      Authors:
            ottrey

    Online References:

`static void init_constants ( void )`

Called by: | CO_set() | co/constants.c
References Functions: | set_boolean() | co/constants.c
| set_int() | co/constants.c
| set_string() | co/constants.c
| show_boolean() | co/constants.c
| show_int() | co/constants.c
| show_string() | co/constants.c
References Variables: | Global_constants | co/constants.c
| constant | co/constants.c

## Local Function readdir_r()

`static int readdir_r ( DIR* __dp, struct dirent* __ent, struct dirent** __res )`

Included from: | /usr/include/dirent.h
Calls: | __posix_readdir_r()

## Local Function set_boolean()

`static int set_boolean ( void* constant, const char* value )`

Calls: | atol()
Used in: | init_constants() | co/constants.c

## Local Function set_int()

`static int set_int ( void* constant, const char* value )`

Calls: | atol()
Used in: | init_constants() | co/constants.c

## Local Function set_string()

`static int set_string ( void* constant, const char* value )`

Calls: | strcpy()
Used in: | init_constants() | co/constants.c

## Local Function show_boolean()

`static char* show_boolean ( const void* constant )`

Calls: | UT_malloc_real(), sprintf()
Used in: | init_constants() | co/constants.c

## Local Function show_int()

`static char* show_int ( const void* constant )`

Calls: | UT_malloc_real(), sprintf()
Used in: | init_constants() | co/constants.c

## Local Function show_string()

`static char* show_string ( const void* constant )`

Calls: | UT_strdup_real()
Used in: | init_constants() | co/constants.c

## Local Function sigwait()

`static int sigwait ( const sigset_t* __setp, int* __signo )`

Included from: | /usr/include/signal.h
Calls: | __posix_sigwait()

## Local Function ttyname_r()

`static int ttyname_r ( int __fildes, char* __buf, size_t __size )`

Included from: | /usr/include/unistd.h
Calls: | __posix_ttyname_r()