Mercurial > hg > freeDiameter-dtls
annotate extensions/test_app/ta_serv.c @ 1220: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 | 1af09cc156d6 |
children | 992437a90bda |
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:
639
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 * * |
1127
1af09cc156d6
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
974
diff
changeset
|
5 * Copyright (c) 2013, 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 /* Install the dispatch callbacks */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
38 #include "test_app.h" |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
40 static struct disp_hdl * ta_hdl_fb = NULL; /* handler for fallback cb */ |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
41 static struct disp_hdl * ta_hdl_tr = NULL; /* handler for Test-Request req cb */ |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 /* Default callback for the application. */ |
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:
575
diff
changeset
|
44 static int ta_fb_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
45 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
46 /* This CB should never be called */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
47 TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
48 |
974
2091bf698fb1
Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents:
741
diff
changeset
|
49 fd_log_debug("Unexpected message received!"); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 return ENOTSUP; |
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 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 /* Callback for incoming Test-Request messages */ |
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:
575
diff
changeset
|
55 static int ta_tr_cb( struct msg ** msg, struct avp * avp, struct session * sess, void * opaque, enum disp_action * act) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
57 struct msg *ans, *qry; |
237
5ba7a37a6732
Add a trace on server for test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
58 struct avp * a; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 TRACE_ENTRY("%p %p %p %p", msg, avp, sess, act); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
62 if (msg == NULL) |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 return EINVAL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 |
237
5ba7a37a6732
Add a trace on server for test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
65 /* Value of Origin-Host */ |
572
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
66 if (! (ta_conf->mode & MODE_BENCH)) { |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
67 fprintf(stderr, "ECHO Test-Request received from "); |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
68 CHECK_FCT( fd_msg_search_avp ( *msg, ta_origin_host, &a) ); |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
69 if (a) { |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
70 struct avp_hdr * hdr; |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
71 CHECK_FCT( fd_msg_avp_hdr( a, &hdr ) ); |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
72 fprintf(stderr, "'%.*s'", (int)hdr->avp_value->os.len, hdr->avp_value->os.data); |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
73 } else { |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
74 fprintf(stderr, "no_Origin-Host"); |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
75 } |
b1b56d4682d0
Added benchmark mode in test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
406
diff
changeset
|
76 fprintf(stderr, ", replying...\n"); |
237
5ba7a37a6732
Add a trace on server for test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
77 } |
5ba7a37a6732
Add a trace on server for test_app
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
78 |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 /* Create answer header */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 qry = *msg; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, msg, 0 ) ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 ans = *msg; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 /* Set the Test-AVP AVP */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
85 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
86 struct avp * src = NULL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
87 struct avp_hdr * hdr = NULL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
89 CHECK_FCT( fd_msg_search_avp ( qry, ta_avp, &src) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 CHECK_FCT( fd_msg_avp_hdr( src, &hdr ) ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
92 CHECK_FCT( fd_msg_avp_new ( ta_avp, 0, &avp ) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
95 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 |
1220
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
97 /* Set the Test-Payload-AVP AVP */ |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
98 if (ta_conf->long_avp_id) { |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
99 struct avp * src = NULL; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
100 struct avp_hdr * hdr = NULL; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
101 |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
102 CHECK_FCT( fd_msg_search_avp ( qry, ta_avp_long, &src) ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
103 CHECK_FCT( fd_msg_avp_hdr( src, &hdr ) ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
104 |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
105 CHECK_FCT( fd_msg_avp_new ( ta_avp_long, 0, &avp ) ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
106 CHECK_FCT( fd_msg_avp_setvalue( avp, hdr->avp_value ) ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
107 CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_LAST_CHILD, avp ) ); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
108 } |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
109 |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
110 |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
111 /* Set the Origin-Host, Origin-Realm, Result-Code AVPs */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
112 CHECK_FCT( fd_msg_rescode_set( ans, "DIAMETER_SUCCESS", NULL, NULL, 1 ) ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
113 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
114 /* Send the answer */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
115 CHECK_FCT( fd_msg_send( msg, NULL, NULL ) ); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
116 |
575
66f188b3ca84
Configurable parameters for the benchmark mode
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
572
diff
changeset
|
117 /* Add this value to the stats */ |
66f188b3ca84
Configurable parameters for the benchmark mode
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
572
diff
changeset
|
118 CHECK_POSIX_DO( pthread_mutex_lock(&ta_conf->stats_lock), ); |
66f188b3ca84
Configurable parameters for the benchmark mode
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
572
diff
changeset
|
119 ta_conf->stats.nb_echoed++; |
66f188b3ca84
Configurable parameters for the benchmark mode
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
572
diff
changeset
|
120 CHECK_POSIX_DO( pthread_mutex_unlock(&ta_conf->stats_lock), ); |
66f188b3ca84
Configurable parameters for the benchmark mode
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
572
diff
changeset
|
121 |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 return 0; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
123 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
125 int ta_serv_init(void) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
126 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
127 struct disp_when data; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
128 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
129 TRACE_DEBUG(FULL, "Initializing dispatch callbacks for test"); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
131 memset(&data, 0, sizeof(data)); |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
132 data.app = ta_appli; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
133 data.command = ta_cmd_r; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 /* fallback CB if command != Test-Request received */ |
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:
575
diff
changeset
|
136 CHECK_FCT( fd_disp_register( ta_fb_cb, DISP_HOW_APPID, &data, NULL, &ta_hdl_fb ) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
137 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
138 /* Now specific handler for Test-Request */ |
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:
575
diff
changeset
|
139 CHECK_FCT( fd_disp_register( ta_tr_cb, DISP_HOW_CC, &data, NULL, &ta_hdl_tr ) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
140 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
141 return 0; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
142 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
143 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
144 void ta_serv_fini(void) |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
145 { |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
146 if (ta_hdl_fb) { |
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:
575
diff
changeset
|
147 (void) fd_disp_unregister(&ta_hdl_fb, NULL); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
148 } |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
112
diff
changeset
|
149 if (ta_hdl_tr) { |
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:
575
diff
changeset
|
150 (void) fd_disp_unregister(&ta_hdl_tr, NULL); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
151 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
152 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
153 return; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
154 } |