14de3d8943389918e368148f39e08af5f8c0304d
[o-du/l2.git] / src / 5gnrrlc / rlc_mgr.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 /* This file defines API towards RLC interface */
19 #include "common_def.h"
20 #include "rgu.h"           /* RGU interface includes*/
21 #include "lkw.h"           /* LKW defines */
22 #include "ckw.h"           /* CKW defines */
23 #include "kwu.h"           /* KWU defines */
24 #include "kw_env.h"        /* RLC environment options */
25 #include "kw.h"            /* RLC defines */
26
27
28 /* header/extern include files (.x) */
29 #include "rgu.x"           
30 #include "lkw.x"           /* LKW */
31 #include "ckw.x"           /* CKW */
32 #include "kwu.x"           /* KWU */
33 #include "kw_err.h"
34 #include "kw.x"
35
36 #include "du_app_rlc_inf.h"
37 #include "rlc_mgr.h"
38
39 RlcUlDuUeCreateRsp rlcUlUeCreateRspOpts[] =
40 {
41    packRlcUlDuUeCreateRsp,     /* 0 - loosely coupled */
42    DuProcRlcUlUeCreateRsp,     /* 1 - tightly coupled */
43    packRlcUlDuUeCreateRsp,     /* 2 - LWLC loosely coupled */
44 };
45
46
47 /***********************************************************
48  *
49  * @brief  
50  *
51  *        Handler for the ue create response to DUAPP
52  *
53  * @b Description:
54  *
55  *        This function reports  ue create response to DUAPP
56  *
57  *  @param[in] post         Post structure  
58  *  @param[in] cfgRsp       ue create Config Response
59  *
60  *  @return  uint16_t
61  *      -# ROK 
62  *      -# RFAILED
63  *
64  *************************************************************/
65 uint8_t SendRlcUlUeCreateRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp)
66 {
67    /* jump to specific primitive depending on configured selector */
68    uint8_t ret = ROK;  
69    RlcUeCfgRsp *ueCreateRsp = NULLP;
70
71    RLC_ALLOC_SHRABL_BUF(pst->region, pst->pool, ueCreateRsp, sizeof(RlcUeCfgRsp));
72    if(!ueCreateRsp)
73    {  
74       DU_LOG("RLC: Memory allocation failed for ueCreateRsp at SendRlcUlUeCreateRspToDu()");
75       ret = RFAILED;
76    }
77    else
78    {
79       /* Mapping Old api to New Api */
80       fillRlcUlUeCfgRsp(ueCreateRsp, cfgRsp);
81       ret = (*rlcUlUeCreateRspOpts[pst->selector])(pst, ueCreateRsp);
82       if(ret)
83       {
84          DU_LOG("RLC: Failed at SendRlcUlUeCreateRspToDu()");
85          RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCreateRsp, sizeof(RlcUeCfgRsp));
86          ret = RFAILED;
87       }
88    }
89    return ret;
90 } /* end of SendRlcUlUeCreateRspToDu */
91
92 /**********************************************************************
93          End of file
94 **********************************************************************/