Scope:
Definition in file mod.c.
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "mod.h"
#include "../../db/db.h"
#include "../../sr_module.h"
#include "../../socket_info.h"
#include "../../timer.h"
#include "../../locking.h"
#include "../tm/tm_load.h"
#include "../dialog/dlg_mod.h"
#include "../cdp/cdp_load.h"
#include "registration.h"
#include "registrar_storage.h"
#include "registrar_subscribe.h"
#include "registrar.h"
#include "nat_helper.h"
#include "security.h"
#include "dlg_state.h"
#include "sdp_util.h"
#include "p_persistency.h"
#include "release_call.h"
#include "ims_pm_pcscf.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 module. | |
| int | fix_parameters () |
| Fix the configuration parameters. | |
| db_con_t * | create_pcscf_db_connection () |
| void | close_pcscf_db_connection (db_con_t *db) |
| int | P_trans_in_processing (struct sip_msg *msg, char *str1, char *str2) |
| Checks if the transaction is in processing. | |
Variables | |
| char * | pcscf_name = "sip:pcscf.open-ims.test:4060" |
| SIP URI of this P-CSCF. | |
| char * | cscf_icid_value_prefix |
| hexadecimal prefix for the icid-value - must be unique on each node | |
| unsigned int * | cscf_icid_value_count |
| to keep the number of generated icid-values | |
| gen_lock_t * | cscf_icid_value_count_lock |
| to lock acces on the above counter | |
| char * | cscf_icid_gen_addr |
| address of the generator of the icid-value | |
| char * | cscf_orig_ioi |
| name of the Originating network | |
| char * | cscf_term_ioi |
| name of the Terminating network | |
| int | pcscf_use_ipsec = 0 |
| whether to use or not ipsec | |
| char * | pcscf_ipsec_host = "127.0.0.1" |
| IP for protected server. | |
| int | pcscf_ipsec_port_c = 4060 |
| PORT for protected client. | |
| int | pcscf_ipsec_port_s = 4060 |
| PORT for protected server. | |
| int | pcscf_use_tls = 0 |
| whether to use or not tls | |
| int | pcscf_tls_port = 4061 |
| PORT for TLS server. | |
| char * | pcscf_ipsec_P_Inc_Req = "/opt/OpenIMSCore/ser_ims/modules/pcscf/ipsec_P_Inc_Req.sh" |
| Req E->P. | |
| char * | pcscf_ipsec_P_Out_Rpl = "/opt/OpenIMSCore/ser_ims/modules/pcscf/ipsec_P_Out_Rpl.sh" |
| Rpl E<-P. | |
| char * | pcscf_ipsec_P_Out_Req = "/opt/OpenIMSCore/ser_ims/modules/pcscf/ipsec_P_Out_Req.sh" |
| Req E<-P. | |
| char * | pcscf_ipsec_P_Inc_Rpl = "/opt/OpenIMSCore/ser_ims/modules/pcscf/ipsec_P_Inc_Rpl.sh" |
| Rpl E->P. | |
| char * | pcscf_ipsec_P_Drop = "/opt/OpenIMSCore/ser_ims/modules/pcscf/ipsec_P_Drop.sh" |
| Drop. | |
| int | registrar_hash_size = 1024 |
| the size of the hash table for registrar | |
| char * | pcscf_reginfo_dtd = "/opt/OpenIMSCore/ser_ims/pcscf/modules/pcscf/reginfo.dtd" |
| DTD to check the reginfo/xml in the NOTIFY to reg. | |
| int | pcscf_subscribe_retries = 1 |
| times to retry subscribe to reg on failure | |
| int | subscriptions_hash_size = 1024 |
| the size of the hash table for subscriptions | |
| int | pcscf_dialogs_hash_size = 1024 |
| the size of the hash table for dialogs | |
| int | pcscf_dialogs_expiration_time = 3600 |
| expiration time for a dialog | |
| int | pcscf_dialogs_enable_release = 1 |
| if to enable dialog release | |
| int | pcscf_min_se = 90 |
| Minimum session-expires accepted value. | |
| int * | pcscf_dialog_count = 0 |
| Counter for saved dialogs. | |
| int | pcscf_max_dialog_count = 20000 |
| Maximum number of dialogs. | |
| gen_lock_t * | pcscf_dialog_count_lock = 0 |
| Lock for the dialog counter. | |
| int | pcscf_nat_enable = 1 |
| whether to enable NAT | |
| int | pcscf_nat_ping = 1 |
| whether to ping anything | |
| int | pcscf_nat_pingall = 0 |
| whether to ping also the UA that don't look like being behind a NAT | |
| int | pcscf_nat_detection_type = 0 |
| the NAT detection tests | |
| socket_info * | force_socket = 0 |
| rtpp_head | rtpp_list |
| RTPProxy list. | |
| int | rtpp_node_count = 0 |
| RTPProxy list count. | |
| char * | force_socket_str = 0 |
| char * | rtpproxy_sock = "unix:/var/run/rtpproxy.sock" |
| int | rtpproxy_enable = 0 |
| if the RTPProxy is enabled | |
| int | rtpproxy_disable_tout = 60 |
| disabling timeout for the RTPProxy | |
| int | rtpproxy_retr = 5 |
| Retry count. | |
| int | rtpproxy_tout = 1 |
| Timeout. | |
| char * | forced_clf_peer = "" |
| FQDN of the forced CLF Diameter Peer (CLF). | |
| int | pcscf_use_e2 = 0 |
| if to enable usage of e2 or not | |
| str | pcscf_name_str |
| fixed SIP URI of this P-CSCF | |
| str | pcscf_path_hdr_str |
| fixed Path header | |
| str | pcscf_path_str |
| fixed Path URI | |
| str | forced_clf_peer_str |
| FQDN of the Diameter Peer (HSS). | |
| str | pcscf_record_route_mo |
| Record-route for originating case. | |
| str | pcscf_record_route_mo_uri |
| URI for Record-route originating. | |
| str | pcscf_record_route_mt |
| Record-route for terminating case. | |
| str | pcscf_record_route_mt_uri |
| URI for Record-route terminating. | |
| str | cscf_icid_value_prefix_str |
| fixed hexadecimal prefix for the icid-value - must be unique on each node | |
| str | cscf_icid_gen_addr_str |
| fixed address of the generator of the icid-value | |
| str | cscf_orig_ioi_str |
| fixed name of the Originating network | |
| str | cscf_term_ioi_str |
| fixed name of the Terminating network | |
| persistency_mode_t | pcscf_persistency_mode = NO_PERSISTENCY |
| the type of persistency | |
| char * | pcscf_persistency_location = "/opt/OpenIMSCore/persistency" |
| where to dump the persistency data | |
| int | pcscf_persistency_timer_dialogs = 60 |
| interval to snapshot dialogs data | |
| int | pcscf_persistency_timer_registrar = 60 |
| interval to snapshot registrar data | |
| int | pcscf_persistency_timer_subscriptions = 60 |
| interval to snapshot subscriptions data | |
| char * | pcscf_db_url = "postgres://mario:mario@localhost/pcscfdb" |
| int * | subs_snapshot_version |
| the version of the next subscriptions snapshot on the db | |
| int * | subs_step_version |
| the step version within the current subscriptions snapshot version | |
| int * | dialogs_snapshot_version |
| the version of the next dialogs snapshot on the db | |
| int * | dialogs_step_version |
| the step version within the current dialogs snapshot version | |
| int * | registrar_snapshot_version |
| the version of the next registrar snapshot on the db | |
| int * | registrar_step_version |
| the step version within the current registrar snapshot version | |
| gen_lock_t * | db_lock |
| lock for db access | |
| int * | shutdown_singleton |
| Shutdown singleton. | |
| static cmd_export_t | pcscf_cmds [] |
| Exported functions. | |
| static param_export_t | pcscf_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. | |
| dlg_func_t | dialogb |
| Structure with pointers to dialog funcs. | |
| cdp_binds | cdpb |
| Structure with pointers to cdp funcs. | |
| r_hash_slot * | registrar |
| the contacts | |
| p_dialog_hash_slot * | p_dialogs |
| the dialogs hash table | |
| db_con_t * | pcscf_db = NULL |
| Database connection handle. | |
| db_func_t | pcscf_dbf |
| Structure with pointers to db functions. | |
| static str | path_str_s = {"Path: <",7} |
| static str | path_str_1 = {"sip:term@",9} |
| static str | path_str_e = {";lr>\r\n",6} |
| 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 |
| static int mod_init | ( | void | ) | [static] |
Initializes the module.
Definition at line 602 of file mod.c.
References cdpb, create_pcscf_db_connection(), cscf_icid_value_count, cscf_icid_value_count_lock, db_lock, dialog_timer(), dialogb, dialogs_snapshot_version, dialogs_step_version, fix_parameters(), get_tls_session_hash, load_cdp(), load_snapshot_dialogs(), load_snapshot_registrar(), load_snapshot_subscriptions(), M_NAME, nat_prepare_1918addr(), NO_PERSISTENCY, NO_SCRIPT, p_dialogs, p_dialogs_init(), pcscf_db, pcscf_db_url, pcscf_dbf, pcscf_dialog_count, pcscf_dialog_count_lock, pcscf_dialogs_hash_size, pcscf_name_str, pcscf_nat_enable, pcscf_persistency_mode, pcscf_persistency_timer_dialogs, pcscf_persistency_timer_registrar, pcscf_persistency_timer_subscriptions, pcscf_use_e2, pcscf_use_tls, persistency_timer_dialogs(), persistency_timer_registrar(), persistency_timer_subscriptions(), r_storage_init(), r_subscription_init(), registrar, registrar_hash_size, registrar_snapshot_version, registrar_step_version, registrar_timer(), rtpproxy_enable, rtpproxy_init(), shutdown_singleton, sl_reply, subs_snapshot_version, subs_step_version, subscription_timer(), tmb, WITH_DATABASE_BULK, and WITH_DATABASE_CACHE.
00603 { 00604 load_tm_f load_tm; 00605 load_cdp_f load_cdp; 00606 bind_dlg_mod_f load_dlg; 00607 00608 LOG(L_INFO,"INFO:"M_NAME":mod_init: Initialization of module\n"); 00609 shutdown_singleton=shm_malloc(sizeof(int)); 00610 *shutdown_singleton=0; 00611 00612 00613 /* fix the parameters */ 00614 if (!fix_parameters()) goto error; 00615 00616 #ifdef WITH_IMS_PM 00617 ims_pm_init(pcscf_name_str,ims_pm_node_type, ims_pm_logfile); 00618 ims_pm_init_pcscf(); 00619 #endif /* WITH_IMS_PM */ 00620 00621 cscf_icid_value_count = shm_malloc(sizeof(unsigned int)); 00622 *cscf_icid_value_count = 0; 00623 cscf_icid_value_count_lock = lock_alloc(); 00624 cscf_icid_value_count_lock = lock_init(cscf_icid_value_count_lock); 00625 00626 /* load the send_reply function from sl module */ 00627 sl_reply = find_export("sl_send_reply", 2, 0); 00628 if (!sl_reply) { 00629 LOG(L_ERR, "ERR"M_NAME":mod_init: This module requires sl module\n"); 00630 goto error; 00631 } 00632 00633 if(pcscf_persistency_mode==WITH_DATABASE_BULK || pcscf_persistency_mode==WITH_DATABASE_CACHE){ 00634 /* bind to the db module */ 00635 if (!pcscf_db_url) { 00636 LOG(L_ERR, "ERR:"M_NAME":mod_init: no db_url specified but DB has to be used " 00637 "(pcscf_persistency_mode=%d\n", pcscf_persistency_mode); 00638 return -1; 00639 } 00640 if (bind_dbmod(pcscf_db_url, &pcscf_dbf) < 0) { /* Find database module */ 00641 LOG(L_ERR, "ERR"M_NAME":mod_init: Can't bind database module via url %s\n", pcscf_db_url); 00642 return -1; 00643 } 00644 00645 if (!DB_CAPABILITY(pcscf_dbf, DB_CAP_ALL)) { 00646 LOG(L_ERR, "ERR:"M_NAME":mod_init: Database module does not implement all functions needed by the module\n"); 00647 return -1; 00648 } 00649 00650 pcscf_db = create_pcscf_db_connection(); 00651 if (!pcscf_db) { 00652 LOG(L_ERR, "ERR:"M_NAME": mod_init: Error while connecting database\n"); 00653 return -1; 00654 } 00655 00656 /* db lock */ 00657 db_lock = (gen_lock_t*)lock_alloc(); 00658 if(!db_lock){ 00659 LOG(L_ERR, "ERR:"M_NAME": mod_init: No memory left\n"); 00660 return -1; 00661 } 00662 lock_init(db_lock); 00663 00664 /* snapshot and step versions */ 00665 00666 subs_snapshot_version=(int*)shm_malloc(sizeof(int)); 00667 if(!subs_snapshot_version){ 00668 LOG(L_ERR, "ERR:"M_NAME":mod_init: subs_snapshot_version, no memory left\n"); 00669 return -1; 00670 } 00671 *subs_snapshot_version=0; 00672 00673 subs_step_version=(int*)shm_malloc(sizeof(int)); 00674 if(!subs_step_version){ 00675 LOG(L_ERR, "ERR:"M_NAME":mod_init: subs_step_version, no memory left\n"); 00676 return -1; 00677 } 00678 *subs_step_version=0; 00679 00680 dialogs_snapshot_version=(int*)shm_malloc(sizeof(int)); 00681 if(!dialogs_snapshot_version){ 00682 LOG(L_ERR, "ERR:"M_NAME":mod_init: dialogs_snapshot_version, no memory left\n"); 00683 return -1; 00684 } 00685 *dialogs_snapshot_version=0; 00686 00687 dialogs_step_version=(int*)shm_malloc(sizeof(int)); 00688 if(!dialogs_step_version){ 00689 LOG(L_ERR, "ERR:"M_NAME":mod_init: dialogs_step_version, no memory left\n"); 00690 return -1; 00691 } 00692 *dialogs_step_version=0; 00693 00694 registrar_snapshot_version=(int*)shm_malloc(sizeof(int)); 00695 if(!registrar_snapshot_version){ 00696 LOG(L_ERR, "ERR:"M_NAME":mod_init: registrar_snapshot_version, no memory left\n"); 00697 return -1; 00698 } 00699 *registrar_snapshot_version=0; 00700 00701 registrar_step_version=(int*)shm_malloc(sizeof(int)); 00702 if(!registrar_step_version){ 00703 LOG(L_ERR, "ERR:"M_NAME":mod_init: registrar_step_version, no memory left\n"); 00704 return -1; 00705 } 00706 *registrar_step_version=0; 00707 } 00708 00709 /* bind to the tm module */ 00710 if (!(load_tm = (load_tm_f)find_export("load_tm",NO_SCRIPT,0))) { 00711 LOG(L_ERR, "ERR:"M_NAME":mod_init: Can not import load_tm. This module requires tm module\n"); 00712 goto error; 00713 } 00714 if (load_tm(&tmb) == -1) 00715 goto error; 00716 00717 /* bind to the dialog module */ 00718 load_dlg = (bind_dlg_mod_f)find_export("bind_dlg_mod", -1, 0); 00719 if (!load_dlg) { 00720 LOG(L_ERR, "ERR:"M_NAME":mod_init: Can not import bind_dlg_mod. This module requires dialog module\n"); 00721 return -1; 00722 } 00723 if (load_dlg(&dialogb) != 0) { 00724 return -1; 00725 } 00726 00727 /* bind to the cdp module */ 00728 if (pcscf_use_e2){ 00729 if (!(load_cdp = (load_cdp_f)find_export("load_cdp",NO_SCRIPT,0))) { 00730 LOG(L_ERR, "DBG:"M_NAME":mod_init: Can not import load_cdp. This module requires cdp module.\n"); 00731 00732 LOG(L_ERR, "DBG:"M_NAME":mod_init: Usage of the e2 interface has been disabled.\n"); 00733 pcscf_use_e2 = 0; 00734 } 00735 if (load_cdp(&cdpb) == -1) 00736 goto error; 00737 } 00738 00739 /* init the registrar storage */ 00740 if (!r_storage_init(registrar_hash_size)) goto error; 00741 if (pcscf_persistency_mode!=NO_PERSISTENCY){ 00742 load_snapshot_registrar(); 00743 if (register_timer(persistency_timer_registrar,0,pcscf_persistency_timer_registrar)<0) goto error; 00744 } 00745 00746 /* register the registrar timer */ 00747 if (register_timer(registrar_timer,registrar,10)<0) goto error; 00748 00749 /* init the registrar subscriptions */ 00750 if (!r_subscription_init()) goto error; 00751 if (pcscf_persistency_mode!=NO_PERSISTENCY){ 00752 load_snapshot_subscriptions(); 00753 if (register_timer(persistency_timer_subscriptions,0,pcscf_persistency_timer_subscriptions)<0) goto error; 00754 } 00755 00756 /* register the subscription timer */ 00757 if (register_timer(subscription_timer,registrar,10)<0) goto error; 00758 00759 /* init the dialog storage */ 00760 if (!p_dialogs_init(pcscf_dialogs_hash_size)){ 00761 LOG(L_ERR, "ERR"M_NAME":mod_init: Error initializing the Hash Table for stored dialogs\n"); 00762 goto error; 00763 } 00764 pcscf_dialog_count = shm_malloc(sizeof(int)); 00765 *pcscf_dialog_count = 0; 00766 pcscf_dialog_count_lock = lock_alloc(); 00767 pcscf_dialog_count_lock = lock_init(pcscf_dialog_count_lock); 00768 00769 if (pcscf_persistency_mode!=NO_PERSISTENCY){ 00770 load_snapshot_dialogs(); 00771 if (register_timer(persistency_timer_dialogs,0,pcscf_persistency_timer_dialogs)<0) goto error; 00772 } 00773 00774 /* register the dialog timer */ 00775 if (register_timer(dialog_timer,p_dialogs,60)<0) goto error; 00776 00777 if (pcscf_nat_enable) 00778 if(!nat_prepare_1918addr()) goto error; 00779 00780 /* rtp proxy initilazition */ 00781 if (pcscf_nat_enable && rtpproxy_enable) 00782 if (!rtpproxy_init()) goto error; 00783 00784 if (pcscf_use_tls) 00785 { 00786 get_tls_session_hash = (void *)find_export("get_tls_session_hash", 0, 0); 00787 if (! get_tls_session_hash) { 00788 LOG(L_ERR,"ERR:"M_NAME":mod_init: get_tls_session_hash not found !\n"); 00789 goto error; 00790 } 00791 } 00792 return 0; 00793 error: 00794 return -1; 00795 }
| static int mod_child_init | ( | int | rank | ) | [static] |
Initializes the module in child.
Definition at line 807 of file mod.c.
References M_NAME, parser_init(), pcscf_nat_enable, pcscf_reginfo_dtd, rtpproxy_child_init(), and rtpproxy_enable.
00808 { 00809 LOG(L_INFO,"INFO:"M_NAME":mod_init: Initialization of module in child [%d] \n", 00810 rank); 00811 /* don't do anything for main process and TCP manager process */ 00812 if ( rank == PROC_MAIN || rank == PROC_TCP_MAIN ) 00813 return 0; 00814 00815 /* Init the user data parser */ 00816 if (!parser_init(pcscf_reginfo_dtd)) return -1; 00817 00818 00819 /* rtpproxy child init */ 00820 if (pcscf_nat_enable && rtpproxy_enable) 00821 if (!rtpproxy_child_init(rank)) return -1; 00822 00823 return 0; 00824 }
| static void mod_destroy | ( | void | ) | [static] |
Destroys the module.
Definition at line 829 of file mod.c.
References close_pcscf_db_connection(), M_NAME, make_snapshot_dialogs(), make_snapshot_registrar(), make_snapshot_subscriptions(), NO_PERSISTENCY, NULL, p_dialogs_destroy(), parser_destroy(), pcscf_db, pcscf_dialog_count, pcscf_dialog_count_lock, pcscf_persistency_mode, process_lock, r_storage_destroy(), r_subscription_destroy(), shutdown_singleton, WITH_DATABASE_BULK, and WITH_DATABASE_CACHE.
00830 { 00831 int do_destroy=0; 00832 LOG(L_INFO,"INFO:"M_NAME":mod_destroy: child exit\n"); 00833 lock_get(process_lock); 00834 if((*shutdown_singleton)==0){ 00835 *shutdown_singleton=1; 00836 do_destroy=1; 00837 } 00838 lock_release(process_lock); 00839 if (do_destroy){ 00840 if (pcscf_persistency_mode!=NO_PERSISTENCY){ 00841 /* First let's snapshot everything */ 00842 make_snapshot_dialogs(); 00843 make_snapshot_registrar(); 00844 make_snapshot_subscriptions(); 00845 } 00846 /* Then nuke it all */ 00847 parser_destroy(); 00848 r_subscription_destroy(); 00849 r_storage_destroy(); 00850 p_dialogs_destroy(); 00851 lock_get(pcscf_dialog_count_lock); 00852 shm_free(pcscf_dialog_count); 00853 lock_destroy(pcscf_dialog_count_lock); 00854 } 00855 00856 if ( (pcscf_persistency_mode==WITH_DATABASE_BULK || pcscf_persistency_mode==WITH_DATABASE_CACHE) && pcscf_db) { 00857 DBG("INFO:"M_NAME": ... closing db connection\n"); 00858 close_pcscf_db_connection(pcscf_db); 00859 } 00860 pcscf_db = NULL; 00861 00862 #ifdef WITH_IMS_PM 00863 ims_pm_destroy(); 00864 #endif /* WITH_IMS_PM */ 00865 }
| int fix_parameters | ( | ) |
Fix the configuration parameters.
Definition at line 489 of file mod.c.
References cscf_icid_gen_addr, cscf_icid_gen_addr_str, cscf_icid_value_prefix, cscf_icid_value_prefix_str, cscf_orig_ioi, cscf_orig_ioi_str, cscf_term_ioi, cscf_term_ioi_str, forced_clf_peer, forced_clf_peer_str, M_NAME, path_str_1, path_str_e, path_str_s, pcscf_name, pcscf_name_str, pcscf_path_hdr_str, pcscf_path_str, pcscf_record_route_mo, pcscf_record_route_mo_uri, pcscf_record_route_mt, pcscf_record_route_mt_uri, s_mo, s_mt, s_record_route_e, s_record_route_s, and STR_APPEND.
00490 { 00491 str x; 00492 00493 pcscf_name_str.s = pcscf_name; 00494 pcscf_name_str.len = strlen(pcscf_name); 00495 00496 x = pcscf_name_str; 00497 if (pcscf_name_str.len>=4 && 00498 strncasecmp(pcscf_name_str.s,"sip:",4)==0) 00499 { 00500 x.s += 4; 00501 x.len -= 4; 00502 } 00503 pcscf_path_str.len = path_str_1.len+x.len; 00504 pcscf_path_str.s = pkg_malloc(pcscf_path_str.len); 00505 if (!pcscf_path_str.s){ 00506 LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n", 00507 pcscf_path_str.len); 00508 pcscf_path_str.len=0; 00509 return 0; 00510 } 00511 pcscf_path_str.len=0; 00512 STR_APPEND(pcscf_path_str,path_str_1); 00513 STR_APPEND(pcscf_path_str,x); 00514 00515 pcscf_path_hdr_str.len = path_str_s.len + pcscf_path_str.len + path_str_e.len; 00516 pcscf_path_hdr_str.s = pkg_malloc(pcscf_path_hdr_str.len); 00517 if (!pcscf_path_hdr_str.s){ 00518 LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n", 00519 pcscf_path_hdr_str.len); 00520 pcscf_path_hdr_str.len=0; 00521 return 0; 00522 } 00523 pcscf_path_hdr_str.len=0; 00524 STR_APPEND(pcscf_path_hdr_str,path_str_s); 00525 STR_APPEND(pcscf_path_hdr_str,pcscf_path_str); 00526 STR_APPEND(pcscf_path_hdr_str,path_str_e); 00527 00528 cscf_icid_value_prefix_str.s = cscf_icid_value_prefix; 00529 cscf_icid_value_prefix_str.len = strlen(cscf_icid_value_prefix); 00530 00531 cscf_icid_gen_addr_str.s = cscf_icid_gen_addr; 00532 cscf_icid_gen_addr_str.len = strlen(cscf_icid_gen_addr); 00533 00534 cscf_orig_ioi_str.s = cscf_orig_ioi; 00535 cscf_orig_ioi_str.len = strlen(cscf_orig_ioi); 00536 00537 cscf_term_ioi_str.s = cscf_term_ioi; 00538 cscf_term_ioi_str.len = strlen(cscf_term_ioi); 00539 00540 00541 /* Record-routes */ 00542 pcscf_record_route_mo.s = pkg_malloc(s_record_route_s.len+s_mo.len+pcscf_name_str.len+s_record_route_e.len); 00543 if (!pcscf_record_route_mo.s){ 00544 LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n", 00545 s_record_route_s.len+s_mo.len+pcscf_name_str.len+s_record_route_e.len); 00546 return 0; 00547 } 00548 pcscf_record_route_mt.s = pkg_malloc(s_record_route_s.len+s_mt.len+pcscf_name_str.len+s_record_route_e.len); 00549 if (!pcscf_record_route_mt.s){ 00550 LOG(L_ERR, "ERR"M_NAME":mod_init: Error allocating %d bytes\n", 00551 s_record_route_s.len+s_mt.len+pcscf_name_str.len+s_record_route_e.len); 00552 return 0; 00553 } 00554 00555 pcscf_record_route_mo.len=0; 00556 STR_APPEND(pcscf_record_route_mo,s_record_route_s); 00557 if (pcscf_name_str.len>4 && strncasecmp(pcscf_name_str.s,"sip:",4)==0){ 00558 STR_APPEND(pcscf_record_route_mo,s_mo); 00559 memcpy(pcscf_record_route_mo.s+pcscf_record_route_mo.len,pcscf_name_str.s+4, 00560 pcscf_name_str.len-4); 00561 pcscf_record_route_mo.len += pcscf_name_str.len-4; 00562 } else { 00563 STR_APPEND(pcscf_record_route_mo,s_mo); 00564 STR_APPEND(pcscf_record_route_mo,pcscf_name_str); 00565 } 00566 STR_APPEND(pcscf_record_route_mo,s_record_route_e); 00567 pcscf_record_route_mo_uri.s = pcscf_record_route_mo.s + s_record_route_s.len; 00568 pcscf_record_route_mo_uri.len = pcscf_record_route_mo.len - s_record_route_s.len - s_record_route_e.len; 00569 00570 pcscf_record_route_mt.len=0; 00571 STR_APPEND(pcscf_record_route_mt,s_record_route_s); 00572 if (pcscf_name_str.len>4 && strncasecmp(pcscf_name_str.s,"sip:",4)==0){ 00573 STR_APPEND(pcscf_record_route_mt,s_mt); 00574 memcpy(pcscf_record_route_mt.s+pcscf_record_route_mt.len,pcscf_name_str.s+4, 00575 pcscf_name_str.len-4); 00576 pcscf_record_route_mt.len += pcscf_name_str.len-4; 00577 } else { 00578 STR_APPEND(pcscf_record_route_mt,s_mt); 00579 STR_APPEND(pcscf_record_route_mt,pcscf_name_str); 00580 } 00581 STR_APPEND(pcscf_record_route_mt,s_record_route_e); 00582 pcscf_record_route_mt_uri.s = pcscf_record_route_mt.s + s_record_route_s.len; 00583 pcscf_record_route_mt_uri.len = pcscf_record_route_mt.len - s_record_route_s.len - s_record_route_e.len; 00584 00585 /* fix the parameters */ 00586 forced_clf_peer_str.s = forced_clf_peer; 00587 forced_clf_peer_str.len = strlen(forced_clf_peer); 00588 return 1; 00589 }
| db_con_t* create_pcscf_db_connection | ( | ) |
Definition at line 591 of file mod.c.
References NULL, pcscf_db_url, pcscf_dbf, pcscf_persistency_mode, WITH_DATABASE_BULK, and WITH_DATABASE_CACHE.
Referenced by mod_init().
00592 { 00593 if (pcscf_persistency_mode!=WITH_DATABASE_BULK && pcscf_persistency_mode!=WITH_DATABASE_CACHE) return NULL; 00594 if (!pcscf_dbf.init) return NULL; 00595 00596 return pcscf_dbf.init(pcscf_db_url); 00597 }
| void close_pcscf_db_connection | ( | db_con_t * | db | ) |
| int P_trans_in_processing | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) |
Checks if the transaction is in processing.
| msg | - the SIP message to check | |
| str1 | - not used | |
| str2 | - not used |
Definition at line 875 of file mod.c.
References CSCF_RETURN_FALSE, CSCF_RETURN_TRUE, and tmb.
00876 { 00877 unsigned int hash, label; 00878 if (tmb.t_get_trans_ident(msg,&hash,&label)<0) 00879 return CSCF_RETURN_FALSE; 00880 return CSCF_RETURN_TRUE; 00881 }
| char* pcscf_name = "sip:pcscf.open-ims.test:4060" |
SIP URI of this P-CSCF.
Definition at line 100 of file mod.c.
Referenced by bin_bulk_dump_to_table(), bin_bulk_load_from_table(), bin_cache_dump_dialogs_to_table(), bin_cache_dump_registrar_to_table(), bin_cache_dump_subs_to_table(), bin_cache_load_dialogs_from_table(), bin_cache_load_registrar_from_table(), bin_cache_load_subscriptions_from_table(), and fix_parameters().
| char* cscf_icid_value_prefix |
| unsigned int* cscf_icid_value_count |
| gen_lock_t* cscf_icid_value_count_lock |
| char* cscf_icid_gen_addr |
| char* cscf_orig_ioi |
| char* cscf_term_ioi |
| int pcscf_use_ipsec = 0 |
whether to use or not ipsec
Definition at line 112 of file mod.c.
Referenced by cscf_get_pref_security_header(), P_security_200(), P_security_401(), and P_security_relay().
| char* pcscf_ipsec_host = "127.0.0.1" |
IP for protected server.
Definition at line 113 of file mod.c.
Referenced by P_security_200(), P_security_401(), and P_security_drop().
| int pcscf_ipsec_port_c = 4060 |
PORT for protected client.
Definition at line 114 of file mod.c.
Referenced by P_security_200(), P_security_401(), P_security_drop(), and P_verify_security().
| int pcscf_ipsec_port_s = 4060 |
PORT for protected server.
Definition at line 115 of file mod.c.
Referenced by P_security_200(), P_security_401(), P_security_drop(), and P_verify_security().