mod.c File Reference


Detailed Description

Serving-CSCF - SER module interface.

Scope:

Author:
Dragos Vingarzan vingarzan -at- fokus dot fraunhofer dot de

Definition in file mod.c.

#include "mod.h"
#include "../../db/db.h"
#include "../../sr_module.h"
#include "../../timer.h"
#include "../../locking.h"
#include "../tm/tm_load.h"
#include "../cdp/cdp_load.h"
#include "../dialog/dlg_mod.h"
#include "registration.h"
#include "registrar.h"
#include "registrar_storage.h"
#include "registrar_notify.h"
#include "sip.h"
#include "cx.h"
#include "scscf_load.h"
#include "dlg_state.h"
#include "s_persistency.h"
#include "ims_pm_scscf.h"
#include "privacy.h"

Go to the source code of this file.

Functions

static MODULE_VERSION int mod_init (void)
 Initializes the module.
static int mod_child_init (int rank)
 Initializes the module in child.
static void mod_destroy (void)
 Destroys the modules.
static int build_record_service_route ()
 Builds the Service-Route header from the scscf_name_str.
db_con_t * create_scscf_db_connection ()
void close_scscf_db_connection (db_con_t *db)
int S_trans_in_processing (struct sip_msg *msg, char *str1, char *str2)
 Checks if this transaction is already in processing.

Variables

char * scscf_name = "sip:scscf.open-ims.test:6060"
 name of the S-CSCF
char * scscf_forced_hss_peer = ""
 FQDN of the Forced Diameter Peer (HSS).
char * scscf_user_data_dtd = 0
char * scscf_user_data_xsd = 0
int auth_data_hash_size = 1024
 authentication vector hash table size
int auth_vector_timeout = 60
 timeout for a sent auth vector to expire in sec
int auth_data_timeout = 60
 timeout for a hash entry to expire when empty in sec
int av_request_at_once = 1
 how many auth vectors to request in a MAR
int av_request_at_sync = 1
 how many auth vectors to request in a sync MAR
int server_assignment_store_data = 0
 whether to ask to keep the data in SAR
int registrar_hash_size = 1024
 the size of the hash table
int registration_default_expires = 3600
 the default value for expires if none found
int registration_min_expires = 10
 minimum registration expiration time
int registration_max_expires = 1000000
 maximum registration expiration time
char * registration_qop = "auth,auth-int"
 the qop options to put in the authorization challenges
str registration_qop_str = {0,0}
 the qop options to put in the authorization challenges
char * registration_default_algorithm = "AKAv1-MD5"
 default algorithm for registration (if none present)
unsigned char registration_default_algorithm_type = 1
 fixed default algorithm for registration (if none present)
int registration_disable_early_ims = 1
 if to disable the Early-IMS checks
int registration_disable_nass_bundled = 1
 if to disable the NASS-Bundled checks
int subscription_default_expires = 3600
 the default value for expires if none found
int subscription_min_expires = 10
 minimum subscription expiration time
int subscription_max_expires = 1000000
 maximum subscription expiration time
int append_branches = 1
 if to append branches
int scscf_dialogs_hash_size = 256
 size of the dialog hash table
int scscf_dialogs_expiration_time = 3600
 default expiration time for dialogs
int scscf_dialogs_enable_release = 1
 if to enable dialog release
int scscf_min_se = 90
 Minimum session-expires accepted value.
int * scscf_dialog_count = 0
 Counter for saved dialogs.
int scscf_max_dialog_count = 20000
 Maximum number of dialogs.
gen_lock_t * scscf_dialog_count_lock = 0
 Lock for the dialog counter.
int scscf_support_wildcardPSI = 0
persistency_mode_t scscf_persistency_mode = NO_PERSISTENCY
 the type of persistency
char * scscf_persistency_location = "/opt/OpenIMSCore/persistency"
 where to dump the persistency data
int scscf_persistency_timer_authdata = 60
 interval to snapshot authorization data
int scscf_persistency_timer_dialogs = 60
 interval to snapshot dialogs data
int scscf_persistency_timer_registrar = 60
 interval to snapshot registrar data
char * scscf_db_url = "postgres://mario:mario@localhost/scscfdb"
int * auth_snapshot_version = 0
 the version of the next auth snapshot on the db
int * auth_step_version = 0
 the step version within the current auth snapshot version
int * dialogs_snapshot_version = 0
 the version of the next dialogs snapshot on the db
