Data Structures | Defines | Typedefs | Functions | Variables

dlg_hash.h File Reference

Functions and definitions related to dialog creation and searchingModule: dialog :: Kamailio dialog module. More...

#include "../../locking.h"
#include "../../lib/kmi/mi.h"
#include "../../timer.h"
#include "dlg_timer.h"
#include "dlg_cb.h"
Include dependency graph for dlg_hash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

Defines

Typedefs

Functions

Variables


Detailed Description

Definition in file dlg_hash.h.


Define Documentation

#define dlg_lock (   _table,
  _entry 
)    lock_set_get( (_table)->locks, (_entry)->lock_idx);
Parameters:
_table dialog table
_entry locked entry

Definition at line 176 of file dlg_hash.h.

Referenced by dlg_lookup(), dlg_ref(), dlg_unref(), internal_get_dlg(), internal_mi_print_dlgs(), is_dlg_in_profile(), link_dlg(), link_dlg_profile(), next_state_dlg(), and unset_dlg_profile().

#define dlg_unlock (   _table,
  _entry 
)    lock_set_release( (_table)->locks, (_entry)->lock_idx);
Parameters:
_table dialog table
_entry locked entry

Definition at line 185 of file dlg_hash.h.

Referenced by dlg_lookup(), dlg_ref(), dlg_unref(), internal_get_dlg(), internal_mi_print_dlgs(), is_dlg_in_profile(), link_dlg(), link_dlg_profile(), next_state_dlg(), and unset_dlg_profile().


Function Documentation

dlg_cell_t* build_new_dlg ( str callid,
str from_uri,
str to_uri,
str from_tag,
str req_uri 
) [read]
Parameters:
callid dialog callid
from_uri dialog from uri
to_uri dialog to uri
from_tag dialog from tag
req_uri dialog r-uri
Returns:
created dialog structure on success, NULL otherwise

Definition at line 419 of file dlg_hash.c.

References dlg_cell::from_uri, dlg_cell::req_uri, _str::s, dlg_table::size, and dlg_cell::to_uri.

Referenced by dlg_new_dialog().

Here is the caller graph for this function:

void destroy_dlg ( struct dlg_cell dlg  )  [inline]
Parameters:
dlg destroyed dialog

Definition at line 310 of file dlg_hash.c.

References dlg_cell::callid, dlg_cell::cbs, dlg_cell::cseq, destroy_linkers(), DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_NONE, dlg_cell::h_entry, dlg_cell::h_id, _str::len, dlg_cell::profile_links, dlg_cell::ref, remove_dialog_timer(), _str::s, dlg_cell::tag, dlg_cell::tl, dlg_cell::toroute_name, and dlg_cell::vars.

Referenced by destroy_dlg_table().

Here is the call graph for this function:

Here is the caller graph for this function:

dlg_cell_t* dlg_get_by_iuid ( dlg_iuid_t diuid  ) 

Note that the caller is responsible for decrementing (or reusing) the reference counter by one again if a dialog has been found.

Parameters:
diuid internal unique id per dialog
Returns:
dialog structure on success, NULL on failure

Search and return dialog in the global list by iuid.

Note that the caller is responsible for decrementing (or reusing) the reference counter by one again if a dialog has been found.

Parameters:
diuid internal unique id per dialog
Returns:
dialog structure on success, NULL on failure

Definition at line 610 of file dlg_hash.c.

References dlg_lookup(), dlg_iuid::h_entry, and dlg_iuid::h_id.

Referenced by dlg_ka_run(), dlg_onreply(), dlg_ontdestroy(), dlg_seq_onreply_helper(), dlg_terminated_confirmed(), and unref_dlg_from_cb().

Here is the call graph for this function:

Here is the caller graph for this function:

int dlg_ka_add ( dlg_cell_t dlg  ) 

Definition at line 129 of file dlg_hash.c.

References DLG_IFLAG_KA_SRC, dlg_cell::h_entry, dlg_cell::h_id, and dlg_cell::iflags.

