dlg_cb.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dlg_cb.h 4518 2008-07-28 15:39:28Z henningw $
00003  *
00004  * Copyright (C) 2006 Voice Sistem SRLs
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  * History:
00023  * --------
00024  * 2006-04-11  initial version (bogdan)
00025  * 2008-04-04  added direction reporting in dlg callbacks (bogdan)
00026  * 2008-04-14  added new type of callback to be triggered when dialogs are 
00027  *              loaded from DB (bogdan)
00028  * 2008-04-17  added new type of callback to be triggered right before the
00029  *              dialog is destroyed (deleted from memory) (bogdan)
00030  */
00031 
00032 #ifndef _DIALOG_DLG_CB_H_
00033 #define _DIALOG_DLG_CB_H_
00034 
00035 #include "../../parser/msg_parser.h"
00036 
00037 struct dlg_cell;
00038 
00039 struct dlg_cb_params {
00040    struct sip_msg* msg;       /* sip msg related to the callback event */
00041    unsigned int direction;    /* direction of the sip msg */
00042    void *dlg_data;            /* generic paramter, specific to callback */
00043    void **param;              /* parameter passed at callback registration*/
00044 };
00045 
00046 /* callback function prototype */
00047 typedef void (dialog_cb) (struct dlg_cell* dlg, int type, 
00048       struct dlg_cb_params * params);
00049 /* function to free the callback param */
00050 typedef void (param_free_cb) (void *param);
00051 /* register callback function prototype */
00052 typedef int (*register_dlgcb_f)(struct dlg_cell* dlg, int cb_types,
00053       dialog_cb f, void *param, param_free_cb ff);
00054 
00055 
00056 #define DLGCB_LOADED          (1<<0)
00057 #define DLGCB_CREATED         (1<<1)
00058 #define DLGCB_FAILED          (1<<2)
00059 #define DLGCB_CONFIRMED       (1<<3)
00060 #define DLGCB_REQ_WITHIN      (1<<4)
00061 #define DLGCB_TERMINATED      (1<<5)
00062 #define DLGCB_EXPIRED         (1<<6)
00063 #define DLGCB_EARLY           (1<<7)
00064 #define DLGCB_RESPONSE_FWDED  (1<<8)
00065 #define DLGCB_RESPONSE_WITHIN (1<<9)
00066 #define DLGCB_MI_CONTEXT      (1<<10)
00067 #define DLGCB_DESTROY         (1<<11)
00068 
00069 struct dlg_callback {
00070    int types;
00071    dialog_cb* callback;
00072    void *param;
00073    param_free_cb* callback_param_free;
00074    struct dlg_callback* next;
00075 };
00076 
00077 
00078 struct dlg_head_cbl {
00079    struct dlg_callback *first;
00080    int types;
00081 };
00082 
00083 
00084 void destroy_dlg_callbacks(unsigned int type);
00085 
00086 void destroy_dlg_callbacks_list(struct dlg_callback *cb);
00087 
00088 int register_dlgcb( struct dlg_cell* dlg, int types, dialog_cb f, void *param, param_free_cb ff);
00089 
00090 void run_create_callbacks(struct dlg_cell *dlg, struct sip_msg *msg);
00091 
00092 void run_dlg_callbacks( int type , struct dlg_cell *dlg, struct sip_msg *msg,
00093       unsigned int dir, void *dlg_data);
00094 
00095 void run_load_callbacks( void );
00096 
00097 
00098 #endif

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