int * dialogs_step_version = 0
 the step version within the current dialogs snapshot version
int * registrar_snapshot_version = 0
 the version of the next registrar snapshot on the db
int * registrar_step_version = 0
 the step version within the current registrar snapshot version
gen_lock_t * db_lock
 lock for db access
str scscf_name_str
 fixed name of the S-CSCF
str scscf_record_route_mo
 the record route header for Mobile Originating
str scscf_record_route_mt
 the record route header for Mobile Terminating
str scscf_record_route_mo_uri
 just the record route uri for Mobile Originating
str scscf_record_route_mt_uri
 just the record route uri for Mobile Terminating
str scscf_service_route
 the service route header
str scscf_service_route_uri
 just the service route uri
str scscf_registration_min_expires
 fixed minimum registration expiration time
str scscf_subscription_min_expires
 fixed minimum subscription expiration time
str scscf_forced_hss_peer_str
 FQDN of the forced Diameter Peer (HSS).
int * callback_singleton
 Cx callback singleton.
int * shutdown_singleton
 Shutdown singleton.
static cmd_export_t scscf_cmds []
 Exported functions.
static param_export_t scscf_params []
 Exported parameters.
module_exports exports
 module exports
int(*) sl_reply (struct sip_msg *_msg, char *_str1, char *_str2)
 link to the stateless reply function in sl module
tm_binds tmb
 Structure with pointers to tm funcs.
cdp_binds cdpb
 Structure with pointers to cdp funcs.
dlg_func_t dialogb
 Structure with pointers to dialog funcs.
auth_hash_slot_tauth_data
 authentication vectors hast table
r_hash_slotregistrar
 the S-CSCF registrar
r_notification_listnotification_list
 list of notifications for reg to be sent
s_dialog_hash_slots_dialogs
 the dialogs hash table
db_con_t * scscf_db = NULL
 Database connection handle.
db_func_t scscf_dbf
 Structure with pointers to db functions.
static str s_qop_s = {", qop=\"",7}
static str s_qop_e = {"\"",1}
static str s_service_route = {"Service-Route: <",16}
static str s_orig = {"sip:orig@",9}
static str s_sr_end = {";lr>\r\n",6}
static str s_min_expires_s = {"Min-Expires: ",13}
static str s_min_expires_e = {"\r\n",2}
static str s_record_route_s = {"Record-Route: <",15}
static str s_mo = {"sip:mo@",7}
static str s_mt = {"sip:mt@",7}
static str s_record_route_e = {";lr>\r\n",6}
gen_lock_t * process_lock


Function Documentation

static int mod_init ( void   )  [static]

Initializes the module.

Definition at line 544 of file mod.c.

References auth_data, auth_data_hash_size, auth_data_init(), auth_snapshot_version, auth_step_version, build_record_service_route(), callback_singleton, cdpb, create_scscf_db_connection(), db_lock, dialog_timer(), dialogs_snapshot_version, dialogs_step_version, get_algorithm_type(), load_cdp(), load_snapshot_authdata(), load_snapshot_dialogs(), load_snapshot_registrar(), M_NAME, NO_PERSISTENCY, NO_SCRIPT, notification_list, notification_timer(), persistency_timer_authdata(), persistency_timer_dialogs(), persistency_timer_registrar(), r_notify_init(), r_storage_init(), reg_await_timer(), registrar, registrar_hash_size, registrar_snapshot_version, registrar_step_version, registrar_timer(), registration_default_algorithm, registration_default_algorithm_type, s_dialogs, s_dialogs_init(), scscf_db_url, scscf_dialog_count, scscf_dialog_count_lock, scscf_dialogs_hash_size, scscf_forced_hss_peer, scscf_forced_hss_peer_str, scscf_name, scscf_name_str, scscf_persistency_mode, scscf_persistency_timer_authdata, scscf_persistency_timer_dialogs, scscf_persistency_timer_registrar, shutdown_singleton, sl_reply, WITH_DATABASE_BULK, and WITH_DATABASE_CACHE.

