Changeset 392:8e260030f32c in freeDiameter for extensions/app_sip/diamsip.c
- Timestamp:
- Jul 6, 2010, 7:50:52 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_sip/diamsip.c
r368 r392 40 40 struct session_handler * ds_sess_hdl; 41 41 42 //configuration stucture 43 struct as_conf * as_conf=NULL; 44 static struct as_conf app_sip_conf; 45 46 //dictionary of SIP 42 47 struct diamsip_dict sip_dict; 43 48 44 49 int diamsip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act) 45 50 { 46 47 51 TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act); 48 49 52 50 53 return 0; 51 54 } 52 55 56 void dump_config() 57 { 58 TRACE_DEBUG(FULL,"***Configuration of Diameter-SIP extension***"); 59 TRACE_DEBUG(FULL,"# mode: *%d*",as_conf->mode); 60 TRACE_DEBUG(FULL,"# datasource: *%d*",as_conf->datasource); 61 TRACE_DEBUG(FULL,"# mysql_login: *%s*",as_conf->mysql_login); 62 TRACE_DEBUG(FULL,"# mysql_password: *%s*",as_conf->mysql_password); 63 TRACE_DEBUG(FULL,"# mysql_database: *%s*",as_conf->mysql_database); 64 TRACE_DEBUG(FULL,"# mysql_server: *%s*",as_conf->mysql_server); 65 TRACE_DEBUG(FULL,"# mysql_port: *%d*",as_conf->mysql_port); 66 TRACE_DEBUG(FULL,"***End of Diameter-SIP configuration extension***"); 67 } 68 69 static int as_conf_init(void) 70 { 71 as_conf=&app_sip_conf; 72 //memset(app_sip_conf, 0, sizeof(struct as_conf)); 73 74 75 return 0; 76 } 77 53 78 /* entry point */ 54 int ds_entry()79 int as_entry(char * conffile) 55 80 { 81 TRACE_ENTRY("%p", conffile); 82 56 83 struct dict_object * app=NULL; 57 84 struct disp_when data; 85 86 /* Initialize configuration */ 87 CHECK_FCT( as_conf_init() ); 88 89 90 //We parse the configuration file 91 if (conffile != NULL) { 92 CHECK_FCT( as_conf_handle(conffile) ); 93 } 94 else 95 { 96 TRACE_DEBUG(INFO, "We need a configuration file for Diameter-SIP extension. See doc/ for an example."); 97 } 98 99 //We can dump the configuration extracted from app_sip.conf 100 //dump_config(); 58 101 59 102 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Session Initiation Protocol (SIP) Application", &app, ENOENT) ); … … 105 148 //TRACE_DEBUG(INFO,"*%s*%s*%s*%s*",DB_SERVER,DB_USERNAME, DB_PASSWORD, DB_DATABASE); 106 149 //We start database connection 107 if(start_mysql_connection( DB_SERVER,DB_USERNAME, DB_PASSWORD, DB_DATABASE))150 if(start_mysql_connection()) 108 151 return 1; 109 152 … … 131 174 } 132 175 133 EXTENSION_ENTRY("diam_sip", ds_entry); 134 135 136 /* 137 138 139 140 141 142 143 test set for digest calculate 144 145 TRACE_DEBUG(FULL,"TEST"); 146 DigestCalcHA1("MD5", "12345678", "example.com", "secret", "3bada1a0","56593a80", HA1); 147 TRACE_DEBUG(FULL,"TEST->HA1 done: *%s*",HA1); 148 DigestCalcResponse(HA1, "3bada1a0", "00000001", "56593a80", "auth","INVITE", "sip:97226491335@example.com", HA2, response); 149 DigestCalcResponseAuth(HA1, "3bada1a0", "00000001", "56593a80", "auth","INVITE", "sip:97226491335@example.com", HA2, responseauth); 150 151 152 153 154 155 156 old digest reponse check 157 158 struct avp_hdr * tempavphdr=NULL; 159 160 161 CHECK_FCT(fd_msg_browse ( avp, MSG_BRW_WALK, &tempavp, NULL) ); 162 163 while(tempavp) 164 { 165 CHECK_FCT( fd_msg_avp_hdr( tempavp, &tempavphdr ) ); 166 167 if(tempavphdr->avp_code==380) 168 { 169 found_response=0; 170 //We have not found it but we finished looking in this Auth-Data-Item 171 tempavp=NULL; 172 } 173 else if(tempavphdr->avp_code==103) 174 { 175 found_response=1; 176 //We found it, we can leave the loop 177 tempavp=NULL; 178 } 179 else 180 { 181 CHECK_FCT(fd_msg_browse ( tempavp, MSG_BRW_WALK, &tempavp, NULL) ); 182 } 183 } 184 */ 176 EXTENSION_ENTRY("app_sip", as_entry);
Note: See TracChangeset
for help on using the changeset viewer.