/src/S2OPC/src/ClientServer/services/bgenc/io_dispatch_mgr.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Licensed to Systerel under one or more contributor license |
3 | | * agreements. See the NOTICE file distributed with this work |
4 | | * for additional information regarding copyright ownership. |
5 | | * Systerel licenses this file to you under the Apache |
6 | | * License, Version 2.0 (the "License"); you may not use this |
7 | | * file except in compliance with the License. You may obtain |
8 | | * a copy of the License at |
9 | | * |
10 | | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | | * |
12 | | * Unless required by applicable law or agreed to in writing, |
13 | | * software distributed under the License is distributed on an |
14 | | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | | * KIND, either express or implied. See the License for the |
16 | | * specific language governing permissions and limitations |
17 | | * under the License. |
18 | | */ |
19 | | |
20 | | /****************************************************************************** |
21 | | |
22 | | File Name : io_dispatch_mgr.c |
23 | | |
24 | | Date : 21/06/2024 07:39:37 |
25 | | |
26 | | C Translator Version : tradc Java V1.2 (06/02/2022) |
27 | | |
28 | | ******************************************************************************/ |
29 | | |
30 | | /*------------------------ |
31 | | Exported Declarations |
32 | | ------------------------*/ |
33 | | #include "io_dispatch_mgr.h" |
34 | | |
35 | | /*------------------------ |
36 | | INITIALISATION Clause |
37 | | ------------------------*/ |
38 | 0 | void io_dispatch_mgr__INITIALISATION(void) { |
39 | 0 | } |
40 | | |
41 | | /*-------------------- |
42 | | OPERATIONS Clause |
43 | | --------------------*/ |
44 | | void io_dispatch_mgr__get_msg_header_type( |
45 | | const constants__t_msg_type_i io_dispatch_mgr__msg_typ, |
46 | 0 | constants__t_msg_header_type_i * const io_dispatch_mgr__header_type) { |
47 | 0 | *io_dispatch_mgr__header_type = constants__c_msg_header_type_indet; |
48 | 0 | switch (io_dispatch_mgr__msg_typ) { |
49 | 0 | case constants__e_msg_session_create_req: |
50 | 0 | case constants__e_msg_session_activate_req: |
51 | 0 | case constants__e_msg_session_close_req: |
52 | 0 | case constants__e_msg_session_cancel_req: |
53 | 0 | case constants__e_msg_node_add_nodes_req: |
54 | 0 | case constants__e_msg_node_add_references_req: |
55 | 0 | case constants__e_msg_node_delete_nodes_req: |
56 | 0 | case constants__e_msg_node_delete_references_req: |
57 | 0 | case constants__e_msg_view_browse_req: |
58 | 0 | case constants__e_msg_view_browse_next_req: |
59 | 0 | case constants__e_msg_view_translate_browse_paths_to_node_ids_req: |
60 | 0 | case constants__e_msg_view_register_nodes_req: |
61 | 0 | case constants__e_msg_view_unregister_nodes_req: |
62 | 0 | case constants__e_msg_query_first_req: |
63 | 0 | case constants__e_msg_query_next_req: |
64 | 0 | case constants__e_msg_attribute_read_req: |
65 | 0 | case constants__e_msg_attribute_history_read_req: |
66 | 0 | case constants__e_msg_attribute_write_req: |
67 | 0 | case constants__e_msg_attribute_history_update_req: |
68 | 0 | case constants__e_msg_method_call_req: |
69 | 0 | case constants__e_msg_monitored_items_create_req: |
70 | 0 | case constants__e_msg_monitored_items_modify_req: |
71 | 0 | case constants__e_msg_monitored_items_set_monitoring_mode_req: |
72 | 0 | case constants__e_msg_monitored_items_set_triggering_req: |
73 | 0 | case constants__e_msg_monitored_items_delete_req: |
74 | 0 | case constants__e_msg_subscription_create_req: |
75 | 0 | case constants__e_msg_subscription_modify_req: |
76 | 0 | case constants__e_msg_subscription_set_publishing_mode_req: |
77 | 0 | case constants__e_msg_subscription_publish_req: |
78 | 0 | case constants__e_msg_subscription_republish_req: |
79 | 0 | case constants__e_msg_subscription_transfer_subscriptions_req: |
80 | 0 | case constants__e_msg_subscription_delete_subscriptions_req: |
81 | 0 | case constants__e_msg_discovery_find_servers_req: |
82 | 0 | case constants__e_msg_discovery_find_servers_on_network_req: |
83 | 0 | case constants__e_msg_discovery_get_endpoints_req: |
84 | 0 | case constants__e_msg_discovery_register_server_req: |
85 | 0 | case constants__e_msg_discovery_register_server2_req: |
86 | 0 | *io_dispatch_mgr__header_type = constants__e_msg_request_type; |
87 | 0 | break; |
88 | 0 | case constants__e_msg_session_create_resp: |
89 | 0 | case constants__e_msg_session_activate_resp: |
90 | 0 | case constants__e_msg_session_close_resp: |
91 | 0 | case constants__e_msg_session_cancel_resp: |
92 | 0 | case constants__e_msg_node_add_nodes_resp: |
93 | 0 | case constants__e_msg_node_add_references_resp: |
94 | 0 | case constants__e_msg_node_delete_nodes_resp: |
95 | 0 | case constants__e_msg_node_delete_references_resp: |
96 | 0 | case constants__e_msg_view_browse_resp: |
97 | 0 | case constants__e_msg_view_browse_next_resp: |
98 | 0 | case constants__e_msg_view_translate_browse_paths_to_node_ids_resp: |
99 | 0 | case constants__e_msg_view_register_nodes_resp: |
100 | 0 | case constants__e_msg_view_unregister_nodes_resp: |
101 | 0 | case constants__e_msg_query_first_resp: |
102 | 0 | case constants__e_msg_query_next_resp: |
103 | 0 | case constants__e_msg_attribute_read_resp: |
104 | 0 | case constants__e_msg_attribute_history_read_resp: |
105 | 0 | case constants__e_msg_attribute_write_resp: |
106 | 0 | case constants__e_msg_attribute_history_update_resp: |
107 | 0 | case constants__e_msg_method_call_resp: |
108 | 0 | case constants__e_msg_monitored_items_create_resp: |
109 | 0 | case constants__e_msg_monitored_items_modify_resp: |
110 | 0 | case constants__e_msg_monitored_items_set_monitoring_mode_resp: |
111 | 0 | case constants__e_msg_monitored_items_set_triggering_resp: |
112 | 0 | case constants__e_msg_monitored_items_delete_resp: |
113 | 0 | case constants__e_msg_subscription_create_resp: |
114 | 0 | case constants__e_msg_subscription_modify_resp: |
115 | 0 | case constants__e_msg_subscription_set_publishing_mode_resp: |
116 | 0 | case constants__e_msg_subscription_publish_resp: |
117 | 0 | case constants__e_msg_subscription_republish_resp: |
118 | 0 | case constants__e_msg_subscription_transfer_subscriptions_resp: |
119 | 0 | case constants__e_msg_subscription_delete_subscriptions_resp: |
120 | 0 | case constants__e_msg_discovery_find_servers_resp: |
121 | 0 | case constants__e_msg_discovery_find_servers_on_network_resp: |
122 | 0 | case constants__e_msg_discovery_get_endpoints_resp: |
123 | 0 | case constants__e_msg_discovery_register_server_resp: |
124 | 0 | case constants__e_msg_discovery_register_server2_resp: |
125 | 0 | case constants__e_msg_service_fault_resp: |
126 | 0 | *io_dispatch_mgr__header_type = constants__e_msg_response_type; |
127 | 0 | break; |
128 | 0 | default: |
129 | 0 | break; |
130 | 0 | } |
131 | 0 | } |
132 | | |
133 | | void io_dispatch_mgr__get_msg_service_class( |
134 | | const constants__t_msg_type_i io_dispatch_mgr__msg_typ, |
135 | 0 | constants__t_msg_service_class_i * const io_dispatch_mgr__service_class) { |
136 | 0 | switch (io_dispatch_mgr__msg_typ) { |
137 | 0 | case constants__e_msg_discovery_find_servers_req: |
138 | 0 | case constants__e_msg_discovery_find_servers_resp: |
139 | 0 | case constants__e_msg_discovery_find_servers_on_network_req: |
140 | 0 | case constants__e_msg_discovery_find_servers_on_network_resp: |
141 | 0 | case constants__e_msg_discovery_get_endpoints_req: |
142 | 0 | case constants__e_msg_discovery_get_endpoints_resp: |
143 | 0 | case constants__e_msg_discovery_register_server_req: |
144 | 0 | case constants__e_msg_discovery_register_server_resp: |
145 | 0 | case constants__e_msg_discovery_register_server2_req: |
146 | 0 | case constants__e_msg_discovery_register_server2_resp: |
147 | 0 | *io_dispatch_mgr__service_class = constants__e_msg_discovery_service_class; |
148 | 0 | break; |
149 | 0 | case constants__e_msg_session_create_req: |
150 | 0 | case constants__e_msg_session_create_resp: |
151 | 0 | case constants__e_msg_session_activate_req: |
152 | 0 | case constants__e_msg_session_activate_resp: |
153 | 0 | case constants__e_msg_session_close_req: |
154 | 0 | case constants__e_msg_session_close_resp: |
155 | 0 | case constants__e_msg_session_cancel_req: |
156 | 0 | case constants__e_msg_session_cancel_resp: |
157 | 0 | *io_dispatch_mgr__service_class = constants__e_msg_session_treatment_class; |
158 | 0 | break; |
159 | 0 | case constants__e_msg_node_add_nodes_req: |
160 | 0 | case constants__e_msg_node_add_nodes_resp: |
161 | 0 | case constants__e_msg_node_add_references_req: |
162 | 0 | case constants__e_msg_node_add_references_resp: |
163 | 0 | case constants__e_msg_node_delete_nodes_req: |
164 | 0 | case constants__e_msg_node_delete_nodes_resp: |
165 | 0 | case constants__e_msg_node_delete_references_req: |
166 | 0 | case constants__e_msg_node_delete_references_resp: |
167 | 0 | case constants__e_msg_view_browse_req: |
168 | 0 | case constants__e_msg_view_browse_resp: |
169 | 0 | case constants__e_msg_view_browse_next_req: |
170 | 0 | case constants__e_msg_view_browse_next_resp: |
171 | 0 | case constants__e_msg_view_translate_browse_paths_to_node_ids_req: |
172 | 0 | case constants__e_msg_view_translate_browse_paths_to_node_ids_resp: |
173 | 0 | case constants__e_msg_view_register_nodes_req: |
174 | 0 | case constants__e_msg_view_register_nodes_resp: |
175 | 0 | case constants__e_msg_view_unregister_nodes_req: |
176 | 0 | case constants__e_msg_view_unregister_nodes_resp: |
177 | 0 | case constants__e_msg_query_first_req: |
178 | 0 | case constants__e_msg_query_first_resp: |
179 | 0 | case constants__e_msg_query_next_req: |
180 | 0 | case constants__e_msg_query_next_resp: |
181 | 0 | case constants__e_msg_attribute_read_req: |
182 | 0 | case constants__e_msg_attribute_read_resp: |
183 | 0 | case constants__e_msg_attribute_history_read_req: |
184 | 0 | case constants__e_msg_attribute_history_read_resp: |
185 | 0 | case constants__e_msg_attribute_write_req: |
186 | 0 | case constants__e_msg_attribute_write_resp: |
187 | 0 | case constants__e_msg_attribute_history_update_req: |
188 | 0 | case constants__e_msg_attribute_history_update_resp: |
189 | 0 | case constants__e_msg_method_call_req: |
190 | 0 | case constants__e_msg_method_call_resp: |
191 | 0 | case constants__e_msg_monitored_items_create_req: |
192 | 0 | case constants__e_msg_monitored_items_create_resp: |
193 | 0 | case constants__e_msg_monitored_items_modify_req: |
194 | 0 | case constants__e_msg_monitored_items_modify_resp: |
195 | 0 | case constants__e_msg_monitored_items_set_monitoring_mode_req: |
196 | 0 | case constants__e_msg_monitored_items_set_monitoring_mode_resp: |
197 | 0 | case constants__e_msg_monitored_items_set_triggering_req: |
198 | 0 | case constants__e_msg_monitored_items_set_triggering_resp: |
199 | 0 | case constants__e_msg_monitored_items_delete_req: |
200 | 0 | case constants__e_msg_monitored_items_delete_resp: |
201 | 0 | case constants__e_msg_subscription_create_req: |
202 | 0 | case constants__e_msg_subscription_create_resp: |
203 | 0 | case constants__e_msg_subscription_modify_req: |
204 | 0 | case constants__e_msg_subscription_modify_resp: |
205 | 0 | case constants__e_msg_subscription_set_publishing_mode_req: |
206 | 0 | case constants__e_msg_subscription_set_publishing_mode_resp: |
207 | 0 | case constants__e_msg_subscription_publish_req: |
208 | 0 | case constants__e_msg_subscription_publish_resp: |
209 | 0 | case constants__e_msg_subscription_republish_req: |
210 | 0 | case constants__e_msg_subscription_republish_resp: |
211 | 0 | case constants__e_msg_subscription_transfer_subscriptions_req: |
212 | 0 | case constants__e_msg_subscription_transfer_subscriptions_resp: |
213 | 0 | case constants__e_msg_subscription_delete_subscriptions_req: |
214 | 0 | case constants__e_msg_subscription_delete_subscriptions_resp: |
215 | 0 | *io_dispatch_mgr__service_class = constants__e_msg_session_service_class; |
216 | 0 | break; |
217 | 0 | default: |
218 | 0 | *io_dispatch_mgr__service_class = constants__e_msg_service_fault_class; |
219 | 0 | break; |
220 | 0 | } |
221 | 0 | } |
222 | | |
223 | | void io_dispatch_mgr__l_may_close_secure_channel_without_session( |
224 | 0 | t_bool * const io_dispatch_mgr__l_is_one_sc_closing) { |
225 | 0 | { |
226 | 0 | t_bool io_dispatch_mgr__l_is_active; |
227 | 0 | t_bool io_dispatch_mgr__l_has_channel_to_close; |
228 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel_to_close; |
229 | | |
230 | 0 | *io_dispatch_mgr__l_is_one_sc_closing = false; |
231 | 0 | channel_mgr__is_auto_close_channel_active(&io_dispatch_mgr__l_is_active); |
232 | 0 | if (io_dispatch_mgr__l_is_active == true) { |
233 | 0 | service_mgr__find_channel_to_close(&io_dispatch_mgr__l_has_channel_to_close, |
234 | 0 | &io_dispatch_mgr__l_channel_to_close); |
235 | 0 | if (io_dispatch_mgr__l_has_channel_to_close == true) { |
236 | 0 | channel_mgr__close_secure_channel(io_dispatch_mgr__l_channel_to_close, |
237 | 0 | constants_statuscodes_bs__e_sc_bad_session_not_activated); |
238 | 0 | *io_dispatch_mgr__l_is_one_sc_closing = true; |
239 | 0 | } |
240 | 0 | } |
241 | 0 | } |
242 | 0 | } |
243 | | |
244 | | void io_dispatch_mgr__l_set_app_call_context_channel_config( |
245 | 0 | const constants__t_channel_i io_dispatch_mgr__p_channel) { |
246 | 0 | { |
247 | 0 | t_bool io_dispatch_mgr__l_is_connected; |
248 | 0 | constants__t_channel_config_idx_i io_dispatch_mgr__l_channel_config; |
249 | 0 | constants__t_endpoint_config_idx_i io_dispatch_mgr__l_endpoint_config; |
250 | | |
251 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__p_channel, |
252 | 0 | &io_dispatch_mgr__l_is_connected); |
253 | 0 | if (io_dispatch_mgr__l_is_connected == true) { |
254 | 0 | channel_mgr__get_channel_info(io_dispatch_mgr__p_channel, |
255 | 0 | &io_dispatch_mgr__l_channel_config); |
256 | 0 | channel_mgr__server_get_endpoint_config(io_dispatch_mgr__p_channel, |
257 | 0 | &io_dispatch_mgr__l_endpoint_config); |
258 | 0 | app_cb_call_context_bs__set_app_call_context_channel_config(io_dispatch_mgr__l_channel_config, |
259 | 0 | io_dispatch_mgr__l_endpoint_config); |
260 | 0 | } |
261 | 0 | } |
262 | 0 | } |
263 | | |
264 | | void io_dispatch_mgr__receive_msg_buffer( |
265 | | const constants__t_channel_i io_dispatch_mgr__channel, |
266 | | const constants__t_byte_buffer_i io_dispatch_mgr__buffer, |
267 | | const constants__t_request_context_i io_dispatch_mgr__request_context, |
268 | 0 | t_bool * const io_dispatch_mgr__valid_msg) { |
269 | 0 | { |
270 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
271 | 0 | t_bool io_dispatch_mgr__l_is_client; |
272 | 0 | constants__t_msg_type_i io_dispatch_mgr__l_msg_type; |
273 | 0 | constants__t_msg_type_i io_dispatch_mgr__l_exp_msg_type; |
274 | 0 | t_bool io_dispatch_mgr__l_valid_msg_type; |
275 | 0 | constants__t_msg_header_type_i io_dispatch_mgr__l_msg_header_type; |
276 | 0 | constants__t_msg_service_class_i io_dispatch_mgr__l_msg_service_class; |
277 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
278 | 0 | t_bool io_dispatch_mgr__l_valid_req_context; |
279 | 0 | t_bool io_dispatch_mgr__l_valid_req_header; |
280 | 0 | t_bool io_dispatch_mgr__l_valid_req; |
281 | 0 | t_bool io_dispatch_mgr__l_async_resp; |
282 | 0 | t_bool io_dispatch_mgr__l_valid_resp; |
283 | 0 | constants_statuscodes_bs__t_StatusCode_i io_dispatch_mgr__l_sc; |
284 | | |
285 | 0 | io_dispatch_mgr__l_async_resp = false; |
286 | 0 | *io_dispatch_mgr__valid_msg = false; |
287 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__channel, |
288 | 0 | &io_dispatch_mgr__l_connected_channel); |
289 | 0 | service_mgr__decode_msg_type(io_dispatch_mgr__buffer, |
290 | 0 | &io_dispatch_mgr__l_valid_msg_type, |
291 | 0 | &io_dispatch_mgr__l_msg_type); |
292 | 0 | if ((io_dispatch_mgr__l_connected_channel == true) && |
293 | 0 | (io_dispatch_mgr__l_valid_msg_type == true)) { |
294 | 0 | channel_mgr__is_client_channel(io_dispatch_mgr__channel, |
295 | 0 | &io_dispatch_mgr__l_is_client); |
296 | 0 | io_dispatch_mgr__get_msg_header_type(io_dispatch_mgr__l_msg_type, |
297 | 0 | &io_dispatch_mgr__l_msg_header_type); |
298 | 0 | io_dispatch_mgr__get_msg_service_class(io_dispatch_mgr__l_msg_type, |
299 | 0 | &io_dispatch_mgr__l_msg_service_class); |
300 | 0 | io_dispatch_mgr__l_set_app_call_context_channel_config(io_dispatch_mgr__channel); |
301 | 0 | switch (io_dispatch_mgr__l_msg_header_type) { |
302 | 0 | case constants__e_msg_request_type: |
303 | 0 | io_dispatch_mgr__l_valid_req = false; |
304 | 0 | service_mgr__is_valid_request_context(io_dispatch_mgr__request_context, |
305 | 0 | &io_dispatch_mgr__l_valid_req_context); |
306 | 0 | if ((io_dispatch_mgr__l_is_client == false) && |
307 | 0 | (io_dispatch_mgr__l_valid_req_context == true)) { |
308 | 0 | io_dispatch_mgr__l_valid_req_header = false; |
309 | 0 | switch (io_dispatch_mgr__l_msg_service_class) { |
310 | 0 | case constants__e_msg_session_treatment_class: |
311 | 0 | channel_mgr__update_create_session_locked(io_dispatch_mgr__channel); |
312 | 0 | service_mgr__server_receive_session_treatment_req(io_dispatch_mgr__channel, |
313 | 0 | io_dispatch_mgr__l_msg_type, |
314 | 0 | io_dispatch_mgr__buffer, |
315 | 0 | &io_dispatch_mgr__l_valid_req_header, |
316 | 0 | &io_dispatch_mgr__l_valid_req, |
317 | 0 | &io_dispatch_mgr__l_sc, |
318 | 0 | &io_dispatch_mgr__l_buffer_out); |
319 | 0 | break; |
320 | 0 | case constants__e_msg_session_service_class: |
321 | 0 | service_mgr__server_receive_session_service_req(io_dispatch_mgr__channel, |
322 | 0 | io_dispatch_mgr__l_msg_type, |
323 | 0 | io_dispatch_mgr__request_context, |
324 | 0 | io_dispatch_mgr__buffer, |
325 | 0 | &io_dispatch_mgr__l_valid_req_header, |
326 | 0 | &io_dispatch_mgr__l_valid_req, |
327 | 0 | &io_dispatch_mgr__l_async_resp, |
328 | 0 | &io_dispatch_mgr__l_sc, |
329 | 0 | &io_dispatch_mgr__l_buffer_out); |
330 | 0 | break; |
331 | 0 | case constants__e_msg_discovery_service_class: |
332 | 0 | service_mgr__server_receive_discovery_service_req(io_dispatch_mgr__channel, |
333 | 0 | io_dispatch_mgr__l_msg_type, |
334 | 0 | io_dispatch_mgr__buffer, |
335 | 0 | &io_dispatch_mgr__l_valid_req_header, |
336 | 0 | &io_dispatch_mgr__l_valid_req, |
337 | 0 | &io_dispatch_mgr__l_sc, |
338 | 0 | &io_dispatch_mgr__l_buffer_out); |
339 | 0 | break; |
340 | 0 | default: |
341 | 0 | io_dispatch_mgr__l_valid_req = false; |
342 | 0 | io_dispatch_mgr__l_buffer_out = constants__c_byte_buffer_indet; |
343 | 0 | io_dispatch_mgr__l_sc = constants_statuscodes_bs__c_StatusCode_indet; |
344 | 0 | break; |
345 | 0 | } |
346 | 0 | if (io_dispatch_mgr__l_buffer_out != constants__c_byte_buffer_indet) { |
347 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__channel, |
348 | 0 | io_dispatch_mgr__l_buffer_out, |
349 | 0 | io_dispatch_mgr__request_context); |
350 | 0 | if (io_dispatch_mgr__l_sc == constants_statuscodes_bs__e_sc_bad_security_checks_failed) { |
351 | 0 | channel_mgr__set_create_session_locked(io_dispatch_mgr__channel); |
352 | 0 | } |
353 | 0 | } |
354 | 0 | else if ((io_dispatch_mgr__l_valid_req == true) && |
355 | 0 | (io_dispatch_mgr__l_async_resp == false)) { |
356 | 0 | service_mgr__send_channel_error_msg(io_dispatch_mgr__channel, |
357 | 0 | io_dispatch_mgr__l_sc, |
358 | 0 | io_dispatch_mgr__request_context); |
359 | 0 | } |
360 | 0 | else if (io_dispatch_mgr__l_valid_req_header == false) { |
361 | 0 | channel_mgr__close_secure_channel(io_dispatch_mgr__channel, |
362 | 0 | constants_statuscodes_bs__e_sc_bad_decoding_error); |
363 | 0 | } |
364 | 0 | } |
365 | 0 | else { |
366 | 0 | channel_mgr__close_secure_channel(io_dispatch_mgr__channel, |
367 | 0 | constants_statuscodes_bs__e_sc_bad_type_mismatch); |
368 | 0 | } |
369 | 0 | *io_dispatch_mgr__valid_msg = io_dispatch_mgr__l_valid_req; |
370 | 0 | break; |
371 | 0 | case constants__e_msg_response_type: |
372 | 0 | io_dispatch_mgr__l_valid_resp = false; |
373 | 0 | if (io_dispatch_mgr__l_is_client == true) { |
374 | 0 | if (io_dispatch_mgr__l_msg_service_class == constants__e_msg_service_fault_class) { |
375 | 0 | service_mgr__client_service_fault_to_resp_type(io_dispatch_mgr__buffer, |
376 | 0 | &io_dispatch_mgr__l_valid_resp, |
377 | 0 | &io_dispatch_mgr__l_exp_msg_type); |
378 | 0 | if (io_dispatch_mgr__l_valid_resp == true) { |
379 | 0 | io_dispatch_mgr__get_msg_service_class(io_dispatch_mgr__l_exp_msg_type, |
380 | 0 | &io_dispatch_mgr__l_msg_service_class); |
381 | 0 | } |
382 | 0 | } |
383 | 0 | else { |
384 | 0 | io_dispatch_mgr__l_valid_resp = true; |
385 | 0 | } |
386 | 0 | if (io_dispatch_mgr__l_valid_resp == true) { |
387 | 0 | switch (io_dispatch_mgr__l_msg_service_class) { |
388 | 0 | case constants__e_msg_session_treatment_class: |
389 | 0 | service_mgr__client_receive_session_treatment_resp(io_dispatch_mgr__channel, |
390 | 0 | io_dispatch_mgr__l_msg_type, |
391 | 0 | io_dispatch_mgr__buffer, |
392 | 0 | &io_dispatch_mgr__l_valid_resp); |
393 | 0 | break; |
394 | 0 | case constants__e_msg_session_service_class: |
395 | 0 | service_mgr__client_receive_session_service_resp(io_dispatch_mgr__channel, |
396 | 0 | io_dispatch_mgr__l_msg_type, |
397 | 0 | io_dispatch_mgr__buffer, |
398 | 0 | &io_dispatch_mgr__l_valid_resp); |
399 | 0 | break; |
400 | 0 | case constants__e_msg_discovery_service_class: |
401 | 0 | service_mgr__client_receive_discovery_service_resp(io_dispatch_mgr__channel, |
402 | 0 | io_dispatch_mgr__l_msg_type, |
403 | 0 | io_dispatch_mgr__buffer, |
404 | 0 | &io_dispatch_mgr__l_valid_resp); |
405 | 0 | break; |
406 | 0 | case constants__e_msg_service_fault_class: |
407 | 0 | ; |
408 | 0 | break; |
409 | 0 | default: |
410 | 0 | break; |
411 | 0 | } |
412 | 0 | } |
413 | 0 | } |
414 | 0 | else { |
415 | 0 | channel_mgr__close_secure_channel(io_dispatch_mgr__channel, |
416 | 0 | constants_statuscodes_bs__e_sc_bad_type_mismatch); |
417 | 0 | } |
418 | 0 | *io_dispatch_mgr__valid_msg = io_dispatch_mgr__l_valid_resp; |
419 | 0 | break; |
420 | 0 | default: |
421 | 0 | *io_dispatch_mgr__valid_msg = false; |
422 | 0 | break; |
423 | 0 | } |
424 | 0 | } |
425 | 0 | else if ((io_dispatch_mgr__l_connected_channel == true) && |
426 | 0 | (io_dispatch_mgr__l_valid_msg_type == false)) { |
427 | 0 | channel_mgr__close_secure_channel(io_dispatch_mgr__channel, |
428 | 0 | constants_statuscodes_bs__e_sc_bad_decoding_error); |
429 | 0 | } |
430 | 0 | service_mgr__dealloc_msg_in_buffer(io_dispatch_mgr__buffer); |
431 | 0 | app_cb_call_context_bs__clear_app_call_context(); |
432 | 0 | } |
433 | 0 | } |
434 | | |
435 | | void io_dispatch_mgr__snd_msg_failure( |
436 | | const constants__t_channel_i io_dispatch_mgr__channel, |
437 | | const constants__t_request_context_i io_dispatch_mgr__request_id, |
438 | 0 | const constants_statuscodes_bs__t_StatusCode_i io_dispatch_mgr__error_status) { |
439 | 0 | { |
440 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
441 | 0 | t_bool io_dispatch_mgr__l_is_client_channel; |
442 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_request_handle; |
443 | | |
444 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__channel, |
445 | 0 | &io_dispatch_mgr__l_connected_channel); |
446 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
447 | 0 | channel_mgr__is_client_channel(io_dispatch_mgr__channel, |
448 | 0 | &io_dispatch_mgr__l_is_client_channel); |
449 | 0 | if (io_dispatch_mgr__l_is_client_channel == true) { |
450 | 0 | service_mgr__client_request_id_to_req_handle(io_dispatch_mgr__request_id, |
451 | 0 | &io_dispatch_mgr__l_request_handle); |
452 | 0 | service_mgr__client_snd_msg_failure(io_dispatch_mgr__channel, |
453 | 0 | io_dispatch_mgr__l_request_handle, |
454 | 0 | io_dispatch_mgr__error_status); |
455 | 0 | } |
456 | 0 | } |
457 | 0 | } |
458 | 0 | } |
459 | | |
460 | | void io_dispatch_mgr__client_request_timeout( |
461 | | const constants__t_channel_i io_dispatch_mgr__channel, |
462 | 0 | const constants__t_client_request_handle_i io_dispatch_mgr__request_handle) { |
463 | 0 | { |
464 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
465 | 0 | t_bool io_dispatch_mgr__l_is_client_channel; |
466 | | |
467 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__channel, |
468 | 0 | &io_dispatch_mgr__l_connected_channel); |
469 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
470 | 0 | channel_mgr__is_client_channel(io_dispatch_mgr__channel, |
471 | 0 | &io_dispatch_mgr__l_is_client_channel); |
472 | 0 | if (io_dispatch_mgr__l_is_client_channel == true) { |
473 | 0 | service_mgr__client_snd_msg_failure(io_dispatch_mgr__channel, |
474 | 0 | io_dispatch_mgr__request_handle, |
475 | 0 | constants_statuscodes_bs__e_sc_bad_timeout); |
476 | 0 | } |
477 | 0 | } |
478 | 0 | } |
479 | 0 | } |
480 | | |
481 | | void io_dispatch_mgr__client_channel_connected_event( |
482 | | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx, |
483 | | const constants__t_reverse_endpoint_config_idx_i io_dispatch_mgr__reverse_endpoint_config_idx, |
484 | 0 | const constants__t_channel_i io_dispatch_mgr__channel) { |
485 | 0 | { |
486 | 0 | t_bool io_dispatch_mgr__l_bres; |
487 | | |
488 | 0 | channel_mgr__cli_set_connected_channel(io_dispatch_mgr__channel_config_idx, |
489 | 0 | io_dispatch_mgr__reverse_endpoint_config_idx, |
490 | 0 | io_dispatch_mgr__channel, |
491 | 0 | &io_dispatch_mgr__l_bres); |
492 | 0 | if (io_dispatch_mgr__l_bres == true) { |
493 | 0 | service_mgr__client_channel_connected_event_session(io_dispatch_mgr__channel_config_idx, |
494 | 0 | io_dispatch_mgr__channel); |
495 | 0 | service_mgr__client_channel_connected_event_discovery(io_dispatch_mgr__channel_config_idx, |
496 | 0 | io_dispatch_mgr__reverse_endpoint_config_idx, |
497 | 0 | io_dispatch_mgr__channel); |
498 | 0 | } |
499 | 0 | } |
500 | 0 | } |
501 | | |
502 | | void io_dispatch_mgr__client_secure_channel_timeout( |
503 | 0 | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx) { |
504 | 0 | { |
505 | 0 | t_bool io_dispatch_mgr__l_bres; |
506 | | |
507 | 0 | service_mgr__client_discovery_req_failures_on_final_connection_failure(io_dispatch_mgr__channel_config_idx); |
508 | 0 | service_mgr__client_close_sessions_on_final_connection_failure(io_dispatch_mgr__channel_config_idx); |
509 | 0 | channel_mgr__cli_set_connection_timeout_channel(io_dispatch_mgr__channel_config_idx, |
510 | 0 | &io_dispatch_mgr__l_bres); |
511 | 0 | } |
512 | 0 | } |
513 | | |
514 | | void io_dispatch_mgr__server_channel_connected_event( |
515 | | const constants__t_endpoint_config_idx_i io_dispatch_mgr__endpoint_config_idx, |
516 | | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx, |
517 | | const constants__t_channel_i io_dispatch_mgr__channel, |
518 | 0 | t_bool * const io_dispatch_mgr__bres) { |
519 | 0 | { |
520 | 0 | t_bool io_dispatch_mgr__l_is_one_sc_closing; |
521 | | |
522 | 0 | io_dispatch_mgr__l_may_close_secure_channel_without_session(&io_dispatch_mgr__l_is_one_sc_closing); |
523 | 0 | channel_mgr__srv_new_secure_channel(io_dispatch_mgr__endpoint_config_idx, |
524 | 0 | io_dispatch_mgr__channel_config_idx, |
525 | 0 | io_dispatch_mgr__channel, |
526 | 0 | io_dispatch_mgr__l_is_one_sc_closing, |
527 | 0 | io_dispatch_mgr__bres); |
528 | 0 | } |
529 | 0 | } |
530 | | |
531 | | void io_dispatch_mgr__client_activate_new_session( |
532 | | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx, |
533 | | const constants__t_reverse_endpoint_config_idx_i io_dispatch_mgr__reverse_endpoint_config_idx, |
534 | | const constants__t_user_token_i io_dispatch_mgr__p_user_token, |
535 | | const constants__t_session_application_context_i io_dispatch_mgr__app_context, |
536 | 0 | t_bool * const io_dispatch_mgr__bres) { |
537 | 0 | { |
538 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
539 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
540 | 0 | t_bool io_dispatch_mgr__l_is_one_sc_closing; |
541 | | |
542 | 0 | channel_mgr__is_valid_channel_config_idx(io_dispatch_mgr__channel_config_idx, |
543 | 0 | io_dispatch_mgr__bres); |
544 | 0 | if (*io_dispatch_mgr__bres == true) { |
545 | 0 | channel_mgr__get_connected_channel(io_dispatch_mgr__channel_config_idx, |
546 | 0 | &io_dispatch_mgr__l_channel); |
547 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
548 | 0 | &io_dispatch_mgr__l_connected_channel); |
549 | 0 | if (io_dispatch_mgr__l_connected_channel == false) { |
550 | 0 | io_dispatch_mgr__l_may_close_secure_channel_without_session(&io_dispatch_mgr__l_is_one_sc_closing); |
551 | 0 | channel_mgr__cli_open_secure_channel(io_dispatch_mgr__channel_config_idx, |
552 | 0 | io_dispatch_mgr__reverse_endpoint_config_idx, |
553 | 0 | io_dispatch_mgr__l_is_one_sc_closing, |
554 | 0 | io_dispatch_mgr__bres); |
555 | 0 | if (*io_dispatch_mgr__bres == true) { |
556 | 0 | service_mgr__client_async_activate_new_session_without_channel(io_dispatch_mgr__channel_config_idx, |
557 | 0 | io_dispatch_mgr__p_user_token, |
558 | 0 | io_dispatch_mgr__app_context, |
559 | 0 | io_dispatch_mgr__bres); |
560 | 0 | } |
561 | 0 | } |
562 | 0 | else { |
563 | 0 | service_mgr__client_async_activate_new_session_with_channel(io_dispatch_mgr__channel_config_idx, |
564 | 0 | io_dispatch_mgr__l_channel, |
565 | 0 | io_dispatch_mgr__p_user_token, |
566 | 0 | io_dispatch_mgr__app_context, |
567 | 0 | io_dispatch_mgr__bres); |
568 | 0 | } |
569 | 0 | } |
570 | 0 | } |
571 | 0 | } |
572 | | |
573 | | void io_dispatch_mgr__client_reactivate_session_new_user( |
574 | | const constants__t_session_i io_dispatch_mgr__session, |
575 | 0 | const constants__t_user_token_i io_dispatch_mgr__p_user_token) { |
576 | 0 | { |
577 | 0 | t_bool io_dispatch_mgr__l_valid_session; |
578 | 0 | constants_statuscodes_bs__t_StatusCode_i io_dispatch_mgr__l_ret; |
579 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
580 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
581 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
582 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_req_handle; |
583 | 0 | constants__t_request_context_i io_dispatch_mgr__l_req_handle_in_req_id; |
584 | | |
585 | 0 | service_mgr__is_valid_session(io_dispatch_mgr__session, |
586 | 0 | &io_dispatch_mgr__l_valid_session); |
587 | 0 | if (io_dispatch_mgr__l_valid_session == true) { |
588 | 0 | service_mgr__client_service_activate_session(io_dispatch_mgr__session, |
589 | 0 | io_dispatch_mgr__p_user_token, |
590 | 0 | &io_dispatch_mgr__l_ret, |
591 | 0 | &io_dispatch_mgr__l_channel, |
592 | 0 | &io_dispatch_mgr__l_buffer_out, |
593 | 0 | &io_dispatch_mgr__l_req_handle); |
594 | 0 | if (io_dispatch_mgr__l_ret == constants_statuscodes_bs__e_sc_ok) { |
595 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
596 | 0 | &io_dispatch_mgr__l_connected_channel); |
597 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
598 | 0 | service_mgr__client_req_handle_to_request_id(io_dispatch_mgr__l_req_handle, |
599 | 0 | &io_dispatch_mgr__l_req_handle_in_req_id); |
600 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
601 | 0 | io_dispatch_mgr__l_buffer_out, |
602 | 0 | io_dispatch_mgr__l_req_handle_in_req_id); |
603 | 0 | } |
604 | 0 | } |
605 | 0 | } |
606 | 0 | } |
607 | 0 | } |
608 | | |
609 | | void io_dispatch_mgr__client_send_service_request( |
610 | | const constants__t_session_i io_dispatch_mgr__session, |
611 | | const constants__t_msg_i io_dispatch_mgr__req_msg, |
612 | | const constants__t_application_context_i io_dispatch_mgr__app_context, |
613 | 0 | constants_statuscodes_bs__t_StatusCode_i * const io_dispatch_mgr__ret) { |
614 | 0 | { |
615 | 0 | t_bool io_dispatch_mgr__l_valid_session; |
616 | 0 | constants__t_msg_type_i io_dispatch_mgr__l_msg_typ; |
617 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
618 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
619 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
620 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_req_handle; |
621 | 0 | constants__t_request_context_i io_dispatch_mgr__l_req_handle_in_req_id; |
622 | | |
623 | 0 | service_mgr__is_valid_session(io_dispatch_mgr__session, |
624 | 0 | &io_dispatch_mgr__l_valid_session); |
625 | 0 | service_mgr__bless_msg_out(io_dispatch_mgr__req_msg, |
626 | 0 | &io_dispatch_mgr__l_msg_typ); |
627 | 0 | if ((io_dispatch_mgr__l_valid_session == true) && |
628 | 0 | (io_dispatch_mgr__l_msg_typ != constants__c_msg_type_indet)) { |
629 | 0 | service_mgr__client_service_request(io_dispatch_mgr__session, |
630 | 0 | io_dispatch_mgr__l_msg_typ, |
631 | 0 | io_dispatch_mgr__req_msg, |
632 | 0 | io_dispatch_mgr__app_context, |
633 | 0 | io_dispatch_mgr__ret, |
634 | 0 | &io_dispatch_mgr__l_channel, |
635 | 0 | &io_dispatch_mgr__l_buffer_out, |
636 | 0 | &io_dispatch_mgr__l_req_handle); |
637 | 0 | if (*io_dispatch_mgr__ret == constants_statuscodes_bs__e_sc_ok) { |
638 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
639 | 0 | &io_dispatch_mgr__l_connected_channel); |
640 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
641 | 0 | service_mgr__client_req_handle_to_request_id(io_dispatch_mgr__l_req_handle, |
642 | 0 | &io_dispatch_mgr__l_req_handle_in_req_id); |
643 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
644 | 0 | io_dispatch_mgr__l_buffer_out, |
645 | 0 | io_dispatch_mgr__l_req_handle_in_req_id); |
646 | 0 | } |
647 | 0 | } |
648 | 0 | } |
649 | 0 | else { |
650 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_bad_invalid_argument; |
651 | 0 | } |
652 | 0 | if (io_dispatch_mgr__l_msg_typ != constants__c_msg_type_indet) { |
653 | 0 | service_mgr__dealloc_msg_out(io_dispatch_mgr__req_msg); |
654 | 0 | } |
655 | 0 | } |
656 | 0 | } |
657 | | |
658 | | void io_dispatch_mgr__client_send_discovery_request( |
659 | | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx, |
660 | | const constants__t_reverse_endpoint_config_idx_i io_dispatch_mgr__reverse_endpoint_config_idx, |
661 | | const constants__t_msg_i io_dispatch_mgr__req_msg, |
662 | | const constants__t_application_context_i io_dispatch_mgr__app_context, |
663 | 0 | constants_statuscodes_bs__t_StatusCode_i * const io_dispatch_mgr__ret) { |
664 | 0 | { |
665 | 0 | constants__t_msg_type_i io_dispatch_mgr__l_msg_typ; |
666 | 0 | t_bool io_dispatch_mgr__l_valid_channel_config; |
667 | 0 | t_bool io_dispatch_mgr__l_bres; |
668 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
669 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
670 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
671 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_req_handle; |
672 | 0 | constants__t_request_context_i io_dispatch_mgr__l_req_handle_in_req_id; |
673 | 0 | t_bool io_dispatch_mgr__l_is_one_sc_closing; |
674 | | |
675 | 0 | service_mgr__bless_msg_out(io_dispatch_mgr__req_msg, |
676 | 0 | &io_dispatch_mgr__l_msg_typ); |
677 | 0 | channel_mgr__is_valid_channel_config_idx(io_dispatch_mgr__channel_config_idx, |
678 | 0 | &io_dispatch_mgr__l_valid_channel_config); |
679 | 0 | if ((io_dispatch_mgr__l_msg_typ != constants__c_msg_type_indet) && |
680 | 0 | (io_dispatch_mgr__l_valid_channel_config == true)) { |
681 | 0 | channel_mgr__get_connected_channel(io_dispatch_mgr__channel_config_idx, |
682 | 0 | &io_dispatch_mgr__l_channel); |
683 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
684 | 0 | &io_dispatch_mgr__l_connected_channel); |
685 | 0 | if (io_dispatch_mgr__l_connected_channel == false) { |
686 | 0 | io_dispatch_mgr__l_may_close_secure_channel_without_session(&io_dispatch_mgr__l_is_one_sc_closing); |
687 | 0 | channel_mgr__cli_open_secure_channel(io_dispatch_mgr__channel_config_idx, |
688 | 0 | io_dispatch_mgr__reverse_endpoint_config_idx, |
689 | 0 | io_dispatch_mgr__l_is_one_sc_closing, |
690 | 0 | &io_dispatch_mgr__l_bres); |
691 | 0 | if (io_dispatch_mgr__l_bres == true) { |
692 | 0 | service_mgr__client_async_discovery_request_without_channel(io_dispatch_mgr__channel_config_idx, |
693 | 0 | io_dispatch_mgr__l_msg_typ, |
694 | 0 | io_dispatch_mgr__req_msg, |
695 | 0 | io_dispatch_mgr__app_context, |
696 | 0 | &io_dispatch_mgr__l_bres); |
697 | 0 | if (io_dispatch_mgr__l_bres == true) { |
698 | 0 | service_mgr__forget_msg_out(io_dispatch_mgr__req_msg); |
699 | 0 | io_dispatch_mgr__l_msg_typ = constants__c_msg_type_indet; |
700 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_ok; |
701 | 0 | } |
702 | 0 | else { |
703 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_bad_too_many_ops; |
704 | 0 | } |
705 | 0 | } |
706 | 0 | else { |
707 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_bad_generic; |
708 | 0 | } |
709 | 0 | } |
710 | 0 | else { |
711 | 0 | service_mgr__client_discovery_service_request(io_dispatch_mgr__l_channel, |
712 | 0 | io_dispatch_mgr__l_msg_typ, |
713 | 0 | io_dispatch_mgr__req_msg, |
714 | 0 | io_dispatch_mgr__app_context, |
715 | 0 | io_dispatch_mgr__ret, |
716 | 0 | &io_dispatch_mgr__l_buffer_out, |
717 | 0 | &io_dispatch_mgr__l_req_handle); |
718 | 0 | if (*io_dispatch_mgr__ret == constants_statuscodes_bs__e_sc_ok) { |
719 | 0 | service_mgr__client_req_handle_to_request_id(io_dispatch_mgr__l_req_handle, |
720 | 0 | &io_dispatch_mgr__l_req_handle_in_req_id); |
721 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
722 | 0 | io_dispatch_mgr__l_buffer_out, |
723 | 0 | io_dispatch_mgr__l_req_handle_in_req_id); |
724 | 0 | } |
725 | 0 | } |
726 | 0 | } |
727 | 0 | else { |
728 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_bad_invalid_argument; |
729 | 0 | } |
730 | 0 | if (io_dispatch_mgr__l_msg_typ != constants__c_msg_type_indet) { |
731 | 0 | service_mgr__dealloc_msg_out(io_dispatch_mgr__req_msg); |
732 | 0 | } |
733 | 0 | } |
734 | 0 | } |
735 | | |
736 | | void io_dispatch_mgr__server_treat_local_service_request( |
737 | | const constants__t_endpoint_config_idx_i io_dispatch_mgr__endpoint_config_idx, |
738 | | const constants__t_msg_i io_dispatch_mgr__req_msg, |
739 | | const constants__t_application_context_i io_dispatch_mgr__app_context, |
740 | 0 | constants_statuscodes_bs__t_StatusCode_i * const io_dispatch_mgr__ret) { |
741 | 0 | { |
742 | 0 | constants__t_msg_type_i io_dispatch_mgr__l_msg_typ; |
743 | 0 | constants__t_msg_service_class_i io_dispatch_mgr__l_msg_service_class; |
744 | 0 | t_bool io_dispatch_mgr__l_valid_endpoint_config; |
745 | | |
746 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_bad_invalid_argument; |
747 | 0 | service_mgr__bless_msg_in(io_dispatch_mgr__req_msg, |
748 | 0 | &io_dispatch_mgr__l_msg_typ); |
749 | 0 | if (io_dispatch_mgr__l_msg_typ != constants__c_msg_type_indet) { |
750 | 0 | channel_mgr__is_valid_endpoint_config_idx(io_dispatch_mgr__endpoint_config_idx, |
751 | 0 | &io_dispatch_mgr__l_valid_endpoint_config); |
752 | 0 | if (io_dispatch_mgr__l_valid_endpoint_config == true) { |
753 | 0 | io_dispatch_mgr__get_msg_service_class(io_dispatch_mgr__l_msg_typ, |
754 | 0 | &io_dispatch_mgr__l_msg_service_class); |
755 | 0 | service_mgr__server_receive_local_service_req(io_dispatch_mgr__endpoint_config_idx, |
756 | 0 | io_dispatch_mgr__l_msg_service_class, |
757 | 0 | io_dispatch_mgr__l_msg_typ, |
758 | 0 | io_dispatch_mgr__req_msg, |
759 | 0 | io_dispatch_mgr__app_context, |
760 | 0 | io_dispatch_mgr__ret); |
761 | 0 | } |
762 | 0 | service_mgr__dealloc_msg_in(io_dispatch_mgr__req_msg); |
763 | 0 | } |
764 | 0 | } |
765 | 0 | } |
766 | | |
767 | | void io_dispatch_mgr__client_send_close_session_request( |
768 | | const constants__t_session_i io_dispatch_mgr__session, |
769 | 0 | constants_statuscodes_bs__t_StatusCode_i * const io_dispatch_mgr__ret) { |
770 | 0 | { |
771 | 0 | t_bool io_dispatch_mgr__l_valid_session; |
772 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
773 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
774 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
775 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_req_handle; |
776 | 0 | constants__t_request_context_i io_dispatch_mgr__l_req_handle_in_req_id; |
777 | | |
778 | 0 | service_mgr__is_valid_session(io_dispatch_mgr__session, |
779 | 0 | &io_dispatch_mgr__l_valid_session); |
780 | 0 | if (io_dispatch_mgr__l_valid_session == true) { |
781 | 0 | service_mgr__client_service_close_session(io_dispatch_mgr__session, |
782 | 0 | io_dispatch_mgr__ret, |
783 | 0 | &io_dispatch_mgr__l_channel, |
784 | 0 | &io_dispatch_mgr__l_buffer_out, |
785 | 0 | &io_dispatch_mgr__l_req_handle); |
786 | 0 | if (*io_dispatch_mgr__ret == constants_statuscodes_bs__e_sc_ok) { |
787 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
788 | 0 | &io_dispatch_mgr__l_connected_channel); |
789 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
790 | 0 | service_mgr__client_req_handle_to_request_id(io_dispatch_mgr__l_req_handle, |
791 | 0 | &io_dispatch_mgr__l_req_handle_in_req_id); |
792 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
793 | 0 | io_dispatch_mgr__l_buffer_out, |
794 | 0 | io_dispatch_mgr__l_req_handle_in_req_id); |
795 | 0 | } |
796 | 0 | } |
797 | 0 | } |
798 | 0 | else { |
799 | 0 | *io_dispatch_mgr__ret = constants_statuscodes_bs__e_sc_bad_invalid_argument; |
800 | 0 | } |
801 | 0 | } |
802 | 0 | } |
803 | | |
804 | | void io_dispatch_mgr__internal_client_create_session( |
805 | | const constants__t_session_i io_dispatch_mgr__session, |
806 | 0 | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx) { |
807 | 0 | { |
808 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
809 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
810 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
811 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_req_handle; |
812 | 0 | constants__t_request_context_i io_dispatch_mgr__l_req_handle_in_req_id; |
813 | | |
814 | 0 | channel_mgr__get_connected_channel(io_dispatch_mgr__channel_config_idx, |
815 | 0 | &io_dispatch_mgr__l_channel); |
816 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
817 | 0 | &io_dispatch_mgr__l_connected_channel); |
818 | 0 | if (io_dispatch_mgr__l_connected_channel == false) { |
819 | 0 | service_mgr__client_close_session(io_dispatch_mgr__session, |
820 | 0 | constants_statuscodes_bs__e_sc_bad_secure_channel_closed); |
821 | 0 | } |
822 | 0 | else { |
823 | 0 | service_mgr__client_service_create_session(io_dispatch_mgr__session, |
824 | 0 | io_dispatch_mgr__l_channel, |
825 | 0 | &io_dispatch_mgr__l_buffer_out, |
826 | 0 | &io_dispatch_mgr__l_req_handle); |
827 | 0 | if (io_dispatch_mgr__l_buffer_out != constants__c_byte_buffer_indet) { |
828 | 0 | service_mgr__client_req_handle_to_request_id(io_dispatch_mgr__l_req_handle, |
829 | 0 | &io_dispatch_mgr__l_req_handle_in_req_id); |
830 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
831 | 0 | io_dispatch_mgr__l_buffer_out, |
832 | 0 | io_dispatch_mgr__l_req_handle_in_req_id); |
833 | 0 | } |
834 | 0 | } |
835 | 0 | } |
836 | 0 | } |
837 | | |
838 | | void io_dispatch_mgr__internal_client_activate_orphaned_session( |
839 | | const constants__t_session_i io_dispatch_mgr__session, |
840 | 0 | const constants__t_channel_config_idx_i io_dispatch_mgr__channel_config_idx) { |
841 | 0 | { |
842 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
843 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
844 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
845 | 0 | constants__t_client_request_handle_i io_dispatch_mgr__l_req_handle; |
846 | 0 | constants__t_request_context_i io_dispatch_mgr__l_req_handle_in_req_id; |
847 | | |
848 | 0 | channel_mgr__get_connected_channel(io_dispatch_mgr__channel_config_idx, |
849 | 0 | &io_dispatch_mgr__l_channel); |
850 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
851 | 0 | &io_dispatch_mgr__l_connected_channel); |
852 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
853 | 0 | service_mgr__client_service_activate_orphaned_session(io_dispatch_mgr__session, |
854 | 0 | io_dispatch_mgr__l_channel, |
855 | 0 | &io_dispatch_mgr__l_buffer_out, |
856 | 0 | &io_dispatch_mgr__l_req_handle); |
857 | 0 | if (io_dispatch_mgr__l_buffer_out != constants__c_byte_buffer_indet) { |
858 | 0 | service_mgr__client_req_handle_to_request_id(io_dispatch_mgr__l_req_handle, |
859 | 0 | &io_dispatch_mgr__l_req_handle_in_req_id); |
860 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
861 | 0 | io_dispatch_mgr__l_buffer_out, |
862 | 0 | io_dispatch_mgr__l_req_handle_in_req_id); |
863 | 0 | } |
864 | 0 | } |
865 | 0 | } |
866 | 0 | } |
867 | | |
868 | | void io_dispatch_mgr__internal_server_evaluate_session_timeout( |
869 | 0 | const constants__t_session_i io_dispatch_mgr__session) { |
870 | 0 | service_mgr__server_evaluate_session_timeout(io_dispatch_mgr__session); |
871 | 0 | } |
872 | | |
873 | 0 | void io_dispatch_mgr__internal_server_evaluate_all_session_user_cert(void) { |
874 | 0 | service_mgr__server_evaluate_all_session_user_cert(); |
875 | 0 | } |
876 | | |
877 | | void io_dispatch_mgr__secure_channel_lost( |
878 | 0 | const constants__t_channel_i io_dispatch_mgr__channel) { |
879 | 0 | { |
880 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
881 | 0 | t_bool io_dispatch_mgr__l_disconnecting_channel; |
882 | 0 | t_bool io_dispatch_mgr__l_valid_new_channel; |
883 | 0 | t_bool io_dispatch_mgr__l_is_client; |
884 | 0 | constants__t_channel_config_idx_i io_dispatch_mgr__l_channel_config_idx; |
885 | 0 | constants__t_reverse_endpoint_config_idx_i io_dispatch_mgr__l_reverse_endpoint_config_idx; |
886 | 0 | constants__t_channel_i io_dispatch_mgr__l_new_channel; |
887 | 0 | t_bool io_dispatch_mgr__l_bres; |
888 | 0 | t_bool io_dispatch_mgr__l_is_one_sc_closing; |
889 | | |
890 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__channel, |
891 | 0 | &io_dispatch_mgr__l_connected_channel); |
892 | 0 | if (io_dispatch_mgr__l_connected_channel == true) { |
893 | 0 | channel_mgr__is_client_channel(io_dispatch_mgr__channel, |
894 | 0 | &io_dispatch_mgr__l_is_client); |
895 | 0 | if (io_dispatch_mgr__l_is_client == true) { |
896 | 0 | channel_mgr__get_all_channel_info(io_dispatch_mgr__channel, |
897 | 0 | &io_dispatch_mgr__l_channel_config_idx, |
898 | 0 | &io_dispatch_mgr__l_reverse_endpoint_config_idx); |
899 | 0 | channel_mgr__is_disconnecting_channel(io_dispatch_mgr__l_channel_config_idx, |
900 | 0 | &io_dispatch_mgr__l_disconnecting_channel); |
901 | 0 | service_mgr__client_secure_channel_lost_session_sm(io_dispatch_mgr__channel, |
902 | 0 | io_dispatch_mgr__l_channel_config_idx); |
903 | 0 | if (io_dispatch_mgr__l_disconnecting_channel == false) { |
904 | 0 | channel_mgr__get_connected_channel(io_dispatch_mgr__l_channel_config_idx, |
905 | 0 | &io_dispatch_mgr__l_new_channel); |
906 | 0 | if (io_dispatch_mgr__l_new_channel == constants__c_channel_indet) { |
907 | 0 | io_dispatch_mgr__l_may_close_secure_channel_without_session(&io_dispatch_mgr__l_is_one_sc_closing); |
908 | 0 | channel_mgr__cli_open_secure_channel(io_dispatch_mgr__l_channel_config_idx, |
909 | 0 | io_dispatch_mgr__l_reverse_endpoint_config_idx, |
910 | 0 | io_dispatch_mgr__l_is_one_sc_closing, |
911 | 0 | &io_dispatch_mgr__l_bres); |
912 | 0 | } |
913 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_new_channel, |
914 | 0 | &io_dispatch_mgr__l_valid_new_channel); |
915 | 0 | if (io_dispatch_mgr__l_valid_new_channel == true) { |
916 | 0 | service_mgr__client_channel_connected_event_session(io_dispatch_mgr__l_channel_config_idx, |
917 | 0 | io_dispatch_mgr__l_new_channel); |
918 | 0 | } |
919 | 0 | } |
920 | 0 | } |
921 | 0 | else { |
922 | 0 | service_mgr__server_secure_channel_lost_session_sm(io_dispatch_mgr__channel); |
923 | 0 | } |
924 | 0 | channel_mgr__channel_lost(io_dispatch_mgr__channel); |
925 | 0 | } |
926 | 0 | } |
927 | 0 | } |
928 | | |
929 | | void io_dispatch_mgr__internal_server_event_triggered( |
930 | | const constants__t_NodeId_i io_dispatch_mgr__p_notifierId, |
931 | | const constants__t_Event_i io_dispatch_mgr__p_event, |
932 | | const constants__t_subscription_i io_dispatch_mgr__p_sub_id, |
933 | | const constants__t_monitoredItemId_i io_dispatch_mgr__p_mi_id, |
934 | 0 | t_bool * const io_dispatch_mgr__bres) { |
935 | 0 | service_mgr__server_subscription_event_triggered(io_dispatch_mgr__p_notifierId, |
936 | 0 | io_dispatch_mgr__p_event, |
937 | 0 | io_dispatch_mgr__p_sub_id, |
938 | 0 | io_dispatch_mgr__p_mi_id, |
939 | 0 | io_dispatch_mgr__bres); |
940 | 0 | } |
941 | | |
942 | | void io_dispatch_mgr__internal_server_data_changed( |
943 | | const constants__t_WriteValuePointer_i io_dispatch_mgr__p_old_write_value_pointer, |
944 | | const constants__t_WriteValuePointer_i io_dispatch_mgr__p_new_write_value_pointer, |
945 | 0 | t_bool * const io_dispatch_mgr__bres) { |
946 | 0 | { |
947 | 0 | t_bool io_dispatch_mgr__l_old_valid_pointer; |
948 | 0 | t_bool io_dispatch_mgr__l_new_valid_pointer; |
949 | | |
950 | 0 | write_value_pointer_bs__write_value_pointer_is_valid(io_dispatch_mgr__p_old_write_value_pointer, |
951 | 0 | &io_dispatch_mgr__l_old_valid_pointer); |
952 | 0 | write_value_pointer_bs__write_value_pointer_is_valid(io_dispatch_mgr__p_new_write_value_pointer, |
953 | 0 | &io_dispatch_mgr__l_new_valid_pointer); |
954 | 0 | if ((io_dispatch_mgr__l_old_valid_pointer == true) && |
955 | 0 | (io_dispatch_mgr__l_new_valid_pointer == true)) { |
956 | 0 | service_mgr__server_subscription_data_changed(io_dispatch_mgr__p_old_write_value_pointer, |
957 | 0 | io_dispatch_mgr__p_new_write_value_pointer); |
958 | 0 | *io_dispatch_mgr__bres = true; |
959 | 0 | } |
960 | 0 | else { |
961 | 0 | *io_dispatch_mgr__bres = false; |
962 | 0 | } |
963 | 0 | } |
964 | 0 | } |
965 | | |
966 | | void io_dispatch_mgr__internal_server_node_changed( |
967 | | const t_bool io_dispatch_mgr__p_node_added, |
968 | 0 | const constants__t_NodeId_i io_dispatch_mgr__p_nid) { |
969 | 0 | service_mgr__server_subscription_node_changed(io_dispatch_mgr__p_node_added, |
970 | 0 | io_dispatch_mgr__p_nid); |
971 | 0 | } |
972 | | |
973 | | void io_dispatch_mgr__internal_server_subscription_publish_timeout( |
974 | | const constants__t_subscription_i io_dispatch_mgr__p_subscription, |
975 | 0 | t_bool * const io_dispatch_mgr__bres) { |
976 | 0 | { |
977 | 0 | t_bool io_dispatch_mgr__l_valid_subscription; |
978 | | |
979 | 0 | service_mgr__is_valid_subscription(io_dispatch_mgr__p_subscription, |
980 | 0 | &io_dispatch_mgr__l_valid_subscription); |
981 | 0 | if (io_dispatch_mgr__l_valid_subscription == true) { |
982 | 0 | service_mgr__server_subscription_publish_timeout(io_dispatch_mgr__p_subscription); |
983 | 0 | *io_dispatch_mgr__bres = true; |
984 | 0 | } |
985 | 0 | else { |
986 | 0 | *io_dispatch_mgr__bres = false; |
987 | 0 | } |
988 | 0 | } |
989 | 0 | } |
990 | | |
991 | | void io_dispatch_mgr__internal_server_send_publish_response_prio_event( |
992 | | const constants__t_session_i io_dispatch_mgr__p_session, |
993 | | const constants__t_server_request_handle_i io_dispatch_mgr__p_req_handle, |
994 | | const constants__t_request_context_i io_dispatch_mgr__p_req_context, |
995 | | const constants__t_msg_i io_dispatch_mgr__p_publish_resp_msg, |
996 | | const constants_statuscodes_bs__t_StatusCode_i io_dispatch_mgr__p_statusCode, |
997 | 0 | t_bool * const io_dispatch_mgr__bres) { |
998 | 0 | { |
999 | 0 | t_bool io_dispatch_mgr__l_valid_session; |
1000 | 0 | constants__t_msg_type_i io_dispatch_mgr__l_msg_typ; |
1001 | 0 | t_bool io_dispatch_mgr__l_valid_req_context; |
1002 | 0 | constants__t_byte_buffer_i io_dispatch_mgr__l_buffer_out; |
1003 | 0 | constants_statuscodes_bs__t_StatusCode_i io_dispatch_mgr__l_sc; |
1004 | 0 | constants__t_channel_i io_dispatch_mgr__l_channel; |
1005 | 0 | t_bool io_dispatch_mgr__l_connected_channel; |
1006 | | |
1007 | 0 | service_mgr__is_valid_session(io_dispatch_mgr__p_session, |
1008 | 0 | &io_dispatch_mgr__l_valid_session); |
1009 | 0 | service_mgr__bless_msg_out(io_dispatch_mgr__p_publish_resp_msg, |
1010 | 0 | &io_dispatch_mgr__l_msg_typ); |
1011 | 0 | service_mgr__is_valid_request_context(io_dispatch_mgr__p_req_context, |
1012 | 0 | &io_dispatch_mgr__l_valid_req_context); |
1013 | 0 | if ((((io_dispatch_mgr__l_valid_session == true) && |
1014 | 0 | (io_dispatch_mgr__l_msg_typ == constants__e_msg_subscription_publish_resp)) && |
1015 | 0 | (io_dispatch_mgr__l_valid_req_context == true)) && |
1016 | 0 | (io_dispatch_mgr__p_statusCode != constants_statuscodes_bs__c_StatusCode_indet)) { |
1017 | 0 | service_mgr__server_send_publish_response(io_dispatch_mgr__p_session, |
1018 | 0 | io_dispatch_mgr__p_req_handle, |
1019 | 0 | io_dispatch_mgr__p_statusCode, |
1020 | 0 | io_dispatch_mgr__l_msg_typ, |
1021 | 0 | io_dispatch_mgr__p_publish_resp_msg, |
1022 | 0 | io_dispatch_mgr__bres, |
1023 | 0 | &io_dispatch_mgr__l_sc, |
1024 | 0 | &io_dispatch_mgr__l_buffer_out, |
1025 | 0 | &io_dispatch_mgr__l_channel); |
1026 | 0 | channel_mgr__is_connected_channel(io_dispatch_mgr__l_channel, |
1027 | 0 | &io_dispatch_mgr__l_connected_channel); |
1028 | 0 | if ((*io_dispatch_mgr__bres == true) && |
1029 | 0 | (io_dispatch_mgr__l_connected_channel == true)) { |
1030 | 0 | service_mgr__send_channel_msg_buffer(io_dispatch_mgr__l_channel, |
1031 | 0 | io_dispatch_mgr__l_buffer_out, |
1032 | 0 | io_dispatch_mgr__p_req_context); |
1033 | 0 | } |
1034 | 0 | else if (io_dispatch_mgr__l_connected_channel == true) { |
1035 | 0 | service_mgr__send_channel_error_msg(io_dispatch_mgr__l_channel, |
1036 | 0 | io_dispatch_mgr__l_sc, |
1037 | 0 | io_dispatch_mgr__p_req_context); |
1038 | 0 | } |
1039 | 0 | } |
1040 | 0 | else { |
1041 | 0 | *io_dispatch_mgr__bres = false; |
1042 | 0 | } |
1043 | 0 | if (io_dispatch_mgr__l_msg_typ != constants__c_msg_type_indet) { |
1044 | 0 | service_mgr__dealloc_msg_out(io_dispatch_mgr__p_publish_resp_msg); |
1045 | 0 | } |
1046 | 0 | } |
1047 | 0 | } |
1048 | | |
1049 | | void io_dispatch_mgr__close_all_active_connections( |
1050 | | const t_bool io_dispatch_mgr__p_clientOnly, |
1051 | 0 | t_bool * const io_dispatch_mgr__bres) { |
1052 | 0 | channel_mgr__close_all_channel(io_dispatch_mgr__p_clientOnly, |
1053 | 0 | io_dispatch_mgr__bres); |
1054 | 0 | } |
1055 | | |
1056 | 0 | void io_dispatch_mgr__UNINITIALISATION(void) { |
1057 | 0 | service_mgr__service_mgr_UNINITIALISATION(); |
1058 | 0 | } |
1059 | | |