00545 {
00546     load_tm_f load_tm;
00547     load_cdp_f load_cdp;
00548     bind_dlg_mod_f load_dlg;
00549     str algo;
00550     
00551     callback_singleton=shm_malloc(sizeof(int));
00552     *callback_singleton=0;
00553     shutdown_singleton=shm_malloc(sizeof(int));
00554     *shutdown_singleton=0;
00555     
00556         
00557     LOG(L_INFO,"INFO:"M_NAME":mod_init: Initialization of module\n");
00558     /* fix the parameters */
00559     scscf_name_str.s = scscf_name;
00560     scscf_name_str.len = strlen(scscf_name);
00561     if (!build_record_service_route()) goto error;
00562     scscf_forced_hss_peer_str.s = scscf_forced_hss_peer;
00563     scscf_forced_hss_peer_str.len = strlen(scscf_forced_hss_peer);
00564     
00565     algo.s = registration_default_algorithm;
00566     algo.len = strlen(registration_default_algorithm);
00567     registration_default_algorithm_type = get_algorithm_type(algo); 
00568     
00569 
00570     #ifdef WITH_IMS_PM
00571         ims_pm_init(scscf_name_str,ims_pm_node_type, ims_pm_logfile);
00572         ims_pm_init_scscf();
00573     #endif /* WITH_IMS_PM */
00574             
00575     /* load the send_reply function from sl module */
00576     sl_reply = find_export("sl_send_reply", 2, 0);
00577     if (!sl_reply) {
00578         LOG(L_ERR, "ERR"M_NAME":mod_init: This module requires sl module\n");
00579         goto error;
00580     }
00581     
00582 //  /* bind to the db module */
00583 //  if ( cscf_db_bind( scscf_db_url ) < 0 ) goto error;
00584 
00585     if(scscf_persistency_mode==WITH_DATABASE_BULK || scscf_persistency_mode==WITH_DATABASE_CACHE){
00586         if (!scscf_db_url) {
00587             LOG(L_ERR, "ERR:"M_NAME":mod_init: no db_url specified but DB has to be used "
00588                 "(scscf_persistency_mode=%d\n", scscf_persistency_mode);
00589             return -1;
00590         }
00591         if (bind_dbmod(scscf_db_url, &scscf_dbf) < 0) { /* Find database module */
00592             LOG(L_ERR, "ERR"M_NAME":mod_init: Can't bind database module via url %s\n", scscf_db_url);
00593             return -1;
00594         }
00595 
00596         if (!DB_CAPABILITY(scscf_dbf, DB_CAP_ALL)) {
00597             LOG(L_ERR, "ERR:"M_NAME":mod_init: Database module does not implement all functions needed by the module\n");
00598             return -1;
00599         }
00600         
00601         scscf_db = create_scscf_db_connection();
00602         if (!scscf_db) {
00603             LOG(L_ERR, "ERR:"M_NAME": mod_init: Error while connecting database\n");
00604             return -1;
00605         }
00606         
00607         /* db lock */
00608         db_lock = (gen_lock_t*)lock_alloc();
00609         if(!db_lock){
00610             LOG(L_ERR, "ERR:"M_NAME": mod_init: No memory left\n");
00611             return -1;
00612         }
00613         lock_init(db_lock);
00614     
00615         /* snapshot and step versions */
00616     
00617         auth_snapshot_version=(int*)shm_malloc(sizeof(int));
00618         if(!auth_snapshot_version){
00619             LOG(L_ERR, "ERR:"M_NAME":mod_init: auth_snapshot_version, no memory left\n");
00620             return -1;
00621         }
00622         *auth_snapshot_version=0;
00623     
00624         auth_step_version=(int*)shm_malloc(sizeof(int));
00625         if(!auth_step_version){
00626             LOG(L_ERR, "ERR:"M_NAME":mod_init: auth_step_version, no memory left\n");
00627             return -1;
00628         }
00629         *auth_step_version=0;
00630     
00631         dialogs_snapshot_version=(int*)shm_malloc(sizeof(int));
00632         if(!dialogs_snapshot_version){
00633             LOG(L_ERR, "ERR:"M_NAME":mod_init: dialogs_snapshot_version, no memory left\n");
00634             return -1;
00635         }
00636         *dialogs_snapshot_version=0;
00637     
00638         dialogs_step_version=(int*)shm_malloc(sizeof(int));
00639         if(!dialogs_step_version){
00640             LOG(L_ERR, "ERR:"M_NAME":mod_init: dialogs_step_version, no memory left\n");
00641             return -1;
00642         }
00643         *dialogs_step_version=0;
00644     
00645         registrar_snapshot_version=(int*)shm_malloc(sizeof(int));
00646         if(!registrar_snapshot_version){
00647             LOG(L_ERR, "ERR:"M_NAME":mod_init: registrar_snapshot_version, no memory left\n");
00648             return -1;
00649         }
00650         *registrar_snapshot_version=0;
00651     
00652         registrar_step_version=(int*)shm_malloc(sizeof(int));
00653         if(!registrar_step_version){
00654             LOG(L_ERR, "ERR:"M_NAME":mod_init: registrar_step_version, no memory left\n");
00655             return -1;
00656         }
00657         *registrar_step_version=0;
00658         
00659     }
00660     
00661     /* bind to the tm module */
00662     if (!(load_tm = (load_tm_f)find_export("load_tm",NO_SCRIPT,0))) {
00663         LOG(L_ERR, "ERR"M_NAME":mod_init: Can not import load_tm. This module requires tm module\n");
00664         goto error;
00665     }
00666     if (load_tm(&tmb) == -1)
00667         goto error;
00668     /* bind to the cdp module */
00669     if (!(load_cdp = (load_cdp_f)find_export("load_cdp",NO_SCRIPT,0))) {
00670         LOG(L_ERR, "ERR"M_NAME":mod_init: Can not import load_cdp. This module requires cdp module\n");
00671         goto error;
00672     }
00673     if (load_cdp(&cdpb) == -1)
00674         goto error;
00675 
00676     /* bind to the dialog module */
00677     load_dlg = (bind_dlg_mod_f)find_export("bind_dlg_mod", -1, 0);
00678     if (!load_dlg) {
00679         LOG(L_ERR, "ERR"M_NAME":mod_init:  Can not import bind_dlg_mod. This module requires dialog module\n");
00680         return -1;
00681     }
00682     if (load_dlg(&dialogb) != 0) {
00683         return -1;
00684     }
00685     
00686     
00687     /* Init the authorization data storage */
00688     if (!auth_data_init(auth_data_hash_size)) goto error;   
00689     if (scscf_persistency_mode!=NO_PERSISTENCY){
00690         load_snapshot_authdata();
00691         if (register_timer(persistency_timer_authdata,0,scscf_persistency_timer_authdata)<0) goto error;
00692     }
00693     
00694 
00695     /* register the authentication vectors timer */
00696     if (register_timer(reg_await_timer,auth_data,10)<0) goto error;
00697     
00698     /* init the registrar storage */
00699     if (!r_storage_init(registrar_hash_size)) goto error;
00700     if (scscf_persistency_mode!=NO_PERSISTENCY){
00701         load_snapshot_registrar();
00702         if (register_timer(persistency_timer_registrar,0,scscf_persistency_timer_registrar)<0) goto error;
00703     }
00704 
00705     /* register the registrar timer */
00706     if (register_timer(registrar_timer,registrar,10)<0) goto error;
00707 
00708     /* init the registrar notifications */
00709     if (!r_notify_init()) goto error;
00710 
00711     /* register the registrar notifications timer */
00712     if (register_timer(notification_timer,notification_list,5)<0) goto error;
00713 
00714     /* init the dialog storage */
00715     if (!s_dialogs_init(scscf_dialogs_hash_size)){
00716         LOG(L_ERR, "ERR"M_NAME":mod_init: Error initializing the Hash Table for stored dialogs\n");
00717         goto error;
00718     }       
00719     scscf_dialog_count = shm_malloc(sizeof(int));
00720     *scscf_dialog_count = 0;
00721     scscf_dialog_count_lock = lock_alloc();
00722     scscf_dialog_count_lock = lock_init(scscf_dialog_count_lock);
00723 
00724     if (scscf_persistency_mode!=NO_PERSISTENCY){
00725         load_snapshot_dialogs();
00726         if (register_timer(persistency_timer_dialogs,0,scscf_persistency_timer_dialogs)<0) goto error;
00727     }
00728 
00729     /* register the dialog timer */
00730     if (register_timer(dialog_timer,s_dialogs,60)<0) goto error;
00731 
00732 
00733     /* don't register response callback as we always set callback per transactions 
00734      *  and we're not interested in other responses */
00735     /*AAAAddResponseHandler(&CxAnswerHandler,0);*/
00736 
00737     
00738     return 0;
00739 error:
00740     return -1;
00741 }

