dlg_profile.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Voice System SRL
00003  *
00004  * This file is part of Kamailio, a free SIP server.
00005  *
00006  * Kamailio 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  * Kamailio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License 
00017  * along with this program; if not, write to the Free Software 
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  * History:
00021  * --------
00022  * 2008-04-20  initial version (bogdan)
00023  *
00024  */
00025 
00026 
00027 
00028 #ifndef _DIALOG_DLG_PROFILE_H_
00029 #define _DIALOG_DLG_PROFILE_H_
00030 
00031 #include "../../parser/msg_parser.h"
00032 #include "../../lib/srutils/srjson.h"
00033 #include "../../locking.h"
00034 #include "../../str.h"
00035 #include "../../modules/tm/h_table.h"
00036 
00037 
00038 
00048 typedef struct dlg_profile_hash {
00049         str value; 
00050         struct dlg_cell *dlg; 
00051         struct dlg_profile_hash *next;
00052         struct dlg_profile_hash *prev;
00053         unsigned int hash; 
00054 } dlg_profile_hash_t;
00055 
00056 
00058 typedef struct dlg_profile_link {
00059         struct dlg_profile_hash hash_linker;
00060         struct dlg_profile_link  *next;
00061         struct dlg_profile_table *profile;
00062 } dlg_profile_link_t;
00063 
00064 
00066 typedef struct dlg_profile_entry {
00067         struct dlg_profile_hash *first;
00068         unsigned int content; 
00069 } dlg_profile_entry_t;
00070 
00071 
00073 typedef struct dlg_profile_table {
00074         str name; 
00075         unsigned int size; 
00076         unsigned int has_value; 
00077         gen_lock_t lock; 
00078         struct dlg_profile_entry *entries;
00079         struct dlg_profile_table *next;
00080 } dlg_profile_table_t;
00081 
00082 
00090 int add_profile_definitions( char* profiles, unsigned int has_value);
00091 
00092 
00096 void destroy_dlg_profiles(void);
00097 
00098 
00105 struct dlg_profile_table* search_dlg_profile(str *name);
00106 
00107 
00115 int profile_cleanup(sip_msg_t *msg, unsigned int flags, void *param );
00116 
00117 
00122 void destroy_linkers(dlg_profile_link_t *linker);
00123 
00124 
00130 void set_current_dialog(sip_msg_t *msg, struct dlg_cell *dlg);
00131 
00132 
00140 int set_dlg_profile(sip_msg_t *msg, str *value,
00141                 dlg_profile_table_t *profile);
00142 
00143 
00151 int unset_dlg_profile(sip_msg_t *msg, str *value,
00152                 dlg_profile_table_t *profile);
00153 
00154 
00162 int is_dlg_in_profile(sip_msg_t *msg, dlg_profile_table_t *profile,
00163                 str *value);
00164 
00165 
00172 unsigned int get_profile_size(dlg_profile_table_t *profile, str *value);
00173 
00174 
00181 struct mi_root * mi_get_profile(struct mi_root *cmd_tree, void *param );
00182 
00183 
00190 struct mi_root * mi_profile_list(struct mi_root *cmd_tree, void *param );
00191 
00195 int is_known_dlg(sip_msg_t *msg);
00196 
00204 int dlg_add_profile(dlg_cell_t *dlg, str *value, struct dlg_profile_table *profile);
00205 
00209 int dlg_profiles_to_json(dlg_cell_t *dlg, srjson_doc_t *jdoc);
00210 
00214 int dlg_json_to_profiles(dlg_cell_t *dlg, srjson_doc_t *jdoc);
00215 
00216 #endif