Mercurial > hg > freeDiameter
annotate tests/testdisp.c @ 1327:82b386714795
Set callback data also when only setting expire callback (and not answer callback as well).
It is used when calling the expire callback, so not setting it makes no sense.
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Mon, 27 Nov 2017 15:21:20 +0100 |
parents | 90e0382e6579 |
children |
rev | line source |
---|---|
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
e5af94b04946
Added dispatch module and tests
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> * |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
1127
1af09cc156d6
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1113
diff
changeset
|
5 * Copyright (c) 2013, WIDE Project and NICT * |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
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 * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 #include "tests.h" |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
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:
90
diff
changeset
|
38 #define Define_cb( __int, __extra ) \ |
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:
90
diff
changeset
|
39 int cb_##__int( struct msg ** msg, struct avp * avp, struct session * session, void * opaque, enum disp_action * action ) \ |
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:
90
diff
changeset
|
40 { \ |
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:
90
diff
changeset
|
41 CHECK( 1, msg ? 1 : 0 ); \ |
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:
90
diff
changeset
|
42 CHECK( 1, action ? 1 : 0 ); \ |
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:
90
diff
changeset
|
43 CHECK( sess, session ); \ |
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:
90
diff
changeset
|
44 if (opaque) { \ |
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:
90
diff
changeset
|
45 CHECK( 1, opaque == g_opaque ? 1 : 0 ); \ |
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:
90
diff
changeset
|
46 } \ |
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:
90
diff
changeset
|
47 *action = DISP_ACT_CONT; \ |
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:
90
diff
changeset
|
48 cbcalled[__int] += 1; \ |
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:
90
diff
changeset
|
49 do { \ |
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:
90
diff
changeset
|
50 __extra ; \ |
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:
90
diff
changeset
|
51 } while (0); \ |
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:
90
diff
changeset
|
52 return 0; \ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
55 #define NB_CB 10 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 char cbcalled[NB_CB]; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
57 struct session * sess; |
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:
90
diff
changeset
|
58 void * g_opaque = (void *)"test"; |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 /* cb_0 */ Define_cb( 0, ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 /* cb_1 */ Define_cb( 1, ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
62 /* cb_2 */ Define_cb( 2, ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 /* cb_3 */ Define_cb( 3, ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 /* cb_4 */ Define_cb( 4, ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
65 /* cb_5 */ Define_cb( 5, ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 /* cb_6 */ Define_cb( 6, return 12345 ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 /* cb_7 */ Define_cb( 7, { CHECK( 1, avp ? 1 : 0 ); } ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 /* cb_8 */ Define_cb( 8, { CHECK( 0, fd_msg_free( *msg ) ); *msg = NULL; } ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 /* cb_9 */ Define_cb( 9, *action = DISP_ACT_SEND ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 /* max: cb_<NB_CB - 1> */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
72 /* Create a new message containing what we want */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 struct msg * new_msg(int appid, struct dict_object * cmd, struct dict_object * avp1, struct dict_object * avp2, int val) |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 struct msg *new; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 struct avp *avp; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 union avp_value value; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
78 struct msg_hdr * msg_hdr = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 CHECK( 0, fd_msg_new ( cmd, 0, &new ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 CHECK( 0, fd_msg_hdr ( new, &msg_hdr ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 msg_hdr->msg_appl = appid; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 if (avp1) { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
85 CHECK( 0, fd_msg_avp_new ( avp1, 0, &avp ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
86 value.u32 = 0; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
87 CHECK( 0, fd_msg_avp_setvalue ( avp, &value ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 CHECK( 0, fd_msg_avp_add ( new, MSG_BRW_LAST_CHILD, avp ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 if (avp2) { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
92 CHECK( 0, fd_msg_avp_new ( avp2, 0, &avp ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 value.u32 = val; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 CHECK( 0, fd_msg_avp_setvalue ( avp, &value ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
95 CHECK( 0, fd_msg_avp_add ( new, MSG_BRW_LAST_CHILD, avp ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
97 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 return new; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
99 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
100 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
101 /* Main test routine */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
102 int main(int argc, char *argv[]) |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
103 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
104 struct dict_object * app1, * app2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
105 struct dict_object * cmd1, * cmd2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
106 struct dict_object * avp1, * avp2; /* avp2 is enumerated; they are both unsigned32 types */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
107 struct dict_object * enu1, * enu2; |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
108 struct msg * msg = NULL, *error; |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
109 enum disp_action action; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
110 struct disp_hdl * hdl[NB_CB]; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
111 struct disp_when when; |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
112 char * ec, *em; |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
113 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
114 /* First, initialize the daemon modules */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
115 INIT_FD(); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
116 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
117 /* Create a dummy session, we don't use it anyway */ |
706
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
118 #define DUMMY_SID "test.disp" |
4ffbc9f1e922
Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
119 CHECK( 0, fd_sess_new( &sess, DUMMY_SID, CONSTSTRLEN(DUMMY_SID), NULL, 0 ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
120 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 memset(&when, 0xff, sizeof(when)); /* check that we don't use un-initialized parts */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
123 /* Initialize dictionary objects */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 struct dict_object * enutype; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
126 struct dict_application_data app1_data = { 1, "Application test 1" }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
127 struct dict_application_data app2_data = { 2, "Application test 2" }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
128 struct dict_cmd_data cmd1_data = { 1, "Command test 1 (req)", CMD_FLAG_REQUEST, CMD_FLAG_REQUEST }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
129 struct dict_cmd_data cmd2_data = { 1, "Command test 2 (ans)", CMD_FLAG_REQUEST, 0 }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 struct dict_type_data type_data = { AVP_TYPE_UNSIGNED32, "Type test", NULL, NULL }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
131 struct dict_avp_data avp1_data = { 10001, 0, "AVP test 1", 0, 0, AVP_TYPE_UNSIGNED32 }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
132 struct dict_avp_data avp2_data = { 10002, 0, "AVP test 2", 0, 0, AVP_TYPE_UNSIGNED32 }; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 struct dict_enumval_data enu1_data = { "ENU test 1", { .u32 = 1 }}; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 struct dict_enumval_data enu2_data = { "ENU test 2", { .u32 = 2 }}; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
136 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_APPLICATION, &app1_data, NULL, &app1 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
137 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_APPLICATION, &app2_data, NULL, &app2 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
138 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_COMMAND, &cmd1_data, NULL, &cmd1 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
139 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_COMMAND, &cmd2_data, NULL, &cmd2 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
140 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_TYPE, &type_data, NULL, &enutype ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
141 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp1_data, NULL, &avp1 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
142 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_AVP, &avp2_data, enutype, &avp2 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
143 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &enu1_data, enutype, &enu1 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
144 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_ENUMVAL, &enu2_data, enutype, &enu2 ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
145 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
146 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
147 /* Register first handler, very simple test */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
148 { |
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:
90
diff
changeset
|
149 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, NULL, &hdl[0] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
150 CHECK( 1, hdl[0] ? 1 : 0 ); |
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:
90
diff
changeset
|
151 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
152 CHECK( NULL, hdl[0] ); |
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:
90
diff
changeset
|
153 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, NULL, &hdl[0] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
154 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
155 /* Check this handler is called for a message */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
156 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
157 memset(cbcalled, 0, sizeof(cbcalled)); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
158 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
159 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
160 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
161 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
162 /* Delete the message */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
163 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
164 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
165 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
166 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
167 /* Handlers for applications */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
168 { |
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:
90
diff
changeset
|
169 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
170 when.app = app1; |
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:
90
diff
changeset
|
171 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_APPID, &when, NULL, &hdl[1] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
172 when.app = app2; |
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:
90
diff
changeset
|
173 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_APPID, &when, NULL, &hdl[2] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
174 when.avp = avp2; |
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:
90
diff
changeset
|
175 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_APPID, &when, NULL, &hdl[3] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
176 when.avp = avp1; |
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:
90
diff
changeset
|
177 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_APPID, &when, NULL, &hdl[4] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
178 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
179 /* Check the callbacks are called as appropriate */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
180 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
181 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
182 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
183 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
184 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
185 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
186 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
187 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
188 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
189 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
190 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
191 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
192 msg = new_msg( 1, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
193 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
194 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
195 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
196 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
197 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
198 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
199 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
200 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
201 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
202 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
203 msg = new_msg( 2, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
204 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
205 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
206 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
207 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
208 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
209 CHECK( 1, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
210 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
211 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
212 |
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:
90
diff
changeset
|
213 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
214 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
215 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
216 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
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:
90
diff
changeset
|
217 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
218 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
219 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
220 /* Handlers for commands */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
221 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
222 when.app = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
223 when.command = NULL; |
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:
90
diff
changeset
|
224 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); |
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:
90
diff
changeset
|
225 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_CC, &when, NULL, &hdl[1] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
226 when.command = cmd1; |
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:
90
diff
changeset
|
227 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_CC, &when, NULL, &hdl[1] ) ); /* cmd1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
228 when.app = app2; |
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:
90
diff
changeset
|
229 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_CC, &when, NULL, &hdl[2] ) ); /* app2 + cmd1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
230 when.command = cmd2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
231 when.app = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
232 when.avp = avp1; |
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:
90
diff
changeset
|
233 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_CC, &when, NULL, &hdl[3] ) ); /* cmd2 (avp1 ignored) */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
234 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
235 /* Check the callbacks are called as appropriate */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
236 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
237 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
238 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
239 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
240 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
241 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
242 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
243 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
244 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
245 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
246 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
247 msg = new_msg( 2, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
248 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
249 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
250 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
251 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
252 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
253 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
254 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
255 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
256 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
257 msg = new_msg( 2, cmd2, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
258 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
259 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
260 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
261 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
262 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
263 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
264 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
265 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
266 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
267 msg = new_msg( 1, cmd2, NULL, avp2, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
268 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
269 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
270 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
271 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
272 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
273 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
274 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
275 |
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:
90
diff
changeset
|
276 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
277 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
278 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
279 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
280 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
281 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
282 /* Handlers for AVPs */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
283 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
284 when.app = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
285 when.command = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
286 when.avp = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
287 |
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:
90
diff
changeset
|
288 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); /* all */ |
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:
90
diff
changeset
|
289 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP, &when, NULL, &hdl[1] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
290 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
291 when.avp = avp1; |
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:
90
diff
changeset
|
292 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP, &when, NULL, &hdl[1] ) ); /* avp1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
293 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
294 when.command = cmd1; |
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:
90
diff
changeset
|
295 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP, &when, NULL, &hdl[2] ) ); /* avp1 + cmd1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
296 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
297 when.command = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
298 when.app = app1; |
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:
90
diff
changeset
|
299 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_AVP, &when, NULL, &hdl[3] ) ); /* avp1 + app1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
300 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
301 when.command = cmd1; |
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:
90
diff
changeset
|
302 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_AVP, &when, NULL, &hdl[4] ) ); /* avp1 + cmd1 + app1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
303 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
304 when.app = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
305 when.command = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
306 when.avp = avp2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
307 when.value = enu1; |
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:
90
diff
changeset
|
308 CHECK( 0, fd_disp_register( cb_5, DISP_HOW_AVP, &when, NULL, &hdl[5] ) ); /* avp2 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
309 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
310 when.value = enu2; |
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:
90
diff
changeset
|
311 CHECK( 0, fd_disp_register( cb_7, DISP_HOW_AVP, &when, NULL, &hdl[6] ) ); /* avp2 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
312 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
313 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
314 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
315 /* Check the callbacks are called as appropriate */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
316 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
317 msg = new_msg( 0, cmd1, NULL, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
318 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
319 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
320 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
321 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
322 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
323 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
324 CHECK( 0, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
325 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
326 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
327 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
328 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
329 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
330 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
331 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
332 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
333 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
334 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
335 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
336 CHECK( 0, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
337 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
338 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
339 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
340 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
341 msg = new_msg( 1, cmd2, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
342 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
343 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
344 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
345 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
346 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
347 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
348 CHECK( 0, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
349 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
350 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
351 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
352 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
353 msg = new_msg( 1, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
354 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
355 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
356 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
357 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
358 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
359 CHECK( 1, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
360 CHECK( 0, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
361 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
362 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
363 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
364 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
365 msg = new_msg( 1, cmd1, avp1, avp2, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
366 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
367 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
368 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
369 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
370 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
371 CHECK( 1, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
372 CHECK( 1, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
373 CHECK( 1, cbcalled[7] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
374 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
375 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
376 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
377 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
378 msg = new_msg( 1, cmd1, NULL, avp2, 1 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
379 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
380 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
381 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
382 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
383 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
384 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
385 CHECK( 1, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
386 CHECK( 1, cbcalled[7] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
387 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
388 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
389 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
390 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
391 msg = new_msg( 1, cmd1, NULL, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
392 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
393 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
394 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
395 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
396 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
397 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
398 CHECK( 1, cbcalled[5] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
399 CHECK( 1, cbcalled[7] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
400 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
401 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
402 |
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:
90
diff
changeset
|
403 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
404 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
405 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
406 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
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:
90
diff
changeset
|
407 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); |
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:
90
diff
changeset
|
408 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); |
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:
90
diff
changeset
|
409 CHECK( 0, fd_disp_unregister( &hdl[6], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
410 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
411 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
412 /* Handlers for enum values */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
413 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
414 when.app = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
415 when.command = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
416 when.avp = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
417 when.value = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
418 |
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:
90
diff
changeset
|
419 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); /* all */ |
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:
90
diff
changeset
|
420 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
421 when.value = enu1; |
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:
90
diff
changeset
|
422 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
423 when.avp = avp1; |
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:
90
diff
changeset
|
424 CHECK( EINVAL, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
425 when.avp = avp2; |
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:
90
diff
changeset
|
426 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); /* avp2, enu1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
427 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
428 when.command = cmd1; |
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:
90
diff
changeset
|
429 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[2] ) ); /* avp2, enu1 + cmd1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
430 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
431 when.command = NULL; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
432 when.app = app1; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
433 when.value = enu2; |
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:
90
diff
changeset
|
434 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[3] ) ); /* avp2, enu2 + app1 */ |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
435 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
436 /* Check the callbacks are called as appropriate */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
437 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
438 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
439 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
440 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
441 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
442 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
443 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
444 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
445 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
446 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
447 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
448 msg = new_msg( 1, cmd2, avp1, avp2, 0 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
449 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
450 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
451 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
452 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
453 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
454 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
455 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
456 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
457 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
458 msg = new_msg( 1, cmd2, avp1, avp2, 1 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
459 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
460 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
461 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
462 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
463 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
464 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
465 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
466 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
467 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
468 msg = new_msg( 1, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
469 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
470 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
471 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
472 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
473 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
474 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
475 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
476 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
477 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
478 msg = new_msg( 1, cmd1, avp1, avp2, 1 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
479 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
480 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
481 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
482 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
483 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
484 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
485 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
486 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
487 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
488 msg = new_msg( 1, cmd2, avp1, avp2, 1 ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
489 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
490 struct avp *avp; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
491 union avp_value value; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
492 CHECK( 0, fd_msg_avp_new ( avp2, 0, &avp ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
493 value.u32 = 2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
494 CHECK( 0, fd_msg_avp_setvalue ( avp, &value ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
495 CHECK( 0, fd_msg_avp_add ( msg, MSG_BRW_LAST_CHILD, avp ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
496 } |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
497 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
498 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
499 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
500 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
501 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
502 CHECK( DISP_ACT_CONT, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
503 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
504 |
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:
90
diff
changeset
|
505 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
506 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
507 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
508 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
509 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
510 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
511 /* Test behavior of handlers */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
512 { |
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:
90
diff
changeset
|
513 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); |
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:
90
diff
changeset
|
514 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, NULL, &hdl[1] ) ); |
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:
90
diff
changeset
|
515 CHECK( 0, fd_disp_register( cb_6, DISP_HOW_ANY, &when, NULL, &hdl[2] ) ); |
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:
90
diff
changeset
|
516 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, NULL, &hdl[3] ) ); |
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:
90
diff
changeset
|
517 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, NULL, &hdl[4] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
518 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
519 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
520 msg = new_msg( 1, cmd1, avp1, avp2, 1 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
521 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
522 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
523 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
524 CHECK( 1, cbcalled[6] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
525 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
526 CHECK( 0, cbcalled[3] ); |
1018
d67fec731a12
Updated test to match new behavior of dispatch function
Sebastien Decugis <sdecugis@freediameter.net>
parents:
740
diff
changeset
|
527 CHECK( 0, msg ? 1 : 0); |
1135
90e0382e6579
Fix wrong parameter name
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
528 CHECK( 1, em ? 1 : 0); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
529 CHECK( 0, fd_msg_free( error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
530 |
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:
90
diff
changeset
|
531 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
532 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
533 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
534 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
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:
90
diff
changeset
|
535 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
536 |
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:
90
diff
changeset
|
537 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); |
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:
90
diff
changeset
|
538 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, NULL, &hdl[1] ) ); |
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:
90
diff
changeset
|
539 CHECK( 0, fd_disp_register( cb_8, DISP_HOW_ANY, &when, NULL, &hdl[2] ) ); |
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:
90
diff
changeset
|
540 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, NULL, &hdl[3] ) ); |
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:
90
diff
changeset
|
541 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, NULL, &hdl[4] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
542 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
543 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
544 msg = new_msg( 1, cmd1, avp1, avp2, 1 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
545 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
546 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
547 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
548 CHECK( 1, cbcalled[8] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
549 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
550 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
551 CHECK( NULL, msg ); |
1135
90e0382e6579
Fix wrong parameter name
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1127
diff
changeset
|
552 CHECK( NULL, em ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
553 |
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:
90
diff
changeset
|
554 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
555 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
556 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
557 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
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:
90
diff
changeset
|
558 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
559 |
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:
90
diff
changeset
|
560 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); |
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:
90
diff
changeset
|
561 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_ANY, &when, NULL, &hdl[1] ) ); |
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:
90
diff
changeset
|
562 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_ANY, &when, NULL, &hdl[2] ) ); |
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:
90
diff
changeset
|
563 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_ANY, &when, NULL, &hdl[3] ) ); |
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:
90
diff
changeset
|
564 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_ANY, &when, NULL, &hdl[4] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
565 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
566 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
567 msg = new_msg( 1, cmd1, avp1, avp2, 1 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
568 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
569 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
570 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
571 CHECK( 1, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
572 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
573 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
574 CHECK( DISP_ACT_SEND, action ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
575 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
576 |
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:
90
diff
changeset
|
577 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
578 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
579 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
580 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
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:
90
diff
changeset
|
581 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
582 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
583 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
584 /* Test order of handlers */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
585 { |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
586 when.app = app2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
587 when.command = cmd2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
588 when.avp = avp2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
589 when.value = enu2; |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
590 |
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:
90
diff
changeset
|
591 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, &when, NULL, &hdl[0] ) ); |
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:
90
diff
changeset
|
592 CHECK( 0, fd_disp_register( cb_1, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[1] ) ); |
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:
90
diff
changeset
|
593 CHECK( 0, fd_disp_register( cb_2, DISP_HOW_AVP, &when, NULL, &hdl[2] ) ); |
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:
90
diff
changeset
|
594 CHECK( 0, fd_disp_register( cb_3, DISP_HOW_CC, &when, NULL, &hdl[3] ) ); |
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:
90
diff
changeset
|
595 CHECK( 0, fd_disp_register( cb_4, DISP_HOW_APPID, &when, NULL, &hdl[4] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
596 |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
597 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
598 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
599 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
600 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
601 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
602 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
603 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
604 CHECK( 1, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
605 CHECK( 0, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
606 CHECK( 0, fd_msg_free( msg ) ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
607 |
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:
90
diff
changeset
|
608 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_ANY, &when, NULL, &hdl[5] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
609 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
610 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
611 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
612 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
613 CHECK( 0, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
614 CHECK( 0, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
615 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
616 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
617 CHECK( 1, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
618 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
619 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
620 |
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:
90
diff
changeset
|
621 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_AVP_ENUMVAL, &when, NULL, &hdl[5] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
622 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
623 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
624 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
625 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
626 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
627 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
628 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
629 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
630 CHECK( 1, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
631 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
632 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
633 |
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:
90
diff
changeset
|
634 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_AVP, &when, NULL, &hdl[5] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
635 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
636 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
637 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
638 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
639 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
640 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
641 CHECK( 0, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
642 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
643 CHECK( 1, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
644 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
645 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
646 |
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:
90
diff
changeset
|
647 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_CC, &when, NULL, &hdl[5] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
648 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
649 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
650 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
651 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
652 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
653 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
654 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
655 CHECK( 0, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
656 CHECK( 1, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
657 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
658 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
659 |
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:
90
diff
changeset
|
660 CHECK( 0, fd_disp_register( cb_9, DISP_HOW_APPID, &when, NULL, &hdl[5] ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
661 memset(cbcalled, 0, sizeof(cbcalled)); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
662 msg = new_msg( 2, cmd2, avp1, avp2, 2 ); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
663 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
664 CHECK( 1, cbcalled[0] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
665 CHECK( 1, cbcalled[1] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
666 CHECK( 1, cbcalled[2] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
667 CHECK( 1, cbcalled[3] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
668 CHECK( 1, cbcalled[4] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
669 CHECK( 1, cbcalled[9] ); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
670 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
671 CHECK( 0, fd_disp_unregister( &hdl[5], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
672 |
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:
90
diff
changeset
|
673 CHECK( 0, fd_disp_unregister( &hdl[0], NULL ) ); |
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:
90
diff
changeset
|
674 CHECK( 0, fd_disp_unregister( &hdl[1], NULL ) ); |
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:
90
diff
changeset
|
675 CHECK( 0, fd_disp_unregister( &hdl[2], NULL ) ); |
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:
90
diff
changeset
|
676 CHECK( 0, fd_disp_unregister( &hdl[3], NULL ) ); |
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:
90
diff
changeset
|
677 CHECK( 0, fd_disp_unregister( &hdl[4], NULL ) ); |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
678 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
679 |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
680 /* Test application support advertisement */ |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
681 { |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
682 struct dict_object * vnd; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
683 struct dict_vendor_data vnd_data = { 1, "Vendor test" }; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
684 struct fd_app * app; |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
685 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
686 CHECK( 0, fd_dict_new ( fd_g_config->cnf_dict, DICT_VENDOR, &vnd_data, NULL, &vnd ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
687 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
688 CHECK( EINVAL, fd_disp_app_support ( vnd, NULL, 1, 0 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
689 CHECK( EINVAL, fd_disp_app_support ( app1, NULL, 0, 0 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
690 CHECK( 0, fd_disp_app_support ( app1, NULL, 1, 0 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
691 CHECK( 0, fd_disp_app_support ( app1, NULL, 0, 1 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
692 CHECK( 0, fd_disp_app_support ( app2, vnd, 1, 0 ) ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
693 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
694 app = (struct fd_app *)(fd_g_config->cnf_apps.next); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
695 CHECK( 1, app->appid ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
696 CHECK( 1, app->flags.auth ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
697 CHECK( 1, app->flags.acct ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
698 app = (struct fd_app *)(fd_g_config->cnf_apps.prev); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
699 CHECK( 2, app->appid ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
700 CHECK( 1, app->flags.auth ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
701 CHECK( 0, app->flags.acct ); |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
702 |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
703 #if 0 |
1088
1d1a20a0779d
Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1018
diff
changeset
|
704 fd_log_debug("%s", fd_conf_dump(FD_DUMP_TEST_PARAMS)); |
10
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
705 #endif |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
706 } |
c5c99c73c2bf
Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
8
diff
changeset
|
707 |
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:
90
diff
changeset
|
708 /* Test opaque pointer management */ |
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:
90
diff
changeset
|
709 { |
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:
90
diff
changeset
|
710 void * ptr; |
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:
90
diff
changeset
|
711 CHECK( 0, fd_disp_register( cb_0, DISP_HOW_ANY, NULL, g_opaque, &hdl[0] ) ); |
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:
90
diff
changeset
|
712 |
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:
90
diff
changeset
|
713 /* Check this handler is called for a message */ |
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:
90
diff
changeset
|
714 msg = new_msg( 0, cmd1, avp1, NULL, 0 ); |
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:
90
diff
changeset
|
715 memset(cbcalled, 0, sizeof(cbcalled)); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1088
diff
changeset
|
716 CHECK( 0, fd_msg_dispatch ( &msg, sess, &action, &ec, &em, &error ) ); |
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:
90
diff
changeset
|
717 CHECK( 1, cbcalled[0] ); |
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:
90
diff
changeset
|
718 CHECK( DISP_ACT_CONT, action ); |
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:
90
diff
changeset
|
719 |
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:
90
diff
changeset
|
720 /* Delete the message */ |
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:
90
diff
changeset
|
721 CHECK( 0, fd_msg_free( msg ) ); |
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:
90
diff
changeset
|
722 CHECK( 0, fd_disp_unregister( &hdl[0], &ptr ) ); |
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:
90
diff
changeset
|
723 CHECK( 1, ptr == g_opaque ? 1 : 0 ); |
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:
90
diff
changeset
|
724 } |
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:
90
diff
changeset
|
725 |
7
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
726 /* That's all for the tests yet */ |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
727 PASSTEST(); |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
728 } |
e5af94b04946
Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
729 |