Defines | Functions | Variables

dlg_profile.c File Reference

Profile related functions for the dialog moduleModule: dialog :: Kamailio dialog module. More...

#include "../../mem/shm_mem.h"
#include "../../hashes.h"
#include "../../trim.h"
#include "../../dprint.h"
#include "../../ut.h"
#include "../../route.h"
#include "../../modules/tm/tm_load.h"
#include "dlg_hash.h"
#include "dlg_var.h"
#include "dlg_handlers.h"
#include "dlg_profile.h"
Include dependency graph for dlg_profile.c:

Go to the source code of this file.

Defines

Functions

Variables


Detailed Description

Definition in file dlg_profile.c.


Function Documentation

int add_profile_definitions ( char *  profiles,
unsigned int  has_value 
)
See also:
new_dlg_profile
Parameters:
profiles profile name
has_value set to 0 for a profile without value, otherwise it has a value
Returns:
0 on success, -1 on failure

Definition at line 77 of file dlg_profile.c.

References _str::len, new_dlg_profile(), PROFILE_HASH_SIZE, and _str::s.

Here is the call graph for this function:

static unsigned int calc_hash_profile ( str value,
dlg_cell_t dlg,
dlg_profile_table_t profile 
) [inline, static]
See also:
core_hash
Parameters:
value hash source
dlg dialog cell
profile dialog profile table (for hash size)
Returns:
value hash if the value has a value, hash over dialog otherwise

Definition at line 335 of file dlg_profile.c.

References dlg_profile_table::has_value, and dlg_profile_table::size.

Referenced by get_profile_size(), and link_dlg_profile().

Here is the caller graph for this function:

static void destroy_dlg_profile ( struct dlg_profile_table profile  )  [static]
Parameters:
profile dialog profile

Definition at line 230 of file dlg_profile.c.

Referenced by destroy_dlg_profiles().

Here is the caller graph for this function:

void destroy_linkers ( struct dlg_profile_link linker  ) 
Parameters:
linker dialog linker

Definition at line 261 of file dlg_profile.c.

References dlg_profile_entry::content, dlg_profile_table::entries, and dlg_profile_hash::hash.

Referenced by destroy_dlg(), profile_cleanup(), set_current_dialog(), set_dlg_profile(), and unset_dlg_profile().

Here is the caller graph for this function:

int dlg_add_profile ( dlg_cell_t dlg,
str value,
struct dlg_profile_table profile 
)
Parameters:
dlg dialog
value value
profile dialog profile table
Returns:
0 on success, -1 on failure

Definition at line 496 of file dlg_profile.c.

References dlg_profile_table::has_value, _str::len, link_dlg_profile(), _str::s, and dlg_profile_hash::value.

Referenced by dlg_json_to_profiles().

Here is the call graph for this function:

Here is the caller graph for this function:

int dlg_json_to_profiles ( dlg_cell_t dlg,
srjson_doc_t *  jdoc 
)

Deserialize dialog profiles to json.

Definition at line 956 of file dlg_profile.c.

References dlg_add_profile(), dlg_profile_table::has_value, _str::len, _str::s, and search_dlg_profile().

Here is the call graph for this function:

int dlg_profiles_to_json ( dlg_cell_t dlg,
srjson_doc_t *  jdoc 
)
unsigned int get_profile_size ( struct dlg_profile_table profile,
str value 
)
Parameters:
profile evaluated profile
value value
Returns:
the profile size

Definition at line 648 of file dlg_profile.c.

References calc_hash_profile(), dlg_profile_entry::content, dlg_profile_table::entries, dlg_profile_table::has_value, _str::len, _str::s, dlg_profile_table::size, and dlg_profile_hash::value.

Referenced by mi_get_profile().

Here is the call graph for this function:

Here is the caller graph for this function:

int is_dlg_in_profile ( struct sip_msg msg,
struct dlg_profile_table profile,
str value 
)
Parameters:
msg SIP message
profile dialog profile table
value value
Returns:
1 on success, -1 on failure

Definition at line 603 of file dlg_profile.c.

References d_table, dlg_get_msg_dialog(), dlg_lock, dlg_release(), dlg_unlock, dlg_table::entries, dlg_cell::h_entry, dlg_profile_table::has_value, _str::len, dlg_cell::profile_links, _str::s, and dlg_profile_hash::value.

