#include <stdio.h>
#include "../../pvar.h"
#include "../../parser/msg_parser.h"
#include "../tm/tm_load.h"


Go to the source code of this file.
dispatcher module
Copyright (C) 2004-2006 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 ------- 2004-07-31 first version, by daniel 2007-01-11 Added a function to check if a specific gateway is in a group (carsten) 2007-02-09 Added active probing of failed destinations and automatic re-enabling of destinations 2007-05-08 Ported the changes to SVN-Trunk and renamed ds_is_domain to ds_is_from_list.
Definition in file dispatch.h.
| #define DS_FAILOVER_ON 2 |
store the other dest in avps
Definition at line 50 of file dispatch.h.
Referenced by ds_mark_dst(), ds_next_dst(), and ds_select_dst().
| #define DS_HASH_USER_ONLY 1 |
use only the uri user part for hashing
Definition at line 49 of file dispatch.h.
Referenced by get_uri_hash_keys().
| #define DS_INACTIVE_DST 1 |
inactive destination
Definition at line 52 of file dispatch.h.
Referenced by ds_mark_dst(), ds_mi_set(), ds_options_callback(), ds_print_list(), ds_print_mi_list(), ds_select_dst(), and ds_set_state().
| #define DS_PROBING_DST 2 |
checking destination
Definition at line 53 of file dispatch.h.
Referenced by ds_check_timer(), ds_mark_dst(), ds_options_callback(), ds_print_list(), ds_print_mi_list(), ds_select_dst(), and ds_set_state().
| #define DS_RESET_FAIL_DST 4 |
Reset-Failure-Counter
Definition at line 54 of file dispatch.h.
Referenced by ds_options_callback(), and ds_set_state().
| void ds_check_timer | ( | unsigned int | ticks, | |
| void * | param | |||
| ) |
Timer for checking inactive destinations.
This timer is regularly fired.
Definition at line 1624 of file dispatch.c.
References _ds_list, _ds_list_nr, _ds_set::dlist, ds_options_callback(), ds_ping_from, ds_ping_method, DS_PROBING_DST, ds_probing_mode, _ds_dest::flags, _ds_set::id, _str::len, LM_DBG, LM_ERR, _ds_set::next, _ds_set::nr, NULL, _str::s, tm_binds::t_request, tmb, and _ds_dest::uri.
Referenced by mod_init().
| int ds_connect_db | ( | void | ) |
Definition at line 453 of file dispatch.c.
References ds_db_url, db_func::init, LM_CRIT, and _str::s.
Referenced by init_ds_db(), and mi_child_init().
| int ds_destroy_list | ( | void | ) |
called from dispatcher.c: free all
Definition at line 627 of file dispatch.c.
References crt_idx, destroy_list(), and shm_free.
Referenced by destroy().
| void ds_disconnect_db | ( | void | ) |
Definition at line 471 of file dispatch.c.
References db_func::close.
Referenced by destroy(), and init_ds_db().
| int ds_is_from_list | ( | struct sip_msg * | _m, | |
| int | group | |||
| ) |
Definition at line 1471 of file dispatch.c.
References _ds_list, _ds_set::dlist, ds_setid_pv, ds_setid_pvname, EQ_T, _pv_value::flags, _ds_set::id, ip_addr_cmp, _ds_dest::ip_address, LM_ERR, _ds_set::next, _ds_set::nr, NULL, _ds_dest::port, PV_TYPE_INT, PV_VAL_INT, _pv_spec::pvp, sip_msg::rcv, _pv_value::ri, _str::s, _pv_spec::setf, receive_info::src_ip, and receive_info::src_port.
Referenced by w_ds_is_from_list0(), and w_ds_is_from_list1().
| int ds_load_db | ( | void | ) |
load groups of destinations from DB
Definition at line 527 of file dispatch.c.
References _ds_list_nr, _ds_table_version, add_dest2list(), crt_idx, destroy_list(), ds_dest_flags_col, ds_dest_priority_col, ds_dest_uri_col, ds_print_sets(), ds_set_id_col, ds_table_name, DS_TABLE_VERSION2, DS_TABLE_VERSION3, db_func::free_result, id, _str::len, LM_ERR, LM_WARN, next_idx, NULL, priority, db_func::query, reindex_dests(), RES_ROW_N, RES_ROWS, ROW_VALUES, _str::s, db_func::use_table, VAL_INT, and VAL_STR.
Referenced by ds_mi_reload(), and init_ds_db().
| int ds_load_list | ( | char * | lfile | ) |
load groups of destinations from file
Definition at line 329 of file dispatch.c.
References _ds_list_nr, add_dest2list(), crt_idx, destroy_list(), ds_print_sets(), id, _str::len, LM_ERR, LM_WARN, next_idx, NULL, priority, reindex_dests(), and _str::s.
Referenced by ds_mi_reload(), and mod_init().
| int ds_mark_dst | ( | struct sip_msg * | msg, | |
| int | mode | |||
| ) |
Definition at line 1320 of file dispatch.c.
References AVP_VAL_STR, DS_FAILOVER_ON, ds_flags, DS_INACTIVE_DST, DS_PROBING_DST, ds_set_state(), dst_avp_name, dst_avp_type, usr_avp::flags, group, grp_avp_name, grp_avp_type, _str::len, LM_DBG, LM_WARN, int_str::n, NULL, _str::s, int_str::s, and search_first_avp().
Referenced by w_ds_mark_dst0(), and w_ds_mark_dst1().
| int ds_next_dst | ( | struct sip_msg * | msg, | |
| int | mode | |||
| ) |
Definition at line 1288 of file dispatch.c.
References AVP_VAL_STR, destroy_avp(), DS_FAILOVER_ON, ds_flags, ds_update_dst(), dst_avp_name, dst_avp_type, usr_avp::flags, _str::len, LM_DBG, LM_ERR, LM_WARN, int_str::n, NULL, _str::s, int_str::s, search_first_avp(), and search_next_avp().
Referenced by w_ds_next_domain(), and w_ds_next_dst().
| int ds_print_list | ( | FILE * | fout | ) |
Definition at line 1425 of file dispatch.c.
References _ds_list, _ds_list_nr, _ds_set::dlist, DS_INACTIVE_DST, DS_PROBING_DST, _ds_dest::failure_count, _ds_dest::flags, _ds_set::id, _str::len, LM_ERR, _ds_set::next, _ds_set::nr, NULL, probing_threshhold, _str::s, and _ds_dest::uri.
| int ds_print_mi_list | ( | struct mi_node * | rpl | ) |
Definition at line 1511 of file dispatch.c.
References _ds_list, _ds_list_nr, add_mi_attr(), add_mi_node_child(), _ds_set::dlist, DS_INACTIVE_DST, DS_PROBING_DST, _ds_dest::flags, _ds_set::id, int2str(), _str::len, len, LM_ERR, MI_DUP_VALUE, _ds_set::next, _ds_set::nr, NULL, _str::s, and _ds_dest::uri.
Referenced by ds_mi_list().
| int ds_select_dst | ( | struct sip_msg * | msg, | |
| int | set, | |||
| int | alg, | |||
| int | mode | |||
| ) |
Definition at line 1074 of file dispatch.c.
References _ds_list, _ds_list_nr, add_avp(), AVP_VAL_STR, cnt_avp_name, cnt_avp_type, _ds_set::dlist, DS_FAILOVER_ON, ds_flags, ds_force_dst, ds_get_index(), ds_hash_authusername(), ds_hash_callid(), ds_hash_fromuri(), ds_hash_pvar(), ds_hash_ruri(), ds_hash_touri(), DS_INACTIVE_DST, DS_PROBING_DST, ds_update_dst(), ds_use_default, dst_avp_name, dst_avp_type, sip_msg::dst_uri, _ds_dest::flags, grp_avp_name, grp_avp_type, hash, _ds_set::last, _str::len, LM_DBG, LM_ERR, LM_WARN, int_str::n, _ds_set::nr, NULL, int_str::s, _str::s, and _ds_dest::uri.
Referenced by w_ds_select_domain(), and w_ds_select_dst().
| int ds_set_state | ( | int | group, | |
| str * | address, | |||
| int | state, | |||
| int | type | |||
| ) |
Definition at line 1362 of file dispatch.c.
References _ds_list, _ds_list_nr, _ds_set::dlist, ds_get_index(), DS_INACTIVE_DST, DS_PROBING_DST, DS_RESET_FAIL_DST, _ds_dest::failure_count, _ds_dest::flags, _str::len, LM_ERR, LM_INFO, NULL, probing_threshhold, _str::s, and _ds_dest::uri.
Referenced by ds_mark_dst(), ds_mi_set(), and ds_options_callback().
| int init_data | ( | void | ) |
Definition at line 137 of file dp_db.c.
References crt_idx, ds_list_nr, init_db_data(), LM_DBG, LM_ERR, next_idx, and shm_malloc().
| int init_ds_db | ( | void | ) |
Initialize and verify DB stuff.
Definition at line 481 of file dispatch.c.
References _ds_table_version, db_bind_mod(), db_table_version(), ds_connect_db(), ds_db_url, ds_disconnect_db(), ds_load_db(), ds_table_name, DS_TABLE_VERSION, DS_TABLE_VERSION2, DS_TABLE_VERSION3, LM_ERR, and _str::s.
Referenced by mod_init().
| unsigned short cnt_avp_type |
| int ds_append_branch |
| int ds_flags |
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_probing_mode |
Definition at line 100 of file dispatcher.c.
Referenced by ds_check_timer(), and ds_options_callback().
| int ds_use_default |
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().
| 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().
| unsigned short grp_avp_type |
Definition at line 89 of file dispatcher.c.
Referenced by ds_mark_dst(), ds_select_dst(), and mod_init().
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().
TM bind
Definition at line 79 of file dispatch.h.
1.5.6