Changeset 1214:c2fbaf2985f4 in freeDiameter for extensions
- Timestamp:
- Jun 18, 2013, 5:27:45 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- extensions/test_app
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/test_app/ta_cli.c
r1088 r1214 182 182 TRACE_DEBUG(FULL, "Creating a new message for sending."); 183 183 184 /* Create the request from template*/184 /* Create the request */ 185 185 CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out ); 186 186 … … 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 254 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out ); 242 255 -
extensions/test_app/ta_conf.l
r1127 r1214 118 118 } 119 119 120 (?i:"long-avp-id") { 121 return LONG_AVP_ID; 122 } 123 124 (?i:"long-avp-len") { 125 return LONG_AVP_LEN; 126 } 127 120 128 (?i:"mode") { 121 129 return MODE; -
extensions/test_app/ta_conf.y
r1127 r1214 121 121 %token CMD_ID 122 122 %token AVP_ID 123 %token LONG_AVP_ID 124 %token LONG_AVP_LEN 123 125 %token MODE 124 126 %token DEST_REALM … … 146 148 | conffile cmd 147 149 | conffile avp 150 | conffile long_avp_id 151 | conffile long_avp_len 148 152 | conffile mode 149 153 | conffile dstrealm … … 178 182 ; 179 183 184 long_avp_id: LONG_AVP_ID '=' INTEGER ';' 185 { 186 ta_conf->long_avp_id = $3; 187 } 188 ; 189 190 long_avp_len: LONG_AVP_LEN '=' INTEGER ';' 191 { 192 ta_conf->long_avp_len = $3; 193 } 194 ; 195 180 196 mode: MODE '=' INTEGER ';' 181 197 { -
extensions/test_app/ta_dict.c
r741 r1214 43 43 struct dict_object * ta_cmd_a = NULL; 44 44 struct dict_object * ta_avp = NULL; 45 struct dict_object * ta_avp_long = NULL; 45 46 46 47 struct dict_object * ta_sess_id = NULL; … … 95 96 data.avp_basetype = AVP_TYPE_INTEGER32; 96 97 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp)); 98 } 99 100 /* Create the Test Payload AVP */ 101 if (ta_conf->long_avp_id) { 102 struct dict_avp_data data; 103 data.avp_code = ta_conf->long_avp_id; 104 data.avp_vendor = ta_conf->vendor_id; 105 data.avp_name = "Test-Payload-AVP"; 106 data.avp_flag_mask = AVP_FLAG_VENDOR; 107 data.avp_flag_val = AVP_FLAG_VENDOR; 108 data.avp_basetype = AVP_TYPE_OCTETSTRING; 109 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp_long)); 97 110 } 98 111 -
extensions/test_app/ta_serv.c
r1127 r1214 95 95 } 96 96 97 /* Set the Test-Payload-AVP AVP */ 98 if (ta_conf->long_avp_id) { 99 struct avp * src = NULL; 100 struct avp_hdr * hdr = NULL; 101 102 CHECK_FCT( fd_msg_search_avp ( qry, ta_avp_long, &src) ); 103 CHECK_FCT( fd_msg_avp_hdr( src, &hdr ) ); 104 105 CHECK_FCT( fd_msg_avp_new ( ta_avp_long, 0, &avp ) ); 106 CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) ); 107 CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) ); 108 } 109 110 97 111 /* Set the Origin-Host, Origin-Realm, Result-Code AVPs */ 98 112 CHECK_FCT( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ) ); -
extensions/test_app/test_app.c
r1199 r1214 55 55 ta_conf->cmd_id = 0xfffffe; /* Experimental */ 56 56 ta_conf->avp_id = 0xffffff; /* dummy value */ 57 ta_conf->long_avp_len = 5000; 57 58 ta_conf->mode = MODE_SERV | MODE_CLI; 58 59 ta_conf->dest_realm = strdup(fd_g_config->cnf_diamrlm); … … 77 78 fd_log_debug( " Command Id ......... : %u", ta_conf->cmd_id); 78 79 fd_log_debug( " AVP Id ............. : %u", ta_conf->avp_id); 80 fd_log_debug( " Long AVP Id ........ : %u", ta_conf->long_avp_id); 81 fd_log_debug( " Long AVP len ....... : %zu", ta_conf->long_avp_len); 79 82 fd_log_debug( " Mode ............... : %s%s%s", ta_conf->mode & MODE_SERV ? "Serv" : "", ta_conf->mode & MODE_CLI ? "Cli" : "", ta_conf->mode & MODE_BENCH ? " (Benchmark)" : ""); 80 83 fd_log_debug( " Destination Realm .. : %s", ta_conf->dest_realm ?: "- none -"); -
extensions/test_app/test_app.h
r741 r1214 60 60 uint32_t cmd_id; /* default 234567 */ 61 61 uint32_t avp_id; /* default 345678 */ 62 uint32_t long_avp_id; /* default 0 */ 63 size_t long_avp_len; /* default 5000 */ 62 64 int mode; /* default MODE_SERV | MODE_CLI */ 63 65 char * dest_realm; /* default local realm */ … … 105 107 extern struct dict_object * ta_cmd_a; 106 108 extern struct dict_object * ta_avp; 109 extern struct dict_object * ta_avp_long; 107 110 108 111 extern struct dict_object * ta_sess_id;
Note: See TracChangeset
for help on using the changeset viewer.