script_cb.c File Reference

Script callbacks functions. More...

#include <stdlib.h>
#include "script_cb.h"
#include "dprint.h"
#include "error.h"
#include "mem/mem.h"

Include dependency graph for script_cb.c:

Go to the source code of this file.

Functions

static int add_callback (struct script_cb **list, cb_function f, void *param)
 Add a callback to the list.
static void destroy_cb_list (struct script_cb **list)
 Destroy callback list, free memory.
void destroy_script_cb (void)
 Destroy all callbacks.
static int exec_post_cb (struct sip_msg *msg, struct script_cb *cb)
 Execute post-script callbacks, don't stop on error.
int exec_post_req_cb (struct sip_msg *msg)
 Execute post-request callbacks.
int exec_post_rpl_cb (struct sip_msg *msg)
 Execute post-reply callbacks.
static int exec_pre_cb (struct sip_msg *msg, struct script_cb *cb)
 Execute pre-script callbacks, stop on error.
int exec_pre_req_cb (struct sip_msg *msg)
 Execute pre-request callbacks.
int exec_pre_rpl_cb (struct sip_msg *msg)
 Execute pre-reply callbacks.
int register_script_cb (cb_function f, int type, void *param)
 Register a script callback function.

Variables

static unsigned int cb_id = 0
static struct script_cbpost_req_cb = 0
static struct script_cbpost_rpl_cb = 0
static struct script_cbpre_req_cb = 0
static struct script_cbpre_rpl_cb = 0


Detailed Description

Script callbacks functions.

Definition in file script_cb.c.


Function Documentation

static int add_callback ( struct script_cb **  list,
cb_function  f,
void *  param 
) [inline, static]

Add a callback to the list.

Parameters:
list list of callbacks
f 
param 
Returns:
0 on success, -1 on error

Definition at line 62 of file script_cb.c.

References cb_id, script_cb::cbf, script_cb::id, LM_ERR, script_cb::next, script_cb::param, and pkg_malloc.

Referenced by register_script_cb().

static void destroy_cb_list ( struct script_cb **  list  )  [inline, static]

Destroy callback list, free memory.

Parameters:
list callback list

Definition at line 134 of file script_cb.c.

References script_cb::next, and pkg_free.

Referenced by destroy_script_cb().

void destroy_script_cb ( void   ) 

Destroy all callbacks.

Definition at line 149 of file script_cb.c.

References destroy_cb_list().

Referenced by cleanup().

static int exec_post_cb ( struct sip_msg msg,
struct script_cb cb 
) [inline, static]

Execute post-script callbacks, don't stop on error.

Parameters:
msg SIP message
cb callback list
Returns:
1

Definition at line 181 of file script_cb.c.

References script_cb::cbf, script_cb::next, and script_cb::param.

Referenced by exec_post_req_cb(), and exec_post_rpl_cb().

int exec_post_req_cb ( struct sip_msg msg  ) 

Execute post-request callbacks.

Parameters:
msg SIP message
Returns:
1

Definition at line 217 of file script_cb.c.

References exec_post_cb().

Referenced by dlg_ontimeout(), and receive_msg().

int exec_post_rpl_cb ( struct sip_msg msg  ) 

Execute post-reply callbacks.

Parameters:
msg SIP message
Returns:
1

Definition at line 228 of file script_cb.c.

References exec_post_cb().

Referenced by receive_msg().

static int exec_pre_cb ( struct sip_msg msg,
struct script_cb cb 
) [inline, static]

Execute pre-script callbacks, stop on error.

Parameters:
msg SIP message
cb callback list
Returns:
1 on success, 0 on error

Definition at line 164 of file script_cb.c.

References script_cb::cbf, script_cb::next, and script_cb::param.

Referenced by exec_pre_req_cb(), and exec_pre_rpl_cb().

int exec_pre_req_cb ( struct sip_msg msg  ) 

Execute pre-request callbacks.

Parameters:
msg SIP message
Returns:
1 on success, 0 on error

Definition at line 195 of file script_cb.c.

References exec_pre_cb().

Referenced by dlg_ontimeout(), and receive_msg().

int exec_pre_rpl_cb ( struct sip_msg msg  ) 

Execute pre-reply callbacks.

Parameters:
msg SIP message
Returns:
1 on success, 0 on error

Definition at line 206 of file script_cb.c.

References exec_pre_cb().

Referenced by receive_msg().

int register_script_cb ( cb_function  f,
int  type,
void *  param 
)

Register a script callback function.

Parameters:
f callback function
type callback type
param callback parameter
Returns:
0 on success, -1 on error

Definition at line 89 of file script_cb.c.

References add_callback(), LM_CRIT, LM_ERR, POST_SCRIPT_CB, PRE_SCRIPT_CB, REQ_TYPE_CB, and RPL_TYPE_CB.

Referenced by mod_init().


Variable Documentation

unsigned int cb_id = 0 [static]

global callback id counter

Definition at line 52 of file script_cb.c.

Referenced by add_callback().

struct script_cb* post_req_cb = 0 [static]

list of post-request callbacks

Definition at line 44 of file script_cb.c.

struct script_cb* post_rpl_cb = 0 [static]

list of post-reply callbacks

Definition at line 49 of file script_cb.c.

struct script_cb* pre_req_cb = 0 [static]

list of pre-request callbacks

Definition at line 42 of file script_cb.c.

struct script_cb* pre_rpl_cb = 0 [static]

list of pre-reply callbacks

Definition at line 47 of file script_cb.c.


Generated on Thu May 24 12:00:42 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6