Cross reference for modules/er/er_macro.c of index.

# File modules/er/er_macro.c

      $Revision: 1.10 $

      Error reporting (er) er_macro.c - simple macro processor

      Status: NOT REVUED, PARTLY TESTED

      Design and implementation by: Marek Bukowy

## Included Files

- `#include <string.h>`

- `#include <glib.h>`

- `#include "include/stubs.h"`
  - `#include <stdlib.h>`
  - `#include <stdio.h>`
  - `#include <ctype.h>`

- `#include "modules/er/erroutines.h"`
  - `#include <stdio.h>`
  - `#include <unistd.h>`
  - `#include <stdlib.h>`
  - `#include <assert.h>`
  - `#include <time.h>`
  - `#include <stdarg.h>`
  - `#include <strings.h>`
  - `#include <glib.h>`
  - `#include <pthread.h>`
  - `#include <include/bitmask.h>`
  - `#include <stubs.h>`
  - `#include "include/thread.h"`
    - `#include <pthread.h>`
  - `#include "modules/er/er_facilities.h"`
    - `#include <include/erroutines.h>`
    - `#include "include/er_RX_errors.h"`
    - `#include "modules/er/er_ER_errors.h"`
    - `#include "include/er_IP_errors.h"`
    - `#include "include/er_UP_errors.h"`
    - `#include "include/er_UT_errors.h"`
    - `#include "include/er_WH_errors.h"`
    - `#include "include/er_RP_errors.h"`
    - `#include "include/er_QI_errors.h"`
    - `#include "include/er_QC_errors.h"`
    - `#include "include/er_PW_errors.h"`
    - `#include "include/er_SK_errors.h"`
    - `#include "include/er_TH_errors.h"`
    - `#include "include/er_SQ_errors.h"`
    - `#include "include/er_PM_errors.h"`
    - `#include "include/er_MM_errors.h"`
    - `#include "include/er_SV_errors.h"`
    - `#include "include/er_AC_errors.h"`
    - `#include "include/er_UD_errors.h"`
    - `#include "include/er_PA_errors.h"`
    - `#include "include/er_PC_errors.h"`
  - `#include "modules/er/er_aspects.h"`
    - `#include "modules/er/erroutines.h"`
  - `#include "modules/er/er_formats.h"`

- `#include "modules/er/er_yacc_helper.h"`

- `#include "include/memwrap.h"`
  - `#include <include/erroutines.h>`
  - `#include <glib.h>`

- `#include "include/sk.h"`
  - `#include "include/stubs.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 "include/iproutines.h"`
    - `#include <sys/types.h>`
    - `#include <glib.h>`
    - `#include <include/inet6def.h>`
    - `#include <include/erroutines.h>`

- `#include "include/ca_configFns.h"`
  - `#include "include/ca_defs.h"`
    - `#include <pthread.h>`
    - `#include <glib.h>`
  - `#include <memwrap.h>`
  - `#include <include/erroutines.h>`

- `#include "include/ca_dictionary.h"`

- `#include "include/ca_macros.h"`
  - `#include "include/ca_adminAttribs.h"`

- `#include "include/thread.h"`

- `#include "modules/er/er_macro.h"`
  - `#include "include/sk.h"`

- `#include "include/ut_string.h"`

## Preprocessor definitions

`#define DBUPDLOG_FORMAT " FORMAT SEVCHAR|FACSYMB|TEXTLONG|DATETIME|PIDFULL|PROGNAME|MNEMONIC "`

`#define RIPLOG_FORMAT " FORMAT SEVCHAR|FACSYMB|TEXTLONG|DATETIME|PIDFULL|PROGNAME|THR_ID|MNEMONIC "`

## Global Variable Lock

`pthread_mutex_t Lock`

Included from | include/ca_defs.h
Visible in: |  | modules/ac/access_control.c
|  | modules/ca/ca_configFns.c
|  | modules/ca/ca_initFn.c
|  | modules/ca/ca_sanityCheck.c
|  | modules/ca/ca_sourceLoader.c
|  | modules/ca/ca_values.c
|  | modules/er/er_macro.c
Used in: | ca_get_adminIntElement() | modules/ca/ca_configFns.c
| ca_get_adminStrElement() | modules/ca/ca_configFns.c
| ca_get_boolean() | modules/ca/ca_configFns.c
| ca_get_dirlist() | modules/ca/ca_configFns.c
| ca_get_int() | modules/ca/ca_configFns.c
| ca_get_string() | modules/ca/ca_configFns.c
| ca_set_boolean() | modules/ca/ca_configFns.c
| ca_set_string() | modules/ca/ca_configFns.c
| ca_srchandle2Intelement() | modules/ca/ca_configFns.c
| ca_srchandle2Strelement() | modules/ca/ca_configFns.c

