#include <stdlib.h>#include <string.h>#include "../../dprint.h"#include "../../ut.h"#include "../../db/db.h"#include "../../re.h"#include "dp_db.h"#include "dialplan.h"

Go to the source code of this file.
Defines | |
| #define | GET_STR_VALUE(_res, _values, _index) |
Functions | |
| int | add_rule2hash (dpl_node_t *, int) |
| dpl_node_t * | build_rule (db_val_t *values) |
| void | destroy_data (void) |
| void | destroy_hash (int) |
| void | destroy_rule (dpl_node_t *rule) |
| int | dp_connect_db (void) |
| void | dp_disconnect_db (void) |
| int | dp_load_db (void) |
| int | init_data (void) |
| int | init_db_data (void) |
| void | list_hash (int h_index) |
| void | list_rule (dpl_node_t *) |
| static pcre * | reg_ex_comp (const char *pattern, int *cap_cnt) |
| dpl_id_p | select_dpid (int id) |
| int | str_to_shm (str src, str *dest) |
Variables | |
| str | attrs_column = str_init(ATTRS_COL) |
| int * | crt_idx |
| static db_con_t * | dp_db_handle = 0 |
| str | dp_db_url = {DEFAULT_RODB_URL, DEFAULT_RODB_URL_LEN} |
| static db_func_t | dp_dbf |
| int | dp_fetch_rows |
| str | dp_table_name = str_init(DP_TABLE_NAME) |
| str | dpid_column = str_init(DPID_COL) |
| str | match_exp_column = str_init(MATCH_EXP_COL) |
| str | match_len_column = str_init(MATCH_LEN_COL) |
| str | match_op_column = str_init(MATCH_OP_COL) |
| int * | next_idx |
| str | pr_column = str_init(PR_COL) |
| str | repl_exp_column = str_init(REPL_EXP_COL) |
| dpl_id_p * | rules_hash = NULL |
| str | subst_exp_column = str_init(SUBST_EXP_COL) |
| #define GET_STR_VALUE | ( | _res, | |||
| _values, | |||||
| _index | ) |
| int add_rule2hash | ( | dpl_node_t * | rule, | |
| int | h_index | |||
| ) |
Definition at line 446 of file dp_db.c.
References dpl_node::dpid, dpl_index::first_rule, dpl_index::last_rule, dpl_index::len, LM_DBG, LM_ERR, dpl_node::matchlen, dpl_node::next, dpl_index::next, dpl_id::next, NULL, dpl_node::pr, shm_free, and shm_malloc().
Referenced by dp_load_db().
| dpl_node_t * build_rule | ( | db_val_t * | values | ) |
Definition at line 338 of file dp_db.c.
References dpl_node::attrs, attrs, destroy_rule(), dpl_node::dpid, EQUAL_OP, GET_STR_VALUE, _str::len, LM_DBG, LM_ERR, dpl_node::match_comp, dpl_node::match_exp, dpl_node::matchlen, dpl_node::matchop, subst_expr::max_pmatch, MAX_REPLACE_WITH, new_rule(), NULL, dpl_node::pr, reg_ex_comp(), REGEX_OP, dpl_node::repl_comp, dpl_node::repl_exp, repl_exp_parse(), repl_expr_free(), _str::s, shm_free, shm_malloc(), str_to_shm(), dpl_node::subst_comp, dpl_node::subst_exp, and VAL_INT.
Referenced by dp_load_db().
| void destroy_data | ( | void | ) |
Definition at line 165 of file dp_db.c.
References crt_idx, destroy_hash(), and shm_free.
Referenced by mod_destroy().
| void destroy_hash | ( | int | index | ) |
Definition at line 535 of file dp_db.c.
References destroy_rule(), dpl_id::first_index, dpl_index::first_rule, dpl_id::next, dpl_index::next, dpl_node::next, NULL, and shm_free.
Referenced by destroy_data(), and dp_load_db().
| void destroy_rule | ( | dpl_node_t * | rule | ) |
Definition at line 574 of file dp_db.c.
References dpl_node::attrs, LM_DBG, dpl_node::match_comp, dpl_node::match_exp, dpl_node::pr, dpl_node::repl_comp, dpl_node::repl_exp, repl_expr_free(), _str::s, shm_free, dpl_node::subst_comp, and dpl_node::subst_exp.
Referenced by build_rule(), destroy_hash(), and dp_load_db().
| int dp_connect_db | ( | void | ) |
Definition at line 112 of file dp_db.c.
References db_func::init, LM_CRIT, and LM_ERR.
Referenced by child_init(), init_db_data(), and mi_child_init().
| void dp_disconnect_db | ( | void | ) |
Definition at line 128 of file dp_db.c.
References db_func::close.
Referenced by init_db_data(), and mod_destroy().
| int dp_load_db | ( | void | ) |
Definition at line 180 of file dp_db.c.
References add_rule2hash(), build_rule(), crt_idx, DB_CAP_FETCH, DB_CAPABILITY, destroy_hash(), destroy_rule(), dp_fetch_rows, DP_TABLE_COL_NO, db_func::fetch_result, db_func::free_result, list_hash(), LM_DBG, LM_ERR, LM_WARN, next_idx, db_func::query, RES_ROW_N, RES_ROWS, ROW_VALUES, and db_func::use_table.
Referenced by init_db_data(), and mi_reload_rules().
| int init_db_data | ( | void | ) |
Definition at line 75 of file dp_db.c.
References db_bind_mod(), db_check_table_version(), dp_connect_db(), dp_disconnect_db(), dp_load_db(), DP_TABLE_VERSION, LM_ERR, and _str::s.
Referenced by init_data().
| void list_hash | ( | int | h_index | ) |
Definition at line 622 of file dp_db.c.
References dpl_id::dp_id, dpl_id::first_index, dpl_index::first_rule, dpl_index::len, list_rule(), LM_DBG, dpl_node::next, dpl_index::next, dpl_id::next, and NULL.
Referenced by dp_load_db().
| void list_rule | ( | dpl_node_t * | rule | ) |
Definition at line 644 of file dp_db.c.
References dpl_node::attrs, _str::len, LM_DBG, dpl_node::match_exp, dpl_node::next, dpl_node::pr, dpl_node::repl_exp, _str::s, and dpl_node::subst_exp.
Referenced by list_hash().
| static pcre* reg_ex_comp | ( | const char * | pattern, | |
| int * | cap_cnt | |||
| ) | [static] |
Definition at line 299 of file dp_db.c.
References LM_ERR, NULL, and shm_malloc().
Referenced by build_rule(), and reload_gws_and_lcrs().
| dpl_id_p select_dpid | ( | int | id | ) |
Definition at line 606 of file dp_db.c.
References crt_idx, dpl_id::dp_id, dpl_id::next, and NULL.
Referenced by dp_translate_f(), and mi_translate().
Definition at line 279 of file dp_db.c.
References _str::len, LM_ERR, _str::s, and shm_malloc().
Referenced by build_rule().
| str attrs_column = str_init(ATTRS_COL) |
| int* crt_idx |
Definition at line 71 of file dp_db.c.
Referenced by destroy_data(), dp_load_db(), ds_destroy_list(), ds_load_db(), ds_load_list(), init_data(), and select_dpid().
db_con_t* dp_db_handle = 0 [static] |
| int dp_fetch_rows |
| str dp_table_name = str_init(DP_TABLE_NAME) |
| str dpid_column = str_init(DPID_COL) |
| str match_exp_column = str_init(MATCH_EXP_COL) |
| str match_len_column = str_init(MATCH_LEN_COL) |
| str match_op_column = str_init(MATCH_OP_COL) |
| int * next_idx |
Definition at line 71 of file dp_db.c.
Referenced by dp_load_db(), ds_load_db(), ds_load_list(), and init_data().
| str repl_exp_column = str_init(REPL_EXP_COL) |
| dpl_id_p* rules_hash = NULL |
| str subst_exp_column = str_init(SUBST_EXP_COL) |
1.5.6