Here is the call graph for this function:

static void link_dlg_profile ( struct dlg_profile_link linker,
struct dlg_cell dlg 
) [static]
Parameters:
linker dialog linker
dlg dialog cell

Definition at line 353 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_cell::h_entry, dlg_cell::h_id, dlg_profile_hash::hash, dlg_cell::profile_links, and dlg_profile_hash::value.

Referenced by dlg_add_profile(), set_current_dialog(), and set_dlg_profile().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mi_root* mi_get_profile ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree MI command tree
param unused
Returns:
MI root output on success, NULL on failure

Definition at line 708 of file dlg_profile.c.

References get_profile_size(), int2str(), _str::len, dlg_profile_table::name, _str::s, search_dlg_profile(), and dlg_profile_table::size.

Here is the call graph for this function:

struct mi_root* mi_profile_list ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree MI command tree
param unused
Returns:
MI root output on success, NULL on failure

Definition at line 789 of file dlg_profile.c.

References dlg_profile_hash::dlg, dlg_profile_table::entries, dlg_profile_table::has_value, _str::len, mi_print_dlg(), _str::s, search_dlg_profile(), dlg_profile_table::size, and dlg_profile_hash::value.

Here is the call graph for this function:

static struct dlg_profile_table * new_dlg_profile ( str name,
unsigned int  size,
unsigned int  has_value 
) [static, read]
See also:
add_profile_definitions
Parameters:
name profile name
size profile size
has_value set to 0 for a profile without value, otherwise it has a value
Returns:
pointer to the created dialog on success, NULL otherwise

Definition at line 157 of file dlg_profile.c.

References dlg_profile_table::has_value, _str::len, _str::s, and search_dlg_profile().

Referenced by add_profile_definitions().

Here is the call graph for this function:

Here is the caller graph for this function:

int profile_cleanup ( struct sip_msg msg,
unsigned int  flags,
void *  param 
)
Parameters:
msg SIP message
flags unused
param unused
Returns:
1

Definition at line 301 of file dlg_profile.c.

References current_dlg_msg_id, destroy_linkers(), dlg_cell::dflags, dlg_profile_hash::dlg, DLG_FLAG_TM, and dlg_unref().

Here is the call graph for this function:

struct dlg_profile_table* search_dlg_profile ( str name  )  [read]
Note:
Linear search, this won't have the best performance for huge profile lists
Parameters:
name searched dialog profile
Returns:
pointer to the profile on success, NULL otherwise

Definition at line 136 of file dlg_profile.c.

References _str::len, dlg_profile_table::name, and _str::s.

Referenced by dlg_json_to_profiles(), mi_get_profile(), mi_profile_list(), and new_dlg_profile().

Here is the caller graph for this function:

void set_current_dialog ( sip_msg_t msg,
dlg_cell_t dlg 
)
Parameters:
msg SIP message
dlg dialog cell

Definition at line 401 of file dlg_profile.c.

References current_dlg_msg_id, destroy_linkers(), dlg_cell::h_entry, dlg_cell::h_id, sip_msg::id, link_dlg_profile(), and sip_msg::pid.

Referenced by dlg_new_dialog(), and dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

int set_dlg_profile ( struct sip_msg msg,
str value,
struct dlg_profile_table profile 
)

Set the dialog profile.

Parameters:
msg SIP message
value value
profile dialog profile table
Returns:
0 on success, -1 on failure

Definition at line 434 of file dlg_profile.c.

References current_dlg_msg_id, destroy_linkers(), dlg_get_msg_dialog(), dlg_release(), dlg_profile_table::has_value, sip_msg::id, _str::len, link_dlg_profile(), sip_msg::pid, _str::s, and dlg_profile_hash::value.

Here is the call graph for this function:

int unset_dlg_profile ( sip_msg_t msg,
str value,
dlg_profile_table_t profile 
)
Parameters:
msg SIP message
value value
profile dialog profile table
Returns:
1 on success, -1 on failure

Definition at line 536 of file dlg_profile.c.

References d_table, destroy_linkers(), dlg_get_msg_dialog(), dlg_lock, dlg_release(), dlg_unlock, dlg_table::entries, dlg_cell::h_entry, dlg_profile_table::has_value, _str::len, dlg_cell::profile_links, and _str::s.

Here is the call graph for this function: