dcfb9b950b4060324dbf87401e158b52cbec13a5
[o-du/l2.git] / src / cm / du_app_rlc_inf.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 #include "common_def.h"
20 #include "du_app_rlc_inf.h"
21
22 /*******************************************************************
23 *
24 * @brief Packs and Sends Max Retransmission Reached Info from RLC to DUAPP
25 *
26 * @details
27 *
28 *    Function : packRlcDuMaxRetransInd
29 *
30 *    Functionality:
31 *       Packs and Sends Max Retransmission Reached Info from RLC to DUAPP
32 *
33 *
34 * @params[in] Post structure pointer
35 *             RlcMaxRetransInfo *maxRetransInfo
36 *
37 * @return ROK     - success
38 *         RFAILED - failure
39 *
40 * ****************************************************************/
41
42 uint8_t packRlcDuMaxRetransInd(Pst *pst, RlcMaxRetransInfo *maxRetransInfo)
43 {
44    Buffer *mBuf = NULLP;
45
46    if(pst->selector == ODU_SELECTOR_LWLC)
47    {
48       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
49       {
50          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuMaxRetransInd");
51          return RFAILED;
52       }
53       /* pack the address of the structure */
54       CMCHKPK(oduPackPointer,(PTR)maxRetransInfo, mBuf);
55    }
56    else
57    {
58       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuMaxRetransInd");
59       return RFAILED;
60    }
61
62    return ODU_POST_TASK(pst,mBuf);
63 }
64
65 /*******************************************************************
66 *
67 * @brief Unpacks Max Retransmission Reached Info received from DU APP
68 *
69 * @details
70 *
71 *    Function : unpackRlcMaxRetransInd
72 *
73 *    Functionality:
74 *         Unpacks Max Retransmission Reached Info received from DU APP
75 *
76 * @params[in] Pointer to Handler
77 *             Post structure pointer
78 *             Message Buffer
79 * @return ROK     - success
80 *         RFAILED - failure
81 *
82 * ****************************************************************/
83
84 uint8_t unpackRlcMaxRetransInd(RlcDuMaxRetransInd func, Pst *pst, Buffer *mBuf)
85 {
86     if(pst->selector == ODU_SELECTOR_LWLC)
87     {
88        RlcMaxRetransInfo *maxRetransInfo = NULLP;
89        /* unpack the address of the structure */
90        CMCHKUNPK(oduUnpackPointer, (PTR *)&maxRetransInfo, mBuf);
91        ODU_PUT_MSG_BUF(mBuf);
92        return (*func)(pst, maxRetransInfo);
93     }
94     else
95     {
96        /* Nothing to do for other selectors */
97        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for Max Retransmission Reached Info ");
98        ODU_PUT_MSG_BUF(mBuf);
99     }
100
101     return RFAILED;
102 }
103
104 /*******************************************************************
105  *
106  * @brief Packs and Sends UE create Request from DUAPP to RLC
107  *
108  * @details
109  *
110  *    Function : packDuRlcUeCreateReq
111  *
112  *    Functionality:
113  *       Packs and Sends UE Create Request from DUAPP to RLC
114  *
115  *
116  * @params[in] Post structure pointer
117  *             RlcUeCfg pointer              
118  * @return ROK     - success
119  *         RFAILED - failure
120  *
121  * ****************************************************************/
122 uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
123 {
124    Buffer *mBuf = NULLP;
125  
126    if(pst->selector == ODU_SELECTOR_LWLC)
127    {
128       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
129       {
130          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeCreateReq");
131          return RFAILED;
132       }
133       /* pack the address of the structure */
134       CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
135    }
136    else
137    {
138       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeCreateReq");
139       return RFAILED;
140    }
141
142     return ODU_POST_TASK(pst,mBuf);
143 }
144
145 /*******************************************************************
146  *
147  * @brief Unpacks UE Create Request received from DU APP
148  *
149  * @details
150  *
151  *    Function : unpackRlcUeCreateReq
152  *
153  *    Functionality:
154  *         Unpacks UE Create Request received from DU APP
155  *
156  * @params[in] Pointer to Handler
157  *             Post structure pointer
158  *             Message Buffer
159  * @return ROK     - success
160  *         RFAILED - failure
161  *
162  * ****************************************************************/
163 uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf)
164 {
165    if(pst->selector == ODU_SELECTOR_LWLC)
166    {
167       RlcUeCfg *ueCfg;
168       /* unpack the address of the structure */
169       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
170       ODU_PUT_MSG_BUF(mBuf);
171       return (*func)(pst, ueCfg);
172    }
173    else
174    {
175       /* Nothing to do for other selectors */
176       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Create Request ");
177       ODU_PUT_MSG_BUF(mBuf);
178    }
179
180    return RFAILED;
181 }
182
183 /*******************************************************************
184  *
185  * @brief Packs and Sends UE Cfg Response from RLC to DUAPP
186  *
187  * @details
188  *
189  *    Function : packRlcDuUeCfgRsp
190  *
191  *    Functionality:
192  *       Packs and Sends UE Cfg Rrsponse from RLC to DUAPP
193  *
194  *
195  * @params[in] Post structure pointer
196  *             RlcUeCfg pointer              
197  * @return ROK     - success
198  *         RFAILED - failure
199  *
200  * ****************************************************************/
201 uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
202 {
203    Buffer *mBuf = NULLP;
204  
205    if(pst->selector == ODU_SELECTOR_LWLC)
206    {
207       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
208       {
209          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuUeCfgRsp");
210          return RFAILED;
211       }
212       /* pack the address of the structure */
213       CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
214    }
215    else
216    {
217       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuUeCfgRsp");
218       return RFAILED;
219    }
220
221     return ODU_POST_TASK(pst,mBuf);
222 }
223
224 /*******************************************************************
225  *
226  * @brief Unpacks UE Cfg Response received from DU APP
227  *
228  * @details
229  *
230  *    Function : unpackRlcUeCfgRsp
231  *
232  *    Functionality:
233  *         Unpacks UE Cfg Response received from DU APP
234  *
235  * @params[in] Pointer to Handler
236  *             Post structure pointer
237  *             Message Buffer
238  * @return ROK     - success
239  *         RFAILED - failure
240  *
241  * ****************************************************************/
242 uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf)
243 {
244    if(pst->selector == ODU_SELECTOR_LWLC)
245    {
246       RlcUeCfgRsp *cfgRsp = NULLP;
247       /* unpack the address of the structure */
248       CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
249       ODU_PUT_MSG_BUF(mBuf);
250       return (*func)(pst, cfgRsp);
251    }
252    else
253    {
254       /* Nothing to do for other selectors */
255       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Cfg Response ");
256       ODU_PUT_MSG_BUF(mBuf);
257    }
258
259    return RFAILED;
260 }
261
262 /*******************************************************************
263  *
264  * @brief Pack and send UL RRC message transfer from RLC to DU APP
265  *
266  * @details
267  *
268  *    Function : packRlcUlRrcMsgToDu
269  *
270  *    Functionality:
271  *       Pack and send UL RRC message transfer from RLC to DU APP
272  *
273  * @params[in] Post structure
274  *             UL RRC Msg transfer info
275  * @return ROK     - success
276  *         RFAILED - failure
277  *
278  * ****************************************************************/
279 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
280 {
281    Buffer *mBuf = NULLP;
282
283    if(pst->selector == ODU_SELECTOR_LWLC)
284    {
285       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
286       {
287          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcUlRrcMsgToDu");
288          return RFAILED;
289       }
290       /* pack the address of the structure */
291       CMCHKPK(oduPackPointer,(PTR)ulRrcMsgInfo, mBuf);
292       return ODU_POST_TASK(pst,mBuf);
293    }
294    else
295    {
296       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcUlRrcMsgToDu");
297    }
298    return RFAILED;
299 }
300
301 /*******************************************************************
302  *
303  * @brief Unpack UL RRC Msg Transfer received at DU APP from RLC
304  *
305  * @details
306  *
307  *    Function : unpackRlcUlRrcMsgToDu
308  *
309  *    Functionality:
310  *      Unpack UL RRC Msg Transfer received at DU APP from RLC
311  *
312  * @params[in]
313  * @return ROK     - success
314  *         RFAILED - failure
315  *
316  * ****************************************************************/
317 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf)
318 {
319    if(pst->selector == ODU_SELECTOR_LWLC)
320    {
321       RlcUlRrcMsgInfo *ulRrcMsgInfo;
322       /* unpack the address of the structure */
323       CMCHKUNPK(oduUnpackPointer, (PTR *)&ulRrcMsgInfo, mBuf);
324       ODU_PUT_MSG_BUF(mBuf);
325       return (*func)(pst, ulRrcMsgInfo);
326    }
327    else
328    {
329       /* Nothing to do for other selectors */
330       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UL RRC Message transfer ");
331       ODU_PUT_MSG_BUF(mBuf);
332    }
333
334    return RFAILED;
335 }
336
337 /*******************************************************************
338  *
339  * @brief Pack and post DL RRC Message from DU APP to RLC 
340  *
341  * @details
342  *
343  *    Function : packDlRrcMsgToRlc
344  *
345  *    Functionality: Pack and post DL RRC Message from DU APP to RLC
346  *
347  * @params[in] Post structure
348  *             DL RRC Message info
349  * @return ROK     - success
350  *         RFAILED - failure
351  *
352  * ****************************************************************/
353 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
354 {
355    Buffer *mBuf = NULLP;
356
357    if(pst->selector == ODU_SELECTOR_LWLC)
358    {
359       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
360       {
361          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDlRrcMsgToRlc");
362          return RFAILED;
363       }
364       /* pack the address of the structure */
365       CMCHKPK(oduPackPointer,(PTR)dlRrcMsgInfo, mBuf);
366       return ODU_POST_TASK(pst,mBuf);
367    }
368    else
369    {
370       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDlRrcMsgToRlc");
371    }
372    return RFAILED;
373 }
374
375 /*******************************************************************
376  *
377  * @brief Unpacks DL RRC Message info received at RLC from DU APP
378  *
379  * @details
380  *
381  *    Function : unpackDlRrcMsgToRlc
382  *
383  *    Functionality:
384  *      Unpacks the DL RRC Message info received at RLC from DU APP
385  *
386  * @params[in] Pointer to handler function
387  *             Post structure
388  *             Messae buffer to be unpacked
389  * @return ROK     - success
390  *         RFAILED - failure
391  *
392  * ****************************************************************/
393 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf)
394 {
395    if(pst->selector == ODU_SELECTOR_LWLC)
396    {
397       RlcDlRrcMsgInfo *dlRrcMsgInfo;
398       /* unpack the address of the structure */
399       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgInfo, mBuf);
400       ODU_PUT_MSG_BUF(mBuf);
401       return (*func)(pst, dlRrcMsgInfo);
402    }
403    else
404    {
405       /* Nothing to do for other selectors */
406       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UL RRC Message transfer ");
407       ODU_PUT_MSG_BUF(mBuf);
408    }
409    return RFAILED;
410 }
411
412 /*******************************************************************
413 *
414 * @brief packs RRC delivery report sending from  RLC to DU APP
415 *
416 * @details
417 *
418 *    Function : packRrcDeliveryReportToDu
419 *
420 *    Functionality:
421 *      Unpacks the DL RRC Message info received at RLC from DU APP
422 *
423 * @params[in] Pointer to handler function
424 *             Post structure
425 *             Messae buffer to be unpacked
426 * @return ROK     - success
427 *         RFAILED - failure
428 *
429 * ****************************************************************/
430 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport)
431 {
432     Buffer *mBuf = NULLP;
433
434     if(pst->selector == ODU_SELECTOR_LWLC)
435     {
436        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
437        {
438           DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRrcDeliveryReportToDu");
439           return RFAILED;
440        }
441        /* pack the address of the structure */
442        CMCHKPK(oduPackPointer,(PTR)rrcDeliveryReport, mBuf);
443        return ODU_POST_TASK(pst,mBuf);
444     }
445     else
446     {
447        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRrcDeliveryReportToDu");
448     }
449     return RFAILED;
450  }
451
452 /*******************************************************************
453 *
454 * @brief Unpacks RRC Delivery Report info received at DU APP from RIC
455 *
456 * @details
457 *
458 *    Function : unpackRrcDeliveryReportToDu
459 *
460 *    Functionality:
461 *      Unpacks RRC Delivery Report info received at DU APP from RIC
462 *
463 * @params[in] Pointer to handler function
464 *             Post structure
465 *             Messae buffer to be unpacked
466 * @return ROK     - success
467 *         RFAILED - failure
468 *
469 * ****************************************************************/
470 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func, Pst *pst, Buffer *mBuf)
471 {
472     if(pst->selector == ODU_SELECTOR_LWLC)
473     {
474        RrcDeliveryReport *rrcDeliveryReport;
475        /* unpack the address of the structure */
476        CMCHKUNPK(oduUnpackPointer, (PTR *)&rrcDeliveryReport, mBuf);
477        ODU_PUT_MSG_BUF(mBuf);
478        return (*func)(pst, rrcDeliveryReport);
479     }
480     else
481     {
482        /* Nothing to do for other selectors */
483        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for RRC delivery Message transfer ");
484        ODU_PUT_MSG_BUF(mBuf);
485     }
486
487     return RFAILED;
488 }
489
490 /*******************************************************************
491  *
492  * @brief Packs and Sends UE Reconfig Request from DUAPP to RLC
493  *
494  * @details
495  *
496  *    Function : packDuRlcUeReconfigReq
497  *
498  *    Functionality:
499  *       Packs and Sends UE Reconfig Request from DUAPP to RLC
500  *
501  *
502  * @params[in] Post structure pointer
503  *             RlcUeCfg pointer              
504  * @return ROK     - success
505  *         RFAILED - failure
506  *
507  * ****************************************************************/
508 uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeRecfg *ueRecfg)
509 {
510    Buffer *mBuf = NULLP;
511  
512    if(pst->selector == ODU_SELECTOR_LWLC)
513    {
514       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
515       {
516          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeReconfigReq");
517          return RFAILED;
518       }
519       /* pack the address of the structure */
520       CMCHKPK(oduPackPointer,(PTR)ueRecfg, mBuf);
521    }
522    else
523    {
524       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeReconfigReq");
525       return RFAILED;
526    }
527
528     return ODU_POST_TASK(pst,mBuf);
529 }
530
531 /*******************************************************************
532  * @brief Unpacks UE Reconfig Request received from DU APP
533  *
534  * @details
535  *
536  *    Function : unpackRlcUeReconfigReq
537  *
538  *    Functionality:
539  *         Unpacks UE Create Request received from DU APP
540  *
541  * @params[in] Pointer to Handler
542  *             Post structure pointer
543  *             Message Buffer
544  * @return ROK     - success
545  *         RFAILED - failure
546  *
547  * ****************************************************************/
548 uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf)
549 {
550    if(pst->selector == ODU_SELECTOR_LWLC)
551    {
552       RlcUeRecfg *ueRecfg;
553       /* unpack the address of the structure */
554       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueRecfg, mBuf);
555       ODU_PUT_MSG_BUF(mBuf);
556       return (*func)(pst, ueRecfg);
557    }
558    else
559    {
560       /* Nothing to do for other selectors */
561       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Create Request ");
562       ODU_PUT_MSG_BUF(mBuf);
563    }
564    return RFAILED;
565 }
566
567 /*******************************************************************
568  *
569  * @brief Pack and send DL RRC message Response from RLC to DU APP
570  *
571  * @details
572  *
573  *    Function : packRlcDlRrcMsgRspToDu
574  *
575  *    Functionality:
576  *       Pack and send DL RRC message Response from RLC to DU APP
577  *
578  * @params[in] Post structure
579  *             DL RRC Msg Response 
580  * @return ROK     - success
581  *         RFAILED - failure
582  *
583  * ****************************************************************/
584 uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp)
585 {
586    Buffer *mBuf = NULLP;
587
588    if(pst->selector == ODU_SELECTOR_LWLC)
589    {
590       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
591       {
592          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDlRrcMsgRspToDu");
593          return RFAILED;
594       }
595       /* pack the address of the structure */
596       CMCHKPK(oduPackPointer,(PTR)dlRrcMsgRsp, mBuf);
597       return ODU_POST_TASK(pst,mBuf);
598    }
599    else
600    {
601       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDlRrcMsgRspToDu");
602    }
603    return RFAILED;
604 }
605
606 /*******************************************************************
607  *
608  * @brief Unpack DL RRC Msg Response received at DU APP from RLC
609  *
610  * @details
611  *
612  *    Function : unpackRlcDlRrcMsgRspToDu
613  *
614  *    Functionality:
615  *      Unpack DL RRC Msg Response received at DU APP from RLC
616  *
617  * @params[in]
618  * @return ROK     - success
619  *         RFAILED - failure
620  *
621  * ****************************************************************/
622 uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf)
623 {
624    if(pst->selector == ODU_SELECTOR_LWLC)
625    {
626       RlcDlRrcMsgRsp *dlRrcMsgRsp;
627       /* unpack the address of the structure */
628       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgRsp, mBuf);
629       ODU_PUT_MSG_BUF(mBuf);
630       return (*func)(pst, dlRrcMsgRsp);
631    }
632    else
633    {
634       /* Nothing to do for other selectors */
635       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for DL RRC Message transfer ");
636       ODU_PUT_MSG_BUF(mBuf);
637    }
638    return RFAILED;
639 }
640
641 /*******************************************************************
642  *
643  * @brief Pack and send UL user data from RLC to DU APP
644  *
645  * @details
646  *
647  *    Function : packRlcUlUserDataToDu
648  *
649  *    Functionality:
650  *       Pack and send UL User Data from RLC to DU APP
651  *
652  * @params[in] Post structure
653  *             UL user data
654  * @return ROK     - success
655  *         RFAILED - failure
656  *
657  * ****************************************************************/
658 uint8_t packRlcUlUserDataToDu(Pst *pst, RlcUlUserDatInfo *ulUserData)
659 {
660    Buffer *mBuf = NULLP;
661
662    if(pst->selector == ODU_SELECTOR_LWLC)
663    {
664       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
665       {
666          DU_LOG("\nERROR  -->  RLC UL: Memory allocation failed at packRlcUlUserDataToDu");
667          return RFAILED;
668       }
669       /* pack the address of the structure */
670       CMCHKPK(oduPackPointer,(PTR)ulUserData, mBuf);
671       return ODU_POST_TASK(pst,mBuf);
672    }
673    else
674    {
675       DU_LOG("\nERROR  -->  RLC UL: Only LWLC supported for packRlcUlUserDataToDu");
676    }
677    return RFAILED;
678 }
679
680 /*******************************************************************
681  *
682  * @brief Unpack UL user data received at DU APP from RLC
683  *
684  * @details
685  *
686  *    Function : unpackRlcUlUserDataToDu
687  *
688  *    Functionality:
689  *      Unpack UL user data received at DU APP from RLC
690  *
691  * @params[in]
692  * @return ROK     - success
693  *         RFAILED - failure
694  *
695  * ****************************************************************/
696 uint8_t unpackRlcUlUserDataToDu(RlcUlUserDataToDuFunc func, Pst *pst, Buffer *mBuf)
697 {
698    if(pst->selector == ODU_SELECTOR_LWLC)
699    {
700       RlcUlUserDatInfo *ulUserData;
701       /* unpack the address of the structure */
702       CMCHKUNPK(oduUnpackPointer, (PTR *)&ulUserData, mBuf);
703       ODU_PUT_MSG_BUF(mBuf);
704       return (*func)(pst, ulUserData);
705    }
706    else
707    {
708       /* Nothing to do for other selectors */
709       DU_LOG("\nERROR  --> RLC UL: Only LWLC supported for UL User data transfer ");
710       ODU_PUT_MSG_BUF(mBuf);
711    }
712
713    return RFAILED;
714 }
715
716 /*******************************************************************
717  *
718  * @brief Pack and send DL user data from DUAPP to RLC
719  *
720  * @details
721  *
722  *    Function : packRlcDlUserDataToRlc
723  *
724  *    Functionality:
725  *       Pack and send DL User Data from DUAPP to RLC
726  *
727  * @params[in] Post structure
728  *             DL user data
729  * @return ROK     - success
730  *         RFAILED - failure
731  *
732  * ****************************************************************/
733 uint8_t packRlcDlUserDataToRlc(Pst *pst, RlcDlUserDataInfo *dlUserData)
734 {
735    if(pst->selector == ODU_SELECTOR_LWLC)
736    {
737       /* pack the address of the structure */
738       CMCHKPK(oduPackPointer,(PTR)dlUserData, dlUserData->dlMsg);
739       return ODU_POST_TASK(pst,dlUserData->dlMsg);
740    }
741    else
742    {
743       DU_LOG("\nERROR  -->  RLC DL: Only LWLC supported for packRlcUlUserDataToDu");
744    }
745    return RFAILED;
746 }
747
748 /*******************************************************************
749  *
750  * @brief Unpack DL user data received at RLC from DUAPP
751  *
752  * @details
753  *
754  *    Function : unpackRlcDlUserDataToRlc
755  *
756  *    Functionality:
757  *      Unpack DL user data received at RLC from DUAPP
758  *
759  * @params[in]
760  * @return ROK     - success
761  *         RFAILED - failure
762  *
763  * ****************************************************************/
764 uint8_t unpackRlcDlUserDataToRlc(DuRlcDlUserDataToRlcFunc func, Pst *pst, Buffer *mBuf)
765 {
766    if(pst->selector == ODU_SELECTOR_LWLC)
767    {
768       RlcDlUserDataInfo *dlUserData;
769       /* unpack the address of the structure */
770       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlUserData, mBuf);
771       return (*func)(pst, dlUserData);
772    }
773    else
774    {
775       /* Nothing to do for other selectors */
776       DU_LOG("\nERROR  --> RLC DL: Only LWLC supported for UL User data transfer ");
777       ODU_PUT_MSG_BUF(mBuf);
778    }
779
780    return RFAILED;
781 }
782
783 /*******************************************************************
784 *
785 * @brief Packs and Sends UE Delete Request from DUAPP to RLC
786 *
787 * @details
788 *
789 *    Function : packDuRlcUeDeleteReq 
790 *
791 *    Functionality:
792 *       Packs and Sends UE Delete Request from DUAPP to RLC
793 *
794 *
795 * @params[in] Post structure pointer
796 *             RlcUeDelete pointer
797 * @return ROK     - success
798 *         RFAILED - failure
799 *
800 * ****************************************************************/
801
802 uint8_t packDuRlcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete)
803 {
804    Buffer *mBuf = NULLP;
805
806    if(pst->selector == ODU_SELECTOR_LWLC)
807    {
808       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
809       {
810          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeDeleteReq");
811          return RFAILED;
812       }
813       /* pack the address of the structure */
814       CMCHKPK(oduPackPointer,(PTR)ueDelete, mBuf);
815    }
816    else
817    {
818       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeDeleteReq");
819       return RFAILED;
820    }
821
822    return ODU_POST_TASK(pst,mBuf);
823 }
824
825 /*******************************************************************
826 * @brief Unpacks UE Delete Request received from DU APP
827 *
828 * @details
829 *
830 *    Function : unpackRlcUeDeleteReq 
831 *
832 *    Functionality:
833 *         Unpacks UE Delete Request received from DU APP
834 *
835 * @params[in] Pointer to Handler
836 *             Post structure pointer
837 *             Message Buffer
838 * @return ROK     - success
839 *         RFAILED - failure
840 *
841 * ****************************************************************/
842
843 uint8_t unpackRlcUeDeleteReq(DuRlcUeDeleteReq func, Pst *pst, Buffer *mBuf)
844 {
845     if(pst->selector == ODU_SELECTOR_LWLC)
846     {
847        RlcUeDelete *ueDelete;
848        /* unpack the address of the structure */
849        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf);
850        ODU_PUT_MSG_BUF(mBuf);
851        return (*func)(pst, ueDelete);
852     }
853     else
854     {
855        /* Nothing to do for other selectors */
856        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Delete Request ");
857        ODU_PUT_MSG_BUF(mBuf);
858     }
859     return RFAILED;
860 }
861
862 /*******************************************************************
863 *
864 * @brief Packs and Sends UE Del Response from RLC to DUAPP
865 *
866 * @details
867 *
868 *    Function : packRlcDuUeDeleteRsp
869 *
870 *    Functionality:
871 *       Packs and Sends UE Del Response from RLC to DUAPP
872 *
873 *
874 * @params[in] Post structure pointer
875 *             RlcUeDeleteRsp *ueDelRsp
876 *
877 * @return ROK     - success
878 *         RFAILED - failure
879 *
880 * ****************************************************************/
881
882 uint8_t packRlcDuUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *ueDelRsp)
883 {
884    Buffer *mBuf = NULLP;
885
886    if(pst->selector == ODU_SELECTOR_LWLC)
887    {
888       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
889       {
890          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuUeDeleteRsp");
891          return RFAILED;
892       }
893       /* pack the address of the structure */
894       CMCHKPK(oduPackPointer,(PTR)ueDelRsp, mBuf);
895    }
896    else
897    {
898       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuUeDeleteRsp");
899       return RFAILED;
900    }
901
902    return ODU_POST_TASK(pst,mBuf);
903 }
904
905 /*******************************************************************
906 *
907 * @brief Unpacks UE Del Response received from DU APP
908 *
909 * @details
910 *
911 *    Function : unpackRlcUeDeleteRsp
912 *
913 *    Functionality:
914 *         Unpacks UE Del Response received from DU APP
915 *
916 * @params[in] Pointer to Handler
917 *             Post structure pointer
918 *             Message Buffer
919 * @return ROK     - success
920 *         RFAILED - failure
921 *
922 * ****************************************************************/
923
924 uint8_t unpackRlcUeDeleteRsp(RlcDuUeDeleteRsp func, Pst *pst, Buffer *mBuf)
925 {
926     if(pst->selector == ODU_SELECTOR_LWLC)
927     {
928        RlcUeDeleteRsp *ueDeleteRsp = NULLP;
929        /* unpack the address of the structure */
930        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDeleteRsp, mBuf);
931        ODU_PUT_MSG_BUF(mBuf);
932        return (*func)(pst, ueDeleteRsp);
933     }
934     else
935     {
936        /* Nothing to do for other selectors */
937        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Del Response ");
938        ODU_PUT_MSG_BUF(mBuf);
939     }
940
941     return RFAILED;
942 }
943
944 /*******************************************************************
945 *
946 * @brief Packs and Sends Slice PM from RLC to DUAPP
947 *
948 * @details
949 *
950 *    Function : packRlcDuSlicePm
951 *
952 *    Functionality:
953 *       Packs and Sends Slice Performance Metrics from RLC to DUAPP
954 *
955 *
956 * @params[in] Post structure pointer
957 *             SlicePmList *sliceStats
958 *
959 * @return ROK     - success
960 *         RFAILED - failure
961 *
962 * ****************************************************************/
963
964 uint8_t packRlcDuSlicePm(Pst *pst, SlicePmList *sliceStats)
965 {
966    Buffer *mBuf = NULLP;
967
968    if(pst->selector == ODU_SELECTOR_LWLC)
969    {
970       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
971       {
972          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuSlicePm");
973          return RFAILED;
974       }
975       /* pack the address of the structure */
976       CMCHKPK(oduPackPointer,(PTR)sliceStats, mBuf);
977    }
978    else
979    {
980       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuSlicePm");
981       return RFAILED;
982    }
983
984    return ODU_POST_TASK(pst,mBuf);
985 }
986
987 /*******************************************************************
988 *
989 * @brief Unpacks Slice PM received from RLC
990 *
991 * @details
992 *
993 *    Function : unpackRlcSlicePm
994 *
995 *    Functionality:
996 *         Unpacks Slice Performance Metrics received from RLC
997 *
998 * @params[in] Pointer to Handler
999 *             Post structure pointer
1000 *             Message Buffer
1001 * @return ROK     - success
1002 *         RFAILED - failure
1003 *
1004 * ****************************************************************/
1005
1006 uint8_t unpackRlcSlicePm(RlcSlicePmToDuFunc func, Pst *pst, Buffer *mBuf)
1007 {
1008     if(pst->selector == ODU_SELECTOR_LWLC)
1009     {
1010        SlicePmList *sliceStats = NULLP;
1011        /* unpack the address of the structure */
1012        CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceStats, mBuf);
1013        ODU_PUT_MSG_BUF(mBuf);
1014        return (*func)(pst, sliceStats);
1015     }
1016     else
1017     {
1018        /* Nothing to do for other selectors */
1019        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for Slice Metrics ");
1020        ODU_PUT_MSG_BUF(mBuf);
1021     }
1022
1023     return RFAILED;
1024 }
1025
1026 /*******************************************************************
1027 *
1028 * @brief Packs and Sends UE Reestablishment Req from DUAPP to RLC
1029 *
1030 * @details
1031 *
1032 *    Function : packDuRlcUeReestablishReq 
1033 *
1034 *    Functionality:
1035 *       Packs and Sends UE Reestablishment Req from DUAPP to RLC
1036 *
1037 *
1038 * @params[in] Post structure pointer
1039 *             RlcUeReestablishReq pointer
1040 * @return ROK     - success
1041 *         RFAILED - failure
1042 *
1043 * ****************************************************************/
1044
1045 uint8_t packDuRlcUeReestablishReq(Pst *pst, RlcUeReestablishReq *ueDelete)
1046 {
1047    Buffer *mBuf = NULLP;
1048
1049    if(pst->selector == ODU_SELECTOR_LWLC)
1050    {
1051       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1052       {
1053          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeReestablishReq");
1054          return RFAILED;
1055       }
1056       /* pack the address of the structure */
1057       CMCHKPK(oduPackPointer,(PTR)ueDelete, mBuf);
1058    }
1059    else
1060    {
1061       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeReestablishReq");
1062       return RFAILED;
1063    }
1064
1065    return ODU_POST_TASK(pst,mBuf);
1066 }
1067
1068 /*******************************************************************
1069 * @brief Unpacks UE Reestablishment Req received from DU APP
1070 *
1071 * @details
1072 *
1073 *    Function : unpackRlcUeReestablishReq 
1074 *
1075 *    Functionality:
1076 *         Unpacks UE Reestablishment Req received from DU APP
1077 *
1078 * @params[in] Pointer to Handler
1079 *             Post structure pointer
1080 *             Message Buffer
1081 * @return ROK     - success
1082 *         RFAILED - failure
1083 *
1084 * ****************************************************************/
1085
1086 uint8_t unpackRlcUeReestablishReq(DuRlcUeReestablishReq func, Pst *pst, Buffer *mBuf)
1087 {
1088     if(pst->selector == ODU_SELECTOR_LWLC)
1089     {
1090        RlcUeReestablishReq *ueDelete;
1091        /* unpack the address of the structure */
1092        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf);
1093        ODU_PUT_MSG_BUF(mBuf);
1094        return (*func)(pst, ueDelete);
1095     }
1096     else
1097     {
1098        /* Nothing to do for other selectors */
1099        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Reestablishment Req ");
1100        ODU_PUT_MSG_BUF(mBuf);
1101     }
1102     return RFAILED;
1103 }
1104
1105 /*******************************************************************
1106 *
1107 * @brief Packs and Sends UE Reestablishment Response from RLC to DUAPP
1108 *
1109 * @details
1110 *
1111 *    Function : packRlcDuUeReestablishRsp
1112 *
1113 *    Functionality:
1114 *       Packs and Sends UE Reestablishment Response from RLC to DUAPP
1115 *
1116 *
1117 * @params[in] Post structure pointer
1118 *             RlcUeReestablishRsp *ueReestablish
1119 *
1120 * @return ROK     - success
1121 *         RFAILED - failure
1122 *
1123 * ****************************************************************/
1124
1125 uint8_t packRlcDuUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *ueReestablish)
1126 {
1127    Buffer *mBuf = NULLP;
1128
1129    if(pst->selector == ODU_SELECTOR_LWLC)
1130    {
1131       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1132       {
1133          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuUeReestablishRsp");
1134          return RFAILED;
1135       }
1136       /* pack the address of the structure */
1137       CMCHKPK(oduPackPointer,(PTR)ueReestablish, mBuf);
1138    }
1139    else
1140    {
1141       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuUeReestablishRsp");
1142       return RFAILED;
1143    }
1144
1145    return ODU_POST_TASK(pst,mBuf);
1146 }
1147
1148 /*******************************************************************
1149 *
1150 * @brief Unpacks UE Reestablishment Response received from DU APP
1151 *
1152 * @details
1153 *
1154 *    Function : unpackRlcUeReestablishRsp
1155 *
1156 *    Functionality:
1157 *         Unpacks UE Reestablishment Response received from DU APP
1158 *
1159 * @params[in] Pointer to Handler
1160 *             Post structure pointer
1161 *             Message Buffer
1162 * @return ROK     - success
1163 *         RFAILED - failure
1164 *
1165 * ****************************************************************/
1166
1167 uint8_t unpackRlcUeReestablishRsp(RlcDuUeReestablishRsp func, Pst *pst, Buffer *mBuf)
1168 {
1169     if(pst->selector == ODU_SELECTOR_LWLC)
1170     {
1171        RlcUeReestablishRsp *ueReestablishRsp = NULLP;
1172        /* unpack the address of the structure */
1173        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueReestablishRsp, mBuf);
1174        ODU_PUT_MSG_BUF(mBuf);
1175        return (*func)(pst, ueReestablishRsp);
1176     }
1177     else
1178     {
1179        /* Nothing to do for other selectors */
1180        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Reestablishment Response ");
1181        ODU_PUT_MSG_BUF(mBuf);
1182     }
1183
1184     return RFAILED;
1185 }
1186 /**********************************************************************
1187          End of file
1188 ***********************************************************************/