[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] Ue Create and Rsp correction in DUAPP...
[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  *             RlcUeCreate pointer              
118  * @return ROK     - success
119  *         RFAILED - failure
120  *
121  * ****************************************************************/
122 uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCreate *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       RlcUeCreate *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 Create Response from RLC to DUAPP
186  *
187  * @details
188  *
189  *    Function : packRlcDuUeCreateRsp
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 packRlcDuUeCreateRsp(Pst *pst, RlcUeCreateRsp *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 packRlcDuUeCreateRsp");
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 packRlcDuUeCreateRsp");
218       return RFAILED;
219    }
220
221     return ODU_POST_TASK(pst,mBuf);
222 }
223
224 /*******************************************************************
225  *
226  * @brief Unpacks UE Create Response received from DU APP
227  *
228  * @details
229  *
230  *    Function : unpackRlcUeCreateRsp
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 unpackRlcUeCreateRsp(RlcDuUeCreateRsp func, Pst *pst, Buffer *mBuf)
243 {
244    if(pst->selector == ODU_SELECTOR_LWLC)
245    {
246       RlcUeCreateRsp *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 Packs and Sends UE Reconfig Response from RLC to DUAPP
265  *
266  * @details
267  *
268  *    Function : packRlcDuUeReconfigRsp
269  *
270  *    Functionality:
271  *       Packs and Sends UE Reconfig Rrsponse from RLC to DUAPP
272  *
273  *
274  * @params[in] Post structure pointer
275  *             RlcUeRecfgRsp pointer              
276  * @return ROK     - success
277  *         RFAILED - failure
278  *
279  * ****************************************************************/
280 uint8_t packRlcDuUeReconfigRsp(Pst *pst, RlcUeReconfigRsp *ueCfg)
281 {
282    Buffer *mBuf = NULLP;
283  
284    if(pst->selector == ODU_SELECTOR_LWLC)
285    {
286       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
287       {
288          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuUeReconfigRsp");
289          return RFAILED;
290       }
291       /* pack the address of the structure */
292       CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
293    }
294    else
295    {
296       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuUeReconfigRsp");
297       return RFAILED;
298    }
299
300     return ODU_POST_TASK(pst,mBuf);
301 }
302
303 /*******************************************************************
304  *
305  * @brief Unpacks UE Reconfig Response received from DU APP
306  *
307  * @details
308  *
309  *    Function : unpackRlcUeReconfigRsp
310  *
311  *    Functionality:
312  *         Unpacks UE Reconfig Response received from DU APP
313  *
314  * @params[in] Pointer to Handler
315  *             Post structure pointer
316  *             Message Buffer
317  * @return ROK     - success
318  *         RFAILED - failure
319  *
320  * ****************************************************************/
321 uint8_t unpackRlcUeReconfigRsp(RlcDuUeReconfigRsp func, Pst *pst, Buffer *mBuf)
322 {
323    if(pst->selector == ODU_SELECTOR_LWLC)
324    {
325       RlcUeReconfigRsp *cfgRsp = NULLP;
326       /* unpack the address of the structure */
327       CMCHKUNPK(oduUnpackPointer, (PTR *)&cfgRsp, mBuf);
328       ODU_PUT_MSG_BUF(mBuf);
329       return (*func)(pst, cfgRsp);
330    }
331    else
332    {
333       /* Nothing to do for other selectors */
334       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Re-Cfg Response ");
335       ODU_PUT_MSG_BUF(mBuf);
336    }
337
338    return RFAILED;
339 }
340
341 /*******************************************************************
342  *
343  * @brief Pack and send UL RRC message transfer from RLC to DU APP
344  *
345  * @details
346  *
347  *    Function : packRlcUlRrcMsgToDu
348  *
349  *    Functionality:
350  *       Pack and send UL RRC message transfer from RLC to DU APP
351  *
352  * @params[in] Post structure
353  *             UL RRC Msg transfer info
354  * @return ROK     - success
355  *         RFAILED - failure
356  *
357  * ****************************************************************/
358 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo)
359 {
360    Buffer *mBuf = NULLP;
361
362    if(pst->selector == ODU_SELECTOR_LWLC)
363    {
364       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
365       {
366          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcUlRrcMsgToDu");
367          return RFAILED;
368       }
369       /* pack the address of the structure */
370       CMCHKPK(oduPackPointer,(PTR)ulRrcMsgInfo, mBuf);
371       return ODU_POST_TASK(pst,mBuf);
372    }
373    else
374    {
375       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcUlRrcMsgToDu");
376    }
377    return RFAILED;
378 }
379
380 /*******************************************************************
381  *
382  * @brief Unpack UL RRC Msg Transfer received at DU APP from RLC
383  *
384  * @details
385  *
386  *    Function : unpackRlcUlRrcMsgToDu
387  *
388  *    Functionality:
389  *      Unpack UL RRC Msg Transfer received at DU APP from RLC
390  *
391  * @params[in]
392  * @return ROK     - success
393  *         RFAILED - failure
394  *
395  * ****************************************************************/
396 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf)
397 {
398    if(pst->selector == ODU_SELECTOR_LWLC)
399    {
400       RlcUlRrcMsgInfo *ulRrcMsgInfo;
401       /* unpack the address of the structure */
402       CMCHKUNPK(oduUnpackPointer, (PTR *)&ulRrcMsgInfo, mBuf);
403       ODU_PUT_MSG_BUF(mBuf);
404       return (*func)(pst, ulRrcMsgInfo);
405    }
406    else
407    {
408       /* Nothing to do for other selectors */
409       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UL RRC Message transfer ");
410       ODU_PUT_MSG_BUF(mBuf);
411    }
412
413    return RFAILED;
414 }
415
416 /*******************************************************************
417  *
418  * @brief Pack and post DL RRC Message from DU APP to RLC 
419  *
420  * @details
421  *
422  *    Function : packDlRrcMsgToRlc
423  *
424  *    Functionality: Pack and post DL RRC Message from DU APP to RLC
425  *
426  * @params[in] Post structure
427  *             DL RRC Message info
428  * @return ROK     - success
429  *         RFAILED - failure
430  *
431  * ****************************************************************/
432 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
433 {
434    Buffer *mBuf = NULLP;
435
436    if(pst->selector == ODU_SELECTOR_LWLC)
437    {
438       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
439       {
440          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDlRrcMsgToRlc");
441          return RFAILED;
442       }
443       /* pack the address of the structure */
444       CMCHKPK(oduPackPointer,(PTR)dlRrcMsgInfo, mBuf);
445       return ODU_POST_TASK(pst,mBuf);
446    }
447    else
448    {
449       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDlRrcMsgToRlc");
450    }
451    return RFAILED;
452 }
453
454 /*******************************************************************
455  *
456  * @brief Unpacks DL RRC Message info received at RLC from DU APP
457  *
458  * @details
459  *
460  *    Function : unpackDlRrcMsgToRlc
461  *
462  *    Functionality:
463  *      Unpacks the DL RRC Message info received at RLC from DU APP
464  *
465  * @params[in] Pointer to handler function
466  *             Post structure
467  *             Messae buffer to be unpacked
468  * @return ROK     - success
469  *         RFAILED - failure
470  *
471  * ****************************************************************/
472 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf)
473 {
474    if(pst->selector == ODU_SELECTOR_LWLC)
475    {
476       RlcDlRrcMsgInfo *dlRrcMsgInfo;
477       /* unpack the address of the structure */
478       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgInfo, mBuf);
479       ODU_PUT_MSG_BUF(mBuf);
480       return (*func)(pst, dlRrcMsgInfo);
481    }
482    else
483    {
484       /* Nothing to do for other selectors */
485       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UL RRC Message transfer ");
486       ODU_PUT_MSG_BUF(mBuf);
487    }
488    return RFAILED;
489 }
490
491 /*******************************************************************
492 *
493 * @brief packs RRC delivery report sending from  RLC to DU APP
494 *
495 * @details
496 *
497 *    Function : packRrcDeliveryReportToDu
498 *
499 *    Functionality:
500 *      Unpacks the DL RRC Message info received at RLC from DU APP
501 *
502 * @params[in] Pointer to handler function
503 *             Post structure
504 *             Messae buffer to be unpacked
505 * @return ROK     - success
506 *         RFAILED - failure
507 *
508 * ****************************************************************/
509 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport)
510 {
511     Buffer *mBuf = NULLP;
512
513     if(pst->selector == ODU_SELECTOR_LWLC)
514     {
515        if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
516        {
517           DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRrcDeliveryReportToDu");
518           return RFAILED;
519        }
520        /* pack the address of the structure */
521        CMCHKPK(oduPackPointer,(PTR)rrcDeliveryReport, mBuf);
522        return ODU_POST_TASK(pst,mBuf);
523     }
524     else
525     {
526        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRrcDeliveryReportToDu");
527     }
528     return RFAILED;
529  }
530
531 /*******************************************************************
532 *
533 * @brief Unpacks RRC Delivery Report info received at DU APP from RIC
534 *
535 * @details
536 *
537 *    Function : unpackRrcDeliveryReportToDu
538 *
539 *    Functionality:
540 *      Unpacks RRC Delivery Report info received at DU APP from RIC
541 *
542 * @params[in] Pointer to handler function
543 *             Post structure
544 *             Messae buffer to be unpacked
545 * @return ROK     - success
546 *         RFAILED - failure
547 *
548 * ****************************************************************/
549 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func, Pst *pst, Buffer *mBuf)
550 {
551     if(pst->selector == ODU_SELECTOR_LWLC)
552     {
553        RrcDeliveryReport *rrcDeliveryReport;
554        /* unpack the address of the structure */
555        CMCHKUNPK(oduUnpackPointer, (PTR *)&rrcDeliveryReport, mBuf);
556        ODU_PUT_MSG_BUF(mBuf);
557        return (*func)(pst, rrcDeliveryReport);
558     }
559     else
560     {
561        /* Nothing to do for other selectors */
562        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for RRC delivery Message transfer ");
563        ODU_PUT_MSG_BUF(mBuf);
564     }
565
566     return RFAILED;
567 }
568
569 /*******************************************************************
570  *
571  * @brief Packs and Sends UE Reconfig Request from DUAPP to RLC
572  *
573  * @details
574  *
575  *    Function : packDuRlcUeReconfigReq
576  *
577  *    Functionality:
578  *       Packs and Sends UE Reconfig Request from DUAPP to RLC
579  *
580  *
581  * @params[in] Post structure pointer
582  *             RlcUeCfg pointer              
583  * @return ROK     - success
584  *         RFAILED - failure
585  *
586  * ****************************************************************/
587 uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeRecfg *ueRecfg)
588 {
589    Buffer *mBuf = NULLP;
590  
591    if(pst->selector == ODU_SELECTOR_LWLC)
592    {
593       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
594       {
595          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeReconfigReq");
596          return RFAILED;
597       }
598       /* pack the address of the structure */
599       CMCHKPK(oduPackPointer,(PTR)ueRecfg, mBuf);
600    }
601    else
602    {
603       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeReconfigReq");
604       return RFAILED;
605    }
606
607     return ODU_POST_TASK(pst,mBuf);
608 }
609
610 /*******************************************************************
611  * @brief Unpacks UE Reconfig Request received from DU APP
612  *
613  * @details
614  *
615  *    Function : unpackRlcUeReconfigReq
616  *
617  *    Functionality:
618  *         Unpacks UE Create Request received from DU APP
619  *
620  * @params[in] Pointer to Handler
621  *             Post structure pointer
622  *             Message Buffer
623  * @return ROK     - success
624  *         RFAILED - failure
625  *
626  * ****************************************************************/
627 uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf)
628 {
629    if(pst->selector == ODU_SELECTOR_LWLC)
630    {
631       RlcUeRecfg *ueRecfg;
632       /* unpack the address of the structure */
633       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueRecfg, mBuf);
634       ODU_PUT_MSG_BUF(mBuf);
635       return (*func)(pst, ueRecfg);
636    }
637    else
638    {
639       /* Nothing to do for other selectors */
640       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Create Request ");
641       ODU_PUT_MSG_BUF(mBuf);
642    }
643    return RFAILED;
644 }
645
646 /*******************************************************************
647  *
648  * @brief Pack and send DL RRC message Response from RLC to DU APP
649  *
650  * @details
651  *
652  *    Function : packRlcDlRrcMsgRspToDu
653  *
654  *    Functionality:
655  *       Pack and send DL RRC message Response from RLC to DU APP
656  *
657  * @params[in] Post structure
658  *             DL RRC Msg Response 
659  * @return ROK     - success
660  *         RFAILED - failure
661  *
662  * ****************************************************************/
663 uint8_t packRlcDlRrcMsgRspToDu(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsgRsp)
664 {
665    Buffer *mBuf = NULLP;
666
667    if(pst->selector == ODU_SELECTOR_LWLC)
668    {
669       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
670       {
671          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDlRrcMsgRspToDu");
672          return RFAILED;
673       }
674       /* pack the address of the structure */
675       CMCHKPK(oduPackPointer,(PTR)dlRrcMsgRsp, mBuf);
676       return ODU_POST_TASK(pst,mBuf);
677    }
678    else
679    {
680       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDlRrcMsgRspToDu");
681    }
682    return RFAILED;
683 }
684
685 /*******************************************************************
686  *
687  * @brief Unpack DL RRC Msg Response received at DU APP from RLC
688  *
689  * @details
690  *
691  *    Function : unpackRlcDlRrcMsgRspToDu
692  *
693  *    Functionality:
694  *      Unpack DL RRC Msg Response received at DU APP from RLC
695  *
696  * @params[in]
697  * @return ROK     - success
698  *         RFAILED - failure
699  *
700  * ****************************************************************/
701 uint8_t unpackRlcDlRrcMsgRspToDu(RlcDlRrcMsgRspToDuFunc func, Pst *pst, Buffer *mBuf)
702 {
703    if(pst->selector == ODU_SELECTOR_LWLC)
704    {
705       RlcDlRrcMsgRsp *dlRrcMsgRsp;
706       /* unpack the address of the structure */
707       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlRrcMsgRsp, mBuf);
708       ODU_PUT_MSG_BUF(mBuf);
709       return (*func)(pst, dlRrcMsgRsp);
710    }
711    else
712    {
713       /* Nothing to do for other selectors */
714       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for DL RRC Message transfer ");
715       ODU_PUT_MSG_BUF(mBuf);
716    }
717    return RFAILED;
718 }
719
720 /*******************************************************************
721  *
722  * @brief Pack and send UL user data from RLC to DU APP
723  *
724  * @details
725  *
726  *    Function : packRlcUlUserDataToDu
727  *
728  *    Functionality:
729  *       Pack and send UL User Data from RLC to DU APP
730  *
731  * @params[in] Post structure
732  *             UL user data
733  * @return ROK     - success
734  *         RFAILED - failure
735  *
736  * ****************************************************************/
737 uint8_t packRlcUlUserDataToDu(Pst *pst, RlcUlUserDatInfo *ulUserData)
738 {
739    Buffer *mBuf = NULLP;
740
741    if(pst->selector == ODU_SELECTOR_LWLC)
742    {
743       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
744       {
745          DU_LOG("\nERROR  -->  RLC UL: Memory allocation failed at packRlcUlUserDataToDu");
746          return RFAILED;
747       }
748       /* pack the address of the structure */
749       CMCHKPK(oduPackPointer,(PTR)ulUserData, mBuf);
750       return ODU_POST_TASK(pst,mBuf);
751    }
752    else
753    {
754       DU_LOG("\nERROR  -->  RLC UL: Only LWLC supported for packRlcUlUserDataToDu");
755    }
756    return RFAILED;
757 }
758
759 /*******************************************************************
760  *
761  * @brief Unpack UL user data received at DU APP from RLC
762  *
763  * @details
764  *
765  *    Function : unpackRlcUlUserDataToDu
766  *
767  *    Functionality:
768  *      Unpack UL user data received at DU APP from RLC
769  *
770  * @params[in]
771  * @return ROK     - success
772  *         RFAILED - failure
773  *
774  * ****************************************************************/
775 uint8_t unpackRlcUlUserDataToDu(RlcUlUserDataToDuFunc func, Pst *pst, Buffer *mBuf)
776 {
777    if(pst->selector == ODU_SELECTOR_LWLC)
778    {
779       RlcUlUserDatInfo *ulUserData;
780       /* unpack the address of the structure */
781       CMCHKUNPK(oduUnpackPointer, (PTR *)&ulUserData, mBuf);
782       ODU_PUT_MSG_BUF(mBuf);
783       return (*func)(pst, ulUserData);
784    }
785    else
786    {
787       /* Nothing to do for other selectors */
788       DU_LOG("\nERROR  --> RLC UL: Only LWLC supported for UL User data transfer ");
789       ODU_PUT_MSG_BUF(mBuf);
790    }
791
792    return RFAILED;
793 }
794
795 /*******************************************************************
796  *
797  * @brief Pack and send DL user data from DUAPP to RLC
798  *
799  * @details
800  *
801  *    Function : packRlcDlUserDataToRlc
802  *
803  *    Functionality:
804  *       Pack and send DL User Data from DUAPP to RLC
805  *
806  * @params[in] Post structure
807  *             DL user data
808  * @return ROK     - success
809  *         RFAILED - failure
810  *
811  * ****************************************************************/
812 uint8_t packRlcDlUserDataToRlc(Pst *pst, RlcDlUserDataInfo *dlUserData)
813 {
814    if(pst->selector == ODU_SELECTOR_LWLC)
815    {
816       /* pack the address of the structure */
817       CMCHKPK(oduPackPointer,(PTR)dlUserData, dlUserData->dlMsg);
818       return ODU_POST_TASK(pst,dlUserData->dlMsg);
819    }
820    else
821    {
822       DU_LOG("\nERROR  -->  RLC DL: Only LWLC supported for packRlcUlUserDataToDu");
823    }
824    return RFAILED;
825 }
826
827 /*******************************************************************
828  *
829  * @brief Unpack DL user data received at RLC from DUAPP
830  *
831  * @details
832  *
833  *    Function : unpackRlcDlUserDataToRlc
834  *
835  *    Functionality:
836  *      Unpack DL user data received at RLC from DUAPP
837  *
838  * @params[in]
839  * @return ROK     - success
840  *         RFAILED - failure
841  *
842  * ****************************************************************/
843 uint8_t unpackRlcDlUserDataToRlc(DuRlcDlUserDataToRlcFunc func, Pst *pst, Buffer *mBuf)
844 {
845    if(pst->selector == ODU_SELECTOR_LWLC)
846    {
847       RlcDlUserDataInfo *dlUserData;
848       /* unpack the address of the structure */
849       CMCHKUNPK(oduUnpackPointer, (PTR *)&dlUserData, mBuf);
850       return (*func)(pst, dlUserData);
851    }
852    else
853    {
854       /* Nothing to do for other selectors */
855       DU_LOG("\nERROR  --> RLC DL: Only LWLC supported for UL User data transfer ");
856       ODU_PUT_MSG_BUF(mBuf);
857    }
858
859    return RFAILED;
860 }
861
862 /*******************************************************************
863 *
864 * @brief Packs and Sends UE Delete Request from DUAPP to RLC
865 *
866 * @details
867 *
868 *    Function : packDuRlcUeDeleteReq 
869 *
870 *    Functionality:
871 *       Packs and Sends UE Delete Request from DUAPP to RLC
872 *
873 *
874 * @params[in] Post structure pointer
875 *             RlcUeDelete pointer
876 * @return ROK     - success
877 *         RFAILED - failure
878 *
879 * ****************************************************************/
880
881 uint8_t packDuRlcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete)
882 {
883    Buffer *mBuf = NULLP;
884
885    if(pst->selector == ODU_SELECTOR_LWLC)
886    {
887       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
888       {
889          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeDeleteReq");
890          return RFAILED;
891       }
892       /* pack the address of the structure */
893       CMCHKPK(oduPackPointer,(PTR)ueDelete, mBuf);
894    }
895    else
896    {
897       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeDeleteReq");
898       return RFAILED;
899    }
900
901    return ODU_POST_TASK(pst,mBuf);
902 }
903
904 /*******************************************************************
905 * @brief Unpacks UE Delete Request received from DU APP
906 *
907 * @details
908 *
909 *    Function : unpackRlcUeDeleteReq 
910 *
911 *    Functionality:
912 *         Unpacks UE Delete Request received from DU APP
913 *
914 * @params[in] Pointer to Handler
915 *             Post structure pointer
916 *             Message Buffer
917 * @return ROK     - success
918 *         RFAILED - failure
919 *
920 * ****************************************************************/
921
922 uint8_t unpackRlcUeDeleteReq(DuRlcUeDeleteReq func, Pst *pst, Buffer *mBuf)
923 {
924     if(pst->selector == ODU_SELECTOR_LWLC)
925     {
926        RlcUeDelete *ueDelete;
927        /* unpack the address of the structure */
928        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf);
929        ODU_PUT_MSG_BUF(mBuf);
930        return (*func)(pst, ueDelete);
931     }
932     else
933     {
934        /* Nothing to do for other selectors */
935        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Delete Request ");
936        ODU_PUT_MSG_BUF(mBuf);
937     }
938     return RFAILED;
939 }
940
941 /*******************************************************************
942 *
943 * @brief Packs and Sends UE Del Response from RLC to DUAPP
944 *
945 * @details
946 *
947 *    Function : packRlcDuUeDeleteRsp
948 *
949 *    Functionality:
950 *       Packs and Sends UE Del Response from RLC to DUAPP
951 *
952 *
953 * @params[in] Post structure pointer
954 *             RlcUeDeleteRsp *ueDelRsp
955 *
956 * @return ROK     - success
957 *         RFAILED - failure
958 *
959 * ****************************************************************/
960
961 uint8_t packRlcDuUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *ueDelRsp)
962 {
963    Buffer *mBuf = NULLP;
964
965    if(pst->selector == ODU_SELECTOR_LWLC)
966    {
967       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
968       {
969          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuUeDeleteRsp");
970          return RFAILED;
971       }
972       /* pack the address of the structure */
973       CMCHKPK(oduPackPointer,(PTR)ueDelRsp, mBuf);
974    }
975    else
976    {
977       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuUeDeleteRsp");
978       return RFAILED;
979    }
980
981    return ODU_POST_TASK(pst,mBuf);
982 }
983
984 /*******************************************************************
985 *
986 * @brief Unpacks UE Del Response received from DU APP
987 *
988 * @details
989 *
990 *    Function : unpackRlcUeDeleteRsp
991 *
992 *    Functionality:
993 *         Unpacks UE Del Response received from DU APP
994 *
995 * @params[in] Pointer to Handler
996 *             Post structure pointer
997 *             Message Buffer
998 * @return ROK     - success
999 *         RFAILED - failure
1000 *
1001 * ****************************************************************/
1002
1003 uint8_t unpackRlcUeDeleteRsp(RlcDuUeDeleteRsp func, Pst *pst, Buffer *mBuf)
1004 {
1005     if(pst->selector == ODU_SELECTOR_LWLC)
1006     {
1007        RlcUeDeleteRsp *ueDeleteRsp = NULLP;
1008        /* unpack the address of the structure */
1009        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDeleteRsp, mBuf);
1010        ODU_PUT_MSG_BUF(mBuf);
1011        return (*func)(pst, ueDeleteRsp);
1012     }
1013     else
1014     {
1015        /* Nothing to do for other selectors */
1016        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Del Response ");
1017        ODU_PUT_MSG_BUF(mBuf);
1018     }
1019
1020     return RFAILED;
1021 }
1022
1023 /*******************************************************************
1024 *
1025 * @brief Packs and Sends Slice PM from RLC to DUAPP
1026 *
1027 * @details
1028 *
1029 *    Function : packRlcDuSlicePm
1030 *
1031 *    Functionality:
1032 *       Packs and Sends Slice Performance Metrics from RLC to DUAPP
1033 *
1034 *
1035 * @params[in] Post structure pointer
1036 *             SlicePmList *sliceStats
1037 *
1038 * @return ROK     - success
1039 *         RFAILED - failure
1040 *
1041 * ****************************************************************/
1042
1043 uint8_t packRlcDuSlicePm(Pst *pst, SlicePmList *sliceStats)
1044 {
1045    Buffer *mBuf = NULLP;
1046
1047    if(pst->selector == ODU_SELECTOR_LWLC)
1048    {
1049       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1050       {
1051          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuSlicePm");
1052          return RFAILED;
1053       }
1054       /* pack the address of the structure */
1055       CMCHKPK(oduPackPointer,(PTR)sliceStats, mBuf);
1056    }
1057    else
1058    {
1059       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuSlicePm");
1060       return RFAILED;
1061    }
1062
1063    return ODU_POST_TASK(pst,mBuf);
1064 }
1065
1066 /*******************************************************************
1067 *
1068 * @brief Unpacks Slice PM received from RLC
1069 *
1070 * @details
1071 *
1072 *    Function : unpackRlcSlicePm
1073 *
1074 *    Functionality:
1075 *         Unpacks Slice Performance Metrics received from RLC
1076 *
1077 * @params[in] Pointer to Handler
1078 *             Post structure pointer
1079 *             Message Buffer
1080 * @return ROK     - success
1081 *         RFAILED - failure
1082 *
1083 * ****************************************************************/
1084
1085 uint8_t unpackRlcSlicePm(RlcSlicePmToDuFunc func, Pst *pst, Buffer *mBuf)
1086 {
1087     if(pst->selector == ODU_SELECTOR_LWLC)
1088     {
1089        SlicePmList *sliceStats = NULLP;
1090        /* unpack the address of the structure */
1091        CMCHKUNPK(oduUnpackPointer, (PTR *)&sliceStats, mBuf);
1092        ODU_PUT_MSG_BUF(mBuf);
1093        return (*func)(pst, sliceStats);
1094     }
1095     else
1096     {
1097        /* Nothing to do for other selectors */
1098        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for Slice Metrics ");
1099        ODU_PUT_MSG_BUF(mBuf);
1100     }
1101
1102     return RFAILED;
1103 }
1104
1105 /*******************************************************************
1106 *
1107 * @brief Packs and Sends UE Reestablishment Req from DUAPP to RLC
1108 *
1109 * @details
1110 *
1111 *    Function : packDuRlcUeReestablishReq 
1112 *
1113 *    Functionality:
1114 *       Packs and Sends UE Reestablishment Req from DUAPP to RLC
1115 *
1116 *
1117 * @params[in] Post structure pointer
1118 *             RlcUeReestablishReq pointer
1119 * @return ROK     - success
1120 *         RFAILED - failure
1121 *
1122 * ****************************************************************/
1123
1124 uint8_t packDuRlcUeReestablishReq(Pst *pst, RlcUeReestablishReq *ueDelete)
1125 {
1126    Buffer *mBuf = NULLP;
1127
1128    if(pst->selector == ODU_SELECTOR_LWLC)
1129    {
1130       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1131       {
1132          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packDuRlcUeReestablishReq");
1133          return RFAILED;
1134       }
1135       /* pack the address of the structure */
1136       CMCHKPK(oduPackPointer,(PTR)ueDelete, mBuf);
1137    }
1138    else
1139    {
1140       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packDuRlcUeReestablishReq");
1141       return RFAILED;
1142    }
1143
1144    return ODU_POST_TASK(pst,mBuf);
1145 }
1146
1147 /*******************************************************************
1148 * @brief Unpacks UE Reestablishment Req received from DU APP
1149 *
1150 * @details
1151 *
1152 *    Function : unpackRlcUeReestablishReq 
1153 *
1154 *    Functionality:
1155 *         Unpacks UE Reestablishment Req received from DU APP
1156 *
1157 * @params[in] Pointer to Handler
1158 *             Post structure pointer
1159 *             Message Buffer
1160 * @return ROK     - success
1161 *         RFAILED - failure
1162 *
1163 * ****************************************************************/
1164
1165 uint8_t unpackRlcUeReestablishReq(DuRlcUeReestablishReq func, Pst *pst, Buffer *mBuf)
1166 {
1167     if(pst->selector == ODU_SELECTOR_LWLC)
1168     {
1169        RlcUeReestablishReq *ueDelete;
1170        /* unpack the address of the structure */
1171        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueDelete, mBuf);
1172        ODU_PUT_MSG_BUF(mBuf);
1173        return (*func)(pst, ueDelete);
1174     }
1175     else
1176     {
1177        /* Nothing to do for other selectors */
1178        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Reestablishment Req ");
1179        ODU_PUT_MSG_BUF(mBuf);
1180     }
1181     return RFAILED;
1182 }
1183
1184 /*******************************************************************
1185 *
1186 * @brief Packs and Sends UE Reestablishment Response from RLC to DUAPP
1187 *
1188 * @details
1189 *
1190 *    Function : packRlcDuUeReestablishRsp
1191 *
1192 *    Functionality:
1193 *       Packs and Sends UE Reestablishment Response from RLC to DUAPP
1194 *
1195 *
1196 * @params[in] Post structure pointer
1197 *             RlcUeReestablishRsp *ueReestablish
1198 *
1199 * @return ROK     - success
1200 *         RFAILED - failure
1201 *
1202 * ****************************************************************/
1203
1204 uint8_t packRlcDuUeReestablishRsp(Pst *pst, RlcUeReestablishRsp *ueReestablish)
1205 {
1206    Buffer *mBuf = NULLP;
1207
1208    if(pst->selector == ODU_SELECTOR_LWLC)
1209    {
1210       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
1211       {
1212          DU_LOG("\nERROR  --> RLC : Memory allocation failed at packRlcDuUeReestablishRsp");
1213          return RFAILED;
1214       }
1215       /* pack the address of the structure */
1216       CMCHKPK(oduPackPointer,(PTR)ueReestablish, mBuf);
1217    }
1218    else
1219    {
1220       DU_LOG("\nERROR  -->  RLC: Only LWLC supported for packRlcDuUeReestablishRsp");
1221       return RFAILED;
1222    }
1223
1224    return ODU_POST_TASK(pst,mBuf);
1225 }
1226
1227 /*******************************************************************
1228 *
1229 * @brief Unpacks UE Reestablishment Response received from DU APP
1230 *
1231 * @details
1232 *
1233 *    Function : unpackRlcUeReestablishRsp
1234 *
1235 *    Functionality:
1236 *         Unpacks UE Reestablishment Response received from DU APP
1237 *
1238 * @params[in] Pointer to Handler
1239 *             Post structure pointer
1240 *             Message Buffer
1241 * @return ROK     - success
1242 *         RFAILED - failure
1243 *
1244 * ****************************************************************/
1245
1246 uint8_t unpackRlcUeReestablishRsp(RlcDuUeReestablishRsp func, Pst *pst, Buffer *mBuf)
1247 {
1248     if(pst->selector == ODU_SELECTOR_LWLC)
1249     {
1250        RlcUeReestablishRsp *ueReestablishRsp = NULLP;
1251        /* unpack the address of the structure */
1252        CMCHKUNPK(oduUnpackPointer, (PTR *)&ueReestablishRsp, mBuf);
1253        ODU_PUT_MSG_BUF(mBuf);
1254        return (*func)(pst, ueReestablishRsp);
1255     }
1256     else
1257     {
1258        /* Nothing to do for other selectors */
1259        DU_LOG("\nERROR  -->  RLC: Only LWLC supported for UE Reestablishment Response ");
1260        ODU_PUT_MSG_BUF(mBuf);
1261     }
1262
1263     return RFAILED;
1264 }
1265 /**********************************************************************
1266          End of file
1267 ***********************************************************************/