Referenced by dlg_onroute().

Here is the caller graph for this function:

int dlg_ka_run ( ticks_t  ti  ) 

Definition at line 164 of file dlg_hash.c.

References DLG_CALLEE_LEG, DLG_CALLER_LEG, dlg_get_by_iuid(), DLG_IFLAG_KA_DST, DLG_IFLAG_KA_SRC, and dlg_release().

Here is the call graph for this function:

dlg_cell_t* dlg_lookup ( unsigned int  h_entry,
unsigned int  h_id 
)

Note that the caller is responsible for decrementing (or reusing) the reference counter by one again if a dialog has been found.

Parameters:
h_entry number of the hash table entry
h_id id of the hash table entry
Returns:
dialog structure on success, NULL on failure

Note that the caller is responsible for decrementing (or reusing) the reference counter by one again iff a dialog has been found.

Parameters:
h_entry number of the hash table entry
h_id id of the hash table entry
Returns:
dialog structure on success, NULL on failure

Definition at line 571 of file dlg_hash.c.

References dlg_lock, dlg_unlock, dlg_table::entries, dlg_entry::first, dlg_cell::h_id, dlg_cell::next, ref_dlg_unsafe, and dlg_table::size.

Referenced by dlg_get_by_iuid(), and dlg_onroute().

Here is the caller graph for this function:

void dlg_ref ( dlg_cell_t dlg,
unsigned int  cnt 
)
See also:
ref_dlg_unsafe
Parameters:
dlg dialog
cnt increment for the reference counter

Definition at line 728 of file dlg_hash.c.

References dlg_lock, dlg_unlock, dlg_table::entries, dlg_cell::h_entry, and ref_dlg_unsafe.

Referenced by dlg_new_dialog(), dlg_onreply(), dlg_onroute(), dlg_ontimeout(), dlg_run_event_route(), and dlg_set_tm_waitack().

Here is the caller graph for this function:

void dlg_release ( dlg_cell_t dlg  ) 
See also:
dlg_unref
Parameters:
dlg dialog

Definition at line 763 of file dlg_hash.c.

References dlg_unref().

Referenced by dlg_ka_run(), dlg_new_dialog(), dlg_onreply(), dlg_onreq(), dlg_onroute(), dlg_seq_onreply_helper(), dlg_terminated_confirmed(), is_dlg_in_profile(), is_known_dlg(), set_dlg_profile(), and unset_dlg_profile().

Here is the call graph for this function:

Here is the caller graph for this function:

void dlg_run_event_route ( dlg_cell_t dlg,
sip_msg_t msg,
int  ostate,
int  nstate 
)

Definition at line 1437 of file dlg_handlers.c.

References dlg_ref(), DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, DLG_STATE_EARLY, DLG_STATE_UNCONFIRMED, and dlg_unref().

Referenced by dlg_onreply(), dlg_onroute(), and dlg_ontimeout().

Here is the call graph for this function:

Here is the caller graph for this function:

int dlg_set_leg_info ( struct dlg_cell dlg,
str tag,
str rr,
str contact,
str cseq,
unsigned int  leg 
)
Parameters:
dlg dialog
tag from tag or to tag
rr record-routing information
contact caller or callee contact
cseq CSEQ of caller or callee
leg must be either DLG_CALLER_LEG, or DLG_CALLEE_LEG
Returns:
0 on success, -1 on failure

Definition at line 482 of file dlg_hash.c.

References dlg_cell::contact, dlg_cell::cseq, _str::len, dlg_cell::route_set, _str::s, and dlg_cell::tag.

Referenced by populate_leg_info().

Here is the caller graph for this function:

int dlg_set_toroute ( dlg_cell_t dlg,
str route 
)
Parameters:
dlg dialog
route name of route
Returns:
0 on success, -1 on failure

Definition at line 946 of file dlg_hash.c.