static int mod_child_init ( int  rank  )  [static]

Initializes the module in child.

Definition at line 754 of file mod.c.

References cdp_binds::AAAAddRequestHandler, callback_singleton, cdpb, CxRequestHandler(), M_NAME, NULL, parser_init(), scscf_user_data_dtd, and scscf_user_data_xsd.

00755 {
00756     LOG(L_INFO,"INFO:"M_NAME":mod_child_init: Initialization of module in child [%d] \n",
00757         rank);
00758     /* don't do anything for main process and TCP manager process */
00759     if ( rank == PROC_MAIN || rank == PROC_TCP_MAIN )
00760         return 0;
00761     
00762 //  /* db child init */
00763 //  cscf_db_init( scscf_db_url, 
00764 //      scscf_db_nds_table,
00765 //      scscf_db_scscf_table,
00766 //      scscf_db_capabilities_table);
00767     
00768     /*if (scscf_persistency_mode==WITH_DATABASE_BULK || scscf_persistency_mode==WITH_DATABASE_CACHE) { 
00769         scscf_db = create_scscf_db_connection();
00770         if (!scscf_db) {
00771             LOG(L_ERR, "ERR:"M_NAME":mod_child_init(%d): "
00772                     "Error while connecting database\n", rank);
00773             return -1;
00774         }
00775     }*/
00776     
00777     /* init the diameter callback - must be done just once */
00778     lock_get(process_lock);
00779         if((*callback_singleton)==0){
00780             *callback_singleton=1;
00781             cdpb.AAAAddRequestHandler(CxRequestHandler,NULL);
00782         }
00783     lock_release(process_lock);
00784     /* Init the user data parser */
00785     if (!parser_init(scscf_user_data_dtd,scscf_user_data_xsd)) return -1;
00786         
00787     return 0;
00788 }

