Cross reference for rx/rx_tree.c of index.

# File rx/rx_tree.c

      $Revision: 1.21 $

      Radix tree (rx).  rx_tree.c - functions to operate on trees
      (creation/deletion/finding).

      Status: NOT REVUED, TESTED, INCOMPLETE

      Design and implementation by: Marek Bukowy

## Included Files

- `#include "/home/shane/code/RIP/include/rip.h"`
  - `#include </home/shane/code/RIP/include/config.h>`
  - `#include <sys/param.h>`
  - `#include </ncc/dbwork/platforms/yucca-debug/glib-indep/include/glib-1.2/glib.h>`
  - `#include "/home/shane/code/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/code/RIP/include/aa.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
      - `#include <sys/types.h>`
      - `#include <glib.h>`
      - `#include </home/shane/code/RIP/include/inet6def.h>`
      - `#include </home/shane/code/RIP/include/erroutines.h>`
  - `#include "/home/shane/code/RIP/include/access_control.h"`
    - `#include "/home/shane/code/RIP/include/erroutines.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/rxroutines.h"`
      - `#include <glib.h>`
      - `#include <pthread.h>`
      - `#include <stubs.h>`
      - `#include </home/shane/code/RIP/include/memwrap.h>`
      - `#include <stdio.h>`
      - `#include <iproutines.h>`
      - `#include <erroutines.h>`
      - `#include "/home/shane/code/RIP/include/sk.h"`
        - `#include "/home/shane/code/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/code/RIP/include/iproutines.h"`
      - `#include "/home/shane/code/RIP/include/thread.h"`
    - `#include "/home/shane/code/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/code/RIP/include/erroutines.h"`
  - `#include "/home/shane/code/RIP/include/bitmask.h"`
  - `#include "/home/shane/code/RIP/include/ca_adminAttribs.h"`
  - `#include "/home/shane/code/RIP/include/ca_configFns.h"`
    - `#include "/home/shane/code/RIP/include/ca_defs.h"`
      - `#include <pthread.h>`
      - `#include <glib.h>`
    - `#include <memwrap.h>`
    - `#include <erroutines.h>`
  - `#include "/home/shane/code/RIP/include/ca_defs.h"`
  - `#include "/home/shane/code/RIP/include/ca_dictionary.h"`
  - `#include "/home/shane/code/RIP/include/ca_macros.h"`
    - `#include "/home/shane/code/RIP/include/ca_adminAttribs.h"`
  - `#include "/home/shane/code/RIP/include/ca_srcAttribs.h"`
  - `#include "/home/shane/code/RIP/include/comparisons.h"`
  - `#include "/home/shane/code/RIP/include/constants.h"`
    - `#include <glib.h>`
  - `#include "/home/shane/code/RIP/include/defs.h"`
    - `#include <glib.h>`
    - `#include "/home/shane/code/RIP/include/bitmask.h"`
    - `#include "/home/shane/code/RIP/include/DF_class_enum.def"`
    - `#include "/home/shane/code/RIP/include/DF_class_mask.def"`
    - `#include "/home/shane/code/RIP/include/DF_attribute_enum.def"`
    - `#include "/home/shane/code/RIP/include/DF_attribute_inv_attr_mask.def"`
    - `#include "/home/shane/code/RIP/include/which_keytypes.h"`
      - `#include "/home/shane/code/RIP/include/bitmask.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/rxroutines.h"`
  - `#include "/home/shane/code/RIP/include/er_arrays.h"`
    - `#include "/home/shane/code/RIP/include/erroutines.h"`
  - `#include "/home/shane/code/RIP/include/er_aspects.h"`
  - `#include "/home/shane/code/RIP/include/er_facilities.h"`
  - `#include "/home/shane/code/RIP/include/er_formats.h"`
  - `#include "/home/shane/code/RIP/include/er_macro.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/er_paths.h"`
    - `#include <sys/param.h>`
    - `#include <glib.h>`
  - `#include "/home/shane/code/RIP/include/er_yacc_helper.h"`
  - `#include "/home/shane/code/RIP/include/erroutines.h"`
  - `#include "/home/shane/code/RIP/include/fdwrap.h"`
    - `#include <stdio.h>`
  - `#include "/home/shane/code/RIP/include/mg_getopt.h"`
  - `#include "/home/shane/code/RIP/include/globaldefs.h"`
  - `#include "/home/shane/code/RIP/include/gpg.h"`
    - `#include <netdb.h>`
    - `#include <unistd.h>`
    - `#include "/home/shane/code/RIP/include/mail_parser.h"`
      - `#include "/home/shane/code/RIP/include/gpg.h"`
      - `#include "/home/shane/code/RIP/include/memwrap.h"`
  - `#include "/home/shane/code/RIP/include/inet6def.h"`
  - `#include "/home/shane/code/RIP/include/iproutines.h"`
  - `#include "/home/shane/code/RIP/include/mail_parser.h"`
  - `#include "/home/shane/code/RIP/include/memwrap.h"`
  - `#include "/home/shane/code/RIP/include/mm.h"`
    - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/mail.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/linkage.h"`
    - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/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 "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/env_unix.h"`
        - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/env.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/fs.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/ftl.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/nl.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/tcp.h"`
      - `#include "/ncc/dbwork/c-client/sparc-sun-solaris2.7/imap-2000a/c-client/lockfix.h"`
    - `#include "/home/shane/code/RIP/include/gpg.h"`
    - `#include "/home/shane/code/RIP/include/mail_parser.h"`
    - `#include "/home/shane/code/RIP/include/memwrap.h"`
    - `#include "/ncc/dbwork/platforms/yucca-debug/glib-indep/include/glib-1.2/glib.h"`
  - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
  - `#include "/home/shane/code/RIP/include/nh.h"`
    - `#include <mysql_driver.h>`
  - `#include "/home/shane/code/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/code/RIP/include/UP_util.h"`
      - `#include "/home/shane/code/RIP/include/syntax_api.h"`
  - `#include "/home/shane/code/RIP/include/numconv.h"`
  - `#include "/home/shane/code/RIP/include/pc_commands.h"`
  - `#include "/home/shane/code/RIP/include/properties.h"`
  - `#include "/home/shane/code/RIP/include/protocol_config.h"`
  - `#include "/home/shane/code/RIP/include/protocol_mirror.h"`
    - `#include <glib.h>`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/aa.h"`
      - `#include "/home/shane/code/RIP/include/iproutines.h"`
  - `#include "/home/shane/code/RIP/include/protocol_whois.h"`
    - `#include "/home/shane/code/RIP/include/query_command.h"`
      - `#include <glib.h>`
      - `#include "/home/shane/code/RIP/include/bitmask.h"`
      - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/query_command.h"`
  - `#include "/home/shane/code/RIP/include/query_instructions.h"`
    - `#include "/home/shane/code/RIP/include/rxroutines.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
    - `#include "/home/shane/code/RIP/include/query_command.h"`
    - `#include "/home/shane/code/RIP/include/defs.h"`
    - `#include "/home/shane/code/RIP/include/which_keytypes.h"`
    - `#include "/home/shane/code/RIP/include/access_control.h"`
    - `#include "/home/shane/code/RIP/include/ca_configFns.h"`
    - `#include "/home/shane/code/RIP/include/ca_dictionary.h"`
    - `#include "/home/shane/code/RIP/include/ca_macros.h"`
    - `#include "/home/shane/code/RIP/include/ca_srcAttribs.h"`
  - `#include "/home/shane/code/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/code/RIP/include/ca_defs.h"`
    - `#include <thread.h>`
  - `#include "/home/shane/code/RIP/include/rxroutines.h"`
  - `#include "/home/shane/code/RIP/include/server.h"`
  - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/stubs.h"`
  - `#include "/home/shane/code/RIP/include/syntax_api.h"`
  - `#include "/home/shane/code/RIP/include/ta.h"`
    - `#include <glib.h>`
    - `#include <pthread.h>`
    - `#include <stdio.h>`
    - `#include "/home/shane/code/RIP/include/stubs.h"`
    - `#include "/home/shane/code/RIP/include/memwrap.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
    - `#include "/home/shane/code/RIP/include/timediff.h"`
      - `#include <sys/time.h>`
  - `#include "/home/shane/code/RIP/include/thread.h"`
  - `#include "/home/shane/code/RIP/include/timediff.h"`
  - `#include "/home/shane/code/RIP/include/ud.h"`
  - `#include "/home/shane/code/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/code/RIP/include/defs.h"`
    - `#include "/home/shane/code/RIP/include/mysql_driver.h"`
    - `#include "/home/shane/code/RIP/include/iproutines.h"`
    - `#include "/home/shane/code/RIP/include/erroutines.h"`
    - `#include "/home/shane/code/RIP/include/rp.h"`
    - `#include "/home/shane/code/RIP/include/nh.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
    - `#include "/home/shane/code/RIP/include/memwrap.h"`
    - `#include "/home/shane/code/RIP/include/ca_configFns.h"`
    - `#include "/home/shane/code/RIP/include/ca_dictionary.h"`
    - `#include "/home/shane/code/RIP/include/ca_macros.h"`
    - `#include "/home/shane/code/RIP/include/ca_srcAttribs.h"`
    - `#include "/home/shane/code/RIP/include/globaldefs.h"`
    - `#include "/home/shane/code/RIP/include/bitmask.h"`
    - `#include "/home/shane/code/RIP/include/which_keytypes.h"`
  - `#include "/home/shane/code/RIP/include/ud_tr.h"`
    - `#include "/home/shane/code/RIP/include/ud_int.h"`
  - `#include "/home/shane/code/RIP/include/ut_string.h"`
  - `#include "/home/shane/code/RIP/include/wh_queries.h"`
    - `#include "/home/shane/code/RIP/include/sk.h"`
  - `#include "/home/shane/code/RIP/include/which_keytypes.h"`

