Changeset 420:c8a61dabea55 in freeDiameter for extensions/test_sip
- Timestamp:
- Jul 19, 2010, 4:46:33 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- extensions/test_sip
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/test_sip/CMakeLists.txt
r381 r420 9 9 test_sip.c 10 10 test_sip.h 11 multimediaauth.c 12 locationinfo.c 13 registrationtermination.c 11 14 ) 12 15 -
extensions/test_sip/test_sip.c
r409 r420 38 38 #include"test_sip.h" 39 39 40 40 struct disp_hdl * test_sip_MAR_hdl=NULL; 41 struct disp_hdl * test_sip_LIR_hdl=NULL; 42 struct disp_hdl * test_sip_UAR_hdl=NULL; 43 struct disp_hdl * test_sip_SAR_hdl=NULL; 44 struct disp_hdl * test_sip_PPA_hdl=NULL; 45 struct disp_hdl * test_sip_RTA_hdl=NULL; 41 46 42 47 struct disp_hdl * test_sip_MAA_hdl=NULL; … … 53 58 //configuration stucture 54 59 struct ts_conf * ts_conf=NULL; 55 static struct ts_conf app_sip_conf; 60 static struct ts_conf test_sip_conf; 61 56 62 57 63 //dictionary of SIP 58 struct test_sip_dict sip_dict;64 struct sip_dict sip_dict; 59 65 60 66 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act) … … 65 71 } 66 72 67 username = "awestfahl" 68 password = "test" 69 sip_aor = "sip:awestfahl@tera.ics.keio.ac.jp" 70 71 #Destination information 72 destination_realm = "freediameter.net" 73 destination_sip = "sip:awestfahl@freediameter.net" 74 73 74 /* 75 75 void dump_config() 76 76 { … … 83 83 TRACE_DEBUG(FULL,"***End of TEST Diameter-SIP configuration extension***"); 84 84 } 85 85 */ 86 86 static int ts_conf_init(void) 87 87 { … … 94 94 95 95 /* entry point */ 96 int as_entry(char * conffile)96 int ts_entry(char * conffile) 97 97 { 98 98 TRACE_ENTRY("%p", conffile); … … 101 101 struct disp_when data; 102 102 103 /* Initialize configuration */104 CHECK_FCT( ts_conf_init() );103 /* Initialize configuration 104 //CHECK_FCT( ts_conf_init() ); 105 105 106 106 … … 116 116 //We can dump the configuration extracted from app_sip.conf 117 117 dump_config(); 118 */ 119 118 120 119 121 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Session Initiation Protocol (SIP) Application", &app, ENOENT) ); … … 125 127 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Session-State", &sip_dict.Auth_Session_State, ENOENT) ); 126 128 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Application-Id", &sip_dict.Auth_Application_Id, ENOENT) ); 129 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &sip_dict.Destination_Host, ENOENT) ); 130 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &sip_dict.Destination_Realm, ENOENT) ); 131 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &sip_dict.Session_Id, ENOENT) ); 127 132 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Auth-Data-Item", &sip_dict.SIP_Auth_Data_Item, ENOENT) ); 128 133 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Authorization", &sip_dict.SIP_Authorization, ENOENT) ); … … 134 139 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Method", &sip_dict.SIP_Method, ENOENT) ); 135 140 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-AOR", &sip_dict.SIP_AOR, ENOENT) ); 141 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Deregistration-Reason", &sip_dict.SIP_Deregistration_Reason, ENOENT) ); 142 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Reason-Code", &sip_dict.SIP_Reason_Code, ENOENT) ); 143 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Reason-Info", &sip_dict.SIP_Reason_Info, ENOENT) ); 136 144 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Digest-Realm", &sip_dict.Digest_Realm, ENOENT) ); 137 145 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Digest-URI", &sip_dict.Digest_URI, ENOENT) ); … … 157 165 158 166 //**Command Codes 167 /**/ 159 168 //MAR 160 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Multimedia-Auth-Request", &data.command, ENOENT) ); 161 CHECK_FCT( fd_disp_register( test_sip_MAR_cb, DISP_HOW_CC, &data, &test_sip_MAR_hdl ) ); 169 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Multimedia-Auth-Answer", &data.command, ENOENT) ); 170 CHECK_FCT( fd_disp_register( test_sip_MAA_cb, DISP_HOW_CC, &data, &test_sip_MAA_hdl ) ); 171 162 172 //RTR 163 173 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Registration-Termination-Request", &data.command, ENOENT) ); 164 CHECK_FCT( fd_disp_register( test_sip_RTR_cb, DISP_HOW_CC, &data, &test_sip_RTA_hdl ) ); 174 CHECK_FCT( fd_disp_register( test_sip_RTR_cb, DISP_HOW_CC, &data, &test_sip_RTR_hdl ) ); 175 176 //LIA 177 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Location-Info-Answer", &data.command, ENOENT) ); 178 CHECK_FCT( fd_disp_register( test_sip_LIA_cb, DISP_HOW_CC, &data, &test_sip_LIA_hdl ) ); 165 179 166 180 … … 168 182 CHECK_FCT( fd_disp_register( test_sip_default_cb, DISP_HOW_APPID, &data, &test_sip_default_hdl ) ); 169 183 170 184 /* 171 185 //We start database connection 172 186 if(start_mysql_connection()) 173 187 return 1; 174 175 CHECK_FCT(fd_sess_handler_create(&ds_sess_hdl, free)); 188 */ 189 190 CHECK_FCT(fd_sess_handler_create(&ts_sess_hdl, free)); 191 CHECK_FCT( fd_sig_register(30, "test_sip", (void *)test_sip_LIR_cb ) ); 176 192 177 193 return 0; … … 181 197 void fd_ext_fini(void) 182 198 { 183 199 /* 184 200 if (test_sip_MAR_cb) { 185 201 (void) fd_disp_unregister(&test_sip_MAR_hdl); 186 202 CHECK_FCT_DO( fd_sess_handler_destroy(&ds_sess_hdl),return); 187 203 } 188 204 */ 189 205 //We close database connection 190 close_mysql_connection();206 //close_mysql_connection(); 191 207 192 208 -
extensions/test_sip/test_sip.h
r409 r420 34 34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 35 35 *********************************************************************************************************/ 36 36 #include <freeDiameter/extension.h> 37 #include <sys/time.h> 38 #include <stdint.h> 39 #include <stdlib.h> 40 #include <stdio.h> 41 #include <gcrypt.h> 42 #include <string.h> 43 #include <mysql.h> 37 44 38 45 /* The module configuration */ 39 struct t est_sip_conf {46 struct ts_conf { 40 47 char * destination_sip; 41 48 char * destination_realm; … … 44 51 char * sip_aor; 45 52 }; 46 extern struct test_sip_conf * test_sip_conf; 47 53 extern struct ts_conf * ts_conf; 48 54 49 55 //Storage for some usefull AVPs … … 51 57 struct dict_object * Auth_Session_State; 52 58 struct dict_object * Auth_Application_Id; 59 struct dict_object * Destination_Host; 60 struct dict_object * Destination_Realm; 53 61 struct dict_object * User_Name; 62 struct dict_object * Session_Id; 54 63 struct dict_object * SIP_Auth_Data_Item; 55 64 struct dict_object * SIP_Authorization; … … 61 70 struct dict_object * SIP_Method; 62 71 struct dict_object * SIP_AOR; 72 struct dict_object * SIP_Deregistration_Reason; 73 struct dict_object * SIP_Reason_Code; 74 struct dict_object * SIP_Reason_Info; 63 75 struct dict_object * Digest_URI; 64 76 struct dict_object * Digest_Nonce; … … 76 88 77 89 extern struct sip_dict sip_dict; 90 extern struct session_handler * ts_sess_hdl; 78 91 92 int ts_entry(); 93 void fd_ext_fini(void); 79 94 80 95 int test_sip_LIR_cb(); 81 96 82 97 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act); 83 98 int test_sip_MAA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act); 84 99 int test_sip_RTR_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act); 100 int test_sip_LIA_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act); 85 101 86
Note: See TracChangeset
for help on using the changeset viewer.