Modify licenses
[scp/ocu/5gnr.git] / Include / cuupCommon.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 ICT/CAS.
4 *
5 *   Licensed under the O-RAN Software License, Version 1.0 (the "Software 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 *       https://www.o-ran.org/software
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
20 #ifndef CU_UP_COMMON_H
21 #define CU_UP_COMMON_H
22
23 #include "vos_types.h"
24 #include "gnbServiceType.h"
25 #include "cuModuleCommon.h"
26 #include "cuModuleInterface.h"
27
28
29 #define CUUP_MAX_SESSION_NUM    256
30 #define CFG_OK                                  0
31 #define CFG_FAIL                                -1
32 #define SECURITY_PERFORMED              0
33 #define SECURITY_NOT_PERFORMED  1
34 #define CUUP_DL_HEAD_LEN                4       // SDAP MAX HEAD 1 + PDCP MAX HEAD +3
35 #define CUUP_UL_HEAD_LEN                0
36 #define AS_KEY_LEN                              4       //4 bytes
37
38 /**
39  * @brief calc function run time
40  */
41  #define CUUP_CALC_ELAPSED_TIME(func)                   \
42 ({                                                                              \
43     struct timeval start, end;                  \
44         INT64 diff;                                                     \
45     gettimeofday(&start,0);     \
46         func;                                                           \
47     gettimeofday(&end,0);                               \
48     diff = ( end.tv_sec*1000000L + end.tv_usec )                \
49         - ( start.tv_sec*1000000L + start.tv_usec );    \
50     vos_info_print("func %s spend time = %ld us\n",#func ,diff);\
51 })
52
53 /* brief UE E1AP ID */
54 typedef UINT32    CuupUeE1apId;
55
56 /* brief Session ID */
57 typedef UINT8    CuupSessionId;                 /* INTEGER (0 ..255) 38463 */
58
59 /* brief Data Radio Bearer ID */
60 typedef UINT8    CuupDrbId;
61
62 /* brief QFI */
63 typedef UINT8    CuupQFI;
64
65 typedef enum
66 {
67     PDU_SESSION_ADD,            /* SESSION TO SETUP */
68     PDU_SESSION_MOD,        /* SESSION TO MODIFY */
69     PDU_SESSION_DEL,        /* SESSION TO DELETE */
70     DRB_DEL,                            /* DRB TO DELETE */
71     UE_RELEASE
72 }UpcCfgType_e;
73
74 typedef struct
75 {
76         UINT64 ueE1apId;
77         UINT8  drbId;
78 }drbToDel_t;
79
80 typedef struct
81 {
82         UpcCfgType_e             cfgType;
83         UINT16                           pduSessionId;
84         INT8                             cfgResult;     //will be removed
85         UINT32                           nggtpuTeid;
86         TransLayerAddr_t         nggtpuAddr;
87         E1apCause_e                      failureCause;
88 }NguCfgResult_t;
89
90 typedef struct
91 {
92         UINT8           drbId;
93         E1apCause_e cause;
94 }DrbFailedCause_t;
95
96 typedef struct
97 {
98         UpcCfgType_e            cfgType;
99         UINT8                           secResPresent;
100         SecuResult_t            secuResult;
101         UINT16                          pduSessionId;
102         UINT8                           drbSetupSuccessNum;
103         UINT8                           drbSetupSuccessArray[MAX_DRB_NUM];
104         UINT8                           drbSetupFailNum;
105         DrbFailedCause_t        drbSetupFailedArray[MAX_DRB_NUM];
106         UINT8                           drbModifySuccessNum;
107         UINT8                           drbModifySuccessArray[MAX_DRB_NUM];
108         UINT8                           drbModifyFailNum;
109         DrbFailedCause_t        drbModifyFailedArray[MAX_DRB_NUM];
110         E1apCause_e                     pduSessionCause;
111 }PdcpuCfgResult_t;
112
113 typedef struct
114 {
115         UINT8  drbId;
116         UINT32 f1gtpuTeid;
117         TransLayerAddr_t gtpuAddr;
118 }Cuf1uSetupInfo_t;
119
120 typedef struct
121 {
122         UpcCfgType_e            cfgType;
123         UINT16                          pduSessionId;
124         UINT8                           drbSetupSuccessNum;
125         Cuf1uSetupInfo_t        drbSetupSuccessArray[MAX_DRB_NUM];
126         UINT8                           drbSetupFailNum;
127         DrbFailedCause_t        drbSetupFailedArray[MAX_DRB_NUM];
128         UINT8                           drbModifySuccessNum;
129         UINT8                           drbModifySuccessArray[MAX_DRB_NUM];
130         UINT8                           drbModifyFailNum;
131         DrbFailedCause_t        drbModifyFailedArray[MAX_DRB_NUM];
132         E1apCause_e                     pduSessionCause;
133 }Cuf1uCfgResult_t;
134
135 typedef enum
136 {
137         CUUP_BEARER_NORMAL,
138         CUUP_BERAER_SUSPEND,
139         CUUP_DETECT_DL_DATA  /* in suspend, ngu recv dl data */
140 }CuupBearerStatus_e;
141
142 typedef struct bearerCxtInactive_s
143 {
144     CuupUeE1apId ueId;
145     UINT8   tag;
146     union {
147         E1apDrbActivityList_t drbActivityList;
148         E1apPduSessionActivityList_t pduSessionActivityList;
149         E1apUeActivity_t ueActivity;
150     }u;
151 }BearerCxtInactive_t;
152 extern INT32 ifmUpcBearerCxtInactiveNotification(BearerCxtInactive_t *bearerCxtInactive);
153 extern INT32 ifmUpcDlDataNotification(UINT64 ueE1apId, UINT8 PPI);
154 #endif /* CU_UP_COMMON_H */