Memory handling fixes
[o-du/l2.git] / src / cm / lkw.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 \f
19 /********************************************************************20**
20   
21         Name:     NR RLC Layer 
22     
23         Type:     C source file
24   
25         Desc:     C Source code for common packing and unpacking functions
26                   for RLC Layer Manager Interfaces.  It contains the 
27                   following function definitions
28
29                      -- packRlcConfigReq
30                      -- cmPkLkwCntrlReq
31                      -- cmPkLkwCntrlCfm 
32                      -- packRlcConfigCfm
33                      -- cmPkLkwStaInd
34
35                      -- unpackRlcConfigReq 
36                      -- cmUnpkLkwCntrlReq
37                      -- cmUnpkLkwCntrlCfm
38                      -- unpackRlcConfigCfm 
39                      -- cmUnpkLkwStaInd
40  
41         File:     lkw.c
42
43 *********************************************************************21*/
44  
45 \f  
46 /* header include files (.h) */
47 #include "common_def.h"
48 #include "lkw.h"                /* Layer manager */
49
50 /* header/extern include files (.x) */
51
52 #include "lkw.x"                /* layer manager */
53
54 #ifdef LCLKW
55
56 Txt ptNmb[LKW_PART_NUM_STR_LEN];         /* Part number */
57
58 \f  
59 /* forward references */
60
61 static S16 cmPkRlcMngmt ARGS ((RlcMngmt *param ,Event eventType, 
62                                Buffer *mBuf));
63 static S16 cmPkRlcCfg ARGS ((RlcMngmt *param ,Elmnt elmnt, Buffer *mBuf));
64 static S16 cmPkRlcCntrl ARGS ((RlcMngmt *cntrl, Elmnt elmnt, Buffer *mBuf));
65 static S16 cmPkRlcUsta ARGS ((RlcMngmt *usta, Elmnt elmnt, Buffer *mBuf));
66 static S16 cmPkRlcSsta ARGS ((RlcMngmt *ssta, Elmnt etmnt, Event eventType,
67                               Buffer *mBuf));
68 static S16 cmPkRlcSts ARGS ((RlcMngmt *sts, Elmnt elmnt, Buffer *mBuf));
69 static S16 cmPkGenSts ARGS ((RlcGenSts *gen, Buffer *mBuf));
70 static S16 cmPkCkwSapSts ARGS ((RlcCkwCntSts *rcSap, Buffer *mBuf));
71 static S16 cmPkKwuSapSts ARGS ((RlcKwuSapSts *ruSap, Buffer *mBuf));
72 /* lkw_c_001.main_2 removed support of RGU sap statistics as it is reflecting
73  * in general statstics.
74  * */
75 static S16 cmPkRlcTrc ARGS ((RlcMngmt *trc, Buffer *mBuf));
76
77 static S16 cmUnpkRlcMngmt ARGS ((RlcMngmt *param, Event eventType,
78                                  Buffer * mBuf));
79 static S16 cmUnpkRlcCfg ARGS ((RlcMngmt *cfg, Elmnt elmnt, Buffer *mBuf));
80 static S16 cmUnpkRlcCntrl ARGS ((RlcMngmt *param, Elmnt elmnt, Buffer *mBuf));
81 static S16 cmUnpkRlcUsta ARGS ((RlcMngmt *usta, Elmnt elmnt, Buffer *mBuf));
82 static S16 cmUnpkRlcSsta ARGS ((RlcMngmt *ssta, Elmnt elmnt, Event eventType,
83                                 Buffer *mBuf));
84 static S16 cmUnpkRlcSts ARGS ((RlcMngmt *sts, Elmnt elmnt, Buffer *mBuf));
85 static S16 cmUnpkGenSts ARGS ((RlcGenSts *gen, Buffer *mBuf));
86 static S16 cmUnpkCkwSapSts ARGS ((RlcCkwCntSts *rcSap, Buffer *mBuf));
87 static S16 cmUnpkKwuSapSts ARGS ((RlcKwuSapSts *ruSap, Buffer *mBuf));
88 /* lkw_c_001.main_2 removed support of RGU sap statistics as it is reflecting
89  * in general statstics.
90  * */
91 static S16 cmUnpkRlcTrc ARGS ((RlcMngmt *trc, Buffer *mBuf));
92
93
94 static S16 cmPkCkwSapSta ARGS ((RlcCkwCntSapSta *rcSap, Buffer *mBuf));
95 static S16 cmUnpkCkwSapSta ARGS ((RlcCkwCntSapSta *rcSap, Buffer *mBuf));
96
97 static S16 cmPkKwuSapSta ARGS ((RlcKwuSapSta *rlSap, Buffer *mBuf));
98 static S16 cmUnpkKwuSapSta ARGS ((RlcKwuSapSta *rlSap, Buffer *mBuf));
99
100 static S16 cmPkRguSapSta ARGS ((RlcRguSapSta *mkSap, Buffer *mBuf));
101 static S16 cmUnpkRguSapSta ARGS ((RlcRguSapSta *mkSap, Buffer *mBuf));
102
103 /**
104  * @brief
105      Pack Config Request
106  *
107  * @param[in] pst  : post structure 
108  * @param[in] cfg  : RLC LM structure 
109  *  @return  S16
110  *      -# Success : ROK 
111  *      -# Failure : RFAILED 
112  */
113
114 S16 packRlcConfigReq
115 (
116 Pst *pst,                    /* post structure */
117 RlcMngmt *cfg                 /* RLC LM structure */
118 )
119 {
120    Buffer *mBuf;             /* message buffer */
121    S16 ret1;                 /* return value */
122
123
124    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
125    if (ret1 != ROK)
126    {
127 #if (ERRCLASS & ERRCLS_ADD_RES)
128        if(ret1 != ROK)
129        {
130           LKWLOGERROR(pst, ERRCLS_ADD_RES, ELKW001, (ErrVal) ret1,
131              "SGetMsg failed ...!\n");
132        }
133 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
134       return (ret1);
135    }
136
137    ret1 = cmPkRlcMngmt(cfg, LKW_EVT_CFG_REQ, mBuf);
138
139    if(ret1 != ROK)
140    {
141       SPutMsg(mBuf);
142 #if (ERRCLASS & ERRCLS_ADD_RES)
143        if(ret1 != ROK)
144        {
145           LKWLOGERROR(pst, ERRCLS_ADD_RES, ELKW002, (ErrVal) ret1,
146                "cmPkRlcMngmt failure ......!");
147        }
148 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
149       return RFAILED;
150    }
151
152    pst->event = (Event) LKW_EVT_CFG_REQ;   /* event */
153    SPstTsk(pst, mBuf);
154
155    return ROK;
156
157 }  /* end of packRlcConfigReq */
158
159 /**
160  * @brief
161      Unpack Config Request
162  *
163  * @param[in] func  : primitive to call
164  * @param[in] pst   : post structure
165  * @param[in] mBuf  : message buffer
166  *  @return  S16
167  *      -# Success : ROK
168  *      -# Failure : RFAILED
169  */
170  
171 uint8_t unpackRlcConfigReq
172 (
173 RlcConfigReq func,              /* primitive to call */
174 Pst *pst,                    /* post structure */
175 Buffer *mBuf                 /* message buffer */
176 )
177 {
178    S16 ret1;                 /* Return value */
179    RlcMngmt cfg;              /* RLC LM structure */
180
181
182    memset(&cfg,  0, sizeof(RlcMngmt));
183    ret1 = cmUnpkRlcMngmt(&cfg, LKW_EVT_CFG_REQ, mBuf);
184
185     if(ret1 != ROK)
186     {
187        SPutMsg(mBuf);
188 #if (ERRCLASS & ERRCLS_DEBUG)
189       /*MBUF_FIXX*/
190           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW003, (ErrVal) ret1,
191                "cmUnpkRlcMngmt failure ......!");
192       
193 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
194        return RFAILED;
195     }
196
197    SPutMsg(mBuf);
198    (Void) (*func)(pst, &cfg);
199
200    return ROK;
201
202 } /* end of unpackRlcConfigReq */
203
204
205
206 /**
207  * @brief
208      Pack Control Request
209  *
210  * @param[in] pst  : post structure
211  * @param[in] cntrl  : RLC LM structure
212  *  @return  S16
213  *      -# Success : ROK
214  *      -# Failure : RFAILED
215  */
216
217 S16 cmPkLkwCntrlReq
218 (
219 Pst *pst,                    /* post structure */
220 RlcMngmt *cntrl               /* RLC LM structure */  
221 )
222 {
223    Buffer *mBuf;             /* message buffer */
224    S16 ret1;                 /* return value */
225
226
227    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
228    if (ret1 != ROK)
229    {
230 #if (ERRCLASS & ERRCLS_ADD_RES)
231        if(ret1 != ROK)
232        {
233           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW004, (ErrVal) ret1,
234                "SGetMsg failure ......!");
235        }
236 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
237       return (ret1);
238    }
239
240    ret1 = cmPkRlcMngmt(cntrl, LKW_EVT_CNTRL_REQ, mBuf);
241
242    if(ret1 != ROK)
243    {
244       SPutMsg(mBuf);
245 #if (ERRCLASS & ERRCLS_ADD_RES)
246        if(ret1 != ROK)
247        {
248           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW005, (ErrVal) ret1,
249                "cmPkRlcMngmt failure ......!");
250        }
251 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
252       return (ret1);
253    }
254
255    pst->event = (Event) LKW_EVT_CNTRL_REQ;   /* event */
256    SPstTsk(pst, mBuf);
257
258    return ROK;
259
260 }  /* end of cmPkLkwCntrlReq */
261
262 /**
263  * @brief
264      Unpack Control Request
265  *
266  * @param[in] func  : primitive to call
267  * @param[in] pst   : post structure
268  * @param[in] mBuf  : message buffer
269  *  @return  S16
270  *      -# Success : ROK
271  *      -# Failure : RFAILED
272  */
273
274 S16 cmUnpkLkwCntrlReq
275 (
276 LkwCntrlReq func,            /* primitive to call */
277 Pst *pst,                    /* post structure */
278 Buffer *mBuf                 /* message buffer */
279 )
280 {
281    S16 ret1;                 /* return value */
282    RlcMngmt cfm;              /* Confirmation */
283
284
285    ret1 = cmUnpkRlcMngmt(&cfm, LKW_EVT_CNTRL_REQ, mBuf);
286
287     if(ret1 != ROK)
288     {
289        SPutMsg(mBuf);
290 #if (ERRCLASS & ERRCLS_DEBUG)
291       /*MBUF_FIXX*/
292           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW006, (ErrVal) ret1,
293                "cmUnpkRlcMngmt failure ......!");
294      
295 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
296        return RFAILED;
297     }
298
299    SPutMsg(mBuf);
300    return ((*func)(pst, &cfm));
301
302 } /* end of cmUnpkLkwCntrlReq */
303
304 /**
305  * @brief
306      Pack Control Confirm
307  *
308  * @param[in] pst  : post structure
309  * @param[in] cfg  : RLC LM structure
310  *  @return  S16
311  *      -# Success : ROK
312  *      -# Failure : RFAILED
313  */
314
315 uint8_t cmPkLkwCntrlCfm
316 (
317 Pst *pst,                    /* post structure */
318 RlcMngmt *cfm                 /* RLC LM structure */
319 )
320 {
321    Buffer *mBuf;             /* message buffer */
322    S16 ret1;                 /* return value */
323
324
325    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
326    if (ret1 != ROK)
327    {
328 #if (ERRCLASS & ERRCLS_ADD_RES)
329        if(ret1 != ROK)
330        {
331           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW007, (ErrVal) ret1,
332                "SGetMsg failure ......!");
333        }
334 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
335       return (ret1);
336    }
337
338    ret1 = cmPkRlcMngmt(cfm, LKW_EVT_CNTRL_CFM, mBuf);
339
340    if(ret1 != ROK)
341    {
342       SPutMsg(mBuf);
343 #if (ERRCLASS & ERRCLS_ADD_RES)
344        if(ret1 != ROK)
345        {
346           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW008, (ErrVal) ret1,
347                "Packing failure ......!");
348        }
349 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
350       return RFAILED;
351    }
352
353    pst->event = (Event) LKW_EVT_CNTRL_CFM;   /* event */
354    SPstTsk(pst, mBuf);
355
356    return ROK;
357
358 }  /* end of cmPkLkwCntrlCfm */
359
360
361 /**
362  * @brief
363      Unpack Control confirm
364  *
365  * @param[in] func  : primitive to call
366  * @param[in] pst   : post structure
367  * @param[in] mBuf  : message buffer
368  *  @return  S16
369  *      -# Success : ROK
370  *      -# Failure : RFAILED
371  */
372
373 S16 cmUnpkLkwCntrlCfm
374 (
375 LkwCntrlCfm func,            /* primitive to call */
376 Pst *pst,                    /* post structure */
377 Buffer *mBuf                 /* message buffer */
378 )
379 {
380    RlcMngmt cfm;              /* RLC LM structure */
381    S16 ret1;                 /* return value */
382
383
384    ret1 = cmUnpkRlcMngmt(&cfm, LKW_EVT_CNTRL_CFM, mBuf);
385
386    if(ret1 != ROK)
387    {
388       SPutMsg(mBuf);
389 #if (ERRCLASS & ERRCLS_DEBUG)
390        if(ret1 != ROK)
391        {
392           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW009, (ErrVal) ret1,
393                "cmUnpkRlcMngmt failure ......!");
394        }
395 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
396       return RFAILED;
397    }
398       
399    SPutMsg(mBuf); 
400
401    return ((*func)(pst, &cfm));
402
403 } /* end of cmUnpkLkwCntrlCfm */
404
405 /**
406  * @brief
407      Unpack statistics Confirm
408  *
409  * @param[in] func  : primitive to call
410  * @param[in] pst   : post structure
411  * @param[in] mBuf  : message buffer
412  *  @return  S16
413  *      -# Success : ROK
414  *      -# Failure : RFAILED
415  */
416 S16 cmUnpkLkwStsCfm
417 (
418 LkwStsCfm func,              /* primitive to call */
419 Pst *pst,                    /* post structure */
420 Buffer *mBuf                 /* message buffer */
421 )
422 {
423    RlcMngmt cfm;              /* RLC LM structure */
424    S16 ret1;                 /* return value */
425
426
427    ret1 = cmUnpkRlcMngmt(&cfm, LKW_EVT_STS_CFM, mBuf);
428
429    if(ret1 != ROK)
430    {
431       SPutMsg(mBuf);
432 #if (ERRCLASS & ERRCLS_DEBUG)
433        if(ret1 != ROK)
434        {
435           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW010, (ErrVal) ret1,
436                "SPutMsg failure ......!");
437        }
438 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
439       return RFAILED;
440    }
441      
442    SPutMsg(mBuf);
443
444    return ((*func)(pst, 0, &cfm));
445
446 } /* end of cmUnpkLkwStsCfm */
447
448 /**
449  * @brief
450      Pack Config Confirm 
451  *
452  * @param[in] pst  : post structure
453  * @param[in] cfg  : RLC LM structure
454  *  @return  S16
455  *      -# Success : ROK
456  *      -# Failure : RFAILED
457  */
458
459
460 uint8_t packRlcConfigCfm
461 (
462 Pst *pst,                    /* post structure */
463 RlcMngmt *cfm                 /* RLC LM structure */
464 )
465 {
466    Buffer *mBuf;             /* message buffer */
467    S16 ret1;                 /* return value */
468
469
470    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
471    if (ret1 != ROK)
472    {
473 #if (ERRCLASS & ERRCLS_ADD_RES)
474        if(ret1 != ROK)
475        {
476           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW011, (ErrVal) ret1,
477                "SGetMsg failure ......!");
478        }
479 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
480       return (ret1);
481    }
482
483    ret1 = cmPkRlcMngmt(cfm, LKW_EVT_CFG_CFM, mBuf);
484
485    if(ret1 != ROK)
486    {
487       SPutMsg(mBuf);
488 #if (ERRCLASS & ERRCLS_ADD_RES)
489        if(ret1 != ROK)
490        {
491           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW012, (ErrVal) ret1,
492                "SPutMsg failure ......!");
493        }
494 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
495       return RFAILED;
496    }
497
498    pst->event = (Event) LKW_EVT_CFG_CFM;   /* event */
499    SPstTsk(pst, mBuf);
500
501    return ROK;
502
503 }  /* end of packRlcConfigCfm */
504
505
506 /**
507  * @brief
508      Unpack Config Confirm 
509  *
510  * @param[in] func  : primitive to call
511  * @param[in] pst   : post structure
512  * @param[in] mBuf  : message buffer
513  *  @return  S16
514  *      -# Success : ROK
515  *      -# Failure : RFAILED
516  */
517 uint8_t unpackRlcConfigCfm
518 (
519 RlcConfigCfm func,              /* primitive to call */
520 Pst *pst,                    /* post structure */
521 Buffer *mBuf                 /* message buffer */
522 )
523 {
524    S16 ret1;                 /* return value */
525    RlcMngmt cfm;              /* RLC LM structure */
526
527
528    ret1 = cmUnpkRlcMngmt(&cfm, LKW_EVT_CFG_CFM, mBuf);
529
530    if(ret1 != ROK)
531    {
532       SPutMsg(mBuf);
533 #if (ERRCLASS & ERRCLS_DEBUG)
534        if(ret1 != ROK)
535        {
536           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW013, (ErrVal) ret1,
537                "SPutMsg failure ......!");
538        }
539 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
540       return RFAILED;
541    }
542
543    SPutMsg(mBuf);
544    return ((*func)(pst, &cfm));
545
546 } /* end of unpackRlcConfigCfm */
547
548
549
550 /**
551  * @brief
552      Pack Status Indication 
553  *
554  * @param[in] pst  : post structure
555  * @param[in] usta  : RLC LM structure
556  *  @return  S16
557  *      -# Success : ROK
558  *      -# Failure : RFAILED
559  */
560
561 S16 cmPkLkwStaInd
562 (
563 Pst *pst,                    /* post structure */
564 RlcMngmt *usta                /* RLC LM structure */
565 )
566 {
567    Buffer *mBuf;             /* message buffer */
568    S16 ret1;                 /* return value */
569
570
571    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
572    if (ret1 != ROK)
573    {
574 #if (ERRCLASS & ERRCLS_ADD_RES)
575        if(ret1 != ROK)
576        {
577           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW014, (ErrVal) ret1,
578                "SGetMsg() failed");
579        }
580 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
581       return (ret1);
582    }
583
584    ret1 = cmPkRlcMngmt(usta, LKW_EVT_STA_IND, mBuf);
585
586    if(ret1 != ROK)
587    {
588       SPutMsg(mBuf);
589 #if (ERRCLASS & ERRCLS_ADD_RES)
590        if(ret1 != ROK)
591        {
592           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW015, (ErrVal) ret1,
593                "cmPkRlcMngmt failure ......!");
594        }
595 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
596       return (ret1);
597    }
598
599    pst->event = (Event) LKW_EVT_STA_IND;   /* event */
600    SPstTsk(pst, mBuf);
601
602    return ROK;
603
604 }  /* end of cmPkLkwStaInd */
605
606
607 /**
608  * @brief
609      Unpack Unsolicited Status indication 
610  *
611  * @param[in] func  : primitive to call
612  * @param[in] pst   : post structure
613  * @param[in] mBuf  : message buffer
614  *  @return  S16
615  *      -# Success : ROK
616  *      -# Failure : RFAILED
617  */
618
619 S16 cmUnpkLkwStaInd
620 (
621 LkwStaInd func,             /* primitive pointer */
622 Pst *pst,                   /* post structure */
623 Buffer *mBuf                /* message buffer */
624 )
625 {
626    RlcMngmt usta;            /* RLC LM structure */
627    S16 ret1;                /* return value */
628
629    
630    ret1 = cmUnpkRlcMngmt(&usta, LKW_EVT_STA_IND, mBuf);
631
632    if(ret1 != ROK)
633    {
634       SPutMsg(mBuf);
635 #if (ERRCLASS & ERRCLS_DEBUG)
636        if(ret1 != ROK)
637        {
638           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW016, (ErrVal) ret1,
639                "cmUnpkRlcMngmt failure ......!");
640        }
641 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
642       return RFAILED;
643    }
644
645    SPutMsg(mBuf);
646
647    return ((*func)(pst, &usta));
648 } /* end of cmUnpkLsnStaInd */
649
650 /**
651  * @brief
652      Pack Status Request
653  *
654  * @param[in] pst  : post structure
655  * @param[in] sta : RLC LM structure
656  *  @return  S16
657  *      -# Success : ROK
658  *      -# Failure : RFAILED
659  */
660
661 S16 cmPkLkwStaReq
662 (
663 Pst *pst,                    /* post structure */
664 RlcMngmt *sta                 /* status */
665 )
666 {
667    Buffer *mBuf;             /* message buffer */
668    S16 ret1;                 /* return value */
669
670
671    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
672    if (ret1 != ROK)
673    {
674 #if (ERRCLASS & ERRCLS_ADD_RES)
675        if(ret1 != ROK)
676        {
677           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW017, (ErrVal) ret1,
678                "SGetMsg failure ......!");
679        }
680 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
681       return RFAILED;
682    }
683  
684    ret1 = cmPkRlcMngmt(sta, LKW_EVT_STA_REQ, mBuf);
685
686    if(ret1 != ROK)
687    {
688       SPutMsg(mBuf);
689 #if (ERRCLASS & ERRCLS_ADD_RES)
690        if(ret1 != ROK)
691        {
692           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW018, (ErrVal) ret1,
693                "SGetMsg() failure ......!");
694        }
695 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
696       return RFAILED;
697    }
698
699    pst->event = (Event) LKW_EVT_STA_REQ;   /* event */
700    SPstTsk(pst, mBuf);
701
702    return ROK;
703
704 }  /* end of cmPkLkwStaReq */
705
706 /**
707  * @brief
708      Unpack status confirmation 
709  *
710  * @param[in] func  : primitive to call
711  * @param[in] pst   : post structure
712  * @param[in] mBuf  : message buffer
713  *  @return  S16
714  *      -# Success : ROK
715  *      -# Failure : RFAILED
716  */
717 S16 cmUnpkLkwStaCfm
718 (
719 LkwStaReq func,              /* primitive pointer */
720 Pst *pst,                    /* post structure */
721 Buffer *mBuf                 /* message buffer */
722 )
723 {
724    RlcMngmt cfm;              /* RLC LM structure */
725    S16 ret1;                 /* return value */
726
727
728    ret1 = cmUnpkRlcMngmt(&cfm, LKW_EVT_STA_CFM, mBuf);
729
730     if(ret1 != ROK)
731     {
732        SPutMsg(mBuf);
733 #if (ERRCLASS & ERRCLS_DEBUG)
734        if(ret1 != ROK)
735        {
736           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW019, (ErrVal) ret1,
737                "Unpacking failure ......!");
738        }
739 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
740        return RFAILED;
741     }
742
743    SPutMsg(mBuf);
744   
745    return ((*func)(pst, &cfm));
746
747 } /* end of function cmUnpkLkwStaCfm */
748
749 /**
750  * @brief
751      Unpack Status request 
752  *
753  * @param[in] func  : primitive to call
754  * @param[in] pst   : post structure
755  * @param[in] mBuf  : message buffer
756  *  @return  S16
757  *      -# Success : ROK
758  *      -# Failure : RFAILED
759  */
760 S16 cmUnpkLkwStsReq
761 (
762 LkwStsReq func,              /* primitive pointer */
763 Pst *pst,                    /* post structure */
764 Buffer *mBuf                 /* message buffer */
765 )
766 {
767    RlcMngmt sts;              /* RLC LM structure */
768    S16 ret1;                 /* return value */
769    Action action;            /* Action */
770
771
772    CMCHKUNPK(SUnpkS16, &action, mBuf);
773
774    ret1 = cmUnpkRlcMngmt(&sts, LKW_EVT_STS_REQ, mBuf);
775
776     if(ret1 != ROK)
777     {
778        SPutMsg(mBuf);
779 #if (ERRCLASS & ERRCLS_DEBUG)
780        /*MBUF_FIXX*/
781           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW020, (ErrVal) ret1,
782                "Unpacking failure ......!");
783       
784 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
785        return RFAILED;
786     }
787
788    SPutMsg(mBuf);
789
790    return ((*func)(pst, action, &sts));
791
792 } /* end of function cmUnpkLkwStsReq */
793
794
795 /**
796  * @brief
797      Unpack ssta 
798  *
799  * @param[in] func  : primitive to call
800  * @param[in] pst   : post structure
801  * @param[in] mBuf  : message buffer
802  *  @return  S16
803  *      -# Success : ROK
804  *      -# Failure : RFAILED
805  */
806 S16 cmUnpkLkwStaReq
807 (
808 LkwStaReq func,              /* primitive pointer */
809 Pst *pst,                    /* post structure */
810 Buffer *mBuf                 /* message buffer */
811 )
812 {
813    RlcMngmt sta;              /* RLC LM structure */
814    S16 ret1;                 /* return value */
815
816
817    ret1 = cmUnpkRlcMngmt(&sta, LKW_EVT_STA_REQ, mBuf);
818
819     if(ret1 != ROK)
820     {
821        SPutMsg(mBuf);
822 #if (ERRCLASS & ERRCLS_DEBUG)
823       /*MBUF_FIXX*/
824           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW021, (ErrVal) ret1,
825                "Unpacking failure ......!");
826       
827 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
828        return RFAILED;
829     }
830
831    SPutMsg(mBuf);
832
833    return ((*func)(pst, &sta));
834
835 } /* end of function cmUnpkLkwStaReq */
836
837
838 /**
839  * @brief
840      Unpack Trace Indication 
841  *
842  * @param[in] func  : primitive to call
843  * @param[in] pst   : post structure
844  * @param[in] mBuf  : message buffer
845  *  @return  S16
846  *      -# Success : ROK
847  *      -# Failure : RFAILED
848  */
849
850 S16 cmUnpkLkwTrcInd
851 (
852 LkwTrcInd func,              /* primitive to call */
853 Pst *pst,                    /* post structure */
854 Buffer *mBuf                 /* message buffer */
855 )
856 {
857    S16 ret1;                 /* return value */
858    RlcMngmt trc;              /* RLC LM structure */
859
860
861    ret1 = cmUnpkRlcMngmt(&trc, LKW_EVT_TRC_IND, mBuf);
862
863     if(ret1 != ROK)
864     {
865        SPutMsg(mBuf);
866 #if (ERRCLASS & ERRCLS_DEBUG)
867        if(ret1 != ROK)
868        {
869           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW022, (ErrVal) ret1,
870                "Unpacking failure ......!");
871        }
872 #endif /*  ERRCLASS & ERRCLS_DEBUG  */
873        return RFAILED;
874     }
875
876    (Void) (*func)(pst, &trc, mBuf);
877
878    return ROK;
879
880 } /* end of cmUnpkLkwTrcInd */
881
882
883 /**
884  * @brief
885      Pack Config Request
886  *
887  * @param[in] pst  : post structure
888  * @param[in] cfg  : RLC LM structure
889  *  @return  S16
890  *      -# Success : ROK
891  *      -# Failure : RFAILED
892  */
893
894 static S16 cmPkCkwSapSta 
895
896 RlcCkwCntSapSta *rcSap,         /* SAP statistics */      
897 Buffer *mBuf                 /* Message buffer */
898 )
899 {
900
901    CMCHKPK(cmPkState, rcSap->state, mBuf);
902    CMCHKPK(SPkS16, rcSap->spId, mBuf);   
903
904    return ROK;
905
906 } /* end of cmPkCkwSapSta */
907
908 /**
909  * @brief
910      Unpack CKW sap Sta 
911  *
912  * @param[out] rcSap: RLC LM structure 
913  * @param[in] buffer: Buffer
914  *  @return  S16
915  *      -# Success : ROK
916  *      -# Failure : RFAILED
917  */
918 static S16 cmUnpkCkwSapSta 
919 (
920 RlcCkwCntSapSta *rcSap,         /* SAP statistics */ 
921 Buffer *mBuf                 /* Message buffer */
922 )
923 {
924
925    CMCHKUNPK(SUnpkS16, &rcSap->spId, mBuf);
926    CMCHKUNPK(cmUnpkState, &rcSap->state, mBuf);
927   
928    return ROK;
929 } /* end of function cmUnpkCkwSapSta */
930
931 /**
932  * @brief
933      Pack Config Request
934  *
935  * @param[in] pst  : post structure
936  * @param[in] cfg  : RLC LM structure
937  *  @return  S16
938  *      -# Success : ROK
939  *      -# Failure : RFAILED
940  */
941 static S16 cmPkKwuSapSta
942 (
943 RlcKwuSapSta *rlSap,           /* SAP statistics */       
944 Buffer *mBuf                 /* Message buffer */
945 )
946 {
947
948    CMCHKPK(cmPkState, rlSap->state, mBuf);
949    CMCHKPK(SPkS16, rlSap->spId, mBuf);
950
951    return ROK;
952
953 } /* end of cmPkKwuSapSta */
954
955 /**
956  * @brief
957      Unpack Kwu Sap Sta 
958  *
959  * @param[out] rlSap  : KwRLSapSta structure 
960  * @param[in] mBuf  : message buffer
961  *  @return  S16
962  *      -# Success : ROK
963  *      -# Failure : RFAILED
964  */
965 static S16 cmUnpkKwuSapSta
966 (
967 RlcKwuSapSta *rlSap,           /* SAP statistics */                   
968 Buffer *mBuf                 /* Message buffer */
969 )
970 {
971
972    CMCHKUNPK(SUnpkS16, &rlSap->spId, mBuf);
973    CMCHKUNPK(cmUnpkState, &rlSap->state, mBuf);
974
975    return ROK;
976  
977 } /* end of function cmUnpkKwuSapSta */
978
979 /**
980  * @brief
981      Pack 
982  *
983  * @param[in] pst  : post structure
984  * @param[in] cfg  : RLC LM structure
985  *  @return  S16
986  *      -# Success : ROK
987  *      -# Failure : RFAILED
988  */
989 static S16 cmPkRguSapSta
990 (
991 RlcRguSapSta *mkSap,           /* SAP statistics */             
992 Buffer *mBuf                 /* Message buffer */
993 )
994 {
995
996    CMCHKPK(cmPkState, mkSap->state, mBuf);
997    CMCHKPK(cmPkSuId, mkSap->suId, mBuf);
998
999    return ROK;
1000
1001 } /* end of cmPkRguSapSta */
1002
1003 /**
1004  * @brief
1005      Unpack Rgu Sap Sta 
1006  *
1007  * @param[out] mkSap: RlcRguSapSta structure 
1008  * @param[in] mBuf  : message buffer
1009  *  @return  S16
1010  *      -# Success : ROK
1011  *      -# Failure : RFAILED
1012  */
1013 static S16 cmUnpkRguSapSta
1014 (
1015 RlcRguSapSta *mkSap,           /* SAP statistics */              
1016 Buffer *mBuf                 /* Message buffer */
1017 )
1018 {
1019
1020    CMCHKUNPK(cmUnpkSuId, &mkSap->suId, mBuf);
1021    CMCHKUNPK(cmUnpkState, &mkSap->state, mBuf);
1022
1023    return ROK;
1024
1025 } /* end of function cmUnpkRguSapSta */
1026
1027 /**
1028  * @brief
1029      Pack 
1030  *
1031  * @param[in] pst  : post structure
1032  * @param[in] cfg  : RLC LM structure
1033  *  @return  S16
1034  *      -# Success : ROK
1035  *      -# Failure : RFAILED
1036  */
1037 S16 cmPkLkwStaCfm
1038 (
1039 Pst *pst,                    /* post structure */
1040 RlcMngmt *cfm                 /* solicited status confirm */
1041 )
1042 {
1043    Buffer *mBuf;             /* message buffer */
1044    S16 ret1;                 /* return value */
1045
1046
1047    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
1048    if (ret1 != ROK)
1049    {
1050 #if (ERRCLASS & ERRCLS_ADD_RES)
1051        if(ret1 != ROK)
1052        {
1053           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW023, (ErrVal) ret1,
1054                "SGetMsg() failure ......!");
1055        }
1056 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1057       return RFAILED;
1058    }
1059
1060    ret1 = cmPkRlcMngmt(cfm, LKW_EVT_STA_CFM, mBuf);
1061
1062    if(ret1 != ROK)
1063    {
1064       SPutMsg(mBuf);
1065 #if (ERRCLASS & ERRCLS_ADD_RES)
1066        if(ret1 != ROK)
1067        {
1068           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW024, (ErrVal) ret1,
1069                "packing failure ......!");
1070        }
1071 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1072       return RFAILED;
1073    }
1074
1075    pst->event = (Event) LKW_EVT_STA_CFM;   /* event */
1076    SPstTsk(pst, mBuf);
1077
1078    return ROK;
1079 } /* end of cmPkLkwStaCfm */
1080
1081
1082 /**
1083  * @brief
1084      Pack 
1085  *
1086  * @param[in] pst  : post structure
1087  * @param[in] cfg  : RLC LM structure
1088  *  @return  S16
1089  *      -# Success : ROK
1090  *      -# Failure : RFAILED
1091  */
1092 S16 cmPkLkwTrcInd
1093 (
1094 Pst *pst,                    /* post structure */
1095 RlcMngmt *trc,                /* trace */
1096 Buffer *trcBuf                 /* trace buffer */
1097 )
1098 {
1099    S16      ret1 = ROK;       /* return value */
1100    Buffer   *mBuf = NULLP;    /* Buffer to trace */
1101
1102
1103    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
1104    if (ret1 != ROK)
1105    {
1106 #if (ERRCLASS & ERRCLS_ADD_RES)
1107       if(ret1 != ROK)
1108       {
1109          LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW025, (ErrVal) ret1,
1110                "SGetMsg() failure ......!");
1111       }
1112 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1113       return RFAILED;
1114    }
1115
1116    if (trcBuf)
1117    {
1118       ret1 = SCatMsg(mBuf, trcBuf, M1M2);
1119       if (ret1 != ROK)
1120       {
1121          SPutMsg(mBuf);
1122          SPutMsg(trcBuf);
1123 #if (ERRCLASS & ERRCLS_ADD_RES)
1124          if(ret1 != ROK)
1125          {
1126             LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW026, (ErrVal) ret1,
1127                   "SGetMsg() failure ......!");
1128          }
1129 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1130          return RFAILED;
1131       }
1132
1133       SPutMsg(trcBuf);
1134    }
1135
1136    ret1 = cmPkRlcMngmt(trc, LKW_EVT_TRC_IND, mBuf);
1137
1138    if(ret1 != ROK)
1139    {
1140       SPutMsg(mBuf);
1141 #if (ERRCLASS & ERRCLS_ADD_RES)
1142       if(ret1 != ROK)
1143       {
1144          LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW027, (ErrVal) ret1,
1145                "packing failure ......!");
1146       }
1147 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1148       /* log error */
1149       return RFAILED;
1150    }
1151
1152    pst->event = (Event) LKW_EVT_TRC_IND;   /* event */
1153    SPstTsk(pst, mBuf);
1154
1155    return ROK;
1156
1157 } /* end of cmPkLkwTrcInd */
1158
1159
1160 /**
1161  * @brief
1162      Pack 
1163  *
1164  * @param[in] pst  : post structure
1165  * @param[in] cfg  : RLC LM structure
1166  *  @return  S16
1167  *      -# Success : ROK
1168  *      -# Failure : RFAILED
1169  */
1170 S16 cmPkLkwStsReq
1171 (
1172 Pst *pst,                    /* post structure */
1173 Action action,               /* action */
1174 RlcMngmt *sts                 /* statistics request */
1175 )
1176 {
1177
1178    Buffer *mBuf;             /* message buffer */
1179    S16 ret1;                 /* return value */
1180
1181
1182    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
1183    if (ret1 != ROK)
1184    {
1185 #if (ERRCLASS & ERRCLS_ADD_RES)
1186        if(ret1 != ROK)
1187        {
1188           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW028, (ErrVal) ret1,
1189                "SGetMsg() failure ......!");
1190        }
1191 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1192       return RFAILED;
1193    }
1194
1195    ret1 = cmPkRlcMngmt(sts, LKW_EVT_STS_REQ, mBuf);
1196
1197    if(ret1 != ROK)
1198    {
1199       SPutMsg(mBuf);
1200 #if (ERRCLASS & ERRCLS_ADD_RES)
1201        if(ret1 != ROK)
1202        {
1203           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW029, (ErrVal) ret1,
1204                "Packing failure ......!");
1205        }
1206 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1207       return RFAILED;
1208    }
1209
1210    CMCHKPK(SPkS16, action, mBuf); 
1211    pst->event = (Event) LKW_EVT_STS_REQ;   /* event */
1212    SPstTsk(pst, mBuf);
1213
1214    return ROK;
1215
1216 } /* end of cmPkLkwStsReq */
1217
1218
1219 /**
1220  * @brief
1221      Pack 
1222  *
1223  * @param[in] pst  : post structure
1224  * @param[in] cfg  : RLC LM structure
1225  *  @return  S16
1226  *      -# Success : ROK
1227  *      -# Failure : RFAILED
1228  */
1229 S16 cmPkLkwStsCfm
1230 (
1231 Pst *pst,                    /* post structure */
1232 Action action,               /* action */
1233 RlcMngmt *cfm                 /* statistics confirmation */
1234 )
1235 {
1236    Buffer *mBuf;             /* message buffer */
1237    S16 ret1;                 /* return value */
1238
1239    /* lkw_c_001.main_2 removed warning */
1240    UNUSED(action);
1241    ret1 = SGetMsg(pst->region, pst->pool, &mBuf);
1242    if (ret1 != ROK)
1243    {
1244 #if (ERRCLASS & ERRCLS_ADD_RES)
1245        if(ret1 != ROK)
1246        {
1247           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW030, (ErrVal) ret1,
1248                "SGetMsg() failure ......!");
1249        }
1250 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1251       return RFAILED;
1252    }
1253
1254    ret1 = cmPkRlcMngmt(cfm, LKW_EVT_STS_CFM, mBuf);
1255
1256    if(ret1 != ROK)
1257    {
1258       SPutMsg(mBuf);
1259 #if (ERRCLASS & ERRCLS_ADD_RES)
1260        if(ret1 != ROK)
1261        {
1262           LKWLOGERROR(pst, ERRCLS_INT_PAR, ELKW031, (ErrVal) ret1,
1263                "Packing  failure ......!");
1264        }
1265 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
1266       return RFAILED;
1267    }
1268
1269    pst->event = (Event) LKW_EVT_STS_CFM;   /* event */
1270    SPstTsk(pst, mBuf);
1271
1272    return ROK;
1273 } /* end of cmPkLkwStsCfm */
1274
1275
1276 /**
1277  * @brief
1278      Pack  
1279  *
1280  * @param[in] pst  : post structure
1281  * @param[in] cfg  : RLC LM structure
1282  *  @return  S16
1283  *      -# Success : ROK
1284  *      -# Failure : RFAILED
1285  */
1286
1287 static S16 cmPkRlcMngmt
1288 (
1289 RlcMngmt *param,              /* Managment */             
1290 Event eventType,             /* Event type */
1291 Buffer *mBuf                 /* Message Buffer */
1292 )
1293 {
1294     S16 ret1;                /* return value */
1295
1296
1297     switch( eventType )
1298     {
1299        case LKW_EVT_CFG_REQ:
1300           ret1 = cmPkRlcCfg(param, param->hdr.elmId.elmnt ,mBuf);
1301           if (ret1 != ROK)
1302           {
1303              return RFAILED;
1304           }
1305           break;
1306
1307        case LKW_EVT_CNTRL_REQ:
1308          ret1 = cmPkRlcCntrl(param, param->hdr.elmId.elmnt ,mBuf);
1309           if (ret1 != ROK)
1310           {
1311              return RFAILED;
1312           }
1313           break;
1314
1315        case LKW_EVT_STA_IND:
1316           ret1 = cmPkRlcUsta(param, param->hdr.elmId.elmnt ,mBuf);
1317           if (ret1 != ROK)
1318           {
1319              return RFAILED;
1320           }
1321           break;
1322
1323        case LKW_EVT_STA_REQ:
1324        case LKW_EVT_STA_CFM:
1325           ret1 = cmPkRlcSsta(param, param->hdr.elmId.elmnt , eventType, mBuf);
1326           if (ret1 != ROK)
1327           {
1328              return RFAILED;
1329           }
1330           break;
1331
1332        case LKW_EVT_STS_REQ:
1333        case LKW_EVT_STS_CFM:
1334           ret1 = cmPkRlcSts(param, param->hdr.elmId.elmnt ,mBuf);
1335           if (ret1 != ROK)
1336           {
1337              return RFAILED;
1338           }
1339           break;
1340        case LKW_EVT_TRC_IND:
1341           ret1 = cmPkRlcTrc(param, mBuf);
1342           if (ret1 != ROK)
1343           {
1344              return RFAILED;
1345           }
1346           break;
1347        case LKW_EVT_CNTRL_CFM:
1348        case LKW_EVT_CFG_CFM:
1349           break;
1350     }
1351
1352    CMCHKPK(cmPkCmStatus, &param->cfm, mBuf);
1353    CMCHKPK(cmPkHeader, &param->hdr, mBuf);
1354
1355    return ROK;
1356 } /* end of function cmPkRlcMngmt */
1357
1358
1359 /**
1360  * @brief
1361      Pack 
1362  *
1363  * @param[in] pst  : post structure
1364  * @param[in] cfg  : RLC LM structure
1365  *  @return  S16
1366  *      -# Success : ROK
1367  *      -# Failure : RFAILED
1368  */
1369 static S16 cmPkRlcCfg
1370 (
1371 RlcMngmt *cfg,
1372 Elmnt elmnt,
1373 Buffer *mBuf
1374 )
1375 {
1376
1377     switch( elmnt )
1378     {
1379       case STGEN:
1380       {
1381          CMCHKPK(oduUnpackUInt16, cfg->t.cfg.s.gen.maxRguSaps, mBuf);
1382          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.gen.rlcMode, mBuf);
1383          CMCHKPK(oduUnpackUInt32, cfg->t.cfg.s.gen.timeRes, mBuf);
1384          CMCHKPK(oduUnpackUInt16, cfg->t.cfg.s.gen.maxUdxSaps, mBuf);
1385          CMCHKPK(oduUnpackUInt16, cfg->t.cfg.s.gen.maxKwuSaps, mBuf);
1386          CMCHKPK(oduUnpackUInt32, cfg->t.cfg.s.gen.maxUe, mBuf);
1387          CMCHKPK(cmPkPst, &cfg->t.cfg.s.gen.lmPst,mBuf);
1388
1389          break;
1390       }
1391       case STCKWSAP:
1392       case STKWUSAP:
1393       case STUDXSAP:
1394       case STRGUSAP:
1395       {
1396          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.route,mBuf);
1397          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.priority,mBuf);
1398          CMCHKPK(oduUnpackUInt16, cfg->t.cfg.s.sap.bndTmrIntvl, mBuf);
1399          CMCHKPK(SPkS16, cfg->t.cfg.s.sap.sapId, mBuf);
1400          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.inst, mBuf);
1401          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.ent, mBuf);
1402          CMCHKPK(oduUnpackUInt16, cfg->t.cfg.s.sap.procId, mBuf);
1403          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.mem.pool, mBuf);
1404          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.mem.region, mBuf);
1405          CMCHKPK(oduUnpackUInt8, cfg->t.cfg.s.sap.selector, mBuf);
1406          break;
1407       }
1408        default:
1409           return RFAILED;
1410     }
1411     return ROK;
1412 } /*end of function cmPkRlcCfg*/
1413
1414
1415 /**
1416  * @brief
1417      Pack kw control request
1418  *
1419  * @param[in] cntrl  : LM management structure
1420  * @param[in] elmnt  : element 
1421  * @param[in] mBuf   : Buffer 
1422  *  @return  S16
1423  *      -# Success : ROK
1424  *      -# Failure : RFAILED
1425  */
1426 static S16 cmPkRlcCntrl
1427 (
1428 RlcMngmt *cntrl,
1429 Elmnt elmnt,
1430 Buffer *mBuf
1431 )
1432 {
1433     uint8_t subAction;            /* sub action */     
1434
1435
1436     switch( elmnt )
1437     {
1438       case STGEN:
1439          {
1440             subAction = cntrl->t.cntrl.subAction;
1441             switch(subAction)
1442             {
1443                case SAUSTA:
1444                   break;
1445                case SADBG:
1446                   {
1447                       CMCHKPK(oduUnpackUInt32, cntrl->t.cntrl.s.dbgCntrl.dbgMask,
1448                                                            mBuf);
1449                   }
1450                   break;
1451                case SATRC:
1452                   {
1453                      CMCHKPK(SPkS16, cntrl->t.cntrl.s.trcCntrl.trcLen, 
1454                                                            mBuf);
1455                      CMCHKPK(oduUnpackUInt8, cntrl->t.cntrl.s.trcCntrl.trcMask,
1456                                                            mBuf);
1457                   }
1458                   break;
1459 #ifdef SS_DIAG
1460                case SALOG:
1461                   {
1462                       CMCHKPK(oduUnpackUInt32, cntrl->t.cntrl.s.logMask,  mBuf);
1463                   }
1464                   break;
1465 #endif
1466                default:
1467                   break;
1468             }
1469             break;
1470          }
1471       case STRGUSAP:
1472       case STUDXSAP:
1473          CMCHKPK(SPkS16, cntrl->t.cntrl.s.sapCntrl.spId, mBuf);
1474          CMCHKPK(SPkS16, cntrl->t.cntrl.s.sapCntrl.suId, mBuf);
1475          break;
1476       default:
1477          break;
1478    }
1479
1480    CMCHKPK(oduUnpackUInt8, cntrl->t.cntrl.action, mBuf);
1481    CMCHKPK(oduUnpackUInt8, cntrl->t.cntrl.subAction, mBuf);
1482    CMCHKPK(cmPkDateTime, &cntrl->t.cntrl.dt, mBuf);
1483
1484    return ROK;
1485 } /*end of function cmPkRlcCntrl */
1486
1487 /**
1488  * @brief
1489      Pack unsolicit status  
1490  *
1491  * @param[in] usta  : RLC LM structure 
1492  * @param[in] elmnt : element
1493  * @param[in] mBuf  : Buffer 
1494  *  @return  S16
1495  *      -# Success : ROK
1496  *      -# Failure : RFAILED
1497  */
1498 static S16 cmPkRlcUsta
1499 (
1500 RlcMngmt *usta,
1501 Elmnt elmnt,
1502 Buffer *mBuf
1503 )
1504 {
1505
1506    /* lkw_c_001.main_2 removed warning */
1507    UNUSED(elmnt);
1508    /* lkw_c_001.main_2 added support for L2 Measurement */
1509 #ifdef LTE_L2_MEAS
1510    CMCHKPK(oduUnpackUInt8, usta->t.usta.qci, mBuf);
1511 #endif
1512    CMCHKPK(oduUnpackUInt32, usta->t.usta.ueId, mBuf);
1513    CMCHKPK(SPkS16, usta->t.usta.suId, mBuf);
1514    CMCHKPK(cmPkCmAlarm, &usta->t.usta.alarm,mBuf);
1515    CMCHKPK(cmPkDateTime, &usta->t.usta.dt, mBuf);
1516
1517    return ROK;
1518
1519 } /* end of cmPkRlcUsta */
1520
1521
1522 /**
1523  * @brief
1524      Pack 
1525  *
1526  * @param[in] pst  : post structure
1527  * @param[in] cfg  : RLC LM structure
1528  *  @return  S16
1529  *      -# Success : ROK
1530  *      -# Failure : RFAILED
1531  */
1532 static S16 cmPkRlcSsta
1533 (
1534 RlcMngmt *ssta,
1535 Elmnt elmnt,
1536 Event eventType,
1537 Buffer *mBuf
1538 )
1539 {
1540    S16 ret1;
1541
1542    ret1 = RFAILED;
1543    switch(elmnt)
1544    {
1545       case STSID:
1546          ret1 = ROK;
1547          if(eventType == LKW_EVT_STA_CFM)
1548          {
1549             CMCHKPK(cmPkSystemId, &ssta->t.ssta.s.sysId,mBuf);
1550          }
1551          break;
1552       case STCKWSAP:
1553          ret1 = cmPkCkwSapSta(&ssta->t.ssta.s.ckwSap, mBuf);
1554          break;
1555       case STKWUSAP:
1556          ret1 = cmPkKwuSapSta(&ssta->t.ssta.s.rlckwuSap, mBuf);
1557          break;
1558       case STRGUSAP:
1559       case STUDXSAP:
1560          ret1 = cmPkRguSapSta(&ssta->t.ssta.s.rguSap, mBuf);
1561          break;
1562       default:
1563          ret1 = RFAILED;
1564         break;
1565    }
1566
1567    if(ret1 != ROK)
1568    {
1569       return RFAILED;
1570    }
1571
1572    CMCHKPK(cmPkDateTime, &ssta->t.ssta.dt, mBuf);
1573
1574    return ROK;
1575
1576 } /* end of cmPkRlcSsta */
1577
1578 /**
1579  * @brief
1580      Pack Trace Indication
1581  *
1582  * @param[in] trc  : RLC LM structure 
1583  * @param[in] mBuf : Buffer 
1584  *  @return  S16
1585  *      -# Success : ROK
1586  *      -# Failure : RFAILED
1587  */
1588 static S16 cmPkRlcTrc
1589 (
1590 RlcMngmt *trc,                /* trace */                 
1591 Buffer *mBuf                 /* data buffer */
1592 )
1593 {
1594
1595    CMCHKPK(oduUnpackUInt16, trc->t.trc.event, mBuf); 
1596    CMCHKPK(cmPkDateTime, &trc->t.trc.dt, mBuf);
1597
1598    return ROK;
1599 } /* end of cmPkRlcTrc */
1600
1601
1602 /**
1603  * @brief
1604      Pack Statistics request 
1605  *
1606  * @param[in] pst  : post structure
1607  * @param[in] cfg  : RLC LM structure
1608  *  @return  S16
1609  *      -# Success : ROK
1610  *      -# Failure : RFAILED
1611  */
1612
1613 static S16 cmPkRlcSts
1614 (
1615 RlcMngmt *sts,
1616 Elmnt elmnt,
1617 Buffer *mBuf
1618 )
1619 {
1620    S16 ret1;
1621
1622    ret1 = RFAILED;
1623    switch(elmnt)
1624    {
1625       case STGEN:
1626          ret1 = cmPkGenSts(&sts->t.sts.s.gen, mBuf); 
1627          break;
1628       case STCKWSAP:
1629          ret1 = cmPkCkwSapSts(&sts->t.sts.s.ckwSap, mBuf);
1630          break;
1631       case STKWUSAP:
1632          ret1 = cmPkKwuSapSts(&sts->t.sts.s.rlckwuSap, mBuf);
1633          break;
1634 /* lkw_c_001.main_2 removed support of RGU sap statistics as it is reflecting
1635  * in general statstics.
1636  * */
1637       default:
1638          ret1 = RFAILED;
1639         break;
1640    } /* end of switch */
1641
1642    if(ret1 != ROK)
1643    {
1644       return RFAILED;
1645    }
1646
1647    CMCHKPK(cmPkDateTime, &sts->t.sts.dt, mBuf);
1648
1649    return ROK;
1650 } /* end of cmPkRlcSts */
1651
1652
1653
1654 /**
1655  * @brief
1656      Pack general statistics 
1657  *
1658  * @param[in] gen  : RlcGenSts structure 
1659  * @param[in] mBuf : Buffer 
1660  *  @return  S16
1661  *      -# Success : ROK
1662  *      -# Failure : RFAILED
1663  */
1664 static S16 cmPkGenSts
1665 (
1666 RlcGenSts *gen,
1667 Buffer *mBuf
1668 )
1669 {
1670
1671    CMCHKPK(oduUnpackUInt32, gen->numSduDisc, mBuf);
1672    CMCHKPK(oduUnpackUInt32, gen->numOfRb, mBuf);
1673    CMCHKPK(oduUnpackUInt32, gen->protTimeOut, mBuf);
1674    CMCHKPK(oduUnpackUInt32, gen->errorPdusRecv, mBuf);
1675    CMCHKPK(oduUnpackUInt32, gen->unexpPdusRecv, mBuf);
1676    CMCHKPK(oduUnpackUInt32, gen->bytesSent, mBuf);
1677    CMCHKPK(oduUnpackUInt32, gen->bytesRecv, mBuf);
1678    CMCHKPK(oduUnpackUInt32, gen->pdusRetx, mBuf);
1679    CMCHKPK(oduUnpackUInt32, gen->pdusSent, mBuf);
1680    CMCHKPK(oduUnpackUInt32, gen->pdusRecv, mBuf);
1681    CMCHKPK(oduUnpackUInt32, gen->numUe, mBuf);
1682
1683    return ROK;
1684
1685 } /* end of cmPkGenSts */
1686
1687 /**
1688  * @brief
1689      Pack CKW statistics
1690  *
1691  * @param[in] pst  : post structure
1692  * @param[in] cfg  : RLC LM structure
1693  *  @return  S16
1694  *      -# Success : ROK
1695  *      -# Failure : RFAILED
1696  */
1697 static S16 cmPkCkwSapSts
1698 (
1699 RlcCkwCntSts *rcSap,
1700 Buffer *mBuf
1701 )
1702 {
1703
1704    CMCHKPK(oduUnpackUInt32, rcSap->statMsgs, mBuf);
1705
1706    return ROK;
1707 } /* end of cmPkCkwSapSts */
1708
1709 /**
1710  * @brief
1711      Pack Config Request
1712  *
1713  * @param[in] pst  : post structure
1714  * @param[in] cfg  : RLC LM structure
1715  *  @return  S16
1716  *      -# Success : ROK
1717  *      -# Failure : RFAILED
1718  */
1719 static S16 cmPkKwuSapSts
1720 (
1721 RlcKwuSapSts *ruSap,
1722 Buffer *mBuf
1723 )
1724 {
1725
1726    CMCHKPK(oduUnpackUInt32, ruSap->sduTx, mBuf);
1727    CMCHKPK(oduUnpackUInt32, ruSap->sduRx, mBuf);
1728    /* lkw_c_001.main_2 changed from suId to spId */
1729    CMCHKPK(cmPkSuId, ruSap->spId, mBuf);
1730
1731    return ROK;
1732 } /* end of cmPkCkwSapSts */
1733
1734 /* lkw_c_001.main_2 removed support of RGU sap statistics as it is reflecting
1735  * in general statstics.
1736  * */
1737
1738 /**
1739  * @brief
1740      Unpack RLC Layer Management structure 
1741  *
1742  * @param[in] param  : RLC LM structure
1743  * @param[in] eventType   : event type 
1744  * @param[in] mBuf  : message buffer
1745  *  @return  S16
1746  *      -# Success : ROK
1747  *      -# Failure : RFAILED
1748  */
1749 static S16 cmUnpkRlcMngmt
1750 (
1751 RlcMngmt *param,
1752 Event eventType,
1753 Buffer *mBuf
1754 )
1755 {
1756     S16 ret1;
1757
1758    memset(param, 0, sizeof(RlcMngmt));
1759
1760    CMCHKUNPK(cmUnpkHeader, &param->hdr, mBuf);
1761    CMCHKUNPK(cmUnpkCmStatus, &param->cfm, mBuf);
1762
1763     switch( eventType )
1764     {
1765        case  LKW_EVT_CFG_REQ:
1766           ret1 = cmUnpkRlcCfg(param, param->hdr.elmId.elmnt ,mBuf);
1767           if (ret1 != ROK)
1768           {
1769              return RFAILED;
1770           }
1771           break;
1772        case LKW_EVT_CNTRL_REQ:
1773           ret1 = cmUnpkRlcCntrl(param, param->hdr.elmId.elmnt ,mBuf);
1774           if (ret1 != ROK)
1775           {
1776              return RFAILED;
1777           }
1778           break;
1779
1780        case LKW_EVT_STA_IND:
1781           ret1 = cmUnpkRlcUsta(param, param->hdr.elmId.elmnt ,mBuf);
1782           if (ret1 != ROK)
1783           {
1784              return RFAILED;
1785           }
1786           break;
1787
1788        case LKW_EVT_STA_REQ:
1789        case LKW_EVT_STA_CFM:
1790           ret1 = cmUnpkRlcSsta(param, param->hdr.elmId.elmnt, eventType,mBuf);
1791           if (ret1 != ROK)
1792           {
1793              return RFAILED;
1794           }
1795           break;
1796
1797        case LKW_EVT_STS_REQ:
1798        case LKW_EVT_STS_CFM:
1799           
1800           ret1 = cmUnpkRlcSts(param, param->hdr.elmId.elmnt ,mBuf);
1801           if (ret1 != ROK)
1802           {
1803              return RFAILED;
1804           }
1805           break;
1806        case LKW_EVT_TRC_IND:
1807           ret1 = cmUnpkRlcTrc(param, mBuf);
1808           if (ret1 != ROK)
1809           {
1810              return RFAILED;
1811           }
1812           break;
1813
1814        case LKW_EVT_CNTRL_CFM:
1815        case LKW_EVT_CFG_CFM:
1816        break;
1817
1818        default:
1819           break;
1820     }
1821     return ROK;
1822 } /*end of function cmUnpkRlcMngmt*/
1823
1824 /**
1825  * @brief
1826      Unpack Kw configuration structure 
1827  *
1828  * @param[out] cfg  : RLC LM structure 
1829  * @param[in] elmnt  : element 
1830  * @param[in] mBuf  : message buffer
1831  *  @return  S16
1832  *      -# Success : ROK
1833  *      -# Failure : RFAILED
1834  */
1835 static S16 cmUnpkRlcCfg
1836 (
1837 RlcMngmt *cfg,
1838 Elmnt elmnt,
1839 Buffer *mBuf
1840 )
1841 {
1842
1843    switch(elmnt)
1844    {
1845       case STGEN:
1846       {
1847          CMCHKUNPK(cmUnpkPst, &cfg->t.cfg.s.gen.lmPst,mBuf);
1848          CMCHKUNPK(oduPackUInt32, &cfg->t.cfg.s.gen.maxUe, mBuf);
1849          CMCHKUNPK(oduPackUInt16, &cfg->t.cfg.s.gen.maxKwuSaps, mBuf);
1850          CMCHKUNPK(oduPackUInt16, &cfg->t.cfg.s.gen.maxUdxSaps, mBuf);
1851          CMCHKUNPK(oduPackUInt32, &cfg->t.cfg.s.gen.timeRes, mBuf);
1852          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.gen.rlcMode, mBuf);
1853          CMCHKUNPK(oduPackUInt16, &cfg->t.cfg.s.gen.maxRguSaps, mBuf);
1854       }
1855       break;
1856
1857       case STCKWSAP:
1858       case STKWUSAP:
1859       case STRGUSAP:
1860       case STUDXSAP:
1861       {
1862          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.selector, mBuf);
1863          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.mem.region, mBuf);
1864          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.mem.pool, mBuf);
1865          CMCHKUNPK(oduPackUInt16, &cfg->t.cfg.s.sap.procId, mBuf);
1866          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.ent, mBuf);
1867          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.inst, mBuf);
1868          CMCHKUNPK(SUnpkS16, &cfg->t.cfg.s.sap.sapId, mBuf);
1869          CMCHKUNPK(oduPackUInt16, &cfg->t.cfg.s.sap.bndTmrIntvl, mBuf);
1870          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.priority,mBuf);
1871          CMCHKUNPK(oduPackUInt8, &cfg->t.cfg.s.sap.route,mBuf);
1872       }
1873       break;
1874       default:
1875         return RFAILED;
1876    } /* end of switch */     
1877
1878    return ROK;
1879 } /* end of cmUnpkRlcCfg */
1880
1881 /**
1882  * @brief
1883      Unpack Control Structure 
1884  *
1885  * @param[in] cfm   : RLC LM structure 
1886  * @param[in] elmnt : element 
1887  * @param[in] mBuf  : message buffer
1888  *  @return  S16
1889  *      -# Success : ROK
1890  *      -# Failure : RFAILED
1891  */
1892 static S16 cmUnpkRlcCntrl
1893 (
1894 RlcMngmt *cfm,
1895 Elmnt elmnt,
1896 Buffer *mBuf
1897 )
1898 {
1899    uint8_t subAction;
1900    RlcDbgCntrl *dbgCntrl;
1901    RlcTrcCntrl *trcCntrl;
1902
1903    
1904    /* lkw_c_001.main_2 removed warning */
1905    UNUSED(elmnt);
1906
1907    CMCHKUNPK(cmUnpkDateTime, &cfm->t.cntrl.dt, mBuf);
1908    CMCHKUNPK(oduPackUInt8, &cfm->t.cntrl.subAction, mBuf);
1909    CMCHKUNPK(oduPackUInt8, &cfm->t.cntrl.action, mBuf);
1910
1911    subAction = cfm->t.cntrl.subAction;
1912
1913    switch(cfm->hdr.elmId.elmnt)
1914    {
1915       case STGEN:
1916          {
1917             switch(subAction)
1918             {
1919                case SAUSTA:
1920                   break;
1921                case SADBG:
1922                   {
1923                      dbgCntrl = &cfm->t.cntrl.s.dbgCntrl;
1924                      CMCHKUNPK(oduPackUInt32, &dbgCntrl->dbgMask, mBuf);
1925                   }
1926                   break;
1927                case SATRC:
1928                   {
1929                     trcCntrl = &cfm->t.cntrl.s.trcCntrl; 
1930                     CMCHKUNPK(oduPackUInt8, &trcCntrl->trcMask, mBuf);
1931                     CMCHKUNPK(SUnpkS16,&trcCntrl->trcLen, mBuf);
1932                   }
1933                   break;
1934 #ifdef SS_DIAG
1935                case SALOG:
1936                   {
1937                       CMCHKUNPK(oduPackUInt32, &cfm->t.cntrl.s.logMask, mBuf);
1938                   }
1939                   break;
1940 #endif
1941                default:
1942                   break;
1943             }
1944             break;
1945          }
1946       case STRGUSAP:
1947       case STUDXSAP:
1948            CMCHKUNPK(SUnpkS16, &cfm->t.cntrl.s.sapCntrl.suId, mBuf);
1949            CMCHKUNPK(SUnpkS16, &cfm->t.cntrl.s.sapCntrl.spId, mBuf);
1950            break;
1951       default:
1952            break;
1953    }
1954
1955    return ROK;
1956
1957 } /* end of cmUnpkRlcCntrl */
1958
1959
1960 /**
1961  * @brief
1962      Unpack USta 
1963  *
1964  * @param[in] usta  : RLC LM Structure
1965  * @param[in] elmnt : element
1966  * @param[out] mBuf  : message buffer
1967  *  @return  S16
1968  *      -# Success : ROK
1969  *      -# Failure : RFAILED
1970  */
1971 static S16 cmUnpkRlcUsta
1972 (
1973 RlcMngmt *usta,
1974 Elmnt elmnt,
1975 Buffer *mBuf
1976 )
1977 {
1978
1979    /* lkw_c_001.main_2 removed warning */
1980    UNUSED(elmnt);
1981
1982    CMCHKUNPK(cmUnpkDateTime, &usta->t.usta.dt, mBuf);
1983    CMCHKUNPK(cmUnpkCmAlarm, &usta->t.usta.alarm,mBuf);
1984    CMCHKUNPK(SUnpkS16, &usta->t.usta.suId, mBuf);
1985    CMCHKUNPK(oduPackUInt32, &usta->t.usta.ueId, mBuf);
1986    /* lkw_c_001.main_2 added support for L2 Measurement */
1987 #ifdef LTE_L2_MEAS
1988    CMCHKUNPK(oduPackUInt8, &usta->t.usta.qci, mBuf);
1989 #endif
1990    return ROK;
1991 }
1992
1993 /**
1994  * @brief
1995      Unpack SSta 
1996  *
1997  * @param[out] ssta: RLC LM structure 
1998  * @param[in] elmnt  : element 
1999  * @param[in] mBuf  : message buffer
2000  *  @return  S16
2001  *      -# Success : ROK
2002  *      -# Failure : RFAILED
2003  */
2004 static S16 cmUnpkRlcSsta
2005 (
2006 RlcMngmt *ssta,
2007 Elmnt elmnt,
2008 Event eventType,
2009 Buffer *mBuf
2010 )
2011 {
2012    S16 ret1;           /* return value */
2013
2014    CMCHKUNPK(cmUnpkDateTime, &ssta->t.ssta.dt, mBuf);
2015    switch(elmnt)
2016    {
2017       case STSID:
2018          ret1 = ROK;
2019          if(eventType == LKW_EVT_STA_CFM)
2020          {
2021             memset( ptNmb, 0, LKW_PART_NUM_STR_LEN);
2022             ssta->t.ssta.s.sysId.ptNmb = ptNmb;
2023             CMCHKUNPK(cmUnpkSystemId, &ssta->t.ssta.s.sysId,mBuf);
2024          }
2025          break;
2026       case STCKWSAP:
2027          ret1 = cmUnpkCkwSapSta(&ssta->t.ssta.s.ckwSap, mBuf);
2028          break;
2029       case STKWUSAP:
2030          ret1 = cmUnpkKwuSapSta(&ssta->t.ssta.s.rlckwuSap, mBuf);
2031          break;
2032       case STRGUSAP:
2033       case STUDXSAP:
2034          ret1 = cmUnpkRguSapSta(&ssta->t.ssta.s.rguSap, mBuf);
2035          break;
2036       default:
2037          ret1 = RFAILED;
2038         break;
2039    }
2040
2041    if(ret1 != ROK)
2042    {
2043       return RFAILED;
2044    }
2045
2046    return ROK;
2047 }
2048
2049
2050 /**
2051  * @brief
2052      Unpack trace Indication 
2053  *
2054  * @param[out] trc   : RLC LM Structure 
2055  * @param[in] mBuf  : message buffer
2056  *  @return  S16
2057  *      -# Success : ROK
2058  *      -# Failure : RFAILED
2059  */
2060 static S16 cmUnpkRlcTrc
2061 (
2062 RlcMngmt *trc,
2063 Buffer *mBuf
2064 )
2065 {
2066
2067    CMCHKUNPK(cmUnpkDateTime, &trc->t.trc.dt, mBuf);
2068    CMCHKUNPK(oduPackUInt16, &trc->t.trc.event, mBuf);
2069
2070    return ROK;
2071 } /* end of cmUnpkRlcTrc */
2072
2073
2074 /**
2075  * @brief
2076      Unpack Statistics 
2077  *
2078  * @param[out] sts  : RLC LM structure 
2079  * @param[in] elmnt : element 
2080  * @param[in] mBuf  : message buffer
2081  *  @return  S16
2082  *      -# Success : ROK
2083  *      -# Failure : RFAILED
2084  */
2085 static S16 cmUnpkRlcSts
2086 (
2087 RlcMngmt *sts,
2088 Elmnt elmnt,
2089 Buffer *mBuf
2090 )
2091 {
2092    S16 ret1;           /* return value */
2093
2094    CMCHKUNPK(cmUnpkDateTime, &sts->t.sts.dt, mBuf);
2095
2096    switch(elmnt)
2097    {
2098       case STGEN:
2099          ret1 = cmUnpkGenSts(&sts->t.sts.s.gen, mBuf);
2100          break;
2101       case STCKWSAP:
2102          ret1 = cmUnpkCkwSapSts(&sts->t.sts.s.ckwSap, mBuf);
2103          break;
2104       case STKWUSAP:
2105          ret1 = cmUnpkKwuSapSts(&sts->t.sts.s.rlckwuSap, mBuf);
2106          break;
2107 /* lkw_c_001.main_2 removed support of RGU sap statistics as it is reflecting
2108  * in general statstics.
2109  * */
2110       default:
2111          ret1 = RFAILED;
2112         break;
2113    } /* end of switch */
2114
2115    if(ret1 != ROK)
2116    {
2117       return RFAILED;
2118    }
2119
2120    return ROK;
2121 } /* end of cmUnpkRlcSts */
2122
2123
2124 /**
2125  * @brief
2126      Unpack General statistics 
2127  *
2128  * @param[out] gen  : RlcGenSts structure 
2129  * @param[in] mBuf  : message buffer
2130  *  @return  S16
2131  *      -# Success : ROK
2132  *      -# Failure : RFAILED
2133  */
2134 static S16 cmUnpkGenSts
2135 (
2136 RlcGenSts *gen,
2137 Buffer *mBuf
2138 )
2139 {
2140
2141    CMCHKUNPK(oduPackUInt32, &gen->numUe, mBuf);
2142    CMCHKUNPK(oduPackUInt32, &gen->pdusRecv, mBuf);
2143    CMCHKUNPK(oduPackUInt32, &gen->pdusSent, mBuf);
2144    CMCHKUNPK(oduPackUInt32, &gen->pdusRetx, mBuf);
2145    CMCHKUNPK(oduPackUInt32, &gen->bytesRecv, mBuf);
2146    CMCHKUNPK(oduPackUInt32, &gen->bytesSent, mBuf);
2147    CMCHKUNPK(oduPackUInt32, &gen->unexpPdusRecv, mBuf);
2148    CMCHKUNPK(oduPackUInt32, &gen->errorPdusRecv, mBuf);
2149    CMCHKUNPK(oduPackUInt32, &gen->protTimeOut, mBuf);
2150    CMCHKUNPK(oduPackUInt32, &gen->numOfRb, mBuf);
2151    CMCHKUNPK(oduPackUInt32, &gen->numSduDisc, mBuf);
2152
2153    return ROK;
2154 } /* end of cmUnpkGenSts */
2155
2156 /**
2157  * @brief
2158      Unpack Ckw Sap Statistics 
2159  *
2160  * @param[out] rcSap  : RlcCkwCntSts structure
2161  * @param[in] mBuf  : message buffer
2162  *  @return  S16
2163  *      -# Success : ROK
2164  *      -# Failure : RFAILED
2165  */
2166 static S16 cmUnpkCkwSapSts
2167 (
2168 RlcCkwCntSts *rcSap,
2169 Buffer *mBuf
2170 )
2171 {
2172
2173
2174    CMCHKUNPK(oduPackUInt32, &rcSap->statMsgs, mBuf); 
2175
2176    return ROK;
2177
2178 } /* end of cmUnpkCkwSapSts */
2179
2180 /**
2181  * @brief
2182      Unpack Kwu Sap statistics
2183  *
2184  * @param[out]       : RlcKwuSapSts structure
2185  * @param[in] mBuf  : message buffer
2186  *  @return  S16
2187  *      -# Success : ROK
2188  *      -# Failure : RFAILED
2189  */
2190 static S16 cmUnpkKwuSapSts
2191 (
2192 RlcKwuSapSts *ruSap,
2193 Buffer *mBuf
2194 )
2195 {
2196
2197    /* lkw_c_001.main_2 changed from suId to spId */
2198    CMCHKUNPK(cmUnpkSuId, &ruSap->spId, mBuf);
2199    CMCHKUNPK(oduPackUInt32, &ruSap->sduRx, mBuf);
2200    CMCHKUNPK(oduPackUInt32, &ruSap->sduTx, mBuf);
2201
2202    return ROK;
2203
2204 } /* end of cmUnpkKwuSapSts */
2205
2206 /* lkw_c_001.main_2 added support for L2 Measurement */
2207 #ifdef LTE_L2_MEAS
2208 S16 cmPkLkwL2MeasReq
2209 (
2210 Pst * pst,
2211 RlcL2MeasReqEvt *measReqEvt
2212 )
2213 {
2214    Buffer *mBuf = NULLP;
2215
2216    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2217 #if (ERRCLASS & ERRCLS_ADD_RES)
2218       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2219             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2220             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2221 #endif
2222       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measReqEvt, sizeof(RlcL2MeasReqEvt));
2223       return RFAILED;
2224    }       
2225    if (cmPkRlcL2MeasReqInfo(&measReqEvt->measReq, mBuf) != ROK) {
2226 #if (ERRCLASS & ERRCLS_ADD_RES)
2227       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2228             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2229             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2230 #endif
2231       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measReqEvt, sizeof(RlcL2MeasReqEvt));
2232       SPutMsg(mBuf);
2233       return RFAILED;
2234    }
2235    if (oduUnpackUInt16(measReqEvt->measPeriod, mBuf) != ROK) {
2236 #if (ERRCLASS & ERRCLS_ADD_RES)
2237       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2238             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2239             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2240 #endif
2241       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measReqEvt, sizeof(RlcL2MeasReqEvt));
2242       SPutMsg(mBuf);
2243       return RFAILED;
2244    }
2245    if (oduUnpackUInt32(measReqEvt->transId, mBuf) != ROK) {
2246 #if (ERRCLASS & ERRCLS_ADD_RES)
2247       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2248             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2249             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2250 #endif
2251       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measReqEvt, sizeof(RlcL2MeasReqEvt));
2252       SPutMsg(mBuf);
2253       return RFAILED;
2254    }
2255
2256    pst->event = (Event) LKW_EVT_L2MEAS_REQ;
2257    return (SPstTsk(pst,mBuf));
2258 }
2259
2260 S16 cmPkRlcL2MeasReqInfo
2261 (
2262 RlcL2MeasReqInfo *param,
2263 Buffer *mBuf
2264 )
2265 {
2266    uint8_t idx;
2267    uint16_t idx1;
2268
2269
2270    if((param->measType & LKW_L2MEAS_DL_IP) ||
2271          (param->measType & LKW_L2MEAS_UL_IP))
2272    {
2273       for(idx1 = 0;idx1 < param->val.ipThMeas.numUes;idx1++)
2274       {
2275
2276          CMCHKPK(cmPkLteCellId, param->val.ipThMeas.ueInfoLst[idx1].cellId, mBuf);
2277          CMCHKPK(cmPkLteRnti,   param->val.ipThMeas.ueInfoLst[idx1].ueId, mBuf);
2278          for(idx = 0; idx < param->val.ipThMeas.ueInfoLst[idx1].numQci; idx++)
2279          {
2280             CMCHKPK(oduUnpackUInt8, param->val.ipThMeas.ueInfoLst[idx1].qci[idx], mBuf);
2281          }
2282          CMCHKPK(oduUnpackUInt8, param->val.ipThMeas.ueInfoLst[idx1].numQci, mBuf);
2283       }
2284       CMCHKPK(oduUnpackUInt16, param->val.ipThMeas.numUes, mBuf);
2285       CMCHKPK(oduUnpackUInt8, param->measType, mBuf);
2286       return ROK;
2287    }
2288    else
2289    {
2290       for(idx = 0; idx < param->val.nonIpThMeas.numQci; idx++)
2291       {
2292          CMCHKPK(oduUnpackUInt8, param->val.nonIpThMeas.qci[idx], mBuf);
2293       }
2294       CMCHKPK(oduUnpackUInt8, param->val.nonIpThMeas.numQci, mBuf);
2295       CMCHKPK(oduUnpackUInt16, param->val.nonIpThMeas.numSamples, mBuf);
2296    }
2297    CMCHKPK(oduUnpackUInt8, param->measType, mBuf);
2298    return ROK;
2299 }
2300
2301 S16 cmPkLkwL2MeasStopReq
2302 (
2303 Pst *pst,
2304 uint8_t  measType
2305 )
2306 {
2307    Buffer *mBuf = NULLP;
2308
2309    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2310 #if (ERRCLASS & ERRCLS_ADD_RES)
2311       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2312             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2313             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2314 #endif
2315       return RFAILED;
2316    }
2317    CMCHKPK(oduUnpackUInt8, measType, mBuf);
2318    pst->event = (Event) LKW_EVT_L2MEAS_STOP_REQ;
2319    return (SPstTsk(pst,mBuf));
2320 }
2321
2322 S16 cmPkLkwL2MeasSendReq
2323 (
2324 Pst *pst,
2325 uint8_t  measType
2326 )
2327 {
2328    Buffer *mBuf = NULLP;
2329
2330    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2331 #if (ERRCLASS & ERRCLS_ADD_RES)
2332       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2333             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2334             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2335 #endif
2336       return RFAILED;
2337    }
2338    CMCHKPK(oduUnpackUInt8, measType, mBuf);
2339    pst->event = (Event) LKW_EVT_L2MEAS_SEND_REQ;
2340    return (SPstTsk(pst,mBuf));
2341 }
2342 #ifdef TENB_SPLIT_ARCH
2343 S16 cmUnpkLkwL2MeasReq
2344 (
2345 LkwL2MeasReq func,
2346 Pst *pst,
2347 Buffer *mBuf
2348 )
2349 {
2350    RlcL2MeasReqEvt measReqEvt;
2351    
2352
2353    if (oduPackUInt32(&measReqEvt.transId, mBuf) != ROK) {
2354       SPutMsg(mBuf);
2355 #if (ERRCLASS & ERRCLS_ADD_RES)
2356       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2357          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2358          (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2359 #endif
2360       return RFAILED;
2361    }
2362    if (oduPackUInt16(&measReqEvt.measPeriod, mBuf) != ROK) {
2363       SPutMsg(mBuf);
2364 #if (ERRCLASS & ERRCLS_ADD_RES)
2365       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2366          __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2367          (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2368 #endif
2369       return RFAILED;
2370    }
2371    if (cmUnpkRlcL2MeasReqInfo(&measReqEvt.measReq, mBuf) != ROK) 
2372    {
2373       /*SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measReqEvt, sizeof(RlcL2MeasReqEvt));*/
2374       SPutMsg(mBuf);
2375 #if (ERRCLASS & ERRCLS_ADD_RES)
2376       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2377            __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2378            (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2379 #endif
2380       return RFAILED;
2381    }
2382    SPutMsg(mBuf);
2383    return ((*func)(pst, &measReqEvt));
2384 }
2385 #else
2386 S16 cmUnpkLkwL2MeasReq
2387 (
2388 LkwL2MeasReq func,
2389 Pst *pst,
2390 Buffer *mBuf
2391 )
2392 {
2393    S16   ret;
2394    RlcL2MeasReqEvt *measReqEvt;
2395
2396
2397
2398    if((ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data **)&measReqEvt,\
2399                sizeof(RlcL2MeasReqEvt))) != ROK)
2400    {
2401 #if (ERRCLASS & ERRCLS_ADD_RES)
2402       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2403             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2404             (ErrVal)ERRLKW, (ErrVal)0, "SGetMsg() failed");
2405 #endif /*  ERRCLASS & ERRCLS_ADD_RES  */
2406       return (ret);
2407    }
2408
2409    if (oduPackUInt32(&measReqEvt->transId, mBuf) != ROK) {
2410       SPutMsg(mBuf);
2411 #if (ERRCLASS & ERRCLS_ADD_RES)
2412       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2413             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2414             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2415 #endif
2416       return RFAILED;
2417    }
2418    if (oduPackUInt16(&measReqEvt->measPeriod, mBuf) != ROK) {
2419       SPutMsg(mBuf);
2420 #if (ERRCLASS & ERRCLS_ADD_RES)
2421       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2422             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2423             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2424 #endif
2425       return RFAILED;
2426    }
2427    if (cmUnpkRlcL2MeasReqInfo(&measReqEvt->measReq, mBuf) != ROK) 
2428    {
2429       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measReqEvt, sizeof(RlcL2MeasReqEvt));
2430       SPutMsg(mBuf);
2431 #if (ERRCLASS & ERRCLS_ADD_RES)
2432       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2433             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2434             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2435 #endif
2436       return RFAILED;
2437    }
2438    SPutMsg(mBuf);
2439    return ((*func)(pst, measReqEvt));
2440 }
2441 #endif
2442
2443 S16 cmUnpkRlcL2MeasReqInfo
2444 (
2445 RlcL2MeasReqInfo *param,
2446 Buffer *mBuf
2447 )
2448 {
2449    uint8_t idx;
2450    uint16_t idx1; 
2451
2452
2453    CMCHKUNPK(oduPackUInt8, &param->measType, mBuf);
2454
2455    if((param->measType & LKW_L2MEAS_DL_IP) ||
2456          (param->measType & LKW_L2MEAS_UL_IP))
2457    {
2458       CMCHKUNPK(oduPackUInt16, &param->val.ipThMeas.numUes, mBuf);
2459       for(idx1 = 0;idx1 < param->val.ipThMeas.numUes;idx1++)
2460       {
2461          CMCHKUNPK(oduPackUInt8, &param->val.ipThMeas.ueInfoLst[idx1].numQci, mBuf);
2462          for(idx = param->val.ipThMeas.ueInfoLst[idx1].numQci; idx > 0; idx--)
2463          {
2464             CMCHKUNPK(oduPackUInt8, &param->val.ipThMeas.ueInfoLst[idx1].\
2465                   qci[idx - 1], mBuf);
2466          }
2467          CMCHKUNPK(cmUnpkLteRnti, &param->val.ipThMeas.ueInfoLst[idx1].\
2468                ueId, mBuf);
2469          CMCHKUNPK(cmUnpkLteCellId, &param->val.ipThMeas.\
2470                ueInfoLst[idx1].cellId, mBuf);
2471       }
2472       return ROK;
2473    }
2474    else
2475    {
2476       CMCHKUNPK(oduPackUInt16, &param->val.nonIpThMeas.numSamples, mBuf);
2477       CMCHKUNPK(oduPackUInt8, &param->val.nonIpThMeas.numQci, mBuf);
2478       for(idx = param->val.nonIpThMeas.numQci; idx > 0; idx--)
2479       {
2480          CMCHKUNPK(oduPackUInt8, &param->val.nonIpThMeas.qci[idx - 1], mBuf);
2481       }
2482    }
2483    return ROK;
2484 }
2485
2486 S16 cmUnpkLkwL2MeasStopReq
2487 (
2488 LkwL2MeasStopReq func,
2489 Pst *pst,
2490 Buffer *mBuf
2491 )
2492 {
2493    uint8_t measType;
2494
2495    CMCHKUNPK(oduPackUInt8, &measType, mBuf);
2496    SPutMsg(mBuf);
2497    return ((*func)(pst, measType));
2498 }
2499
2500 S16 cmUnpkLkwL2MeasSendReq
2501 (
2502 LkwL2MeasSendReq func,
2503 Pst *pst,
2504 Buffer *mBuf
2505 )
2506 {
2507    uint8_t    measType;
2508
2509
2510    CMCHKUNPK(oduPackUInt8, &measType, mBuf); 
2511    SPutMsg(mBuf);
2512    return ((*func)(pst, measType));
2513 }
2514
2515 S16 cmPkLkwL2MeasCfm
2516 (
2517 Pst * pst,
2518 RlcL2MeasCfmEvt *measCfmEvt
2519 )
2520 {
2521    Buffer *mBuf = NULLP;
2522    uint8_t idx;
2523    uint8_t idx1;
2524
2525
2526    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2527 #if (ERRCLASS & ERRCLS_ADD_RES)
2528       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2529             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2530             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2531 #endif
2532       SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,pst->region, pst->pool, (Data *)measCfmEvt, sizeof(RlcL2MeasCfmEvt));
2533       return RFAILED;
2534    }
2535
2536    if((measCfmEvt->measType & LKW_L2MEAS_ACT_UE) || \
2537          (measCfmEvt->measType & LKW_L2MEAS_UU_LOSS) || \
2538          (measCfmEvt->measType & LKW_L2MEAS_DL_DISC) ||  \
2539          (measCfmEvt->measType & LKW_L2MEAS_DL_DELAY)) 
2540    {
2541       for(idx = 0; idx < measCfmEvt->val.nonIpThMeas.numCfm; idx++)
2542       {
2543          if (cmPkRlcL2MeasCfmInfo(&measCfmEvt->val.nonIpThMeas.measCfm[idx], \
2544                   mBuf, measCfmEvt->measType) != ROK) {
2545 #if (ERRCLASS & ERRCLS_ADD_RES)
2546             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2547                   __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2548                   (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2549 #endif
2550             SPutMsg(mBuf);
2551             return RFAILED;
2552          }
2553       }
2554
2555       if (oduUnpackUInt16(measCfmEvt->val.nonIpThMeas.numCfm, mBuf) != ROK) {
2556 #if (ERRCLASS & ERRCLS_ADD_RES)
2557          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2558                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2559                (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2560 #endif
2561          SPutMsg(mBuf);
2562          return RFAILED;
2563       }
2564    }
2565    else
2566    {
2567       for(idx1 =0 ;idx1< measCfmEvt->val.ipThMeas.numUes;idx1++)
2568       {
2569
2570          for(idx = 0; idx < measCfmEvt->val.ipThMeas.ueInfoLst[idx1].numCfm; idx++)
2571          {
2572             if (cmPkRlcL2MeasCfmInfo(&measCfmEvt->val.ipThMeas.ueInfoLst[idx1].\
2573                      measCfm[idx], mBuf, measCfmEvt->measType) != ROK) {
2574 #if (ERRCLASS & ERRCLS_ADD_RES)
2575                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2576                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2577                      (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2578 #endif
2579                SPutMsg(mBuf);
2580                return RFAILED;
2581             }
2582          }
2583
2584          if (oduUnpackUInt16(measCfmEvt->val.ipThMeas.ueInfoLst[idx1].numCfm, mBuf) != ROK) {
2585 #if (ERRCLASS & ERRCLS_ADD_RES)
2586             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2587                   __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2588                   (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2589 #endif
2590             SPutMsg(mBuf);
2591             return RFAILED;
2592          }
2593
2594          CMCHKPK(cmPkLteCellId, measCfmEvt->val.ipThMeas.ueInfoLst[idx1].cellId, mBuf);
2595          CMCHKPK(cmPkLteRnti,   measCfmEvt->val.ipThMeas.ueInfoLst[idx1].ueId, mBuf);
2596       }
2597       oduUnpackUInt16(measCfmEvt->val.ipThMeas.numUes, mBuf);
2598    }
2599
2600    CMCHKPK(oduUnpackUInt8, measCfmEvt->measType, mBuf);
2601    CMCHKPK(cmPkCmStatus, &measCfmEvt->status, mBuf);
2602    if (oduUnpackUInt32(measCfmEvt->transId, mBuf) != ROK) {
2603 #if (ERRCLASS & ERRCLS_ADD_RES)
2604       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2605             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2606             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2607 #endif
2608       SPutMsg(mBuf);
2609       return RFAILED;
2610    }
2611    pst->event = (Event) LKW_EVT_L2MEAS_CFM;
2612    return (SPstTsk(pst,mBuf));
2613 }
2614
2615 S16 cmPkRlcL2MeasCfmInfo
2616 (
2617 RlcL2MeasCfmInfo *param,
2618 Buffer *mBuf,
2619 uint8_t measType
2620 )
2621 {
2622
2623    if((measType & LKW_L2MEAS_DL_IP) ||
2624          (measType & LKW_L2MEAS_UL_IP))
2625    {
2626       CMCHKPK(SPkF32, param->val.ipThrput.ulIpThPut, mBuf);
2627       CMCHKPK(SPkF32, param->val.ipThrput.dlIpThPut, mBuf);
2628       CMCHKPK(oduUnpackUInt8, param->qci, mBuf);
2629       return ROK;
2630    }
2631    else  
2632    {
2633       CMCHKPK(oduUnpackUInt32, param->val.nonIpThrput.dlDiscRate, mBuf);
2634       CMCHKPK(oduUnpackUInt32, param->val.nonIpThrput.uuLoss, mBuf);
2635       CMCHKPK(oduUnpackUInt32, param->val.nonIpThrput.numActUe, mBuf);
2636       CMCHKPK(oduUnpackUInt32, param->val.nonIpThrput.dlSduDelay, mBuf);
2637       CMCHKPK(oduUnpackUInt8,  param->qci, mBuf);
2638    } 
2639    return ROK;
2640 }
2641
2642 S16 cmUnpkLkwL2MeasCfm
2643 (
2644 LkwL2MeasCfm func,
2645 Pst *pst,
2646 Buffer *mBuf
2647 )
2648 {
2649    uint8_t idx;
2650    uint16_t idx1;
2651    RlcL2MeasCfmEvt measCfmEvt;
2652
2653    memset(&measCfmEvt, 0 , sizeof(RlcL2MeasCfmEvt));
2654    if (oduPackUInt32(&measCfmEvt.transId, mBuf) != ROK) {
2655       SPutMsg(mBuf);
2656 #if (ERRCLASS & ERRCLS_ADD_RES)
2657       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2658             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2659             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2660 #endif
2661       return RFAILED;
2662    }
2663    CMCHKUNPK(cmUnpkCmStatus, &measCfmEvt.status, mBuf);
2664    CMCHKUNPK(oduPackUInt8, &measCfmEvt.measType, mBuf);  
2665
2666    if(measCfmEvt.measType & LKW_L2MEAS_DL_IP || measCfmEvt.measType & LKW_L2MEAS_UL_IP)
2667    { 
2668       CMCHKUNPK(oduPackUInt16, &measCfmEvt.val.ipThMeas.numUes, mBuf);
2669       for(idx1 = 0;idx1<measCfmEvt.val.ipThMeas.numUes;idx1++)
2670       {
2671          CMCHKUNPK(cmUnpkLteRnti, &measCfmEvt.val.ipThMeas.\
2672                ueInfoLst[idx1].ueId, mBuf);
2673          CMCHKUNPK(cmUnpkLteCellId, &measCfmEvt.val.ipThMeas.\
2674                ueInfoLst[idx1].cellId, mBuf);
2675          if (oduPackUInt16(&measCfmEvt.val.ipThMeas.ueInfoLst[idx1].\
2676                   numCfm, mBuf) != ROK) {
2677             SPutMsg(mBuf);
2678 #if (ERRCLASS & ERRCLS_ADD_RES)
2679             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2680                   __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2681                   (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2682 #endif
2683             return RFAILED;
2684          }
2685          for(idx = measCfmEvt.val.ipThMeas.ueInfoLst[idx1].numCfm; idx > 0; idx--)
2686          {
2687             if (cmUnpkRlcL2MeasCfmInfo(&measCfmEvt.val.ipThMeas.ueInfoLst[idx1].\
2688                      measCfm[idx - 1], mBuf, measCfmEvt.measType) != ROK) {
2689                SPutMsg(mBuf);
2690 #if (ERRCLASS & ERRCLS_ADD_RES)
2691                SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2692                      __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2693                      (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2694 #endif
2695                return RFAILED;
2696             }
2697          }
2698       }
2699    }
2700    else
2701    {
2702       if (oduPackUInt16(&measCfmEvt.val.nonIpThMeas.numCfm, mBuf) != ROK) {
2703          SPutMsg(mBuf);
2704 #if (ERRCLASS & ERRCLS_ADD_RES)
2705          SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2706                __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2707                (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2708 #endif
2709          return RFAILED;
2710       }
2711       for(idx = measCfmEvt.val.nonIpThMeas.numCfm; idx > 0; idx--)
2712       {
2713          if (cmUnpkRlcL2MeasCfmInfo(&measCfmEvt.val.nonIpThMeas.measCfm[idx - 1], \
2714                   mBuf, measCfmEvt.measType) != ROK) {
2715             SPutMsg(mBuf);
2716 #if (ERRCLASS & ERRCLS_ADD_RES)
2717             SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2718                   __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2719                   (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2720 #endif
2721             return RFAILED;
2722          }
2723       }
2724    }
2725    SPutMsg(mBuf);
2726    return ((*func)(pst, &measCfmEvt));
2727 }
2728
2729 S16 cmUnpkRlcL2MeasCfmInfo
2730 (
2731 RlcL2MeasCfmInfo *param,
2732 Buffer *mBuf,
2733 uint8_t measType
2734 )
2735 {
2736
2737    if((measType & LKW_L2MEAS_DL_IP) ||
2738          (measType & LKW_L2MEAS_UL_IP))
2739    {
2740       CMCHKUNPK(oduPackUInt8,  &param->qci, mBuf);
2741       CMCHKUNPK(SUnpkF32, &param->val.ipThrput.dlIpThPut, mBuf);
2742       CMCHKUNPK(SUnpkF32, &param->val.ipThrput.ulIpThPut, mBuf);
2743    }
2744    else
2745
2746    {
2747       CMCHKUNPK(oduPackUInt8,  &param->qci, mBuf);
2748       CMCHKUNPK(oduPackUInt32, &param->val.nonIpThrput.dlSduDelay, mBuf);
2749       CMCHKUNPK(oduPackUInt32, &param->val.nonIpThrput.numActUe, mBuf);
2750       CMCHKUNPK(oduPackUInt32, &param->val.nonIpThrput.uuLoss, mBuf);
2751       CMCHKUNPK(oduPackUInt32, &param->val.nonIpThrput.dlDiscRate, mBuf);
2752    }
2753    return ROK;
2754 }
2755
2756
2757 S16 cmPkLkwL2MeasStopCfm
2758 (
2759 Pst * pst,
2760 uint8_t measType,
2761 uint8_t status
2762 )
2763 {
2764    Buffer *mBuf = NULLP;
2765
2766    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) {
2767 #if (ERRCLASS & ERRCLS_ADD_RES)
2768       SLogError(pst->srcEnt, pst->srcInst, pst->srcProcId,
2769             __FILE__, __LINE__, (ErrCls)ERRCLS_ADD_RES,
2770             (ErrVal)ERRLKW, (ErrVal)0, "Packing failed");
2771 #endif
2772       return RFAILED;
2773    }
2774    CMCHKPK(oduUnpackUInt8, status, mBuf);
2775    CMCHKPK(oduUnpackUInt8, measType, mBuf);
2776    pst->event = (Event) LKW_EVT_L2MEAS_STOP_CFM;
2777    return (SPstTsk(pst,mBuf));
2778 }
2779
2780
2781 S16 cmUnpkLkwL2MeasStopCfm
2782 (
2783 LkwL2MeasStopCfm func,
2784 Pst *pst,
2785 Buffer *mBuf
2786 )
2787 {
2788    uint8_t measType;
2789    uint8_t status;
2790    CMCHKUNPK(oduPackUInt8,  &measType, mBuf);
2791    CMCHKUNPK(oduPackUInt8,  &status, mBuf);
2792    SPutMsg(mBuf);
2793    return ((*func)(pst, measType,status));
2794 }
2795 #endif /* LTE_L2_MEAS */
2796 #endif /* LCLKW */
2797
2798 \f  
2799 /**********************************************************************
2800          End of file
2801  **********************************************************************/