## Global Function ER_macro_list()

      Lists all currently defined macros to the given connection.

`void ER_macro_list ( sk_conn_st* condat )`

`sk_conn_st* condat`
  connection data structure

Prototyped in: | modules/er/er_macro.h
Calls: | TH_acquire_read_lock(), TH_release_read_lock(), g_hash_table_foreach()
References Functions: | er_macro_list_hook() | modules/er/er_macro.c
References Variables: | er_macro_hash | modules/er/er.c
| er_paths_lock | modules/er/er.c

## Global Function ER_macro_predef()

      predefine some macros useful for the whois_rip server.
      XXX - this should not be here, it should be done via the CA module!

`void ER_macro_predef ( void )`

Prototyped in: | modules/er/er_macro.h
Calls: | ER_make_macro() | modules/er/er_macro.c
Called by: | ER_init() | modules/er/er.c

## Global Function ER_macro_spec()

      Take a text line and parse it as an error specification
      line. Optionally, if the first word is a macro, run the macro using
      other words as its arguments.  This is basically a wrapper around
      ER_process_split() that splits the string into argv and calls the
      ER_parse.

      sets the errbuf to the result of ER_parse_spec.

`int ER_macro_spec ( char* input, char** errbuf )`

`int ER_macro_spec`
  returns 0 on success, non-0 on failure.
`char* input`
  input line
`char** errbuf`
  storage for the result pointer (to allocated text)

Prototyped in: | modules/er/er_macro.h
Calls: | ER_parse_spec() | modules/er/er.yacc.tab.c
| ER_process_split() | modules/er/er_macro.c
| free(), g_strfreev(), g_strsplit(), strdup(), ut_string_compress()
Called by: | ER_proc_ca_err() | modules/er/er_macro.c

## Global Function ER_make_macro()

      (Re)Define a macro.

`void ER_make_macro ( char* name, char* def )`

`char* name`
  macro name
`char* def`
  macro contents

Prototyped in: | modules/er/er_macro.h
Calls: | TH_acquire_write_lock(), TH_release_write_lock(), g_hash_table_insert(), g_hash_table_lookup_extended(), g_hash_table_remove(), wr_real_free(), wr_real_string()
Called by: | ER_macro_predef() | modules/er/er_macro.c
| ER_proc_ca_macro() | modules/er/er_macro.c
References Variables: | er_macro_hash | modules/er/er.c
| er_paths_lock | modules/er/er.c

## Global Function ER_proc_ca_err()

      Processes the error definitions from the config file. The
      definitions can be specified with the use of a macro or without.

`void ER_proc_ca_err ( void )`

Prototyped in: | modules/er/er_macro.h
Calls: | ER_macro_spec() | modules/er/er_macro.c
| ca_get_string() | modules/ca/ca_configFns.c
| fprintf(), fputs(), free(), strchr()
Called by: | ER_init() | modules/er/er.c

## Global Function ER_proc_ca_macro()

     Defines the macros with the definitions from the config file,
     overriding any currently defined ones if the same name is used.

`void ER_proc_ca_macro ( void )`

Prototyped in: | modules/er/er_macro.h
Calls: | ER_make_macro() | modules/er/er_macro.c
| ca_get_string() | modules/ca/ca_configFns.c
| fprintf(), free(), strchr(), strtok_r()
Called by: | ER_init() | modules/er/er.c

## Global Function ER_process_split()

      processes a macro call, i.e. executes one of the predefined macros
      selected by the 0th word of the array, using other words as
      arguments to that macro. Uses the er_macro_array[] to find the
      macro definition.  Allocates the result string and stores the
      pointer to it in **output.

`int ER_process_split ( int argc, char** argv, char** output )`

`int ER_process_split`
  returns 0 on success, non-0 on failure.
`int argc`
  number of words in the word array
`char** argv`
  word array (pointers to strings)
`char** output`
  storage for the result pointer (to allocated text)

Prototyped in: | modules/er/er_macro.h
Calls: | TH_acquire_write_lock(), TH_release_write_lock(), g_hash_table_lookup(), g_string_append(), g_string_append_c(), g_string_free(), g_string_new(), strlen(), strstr()
Called by: | ER_macro_spec() | modules/er/er_macro.c
References Variables: | er_macro_hash | modules/er/er.c
| er_paths_lock | modules/er/er.c

## Local Function er_macro_list_hook()

      Prints the arguments (key and value of a hash) to the given
      connection (used for listing the defined macros)

`static void er_macro_list_hook ( void* key, void* value, void* condat )`

`void* key`
  hash key
`void* value`
  hash value
`void* condat`
  connection data structure

Calls: | SK_cd_printf()
Used in: | ER_macro_list() | modules/er/er_macro.c