## Preprocessor definitions

`#define RX_IMPL`

## Global Variable Lock

`pthread_mutex_t Lock`

Included from | /home/shane/code/RIP/include/ca_defs.h
Visible in: |  | aa/aa.c
|  | ac/access_control.c
|  | ca/ca_configFns.c
|  | ca/ca_initFn.c
|  | ca/ca_sanityCheck.c
|  | ca/ca_sourceLoader.c
|  | ca/ca_values.c
|  | co/constants.c
|  | df/defs.c
|  | er/er.c
|  | er/er_arrays.c
|  | er/er_macro.c
|  | er/er_paths.c
|  | er/er_print.c
|  | ip/ip.c
|  | ma/bitmask.c
|  | mm/mm.c
|  | nh/nh.c
|  | pa/gpg.c
|  | pa/spawn.c
|  | pc/pc_commands.c
|  | pc/protocol_config.c
|  | pm/pm_serials.c
|  | pm/protocol_mirror.c
|  | pr/properties.c
|  | pw/protocol_whois.c
|  | qc/mg_getopt.c
|  | qc/query_command.c
|  | qi/query_instructions.c
|  | rp/rp_convert.c
|  | rp/rp_load.c
|  | rp/rp_search.c
|  | rp/rp_tree.c
|  | rp/rp_update.c
|  | rx/rx_node.c
|  | rx/rx_print.c
|  | rx/rx_search.c
|  | rx/rx_tree.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

