#include "../../mem/shm_mem.h"
#include "../../hash_func.h"
#include "../../dprint.h"
#include "../../ut.h"
#include "../../route.h"
#include "../tm/tm_load.h"
#include "dlg_hash.h"
#include "dlg_profile.h"

Go to the source code of this file.
Defines | |
| #define | PROFILE_HASH_SIZE 16 |
Functions | |
| int | add_profile_definitions (char *profiles, unsigned int has_value) |
| Add profile definitions to the global list. | |
| static unsigned int | calc_hash_profile (str *value, struct dlg_cell *dlg, struct dlg_profile_table *profile) |
| Calculate the hash profile from a dialog. | |
| static void | destroy_dlg_profile (struct dlg_profile_table *profile) |
| Destroy a dialog profile list. | |
| void | destroy_dlg_profiles (void) |
| Destroy the global dialog profile list. | |
| void | destroy_linkers (struct dlg_profile_link *linker) |
| Destroy dialog linkers. | |
| static struct dlg_cell * | get_current_dialog (struct sip_msg *msg) |
| Get the current dialog for a message, if exists. | |
| unsigned int | get_profile_size (struct dlg_profile_table *profile, str *value) |
| Get the size of a profile. | |
| int | is_dlg_in_profile (struct sip_msg *msg, struct dlg_profile_table *profile, str *value) |
| Check if a dialog belongs to a profile. | |
| static void | link_dlg_profile (struct dlg_profile_link *linker, struct dlg_cell *dlg) |
| Link a dialog profile. | |
| struct mi_root * | mi_get_profile (struct mi_root *cmd_tree, void *param) |
| Output a profile via MI interface. | |
| struct mi_root * | mi_profile_list (struct mi_root *cmd_tree, void *param) |
| List the profiles via MI interface. | |
| static struct dlg_profile_table * | new_dlg_profile (str *name, unsigned int size, unsigned int has_value) |
| Creates a new dialog profile. | |
| int | profile_cleanup (struct sip_msg *msg, void *param) |
| Cleanup a profile. | |
| struct dlg_profile_table * | search_dlg_profile (str *name) |
| Search a dialog profile in the global list. | |
| void | set_current_dialog (struct sip_msg *msg, struct dlg_cell *dlg) |
| Set the global variables to the current dialog. | |
| int | set_dlg_profile (struct sip_msg *msg, str *value, struct dlg_profile_table *profile) |
| Set a dialog profile. | |
| int | unset_dlg_profile (struct sip_msg *msg, str *value, struct dlg_profile_table *profile) |
| Unset a dialog profile. | |
Variables | |
| static unsigned int | current_dlg_msg_id = 0 |
| struct dlg_cell * | current_dlg_pointer = NULL |
| static struct dlg_profile_link * | current_pending_linkers = NULL |
| struct tm_binds | d_tmb |
| static struct dlg_profile_table * | profiles = NULL |
Module: dialog.
Definition in file dlg_profile.c.
| #define PROFILE_HASH_SIZE 16 |
size of dialog profile hash
Definition at line 48 of file dlg_profile.c.
Referenced by add_profile_definitions().
| int add_profile_definitions | ( | char * | profiles, | |
| unsigned int | has_value | |||
| ) |
Add profile definitions to the global list.
| profiles | profile name | |
| has_value | set to 0 for a profile without value, otherwise it has a value |
Definition at line 77 of file dlg_profile.c.
References _str::len, LM_DBG, LM_ERR, dlg_profile_table::name, new_dlg_profile(), NULL, PROFILE_HASH_SIZE, _str::s, and trim_spaces_lr.
Referenced by mod_init().
| static unsigned int calc_hash_profile | ( | str * | value, | |
| struct dlg_cell * | dlg, | |||
| struct dlg_profile_table * | profile | |||
| ) | [inline, static] |
Calculate the hash profile from a dialog.
Definition at line 353 of file dlg_profile.c.
References core_hash(), dlg_profile_table::has_value, NULL, and dlg_profile_table::size.
Referenced by get_profile_size(), and link_dlg_profile().
| static void destroy_dlg_profile | ( | struct dlg_profile_table * | profile | ) | [static] |
Destroy a dialog profile list.
| profile | dialog profile |
Definition at line 230 of file dlg_profile.c.
References dlg_profile_table::lock, NULL, and shm_free.
Referenced by destroy_dlg_profiles().
| void destroy_dlg_profiles | ( | void | ) |
Destroy the global dialog profile list.
Definition at line 244 of file dlg_profile.c.
References destroy_dlg_profile(), and dlg_profile_table::next.
Referenced by mod_destroy().
| void destroy_linkers | ( | struct dlg_profile_link * | linker | ) |
Destroy dialog linkers.
| linker | dialog linker |
Definition at line 261 of file dlg_profile.c.
References dlg_profile_entry::content, dlg_profile_table::entries, dlg_profile_entry::first, get_lock(), dlg_profile_hash::hash, dlg_profile_link::hash_linker, dlg_profile_table::lock, dlg_profile_hash::next, dlg_profile_link::next, NULL, dlg_profile_hash::prev, dlg_profile_link::profile, release_lock(), and shm_free.
Referenced by destroy_dlg(), get_current_dialog(), profile_cleanup(), set_current_dialog(), and unset_dlg_profile().
Get the current dialog for a message, if exists.
| msg | SIP message |
Definition at line 322 of file dlg_profile.c.
References current_dlg_msg_id, d_tmb, destroy_linkers(), cell::dialog_ctx, sip_msg::id, NULL, REQUEST_ROUTE, route_type, tm_binds::t_gett, and T_UNDEFINED.
Referenced by is_dlg_in_profile(), set_dlg_profile(), and unset_dlg_profile().
| unsigned int get_profile_size | ( | struct dlg_profile_table * | profile, | |
| str * | value | |||
| ) |
Get the size of a profile.
| profile | evaluated profile | |
| value | value |
Definition at line 606 of file dlg_profile.c.
References calc_hash_profile(), dlg_profile_entry::content, dlg_profile_table::entries, dlg_profile_entry::first, get_lock(), dlg_profile_table::has_value, _str::len, dlg_profile_table::lock, dlg_profile_hash::next, NULL, release_lock(), _str::s, dlg_profile_table::size, and dlg_profile_hash::value.
Referenced by mi_get_profile(), and w_get_profile_size().
| int is_dlg_in_profile | ( | struct sip_msg * | msg, | |
| struct dlg_profile_table * | profile, | |||
| str * | value | |||
| ) |
Check if a dialog belongs to a profile.
| msg | SIP message | |
| profile | dialog profile table | |
| value | value |
Definition at line 564 of file dlg_profile.c.
References d_table, dlg_lock, dlg_unlock, dlg_table::entries, get_current_dialog(), dlg_cell::h_entry, dlg_profile_table::has_value, dlg_profile_link::hash_linker, _str::len, dlg_profile_link::next, NULL, dlg_profile_link::profile, dlg_cell::profile_links, _str::s, and dlg_profile_hash::value.
Referenced by w_is_in_profile().
| static void link_dlg_profile | ( | struct dlg_profile_link * | linker, | |
| struct dlg_cell * | dlg | |||
| ) | [static] |
Link a dialog profile.
Definition at line 371 of file dlg_profile.c.
References calc_hash_profile(), dlg_profile_entry::content, d_table, dlg_profile_hash::dlg, dlg_lock, dlg_unlock, dlg_profile_table::entries, dlg_table::entries, dlg_profile_entry::first, get_lock(), dlg_cell::h_entry, dlg_cell::h_id, dlg_profile_hash::hash, hash, dlg_profile_link::hash_linker, dlg_profile_table::lock, dlg_profile_hash::next, dlg_profile_link::next, dlg_profile_hash::prev, dlg_profile_link::profile, dlg_cell::profile_links, release_lock(), and dlg_profile_hash::value.
Referenced by set_current_dialog(), and set_dlg_profile().
Output a profile via MI interface.
| cmd_tree | MI command tree | |
| param | unused |
Definition at line 650 of file dlg_profile.c.
References add_mi_attr(), add_mi_node_child(), free_mi_tree(), get_profile_size(), init_mi_tree(), int2str(), mi_node::kids, _str::len, len, MI_BAD_PARM, MI_DUP_VALUE, MI_MISSING_PARM, MI_OK, MI_SSTR, dlg_profile_table::name, mi_node::next, mi_root::node, NULL, _str::s, search_dlg_profile(), dlg_profile_table::size, and mi_node::value.
List the profiles via MI interface.
| cmd_tree | MI command tree | |
| param | unused |
Definition at line 731 of file dlg_profile.c.
References dlg_profile_hash::dlg, dlg_profile_table::entries, dlg_profile_entry::first, free_mi_tree(), get_lock(), dlg_profile_table::has_value, init_mi_tree(), mi_node::kids, _str::len, dlg_profile_table::lock, MI_BAD_PARM, MI_MISSING_PARM, MI_OK, mi_print_dlg(), MI_SSTR, dlg_profile_hash::next, mi_node::next, mi_root::node, NULL, release_lock(), _str::s, search_dlg_profile(), dlg_profile_table::size, mi_node::value, and dlg_profile_hash::value.
| static struct dlg_profile_table * new_dlg_profile | ( | str * | name, | |
| unsigned int | size, | |||
| unsigned int | has_value | |||
| ) | [static, read] |
Creates a new dialog profile.
| name | profile name | |
| size | profile size | |
| has_value | set to 0 for a profile without value, otherwise it has a value |
Definition at line 157 of file dlg_profile.c.
References dlg_profile_table::has_value, _str::len, len, LM_ERR, dlg_profile_table::next, NULL, _str::s, search_dlg_profile(), shm_free, and shm_malloc().
Referenced by add_profile_definitions().
| int profile_cleanup | ( | struct sip_msg * | msg, | |
| void * | param | |||
| ) |
Cleanup a profile.
| msg | SIP message | |
| unused |
Definition at line 300 of file dlg_profile.c.
References current_dlg_msg_id, destroy_linkers(), NULL, and unref_dlg().
Referenced by dlg_new_dialog(), and mod_init().
| struct dlg_profile_table* search_dlg_profile | ( | str * | name | ) | [read] |
Search a dialog profile in the global list.
| name | searched dialog profile |
Definition at line 136 of file dlg_profile.c.
References _str::len, dlg_profile_table::name, dlg_profile_table::next, NULL, and _str::s.
Referenced by fixup_profile(), mi_get_profile(), mi_profile_list(), and new_dlg_profile().
Set the global variables to the current dialog.
Definition at line 419 of file dlg_profile.c.
References current_dlg_msg_id, destroy_linkers(), sip_msg::id, link_dlg_profile(), dlg_profile_link::next, and NULL.
Referenced by dlg_onroute().
| int set_dlg_profile | ( | struct sip_msg * | msg, | |
| str * | value, | |||
| struct dlg_profile_table * | profile | |||
| ) |
Set a dialog profile.
Set the dialog profile.
| msg | SIP message | |
| value | value | |
| profile | dialog profile table |
Definition at line 451 of file dlg_profile.c.
References get_current_dialog(), dlg_profile_table::has_value, dlg_profile_link::hash_linker, _str::len, link_dlg_profile(), LM_CRIT, LM_ERR, dlg_profile_link::next, NULL, dlg_profile_link::profile, REQUEST_ROUTE, route_type, _str::s, shm_malloc(), and dlg_profile_hash::value.
Referenced by w_set_dlg_profile().
| int unset_dlg_profile | ( | struct sip_msg * | msg, | |
| str * | value, | |||
| struct dlg_profile_table * | profile | |||
| ) |
Unset a dialog profile.
| msg | SIP message | |
| value | value | |
| profile | dialog profile table |
Definition at line 504 of file dlg_profile.c.
References d_table, destroy_linkers(), dlg_lock, dlg_unlock, dlg_table::entries, get_current_dialog(), dlg_cell::h_entry, dlg_profile_table::has_value, _str::len, LM_CRIT, dlg_profile_link::next, NULL, dlg_cell::profile_links, REQUEST_ROUTE, route_type, and _str::s.
Referenced by w_unset_dlg_profile().
unsigned int current_dlg_msg_id = 0 [static] |
global dialog message id
Definition at line 54 of file dlg_profile.c.
Referenced by get_current_dialog(), profile_cleanup(), and set_current_dialog().
| struct dlg_cell* current_dlg_pointer = NULL |
global dialog
Definition at line 57 of file dlg_profile.c.
Referenced by dlg_new_dialog(), dlg_onreq(), dlg_onroute(), and w_dlg_get().
struct dlg_profile_link* current_pending_linkers = NULL [static] |
pending dialog links
Definition at line 60 of file dlg_profile.c.
struct dlg_profile_table* profiles = NULL [static] |
Definition at line 63 of file dlg_profile.c.
1.5.6