Release A code commit
[o-du/l2.git] / src / cu_stub / cu_stub.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 /* This functions contains main() for cu_app */
20
21 #include "cu_stub.h"
22 #include "cu_stub_sctp.h"
23
24 #define CU_ID 1
25 #define CU_NAME "ORAN_OAM_CU"
26 #define DU_IP_V4_ADDR "10.0.2.20"
27 #define CU_IP_V4_ADDR "10.0.2.25"
28 #define DU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0001"
29 #define CU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0011"
30 #define DU_PORT 38472
31 #define CU_PORT 38472 
32
33 /*******************************************************************
34  *
35  * @brief Handles SCTP notification 
36  *
37  * @details
38  *
39  *    Function : sctpNtfyInd
40  *
41  *    Functionality:
42  *         Handles SCTP notification
43  *
44  * @params[in] sctp notification
45  * @return void
46  *
47  ******************************************************************/
48 void sctpNtfyInd(CmInetSctpNotification *ntfy)
49 {
50 //TODO
51 }
52
53 /*******************************************************************
54  *
55  * @brief Main function of CU APP
56  *
57  * @details
58  *
59  *    Function : main
60  *
61  *    Functionality:
62  *         - Reads CU related configurations
63  *         - Initialize SCTP Parameters
64  *         - Start SCTP receiver thread
65  *
66  * @params[in] 
67  * @return ROK     - success
68  *         RFAILED - failure
69  *
70  * ****************************************************************/
71
72 S16 tst()
73 {
74    printf("\nStarting cu_app");
75    
76    /* Read CU configurations */
77    readCuCfg();
78
79    /* Initializing SCTP global parameters */
80    sctpActvInit(0, 0, 0, 0);
81  
82    /* Start CU-SCTP to listen on incoming connection */
83    sctpStartReq(); 
84
85    RETVALUE(ROK);
86 }
87
88 /*******************************************************************
89  *
90  * @brief Read CU related configuration
91  *
92  * @details
93  *
94  *    Function : readCuCfg
95  *
96  *    Functionality:
97  *            - RRead CU related configuration
98  *
99  * @params[in] 
100  * @return ROK     - success
101  *         RFAILED - failure
102  *
103  * ****************************************************************/
104
105 void readCuCfg()
106 {
107    U32 ipv4_du, ipv4_cu;
108
109    printf("\nReading CU configurations");
110
111    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
112    cmInetAddr((S8*)CU_IP_V4_ADDR, &ipv4_cu);
113    //U32 ipv6_int = inet_addr(DU_IP_V6_ADDR);
114  
115    cuCfgParams.cuId = CU_ID;
116    strcpy(cuCfgParams.cuName, CU_NAME);
117  
118    /* DU IP Address and Port*/
119    cuCfgParams.sctpParams.duIpAddr.ipV4Pres = true;
120    cuCfgParams.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
121    cuCfgParams.sctpParams.duIpAddr.ipV6Pres = false;
122    //strcpy(cuCfgParams.sctpParams.duIpAddr.ipV6Addr, (char*)DU_IP_V6_ADDR);
123    cuCfgParams.sctpParams.duPort = DU_PORT;
124
125    /* CU IP Address and Port*/
126    cuCfgParams.sctpParams.cuIpAddr.ipV4Pres = true;
127    cuCfgParams.sctpParams.cuIpAddr.ipV4Addr = ipv4_cu;
128    cuCfgParams.sctpParams.cuIpAddr.ipV6Pres = false;
129    //strcpy(cuCfgParams.sctpParams.cuIpAddr.ipV6Addr, DU_IP_V6_ADDR);
130    cuCfgParams.sctpParams.cuPort = CU_PORT;
131    
132 } /* End of readCuCfg */
133 /**********************************************************************
134          End of file
135 **********************************************************************/