comparison src/g23m-fad/l2r/l2r_mgtp.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : CSD (8411)
4 | Modul : L2r_mgtp.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul defines the functions for processing
18 | of incomming primitives for the component
19 | Radio Link Protocol of the base station
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef L2R_MGTP_C
24 #define L2R_MGTP_C
25 #endif
26
27 #define ENTITY_L2R
28
29 /*==== INCLUDES ===================================================*/
30
31 #include <string.h>
32 #include "typedefs.h"
33 #include "pconst.cdg"
34 #include "vsi.h"
35 #include "macdef.h"
36 #include "custom.h"
37 #include "gsm.h"
38 #include "cus_l2r.h"
39 #include "cnf_l2r.h"
40 #include "mon_l2r.h"
41 #include "prim.h"
42 #include "pei.h"
43 #include "tok.h"
44 #include "dti.h" /* functionality of the dti library */
45
46 #include "cl_ribu.h"
47 #include "l2r.h"
48
49 /*==== CONST =======================================================*/
50
51 /*==== TYPES =======================================================*/
52
53 /*==== VAR EXPORT ==================================================*/
54
55 /*==== VAR LOCAL ===================================================*/
56
57 /*==== FUNCTIONS ===================================================*/
58
59 GLOBAL void mgt_l2r_connect_cnf(UBYTE nack)
60 {
61 PALLOC (l2r_connect_cnf, L2R_CONNECT_CNF);
62 l2r_connect_cnf->ack_flg = nack;
63 PSENDX (CTRL, l2r_connect_cnf);
64 }
65
66 LOCAL void snd_rlp_connect_res(UBYTE nack)
67 {
68 PALLOC (rlp_connect_res, RLP_CONNECT_RES);
69 rlp_connect_res->ack_flg = nack;
70 PSENDX (RLP, rlp_connect_res);
71 }
72
73 /*
74 +------------------------------------------------------------------------------
75 | Function : mgt_l2r_activate_req
76 +------------------------------------------------------------------------------
77 | Description : Process primitive L2R_ACTIVATE_REQ received from the Controller
78 |
79 | Parameters : l2r_activate_req -
80 |
81 |
82 | Return : -
83 +------------------------------------------------------------------------------
84 */
85
86
87 GLOBAL void mgt_l2r_activate_req(T_L2R_ACTIVATE_REQ *l2r_activate_req)
88 {
89 USHORT BytesPerPrim; /* Number of bytes per primitive */
90 T_L2R_DATA *l2r_data_orig;
91
92 TRACE_FUNCTION ("mgt_l2r_activate_req()");
93 PACCESS (l2r_activate_req);
94
95 /***************************************
96 *
97 * Initialize Shared Fax/Data memory *
98 *
99 ***************************************
100 */
101
102 l2r_data_mode = NONTRANSP;
103
104 l2r_data_orig = l2r_data;
105
106 if (l2r_data_magic_num NEQ L2R_DATA_MAGIC_NUM)
107 {
108 l2r_data = &l2r_data_base[0];
109 }
110
111 memset (l2r_data, 0, sizeof (T_L2R_DATA));
112
113 mgt_init(&l2r_data->mgt);
114 dn_init(&l2r_data->dn);
115 up_init(&l2r_data->up);
116
117 l2r_data_magic_num = L2R_DATA_MAGIC_NUM; /* memory is initialized */
118
119 l2r_data = l2r_data_orig;
120
121 switch (GET_STATE (MGT))
122 {
123 case MGT_ATTACHED:
124 {
125 PPASS (l2r_activate_req, l2r_activate_cnf, L2R_ACTIVATE_CNF);
126 l2r_activate_cnf->ack_flg = L2R_NAK;
127 PSENDX (CTRL, l2r_activate_cnf);
128 break;
129 }
130
131 case MGT_DETACHED:
132 if (mgt_checkpar(l2r_activate_req) EQ FALSE) /* invalid parameter values */
133 {
134 PPASS (l2r_activate_req, l2r_activate_cnf, L2R_ACTIVATE_CNF);
135 l2r_activate_cnf->ack_flg = L2R_NAK;
136 PSENDX (CTRL, l2r_activate_cnf);
137 return;
138 }
139
140 {
141 T_MGT *dmgt = &l2r_data->mgt;
142
143 PALLOC (rlp_attach_req, RLP_ATTACH_REQ);
144
145 rlp_attach_req->k_ms_iwf = l2r_activate_req->k_ms_iwf;
146 rlp_attach_req->k_iwf_ms = l2r_activate_req->k_iwf_ms;
147 rlp_attach_req->t1 = l2r_activate_req->t1;
148 rlp_attach_req->t2 = l2r_activate_req->t2;
149 rlp_attach_req->n2 = l2r_activate_req->n2;
150 rlp_attach_req->pt = l2r_activate_req->pt;
151 rlp_attach_req->p1 = l2r_activate_req->p1;
152 rlp_attach_req->p2 = l2r_activate_req->p2;
153 rlp_attach_req->bytes_per_prim = l2r_activate_req->bytes_per_prim;
154
155 switch (l2r_activate_req->uil2p)
156 {
157 case L2R_COPnoFlCt:
158 dmgt->FlowCtrlUsed = FALSE;
159 break;
160 case L2R_ISO6429:
161 dmgt->FlowCtrlUsed = TRUE;
162 break;
163 }
164
165 switch (l2r_activate_req->rate)
166 {
167 case L2R_FULLRATE_14400:
168 rlp_attach_req->rate = RLP_FULLRATE_14400;
169 dmgt->FrameSize = RLP_FRAME_SIZE_LONG;
170 break;
171
172 case L2R_FULLRATE_9600:
173 rlp_attach_req->rate = RLP_FULLRATE_9600;
174 dmgt->FrameSize = RLP_FRAME_SIZE_SHORT;
175 break;
176
177 case L2R_FULLRATE_4800:
178 rlp_attach_req->rate = RLP_FULLRATE_4800;
179 dmgt->FrameSize = RLP_FRAME_SIZE_SHORT;
180 break;
181
182 case L2R_HALFRATE_4800:
183 rlp_attach_req->rate = RLP_HALFRATE_4800;
184 dmgt->FrameSize = RLP_FRAME_SIZE_SHORT;
185 break;
186 }
187
188 BytesPerPrim = l2r_activate_req->bytes_per_prim;
189 dmgt->FramesPerPrim = (BytesPerPrim + dmgt->FrameSize - 1) / dmgt->FrameSize;
190 dmgt->RiBuSize = ((l2r_activate_req->buffer_size + BytesPerPrim - 1) / BytesPerPrim) + 1;
191
192 if (dmgt->RiBuSize < MIN_RIBU_SIZE)
193 {
194 dmgt->RiBuSize = MIN_RIBU_SIZE;
195 }
196
197 rlp_attach_req->p0 = RLP_COMP_DIR_NONE;
198 PSENDX (RLP, rlp_attach_req);
199 SET_STATE (CONIND, IW_IDLE);
200 SET_STATE (MGT, MGT_PENDING_ATTACH);
201 break;
202 }
203 }
204 PFREE (l2r_activate_req);
205 }
206
207 /*
208 +------------------------------------------------------------------------------
209 | Function : mgt_l2r_deactivate_req
210 +------------------------------------------------------------------------------
211 | Description : Process primitive L2R_DEACTIVATE_REQ received from the Controller.
212 |
213 | Parameters : l2r_deactivate_req -
214 |
215 |
216 | Return : -
217 +------------------------------------------------------------------------------
218 */
219
220 GLOBAL void mgt_l2r_deactivate_req
221 (
222 T_L2R_DEACTIVATE_REQ *l2r_deactivate_req
223 )
224 {
225 TRACE_FUNCTION ("mgt_l2r_deactivate_req()");
226 PACCESS (l2r_deactivate_req);
227
228 if (GET_STATE (MGT) NEQ MGT_DETACHED)
229 {
230 PALLOC (rlp_detach_req, RLP_DETACH_REQ);
231 mgt_deinit_connection();
232 PSENDX (RLP, rlp_detach_req);
233 SET_STATE (MGT, MGT_PENDING_DETACH);
234 }
235
236 PFREE (l2r_deactivate_req);
237
238 if (GET_STATE (DTI) NEQ DTI_CLOSED)
239 {
240 dti_close(l2r_hDTI, L2R_DTI_UP_DEF_INSTANCE, L2R_DTI_UP_INTERFACE, L2R_DTI_UP_CHANNEL, FALSE);
241 SET_STATE (DTI, DTI_CLOSED);
242 }
243 }
244
245 /*
246 +------------------------------------------------------------------------------
247 | Function : mgt_l2r_connect_req
248 +------------------------------------------------------------------------------
249 | Description : Process primitive L2R_CONNECT_REQ received from the Controller.
250 |
251 | Parameters : l2r_connect_req -
252 |
253 |
254 | Return : -
255 +------------------------------------------------------------------------------
256 */
257
258 GLOBAL void mgt_l2r_connect_req(T_L2R_CONNECT_REQ *l2r_connect_req)
259 {
260 TRACE_FUNCTION ("mgt_l2r_connect_req()");
261 PACCESS (l2r_connect_req);
262
263 if (GET_STATE (MGT) EQ MGT_ATTACHED)
264 {
265 PALLOC (rlp_connect_req, RLP_CONNECT_REQ);
266 PSENDX (RLP, rlp_connect_req);
267 SET_STATE (MGT, MGT_PENDING_CONNECT);
268 }
269 PFREE (l2r_connect_req);
270 }
271
272 /*
273 +------------------------------------------------------------------------------
274 | Function : mgt_l2r_disc_req
275 +------------------------------------------------------------------------------
276 | Description : Process primitive L2R_DISC_REQ received from the Controller.
277 |
278 | Parameters : l2r_disc_req -
279 |
280 |
281 | Return : -
282 +------------------------------------------------------------------------------
283 */
284
285 GLOBAL void mgt_l2r_disc_req(T_L2R_DISC_REQ *l2r_disc_req)
286 {
287 TRACE_FUNCTION ("mgt_l2r_disc_req()");
288 PACCESS (l2r_disc_req);
289
290 switch (GET_STATE (MGT))
291 {
292 case MGT_DETACHED:
293 case MGT_PENDING_ATTACH:
294 case MGT_ATTACHED:
295 break;
296
297 default:
298 {
299 PALLOC (rlp_disc_req, RLP_DISC_REQ);
300 PSENDX (RLP, rlp_disc_req);
301 mgt_deinit_connection();
302 SET_STATE (MGT, MGT_DISCONNECT_INITIATED);
303 break;
304 }
305 }
306 PFREE (l2r_disc_req);
307 }
308
309 LOCAL void send_l2r_dti_cnf(U8 dti_conn, U32 link_id)
310 {
311 PALLOC (l2r_dti_cnf, L2R_DTI_CNF);
312 l2r_dti_cnf->dti_conn = dti_conn;
313 l2r_dti_cnf->link_id = link_id;
314 PSENDX (CTRL, l2r_dti_cnf);
315 }
316
317 /*
318 +------------------------------------------------------------------------------
319 | Function : mgt_l2r_dti_req
320 +------------------------------------------------------------------------------
321 | Description : Process primitive L2R_DTI_REQ received from the Controller.
322 |
323 | Parameters : l2r_dti_req -
324 |
325 |
326 | Return : -
327 +------------------------------------------------------------------------------
328 */
329
330
331 GLOBAL void mgt_l2r_dti_req(T_L2R_DTI_REQ *l2r_dti_req)
332 {
333 BOOL isOK;
334
335 TRACE_FUNCTION ("mgt_l2r_dti_req()");
336 PACCESS (l2r_dti_req);
337
338 switch (GET_STATE (MGT))
339 {
340 case MGT_CONNECTED:
341 switch (l2r_dti_req->dti_conn)
342 {
343 case L2R_CONNECT_DTI:
344 l2r_data->mgt.link_id = l2r_dti_req->link_id;
345
346 if (GET_STATE (DTI) NEQ DTI_CLOSED)
347 {
348 dti_close(l2r_hDTI, L2R_DTI_UP_DEF_INSTANCE, L2R_DTI_UP_INTERFACE, L2R_DTI_UP_CHANNEL, FALSE);
349 SET_STATE (DTI, DTI_CLOSED);
350 }
351 /*
352 * open new dti library communication channel
353 */
354 INIT_STATE (DTI, DTI_SETUP);
355 sig_mgt_up_dti_conn_setup (l2r_dti_req->link_id);
356 sig_mgt_dn_dti_conn_setup (l2r_dti_req->link_id);
357
358 isOK = dti_open (
359 l2r_hDTI,
360 L2R_DTI_UP_DEF_INSTANCE,
361 L2R_DTI_UP_INTERFACE,
362 L2R_DTI_UP_CHANNEL,
363 L2R_DTI_UPLINK_QUEUE_SIZE,
364 l2r_dti_req->dti_direction,
365 DTI_QUEUE_UNUSED,
366 DTI_VERSION_10,
367 (U8*)l2r_dti_req->entity_name,
368 l2r_dti_req->link_id
369 );
370
371 if (isOK EQ FALSE)
372 {
373 send_l2r_dti_cnf(L2R_DISCONNECT_DTI, l2r_dti_req->link_id);
374 SET_STATE (DTI, DTI_CLOSED);
375 PFREE(l2r_dti_req);
376 return;
377 }
378 PFREE(l2r_dti_req);
379 /*
380 * L2R_DTI_CNF will be sent in sig_dti_mgt_connection_opened_ind
381 */
382 return;
383
384 case L2R_DISCONNECT_DTI:
385 l2r_data->up.DtiConnected = FALSE;
386 l2r_data->dn.DtiConnected = FALSE;
387 /*
388 TRACE_EVENT_P2 ("Air interface: Received:%d Sent:%d", l2r_data->dn.RcvdChar, l2r_data->up.SentChar);
389 */
390 if (GET_STATE (DTI) NEQ DTI_CLOSED)
391 {
392 dti_close(l2r_hDTI, L2R_DTI_UP_DEF_INSTANCE, L2R_DTI_UP_INTERFACE, L2R_DTI_UP_CHANNEL, FALSE);
393 SET_STATE (DTI, DTI_CLOSED);
394 }
395 TRACE_EVENT("MGT: DTI snatched away by ACI");
396 break;
397 }
398 send_l2r_dti_cnf(l2r_dti_req->dti_conn, l2r_dti_req->link_id);
399 break;
400
401 default:
402 break;
403 }
404 PFREE(l2r_dti_req);
405 }
406
407
408 /*
409 +------------------------------------------------------------------------------
410 | Function : sig_dti_mgt_connection_opened_ind
411 +------------------------------------------------------------------------------
412 | Description : Handles the DTILIB callback call DTI_REASON_CONNECTION_OPENED
413 |
414 | This signal means that a dti connection has been opened
415 | successfully.
416 | Since it is called directy from the dtilib callback function
417 | it is handled like a primitive, here..
418 |
419 | Parameters : -
420 | Return : -
421 +------------------------------------------------------------------------------
422 */
423 GLOBAL void sig_dti_mgt_connection_opened_ind()
424 {
425 TRACE_FUNCTION ("sig_dti_mgt_connection_opened_ind()");
426
427 if (GET_STATE (DTI) EQ DTI_SETUP)
428 {
429 send_l2r_dti_cnf(L2R_CONNECT_DTI, l2r_data->mgt.link_id);
430 sig_mgt_up_dti_conn_open();
431
432 l2r_data->dn.DtiConnected = TRUE;
433 TRACE_EVENT("MGT: DTI received from ACI");
434 SET_STATE (DTI, DTI_IDLE);
435 }
436 }
437
438 /*
439 +------------------------------------------------------------------------------
440 | Function : sig_dti_mgt_connection_closed_ind
441 +------------------------------------------------------------------------------
442 | Description : Handles the DTILIB callback call DTI_REASON_CONNECTION_CLOSED
443 |
444 | This signal means that a dti connection has been closed
445 | Since it is called directy from the dtilib callback function
446 | it is handled like a primitive, here..
447 |
448 | Parameters : -
449 | Return : -
450 +------------------------------------------------------------------------------
451 */
452 GLOBAL void sig_dti_mgt_connection_closed_ind()
453 {
454 TRACE_FUNCTION ("sig_dti_mgt_connection_closed_ind()");
455
456 if (GET_STATE (DTI) NEQ DTI_CLOSED)
457 {
458 PALLOC (l2r_dti_ind, L2R_DTI_IND);
459
460 SET_STATE (DTI, DTI_CLOSED);
461
462 l2r_data->up.DtiConnected = FALSE;
463 l2r_data->dn.DtiConnected = FALSE;
464
465 l2r_dti_ind->link_id = l2r_data->mgt.link_id;
466 TRACE_EVENT("MGT: DTI passed to ACI");
467 PSENDX (CTRL, l2r_dti_ind);
468 }
469 }
470
471 /*
472 +------------------------------------------------------------------------------
473 | Function : mgt_rlp_connect_ind
474 +------------------------------------------------------------------------------
475 | Description : Process primitive RLP_CONNECT_IND received from RLP.
476 |
477 | Parameters : rlp_connect_ind -
478 |
479 |
480 | Return :
481 +------------------------------------------------------------------------------
482 */
483
484 GLOBAL void mgt_rlp_connect_ind(T_RLP_CONNECT_IND *rlp_connect_ind)
485 {
486 TRACE_FUNCTION ("mgt_rlp_connect_ind()");
487 PACCESS (rlp_connect_ind);
488
489 switch (GET_STATE (MGT))
490 {
491 case MGT_PENDING_ATTACH:
492 SET_STATE (CONIND, IW_WAIT);
493 break;
494
495 case MGT_ATTACHED:
496 snd_rlp_connect_res(RLP_ACK);
497 mgt_init_connection(TRUE);
498 SET_STATE (MGT, MGT_CONNECTED);
499 break;
500
501 case MGT_PENDING_CONNECT:
502 snd_rlp_connect_res(RLP_ACK);
503 mgt_init_connection(FALSE);
504 SET_STATE (MGT, MGT_CONNECTED);
505 break;
506 }
507 PFREE (rlp_connect_ind);
508 }
509
510 /*
511 +------------------------------------------------------------------------------
512 | Function : mgt_rlp_connect_cnf
513 +------------------------------------------------------------------------------
514 | Description : Process primitive RLP_CONNECT_CNF received from RLP.
515 |
516 | Parameters : rlp_connect_cnf -
517 |
518 |
519 | Return : -
520 +------------------------------------------------------------------------------
521 */
522
523 GLOBAL void mgt_rlp_connect_cnf(T_RLP_CONNECT_CNF *rlp_connect_cnf)
524 {
525 TRACE_FUNCTION ("mgt_rlp_connect_cnf()");
526 PACCESS (rlp_connect_cnf);
527
528 if (GET_STATE (MGT) EQ MGT_PENDING_CONNECT)
529 {
530 switch (rlp_connect_cnf->ack_flg)
531 {
532 case RLP_ACK:
533 mgt_init_connection(FALSE);
534 SET_STATE (MGT, MGT_CONNECTED);
535 break;
536
537 case RLP_NAK:
538 mgt_l2r_connect_cnf(L2R_NAK);
539 SET_STATE (MGT, MGT_ATTACHED);
540 break;
541 }
542 }
543 PFREE (rlp_connect_cnf);
544 }
545
546 /*
547 +------------------------------------------------------------------------------
548 | Function : mgt_rlp_disc_ind
549 +------------------------------------------------------------------------------
550 | Description : Process primitive RLP_DISC_IND received from RLP.
551 |
552 | Parameters : rlp_disc_ind -
553 |
554 |
555 | Return : -
556 +------------------------------------------------------------------------------
557 */
558
559
560 GLOBAL void mgt_rlp_disc_ind(T_RLP_DISC_IND *rlp_disc_ind)
561 {
562 TRACE_FUNCTION ("mgt_rlp_disc_ind()");
563 PACCESS (rlp_disc_ind);
564
565 switch (GET_STATE (MGT))
566 {
567 case MGT_PENDING_CONNECT:
568 mgt_l2r_connect_cnf(L2R_NAK);
569 SET_STATE (MGT, MGT_ATTACHED);
570 break;
571
572 case MGT_CONNECTED:
573 {
574 PALLOC (l2r_disc_ind, L2R_DISC_IND);
575 PSENDX (CTRL, l2r_disc_ind);
576 }
577 mgt_deinit_connection();
578 SET_STATE (MGT, MGT_ATTACHED);
579 break;
580 }
581 PFREE (rlp_disc_ind);
582 }
583
584 /*
585 +------------------------------------------------------------------------------
586 | Function : mgt_rlp_disc_cnf
587 +------------------------------------------------------------------------------
588 | Description : Process primitive RLP_DISC_CNF received from RLP.
589 |
590 | Parameters : rlp_disc_cnf -
591 |
592 |
593 | Return : -
594 +------------------------------------------------------------------------------
595 */
596
597
598 GLOBAL void mgt_rlp_disc_cnf
599 (
600 T_RLP_DISC_CNF *rlp_disc_cnf
601 )
602 {
603 TRACE_FUNCTION ("mgt_rlp_disc_cnf()");
604 PACCESS (rlp_disc_cnf);
605
606 switch (GET_STATE (MGT))
607 {
608 case MGT_DISCONNECT_INITIATED:
609 {
610 /*
611 * processing for state MGT_DISCONNECT_INITIATED
612 */
613 PALLOC (l2r_disc_cnf, L2R_DISC_CNF);
614 PSENDX (CTRL, l2r_disc_cnf);
615 SET_STATE (MGT, MGT_ATTACHED);
616 break;
617 }
618 }
619 PFREE (rlp_disc_cnf);
620 }
621
622 /*
623 +------------------------------------------------------------------------------
624 | Function : mgt_rlp_reset_ind
625 +------------------------------------------------------------------------------
626 | Description : Process primitive RLP_RESET_IND received from RLP.
627 |
628 | Parameters : rlp_reset_ind -
629 |
630 |
631 | Return : -
632 +------------------------------------------------------------------------------
633 */
634
635
636 GLOBAL void mgt_rlp_reset_ind
637 (
638 T_RLP_RESET_IND *rlp_reset_ind
639 )
640 {
641 TRACE_FUNCTION ("mgt_rlp_reset_ind()");
642 PACCESS (rlp_reset_ind);
643
644 switch (GET_STATE (MGT))
645 {
646 case MGT_CONNECTED:
647 {
648 /*
649 * processing for state MGT_CONNECTED
650 */
651 {
652 PALLOC (l2r_reset_ind, L2R_RESET_IND);
653 PSENDX (CTRL, l2r_reset_ind);
654 }
655 sig_mgt_up_clear_req();
656 sig_mgt_dn_clear_req();
657
658 {
659 PALLOC (rlp_reset_res, RLP_RESET_RES);
660 PSENDX (RLP, rlp_reset_res);
661 }
662 sig_mgt_dn_reconn_req();
663 break;
664 }
665 }
666 PFREE (rlp_reset_ind);
667 }
668
669 /*
670 +------------------------------------------------------------------------------
671 | Function : mgt_rlp_reset_cnf
672 +------------------------------------------------------------------------------
673 | Description : Process primitive RLP_RESET_CNF received from RLP.
674 |
675 | Parameters : rlp_reset_cnf -
676 |
677 |
678 | Return : -
679 +------------------------------------------------------------------------------
680 */
681
682
683 GLOBAL void mgt_rlp_reset_cnf
684 (
685 T_RLP_RESET_CNF *rlp_reset_cnf
686 )
687 {
688 TRACE_FUNCTION ("mgt_rlp_reset_cnf()");
689 PACCESS (rlp_reset_cnf);
690 /*
691 * RLP_RESET_REQ is never used.
692 * Therefore RLP_RESET_CNF does not need to be handled.
693 */
694 PFREE (rlp_reset_cnf);
695 }
696
697 /*
698 +------------------------------------------------------------------------------
699 | Function : mgt_rlp_ui_ind
700 +------------------------------------------------------------------------------
701 | Description : Process primitive RLP_UI_IND received from RLP.
702 |
703 | Parameters : rlp_ui_ind -
704 |
705 |
706 | Return : -
707 +------------------------------------------------------------------------------
708 */
709
710
711 GLOBAL void mgt_rlp_ui_ind(T_RLP_UI_IND *rlp_ui_ind)
712 {
713 TRACE_FUNCTION ("mgt_rlp_ui_ind()");
714 PACCESS (rlp_ui_ind);
715 /*
716 * processing for all states
717 * unnumbered information is ignored by L2R
718 */
719 PFREE (rlp_ui_ind);
720 }
721
722 /*
723 +------------------------------------------------------------------------------
724 | Function : mgt_rlp_xid_ind
725 +------------------------------------------------------------------------------
726 | Description : Process primitive RLP_XID_IND received from RLP.
727 |
728 | Parameters : rlp_xid_ind -
729 |
730 |
731 | Return : -
732 +------------------------------------------------------------------------------
733 */
734
735 GLOBAL void mgt_rlp_xid_ind(T_RLP_XID_IND *rlp_xid_ind)
736 {
737 UBYTE state;
738 TRACE_FUNCTION ("mgt_rlp_xid_ind()");
739 PACCESS (rlp_xid_ind);
740
741 state = GET_STATE (MGT);
742 switch (state)
743 {
744 case MGT_PENDING_ATTACH:
745 case MGT_ATTACHED:
746 case MGT_PENDING_CONNECT:
747 case MGT_CONNECTED:
748 {
749 /*
750 * processing for states MGT_PENDING_ATTACH, MGT_ATTACHED,
751 * MGT_PENDING_CONNECT and MGT_CONNECTED
752 */
753
754 PALLOC (l2r_xid_ind, L2R_XID_IND);
755
756 l2r_xid_ind->rlp_vers = rlp_xid_ind->rlp_vers;
757 l2r_xid_ind->k_ms_iwf = rlp_xid_ind->k_ms_iwf;
758 l2r_xid_ind->k_iwf_ms = rlp_xid_ind->k_iwf_ms;
759 l2r_xid_ind->t1 = rlp_xid_ind->t1;
760 l2r_xid_ind->t2 = rlp_xid_ind->t2;
761 l2r_xid_ind->n2 = rlp_xid_ind->n2;
762 l2r_xid_ind->pt = rlp_xid_ind->pt;
763 l2r_xid_ind->p0 = rlp_xid_ind->p0;
764 l2r_xid_ind->p1 = rlp_xid_ind->p1;
765 l2r_xid_ind->p2 = rlp_xid_ind->p2;
766
767 PSENDX (CTRL, l2r_xid_ind);
768 if (state EQ MGT_PENDING_ATTACH)
769 {
770 {
771 PALLOC (l2r_activate_cnf, L2R_ACTIVATE_CNF);
772 l2r_activate_cnf->ack_flg = L2R_ACK;
773 PSENDX (CTRL, l2r_activate_cnf);
774 }
775
776 switch (GET_STATE (CONIND))
777 {
778 case IW_IDLE:
779 {
780 SET_STATE (MGT, MGT_ATTACHED);
781 break;
782 }
783 case IW_WAIT:
784 snd_rlp_connect_res(RLP_ACK);
785 mgt_init_connection(TRUE);
786 SET_STATE (MGT, MGT_CONNECTED);
787 break;
788 }
789 }
790 break;
791 }
792 }
793 PFREE (rlp_xid_ind);
794 }
795
796 /*
797 +------------------------------------------------------------------------------
798 | Function : mgt_rlp_error_ind
799 +------------------------------------------------------------------------------
800 | Description : Process primitive RLP_ERROR_IND received from RLP.
801 |
802 | Parameters : rlp_error_ind -
803 |
804 |
805 | Return : -
806 +------------------------------------------------------------------------------
807 */
808
809 GLOBAL void mgt_rlp_error_ind(T_RLP_ERROR_IND *rlp_error_ind)
810 {
811 TRACE_FUNCTION ("mgt_rlp_error_ind()");
812 PACCESS (rlp_error_ind);
813
814 mgt_send_l2r_error_ind(rlp_error_ind->cause);
815 SET_STATE (MGT, MGT_PERMANENT_ERROR);
816 PFREE (rlp_error_ind);
817 }
818
819 /*
820 +------------------------------------------------------------------------------
821 | Function : mgt_rlp_statistic_ind
822 +------------------------------------------------------------------------------
823 | Description : Process primitive RLP_STATISTIC_IND received from RLP.
824 |
825 | Parameters : rlp_statistic_ind -
826 |
827 |
828 | Return :
829 +------------------------------------------------------------------------------
830 */
831
832 GLOBAL void mgt_rlp_statistic_ind
833 (
834 T_RLP_STATISTIC_IND *rlp_statistic_ind
835 )
836 {
837 TRACE_FUNCTION ("mgt_rlp_statistic_ind()");
838 PACCESS (rlp_statistic_ind);
839 {
840 PALLOC (l2r_statistic_ind, L2R_STATISTIC_IND);
841 l2r_statistic_ind->error_rate = rlp_statistic_ind->error_rate;
842 PSENDX (CTRL, l2r_statistic_ind);
843 }
844 PFREE (rlp_statistic_ind);
845 }
846
847 /*
848 +------------------------------------------------------------------------------
849 | Function : mgt_rlp_detach_cnf
850 +------------------------------------------------------------------------------
851 | Description : Process primitive RLP_DETACH_CNF received from RLP.
852 |
853 | Parameters : rlp_detach_cnf -
854 |
855 |
856 | Return : -
857 +------------------------------------------------------------------------------
858 */
859
860 GLOBAL void mgt_rlp_detach_cnf(T_RLP_DETACH_CNF *rlp_detach_cnf)
861 {
862 TRACE_FUNCTION ("mgt_rlp_detach_cnf()");
863 PACCESS (rlp_detach_cnf);
864
865 switch (GET_STATE (MGT))
866 {
867 case MGT_PENDING_DETACH:
868 {
869 PPASS (rlp_detach_cnf, l2r_deactivate_cnf, L2R_DEACTIVATE_CNF);
870 PSENDX (CTRL, l2r_deactivate_cnf);
871 SET_STATE (MGT, MGT_DETACHED);
872 l2r_data_magic_num = 0; /* memory is no more initialized */
873 break;
874 }
875
876 default:
877 PFREE (rlp_detach_cnf);
878 break;
879 }
880 }
881