userblacklist.c File Reference

USERBLACKLIST :: module definitions

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"

Include dependency graph for userblacklist.c:

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_rootmi_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_tsources = NULL
static int use_domain = 0
str userblacklist_db_url = str_init(DEFAULT_RODB_URL)


Detailed Description

USERBLACKLIST :: module definitions

Definition in file userblacklist.c.


Define Documentation

#define MAXNUMBERLEN   31

Definition at line 61 of file userblacklist.c.

Referenced by check_blacklist(), and check_user_blacklist().


Typedef Documentation

typedef struct _avp_check avp_check_t


Function Documentation

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.

Returns:
zero on success, negative on errors

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]

static int check_blacklist_fixup ( void **  param,
int  param_no 
) [static]

static int check_user_blacklist ( struct sip_msg msg,
char *  str1,
char *  str2,
char *  str3,
char *  str4 
) [static]

static int check_user_blacklist_fixup ( void **  param,
int  param_no 
) [static]

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]

Definition at line 528 of file userblacklist.c.

References NULL.

Referenced by mod_destroy().

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]

Definition at line 512 of file userblacklist.c.

References LM_CRIT.

Referenced by mod_init().

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().

struct mi_root * mi_reload_blacklist ( struct mi_root cmd,
void *  param 
) [read]

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]

static int mod_init ( void   )  [static]

static int reload_sources ( void   )  [static]

Fills the d-tree for all configured and prepared sources.

Returns:
0 on success, -1 otherwise

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.

Returns:
pointer to d-tree root on success, NULL otherwise

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().


Variable Documentation

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.

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)


Generated on Thu May 24 22:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6