File modules/er/er_paths.c

  $Revision: 1.7 $

Error reporting (er) er_paths.c - parser callback functions for path & filter creation/modification/deletion
Status: NOT REVUED, PARTLY TESTED
Design and implementation by: Marek Bukowy

Included Files


Global Function er_add_exec_arg()

  Adds an argument to a dynamically build argv array of arguments for
  a path of EXEC type.
void er_add_exec_arg ( er_path_t* pathptr, char* arg )
er_path_t* pathptr
path structure
char* arg
new argument
Prototyped in: modules/er/er_paths.h
Calls: calloc(), free(), memcpy(), strdup()
Called by: er_yyparse()modules/er/er.yacc.tab.c

Global Function er_add_filter()

  Adds a filter to the filter chain for the given path.

er_ret_t er_add_filter always returns ER_OK.
er_ret_t er_add_filter ( er_path_t* pathptr, er_filter_t* filter )
er_path_t* pathptr
pointer to path
er_filter_t* filter
pointer to the filter
Prototyped in: include/erroutines.h
Calls: g_list_append(), malloc(), memcpy()
Called by: er_attach_filter_chain()modules/er/er_paths.c
  er_yyparse()modules/er/er.yacc.tab.c

Global Function er_attach_filter_chain()

  Finds a path by identifier and adds a list of filters to the filter
  chain for that path.

er_ret_t er_attach_filter_chain returns ER_INVKEY if the path cannot be found or ER_OK on success.
er_ret_t er_attach_filter_chain ( char* key, GList* filterlist )
char* key
path identifier
GList* filterlist
list of filters
Prototyped in: modules/er/er_paths.h
Calls: NOERR()modules/er/er.c
  er_add_filter()modules/er/er_paths.c
  er_find_path_byname()modules/er/er_paths.c
  er_upd_asparray()modules/er/er_paths.c
  g_list_first()
Called by: er_yyparse()modules/er/er.yacc.tab.c

Global Function er_delete_filter()

  Deletes a filter from the list of filters of the path specified by
  identifier.  The filter is specified by its position in the list,
  starting with 0.

er_ret_t er_delete_filter returns ER_INVKEY if the path or filter cannot be found
er_ret_t er_delete_filter ( char* key, unsigned filterid )
char* key
path identifier
unsigned filterid
filter position
Prototyped in: modules/er/er_paths.h
Calls: er_find_path_byname()modules/er/er_paths.c
  er_upd_asparray()modules/er/er_paths.c
  free(), g_list_length(), g_list_nth_data(), g_list_remove()
Called by: er_yyparse()modules/er/er.yacc.tab.c

Global Function er_delete_path()

  finds and removes a path identified by identifier

er_ret_t er_delete_path ER_OK on success, ER_INVKEY if path not found
er_ret_t er_delete_path ( char* key )
char* key
path identifier
Prototyped in: modules/er/er_paths.h
Calls: er_find_path_byname()modules/er/er_paths.c
  er_free_dynadescr()modules/er/er_paths.c
  er_upd_asparray()modules/er/er_paths.c
  free(), g_list_remove(), wr_real_clear_list()
Called by: er_yyparse()modules/er/er.yacc.tab.c

Global Function er_free_dynadescr()

  free dynamic elements of the path structure 
void er_free_dynadescr ( er_path_t* pathptr )
er_path_t* pathptr
path structure
Calls: free()
Called by: er_delete_path()modules/er/er_paths.c

Global Function er_modify_path()

  Finds the path by identified and replaces its definition without touching
  the filters

er_ret_t er_modify_path returns ER_INVKEY if the path cannot be found or ER_OK on success.
er_ret_t er_modify_path ( er_path_t* newpath, char* key )
er_path_t* newpath
new path structure
char* key
path identifier
Prototyped in: modules/er/er_paths.h
Calls: er_find_path_byname()modules/er/er_paths.c
  er_upd_asparray()modules/er/er_paths.c
Called by: er_yyparse()modules/er/er.yacc.tab.c

Global Function er_register_path()

  Registers a path in the chain of paths.

er_ret_t er_register_path returns ER_DUPENT if a path with that identifier already exists, returns ER_INSANE if the sanity check is not passed, or ER_OK on success.
er_ret_t er_register_path ( er_path_t* path, char* key )
er_path_t* path
new path structure
char* key
path identifier
Prototyped in: modules/er/er_paths.h
Calls: er_find_path_byname()modules/er/er_paths.c
  er_path_safeguard()modules/er/er_paths.c
  er_upd_asparray()modules/er/er_paths.c
  calloc(), g_list_append(), memcpy(), strncpy()
Called by: er_yyparse()modules/er/er.yacc.tab.c

Global Function er_upd_asparray()

  Updates the array of currently active aspects. Must be used after any change
  of filters/paths.

The "asp" array describes the "OR" of all filters' aspects. This is to allow fast dropping of messages that would be dropped anyway
This function clears the array and regenerates it by going through all filters and setting appropriate bits of aspects per facility.
void er_upd_asparray ( void )
Prototyped in: modules/er/er_paths.h
Calls: MA_isset(), g_list_first()
Called by: er_attach_filter_chain()modules/er/er_paths.c
  er_delete_filter()modules/er/er_paths.c
  er_delete_path()modules/er/er_paths.c
  er_modify_path()modules/er/er_paths.c
  er_register_path()modules/er/er_paths.c

Local Function er_find_path_byname()

  finds path by identifier

er_path_t * er_find_path_byname returns the pointer to it if found or NULL if not found
static er_path_t* er_find_path_byname ( char* key )
char* key
path identifier
Calls: g_list_first(), strcmp()
Called by: er_attach_filter_chain()modules/er/er_paths.c
  er_delete_filter()modules/er/er_paths.c
  er_delete_path()modules/er/er_paths.c
  er_modify_path()modules/er/er_paths.c
  er_register_path()modules/er/er_paths.c

Local Function er_path_safeguard()

  basic sanity checks for a path definition. Currently only checking
  if a specified socket exists.

int er_path_safeguard Returns 0 on success, -1 on failure
static int er_path_safeguard ( er_path_t* path )
er_path_t* path
new path structure
Calls: SK_getpeername(), free()
Called by: er_register_path()modules/er/er_paths.c