dlg_state.h

Go to the documentation of this file.
00001 /*
00002  * $Id: dlg_state.h 552 2008-04-17 17:30:10Z vingarzan $
00003  *  
00004  * Copyright (C) 2004-2006 FhG Fokus
00005  *
00006  * This file is part of Open IMS Core - an open source IMS CSCFs & HSS
00007  * implementation
00008  *
00009  * Open IMS Core is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * For a license to use the Open IMS Core software under conditions
00015  * other than those described here, or to purchase support for this
00016  * software, please contact Fraunhofer FOKUS by e-mail at the following
00017  * addresses:
00018  *     info@open-ims.org
00019  *
00020  * Open IMS Core is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  * 
00025  * It has to be noted that this Open Source IMS Core System is not 
00026  * intended to become or act as a product in a commercial context! Its 
00027  * sole purpose is to provide an IMS core reference implementation for 
00028  * IMS technology testing and IMS application prototyping for research 
00029  * purposes, typically performed in IMS test-beds.
00030  * 
00031  * Users of the Open Source IMS Core System have to be aware that IMS
00032  * technology may be subject of patents and licence terms, as being 
00033  * specified within the various IMS-related IETF, ITU-T, ETSI, and 3GPP
00034  * standards. Thus all Open IMS Core users have to take notice of this 
00035  * fact and have to agree to check out carefully before installing, 
00036  * using and extending the Open Source IMS Core System, if related 
00037  * patents and licences may become applicable to the intended usage 
00038  * context.  
00039  *
00040  * You should have received a copy of the GNU General Public License
00041  * along with this program; if not, write to the Free Software
00042  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00043  * 
00044  */
00045  
00056 #ifndef S_CSCF_DLG_STATE_H
00057 #define S_CSCF_DLG_STATE_H
00058 
00059 #include "../../sr_module.h"
00060 #include "mod.h"
00061 #include "../../locking.h"
00062 #include "../tm/dlg.h"
00063 
00065 enum s_dialog_method {
00066     DLG_METHOD_OTHER=0,
00067     DLG_METHOD_INVITE=1,
00068     DLG_METHOD_SUBSCRIBE=2  
00069 };
00070 
00072 #define DLG_METHOD_MAX DLG_METHOD_SUBSCRIBE
00073 
00075 enum s_dialog_state {
00076     DLG_STATE_UNKNOWN=0,
00077     DLG_STATE_INITIAL=1,
00078     DLG_STATE_EARLY=2,
00079     DLG_STATE_CONFIRMED=3,
00080     DLG_STATE_TERMINATED_ONE_SIDE=4,
00081     DLG_STATE_TERMINATED=5  
00082 };
00083 
00085 enum s_dialog_direction {
00086     DLG_MOBILE_ORIGINATING=0,
00087     DLG_MOBILE_TERMINATING=1,
00088     DLG_MOBILE_UNKNOWN=2
00089 };
00090 
00092 typedef struct _s_dialog {
00093     unsigned int hash;                  
00094     str call_id;                        
00095     enum s_dialog_direction direction;  
00097     str aor;                            
00099     enum s_dialog_method method;        
00100     str method_str;                     
00101     int first_cseq;                     
00102     int last_cseq;                      
00103     enum s_dialog_state state;          
00104     time_t expires;                     
00105     time_t lr_session_expires;          
00106     str refresher;                      
00107     unsigned char uac_supp_timer;       
00109     str event;                          
00111     unsigned char is_releasing;         
00114     dlg_t *dialog_c;                    
00115     dlg_t *dialog_s;                    
00117     struct _s_dialog *next;             
00118     struct _s_dialog *prev;             
00119 } s_dialog;
00120 
00122 typedef struct {
00123     s_dialog *head;                     
00124     s_dialog *tail;                     
00125     gen_lock_t *lock;                   
00126 } s_dialog_hash_slot;
00127 
00128 
00129 inline unsigned int get_s_dialog_hash(str call_id);
00130 
00131 int s_dialogs_init(int hash_size);
00132 
00133 void s_dialogs_destroy();
00134 
00135 inline void d_lock(unsigned int hash);
00136 inline void d_unlock(unsigned int hash);
00137 
00138 
00139 s_dialog* new_s_dialog(str call_id,str aor,enum s_dialog_direction dir);
00140 s_dialog* add_s_dialog(str call_id,str aor,enum s_dialog_direction dir);
00141 int is_s_dialog(str call_id,str aor,enum s_dialog_direction dir);
00142 int is_s_dialog_dir(str call_id,enum s_dialog_direction dir);
00143 s_dialog* get_s_dialog(str call_id,str aor);
00144 s_dialog* get_s_dialog_dir(str call_id,enum s_dialog_direction dir);
00145 s_dialog* get_s_dialog_dir_nolock(str call_id,enum s_dialog_direction dir);
00146 int terminate_s_dialog(s_dialog *d);
00147 void del_s_dialog(s_dialog *d);
00148 void free_s_dialog(s_dialog *d);
00149 void print_s_dialogs(int log_level);
00150 enum s_dialog_direction get_dialog_direction(char *direction);
00151 
00152 
00153 int S_is_in_dialog(struct sip_msg* msg, char* str1, char* str2);
00154 
00155 int S_save_dialog(struct sip_msg* msg, char* str1, char* str2);
00156 
00157 int S_update_dialog(struct sip_msg* msg, char* str1, char* str2);
00158 
00159 int S_drop_dialog(struct sip_msg* msg, char* str1, char* str2);
00160 
00161 int S_drop_all_dialogs(str aor);
00162 
00163 int S_record_route(struct sip_msg *msg,char *user,char *str2);
00164 
00165 int S_is_record_routed(struct sip_msg *msg,char *str1,char *str2);
00166 
00167 void dialog_timer(unsigned int ticks, void* param);
00168 
00169 int S_check_session_expires(struct sip_msg* msg, char* str1, char* str2);
00170 
00171 int S_422_session_expires(struct sip_msg* msg, char* str1, char* str2);
00172         
00173 #endif

Generated on Thu Oct 23 04:14:38 2008 for Open IMS Core CSCFs by  doxygen 1.5.2