registrar_subscribe.h

Go to the documentation of this file.
00001 /*
00002  * $Id: registrar_subscribe.h 161 2007-03-01 14:06:01Z 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 
00057 #ifndef P_CSCF_REGISTRAR_SUBSCRIBE_H_
00058 #define P_CSCF_REGISTRAR_SUBSCRIBE_H_
00059 
00060 #include "../../sr_module.h"
00061 #include "../../locking.h"
00062 #include "../tm/tm_load.h"
00063 
00064 #include "registrar_storage.h"
00065 
00067 enum {
00068     IMS_REGINFO_FULL,
00069     IMS_REGINFO_PARTIAL,
00070     IMS_REGINFO_ACTIVE,
00071     IMS_REGINFO_TERMINATED
00072 }IMS_Reginfo_states;
00073 
00075 enum {
00076     IMS_REGINFO_NONE,                   
00077     IMS_REGINFO_SUBSCRIBE,              
00078     IMS_REGINFO_SUBSCRIBE_EXPIRED,      
00080     IMS_REGINFO_CONTACT_REGISTERED,     
00081     IMS_REGINFO_CONTACT_CREATED,        
00082     IMS_REGINFO_CONTACT_REFRESHED,      
00083     IMS_REGINFO_CONTACT_SHORTENED,      
00084     IMS_REGINFO_CONTACT_EXPIRED,        
00085     IMS_REGINFO_CONTACT_DEACTIVATED,    
00086     IMS_REGINFO_CONTACT_PROBATION,      
00087     IMS_REGINFO_CONTACT_UNREGISTERED,   
00088     IMS_REGINFO_CONTACT_REJECTED        
00089 }IMS_Registrar_events;
00090 
00092 typedef struct _r_subscription {
00093     unsigned int hash;
00094     str req_uri;            
00095     int duration;           
00096     time_t expires;         
00097     char attempts_left;     
00099     dlg_t *dialog; 
00100         
00101     struct _r_subscription *next, *prev;
00102 } r_subscription;
00103 
00105 typedef struct {    
00106     gen_lock_t *lock;       
00107     r_subscription *head;   
00108     r_subscription *tail;   
00109 } r_subscription_hash_slot;
00110 
00111 void subs_lock(unsigned int hash);
00112 void subs_unlock(unsigned int hash);
00113 unsigned int get_subscription_hash(str uri);
00114 int r_subscription_init();
00115 void r_subscription_destroy();
00116 
00117 
00118 int P_subscribe(struct sip_msg *rpl, char* str1, char* str2);
00119 
00120 int r_subscribe(str uri,int duration);
00121 
00122 
00123 int r_send_subscribe(r_subscription *s,int duration);
00124 
00125 void r_subscribe_response(struct cell *t,int type,struct tmcb_params *ps);
00126 
00127 int P_notify(struct sip_msg *msg,char *str1,char *str2);
00128 
00129 void subscription_timer(unsigned int ticks, void* param);
00130 
00131 r_subscription* new_r_subscription(str req_uri,int duration);
00132 void add_r_subscription(r_subscription *s);
00133 int update_r_subscription(r_subscription *s,int expires);
00134 r_subscription* get_r_subscription(str aor);
00135 int is_r_subscription(str aor);
00136 void del_r_subscription(r_subscription *s);
00137 void del_r_subscription_nolock(r_subscription *s);
00138 void free_r_subscription(r_subscription *s);
00139 void print_subs(int log_level);
00140 
00142 typedef struct _r_regcontact {
00143     str id;
00144     str uri;
00145     int state;
00146     int event;
00147     int expires;
00148     
00149     struct _r_regcontact *next;
00150 } r_regcontact;
00151 
00153 typedef struct _r_registration {
00154     str id;
00155     str aor;
00156     int state;
00157     
00158     r_regcontact *contact;
00159     struct _r_registration *next;
00160 } r_registration;
00161 
00163 typedef struct {
00164     int state;
00165     r_registration *registration;
00166 } r_notification;
00167 
00168 int parser_init(char *dtd_filename);
00169 void parser_destroy();
00170 
00171 r_notification* r_notification_parse(str xml);
00172 int r_notification_process(r_notification *n,int expires);
00173 void r_notification_print(r_notification *n);
00174 void r_notification_free(r_notification *n);
00175 
00176 
00177 #endif //P_CSCF_REGISTRAR_SUBSCRIBE_H_

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