static void mod_destroy ( void   )  [static]

Destroys the modules.

Definition at line 793 of file mod.c.

References auth_data_destroy(), close_scscf_db_connection(), M_NAME, make_snapshot_authdata(), make_snapshot_dialogs(), make_snapshot_registrar(), NO_PERSISTENCY, NULL, parser_destroy(), r_notify_destroy(), r_storage_destroy(), s_dialogs_destroy(), scscf_dialog_count, scscf_dialog_count_lock, scscf_persistency_mode, scscf_service_route, shutdown_singleton, WITH_DATABASE_BULK, and WITH_DATABASE_CACHE.

00794 {
00795     int do_destroy=0;
00796     LOG(L_INFO,"INFO:"M_NAME":mod_destroy: child exit\n");
00797     lock_get(process_lock);
00798         if((*shutdown_singleton)==0){
00799             *shutdown_singleton=1;
00800             do_destroy=1;
00801         }
00802     lock_release(process_lock);
00803     if (do_destroy){
00804         if (scscf_persistency_mode!=NO_PERSISTENCY){
00805             /* First let's snapshot everything */
00806             make_snapshot_authdata();
00807             make_snapshot_dialogs();
00808             make_snapshot_registrar();
00809         }
00810         /* Then nuke it all */
00811         auth_data_destroy();
00812         parser_destroy();
00813         r_notify_destroy(); 
00814         r_storage_destroy();
00815         s_dialogs_destroy();    
00816         lock_get(scscf_dialog_count_lock);
00817         shm_free(scscf_dialog_count);
00818         lock_destroy(scscf_dialog_count_lock);      
00819         pkg_free(scscf_service_route.s);
00820     }
00821     
00822     if ( (scscf_persistency_mode==WITH_DATABASE_BULK || scscf_persistency_mode==WITH_DATABASE_CACHE) && scscf_db) {
00823         DBG("INFO:"M_NAME": ... closing db connection\n");
00824         close_scscf_db_connection(scscf_db);
00825     }
00826     scscf_db = NULL;
00827     #ifdef WITH_IMS_PM
00828         ims_pm_destroy();   
00829     #endif /* WITH_IMS_PM */    
00830 }

static int build_record_service_route (  )  [inline, static]

Builds the Service-Route header from the scscf_name_str.

Definition at line 421 of file mod.c.

References M_NAME, registration_min_expires, registration_qop, registration_qop_str, scscf_name_str, scscf_record_route_mo, scscf_record_route_mo_uri, scscf_record_route_mt, scscf_record_route_mt_uri, scscf_registration_min_expires, scscf_service_route, scscf_service_route_uri, scscf_subscription_min_expires, STR_APPEND, and subscription_min_expires.

Referenced by mod_init().