## Global Function RX_tree_cre()

      creates a (top) tree for the space, fills out sql table of trees
      generates a tablename for a tree (if NONE)
      updates LL of trees

      MT-note: locks/unlocks the forest (still to be done)

`er_ret_t RX_tree_cre ( char* prefixstr, rx_fam_t fam_id, rx_mem_mt mem_mode, rx_subtree_mt subtrees, rx_tree_t** treestore )`

`char* prefixstr`
  prefix the tree will cover (string)
`rx_fam_t fam_id`
  &nbs;
`rx_mem_mt mem_mode`
  &nbs;
`rx_subtree_mt subtrees`
  one of NONE, AUTO, HAND
`rx_tree_t** treestore`
  &nbs;

Prototyped in: | /home/shane/code/RIP/include/rxroutines.h
Calls: | ER_dbg_va() | er/er.c
| IP_pref_b2_space() | ip/ip.c
| IP_pref_t2b() | ip/ip.c
| IP_sizebits() | ip/ip.c
| TH_init_read_write_lockw(), UT_malloc_real(), fprintf(), strcpy()
Called by: | AC_build() | ac/access_control.c
| RP_tree_add() | rp/rp_tree.c

## Global Function RX_treecheck()

`er_ret_t RX_treecheck ( rx_tree_t* tree, int datatoo, rx_treecheck_t* errorfound )`

