pdt.c File Reference

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "../../db/db_op.h"
#include "../../sr_module.h"
#include "../../db/db.h"
#include "../../mem/shm_mem.h"
#include "../../mem/mem.h"
#include "../../dprint.h"
#include "../../parser/parse_uri.h"
#include "../../timer.h"
#include "../../ut.h"
#include "../../locking.h"
#include "../../action.h"
#include "../../mod_fix.h"
#include "../../parser/parse_from.h"
#include "pdtree.h"

Include dependency graph for pdt.c:

Go to the source code of this file.

Defines

#define NR_KEYS   3

Functions

static int child_init (void)
static int mod_child_init (int r)
static void mod_destroy (void)
static int mod_init (void)
static int pdt_load_db ()
static struct mi_rootpdt_mi_add (struct mi_root *, void *param)
static struct mi_rootpdt_mi_delete (struct mi_root *, void *param)
static struct mi_rootpdt_mi_list (struct mi_root *, void *param)
static struct mi_rootpdt_mi_reload (struct mi_root *, void *param)
int pdt_print_mi_node (pdt_node_t *pt, struct mi_node *rpl, char *code, int len, str *sdomain, str *sd, str *sp)
static int prefix2domain (struct sip_msg *, int mode, int sd_en)
static int update_new_uri (struct sip_msg *msg, int plen, str *d, int mode)
static int w_prefix2domain (struct sip_msg *msg, char *str1, char *str2)
static int w_prefix2domain_1 (struct sip_msg *msg, char *mode, char *str2)
static int w_prefix2domain_2 (struct sip_msg *msg, char *mode, char *sd_en)

Variables

pdt_tree_t ** _ptree = NULL
static cmd_export_t cmds []
static db_con_tdb_con = NULL
static str db_table = str_init("pdt")
static str db_url = str_init(DEFAULT_DB_URL)
static str domain_column = str_init("domain")
struct module_exports exports
static mi_export_t mi_cmds []
static param_export_t params []
str pdt_char_list = {"0123456789", 10}
static int pdt_check_domain = 1
static db_func_t pdt_dbf
int pdt_fetch_rows = 1000
static gen_lock_t * pdt_lock = 0
static volatile int pdt_reload_flag = 0
static volatile int pdt_tree_refcnt = 0
str prefix = {"", 0}
static str prefix_column = str_init("prefix")
static str sdomain_column = str_init("sdomain")


Define Documentation

#define NR_KEYS   3

Id
pdt.c 4657 2008-08-10 22:51:44Z henningw

Copyright (C) 2001-2003 FhG Fokus

This file is part of Kamailio, a free SIP server.

Kamailio is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version

Kamailio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

History: ------- 2003-04-07: a structure for both hashes introduced (ramona) 2003-04-06: db connection closed in mod_init (janakj) 2004-06-07: updated to the new DB api (andrei) 2005-01-26: removed terminating code (ramona) prefix hash replaced with tree (ramona) FIFO commands to add/list/delete prefix domains (ramona) pdt cache per process for fast translation (ramona) 2006-01-30: multi domain support added

Definition at line 62 of file pdt.c.


Function Documentation

static int child_init ( void   )  [static]

Definition at line 263 of file pdt.c.

References db_func::init, LM_ERR, NULL, and db_func::use_table.

static int mod_child_init ( int  r  )  [static]

Definition at line 282 of file pdt.c.

References child_init(), and LM_DBG.

static void mod_destroy ( void   )  [static]

Definition at line 293 of file pdt.c.

References db_func::close, LM_DBG, NULL, pdt_free_tree(), pdt_lock, and shm_free.

static int mod_init ( void   )  [static]

static int pdt_load_db ( void   )  [static]

struct mi_root * pdt_mi_add ( struct mi_root cmd_tree,
void *  param 
) [static, read]

struct mi_root * pdt_mi_delete ( struct mi_root cmd_tree,
void *  param 
) [static, read]

struct mi_root * pdt_mi_list ( struct mi_root cmd_tree,
void *  param 
) [static, read]

"pdt_list" syntax : sdomain prefix domain

  • '.' (dot) means NULL value and will match anything
  • the comparison operation is 'START WITH' -- if domain is 'a' then all domains starting with 'a' are listed

Examples pdt_list o 2 . - lists the entries where sdomain is starting with 'o', prefix is starting with '2' and domain is anything