00422 {
00423     scscf_service_route.s = pkg_malloc(s_service_route.len+s_orig.len+scscf_name_str.len+s_sr_end.len);
00424     if (!scscf_service_route.s){
00425         LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n",
00426             s_service_route.len+s_orig.len+scscf_name_str.len+s_sr_end.len);
00427         return 0;
00428     }
00429     scscf_registration_min_expires.s = pkg_malloc(s_min_expires_s.len+10+s_min_expires_e.len);
00430     if (!scscf_registration_min_expires.s){
00431         LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n",
00432             s_min_expires_s.len+10+s_min_expires_e.len);
00433         return 0;
00434     }
00435     scscf_subscription_min_expires.s = pkg_malloc(s_min_expires_s.len+10+s_min_expires_e.len);
00436     if (!scscf_subscription_min_expires.s){
00437         LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n",
00438             s_min_expires_s.len+10+s_min_expires_e.len);
00439         return 0;
00440     }
00441     
00442     if (registration_qop && strlen(registration_qop)>0) {
00443         registration_qop_str.len = s_qop_s.len+strlen(registration_qop)+s_qop_e.len;
00444         registration_qop_str.s = pkg_malloc(registration_qop_str.len);
00445         if (!registration_qop_str.s){
00446             LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n",registration_qop_str.len);
00447             registration_qop_str.len = 0;
00448             return 0;
00449         }
00450         registration_qop_str.len = 0;
00451         STR_APPEND(registration_qop_str,s_qop_s);
00452         memcpy(registration_qop_str.s+registration_qop_str.len,registration_qop,strlen(registration_qop));
00453         registration_qop_str.len += strlen(registration_qop);
00454         STR_APPEND(registration_qop_str,s_qop_e);       
00455     }else{
00456         registration_qop_str.len=0;
00457         registration_qop_str.s=0;
00458     }
00459     
00460     scscf_record_route_mo.s = pkg_malloc(s_record_route_s.len+s_mo.len+scscf_name_str.len+s_record_route_e.len);
00461     if (!scscf_record_route_mo.s){
00462         LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n",
00463             s_record_route_s.len+s_mo.len+scscf_name_str.len+s_record_route_e.len);
00464         return 0;
00465     }
00466     scscf_record_route_mt.s = pkg_malloc(s_record_route_s.len+s_mt.len+scscf_name_str.len+s_record_route_e.len);
00467     if (!scscf_record_route_mt.s){
00468         LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n",
00469             s_record_route_s.len+s_mt.len+scscf_name_str.len+s_record_route_e.len);
00470         return 0;
00471     }
00472     
00473     STR_APPEND(scscf_service_route,s_service_route);
00474     if (scscf_name_str.len>4 && strncasecmp(scscf_name_str.s,"sip:",4)==0){
00475         STR_APPEND(scscf_service_route,s_orig);
00476         memcpy(scscf_service_route.s+scscf_service_route.len,scscf_name_str.s+4,
00477             scscf_name_str.len-4);
00478         scscf_service_route.len += scscf_name_str.len-4;
00479     } else {
00480         STR_APPEND(scscf_service_route,s_orig);
00481         STR_APPEND(scscf_service_route,scscf_name_str);
00482     }
00483     STR_APPEND(scscf_service_route,s_sr_end);
00484     scscf_service_route_uri.s = scscf_service_route.s + s_service_route.len;
00485     scscf_service_route_uri.len = scscf_service_route.len - s_service_route.len - s_sr_end.len;
00486 
00487     sprintf(scscf_registration_min_expires.s,"%.*s%d%.*s",
00488         s_min_expires_s.len,s_min_expires_s.s,
00489         registration_min_expires,
00490         s_min_expires_e.len,s_min_expires_e.s);
00491     scscf_registration_min_expires.len = strlen(scscf_registration_min_expires.s);
00492 
00493     sprintf(scscf_subscription_min_expires.s,"%.*s%d%.*s",
00494         s_min_expires_s.len,s_min_expires_s.s,
00495         subscription_min_expires,
00496         s_min_expires_e.len,s_min_expires_e.s);
00497     scscf_subscription_min_expires.len = strlen(scscf_subscription_min_expires.s);
00498 
00499     scscf_record_route_mo.len=0;
00500     STR_APPEND(scscf_record_route_mo,s_record_route_s);
00501     if (scscf_name_str.len>4 && strncasecmp(scscf_name_str.s,"sip:",4)==0){
00502         STR_APPEND(scscf_record_route_mo,s_mo);
00503         memcpy(scscf_record_route_mo.s+scscf_record_route_mo.len,scscf_name_str.s+4,
00504             scscf_name_str.len-4);
00505         scscf_record_route_mo.len += scscf_name_str.len-4;
00506     } else {
00507         STR_APPEND(scscf_record_route_mo,s_mo);
00508         STR_APPEND(scscf_record_route_mo,scscf_name_str);
00509     }
00510     STR_APPEND(scscf_record_route_mo,s_record_route_e);
00511     scscf_record_route_mo_uri.s = scscf_record_route_mo.s + s_record_route_s.len;
00512     scscf_record_route_mo_uri.len = scscf_record_route_mo.len - s_record_route_s.len - s_record_route_e.len;
00513 
00514     scscf_record_route_mt.len=0;
00515     STR_APPEND(scscf_record_route_mt,s_record_route_s);
00516     if (scscf_name_str.len>4 && strncasecmp(scscf_name_str.s,"sip:",4)==0){
00517         STR_APPEND(scscf_record_route_mt,s_mt);
00518         memcpy(scscf_record_route_mt.s+scscf_record_route_mt.len,scscf_name_str.s+4,
00519             scscf_name_str.len-4);
00520         scscf_record_route_mt.len += scscf_name_str.len-4;
00521     } else {
00522         STR_APPEND(scscf_record_route_mt,s_mt);
00523         STR_APPEND(scscf_record_route_mt,scscf_name_str);
00524     }
00525     STR_APPEND(scscf_record_route_mt,s_record_route_e);
00526     scscf_record_route_mt_uri.s = scscf_record_route_mt.s + s_record_route_s.len;
00527     scscf_record_route_mt_uri.len = scscf_record_route_mt.len - s_record_route_s.len - s_record_route_e.len;
00528 
00529 
00530     return 1;
00531 }

