[JIRA ID - ODUHIGH-291]: Code changes for RLC UL AMD PDU
[o-du/l2.git] / src / cm / ckw.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /********************************************************************20**
20   
21         Name:    CKW RRC Control Interface
22     
23         Type:    C file
24   
25         Desc:    This file Contains the packing and unpacking functions for
26                  CKW Interface
27  
28         File:    ckw.c
29
30 *********************************************************************21*/
31
32 #include "common_def.h"
33 #include "ckw.h"
34 #include "ckw.x"
35
36 /* extern (.x) include files */
37
38 \f
39 #ifdef __cplusplus
40 extern "C" {
41 #endif  /*for extern "C"*/
42
43 #ifdef LCCKW
44 /*
45 *
46 *    Fun:    cmPkCkwBndReq
47 *
48 *    Desc:    pack the primitive CkwBndReq
49 *
50 *    Ret:    ROK  -ok
51 *
52 *    Notes:    None
53 *
54 *    File:     ckw.c
55 *
56 */
57 S16 cmPkCkwBndReq
58 (
59 Pst *pst,
60 SuId suId,
61 SpId spId
62 )
63 {
64     S16 ret1;
65     Buffer *mBuf;
66     mBuf = NULLP;
67
68     if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
69     {
70 #if (ERRCLASS & ERRCLS_ADD_RES)
71        if(ret1 != ROK)
72        {
73           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
74                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
75                (ErrVal)ECKW001, (ErrVal)0, "SGetMsg() failed");
76        }
77 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
78        return (ret1);
79     }
80     CMCHKPKLOG(SPkS16, spId, mBuf, ECKW002, pst);
81     CMCHKPKLOG(SPkS16, suId, mBuf, ECKW003, pst);
82     pst->event = (Event) CKW_EVT_BND_REQ;
83
84     return (SPstTsk(pst,mBuf));
85 } /*end of function cmPkCkwBndReq*/
86 \f
87 /*
88 *
89 *    Fun:    cmPkCkwUbndReq
90 *
91 *    Desc:    pack the primitive CkwUbndReq
92 *
93 *    Ret:    ROK  -ok
94 *
95 *    Notes:    None
96 *
97 *    File:     ckw.c
98 *
99 */
100 S16 cmPkCkwUbndReq
101 (
102 Pst *pst,
103 SpId spId,
104 Reason reason
105 )
106 {
107     S16 ret1;
108     Buffer *mBuf;
109     mBuf = NULLP;
110
111     if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
112     {
113 #if (ERRCLASS & ERRCLS_ADD_RES)
114        if(ret1 != ROK)
115        {
116           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
117                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
118                (ErrVal)ECKW004, (ErrVal)0, "SGetMsg() failed");
119        }
120 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
121        return (ret1);
122     }
123     CMCHKPKLOG(SPkS16, reason, mBuf, ECKW005, pst);
124     CMCHKPKLOG(SPkS16, spId, mBuf, ECKW006, pst);
125     pst->event = (Event) CKW_EVT_UBND_REQ;
126
127     return (SPstTsk(pst,mBuf));
128 } /*end of function cmPkCkwUbndReq*/
129 \f
130 /*
131 *
132 *    Fun:    cmPkCkwBndCfm
133 *
134 *    Desc:    pack the primitive CkwBndCfm
135 *
136 *    Ret:    ROK  -ok
137 *
138 *    Notes:    None
139 *
140 *    File:     ckw.c
141 *
142 */
143 S16 cmPkCkwBndCfm
144 (
145 Pst *pst,
146 SuId suId,
147 uint8_t status
148 )
149 {
150     S16 ret1;
151     Buffer *mBuf;
152     mBuf = NULLP;
153
154     if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
155     {
156 #if (ERRCLASS & ERRCLS_ADD_RES)
157        if(ret1 != ROK)
158        {
159           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
160                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
161                (ErrVal)ECKW007, (ErrVal)0, "SGetMsg() failed");
162        }
163
164 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
165        return (ret1);
166     }
167     CMCHKPKLOG(oduUnpackUInt8, status, mBuf, ECKW008, pst);
168     CMCHKPKLOG(SPkS16, suId, mBuf, ECKW009, pst);
169     pst->event = (Event) CKW_EVT_BND_CFM;
170
171     return (SPstTsk(pst,mBuf));
172 } /*end of function cmPkCkwBndCfm*/
173
174 \f
175 /*
176 *
177 *    Fun:    cmPkRlcTmInfo
178 *
179 *    Desc:    pack the structure RlcTmInfo
180 *
181 *    Ret:    ROK  -ok
182 *
183 *    Notes:    None
184 *
185 *    File:     ckw.c
186 *
187 */
188 S16 cmPkRlcTmInfo
189 (
190 RlcTmInfo      *param,
191 Buffer         *mBuf
192 )
193 {
194
195     CMCHKPK(oduUnpackUInt32, param->dl.buffSize, mBuf);
196
197     return ROK;
198 } /* cmPkRlcTmInfo */
199
200 \f
201 /*
202 *
203 *    Fun:    cmPkRlcUmInfo
204 *
205 *    Desc:    pack the structure RlcUmInfo
206 *
207 *    Ret:    ROK  -ok
208 *
209 *    Notes:    None
210 *
211 *    File:     ckw.c
212 *
213 */
214 S16 cmPkRlcUmInfo
215 (
216 RlcEntCfgInfo  *param,
217 Buffer         *mBuf
218 )
219 {
220
221     switch(param->dir)
222     {
223        case CKW_CFG_DIR_DL:
224           {
225              CMCHKPK(oduUnpackUInt8, param->m.umInfo.dl.snLen, mBuf);
226              break;
227           }
228        case CKW_CFG_DIR_UL:
229           {
230              CMCHKPK(oduUnpackUInt8, param->m.umInfo.ul.reAsmblTmr, mBuf);
231              CMCHKPK(oduUnpackUInt8, param->m.umInfo.ul.snLen, mBuf);
232              break;
233           }
234        /* Patch ckw_c_001.main_3 */
235        case CKW_CFG_DIR_BOTH:
236           {
237              CMCHKPK(oduUnpackUInt8, param->m.umInfo.dl.snLen, mBuf);
238              CMCHKPK(oduUnpackUInt8, param->m.umInfo.ul.reAsmblTmr, mBuf);
239              CMCHKPK(oduUnpackUInt8, param->m.umInfo.ul.snLen, mBuf);
240              break;
241           }
242     }
243
244     return ROK;
245 } /* cmPkRlcUmInfo */
246
247 \f
248 /*
249 *
250 *    Fun:    cmPkRlcAmInfo
251 *
252 *    Desc:    pack the structure RlcAmInfo
253 *
254 *    Ret:    ROK  -ok
255 *
256 *    Notes:    None
257 *
258 *    File:     ckw.c
259 *
260 */
261 S16 cmPkRlcAmInfo
262 (
263 RlcAmInfo      *param,
264 Buffer         *mBuf
265 )
266 {
267
268     /* UP LINK */
269     CMCHKPK(oduUnpackUInt8, param->ul.reAsmblTmr, mBuf);
270     CMCHKPK(oduUnpackUInt16, param->ul.staProhTmr, mBuf);
271     CMCHKPK(oduUnpackUInt8, param->ul.snLen, mBuf);
272
273     /* DOWN LINK */
274     CMCHKPK(oduUnpackUInt8, param->dl.maxRetx, mBuf);
275     CMCHKPK(SPkS32, param->dl.pollByte, mBuf);
276     CMCHKPK(SPkS16, param->dl.pollPdu, mBuf);
277     CMCHKPK(oduUnpackUInt16, param->dl.pollRetxTmr, mBuf);
278     CMCHKPK(oduUnpackUInt8, param->dl.snLen, mBuf);
279
280     return ROK;
281 } /* cmPkRlcAmInfo */
282
283 \f
284 /*
285 *
286 *    Fun:    cmPkCkwLInfo
287 *
288 *    Desc:    pack the structure CkwLChInfo
289 *
290 *    Ret:    ROK  -ok
291 *
292 *    Notes:    None
293 *
294 *    File:     ckw.c
295 *
296 */
297 S16 cmPkCkwLChInfo
298 (
299 CkwLChInfo     *param,
300 Buffer         *mBuf
301 )
302 {
303
304     CMCHKPK(oduUnpackUInt8, param->type, mBuf);
305     CMCHKPK(oduUnpackUInt8, param->lChId, mBuf);
306
307     return ROK;
308 } /* cmPkCkwLChInfo */
309
310 \f
311 /*
312 *
313 *    Fun:    cmPkRlcEntCfgInfo
314 *
315 *    Desc:    pack the structure RlcEntCfgInfo
316 *
317 *    Ret:    ROK  -ok
318 *
319 *    Notes:    None
320 *
321 *    File:     ckw.c
322 *
323 */
324 S16 cmPkRlcEntCfgInfo
325 (
326 RlcEntCfgInfo  *param,
327 Buffer         *mBuf
328 )
329 {
330
331     switch(param->entMode)
332     {
333        case CM_LTE_MODE_TM:
334           {
335              CMCHKPK(cmPkRlcTmInfo, &(param->m.tmInfo), mBuf);
336              break;
337           }
338        case CM_LTE_MODE_UM:
339           {
340              CMCHKPK(cmPkRlcUmInfo, param, mBuf);
341              break;
342           }
343        case CM_LTE_MODE_AM:
344           {
345              CMCHKPK(cmPkRlcAmInfo, &(param->m.amInfo), mBuf);
346              break;
347           }
348     }
349
350     /* Logical Channel Information */
351     switch(param->entMode)
352     {
353        case CM_LTE_MODE_TM:
354           {
355              CMCHKPK(cmPkCkwLChInfo, &(param->lCh[0]), mBuf);
356              break;
357           }
358        /* ccpu00128195: Packing lCh[0] and lCh[1] for UM bearer as well */
359        case CM_LTE_MODE_UM:
360        case CM_LTE_MODE_AM:
361           {
362              CMCHKPK(cmPkCkwLChInfo, &(param->lCh[1]), mBuf);
363              CMCHKPK(cmPkCkwLChInfo, &(param->lCh[0]), mBuf);
364              break;
365           }
366     }
367
368 #ifdef TENB_MULT_CELL_SUPPRT
369     CMCHKPK(SPkS16, param->rguSapId, mBuf);
370 #endif
371     CMCHKPK(SPkS16, param->discardTmr, mBuf);
372     CMCHKPK(oduUnpackUInt8, param->dir, mBuf);
373     CMCHKPK(cmPkLteRlcMode, param->entMode, mBuf);
374     CMCHKPK(oduUnpackUInt8, param->qci, mBuf);
375     CMCHKPK(oduUnpackUInt8, param->rbType, mBuf);
376     CMCHKPK(oduUnpackUInt8, param->rbId, mBuf);
377     CMCHKPK(oduUnpackUInt8, param->cfgType, mBuf);
378
379     return ROK;
380 } /* cmPkRlcEntCfgInfo */
381
382 \f
383 /*
384 *
385 *    Fun:    cmPkRlcCfgInfo
386 *
387 *    Desc:    pack the structure RlcCfgInfo
388 *
389 *    Ret:    ROK  -ok
390 *
391 *    Notes:    None
392 *
393 *    File:     ckw.c
394 *
395 */
396 S16 cmPkRlcCfgInfo
397 (
398 RlcCfgInfo     *param,
399 Pst            *pst,
400 Buffer         *mBuf
401 )
402 {
403    S16 idx;
404
405     for (idx = param->numEnt-1; idx >= 0; idx--)
406     {
407        CMCHKPK(cmPkRlcEntCfgInfo, &(param->entCfg[idx]), mBuf);
408     }
409
410     CMCHKPK(oduUnpackUInt8, param->numEnt, mBuf);
411     CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
412     CMCHKPK(cmPkLteRnti, param->ueId, mBuf);
413     CMCHKPKLOG(oduUnpackUInt32, param->transId, mBuf, ECKW010, pst);
414
415     return ROK;
416 } /* cmPkRlcCfgInfo */
417
418 \f
419 /*
420 *
421 *    Fun:    cmPkRlcEntCfgCfmInfo
422 *
423 *    Desc:    pack the structure RlcEntCfgInfo
424 *
425 *    Ret:    ROK  -ok
426 *
427 *    Notes:    None
428 *
429 *    File:     ckw.c
430 *
431 */
432 S16 cmPkRlcEntCfgCfmInfo
433 (
434 RlcEntCfgCfmInfo  *param,
435 Buffer            *mBuf
436 )
437 {
438
439     CMCHKPK(cmPkCmStatus, &(param->status), mBuf);
440     CMCHKPK(oduUnpackUInt8, param->rbType, mBuf);
441     CMCHKPK(oduUnpackUInt8, param->rbId, mBuf);
442
443     return ROK;
444 } /* cmPkRlcEntCfgCfmInfo */
445
446 \f
447 /*
448 *
449 *    Fun:    cmPkRlcCfgCfmInfo
450 *
451 *    Desc:    pack the structure RlcCfgCfmInfo
452 *
453 *    Ret:    ROK  -ok
454 *
455 *    Notes:    None
456 *
457 *    File:     ckw.c
458 *
459 */
460 S16 cmPkRlcCfgCfmInfo
461 (
462 RlcCfgCfmInfo  *param,
463 Pst            *pst,
464 Buffer         *mBuf
465 )
466 {
467     S16         idx;
468
469     for (idx = param->numEnt-1; idx >= 0; idx--)
470     {
471        CMCHKPK(cmPkRlcEntCfgCfmInfo, &(param->entCfgCfm[(uint8_t)idx]), mBuf);
472     }
473
474     CMCHKPK(oduUnpackUInt8, param->numEnt, mBuf);
475     CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
476     CMCHKPK(cmPkLteRnti, param->ueId, mBuf);
477     CMCHKPKLOG(oduUnpackUInt32, param->transId, mBuf, ECKW014, pst);
478
479     return ROK;
480 } /* cmPkRlcCfgCfmInfo */
481
482 \f
483 /*
484 *
485 *    Fun:    cmPkRlcCfgCfm
486 *
487 *    Desc:    pack the primitive RlcUiRlcCfgCfm
488 *
489 *    Ret:    ROK  -ok
490 *
491 *    Notes:    None
492 *
493 *    File:     ckw.c
494 *
495 */
496 S16 cmPkRlcCfgCfm
497 (
498 Pst               *pst,
499 SuId              suId,
500 RlcCfgCfmInfo     *cfgCfmInfo
501 )
502 {
503     S16 ret1;
504     Buffer *mBuf;
505     mBuf = NULLP;
506
507     if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
508     {
509 #if (ERRCLASS & ERRCLS_ADD_RES)
510        if(ret1 != ROK)
511        {
512           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
513                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
514                (ErrVal)ECKW015, (ErrVal)0, "SGetMsg() failed");
515        }
516 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
517        return (ret1);
518     }
519
520     switch(pst->selector)
521     {
522 #ifdef LCCKW
523        case ODU_SELECTOR_LC:
524           {
525              ret1 = cmPkRlcCfgCfmInfo( (cfgCfmInfo), pst, mBuf);
526 #if (ERRCLASS & ERRCLS_ADD_RES)
527              if(ret1 != ROK)
528              {
529                 SPutMsg(mBuf);
530                 SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
531                       __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
532                       (ErrVal)ECKW016, (ErrVal)ret1, "Packing failure");
533                 return ( ret1 );
534              }
535 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
536              if (SPutSBuf(pst->region, pst->pool, (Data *)cfgCfmInfo,
537                       sizeof(RlcCfgCfmInfo)) != ROK)
538              {
539                 SPutMsg(mBuf);
540                 return RFAILED;
541              }
542
543              break;
544           }
545 #endif /* LCCKW */
546     }
547
548     CMCHKPKLOG(SPkS16, suId, mBuf, ECKW017, pst);
549     pst->event = (Event) CKW_EVT_CFG_CFM;
550
551     return (SPstTsk(pst,mBuf));
552 } /* cmPkRlcCfgCfm */
553
554 /*
555 *
556 *    Fun:    cmPkCkwUeInfo
557 *
558 *    Desc:   pack the primitive KwUiCkwUeInfo
559 *
560 *    Ret:    ROK  -ok
561 *
562 *    Notes:  None
563 *
564 *    File:   ckw.c
565 *
566 */
567 S16 cmPkCkwUeInfo
568 (
569 CkwUeInfo *param,
570 Buffer    *mBuf
571 )
572 {
573
574    CMCHKPK(cmPkLteCellId, param->cellId, mBuf);
575    CMCHKPK(cmPkLteRnti, param->ueId, mBuf);
576
577    return ROK;
578 }
579
580 /*
581 *
582 *    Fun:    cmPkCkwUeIdChgReq
583 *
584 *    Desc:   pack the primitive RlcUiCkwUeIdChgReq
585 *
586 *    Ret:    ROK  -ok
587 *
588 *    Notes:  None
589 *
590 *    File:   ckw.c
591 *
592 */
593 S16 cmPkCkwUeIdChgReq
594 (
595 Pst       *pst,
596 SpId      spId,
597 uint32_t  transId,
598 CkwUeInfo *ueInfo,
599 CkwUeInfo *newUeInfo
600 )
601 {
602     S16    ret1;
603     Buffer *mBuf = NULLP;
604
605
606     if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
607     {
608 #if (ERRCLASS & ERRCLS_ADD_RES)
609        if(ret1 != ROK)
610        {
611           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
612                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
613                (ErrVal)ECKW018, (ErrVal)0, "SGetMsg() failed");
614        }
615 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
616
617        return (ret1);
618     }
619
620     CMCHKPK(cmPkCkwUeInfo, newUeInfo, mBuf);
621     if (SPutSBuf(pst->region, pst->pool, (Data *)newUeInfo,
622              sizeof(CkwUeInfo)) != ROK)
623     {
624        SPutMsg(mBuf);
625        return RFAILED;
626     }
627     CMCHKPK(cmPkCkwUeInfo, ueInfo, mBuf);
628     if (SPutSBuf(pst->region, pst->pool, (Data *)ueInfo,
629              sizeof(CkwUeInfo)) != ROK)
630     {
631        SPutMsg(mBuf);
632        return RFAILED;
633     }
634     CMCHKPKLOG(oduUnpackUInt32, transId, mBuf, ECKW019, pst);
635     CMCHKPKLOG(SPkS16, spId, mBuf, ECKW020, pst);
636     pst->event = (Event) CKW_EVT_UEIDCHG_REQ;
637
638     return (SPstTsk(pst, mBuf));
639
640 } /* cmPkCkwUeIdChgReq */
641
642 /*
643 *
644 *    Fun:    cmPkCkwUeIdChgCfm
645 *
646 *    Desc:   pack the primitive RlcUiCkwUeIdChgCfm
647 *
648 *    Ret:    ROK  -ok
649 *
650 *    Notes:  None
651 *
652 *    File:   ckw.c
653 *
654 */
655 S16 cmPkCkwUeIdChgCfm
656 (
657 Pst         *pst,
658 SuId        suId,
659 uint32_t    transId,
660 CkwUeInfo   *ueInfo,
661 CmStatus    status
662 )
663 {
664     S16    ret1;
665     Buffer *mBuf = NULLP;
666
667
668     if((ret1 = SGetMsg(pst->region, pst->pool, &mBuf)) != ROK)
669     {
670 #if (ERRCLASS & ERRCLS_ADD_RES)
671        if(ret1 != ROK)
672        {
673           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
674                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
675                (ErrVal)ECKW021, (ErrVal)0, "SGetMsg() failed");
676        }
677 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
678
679        return (ret1);
680     }
681     
682     CMCHKPK(cmPkCmStatus, &status, mBuf); 
683     CMCHKPK(cmPkCkwUeInfo, ueInfo, mBuf);
684     if (SPutSBuf(pst->region, pst->pool, (Data *)ueInfo,
685              sizeof(CkwUeInfo)) != ROK)
686     {
687        SPutMsg(mBuf);
688        return RFAILED;
689     }
690     CMCHKPKLOG(oduUnpackUInt32, transId, mBuf, ECKW022, pst);
691     CMCHKPKLOG(SPkS16, suId, mBuf, ECKW023, pst);
692     pst->event = (Event) CKW_EVT_UEIDCHG_CFM;
693
694     return (SPstTsk(pst, mBuf));
695
696 } /* cmPkCkwUeIdChgCfm */
697
698
699 /******************************************************************************
700  *                            UNPACK FUNCTIONS
701  *****************************************************************************/
702 \f
703 /*
704 *
705 *    Fun:    cmUnpkCkwBndReq
706 *
707 *    Desc:    unpack the primitive CkwBndReq
708 *
709 *    Ret:    ROK  -ok
710 *
711 *    Notes:    None
712 *
713 *    File:     ckw.c
714 *
715 */
716 S16 cmUnpkCkwBndReq
717 (
718 CkwBndReq      func,
719 Pst            *pst,
720 Buffer         *mBuf
721 )
722 {
723     SuId       suId = 0;
724     SpId       spId = 0;
725     
726
727     CMCHKUNPKLOG(SUnpkS16, &suId, mBuf, ECKW024, pst);
728     CMCHKUNPKLOG(SUnpkS16, &spId, mBuf, ECKW025, pst);
729     SPutMsg(mBuf);
730
731     return ((*func)(pst, suId, spId));
732 } /*end of function cmUnpkCkwBndReq*/
733 \f
734 /*
735 *
736 *    Fun:    cmUnpkCkwUbndReq
737 *
738 *    Desc:    unpack the primitive CkwUbndReq
739 *
740 *    Ret:    ROK  -ok
741 *
742 *    Notes:    None
743 *
744 *    File:     ckw.c
745 *
746 */
747 S16 cmUnpkCkwUbndReq
748 (
749 CkwUbndReq     func,
750 Pst            *pst,
751 Buffer         *mBuf
752 )
753 {
754     SpId       spId = 0;
755     Reason     reason = 0;
756     
757
758     CMCHKUNPKLOG(SUnpkS16, &spId, mBuf, ECKW026, pst);
759     CMCHKUNPKLOG(SUnpkS16, &reason, mBuf, ECKW027, pst);
760     SPutMsg(mBuf);
761     return ((*func)(pst, spId, reason));
762 } /*end of function cmUnpkCkwUbndReq*/
763 \f
764 /*
765 *
766 *    Fun:    cmUnpkCkwBndCfm
767 *
768 *    Desc:    unpack the primitive CkwBndCfm
769 *
770 *    Ret:    ROK  -ok
771 *
772 *    Notes:    None
773 *
774 *    File:     ckw.c
775 *
776 */
777 S16 cmUnpkCkwBndCfm
778 (
779 CkwBndCfm      func,
780 Pst            *pst,
781 Buffer         *mBuf
782 )
783 {
784     SuId    suId = 0;
785     uint8_t status = 0;
786     
787
788     CMCHKUNPKLOG(SUnpkS16, &suId, mBuf, ECKW028, pst);
789     CMCHKUNPKLOG(oduPackUInt8, &status, mBuf, ECKW029, pst);
790     SPutMsg(mBuf);
791
792     return ((*func)(pst, suId, status));
793 } /*end of function cmUnpkCkwBndCfm*/
794
795 \f
796 /*
797 *
798 *    Fun:    cmUnpkRlcTmInfo
799 *
800 *    Desc:    pack the structure RlcTmInfo
801 *
802 *    Ret:    ROK  -ok
803 *
804 *    Notes:    None
805 *
806 *    File:     ckw.c
807 *
808 */
809 S16 cmUnpkRlcTmInfo
810 (
811 RlcTmInfo      *param,
812 Buffer         *mBuf
813 )
814 {
815
816     CMCHKUNPK(oduPackUInt32, &(param->dl.buffSize), mBuf);
817
818     return ROK;
819 } /* cmUnpkRlcTmInfo */
820
821 \f
822 /*
823 *
824 *    Fun:    cmUnpkRlcUmInfo
825 *
826 *    Desc:    pack the structure RlcUmInfo
827 *
828 *    Ret:    ROK  -ok
829 *
830 *    Notes:    None
831 *
832 *    File:     ckw.c
833 *
834 */
835 S16 cmUnpkRlcUmInfo
836 (
837 RlcEntCfgInfo  *param,
838 Buffer         *mBuf
839 )
840 {
841
842     switch(param->dir)
843     {
844        case CKW_CFG_DIR_DL:
845           {
846              CMCHKUNPK(oduPackUInt8, &(param->m.umInfo.dl.snLen), mBuf);
847              break;
848           }
849        case CKW_CFG_DIR_UL:
850           {
851              CMCHKUNPK(oduPackUInt8, &(param->m.umInfo.ul.snLen), mBuf);
852              CMCHKUNPK(oduPackUInt8, &(param->m.umInfo.ul.reAsmblTmr), mBuf);
853              break;
854           }
855        /* Patch ckw_c_001.main_3 */
856        case CKW_CFG_DIR_BOTH:
857           {
858              CMCHKUNPK(oduPackUInt8, &(param->m.umInfo.ul.snLen), mBuf);
859              CMCHKUNPK(oduPackUInt8, &(param->m.umInfo.ul.reAsmblTmr), mBuf);
860              CMCHKUNPK(oduPackUInt8, &(param->m.umInfo.dl.snLen), mBuf);
861              break;
862           }
863     }
864
865     return ROK;
866 } /* cmUnpkRlcUmInfo */
867
868 \f
869 /*
870 *
871 *    Fun:    cmUnpkRlcAmInfo
872 *
873 *    Desc:    pack the structure RlcAmInfo
874 *
875 *    Ret:    ROK  -ok
876 *
877 *    Notes:    None
878 *
879 *    File:     ckw.c
880 *
881 */
882 S16 cmUnpkRlcAmInfo
883 (
884 RlcAmInfo      *param,
885 Buffer         *mBuf
886 )
887 {
888
889     /* DOWN LINK */
890     CMCHKUNPK(oduPackUInt8, &(param->dl.snLen), mBuf);
891     CMCHKUNPK(oduPackUInt16, &(param->dl.pollRetxTmr), mBuf);
892     CMCHKUNPK(SUnpkS16, &(param->dl.pollPdu), mBuf);
893     CMCHKUNPK(SUnpkS32, &(param->dl.pollByte), mBuf);
894     CMCHKUNPK(oduPackUInt8, &(param->dl.maxRetx), mBuf);
895
896     /* UP LINK */
897     CMCHKUNPK(oduPackUInt8, &(param->ul.snLen), mBuf);
898     CMCHKUNPK(oduPackUInt16, &(param->ul.staProhTmr), mBuf);
899     CMCHKUNPK(oduPackUInt8, &(param->ul.reAsmblTmr), mBuf);
900
901     return ROK;
902 } /* cmUnpkRlcAmInfo */
903
904 \f
905 /*
906 *
907 *    Fun:    cmUnpkCkwLChInfo
908 *
909 *    Desc:    pack the structure CkwLChInfo
910 *
911 *    Ret:    ROK  -ok
912 *
913 *    Notes:    None
914 *
915 *    File:     ckw.c
916 *
917 */
918 S16 cmUnpkCkwLChInfo
919 (
920 CkwLChInfo     *param,
921 Buffer         *mBuf
922 )
923 {
924
925     CMCHKUNPK(oduPackUInt8, &(param->lChId), mBuf);
926     CMCHKUNPK(oduPackUInt8, &(param->type), mBuf);
927
928     return ROK;
929 } /* cmUnpkCkwLChInfo */
930
931 \f
932 /*
933 *
934 *    Fun:    cmUnpkRlcEntCfgCfmInfo
935 *
936 *    Desc:    unpack the structure RlcEntCfgInfo
937 *
938 *    Ret:    ROK  -ok
939 *
940 *    Notes:    None
941 *
942 *    File:     ckw.c
943 *
944 */
945 S16 cmUnpkRlcEntCfgCfmInfo
946 (
947 RlcEntCfgCfmInfo  *param,
948 Buffer            *mBuf
949 )
950 {
951
952     CMCHKUNPK(oduPackUInt8, &(param->rbId), mBuf);
953     CMCHKUNPK(oduPackUInt8, &(param->rbType), mBuf);
954     CMCHKUNPK(cmUnpkCmStatus, &(param->status), mBuf);
955
956     return ROK;
957 } /* cmUnpkRlcEntCfgCfmInfo */
958
959 \f
960 /*
961 *
962 *    Fun:    cmUnpkRlcCfgCfmInfo
963 *
964 *    Desc:    pack the structure RlcCfgCfmInfo
965 *
966 *    Ret:    ROK  -ok
967 *
968 *    Notes:    None
969 *
970 *    File:     ckw.c
971 *
972 */
973 S16 cmUnpkRlcCfgCfmInfo
974 (
975 RlcCfgCfmInfo  *param,
976 Pst            *pst,
977 Buffer         *mBuf
978 )
979 {
980     uint8_t         idx;
981
982     CMCHKUNPKLOG(oduPackUInt32, &(param->transId), mBuf, ECKW030, pst);
983     CMCHKUNPK(cmUnpkLteRnti, &(param->ueId), mBuf);
984     CMCHKUNPK(cmUnpkLteCellId, &(param->cellId), mBuf);
985     CMCHKUNPK(oduPackUInt8, &(param->numEnt), mBuf);
986
987     for (idx = 0; idx < param->numEnt; idx++)
988     {
989        CMCHKUNPK(cmUnpkRlcEntCfgCfmInfo, &(param->entCfgCfm[idx]), mBuf);
990     }
991
992     return ROK;
993 } /* cmUnpkRlcCfgCfmInfo */
994
995 \f
996 /*
997 *
998 *    Fun:    cmUnpkRlcEntCfgInfo
999 *
1000 *    Desc:    pack the structure RlcEntCfgCfmInfo
1001 *
1002 *    Ret:    ROK  -ok
1003 *
1004 *    Notes:    None
1005 *
1006 *    File:     ckw.c
1007 *
1008 */
1009 S16 cmUnpkRlcEntCfgInfo
1010 (
1011 RlcEntCfgInfo  *param,
1012 Buffer         *mBuf
1013 )
1014 {
1015
1016     CMCHKUNPK(oduPackUInt8, &(param->cfgType), mBuf);
1017     CMCHKUNPK(oduPackUInt8, &(param->rbId), mBuf);
1018     CMCHKUNPK(oduPackUInt8, &(param->rbType), mBuf);
1019     CMCHKUNPK(oduPackUInt8, &(param->qci), mBuf);
1020     CMCHKUNPK(cmUnpkLteRlcMode, &(param->entMode), mBuf);
1021     CMCHKUNPK(oduPackUInt8, &(param->dir), mBuf);
1022     CMCHKUNPK(SUnpkS16, &(param->discardTmr), mBuf);
1023 #ifdef TENB_MULT_CELL_SUPPRT
1024     CMCHKUNPK(SUnpkS16, &(param->rguSapId), mBuf);
1025 #endif
1026
1027     /* Logical Channel Information */
1028     switch(param->entMode)
1029     {
1030        case CM_LTE_MODE_TM:
1031           {
1032              CMCHKUNPK(cmUnpkCkwLChInfo, &(param->lCh[0]), mBuf);
1033              break;
1034           }
1035        /* ccpu00128195: Unpacking lCh[0] and lCh[1] for UM bearer as well */
1036        case CM_LTE_MODE_UM:
1037        case CM_LTE_MODE_AM:
1038           {
1039              CMCHKUNPK(cmUnpkCkwLChInfo, &(param->lCh[0]), mBuf);
1040              CMCHKUNPK(cmUnpkCkwLChInfo, &(param->lCh[1]), mBuf);
1041              break;
1042           }
1043     }
1044
1045     /* TM/UM/AM Info */
1046     switch(param->entMode)
1047     {
1048        case CM_LTE_MODE_TM:
1049           {
1050              CMCHKUNPK(cmUnpkRlcTmInfo, &(param->m.tmInfo), mBuf);
1051              break;
1052           }
1053        case CM_LTE_MODE_UM:
1054           {
1055              CMCHKUNPK(cmUnpkRlcUmInfo, param, mBuf);
1056              break;
1057           }
1058        case CM_LTE_MODE_AM:
1059           {
1060              CMCHKUNPK(cmUnpkRlcAmInfo, &(param->m.amInfo), mBuf);
1061              break;
1062           }
1063     }
1064
1065     return ROK;
1066 } /* cmUnpkRlcEntCfgInfo */
1067
1068 \f
1069 /*
1070 *
1071 *    Fun:    cmUnpkRlcCfgInfo
1072 *
1073 *    Desc:    unpack the structure RlcCfgInfo
1074 *
1075 *    Ret:    ROK  -ok
1076 *
1077 *    Notes:    None
1078 *
1079 *    File:     ckw.c
1080 *
1081 */
1082 S16 cmUnpkRlcCfgInfo
1083 (
1084 RlcCfgInfo     *param,
1085 Pst            *pst,
1086 Buffer         *mBuf
1087 )
1088 {
1089     uint8_t  idx;
1090
1091     CMCHKUNPKLOG(oduPackUInt32, &(param->transId), mBuf, ECKW031, pst);
1092     CMCHKUNPK(cmUnpkLteRnti, &(param->ueId), mBuf);
1093     CMCHKUNPK(cmUnpkLteCellId, &(param->cellId), mBuf);
1094     CMCHKUNPK(oduPackUInt8, &(param->numEnt), mBuf);
1095
1096     for (idx = 0; idx < param->numEnt; idx++)
1097     {
1098        CMCHKUNPKLOG(cmUnpkRlcEntCfgInfo,&(param->entCfg[idx]), mBuf, ECKW032, pst);
1099     }
1100
1101     return ROK;
1102 } /* cmUnpkRlcCfgInfo */
1103
1104 \f
1105 /*
1106 *
1107 *    Fun:    cmUnpkRlcCfgCfm
1108 *
1109 *    Desc:    unpack the primitive RlcUiRlcCfgCfm
1110 *
1111 *    Ret:    ROK  -ok
1112 *
1113 *    Notes:    None
1114 *
1115 *    File:     ckw.c
1116 *
1117 */
1118 S16 cmUnpkRlcCfgCfm
1119 (
1120 RlcCfgCfm         func,
1121 Pst               *pst,
1122 Buffer            *mBuf
1123 )
1124 {
1125     S16 ret1;
1126     SuId  suId = 0;
1127     RlcCfgCfmInfo  *cfgCfmInfo = NULLP;
1128     
1129
1130     if((ret1 = SGetSBuf(pst->region, pst->pool, (Data **)&cfgCfmInfo,\
1131                 sizeof(RlcCfgCfmInfo))) != ROK)
1132     {
1133 #if (ERRCLASS & ERRCLS_ADD_RES)
1134        if(ret1 != ROK)
1135        {
1136           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1137                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1138                (ErrVal)ECKW035, (ErrVal)0, "SGetMsg() failed");
1139        }
1140 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1141        return (ret1);
1142     }
1143
1144     memset(cfgCfmInfo, 0, sizeof(RlcCfgCfmInfo));
1145
1146     CMCHKUNPK(SUnpkS16, &suId, mBuf);
1147
1148     switch(pst->selector)
1149     {
1150 #ifdef LCCKW
1151        case ODU_SELECTOR_LC:
1152        {
1153           ret1 = cmUnpkRlcCfgCfmInfo( (cfgCfmInfo), pst, mBuf);
1154 #if(ERRCLASS & ERRCLS_DEBUG)
1155           if(ret1 != ROK)
1156           {
1157              SPutMsg(mBuf);
1158              SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1159                    __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1160                   (ErrVal)ECKW036, (ErrVal)ret1, "Unpacking failure");
1161              return ( ret1 );
1162           }
1163 #endif /* ERRCLASS & ERRCLS_DEBUG */
1164           break;
1165        }
1166 #endif /* LCCKW */
1167     }
1168     SPutMsg(mBuf);
1169
1170     return ((*func)(pst, suId, cfgCfmInfo));
1171 } /* cmUnpkRlcCfgCfm */
1172
1173 /*
1174 *
1175 *    Fun:    cmUnpkCkwUeInfo
1176 *
1177 *    Desc:   Unpack the primitive KwUiCkwUeInfo
1178 *
1179 *    Ret:    ROK  -ok
1180 *
1181 *    Notes:  None
1182 *
1183 *    File:   ckw.c
1184 *
1185 */
1186 S16 cmUnpkCkwUeInfo
1187 (
1188 CkwUeInfo *param,
1189 Buffer    *mBuf
1190 )
1191 {
1192
1193    CMCHKUNPK(cmUnpkLteRnti, &(param->ueId), mBuf);
1194    CMCHKUNPK(cmUnpkLteCellId, &(param->cellId), mBuf);
1195
1196    return ROK;
1197 }
1198
1199 /*
1200 *
1201 *    Fun:    cmUnpkCkwUeIdChgReq
1202 *
1203 *    Desc:    unpack the primitive RlcUiCkwUeIdChgReq
1204 *
1205 *    Ret:    ROK  -ok
1206 *
1207 *    Notes:    None
1208 *
1209 *    File:     ckw.c
1210 *
1211 */
1212 S16 cmUnpkCkwUeIdChgReq
1213 (
1214 CkwUeIdChgReq     func,
1215 Pst               *pst,
1216 Buffer            *mBuf
1217 )
1218 {
1219     S16       ret1;
1220     SpId      spId = 0;
1221     uint32_t  transId = 0;
1222     CkwUeInfo *ueInfo = NULLP;
1223     CkwUeInfo *newUeInfo = NULLP;
1224     
1225
1226
1227     CMCHKUNPK(SUnpkS16, &(spId), mBuf);
1228     CMCHKUNPKLOG(oduPackUInt32, &transId, mBuf, ECKW037, pst);
1229
1230     if((ret1 = SGetSBuf(pst->region, pst->pool, (Data **)&ueInfo,\
1231                 sizeof(CkwUeInfo))) != ROK)
1232     {
1233 #if (ERRCLASS & ERRCLS_ADD_RES)
1234       /*MBUF_FIXX*/
1235           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1236                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1237                (ErrVal)ECKW038, (ErrVal)0, "SGetMsg() failed");
1238       
1239 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1240        return (ret1);
1241     }
1242
1243     memset(ueInfo, 0, sizeof(CkwUeInfo));
1244
1245     ret1 = cmUnpkCkwUeInfo((ueInfo), mBuf);
1246 #if(ERRCLASS & ERRCLS_DEBUG)
1247     if(ret1 != ROK)
1248     {
1249        SPutMsg(mBuf);
1250        SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1251              __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1252              (ErrVal)ECKW039, (ErrVal)ret1, "Unpacking failure");
1253        return ( ret1 );
1254     }
1255 #endif /* ERRCLASS & ERRCLS_DEBUG */
1256
1257     if((ret1 = SGetSBuf(pst->region, pst->pool, (Data **)&newUeInfo,\
1258                 sizeof(CkwUeInfo))) != ROK)
1259     {
1260 #if (ERRCLASS & ERRCLS_ADD_RES)
1261        /*MBUF_FIXX*/
1262           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1263                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1264                (ErrVal)ECKW040, (ErrVal)0, "SGetMsg() failed");
1265        
1266 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1267        return (ret1);
1268     }
1269
1270     memset(newUeInfo, 0, sizeof(CkwUeInfo));
1271
1272     ret1 = cmUnpkCkwUeInfo((newUeInfo), mBuf);
1273 #if(ERRCLASS & ERRCLS_DEBUG)
1274     if(ret1 != ROK)
1275     {
1276        SPutMsg(mBuf);
1277        SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1278              __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1279              (ErrVal)ECKW041, (ErrVal)ret1, "Unpacking failure");
1280        return ( ret1 );
1281     }
1282 #endif /* ERRCLASS & ERRCLS_DEBUG */
1283
1284     SPutMsg(mBuf);
1285
1286     return ((*func)(pst, spId, transId, ueInfo, newUeInfo));
1287
1288 } /* cmUnpkCkwUeIdChgReq */
1289
1290 /*
1291 *
1292 *    Fun:     cmUnpkCkwUeIdChgCfm
1293 *
1294 *    Desc:    unpack the primitive RlcUiCkwUeIdChgCfm
1295 *
1296 *    Ret:     ROK  -ok
1297 *
1298 *    Notes:   None
1299 *
1300 *    File:    ckw.c
1301 *
1302 */
1303 S16 cmUnpkCkwUeIdChgCfm
1304 (
1305 CkwUeIdChgCfm     func,
1306 Pst               *pst,
1307 Buffer            *mBuf
1308 )
1309 {
1310     S16       ret1;
1311     SuId      suId = 0;
1312     uint32_t  transId = 0;
1313     CkwUeInfo *ueInfo = NULLP;
1314     CmStatus  status;
1315     
1316
1317     memset(&status, 0, sizeof(CmStatus));
1318
1319     CMCHKUNPK(SUnpkS16, &suId, mBuf);
1320     CMCHKUNPKLOG(oduPackUInt32, &transId, mBuf, ECKW042, pst);
1321
1322     if((ret1 = SGetSBuf(pst->region, pst->pool, (Data **)&ueInfo,\
1323                 sizeof(CkwUeInfo))) != ROK)
1324     {
1325 #if (ERRCLASS & ERRCLS_ADD_RES)
1326        if(ret1 != ROK)
1327        {
1328           SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
1329                 __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
1330                (ErrVal)ECKW043, (ErrVal)0, "SGetMsg() failed");
1331        }
1332 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1333        return (ret1);
1334     }
1335
1336     memset(ueInfo, 0, sizeof(CkwUeInfo));
1337
1338     ret1 = cmUnpkCkwUeInfo((ueInfo), mBuf);
1339 #if(ERRCLASS & ERRCLS_DEBUG)
1340     if(ret1 != ROK)
1341     {
1342        SPutMsg(mBuf);
1343        SLogError(pst->dstEnt, pst->dstInst, pst->dstProcId,
1344              __FILE__, __LINE__, (ErrCls)ERRCLS_DEBUG,
1345              (ErrVal)ECKW044, (ErrVal)ret1, "Unpacking failure");
1346        return ( ret1 );
1347     }
1348 #endif /* ERRCLASS & ERRCLS_DEBUG */
1349
1350     CMCHKUNPK(cmUnpkCmStatus, &status, mBuf);
1351
1352     SPutMsg(mBuf);
1353
1354     return ((*func)(pst, suId, transId, ueInfo, status));
1355
1356 } /* cmUnpkCkwUeIdChgCfm */
1357
1358 #endif /* LCCKW */
1359 #ifdef __cplusplus
1360 }
1361 #endif /* __cplusplus */
1362
1363 \f  
1364 /**********************************************************************
1365          End of file
1366 **********************************************************************/