/src/S2OPC/src/ClientServer/services/bgenc/channel_mgr.c
Line | Count | Source |
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 : channel_mgr.c |
23 | | |
24 | | Date : 01/10/2025 15:57:50 |
25 | | |
26 | | C Translator Version : tradc Java V1.2 (06/02/2022) |
27 | | |
28 | | ******************************************************************************/ |
29 | | |
30 | | /*------------------------ |
31 | | Exported Declarations |
32 | | ------------------------*/ |
33 | | #include "channel_mgr.h" |
34 | | |
35 | | /*---------------------------- |
36 | | CONCRETE_VARIABLES Clause |
37 | | ----------------------------*/ |
38 | | t_bool channel_mgr__all_channel_closing; |
39 | | t_bool channel_mgr__all_client_only_channel_closing; |
40 | | |
41 | | /*------------------------ |
42 | | INITIALISATION Clause |
43 | | ------------------------*/ |
44 | 0 | void channel_mgr__INITIALISATION(void) { |
45 | 0 | channel_mgr__all_channel_closing = false; |
46 | 0 | channel_mgr__all_client_only_channel_closing = false; |
47 | 0 | } |
48 | | |
49 | | /*-------------------- |
50 | | OPERATIONS Clause |
51 | | --------------------*/ |
52 | | void channel_mgr__l_close_secure_channel( |
53 | | const constants__t_channel_i channel_mgr__p_channel, |
54 | | const constants_statuscodes_bs__t_StatusCode_i channel_mgr__p_statusCode, |
55 | 0 | const constants__t_application_context_i channel_mgr__p_close_ctx) { |
56 | 0 | { |
57 | 0 | t_bool channel_mgr__l_res; |
58 | 0 | constants__t_channel_config_idx_i channel_mgr__l_channel_conf; |
59 | 0 | t_bool channel_mgr__l_is_client_channel; |
60 | | |
61 | 0 | channel_mgr_1__getall_channel_connected(channel_mgr__p_channel, |
62 | 0 | &channel_mgr__l_res, |
63 | 0 | &channel_mgr__l_channel_conf); |
64 | 0 | if (channel_mgr__l_res == true) { |
65 | 0 | channel_mgr_1__is_client_channel(channel_mgr__p_channel, |
66 | 0 | &channel_mgr__l_is_client_channel); |
67 | 0 | if (channel_mgr__l_is_client_channel == true) { |
68 | 0 | channel_mgr_1__add_cli_channel_disconnecting(channel_mgr__l_channel_conf, |
69 | 0 | channel_mgr__p_close_ctx); |
70 | 0 | } |
71 | 0 | channel_mgr_bs__finalize_close_secure_channel(channel_mgr__p_channel, |
72 | 0 | channel_mgr__p_statusCode); |
73 | 0 | } |
74 | 0 | } |
75 | 0 | } |
76 | | |
77 | 0 | void channel_mgr__l_check_all_channel_lost(void) { |
78 | 0 | { |
79 | 0 | t_bool channel_mgr__l_cli_con; |
80 | 0 | t_bool channel_mgr__l_any_channel_connected_or_connecting; |
81 | 0 | t_bool channel_mgr__l_continue; |
82 | 0 | constants__t_channel_i channel_mgr__l_channel; |
83 | 0 | constants__t_channel_config_idx_i channel_mgr__l_config_idx; |
84 | | |
85 | 0 | if ((channel_mgr__all_channel_closing == true) || |
86 | 0 | (channel_mgr__all_client_only_channel_closing == true)) { |
87 | 0 | channel_mgr__l_any_channel_connected_or_connecting = false; |
88 | 0 | channel_mgr_it__init_iter_channel(&channel_mgr__l_continue); |
89 | 0 | while ((channel_mgr__l_continue == true) && |
90 | 0 | (channel_mgr__l_any_channel_connected_or_connecting == false)) { |
91 | 0 | channel_mgr_it__continue_iter_channel(&channel_mgr__l_continue, |
92 | 0 | &channel_mgr__l_channel); |
93 | 0 | channel_mgr_1__is_client_channel(channel_mgr__l_channel, |
94 | 0 | &channel_mgr__l_cli_con); |
95 | 0 | if ((channel_mgr__all_channel_closing == true) || |
96 | 0 | ((channel_mgr__all_client_only_channel_closing == true) && |
97 | 0 | (channel_mgr__l_cli_con == true))) { |
98 | 0 | channel_mgr_1__is_channel_connected(channel_mgr__l_channel, |
99 | 0 | &channel_mgr__l_any_channel_connected_or_connecting); |
100 | 0 | } |
101 | 0 | } |
102 | 0 | channel_mgr_it__init_iter_channel_config_idx(&channel_mgr__l_continue); |
103 | 0 | while ((channel_mgr__l_continue == true) && |
104 | 0 | (channel_mgr__l_any_channel_connected_or_connecting == false)) { |
105 | 0 | channel_mgr_it__continue_iter_channel_config_idx(&channel_mgr__l_continue, |
106 | 0 | &channel_mgr__l_config_idx); |
107 | 0 | channel_mgr_1__is_cli_channel_connecting(channel_mgr__l_config_idx, |
108 | 0 | &channel_mgr__l_any_channel_connected_or_connecting); |
109 | 0 | } |
110 | 0 | if (channel_mgr__l_any_channel_connected_or_connecting == false) { |
111 | 0 | channel_mgr_bs__last_connected_channel_lost(channel_mgr__all_client_only_channel_closing); |
112 | 0 | channel_mgr__all_channel_closing = false; |
113 | 0 | channel_mgr__all_client_only_channel_closing = false; |
114 | 0 | } |
115 | 0 | } |
116 | 0 | } |
117 | 0 | } |
118 | | |
119 | | void channel_mgr__l_is_new_sc_connection_allowed( |
120 | | const t_bool channel_mgr__is_one_sc_auto_closing, |
121 | 0 | t_bool * const channel_mgr__l_allowed_new_sc) { |
122 | 0 | { |
123 | 0 | t_entier4 channel_mgr__l_card_used; |
124 | 0 | t_entier4 channel_mgr__l_card_channel; |
125 | | |
126 | 0 | *channel_mgr__l_allowed_new_sc = false; |
127 | 0 | channel_mgr_1__get_card_channel_used(&channel_mgr__l_card_used); |
128 | 0 | constants__get_card_t_channel(&channel_mgr__l_card_channel); |
129 | 0 | if (channel_mgr__l_card_used != channel_mgr__l_card_channel) { |
130 | 0 | if ((channel_mgr__l_card_used < constants__c_max_channels_connected) || |
131 | 0 | (channel_mgr__is_one_sc_auto_closing == true)) { |
132 | 0 | *channel_mgr__l_allowed_new_sc = true; |
133 | 0 | } |
134 | 0 | } |
135 | 0 | } |
136 | 0 | } |
137 | | |
138 | | void channel_mgr__cli_open_secure_channel( |
139 | | const constants__t_channel_config_idx_i channel_mgr__config_idx, |
140 | | const constants__t_reverse_endpoint_config_idx_i channel_mgr__reverse_endpoint_config_idx, |
141 | | const t_bool channel_mgr__is_one_sc_auto_closing, |
142 | 0 | t_bool * const channel_mgr__bres) { |
143 | 0 | { |
144 | 0 | t_bool channel_mgr__l_already_connecting; |
145 | 0 | t_bool channel_mgr__l_dom; |
146 | 0 | constants__t_channel_i channel_mgr__l_channel; |
147 | 0 | t_bool channel_mgr__l_allowed_new_sc; |
148 | | |
149 | 0 | channel_mgr_1__is_cli_channel_connecting(channel_mgr__config_idx, |
150 | 0 | &channel_mgr__l_already_connecting); |
151 | 0 | if (channel_mgr__l_already_connecting == true) { |
152 | 0 | *channel_mgr__bres = true; |
153 | 0 | } |
154 | 0 | else { |
155 | 0 | channel_mgr_1__getall_config_inv(channel_mgr__config_idx, |
156 | 0 | &channel_mgr__l_dom, |
157 | 0 | &channel_mgr__l_channel); |
158 | 0 | if (channel_mgr__l_dom == false) { |
159 | 0 | channel_mgr__l_is_new_sc_connection_allowed(channel_mgr__is_one_sc_auto_closing, |
160 | 0 | &channel_mgr__l_allowed_new_sc); |
161 | 0 | if (channel_mgr__l_allowed_new_sc == true) { |
162 | 0 | channel_mgr_1__add_cli_channel_connecting(channel_mgr__config_idx); |
163 | 0 | channel_mgr_bs__prepare_cli_open_secure_channel(channel_mgr__config_idx, |
164 | 0 | channel_mgr__reverse_endpoint_config_idx); |
165 | 0 | *channel_mgr__bres = true; |
166 | 0 | } |
167 | 0 | else { |
168 | 0 | *channel_mgr__bres = false; |
169 | 0 | } |
170 | 0 | } |
171 | 0 | else { |
172 | 0 | *channel_mgr__bres = false; |
173 | 0 | } |
174 | 0 | } |
175 | 0 | } |
176 | 0 | } |
177 | | |
178 | | void channel_mgr__srv_new_secure_channel( |
179 | | const constants__t_endpoint_config_idx_i channel_mgr__endpoint_config_idx, |
180 | | const constants__t_channel_config_idx_i channel_mgr__channel_config_idx, |
181 | | const constants__t_channel_i channel_mgr__channel, |
182 | | const t_bool channel_mgr__is_one_sc_auto_closing, |
183 | 0 | t_bool * const channel_mgr__bres) { |
184 | 0 | { |
185 | 0 | t_bool channel_mgr__l_con; |
186 | 0 | t_bool channel_mgr__l_dom; |
187 | 0 | constants__t_channel_i channel_mgr__l_channel; |
188 | 0 | constants__t_timeref_i channel_mgr__l_current_time; |
189 | 0 | t_bool channel_mgr__l_allowed_new_sc; |
190 | | |
191 | 0 | channel_mgr_1__is_channel_connected(channel_mgr__channel, |
192 | 0 | &channel_mgr__l_con); |
193 | 0 | channel_mgr_1__getall_config_inv(channel_mgr__channel_config_idx, |
194 | 0 | &channel_mgr__l_dom, |
195 | 0 | &channel_mgr__l_channel); |
196 | 0 | channel_mgr__l_is_new_sc_connection_allowed(channel_mgr__is_one_sc_auto_closing, |
197 | 0 | &channel_mgr__l_allowed_new_sc); |
198 | 0 | if (((channel_mgr__l_con == false) && |
199 | 0 | (channel_mgr__l_dom == false)) && |
200 | 0 | (channel_mgr__l_allowed_new_sc == true)) { |
201 | 0 | time_reference_bs__get_current_TimeReference(&channel_mgr__l_current_time); |
202 | 0 | channel_mgr_1__add_channel_connected(channel_mgr__channel, |
203 | 0 | channel_mgr__l_current_time); |
204 | 0 | channel_mgr_1__set_config(channel_mgr__channel, |
205 | 0 | channel_mgr__channel_config_idx, |
206 | 0 | constants__c_reverse_endpoint_config_idx_indet); |
207 | 0 | channel_mgr_1__set_endpoint(channel_mgr__channel, |
208 | 0 | channel_mgr__endpoint_config_idx); |
209 | 0 | channel_mgr_bs__define_SecurityPolicy(channel_mgr__channel); |
210 | 0 | *channel_mgr__bres = true; |
211 | 0 | } |
212 | 0 | else { |
213 | 0 | *channel_mgr__bres = false; |
214 | 0 | } |
215 | 0 | } |
216 | 0 | } |
217 | | |
218 | | void channel_mgr__close_secure_channel( |
219 | | const constants__t_channel_i channel_mgr__channel, |
220 | 0 | const constants_statuscodes_bs__t_StatusCode_i channel_mgr__statusCode) { |
221 | 0 | channel_mgr__l_close_secure_channel(channel_mgr__channel, |
222 | 0 | channel_mgr__statusCode, |
223 | 0 | constants__c_no_application_context); |
224 | 0 | } |
225 | | |
226 | | void channel_mgr__close_client_channel( |
227 | | const constants__t_channel_config_idx_i channel_mgr__p_config_idx, |
228 | | const constants__t_application_context_i channel_mgr__p_close_ctx, |
229 | 0 | t_bool * const channel_mgr__bres) { |
230 | 0 | { |
231 | 0 | constants__t_channel_i channel_mgr__l_channel; |
232 | 0 | t_bool channel_mgr__l_connected; |
233 | 0 | t_bool channel_mgr__l_connecting; |
234 | 0 | t_bool channel_mgr__l_disconnecting; |
235 | 0 | t_bool channel_mgr__l_cli_con; |
236 | 0 | t_bool channel_mgr__l_new_sc_disconnecting; |
237 | | |
238 | 0 | channel_mgr__l_new_sc_disconnecting = false; |
239 | 0 | channel_mgr_1__is_cli_channel_connecting(channel_mgr__p_config_idx, |
240 | 0 | &channel_mgr__l_connecting); |
241 | 0 | channel_mgr_1__is_disconnecting_channel(channel_mgr__p_config_idx, |
242 | 0 | &channel_mgr__l_disconnecting); |
243 | 0 | channel_mgr_1__get_connected_channel(channel_mgr__p_config_idx, |
244 | 0 | &channel_mgr__l_channel); |
245 | 0 | channel_mgr_1__is_connected_channel(channel_mgr__l_channel, |
246 | 0 | &channel_mgr__l_connected); |
247 | 0 | if (channel_mgr__l_disconnecting == false) { |
248 | 0 | if (channel_mgr__l_connected == true) { |
249 | 0 | channel_mgr_1__is_client_channel(channel_mgr__l_channel, |
250 | 0 | &channel_mgr__l_cli_con); |
251 | 0 | if (channel_mgr__l_cli_con == true) { |
252 | 0 | channel_mgr__l_close_secure_channel(channel_mgr__l_channel, |
253 | 0 | constants_statuscodes_bs__e_sc_bad_secure_channel_closed, |
254 | 0 | channel_mgr__p_close_ctx); |
255 | 0 | channel_mgr__l_new_sc_disconnecting = true; |
256 | 0 | } |
257 | 0 | } |
258 | 0 | else if (channel_mgr__l_connecting == true) { |
259 | 0 | channel_mgr_1__add_cli_channel_disconnecting(channel_mgr__p_config_idx, |
260 | 0 | channel_mgr__p_close_ctx); |
261 | 0 | channel_mgr__l_new_sc_disconnecting = true; |
262 | 0 | } |
263 | 0 | } |
264 | 0 | *channel_mgr__bres = channel_mgr__l_new_sc_disconnecting; |
265 | 0 | } |
266 | 0 | } |
267 | | |
268 | | void channel_mgr__close_all_channel( |
269 | | const t_bool channel_mgr__p_clientOnly, |
270 | 0 | t_bool * const channel_mgr__bres) { |
271 | 0 | { |
272 | 0 | t_bool channel_mgr__l_continue; |
273 | 0 | constants__t_channel_i channel_mgr__l_channel; |
274 | 0 | constants__t_channel_config_idx_i channel_mgr__l_config_idx; |
275 | 0 | t_bool channel_mgr__l_connected; |
276 | 0 | t_bool channel_mgr__l_connecting; |
277 | 0 | t_bool channel_mgr__l_cli_con; |
278 | 0 | t_bool channel_mgr__l_any_channel_closing_or_connecting; |
279 | | |
280 | 0 | channel_mgr__l_any_channel_closing_or_connecting = false; |
281 | 0 | channel_mgr_it__init_iter_channel(&channel_mgr__l_continue); |
282 | 0 | while (channel_mgr__l_continue == true) { |
283 | 0 | channel_mgr_it__continue_iter_channel(&channel_mgr__l_continue, |
284 | 0 | &channel_mgr__l_channel); |
285 | 0 | channel_mgr_1__is_channel_connected(channel_mgr__l_channel, |
286 | 0 | &channel_mgr__l_connected); |
287 | 0 | channel_mgr_1__is_client_channel(channel_mgr__l_channel, |
288 | 0 | &channel_mgr__l_cli_con); |
289 | 0 | if ((channel_mgr__l_connected == true) && |
290 | 0 | ((channel_mgr__p_clientOnly == false) || |
291 | 0 | (channel_mgr__l_cli_con == true))) { |
292 | 0 | channel_mgr__l_any_channel_closing_or_connecting = true; |
293 | 0 | channel_mgr__l_close_secure_channel(channel_mgr__l_channel, |
294 | 0 | constants_statuscodes_bs__e_sc_bad_secure_channel_closed, |
295 | 0 | constants__c_no_application_context); |
296 | 0 | } |
297 | 0 | } |
298 | 0 | channel_mgr_it__init_iter_channel_config_idx(&channel_mgr__l_continue); |
299 | 0 | while (channel_mgr__l_continue == true) { |
300 | 0 | channel_mgr_it__continue_iter_channel_config_idx(&channel_mgr__l_continue, |
301 | 0 | &channel_mgr__l_config_idx); |
302 | 0 | channel_mgr_1__is_cli_channel_connecting(channel_mgr__l_config_idx, |
303 | 0 | &channel_mgr__l_connecting); |
304 | 0 | if (channel_mgr__l_connecting == true) { |
305 | 0 | channel_mgr__l_any_channel_closing_or_connecting = true; |
306 | 0 | channel_mgr_1__add_cli_channel_disconnecting(channel_mgr__l_config_idx, |
307 | 0 | constants__c_no_application_context); |
308 | 0 | } |
309 | 0 | } |
310 | 0 | channel_mgr__all_channel_closing = ((channel_mgr__p_clientOnly == false) && |
311 | 0 | (channel_mgr__l_any_channel_closing_or_connecting == true)); |
312 | 0 | channel_mgr__all_client_only_channel_closing = ((channel_mgr__p_clientOnly == true) && |
313 | 0 | (channel_mgr__l_any_channel_closing_or_connecting == true)); |
314 | 0 | *channel_mgr__bres = channel_mgr__l_any_channel_closing_or_connecting; |
315 | 0 | } |
316 | 0 | } |
317 | | |
318 | | void channel_mgr__channel_lost( |
319 | 0 | const constants__t_channel_i channel_mgr__channel) { |
320 | 0 | { |
321 | 0 | t_bool channel_mgr__l_res; |
322 | 0 | constants__t_channel_config_idx_i channel_mgr__l_channel_conf; |
323 | 0 | constants__t_application_context_i channel_mgr__l_closing_ctx; |
324 | | |
325 | 0 | channel_mgr_1__getall_channel_connected(channel_mgr__channel, |
326 | 0 | &channel_mgr__l_res, |
327 | 0 | &channel_mgr__l_channel_conf); |
328 | 0 | if (channel_mgr__l_res == true) { |
329 | 0 | channel_mgr_1__remove_channel_connected(channel_mgr__channel); |
330 | 0 | channel_mgr_1__remove_cli_channel_disconnecting(channel_mgr__l_channel_conf, |
331 | 0 | &channel_mgr__l_closing_ctx); |
332 | 0 | if (channel_mgr__l_closing_ctx != constants__c_no_application_context) { |
333 | 0 | channel_mgr_bs__notify_client_connection_closed(channel_mgr__l_channel_conf, |
334 | 0 | channel_mgr__l_closing_ctx); |
335 | 0 | } |
336 | 0 | channel_mgr_1__reset_config(channel_mgr__channel); |
337 | 0 | channel_mgr_1__reset_endpoint(channel_mgr__channel); |
338 | 0 | channel_mgr_bs__reset_SecurityPolicy(channel_mgr__channel); |
339 | 0 | channel_mgr__l_check_all_channel_lost(); |
340 | 0 | } |
341 | 0 | } |
342 | 0 | } |
343 | | |
344 | | void channel_mgr__cli_set_connected_channel( |
345 | | const constants__t_channel_config_idx_i channel_mgr__config_idx, |
346 | | const constants__t_reverse_endpoint_config_idx_i channel_mgr__reverse_endpoint_config_idx, |
347 | | const constants__t_channel_i channel_mgr__channel, |
348 | 0 | t_bool * const channel_mgr__bres) { |
349 | 0 | { |
350 | 0 | t_bool channel_mgr__l_is_channel_connecting; |
351 | 0 | t_bool channel_mgr__l_is_channel_disconnecting; |
352 | 0 | t_bool channel_mgr__l_is_channel_connected; |
353 | 0 | constants__t_timeref_i channel_mgr__l_current_time; |
354 | 0 | constants__t_application_context_i channel_mgr__l_closing_ctx; |
355 | | |
356 | 0 | channel_mgr_1__is_cli_channel_connecting(channel_mgr__config_idx, |
357 | 0 | &channel_mgr__l_is_channel_connecting); |
358 | 0 | channel_mgr_1__is_disconnecting_channel(channel_mgr__config_idx, |
359 | 0 | &channel_mgr__l_is_channel_disconnecting); |
360 | 0 | channel_mgr_1__is_channel_connected(channel_mgr__channel, |
361 | 0 | &channel_mgr__l_is_channel_connected); |
362 | 0 | if ((channel_mgr__l_is_channel_connecting == true) && |
363 | 0 | (channel_mgr__l_is_channel_connected == false)) { |
364 | 0 | channel_mgr_1__remove_cli_channel_connecting(channel_mgr__config_idx); |
365 | 0 | time_reference_bs__get_current_TimeReference(&channel_mgr__l_current_time); |
366 | 0 | channel_mgr_1__add_channel_connected(channel_mgr__channel, |
367 | 0 | channel_mgr__l_current_time); |
368 | 0 | channel_mgr_1__set_config(channel_mgr__channel, |
369 | 0 | channel_mgr__config_idx, |
370 | 0 | channel_mgr__reverse_endpoint_config_idx); |
371 | 0 | channel_mgr_bs__define_SecurityPolicy(channel_mgr__channel); |
372 | 0 | if (channel_mgr__l_is_channel_disconnecting == true) { |
373 | 0 | channel_mgr_1__remove_cli_channel_disconnecting(channel_mgr__config_idx, |
374 | 0 | &channel_mgr__l_closing_ctx); |
375 | 0 | channel_mgr__l_close_secure_channel(channel_mgr__channel, |
376 | 0 | constants_statuscodes_bs__e_sc_bad_secure_channel_closed, |
377 | 0 | channel_mgr__l_closing_ctx); |
378 | 0 | } |
379 | 0 | *channel_mgr__bres = true; |
380 | 0 | } |
381 | 0 | else { |
382 | 0 | *channel_mgr__bres = false; |
383 | 0 | } |
384 | 0 | } |
385 | 0 | } |
386 | | |
387 | | void channel_mgr__cli_set_connection_timeout_channel( |
388 | | const constants__t_channel_config_idx_i channel_mgr__config_idx, |
389 | 0 | t_bool * const channel_mgr__bres) { |
390 | 0 | { |
391 | 0 | t_bool channel_mgr__l_res; |
392 | | |
393 | 0 | channel_mgr_1__is_cli_channel_connecting(channel_mgr__config_idx, |
394 | 0 | &channel_mgr__l_res); |
395 | 0 | if (channel_mgr__l_res == true) { |
396 | 0 | channel_mgr_1__remove_cli_channel_connecting(channel_mgr__config_idx); |
397 | 0 | channel_mgr__l_check_all_channel_lost(); |
398 | 0 | *channel_mgr__bres = true; |
399 | 0 | } |
400 | 0 | else { |
401 | 0 | *channel_mgr__bres = false; |
402 | 0 | } |
403 | 0 | } |
404 | 0 | } |
405 | | |
406 | | void channel_mgr__is_auto_close_channel_active( |
407 | 0 | t_bool * const channel_mgr__p_auto_closed_active) { |
408 | 0 | { |
409 | 0 | t_entier4 channel_mgr__l_card_used; |
410 | 0 | t_entier4 channel_mgr__l_card_channel; |
411 | | |
412 | 0 | channel_mgr_1__get_card_channel_used(&channel_mgr__l_card_used); |
413 | 0 | constants__get_card_t_channel(&channel_mgr__l_card_channel); |
414 | 0 | *channel_mgr__p_auto_closed_active = (channel_mgr__l_card_used >= constants__c_max_channels_connected); |
415 | 0 | } |
416 | 0 | } |
417 | | |
418 | | void channel_mgr__set_create_session_locked( |
419 | 0 | const constants__t_channel_i channel_mgr__p_channel) { |
420 | 0 | { |
421 | 0 | constants__t_timeref_i channel_mgr__l_end_lock_target_timeref; |
422 | | |
423 | 0 | time_reference_bs__get_target_TimeReference(constants__c_channel_lock_create_session_delay, |
424 | 0 | &channel_mgr__l_end_lock_target_timeref); |
425 | 0 | channel_mgr_1__set_create_session_locked_1(channel_mgr__p_channel, |
426 | 0 | channel_mgr__l_end_lock_target_timeref); |
427 | 0 | } |
428 | 0 | } |
429 | | |
430 | | void channel_mgr__update_create_session_locked( |
431 | 0 | const constants__t_channel_i channel_mgr__p_channel) { |
432 | 0 | { |
433 | 0 | constants__t_timeref_i channel_mgr__l_current_timeref; |
434 | 0 | constants__t_timeref_i channel_mgr__l_target_timeref; |
435 | 0 | t_bool channel_mgr__l_target_not_reached; |
436 | | |
437 | 0 | channel_mgr_1__get_create_session_locked_1(channel_mgr__p_channel, |
438 | 0 | &channel_mgr__l_target_timeref); |
439 | 0 | if (channel_mgr__l_target_timeref != constants__c_timeref_indet) { |
440 | 0 | time_reference_bs__get_current_TimeReference(&channel_mgr__l_current_timeref); |
441 | 0 | time_reference_bs__is_less_than_TimeReference(channel_mgr__l_current_timeref, |
442 | 0 | channel_mgr__l_target_timeref, |
443 | 0 | &channel_mgr__l_target_not_reached); |
444 | 0 | if (channel_mgr__l_target_not_reached == false) { |
445 | 0 | channel_mgr_1__set_create_session_locked_1(channel_mgr__p_channel, |
446 | 0 | constants__c_timeref_indet); |
447 | 0 | } |
448 | 0 | } |
449 | 0 | } |
450 | 0 | } |
451 | | |
452 | | void channel_mgr__is_create_session_locked( |
453 | | const constants__t_channel_i channel_mgr__p_channel, |
454 | 0 | t_bool * const channel_mgr__p_session_locked) { |
455 | 0 | { |
456 | 0 | constants__t_timeref_i channel_mgr__l_target_timeref; |
457 | | |
458 | 0 | channel_mgr_1__get_create_session_locked_1(channel_mgr__p_channel, |
459 | 0 | &channel_mgr__l_target_timeref); |
460 | 0 | *channel_mgr__p_session_locked = (channel_mgr__l_target_timeref != constants__c_timeref_indet); |
461 | 0 | } |
462 | 0 | } |
463 | | |