db_con_t* create_scscf_db_connection (  ) 

Definition at line 533 of file mod.c.

References NULL, scscf_db_url, scscf_persistency_mode, WITH_DATABASE_BULK, and WITH_DATABASE_CACHE.

Referenced by mod_init().

00534 {
00535     if (scscf_persistency_mode!=WITH_DATABASE_BULK && scscf_persistency_mode!=WITH_DATABASE_CACHE) return NULL;
00536     if (!scscf_dbf.init) return NULL;
00537 
00538     return scscf_dbf.init(scscf_db_url);
00539 }

void close_scscf_db_connection ( db_con_t *  db  ) 

Definition at line 746 of file mod.c.

Referenced by mod_destroy().

00747 {
00748     if (db && scscf_dbf.close) scscf_dbf.close(db);
00749 }

int S_trans_in_processing ( struct sip_msg *  msg,
char *  str1,
char *  str2 
)

Checks if this transaction is already in processing.

Parameters:
msg - the SIP message
str1 - not used
str2 - not used
Returns:
CSCF_RETURN_TRUE if in processing or CSCF_RETURN_FALSE if not

Definition at line 842 of file mod.c.

References CSCF_RETURN_FALSE, and CSCF_RETURN_TRUE.

00843 {
00844     unsigned int hash, label;
00845     if (tmb.t_get_trans_ident(msg,&hash,&label)<0)
00846         return CSCF_RETURN_FALSE;
00847     return CSCF_RETURN_TRUE;    
00848 }


Variable Documentation

char* scscf_name = "sip:scscf.open-ims.test:6060"

name of the S-CSCF

Definition at line 89 of file mod.c.

Referenced by bin_cache_dump_auth_to_table(), bin_cache_load_auth_from_table(), I_get_capabilities(), I_scscf_select(), icscf_db_get_scscf(), and mod_init().

char* scscf_forced_hss_peer = ""

FQDN of the Forced Diameter Peer (HSS).

Definition at line 91 of file mod.c.

Referenced by mod_init().

char* scscf_user_data_dtd = 0

Definition at line 93 of file mod.c.

Referenced by mod_child_init(), and parse_user_data().

char* scscf_user_data_xsd = 0

Definition at line 94 of file mod.c.

Referenced by mod_child_init(), and parse_user_data().

int auth_data_hash_size = 1024

authentication vector hash table size

Definition at line 96 of file mod.c.

Referenced by bin_cache_dump_auth_to_table(), make_snapshot_authdata(), and mod_init().

int auth_vector_timeout = 60

timeout for a sent auth vector to expire in sec

Definition at line 97 of file mod.c.

Referenced by start_reg_await_timer().