dlg_timer.c File Reference

Timer related functions for the dialog module

Module: dialog. More...

#include "../../mem/shm_mem.h"
#include "../../timer.h"
#include "dlg_timer.h"

Include dependency graph for dlg_timer.c:

Go to the source code of this file.

Functions

void destroy_dlg_timer (void)
 Destroy global dialog timer.
void dlg_timer_routine (unsigned int ticks, void *attr)
 Timer routine for expiration of dialogs Timer handler for expiration of dialogs, runs the global timer handler on them.
static struct dlg_tlget_expired_dlgs (unsigned int time)
 Helper function for dlg_timer_routine.
int init_dlg_timer (dlg_timer_handler hdl)
 Initialize the dialog timer handler Initialize the dialog timer handler, allocate the lock and a global timer in shared memory. The global timer handler will be set on success.
static void insert_dialog_timer_unsafe (struct dlg_tl *tl)
 Helper function for insert_dialog_timer.
int insert_dlg_timer (struct dlg_tl *tl, int interval)
 Insert a dialog timer to the list.
int remove_dialog_timer (struct dlg_tl *tl)
 Remove a dialog timer from the list.
static void remove_dialog_timer_unsafe (struct dlg_tl *tl)
 Helper function for remove_dialog_timer.
int update_dlg_timer (struct dlg_tl *tl, int timeout)
 Update a dialog timer on the list.

Variables

struct dlg_timerd_timer = 0
dlg_timer_handler timer_hdl = 0


Detailed Description

Timer related functions for the dialog module

Module: dialog.

Definition in file dlg_timer.c.


Function Documentation

void destroy_dlg_timer ( void   ) 

Destroy global dialog timer.

Definition at line 89 of file dlg_timer.c.

References dlg_timer::lock, and shm_free.

Referenced by mod_destroy().

void dlg_timer_routine ( unsigned int  ticks,
void *  attr 
)

Timer routine for expiration of dialogs Timer handler for expiration of dialogs, runs the global timer handler on them.

Parameters:
time for expiration checks
attr unused

Definition at line 275 of file dlg_timer.c.

References get_expired_dlgs(), LM_DBG, dlg_tl::next, NULL, and timer_hdl.

Referenced by mod_init().

static struct dlg_tl* get_expired_dlgs ( unsigned int  time  )  [static, read]

Helper function for dlg_timer_routine.

Parameters:
time time for expiration check
Returns:
list of expired dialogs on success, 0 on failure

Definition at line 226 of file dlg_timer.c.

References dlg_timer::first, LM_WARN, dlg_timer::lock, dlg_tl::next, dlg_tl::prev, and dlg_tl::timeout.

Referenced by dlg_timer_routine().

int init_dlg_timer ( dlg_timer_handler  hdl  ) 

Initialize the dialog timer handler Initialize the dialog timer handler, allocate the lock and a global timer in shared memory. The global timer handler will be set on success.

Parameters:
hdl dialog timer handler
Returns:
0 on success, -1 on failure

Definition at line 53 of file dlg_timer.c.

References dlg_timer::first, LM_ERR, dlg_timer::lock, dlg_tl::next, dlg_tl::prev, shm_free, shm_malloc(), and timer_hdl.

Referenced by mod_init().

static void insert_dialog_timer_unsafe ( struct dlg_tl tl  )  [inline, static]

Helper function for insert_dialog_timer.

See also:
insert_dialog_timer
Parameters:
tl dialog timer list

Definition at line 107 of file dlg_timer.c.

References dlg_timer::first, LM_DBG, dlg_tl::next, dlg_tl::prev, and dlg_tl::timeout.

Referenced by insert_dlg_timer(), and update_dlg_timer().

int insert_dlg_timer ( struct dlg_tl tl,
int  interval 
)

Insert a dialog timer to the list.

Parameters:
tl dialog timer list
interval timeout value in seconds
Returns:
0 on success, -1 when the input timer list is invalid

Definition at line 131 of file dlg_timer.c.

References get_ticks(), insert_dialog_timer_unsafe(), LM_CRIT, dlg_timer::lock, dlg_tl::next, dlg_tl::prev, and dlg_tl::timeout.

Referenced by dlg_onreply(), and load_dialog_info_from_db().

int remove_dialog_timer ( struct dlg_tl tl  ) 

Remove a dialog timer from the list.

Parameters:
tl dialog timer that should be removed
Returns:
1 when the input timer is empty, 0 when the timer was removed, -1 when the input timer list is invalid

Definition at line 168 of file dlg_timer.c.

References LM_CRIT, dlg_timer::lock, dlg_tl::next, NULL, dlg_tl::prev, remove_dialog_timer_unsafe(), and dlg_tl::timeout.

Referenced by bye_reply_cb(), destroy_dlg(), and dlg_onroute().

static void remove_dialog_timer_unsafe ( struct dlg_tl tl  )  [inline, static]

Helper function for remove_dialog_timer.

Parameters:
tl dialog timer list
See also:
remove_dialog_timer

Definition at line 155 of file dlg_timer.c.

References dlg_tl::next, and dlg_tl::prev.

Referenced by remove_dialog_timer(), and update_dlg_timer().

int update_dlg_timer ( struct dlg_tl tl,
int  timeout 
)

Update a dialog timer on the list.

Parameters:
tl dialog timer
timeout new timeout value in seconds
Returns:
0 on success, -1 when the input list is invalid
Note:
the update is implemented as a remove, insert

Definition at line 201 of file dlg_timer.c.

References get_ticks(), insert_dialog_timer_unsafe(), dlg_timer::lock, dlg_tl::next, dlg_tl::prev, remove_dialog_timer_unsafe(), and dlg_tl::timeout.

Referenced by dlg_onroute().


Variable Documentation

struct dlg_timer* d_timer = 0

global dialog timer

Definition at line 41 of file dlg_timer.c.

global dialog timer handler

Definition at line 43 of file dlg_timer.c.

Referenced by dlg_timer_routine(), and init_dlg_timer().


Generated on Tue May 22 16:00:38 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6