Modify licenses
[scp/ocu/5gnr.git] / Include / cuModuleCommon.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
21 #ifndef __CUMODULECOMMONH__
22 #define __CUMODULECOMMONH__
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include "gnbCommon.h"
29 #include "cuModuleEnum.h"
30
31 #define MAX_LENGTH_RAN_NAME         150
32
33 #define CU_MAX_PLMN_NUM       6
34 #define CU_MAX_UES_PER_CELL   32
35 #define CU_MAX_DU_NUM         2
36
37 #define CU_MAX_AMF_NUM         2
38 #define CU_MAX_UPF_NUM         2
39 #define CU_MAX_CUUP_NUM        4
40
41 #define CU_MAX_CUCP_NUM        2
42
43
44 #define CU_SEC_SNOW3G_ALGO_BITMASK 0x01
45 #define CU_SEC_AES_ALGO_BITMASK    0x02
46 #define CU_SEC_ZUC_ALGO_BITMASK    0x03
47
48 #define CU_MAX_AS_SEC_ALGOS   4
49
50 #define CU_MAX_SNSSAI_NUM               3
51
52 typedef enum cuSecAlgo_
53 {
54   CU_SEC_NULL_ALGO,
55   CU_SEC_SNOW3G_ALGO,
56   CU_SEC_AES_ALGO,
57   CU_SEC_ZUC_ALGO
58 } CuSecAlgo_e;
59
60
61 #define CU_INVALID_AP_ID             0xFFFFFFFF;
62
63 #define CU_SET_CU_UE_F1AP_ID(_cuUeF1apId,_cellIdx,_ueIdx)  CU_SET_TRANS_ID(_cuUeF1apId,_cellIdx,_ueIdx,0)
64
65 /* gNB Identity */
66 typedef UINT32  gNBId_t;
67
68 typedef struct
69 {
70         PlmnId_t        plmnId;
71         gNBId_t         gNBId;
72 }GlobalRanNodeId_t;
73
74 /* Ran name, a string */
75 typedef struct  RanName
76 {
77     char                    nodeName[MAX_LENGTH_RAN_NAME];
78 }RanName_t;
79
80 /* Tracking Area Code */
81 typedef struct  cuTac
82 {
83     UINT8                   tac[3];
84 }CuTac_t;
85
86 typedef struct  cuepsTac_s
87 {
88     UINT8                   tac[2];
89 }CuEpsTac_t;
90
91 /* S_NSSAI */
92 #define S_NSSAI_SD_PRESENT      (1 << 0)
93 typedef struct  SNssai
94 {
95     UINT16                  bitMask;
96     UINT8                   sst;
97     UINT32                  sd:24;/*optional*/
98 }SNssai_t;
99
100 typedef struct
101 {
102     UINT8                   sNssaiNum;
103     SNssai_t                sNssai[CU_MAX_SNSSAI_NUM];
104 }SliceList_t;
105
106 /* time stamp */
107 typedef struct  Timestamp
108 {
109     UINT8                   timeStamp[4];
110 }Timestamp_t;
111 /* NR-CGI */
112 typedef struct cuNrCgi
113 {
114     PlmnId_t                plmnId;
115     NrCellId_t              nrCellId;
116 }CuNrCgi_t;
117 /* TAI */
118 typedef struct Tai
119 {
120     PlmnId_t                plmnId;
121     CuTac_t                   tac;
122 }Tai_t;
123
124 /* masked imeisv */
125 typedef UINT64  MaskedImeiSv_t;
126
127 /* UE Identity Index value */
128 typedef struct UeIdIdxValue
129 {
130     UINT16                  ueIdIdxValue:10;
131 }UeIdIdxValue_t;
132
133 /* GTP Teid */
134 typedef UINT32  GtpTeid_t;
135
136 typedef struct recomRanGnbId
137 {
138         PlmnId_t                                plmnId;
139         gNBId_t                                 gNBId;
140 }RecomRanGnbId_t;
141
142 typedef struct transLayerAddr
143 {
144     UINT8                   transLayerAddress[20];
145         UINT8                                   bitStringSize;                  /* bit string size in bytes */
146 }TransLayerAddr_t;
147
148 typedef struct secuResult
149 {
150     IPResult_e               integrityProtectionResult;
151     CPResult_e               confidentialityProtectionResult;
152 } SecuResult_t;
153
154 typedef struct gtpTunnel
155 {
156     TransLayerAddr_t                        transLayerAddr;
157     GtpTeid_t                               gtpTeid;
158 } GtpTunnel_t;
159
160 typedef struct upTransLayerInfo
161 {
162     GtpTunnel_t                             gtpTunnel;
163 } UpTransLayerInfo_t;
164
165 typedef struct
166 {
167         IPIndication_e                                                  IPIndication;
168         CPIndication_e                                                  CPIndication;
169         MaxIpDataRate_e                                                 maxIPdataRate;
170 }SecuInd_t;
171
172 #define PRIORITY_LEVEL_QOS_PRESENT                  (1 << 0)
173 #define NON_DYNAMIC_AVERAGING_WINDOW_PRESENT        (1 << 1)
174 #define NON_DYNAMIC_MAX_DATA_BURST_VOLUME           (1 << 2)
175 typedef struct nonDynamic5QIDescr
176 {
177         UINT16                                                                  bitMask;
178         INT64                                                                   fiveQI;
179         INT64                                                                   priorityLevelQos;               /* OPTIONAL */
180         INT64                                                                   averagingWindow;                /* OPTIONAL */
181         INT64                                                                   maxDataBurstVolume; /* OPTIONAL */
182 } NonDynamic5QIDescr_t;
183
184 typedef struct
185 {
186         INT64                                                                   perScalar;
187         INT64                                                                   perExponent;
188 }PackErrorRate_t;
189
190 #define FIVEQI_PRESENT                              (1 << 0)
191 #define DELAY_CRITICAL_PRESENT                      (1 << 1)
192 #define DYNAMIC_AVERAGING_WINDOW_PRESENT            (1 << 2)
193 #define DYNAMIC_MAX_DATA_BURST_VOLUME               (1 << 3)
194 typedef struct dynamic5QIDescr
195 {
196         UINT16                                                                  bitMask;
197         INT64                                                                   priorityLevelQos;
198         INT64                                                                   packetDelayBudget;
199         PackErrorRate_t                                                 packetErrorRate;
200         INT64                                                                   fiveQI;                                 /* OPTIONAL */
201         Dynamic5QIDelayCritical_e                               delayCritical;                  /* OPTIONAL */
202         INT64                                                                   averagingWindow;                /* OPTIONAL */
203         INT64                                                                   maxDataBurstVolume;     /* OPTIONAL */
204 } Dynamic5QIDescr_t;
205
206 typedef struct QosCharact
207 {
208         QosCharacterPR_e        present;
209         union{
210                 NonDynamic5QIDescr_t                            nonDynamic5QI;
211                 Dynamic5QIDescr_t                                       dynamic5QI;
212         }choice;
213 } QosCharact_t;
214
215 typedef struct
216 {
217         PriorityLevel_e                                                 priorityLevel;
218         PreEmptionCapability_e                                  pre_emptionCapability;
219         PreEmptionVulnerability_e                               pre_emptionVulnerability;
220 }AllocAndRetenPriority_t;
221
222 typedef struct
223 {
224         SecuResult_t                    securityResult;
225         SecuInd_t                               securityIndication;
226 }UserPlaneSecurInfo_t;
227
228 #ifdef __cplusplus
229 }
230
231 #endif
232
233 #endif