comparison extensions/test_app/ta_cli.c @ 1214:c2fbaf2985f4

New options to test_app extension to generate long Diameter messages
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 18 Jun 2013 16:27:45 +0800
parents 1d1a20a0779d
children 035f489b845b
comparison
equal deleted inserted replaced
1213:b1c4876b1896 1214:c2fbaf2985f4
179 struct sess_state * mi = NULL, *svg; 179 struct sess_state * mi = NULL, *svg;
180 struct session *sess = NULL; 180 struct session *sess = NULL;
181 181
182 TRACE_DEBUG(FULL, "Creating a new message for sending."); 182 TRACE_DEBUG(FULL, "Creating a new message for sending.");
183 183
184 /* Create the request from template */ 184 /* Create the request */
185 CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out ); 185 CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
186 186
187 /* Create a new session */ 187 /* Create a new session */
188 #define TEST_APP_SID_OPT "app_test" 188 #define TEST_APP_SID_OPT "app_test"
189 CHECK_FCT_DO( fd_msg_new_session( req, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out ); 189 CHECK_FCT_DO( fd_msg_new_session( req, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out );
236 val.i32 = mi->randval; 236 val.i32 = mi->randval;
237 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); 237 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out );
238 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out ); 238 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out );
239 } 239 }
240 240
241 /* Set the Test-Payload-AVP AVP */
242 if (ta_conf->long_avp_id) {
243 int l;
244 CHECK_FCT_DO( fd_msg_avp_new ( ta_avp_long, 0, &avp ), goto out );
245 CHECK_MALLOC_DO( val.os.data = malloc(ta_conf->long_avp_len), goto out);
246 val.os.len = ta_conf->long_avp_len;
247 for (l=0; l < ta_conf->long_avp_len; l++)
248 val.os.data[l]=l;
249 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out );
250 free(val.os.data);
251 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out );
252 }
253
241 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out ); 254 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );
242 255
243 /* Keep a pointer to the session data for debug purpose, in real life we would not need it */ 256 /* Keep a pointer to the session data for debug purpose, in real life we would not need it */
244 svg = mi; 257 svg = mi;
245 258
"Welcome to our mercurial repository"