diff 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
line wrap: on
line diff
--- a/extensions/test_app/ta_cli.c	Tue Jun 18 12:44:30 2013 +0800
+++ b/extensions/test_app/ta_cli.c	Tue Jun 18 16:27:45 2013 +0800
@@ -181,7 +181,7 @@
 	
 	TRACE_DEBUG(FULL, "Creating a new message for sending.");
 	
-	/* Create the request from template */
+	/* Create the request */
 	CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out );
 	
 	/* Create a new session */
@@ -238,6 +238,19 @@
 		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
 	}
 	
+	/* Set the Test-Payload-AVP AVP */
+	if (ta_conf->long_avp_id) {
+		int l;
+		CHECK_FCT_DO( fd_msg_avp_new ( ta_avp_long, 0, &avp ), goto out  );
+		CHECK_MALLOC_DO( val.os.data = malloc(ta_conf->long_avp_len), goto out);
+		val.os.len = ta_conf->long_avp_len;
+		for (l=0; l < ta_conf->long_avp_len; l++)
+			val.os.data[l]=l;
+		CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out  );
+		free(val.os.data);
+		CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out  );
+	}
+	
 	CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out );
 	
 	/* Keep a pointer to the session data for debug purpose, in real life we would not need it */
"Welcome to our mercurial repository"