Mercurial > hg > freeDiameter
annotate extensions/test_app/ta_dict.c @ 1235:f937feb72734 1.2.0
Updated copyright information
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Sat, 14 Sep 2013 18:09:01 +0800 |
parents | c2fbaf2985f4 |
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:
127
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 * * |
1235
f937feb72734
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1214
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 dictionary objects */ |
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:
93
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:
93
diff
changeset
|
40 struct dict_object * ta_vendor = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
41 struct dict_object * ta_appli = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
42 struct dict_object * ta_cmd_r = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
43 struct dict_object * ta_cmd_a = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
44 struct dict_object * ta_avp = NULL; |
1214
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
45 struct dict_object * ta_avp_long = NULL; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
46 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
47 struct dict_object * ta_sess_id = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
48 struct dict_object * ta_origin_host = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
49 struct dict_object * ta_origin_realm = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
50 struct dict_object * ta_dest_host = NULL; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
51 struct dict_object * ta_dest_realm = NULL; |
127
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
52 struct dict_object * ta_user_name = NULL; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
53 struct dict_object * ta_res_code = NULL; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
55 int ta_dict_init(void) |
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 TRACE_DEBUG(FULL, "Initializing the dictionary for test"); |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
58 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 /* Create the Test Vendor */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 struct dict_vendor_data data; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
62 data.vendor_id = ta_conf->vendor_id; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 data.vendor_name = "app_test vendor"; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
64 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_VENDOR, &data, NULL, &ta_vendor)); |
93
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 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 /* Create the Test Application */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 struct dict_application_data data; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
70 data.application_id = ta_conf->appli_id; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 data.application_name = "app_test application"; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
72 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_APPLICATION, &data, ta_vendor, &ta_appli)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 } |
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 /* Create the Test-Request & Test-Answer commands */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 struct dict_cmd_data data; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
78 data.cmd_code = ta_conf->cmd_id; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 data.cmd_name = "Test-Request"; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 data.cmd_flag_mask = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 data.cmd_flag_val = CMD_FLAG_PROXIABLE | CMD_FLAG_REQUEST; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
82 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, ta_appli, &ta_cmd_r)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 data.cmd_name = "Test-Answer"; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 data.cmd_flag_val = CMD_FLAG_PROXIABLE; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
85 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_COMMAND, &data, ta_appli, &ta_cmd_a)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
86 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
87 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 /* Create the Test AVP */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 struct dict_avp_data data; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
91 data.avp_code = ta_conf->avp_id; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
92 data.avp_vendor = ta_conf->vendor_id; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 data.avp_name = "Test-AVP"; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 data.avp_flag_mask = AVP_FLAG_VENDOR; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
95 data.avp_flag_val = AVP_FLAG_VENDOR; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 data.avp_basetype = AVP_TYPE_INTEGER32; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
97 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
99 |
1214
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
100 /* Create the Test Payload AVP */ |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
101 if (ta_conf->long_avp_id) { |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
102 struct dict_avp_data data; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
103 data.avp_code = ta_conf->long_avp_id; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
104 data.avp_vendor = ta_conf->vendor_id; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
105 data.avp_name = "Test-Payload-AVP"; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
106 data.avp_flag_mask = AVP_FLAG_VENDOR; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
107 data.avp_flag_val = AVP_FLAG_VENDOR; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
108 data.avp_basetype = AVP_TYPE_OCTETSTRING; |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
109 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_AVP, &data, NULL, &ta_avp_long)); |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
110 } |
c2fbaf2985f4
New options to test_app extension to generate long Diameter messages
Sebastien Decugis <sdecugis@freediameter.net>
parents:
741
diff
changeset
|
111 |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
112 /* Now resolve some other useful AVPs */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
113 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &ta_sess_id, ENOENT) ); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
114 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &ta_origin_host, ENOENT) ); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
115 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &ta_origin_realm, ENOENT) ); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
116 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &ta_dest_host, ENOENT) ); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
117 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &ta_dest_realm, ENOENT) ); |
127
8ee43cf85a5f
Added User-Name AVP in test_app extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
120
diff
changeset
|
118 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "User-Name", &ta_user_name, ENOENT) ); |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
119 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &ta_res_code, ENOENT) ); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
120 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 /* Create the rules for Test-Request and Test-Answer */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 { |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
123 struct dict_rule_data data; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 data.rule_min = 1; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 data.rule_max = 1; |
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 /* Session-Id is in first position */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
128 data.rule_avp = ta_sess_id; |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
129 data.rule_position = RULE_FIXED_HEAD; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 data.rule_order = 1; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
131 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL)); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
132 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 data.rule_position = RULE_REQUIRED; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 /* Test-AVP is mandatory */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
136 data.rule_avp = ta_avp; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
137 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL)); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
138 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
139 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
140 /* idem for Origin Host and Realm */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
141 data.rule_avp = ta_origin_host; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
142 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL)); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
143 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
144 |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
145 data.rule_avp = ta_origin_realm; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
146 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL)); |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
147 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
148 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
149 /* And Result-Code is mandatory for answers only */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
150 data.rule_avp = ta_res_code; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
151 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_a, NULL)); |
93
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 /* And Destination-Realm for requests only */ |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
154 data.rule_avp = ta_dest_realm; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
155 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL)); |
93
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
156 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
157 /* And Destination-Host optional for requests only */ |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
158 data.rule_position = RULE_OPTIONAL; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
159 data.rule_min = 0; |
120
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
160 data.rule_avp = ta_dest_host; |
d7acdc46134d
Renamed several extensions
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
93
diff
changeset
|
161 CHECK_FCT(fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &data, ta_cmd_r, NULL)); |
93
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 } |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
164 |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
165 return 0; |
3910804c84db
Ported the app_test application
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
166 } |