References _str::len, _str::s, dlg_cell::toroute, and dlg_cell::toroute_name.

Referenced by dlg_new_dialog().

Here is the caller graph for this function:

void dlg_unref ( dlg_cell_t dlg,
unsigned int  cnt 
)
See also:
unref_dlg_unsafe
Parameters:
dlg dialog
cnt decrement for the reference counter

Definition at line 746 of file dlg_hash.c.

References dlg_lock, dlg_unlock, dlg_table::entries, dlg_cell::h_entry, and unref_dlg_unsafe.

Referenced by dlg_new_dialog(), dlg_onreply(), dlg_onroute(), dlg_ontdestroy(), dlg_ontimeout(), dlg_release(), dlg_run_event_route(), dlg_set_tm_waitack(), profile_cleanup(), and unref_dlg_from_cb().

Here is the caller graph for this function:

int dlg_update_cseq ( struct dlg_cell dlg,
unsigned int  leg,
str cseq 
)
Parameters:
dlg dialog
leg must be either DLG_CALLER_LEG, or DLG_CALLEE_LEG
cseq CSEQ of caller or callee
Returns:
0 on success, -1 on failure

Definition at line 536 of file dlg_hash.c.

References dlg_cell::cseq, _str::len, and _str::s.

Referenced by update_cseqs().

Here is the caller graph for this function:

dlg_cell_t* get_dlg ( str callid,
str ftag,
str ttag,
unsigned int *  dir 
) [read]

Get dialog that correspond to CallId, From Tag and To Tag. See RFC 3261, paragraph 4. Overview of Operation: "The combination of the To tag, From tag, and Call-ID completely defines a peer-to-peer SIP relationship between [two UAs] and is referred to as a dialog." Note that the caller is responsible for decrementing (or reusing) the reference counter by one again iff a dialog has been found.

Parameters:
callid callid
ftag from tag
ttag to tag
dir direction
Returns:
dialog structure on success, NULL on failure

Definition at line 674 of file dlg_hash.c.

References internal_get_dlg(), _str::len, _str::s, and dlg_table::size.

Referenced by dlg_get_msg_dialog(), dlg_new_dialog(), and dlg_onroute().

Here is the call graph for this function:

Here is the caller graph for this function:

int init_dlg_table ( unsigned int  size  ) 
Parameters:
size size of the table
Returns:
0 on success, -1 on failure

Definition at line 230 of file dlg_hash.c.

References dlg_table::entries, dlg_entry::lock_idx, dlg_table::locks, dlg_table::locks_no, dlg_entry::next_id, and dlg_table::size.

void link_dlg ( struct dlg_cell dlg,
int  n 
)
Parameters:
dlg dialog
n extra increments for the reference counter

Definition at line 695 of file dlg_hash.c.

References dlg_lock, dlg_unlock, dlg_table::entries, dlg_entry::first, dlg_cell::h_entry, dlg_cell::h_id, dlg_entry::last, dlg_cell::next, dlg_entry::next_id, dlg_cell::prev, and ref_dlg_unsafe.

Referenced by dlg_new_dialog().

Here is the caller graph for this function:

static int match_dialog ( dlg_cell_t dlg,
str callid,
str ftag,
str ttag,
unsigned int *  dir 
) [inline, static]
Parameters:
dlg dialog structure
callid SIP message Call-ID
ftag SIP message from tag
ttag SIP message to tag
dir direction of the message, if DLG_DIR_NONE it will set
Returns:
1 if dialog structure and message content matches, 0 otherwise

Definition at line 402 of file dlg_hash.h.

References dlg_cell::callid, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_DIR_DOWNSTREAM, DLG_DIR_UPSTREAM, DLG_STATE_CONFIRMED_NA, _str::len, _str::s, dlg_cell::state, and dlg_cell::tag.

Referenced by dlg_onroute(), and internal_get_dlg().

Here is the caller graph for this function:

