More...
#include <string.h>
#include "../../parser/parse_uri.h"
#include "../../mem/shm_mem.h"
#include "../../sr_module.h"
#include "../../mi/mi.h"
#include "../../mem/mem.h"
#include "../../usr_avp.h"
#include "../../locking.h"
#include "../../error.h"
#include "../../ut.h"
#include "../../mod_fix.h"
#include "../../trie/dtrie.h"
#include "db.h"
#include "db_userblacklist.h"

Go to the source code of this file.
Data Structures | |
| struct | _avp_check |
| struct | check_blacklist_fs_t |
| struct | source_list_t |
| struct | source_t |
Defines | |
| #define | MAXNUMBERLEN 31 |
Typedefs | |
| typedef struct _avp_check | avp_check_t |
Functions | |
| static int | add_source (const char *table) |
| static int | check_blacklist (struct sip_msg *msg, struct check_blacklist_fs_t *arg1) |
| static int | check_blacklist_fixup (void **param, int param_no) |
| static int | check_user_blacklist (struct sip_msg *msg, char *str1, char *str2, char *str3, char *str4) |
| static int | check_user_blacklist_fixup (void **param, int param_no) |
| static int | child_init (int rank) |
| static void | destroy_shmlock (void) |
| static void | destroy_source_list (void) |
| static int | init_shmlock (void) |
| static int | init_source_list (void) |
| static int | mi_child_init (void) |
| struct mi_root * | mi_reload_blacklist (struct mi_root *cmd, void *param) |
| static void | mod_destroy (void) |
| static int | mod_init (void) |
| static int | reload_sources (void) |
| static struct dtrie_node_t * | table2dt (const char *table) |
Variables | |
| static cmd_export_t | cmds [] |
| static struct dtrie_node_t * | dtrie_root |
| struct module_exports | exports |
| static gen_lock_t * | lock = NULL |
| static mi_export_t | mi_cmds [] |
| static param_export_t | params [] |
| static struct source_list_t * | sources = NULL |
| static int | use_domain = 0 |
| str | userblacklist_db_url = str_init(DEFAULT_RODB_URL) |
Definition in file userblacklist.c.
| #define MAXNUMBERLEN 31 |
Definition at line 61 of file userblacklist.c.
Referenced by check_blacklist(), and check_user_blacklist().
| typedef struct _avp_check avp_check_t |
| static int add_source | ( | const char * | table | ) | [static] |
Adds a new table to the list, if the table is already present, nothing will be done.
Definition at line 319 of file userblacklist.c.
References source_t::dtrie_root, source_list_t::head, LM_DBG, LM_ERR, source_t::next, NULL, shm_free, shm_malloc(), SHM_MEM_ERROR, and source_t::table.
Referenced by check_blacklist_fixup().
| static int check_blacklist | ( | struct sip_msg * | msg, | |
| struct check_blacklist_fs_t * | arg1 | |||
| ) | [static] |
Definition at line 397 of file userblacklist.c.
References check_blacklist_fs_t::dtrie_root, sip_msg::first_line, _str::len, LM_DBG, LM_ERR, MARK_WHITELIST, MAXNUMBERLEN, NULL, parse_sip_msg_uri(), sip_msg::parsed_uri, _str::s, SIP_REQUEST, msg_start::type, and sip_uri::user.
| static int check_blacklist_fixup | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 358 of file userblacklist.c.
References add_source(), check_blacklist_fs_t::dtrie_root, LM_ERR, NULL, pkg_malloc, PKG_MEM_ERROR, table, and table2dt().
| static int check_user_blacklist | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2, | |||
| char * | str3, | |||
| char * | str4 | |||
| ) | [static] |
Definition at line 203 of file userblacklist.c.
References db_build_userbl_tree(), domain, sip_msg::first_line, _str::len, LM_DBG, LM_ERR, MARK_WHITELIST, MAXNUMBERLEN, NULL, parse_sip_msg_uri(), sip_msg::parsed_uri, pv_printf_s(), _str::s, SIP_REQUEST, table, msg_start::type, use_domain, sip_uri::user, user, and userblacklist_table.
| static int check_user_blacklist_fixup | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 158 of file userblacklist.c.
References E_UNSPEC, _pv_spec::getf, _pv_name::isname, _str::len, LM_ERR, NULL, pv_parse_format(), _pv_param::pvn, _pv_spec::pvp, _str::s, s, _pv_elem::spec, str2int(), and _pv_name::u.
| static int child_init | ( | int | rank | ) | [static] |
Definition at line 562 of file userblacklist.c.
References LM_ERR, NULL, reload_sources(), and userblacklist_db_open().
| static void destroy_shmlock | ( | void | ) | [static] |
| static void destroy_source_list | ( | void | ) | [static] |
Definition at line 494 of file userblacklist.c.
References source_t::dtrie_root, source_list_t::head, source_t::next, NULL, shm_free, and source_t::table.
Referenced by mod_destroy().
| static int init_shmlock | ( | void | ) | [static] |
| static int init_source_list | ( | void | ) | [static] |
Definition at line 482 of file userblacklist.c.
References source_list_t::head, NULL, shm_malloc(), and SHM_MEM_ERROR.
Referenced by mod_init().
| static int mi_child_init | ( | void | ) | [static] |
Definition at line 577 of file userblacklist.c.
References LM_ERR, NULL, reload_sources(), and userblacklist_db_open().
Definition at line 538 of file userblacklist.c.
References init_mi_tree(), MI_OK_LEN, MI_OK_S, NULL, and reload_sources().
| static void mod_destroy | ( | void | ) | [static] |
Definition at line 592 of file userblacklist.c.
References destroy_shmlock(), destroy_source_list(), NULL, and userblacklist_db_close().
| static int mod_init | ( | void | ) | [static] |
Definition at line 551 of file userblacklist.c.
References init_shmlock(), init_source_list(), userblacklist_db_init(), and userblacklist_db_vars().
| static int reload_sources | ( | void | ) | [static] |
Fills the d-tree for all configured and prepared sources.
Definition at line 453 of file userblacklist.c.
References db_reload_source(), source_t::dtrie_root, source_list_t::head, _str::len, LM_ERR, LM_INFO, source_t::next, _str::s, and source_t::table.
Referenced by child_init(), mi_child_init(), and mi_reload_blacklist().
| static struct dtrie_node_t* table2dt | ( | const char * | table | ) | [static, read] |
Finds d-tree root for given table.
Definition at line 301 of file userblacklist.c.
References source_t::dtrie_root, source_list_t::head, LM_ERR, source_t::next, NULL, and source_t::table.
Referenced by check_blacklist_fixup().
cmd_export_t cmds[] [static] |
Definition at line 96 of file userblacklist.c.
struct dtrie_node_t* dtrie_root [static] |
Definition at line 155 of file userblacklist.c.
| struct module_exports exports |
Definition at line 123 of file userblacklist.c.
gen_lock_t* lock = NULL [static] |
Definition at line 153 of file userblacklist.c.
mi_export_t mi_cmds[] [static] |
Initial value:
{
{ "reload_blacklist", mi_reload_blacklist, MI_NO_INPUT_FLAG, 0, mi_child_init },
{ 0, 0, 0, 0, 0}
}
Definition at line 117 of file userblacklist.c.
param_export_t params[] [static] |
Definition at line 105 of file userblacklist.c.
struct source_list_t* sources = NULL [static] |
Definition at line 154 of file userblacklist.c.
int use_domain = 0 [static] |
Definition at line 76 of file userblacklist.c.
| str userblacklist_db_url = str_init(DEFAULT_RODB_URL) |
Definition at line 75 of file userblacklist.c.
Referenced by userblacklist_db_init(), userblacklist_db_open(), and userblacklist_db_vars().
1.5.6