pdt_list . 2 open - lists the entries where sdomain is anything, prefix starts with '2' and domain starts with 'open'

Definition at line 964 of file pdt.c.

References free_mi_tree(), _pdt_tree::head, init_mi_tree(), mi_node::kids, _str::len, len, LM_ERR, MI_INTERNAL_ERR_LEN, MI_INTERNAL_ERR_S, MI_OK_LEN, MI_OK_S, _pdt_tree::next, mi_node::next, mi_root::node, NULL, PDT_MAX_DEPTH, pdt_print_mi_node(), pt, _str::s, _pdt_tree::sdomain, strpos, and mi_node::value.

static struct mi_root * pdt_mi_reload ( struct mi_root cmd_tree,
void *  param 
) [static, read]

"pdt_reload" syntax :

Definition at line 684 of file pdt.c.

References init_mi_tree(), LM_ERR, MI_OK_LEN, MI_OK_S, and pdt_load_db().

int pdt_print_mi_node ( pdt_node_t pt,
struct mi_node rpl,
char *  code,
int  len,
str sdomain,
str sd,
str sp 
)

static int prefix2domain ( struct sip_msg msg,
int  mode,
int  sd_en 
) [static]

static int update_new_uri ( struct sip_msg msg,
int  plen,
str d,
int  mode 
) [static]

static int w_prefix2domain ( struct sip_msg msg,
char *  str1,
char *  str2 
) [static]

Definition at line 315 of file pdt.c.

References prefix2domain().

static int w_prefix2domain_1 ( struct sip_msg msg,
char *  mode,
char *  str2 
) [static]

Definition at line 320 of file pdt.c.

References fixup_get_ivalue(), LM_ERR, and prefix2domain().

static int w_prefix2domain_2 ( struct sip_msg msg,
char *  mode,
char *  sd_en 
) [static]

Definition at line 336 of file pdt.c.

References fixup_get_ivalue(), LM_ERR, prefix2domain(), and s.


Variable Documentation

pdt_tree_t** _ptree = NULL

structures containing prefix-domain pairs

Definition at line 67 of file pdt.c.

cmd_export_t cmds[] [static]

Definition at line 109 of file pdt.c.

db_con_t* db_con = NULL [static]

database connection

Definition at line 70 of file pdt.c.

str db_table = str_init("pdt") [static]

Definition at line 76 of file pdt.c.

str db_url = str_init(DEFAULT_DB_URL) [static]

parameters

Definition at line 75 of file pdt.c.

str domain_column = str_init("domain") [static]

Definition at line 79 of file pdt.c.

Definition at line 141 of file pdt.c.

mi_export_t mi_cmds[] [static]

Definition at line 132 of file pdt.c.

param_export_t params[] [static]

Definition at line 119 of file pdt.c.

str pdt_char_list = {"0123456789", 10}

Id
pdtree.c 4518 2008-07-28 15:39:28Z henningw

Copyright (C) 2005 Voice Sistem SRL (Voice-System.RO)

This file is part of Kamailio, a free SIP server.

This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version

This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

History: ------- 2005-01-25 first tree version (ramona) 2006-01-30 multi domain support added (ramona)

Definition at line 85 of file pdt.c.

int pdt_check_domain = 1 [static]

Definition at line 80 of file pdt.c.

Referenced by pdt_load_db(), and pdt_mi_add().

db_func_t pdt_dbf [static]

Definition at line 71 of file pdt.c.

int pdt_fetch_rows = 1000

Definition at line 64 of file pdt.c.

Referenced by mod_init(), and pdt_load_db().

gen_lock_t* pdt_lock = 0 [static]

Definition at line 88 of file pdt.c.

Referenced by mod_destroy(), mod_init(), pdt_load_db(), and prefix2domain().

volatile int pdt_reload_flag = 0 [static]

Definition at line 90 of file pdt.c.

Referenced by pdt_load_db(), and prefix2domain().

volatile int pdt_tree_refcnt = 0 [static]

Definition at line 89 of file pdt.c.

Referenced by pdt_load_db(), and prefix2domain().

str prefix = {"", 0}

str prefix_column = str_init("prefix") [static]

Definition at line 78 of file pdt.c.

str sdomain_column = str_init("sdomain") [static]

Definition at line 77 of file pdt.c.


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