Mercurial > hg > freeDiameter
annotate extensions/test_app/ta_cli.c @ 1554:566bb46cc73f
Updated copyright information
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Tue, 06 Oct 2020 21:34:53 +0800 |
parents | 84a3c9c4b834 |
children |
rev | line source |
---|---|
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
740
4a9f08d6b6ba
Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
706
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
1554
566bb46cc73f
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1305
diff
changeset
|
5 * Copyright (c) 2016, WIDE Project and NICT * |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 /* Create and send a message, and receive it */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 /* Note that we use both sessions and the argument to answer callback to pass the same value. |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 * This is just for the purpose of checking everything went OK. |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
42 #include "test_app.h" |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 |
98 | 44 #include <stdio.h> |
45 | |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
46 static struct session_handler * ta_cli_reg = NULL; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
47 |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
930
diff
changeset
|
48 struct sess_state { |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
49 int32_t randval; /* a random value to store in Test-AVP */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 struct timespec ts; /* Time of sending the message */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 } ; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 /* Cb called when an answer is received */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
54 static void ta_cb_ans(void * data, struct msg ** msg) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
55 { |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
930
diff
changeset
|
56 struct sess_state * mi = NULL; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
57 struct timespec ts; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
58 struct session * sess; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 struct avp * avp; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 struct avp_hdr * hdr; |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
61 unsigned long dur; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
62 int error = 0; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), return ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
65 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 /* Search the session, retrieve its data */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 int new; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &sess, &new), return ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 ASSERT( new == 0 ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
72 CHECK_FCT_DO( fd_sess_state_retrieve( ta_cli_reg, sess, &mi ), return ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 ASSERT( (void *)mi == data ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 /* Now log content of the answer */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 fprintf(stderr, "RECV "); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
78 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 /* Value of Test-AVP */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
80 CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_avp, &avp), return ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 if (avp) { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return ); |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
83 if (hdr->avp_value->i32 == mi->randval) { |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
84 fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, "Ok"); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
85 } else { |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
86 fprintf(stderr, "%x (%s) ", hdr->avp_value->i32, "PROBLEM"); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
87 error++; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
88 } |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 } else { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 fprintf(stderr, "no_Test-AVP "); |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
91 error++; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
92 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 /* Value of Result Code */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
95 CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_res_code, &avp), return ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 if (avp) { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
97 CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 fprintf(stderr, "Status: %d ", hdr->avp_value->i32); |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
99 if (hdr->avp_value->i32 != 2001) |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
100 error++; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
101 } else { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
102 fprintf(stderr, "no_Result-Code "); |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
103 error++; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
104 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
105 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
106 /* Value of Origin-Host */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
107 CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_host, &avp), return ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
108 if (avp) { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
109 CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return ); |
406
345f3541df81
Fix a few additional warnings on 64bits arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
403
diff
changeset
|
110 fprintf(stderr, "From '%.*s' ", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
111 } else { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
112 fprintf(stderr, "no_Origin-Host "); |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
113 error++; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
114 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
115 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
116 /* Value of Origin-Realm */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
117 CHECK_FCT_DO( fd_msg_search_avp ( *msg, ta_origin_realm, &avp), return ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
118 if (avp) { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
119 CHECK_FCT_DO( fd_msg_avp_hdr( avp, &hdr ), return ); |
406
345f3541df81
Fix a few additional warnings on 64bits arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
403
diff
changeset
|
120 fprintf(stderr, "('%.*s') ", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 } else { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 fprintf(stderr, "no_Origin-Realm "); |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
123 error++; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
126 CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), ); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
127 dur = ((ts.tv_sec - mi->ts.tv_sec) * 1000000) + ((ts.tv_nsec - mi->ts.tv_nsec) / 1000); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
128 if (ta_conf->stats.nb_recv) { |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
129 /* Ponderate in the avg */ |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
130 ta_conf->stats.avg = (ta_conf->stats.avg * ta_conf->stats.nb_recv + dur) / (ta_conf->stats.nb_recv + 1); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
131 /* Min, max */ |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
132 if (dur < ta_conf->stats.shortest) |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
133 ta_conf->stats.shortest = dur; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
134 if (dur > ta_conf->stats.longest) |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
135 ta_conf->stats.longest = dur; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
136 } else { |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
137 ta_conf->stats.shortest = dur; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
138 ta_conf->stats.longest = dur; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
139 ta_conf->stats.avg = dur; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
140 } |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
141 |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
142 if (error) |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
143 ta_conf->stats.nb_errs++; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
144 else |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
145 ta_conf->stats.nb_recv++; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
146 |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
147 |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
148 CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), ); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
149 |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
150 /* Display how long it took */ |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
151 if (ts.tv_nsec > mi->ts.tv_nsec) { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
152 fprintf(stderr, "in %d.%06ld sec", |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
153 (int)(ts.tv_sec - mi->ts.tv_sec), |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
154 (long)(ts.tv_nsec - mi->ts.tv_nsec) / 1000); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
155 } else { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
156 fprintf(stderr, "in %d.%06ld sec", |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
157 (int)(ts.tv_sec + 1 - mi->ts.tv_sec), |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
158 (long)(1000000000 + ts.tv_nsec - mi->ts.tv_nsec) / 1000); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
159 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
160 fprintf(stderr, "\n"); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
161 fflush(stderr); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
162 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
163 /* Free the message */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
164 CHECK_FCT_DO(fd_msg_free(*msg), return); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
165 *msg = NULL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
166 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
167 free(mi); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
168 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
169 return; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
170 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
171 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
172 /* Create a test message */ |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
639
diff
changeset
|
173 static void ta_cli_test_message() |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
174 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
175 struct msg * req = NULL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
176 struct avp * avp; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
177 union avp_value val; |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
930
diff
changeset
|
178 struct sess_state * mi = NULL, *svg; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
179 struct session *sess = NULL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
180 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
181 TRACE_DEBUG(FULL, "Creating a new message for sending."); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
182 |
1214
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
183 /* Create the request */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
184 CHECK_FCT_DO( fd_msg_new( ta_cmd_r, MSGFL_ALLOC_ETEID, &req ), goto out ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
185 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
186 /* Create a new session */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
187 #define TEST_APP_SID_OPT "app_test" |
924
877592751fee
Fix (tentative) for invalid handling of sessions fast creation/destruction as pointed by Yusuke Okura -- http://lists.freediameter.net/pipermail/help/2013-February/000584.html and http://lists.freediameter.net/pipermail/help/2013-February/000589.html -- Thank you very much
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
188 CHECK_FCT_DO( fd_msg_new_session( req, (os0_t)TEST_APP_SID_OPT, CONSTSTRLEN(TEST_APP_SID_OPT) ), goto out ); |
877592751fee
Fix (tentative) for invalid handling of sessions fast creation/destruction as pointed by Yusuke Okura -- http://lists.freediameter.net/pipermail/help/2013-February/000584.html and http://lists.freediameter.net/pipermail/help/2013-February/000589.html -- Thank you very much
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
189 CHECK_FCT_DO( fd_msg_sess_get(fd_g_config->cnf_dict, req, &sess, NULL), goto out ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
190 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
191 /* Create the random value to store with the session */ |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
930
diff
changeset
|
192 mi = malloc(sizeof(struct sess_state)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
193 if (mi == NULL) { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
194 fd_log_debug("malloc failed: %s", strerror(errno)); |
98 | 195 goto out; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
196 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
197 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
198 mi->randval = (int32_t)random(); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
199 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
200 /* Now set all AVPs values */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
201 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
202 /* Set the Destination-Realm AVP */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
203 { |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
204 CHECK_FCT_DO( fd_msg_avp_new ( ta_dest_realm, 0, &avp ), goto out ); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
205 val.os.data = (unsigned char *)(ta_conf->dest_realm); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
206 val.os.len = strlen(ta_conf->dest_realm); |
98 | 207 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); |
208 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out ); | |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
209 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
210 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
211 /* Set the Destination-Host AVP if needed*/ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
212 if (ta_conf->dest_host) { |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
213 CHECK_FCT_DO( fd_msg_avp_new ( ta_dest_host, 0, &avp ), goto out ); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
214 val.os.data = (unsigned char *)(ta_conf->dest_host); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
215 val.os.len = strlen(ta_conf->dest_host); |
98 | 216 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); |
217 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out ); | |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
218 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
219 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
220 /* Set Origin-Host & Origin-Realm */ |
98 | 221 CHECK_FCT_DO( fd_msg_add_origin ( req, 0 ), goto out ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
222 |
127
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
223 /* Set the User-Name AVP if needed*/ |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
224 if (ta_conf->user_name) { |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
225 CHECK_FCT_DO( fd_msg_avp_new ( ta_user_name, 0, &avp ), goto out ); |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
226 val.os.data = (unsigned char *)(ta_conf->user_name); |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
227 val.os.len = strlen(ta_conf->user_name); |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
228 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
229 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out ); |
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
121
diff
changeset
|
230 } |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
231 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
232 /* Set the Test-AVP AVP */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
233 { |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
234 CHECK_FCT_DO( fd_msg_avp_new ( ta_avp, 0, &avp ), goto out ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
235 val.i32 = mi->randval; |
98 | 236 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); |
237 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out ); | |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
238 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
239 |
1214
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
240 /* Set the Test-Payload-AVP AVP */ |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
241 if (ta_conf->long_avp_id) { |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
242 int l; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
243 CHECK_FCT_DO( fd_msg_avp_new ( ta_avp_long, 0, &avp ), goto out ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
244 CHECK_MALLOC_DO( val.os.data = malloc(ta_conf->long_avp_len), goto out); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
245 val.os.len = ta_conf->long_avp_len; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
246 for (l=0; l < ta_conf->long_avp_len; l++) |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
247 val.os.data[l]=l; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
248 CHECK_FCT_DO( fd_msg_avp_setvalue( avp, &val ), goto out ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
249 free(val.os.data); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
250 CHECK_FCT_DO( fd_msg_avp_add( req, MSG_BRW_LAST_CHILD, avp ), goto out ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
251 } |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
252 |
98 | 253 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &mi->ts), goto out ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
254 |
99 | 255 /* Keep a pointer to the session data for debug purpose, in real life we would not need it */ |
256 svg = mi; | |
257 | |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
258 /* Store this value in the session */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
259 CHECK_FCT_DO( fd_sess_state_store ( ta_cli_reg, sess, &mi ), goto out ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
260 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
261 /* Log sending the message */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
262 fprintf(stderr, "SEND %x to '%s' (%s)\n", svg->randval, ta_conf->dest_realm, ta_conf->dest_host?:"-" ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
263 fflush(stderr); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
264 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
265 /* Send the request */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
266 CHECK_FCT_DO( fd_msg_send( &req, ta_cb_ans, svg ), goto out ); |
98 | 267 |
930
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
268 /* Increment the counter */ |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
269 CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), ); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
270 ta_conf->stats.nb_sent++; |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
271 CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), ); |
64d8ba7976d0
Include client stats in non-benchmark mode in test_app
Sebastien Decugis <sdecugis@freediameter.net>
parents:
928
diff
changeset
|
272 |
98 | 273 out: |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
274 return; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
275 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
276 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
277 int ta_cli_init(void) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
278 { |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
930
diff
changeset
|
279 CHECK_FCT( fd_sess_handler_create(&ta_cli_reg, (void *)free, NULL, NULL) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
280 |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
639
diff
changeset
|
281 CHECK_FCT( fd_event_trig_regcb(ta_conf->signal, "test_app.cli", ta_cli_test_message ) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
282 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
283 return 0; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
284 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
285 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
99
diff
changeset
|
286 void ta_cli_fini(void) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
287 { |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
639
diff
changeset
|
288 // CHECK_FCT_DO( fd_sig_unregister(ta_conf->signal), /* continue */ ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
289 |
639
95a784729cac
Added new opaque pointer to fd_sess_handler_create and fd_disp_register for usability. Bumped API version number.
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
290 CHECK_FCT_DO( fd_sess_handler_destroy(&ta_cli_reg, NULL), /* continue */ ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
291 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
292 return; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
293 }; |