static int match_downstream_dialog ( dlg_cell_t dlg,
str callid,
str ftag 
) [inline, static]
Parameters:
dlg dialog structure
callid SIP message callid
ftag SIP message from tag
Returns:
1 if dialog structure matches the SIP dialog, 0 otherwise

Definition at line 502 of file dlg_hash.h.

References dlg_cell::callid, DLG_CALLER_LEG, _str::len, _str::s, and dlg_cell::tag.

int mi_print_dlg ( struct mi_node *  rpl,
struct dlg_cell dlg,
int  with_context 
)
Parameters:
rpl MI node that should be filled
dlg printed dialog
with_context if 1 then the dialog context will be also printed
Returns:
0 on success, -1 on failure

Definition at line 1121 of file dlg_hash.c.

References internal_mi_print_dlg().

Referenced by mi_profile_list().

Here is the call graph for this function:

Here is the caller graph for this function:

struct mi_root* mi_print_dlgs ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree MI root node
param unused
Returns:
a mi node with the dialog information, or NULL on failure
Parameters:
cmd_tree MI command tree
param unused
Returns:
mi node with the dialog information, or NULL on failure

Definition at line 1218 of file dlg_hash.c.

References internal_mi_print_dlg(), and internal_mi_print_dlgs().

Here is the call graph for this function:

struct mi_root* mi_print_dlgs_ctx ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree MI command tree
param unused
Returns:
mi node with the dialog information, or NULL on failure

Definition at line 1255 of file dlg_hash.c.

References internal_mi_print_dlg(), and internal_mi_print_dlgs().

Here is the call graph for this function:

struct mi_root* mi_terminate_dlgs ( struct mi_root *  cmd_tree,
void *  param 
) [read]
Parameters:
cmd_tree MI command tree
param unused
Returns:
mi node with the dialog information, or NULL on failure

Terminate selected dialogs via the MI interface.

Parameters:
cmd_tree MI command tree
param unused
Returns:
mi node with the dialog information, or NULL on failure

Definition at line 1291 of file dlg_hash.c.

void next_state_dlg ( dlg_cell_t dlg,
int  event,
int *  old_state,
int *  new_state,
int *  unref 
)

This functions implement the main state machine that update a dialog state according a processed event and the current state. If necessary it will delete the processed dialog. The old and new state are also saved for reference.

Parameters:
dlg updated dialog
event current event
old_state old dialog state
new_state new dialog state
unref set to 1 when the dialog was deleted, 0 otherwise

Definition at line 799 of file dlg_hash.c.

References dlg_cell::callid, dlg_cell::dflags, DLG_CALLEE_LEG, DLG_CALLER_LEG, DLG_EVENT_REQ, DLG_EVENT_REQACK, DLG_EVENT_REQBYE, DLG_EVENT_REQPRACK, DLG_EVENT_RPL1xx, DLG_EVENT_RPL2xx, DLG_EVENT_RPL3xx, DLG_EVENT_TDEL, DLG_FLAG_HASBYE, dlg_lock, DLG_STATE_CONFIRMED, DLG_STATE_CONFIRMED_NA, DLG_STATE_DELETED, DLG_STATE_EARLY, DLG_STATE_UNCONFIRMED, dlg_unlock, dlg_table::entries, dlg_cell::h_entry, dlg_cell::h_id, _str::len, log_next_state_dlg(), dlg_cell::ref, ref_dlg_unsafe, _str::s, dlg_cell::state, dlg_cell::tag, and unref_dlg_unsafe.

Referenced by dlg_onreply(), dlg_onroute(), and dlg_ontimeout().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unlink_unsafe_dlg ( dlg_entry_t d_entry,
dlg_cell_t dlg 
) [inline, static]
See also:
unref_dlg_unsafe
Parameters:
d_entry unlinked entry
dlg unlinked dialog

Definition at line 194 of file dlg_hash.h.

References dlg_entry::first, dlg_entry::last, dlg_cell::next, and dlg_cell::prev.