#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "../../mi/mi.h"
#include "../../sr_module.h"
#include "../../dprint.h"
#include "../../error.h"
#include "../../ut.h"
#include "../../route.h"
#include "../../mem/mem.h"
#include "../../mod_fix.h"
#include "dispatch.h"

Go to the source code of this file.
Defines | |
| #define | DS_DEST_FLAGS_COL "flags" |
| #define | DS_DEST_PRIORITY_COL "priority" |
| #define | DS_DEST_URI_COL "destination" |
| #define | DS_SET_ID_COL "setid" |
| #define | DS_TABLE_NAME "dispatcher" |
| #define | MI_ERR_RELOAD "ERROR Reloading data" |
| #define | MI_ERR_RELOAD_LEN (sizeof(MI_ERR_RELOAD)-1) |
| #define | MI_NOT_SUPPORTED "DB mode not configured" |
| #define | MI_NOT_SUPPORTED_LEN (sizeof(MI_NOT_SUPPORTED)-1) |
Functions | |
| static int | child_init (int rank) |
| Initialize children. | |
| static void | destroy (void) |
| destroy function | |
| static struct mi_root * | ds_mi_list (struct mi_root *cmd, void *param) |
| static struct mi_root * | ds_mi_reload (struct mi_root *cmd_tree, void *param) |
| static struct mi_root * | ds_mi_set (struct mi_root *cmd, void *param) |
| static int | ds_warn_fixup (void **param, int param_no) |
| static int | mi_child_init (void) |
| static int | mod_init (void) |
| static int | w_ds_is_from_list0 (struct sip_msg *, char *, char *) |
| static int | w_ds_is_from_list1 (struct sip_msg *, char *, char *) |
| static int | w_ds_mark_dst0 (struct sip_msg *, char *, char *) |
| static int | w_ds_mark_dst1 (struct sip_msg *, char *, char *) |
| static int | w_ds_next_domain (struct sip_msg *, char *, char *) |
| static int | w_ds_next_dst (struct sip_msg *, char *, char *) |
| static int | w_ds_select_domain (struct sip_msg *, char *, char *) |
| static int | w_ds_select_dst (struct sip_msg *, char *, char *) |
Variables | |
| static cmd_export_t | cmds [] |
| int_str | cnt_avp_name |
| static str | cnt_avp_param = {NULL, 0} |
| unsigned short | cnt_avp_type |
| int | ds_append_branch = 1 |
| str | ds_db_url = {NULL, 0} |
| str | ds_dest_flags_col = str_init(DS_DEST_FLAGS_COL) |
| str | ds_dest_priority_col = str_init(DS_DEST_PRIORITY_COL) |
| str | ds_dest_uri_col = str_init(DS_DEST_URI_COL) |
| int | ds_flags = 0 |
| int | ds_force_dst = 0 |
| str | ds_ping_from = {"sip:dispatcher@localhost", 24} |
| static int | ds_ping_interval = 0 |
| str | ds_ping_method = {"OPTIONS",7} |
| int | ds_probing_mode = 0 |
| str | ds_set_id_col = str_init(DS_SET_ID_COL) |
| pv_spec_t | ds_setid_pv |
| str | ds_setid_pvname = {NULL, 0} |
| str | ds_table_name = str_init(DS_TABLE_NAME) |
| int | ds_use_default = 0 |
| char * | dslistfile = CFG_DIR"dispatcher.list" |
| int_str | dst_avp_name |
| static str | dst_avp_param = {NULL, 0} |
| unsigned short | dst_avp_type |
| struct module_exports | exports |
| int_str | grp_avp_name |
| static str | grp_avp_param = {NULL, 0} |
| unsigned short | grp_avp_type |
| pv_elem_t * | hash_param_model = NULL |
| str | hash_pvar_param = {NULL, 0} |
| static mi_export_t | mi_cmds [] |
| static param_export_t | params [] |
| int | probing_threshhold = 3 |
dispatcher module -- stateless load balancing
Copyright (C) 2004-2005 FhG Fokus Copyright (C) 2006 Voice Sistem SRL
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 ------- 2004-07-31 first version, by daniel 2007-01-11 Added a function to check if a specific gateway is in a group (carsten - Carsten Bock, BASIS AudioNet GmbH) 2007-02-09 Added active probing of failed destinations and automatic re-enabling of destinations (carsten) 2007-05-08 Ported the changes to SVN-Trunk and renamed ds_is_domain to ds_is_from_list. (carsten) 2007-07-18 Added support for load/reload groups from DB reload triggered from ds_reload MI_Command (ancuta)
Definition in file dispatcher.c.
| #define DS_DEST_FLAGS_COL "flags" |
Definition at line 72 of file dispatcher.c.
| #define DS_DEST_PRIORITY_COL "priority" |
Definition at line 73 of file dispatcher.c.
| #define DS_DEST_URI_COL "destination" |
Definition at line 71 of file dispatcher.c.
| #define DS_SET_ID_COL "setid" |
Definition at line 70 of file dispatcher.c.
| #define DS_TABLE_NAME "dispatcher" |
Definition at line 74 of file dispatcher.c.
| #define MI_ERR_RELOAD "ERROR Reloading data" |
| #define MI_ERR_RELOAD_LEN (sizeof(MI_ERR_RELOAD)-1) |
| #define MI_NOT_SUPPORTED "DB mode not configured" |
Definition at line 561 of file dispatcher.c.
| #define MI_NOT_SUPPORTED_LEN (sizeof(MI_NOT_SUPPORTED)-1) |
Definition at line 562 of file dispatcher.c.
| static int child_init | ( | int | rank | ) | [static] |
| static void destroy | ( | void | ) | [static] |
destroy function
Definition at line 378 of file dispatcher.c.
References ds_destroy_list(), ds_disconnect_db(), and _str::s.
Definition at line 541 of file dispatcher.c.
References ds_print_mi_list(), free_mi_tree(), init_mi_tree(), LM_ERR, MI_OK_LEN, MI_OK_S, mi_root::node, and NULL.
Definition at line 564 of file dispatcher.c.
References ds_load_db(), ds_load_list(), dslistfile, init_mi_tree(), MI_ERR_RELOAD, MI_ERR_RELOAD_LEN, MI_OK_LEN, MI_OK_S, and _str::s.
Definition at line 480 of file dispatcher.c.
References DS_INACTIVE_DST, ds_set_state(), group, init_mi_tree(), mi_node::kids, _str::len, LM_ERR, MI_MISSING_PARM_LEN, MI_MISSING_PARM_S, MI_OK_LEN, MI_OK_S, mi_node::next, mi_root::node, NULL, _str::s, str2int(), and mi_node::value.
| static int ds_warn_fixup | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
| static int mi_child_init | ( | void | ) | [static] |
| static int mod_init | ( | void | ) | [static] |
module functions
init module function
Definition at line 203 of file dispatcher.c.
References cnt_avp_type, ds_check_timer(), ds_load_list(), ds_ping_interval, dslistfile, dst_avp_type, find_export(), grp_avp_type, init_data(), init_ds_db(), _str::len, LM_DBG, LM_ERR, LM_WARN, load_tm(), int_str::n, NULL, pv_get_avp_name(), pv_is_w, pv_parse_format(), pv_parse_spec(), _pv_spec::pvp, PVT_AVP, register_timer(), _str::s, tmb, and _pv_spec::type.
| static int w_ds_is_from_list0 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_ds_is_from_list1 | ( | struct sip_msg * | msg, | |
| char * | set, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_ds_mark_dst0 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_ds_mark_dst1 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_ds_next_domain | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_ds_next_dst | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int w_ds_select_domain | ( | struct sip_msg * | msg, | |
| char * | set, | |||
| char * | alg | |||
| ) | [static] |
Definition at line 411 of file dispatcher.c.
References ds_select_dst(), fixup_get_ivalue(), LM_ERR, NULL, and s.
| static int w_ds_select_dst | ( | struct sip_msg * | msg, | |
| char * | set, | |||
| char * | alg | |||
| ) | [static] |
Definition at line 388 of file dispatcher.c.
References ds_select_dst(), fixup_get_ivalue(), LM_ERR, NULL, and s.
cmd_export_t cmds[] [static] |
Definition at line 137 of file dispatcher.c.
str cnt_avp_param = {NULL, 0} [static] |
Definition at line 83 of file dispatcher.c.
| unsigned short cnt_avp_type |
| int ds_append_branch = 1 |
| str ds_dest_flags_col = str_init(DS_DEST_FLAGS_COL) |
| str ds_dest_priority_col = str_init(DS_DEST_PRIORITY_COL) |
| str ds_dest_uri_col = str_init(DS_DEST_URI_COL) |
| int ds_flags = 0 |
Definition at line 79 of file dispatcher.c.
Referenced by ds_hash_fromuri(), ds_hash_ruri(), ds_hash_touri(), ds_mark_dst(), ds_next_dst(), and ds_select_dst().
| int ds_force_dst = 0 |
| str ds_ping_from = {"sip:dispatcher@localhost", 24} |
int ds_ping_interval = 0 [static] |
| str ds_ping_method = {"OPTIONS",7} |
| int ds_probing_mode = 0 |
Definition at line 100 of file dispatcher.c.
Referenced by ds_check_timer(), and ds_options_callback().
| str ds_set_id_col = str_init(DS_SET_ID_COL) |
| str ds_setid_pvname = {NULL, 0} |
| str ds_table_name = str_init(DS_TABLE_NAME) |
| int ds_use_default = 0 |
| char* dslistfile = CFG_DIR"dispatcher.list" |
parameters
Definition at line 77 of file dispatcher.c.
Referenced by ds_mi_reload(), and mod_init().
Definition at line 86 of file dispatcher.c.
Referenced by ds_mark_dst(), ds_next_dst(), ds_select_dst(), ldap_filter_url_encode(), and ldap_write_result().
str dst_avp_param = {NULL, 0} [static] |
Definition at line 81 of file dispatcher.c.
| unsigned short dst_avp_type |
Definition at line 87 of file dispatcher.c.
Referenced by ds_mark_dst(), ds_next_dst(), ds_select_dst(), ldap_filter_url_encode(), ldap_write_result(), and mod_init().
| struct module_exports exports |
module exports
Definition at line 185 of file dispatcher.c.
str grp_avp_param = {NULL, 0} [static] |
Definition at line 82 of file dispatcher.c.
| unsigned short grp_avp_type |
Definition at line 89 of file dispatcher.c.
Referenced by ds_mark_dst(), ds_select_dst(), and mod_init().
| pv_elem_t* hash_param_model = NULL |
| str hash_pvar_param = {NULL, 0} |
Definition at line 84 of file dispatcher.c.
mi_export_t mi_cmds[] [static] |
Definition at line 176 of file dispatcher.c.
param_export_t params[] [static] |
Definition at line 150 of file dispatcher.c.
| int probing_threshhold = 3 |
number of failed requests, before a destination is taken into probing
Definition at line 95 of file dispatcher.c.
Referenced by ds_print_list(), and ds_set_state().
1.5.6