dlg_mod.h

00001 /* 
00002  * Copyright (C) 2005 iptelorg GmbH
00003  *
00004  * This file is part of ser, a free SIP server.
00005  *
00006  * ser is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version
00010  *
00011  * For a license to use the ser software under conditions
00012  * other than those described here, or to purchase support for this
00013  * software, please contact iptel.org by e-mail at the following addresses:
00014  *    info@iptel.org
00015  *
00016  * ser is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  */
00025 
00026 #ifndef __DLG_MOD_H
00027 #define __DLG_MOD_H
00028 
00029 #include "../../modules/tm/dlg.h"
00030 #include "../../lib/srdb2/db.h"
00031 #include "../../modules/tm/t_hooks.h"
00032 #include <cds/serialize.h>
00033 
00034 /* Prototype of function for storing dialog into database.
00035  * This function computes ID of newly added row and returns
00036  * it in dst_id (if set). Function returns 0 if OK, nonzero
00037  * on error.
00038  */
00039 /*typedef int (*db_store_dlg_f)(db_con_t* conn, dlg_t *dlg, str *dst_id);
00040 typedef int (*db_load_dlg_f)(db_con_t* conn, str *id, dlg_t **dst_dlg);*/
00041 typedef int (*serialize_dlg_f)(sstream_t *ss, dlg_t *dlg);
00042 typedef int (*dlg2str_f)(dlg_t *dlg, str *dst_str);
00043 typedef int (*str2dlg_f)(const str *s, dlg_t *dst_dlg);
00044 typedef int (*preset_dialog_route_f)(dlg_t* dialog, str *route);
00045 typedef int (*request_outside_f)(str* method, str* headers, str* body, dlg_t* dialog, transaction_cb cb, void* cbp);
00046 typedef int (*request_inside_f)(str* method, str* headers, str* body, dlg_t* dialog, transaction_cb cb, void* cbp);
00047 typedef int (*cmp_dlg_ids_f)(dlg_id_t *a, dlg_id_t *b);
00048 typedef unsigned int (*hash_dlg_id_f)(dlg_id_t *id);
00049 
00050 typedef struct {
00051         /* dialog creation/destruction functions */
00052         
00053         
00054         /* db_store_dlg_f db_store;
00055         db_load_dlg_f db_load;*/
00056         
00057         /* utility functions */
00058         serialize_dlg_f serialize;
00059         dlg2str_f dlg2str;
00060         str2dlg_f str2dlg;
00061         hash_dlg_id_f hash_dlg_id;
00062         cmp_dlg_ids_f cmp_dlg_ids;
00063 
00064         /* dialog functions */
00065         preset_dialog_route_f preset_dialog_route;
00066         request_outside_f request_outside;
00067         request_inside_f request_inside;
00068         
00069 } dlg_func_t;
00070 
00071 typedef int (*bind_dlg_mod_f)(dlg_func_t *dst);
00072 
00073 #endif