Prototyped in: | /home/shane/code/RIP/include/rxroutines.h
Calls: | rx_check_walk_tree() | rx/rx_tree.c

## Global Function rx_check_walk_tree()

`int rx_check_walk_tree ( rx_node_t* node, rx_node_t* parent_node, int nodecounter, rx_treecheck_t* checkstruct )`

Calls: | rx_check_walk_tree() | rx/rx_tree.c
| fprintf(), g_list_length()
Called by: | RX_treecheck() | rx/rx_tree.c
| rx_check_walk_tree() | rx/rx_tree.c

## Global Function rx_delete_dataleaves()

      go down the tree and delete all nodes of the tree.

      the function is called recursively with level increased
      it stops recursing when no child nodes are found or maxlevel is reached.

      therefore the initial call must set level to 0.

      the nodecounter increments at every node, and is the return value
      of the function. So start with 0 to get the number of nodes traversed.

      ERROR HANDLING IS DIFFERENT HERE!
      Unlike other functions it is not the return value:
      The error code from the func function IF DEFINED (== not NULL ) goes
      to the variable pointed to by the last parameter.

      XXX: nodecounter is ALWAYS passed as 0, so should probably be removed from
           calling parameter list, shane 2001-02-01

`void rx_delete_dataleaves ( void* element_data, void* result_ptr )`

Calls: | ER_dbg_va() | er/er.c
| UT_free_real()
Used in: | rx_delete_treenode() | rx/rx_tree.c

## Global Function rx_delete_tree()

`int rx_delete_tree ( rx_tree_t* tree, rx_node_t* node, int maxlevel, int level, int nodecounter, void* userptr )`

Prototyped in: | /home/shane/code/RIP/include/rxroutines.h
Calls: | rx_delete_tree() | rx/rx_tree.c
| rx_delete_treenode() | rx/rx_tree.c
| fprintf()
Called by: | RP_tree_del() | rp/rp_tree.c
| rx_delete_tree() | rx/rx_tree.c

## Global Function rx_delete_treenode()

`void rx_delete_treenode ( rx_tree_t* tree, rx_node_t* curnode )`

Prototyped in: | /home/shane/code/RIP/include/rxroutines.h
Calls: | ER_dbg_va() | er/er.c
| UT_free_real(), g_list_foreach(), g_list_free()
Called by: | rx_delete_tree() | rx/rx_tree.c
References Functions: | rx_delete_dataleaves() | rx/rx_tree.c

## Global Function rx_walk_tree()

      go down the tree calling func on every node.
      (func takes the node pointer and the current level)

      the function is called recursively with level increased
      it stops recursing when no child nodes are found or maxlevel is reached.

      therefore the initial call must set level to 0.

      the nodecounter increments at every node, and is the return value
      of the function. So start with 0 to get the number of nodes traversed.

      ERROR HANDLING IS DIFFERENT HERE!
      Unlike other functions it is not the return value:
      The error code from the func function IF DEFINED (== not NULL ) goes
      to the variable pointed to by the last parameter.

      XXX: nodecounter is ALWAYS passed as 0, so should probably be removed from
           calling parameter list, shane 2001-02-01

`int rx_walk_tree ( rx_node_t* node, er_ret_t (*func)(rx_node_t* node,int level,int nodecounter,void* userptr), rx_walk_mt walk_mode, int maxlevel, int level, int nodecounter, void* userptr, er_ret_t* err )`

Prototyped in: | /home/shane/code/RIP/include/rxroutines.h
Calls: | ER_dbg_va() | er/er.c
| rx_walk_tree() | rx/rx_tree.c
| fprintf()
Called by: | AC_decay() | ac/access_control.c
| AC_print_access() | ac/access_control.c
| AC_print_acl() | ac/access_control.c
| rx_nod_search() | rx/rx_search.c
| rx_tree_print() | rx/rx_print.c
| rx_walk_tree() | rx/rx_tree.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 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 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()