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