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