E2AP changes Part2
[o-du/l2.git] / src / du_app / du_cfg.h
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 #ifndef __DU_CONFIG_H_
20 #define __DU_CONFIG_H__
21
22 #include "stdbool.h"
23 #include "du_app_mac_inf.h"
24 #include "du_log.h"
25 #include "odu_common_codec.h"
26
27 /* MACROS */
28 #define DU_INST 0
29 #define DU_ID 1
30 #define DU_IP_V4_ADDR "10.0.2.20"
31 #define CU_IP_V4_ADDR "10.0.2.25"
32 #define RIC_IP_V4_ADDR "10.0.2.30"
33 #define DU_PORT 38472
34 #define CU_PORT 38472
35 #define RIC_PORT 38482
36 #define DU_EGTP_PORT  39001
37 #define CU_EGTP_PORT  39002
38 #define NR_PCI 1
39 #define NR_CELL_ID 1
40 #define DU_NAME "ORAN_OAM_DU"
41 #define CELL_TYPE SMALL
42 #define DUPLEX_MODE DUP_MODE_TDD
43 #define DU_TAC 1
44 #define PLMN_MCC0 3
45 #define PLMN_MCC1 1
46 #define PLMN_MCC2 1
47 #define PLMN_MNC0 4
48 #define PLMN_MNC1 8
49 #define PLMN_MNC2 0
50 #define PLMN_SIZE 3
51 #define NR_ARFCN  2079427
52 #define SUL_ARFCN 100
53 #define NR_FREQ_BAND 257
54 #define SUL_BAND 2
55 #define TIME_CFG 0
56 #define CARRIER_IDX 1
57 #define NUM_TX_ANT 2
58 #define NUM_RX_ANT 2
59 #define FREQ_SHIFT_7P5KHZ FALSE
60 #define SSB_PBCH_PWR 0
61 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
62 #define SUBCARRIER_SPACING 3
63 #define PRB_OFFSET 0
64 #define BETA_PSS BETA_PSS_0DB
65 #define SSB_PERIODICITTY SSB_PRDCTY_MS_20
66 #define SSB_SUBCARRIER_OFFSET 0
67 #define SSB_MULT_CARRIER_BAND FALSE
68 #define MULT_CELL_CARRIER FALSE
69
70 #define PRACH_SEQ_LEN SHORT_SEQUENCE
71 #define PRACH_SUBCARRIER_SPACING 3
72 #define PRACH_RESTRICTED_SET_CFG UNRESTRICTED
73 #define NUM_PRACH_FDM 1
74 #define ROOT_SEQ_IDX 0
75 #define NUM_ROOT_SEQ 1
76 #define ZERO_CORRELATION_ZONE_CFG 2
77 #define NUM_UNUSED_ROOT_SEQ 1
78 #define UNUSED_ROOT_SEQ 1
79 #define SSB_PER_RACH 3
80 #define PRACH_MULT_CARRIER_BAND FALSE
81 #define TDD_PERIODICITY TX_PRDCTY_MS_2P5
82 #define RSS_MEASUREMENT_UNIT DONT_REPORT_RSSI
83
84 #define DU_PROC  0
85 #define DU_INST 0
86 #define DU_POOL  1
87 #define MAX_DU_PORT 2
88 #define F1_INTERFACE 0
89 #define E2_INTERFACE 1
90
91 #define SCTP_INST 0
92 #define EGTP_INST 0
93
94 /* Events */
95 #define EVTCFG 0
96
97 /* Selector */
98 #define DU_SELECTOR_LC   0
99 #define DU_SELECTOR_TC   1
100 #define DU_SELECTOR_LWLC 2
101
102 #ifdef EGTP_TEST
103 /* Macro definitions for EGTP procedures */
104 #define EGTP_LCL_TEID 1     /* EGTP local tunnel id */
105 #define EGTP_REM_TEID 10    /* EGTP remote tinnel id */
106 #endif
107
108
109 /* Macro definitions for F1 procedures */
110 #define CU_DU_NAME_LEN_MAX 30      /* Max length of CU/DU name string */
111 #define MAX_F1_CONNECTIONS 65536    /* Max num of F1 connections */
112 #define DU_MAX_CELLS       1      /* Max num of cells served by gNB-DU */
113 #define MAX_PLMN           6        /* Max num of broadcast PLMN ids */
114 #define MAXNRARFCN         3279165  /* Maximum values of NRAFCN */
115 #define MAXNRCELLBANDS     2       /* Maximum number of frequency bands */
116 #define MAX_NUM_OF_SLICE_ITEMS 1024     /* Maximum number of signalled slice support items */
117 #define MAXBPLMNNRMINUS1   1       /* Maximum number of PLMN Ids broadcast in an NR cell minus 1 */
118 #define MAXNUMOFSIBTYPES   32       /* Maximum number of SIB types */
119 #define MAX_UEID           512      /* Maximum number of UE Ids */
120 #define MAX_TNL_ASSOC      32       /* Max num of TNL Assoc between CU and DU */
121 #define MAXCELLINENB       256      /* Max num of cells served by eNB */
122 #define MAX_NUM_OF_UE_ID       65536    /* Max num of UEs served by DU */
123 #define MAXNUMOFUACPLMN    12       /* Maximum number of PLMN ids*/
124 #define MAXNUMOFUACPERPLMN 64       /* Maximum number of signalled categories per PLMN */
125 #define NR_RANAC           150      /* RANAC */
126 #define DEFAULT_CELLS      1        /* Max num of broadcast PLMN ids */
127
128
129 /* Macro definitions for MIB/SIB1 */
130 #define SYS_FRAME_NUM 0
131 #define SPARE 0
132 #define SSB_SC_OFFSET 8
133 #define CORESET_ZERO 1
134 #define SEARCH_SPACE_ZERO 8
135 #define DU_RANAC 1
136 #define CELL_IDENTITY 32
137
138 #ifdef EGTP_TEST
139 #define UE_ID 1
140 #define RB_ID 1
141 #define LC_ID 1
142 #endif
143
144 typedef enum
145 {
146    GNBDU,
147    GNBCU 
148 }F1Entity;
149
150 typedef enum
151 {
152    UNSPECIFIED,
153    RL_FAILURE_RLC,
154    INVALID_CU_UE_F1AP_ID,
155    INVALID_DU_UE_F1AP_ID,
156    INTERACTION_WITH_OTHER_PROC,
157    INVALID_QCI_VALUE,
158    RADIO_RELATED_REASON,
159    INSUFFICIENT_RADIO_RESOURCE,
160    PROCEDURE_CANCELLED,
161    NORMAL_RELEASE,
162    UNAVAILABLE_CELL,
163    RL_FAILURE_OTHERS,
164    UE_ACCESS_REJECTED,
165    SLICE_RESOURCE_UNAVAILABLE,
166    AMF_ABNORMAL_RELEASE,
167    INVALID_PLMN
168 }RadioNwCause;
169
170 typedef enum
171 {
172    TRANS_CAUSE_UNSPECIFIED,
173    TRANSPORT_RESOURCE_UNAVAIL
174 }TransLayerCause;
175
176 typedef enum
177 {
178    TRANSFER_SYNTAX_ERR,
179    ABSTRACT_SYNTAX_ERR_REJECT,
180    ABSTRACT_SYNTAX_ERR_NOTIFY,
181    INCOMPATIBLE_MESSAGE,
182    SEMANTIC_ERROR,
183    ABSTRACT_SYNTAX_ERR_MSG_CONSTRUCT,
184    PROTOCOL_CAUSE_UNSPECIFIED
185 }ProtocolCause;
186
187 typedef enum
188 {
189    CONTROL_PROC_OVERLOAD,
190    INSUFF_USER_PLANE_RESOURCE,
191    HARDWARE_FAILURE,
192    O_AND_M_INTERVENTION,
193    MISC_CAUSE_UNSPECIFIED
194 }MiscCause;
195
196 typedef enum
197 {
198   ALL
199 }F1ResetAll;
200
201 typedef enum 
202 {
203   IN_SERVICE,
204   OUT_OF_SERVICE
205 }SrvState;
206
207 typedef enum
208 {
209    INITIATING_MSG,
210    SUCCESSFUL_OUTCOME,
211    UNSUCCESSFUL_OUTCOME
212 }F1TriggMsgVal;
213
214 typedef enum
215 {
216    CRIT_REJECT,
217    CRIT_IGNORE,
218    CRIT_NOTIFY
219 }F1ProcCritVal;
220
221 typedef enum
222 {
223    NOT_UNDERSTOOD,
224    MISSING_IE
225 }F1ErrorType;
226
227 typedef enum
228 {
229    SCS_15,
230    SCS_30,
231    SCS_60,
232    SCS_120
233 }F1NrScs;
234
235 typedef enum
236 {
237    NRB_11,
238    NRB_18,
239    NRB_24,
240    NRB_25,
241    NRB_31,
242    NRB_32,
243    NRB_38,
244    NRB_51,
245    NRB_52,
246    NRB_65,
247    NRB_66,
248    NRB_78,
249    NRB_79,
250    NRB_93,
251    NRB_106,
252    NRB_107,
253    NRB_121,
254    NRB_132,
255    NRB_133,
256    NRB_135,
257    NRB_160,
258    NRB_162,
259    NRB_189,
260    NRB_216,
261    NRB_217,
262    NRB_245,
263    NRB_264,
264    NRB_270,
265    NRB_273
266 }F1Nrb;
267
268 typedef enum
269 {
270    VERY_SMALL,
271    SMALL,
272    MEDIUM,
273    LARGE
274 }F1CellType;
275
276 typedef enum
277 {
278    DL,
279    UL,
280    DL_UL
281 }F1CellDir;
282
283 typedef enum
284 {
285    UE_USAGE,
286    NON_UE_USAGE,
287    BOTH
288 }F1AssocUsage;
289
290 typedef enum
291 {
292    BARRED,
293    NOT_BARRED
294 }CellBarred;
295
296 typedef enum
297 {
298    OFFER,
299    EXECUTION
300 }F1ReqType;
301
302 typedef enum
303 {
304    IGNORE_YES,
305    IGNORE_NO
306 }F1IgnoreReq;
307
308 typedef enum
309 {
310    OVERLOADED,
311    NOT_OVERLOADED
312 }F1GnbDuOvrloadInfo;
313
314 typedef enum
315 {
316    REJECT_RRC_CONN_NON_EMERG_MODT,
317    REJECT_RRC_CONN_SIGNALLING,
318    PERMIT_EMERG_SESSION_AND_MOBILE_TERM_SERVICE,
319    PERMIT_HIGH_PRIOR_SESSION_AND_MOBILE_TERM_SERVICE
320 }F1UacStandardAction;
321
322 typedef struct f1RrcVersion
323 {
324    char    rrcVer[30];     /* Latest RRC Version */
325    uint32_t   extRrcVer;  /* Latest RRC version extended */
326 }F1RrcVersion;
327
328 typedef struct f1FailCause
329 {
330    union
331    {
332       RadioNwCause      radioNwCause;     /* Radio Network Layer Cause */
333       TransLayerCause   transLayerCause;  /* Transport Layer Cause */
334       ProtocolCause     protCause;        /* Protocol Cause */
335       MiscCause         miscCause;        /* Miscellaneous Cause */
336    }cause;
337 }F1FailCause;
338
339 typedef struct f1ProcCode
340 {
341    bool   pres;
342    uint8_t     value;
343 }F1ProcCode;
344
345 typedef struct f1TriggMsg
346 {
347    bool   pres;
348    F1TriggMsgVal   value;
349 }F1TriggMsg;
350
351 typedef struct f1ProcCrit
352 {
353    bool   pres;
354    F1ProcCritVal   value;
355 }F1ProcCrit;
356
357 typedef struct f1CritDignosIE
358 {
359    F1ProcCritVal   ieCritVal;
360    uint16_t             ieId;
361    F1ErrorType       type;
362 }F1CritDignosIE;
363
364 typedef struct f1CritDiagnostic
365 {
366    bool         pres;
367    F1ProcCode   procCode;      /* Procedure Code */
368    F1TriggMsg   triggeringMsg; /* Triggering Message */
369    F1ProcCrit   procCrit;      /* Criticality of Triggering msg/proc */
370    uint32_t          transId;
371    F1CritDignosIE diagnosIE;
372 }F1CritDiagnostic;
373
374 typedef struct f1FailureIE
375 {
376    uint32_t                transId;        /* Uniquely identify transaction */
377    F1FailCause        cause;          /* Failure cause */
378    uint8_t                 timeToWait;     /* Seconds to be waited before retry */
379    F1CritDiagnostic   critDiagnostic; /* Critical diagnostics */
380 }F1FailureIE;
381
382 typedef struct f1LogicalConnUeAssoc
383 {
384    uint32_t   gnbCuUeF1apId;
385    uint32_t   gnbDuUeF1apId;
386 }F1LogicalConnUeAssoc;
387
388 typedef struct f1ResetType
389 {
390    union
391    {
392       F1ResetAll             resetAll; /* Reset All */
393       F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* In case of Partial Reset : UE associated logical F1 conn list*/
394    }type;
395 }F1ResetType;
396
397 typedef struct nrEcgi
398 {
399   Plmn  plmn;
400   uint16_t     cellId;
401 }NrEcgi;
402
403 typedef struct f1SibType
404 {
405    uint8_t   sibType;
406    uint8_t   sibMsg;
407    uint8_t   value;
408 }F1SibType;
409
410 typedef struct f1TxBw
411 {
412    F1NrScs   nrScs; /* NR subcarrier spacing */
413    F1Nrb     nrb;   /* Transmission bandwidth expressed in units of RBs */
414 }F1TxBw;
415
416 typedef struct f1SulInfo
417 {
418    uint32_t      sulArfcn; /* SUL ARFCN */
419    F1TxBw   sulTxBw;  /* SUL transmission bandwidth */ 
420 }F1SulInfo;
421
422 typedef struct f1FreqBand
423 {
424   uint16_t   nrFreqBand;
425   uint16_t   sulBand[MAXNRCELLBANDS];
426 }F1FreqBand;
427
428 typedef struct f1NrFreqInfo
429 {
430    uint32_t        nrArfcn;
431    F1SulInfo  sulInfo;
432    F1FreqBand freqBand[MAXNRCELLBANDS];
433 }F1NrFreqInfo;
434
435 typedef struct f1NrFddInfo
436 {
437    F1NrFreqInfo   ulNrFreqInfo;  /* UL NR Frequency Info */
438    F1NrFreqInfo   dlNrFreqInfo;  /* DL NR Frequency Info */
439    F1TxBw         ulTxBw;        /* UL Transmission bandwidth */
440    F1TxBw         dlTxBw;        /* DL Transmission bandwidth */
441 }F1NrFddInfo;
442
443 typedef struct f1NrTddInfo
444 {
445    F1NrFreqInfo   nrFreqInfo;   /* NR Frequency Info */
446    F1TxBw       nrTxBw;       /* NR Transmission Bandwidth */
447 }F1NrTddInfo;
448
449 typedef struct f1NrModeInfo
450 {
451    union
452    {
453       F1NrFddInfo  fdd;
454       F1NrTddInfo  tdd;
455    }mode;
456 }NrModeInfo;
457
458 typedef struct f1EutraFddInfo
459 {
460    uint16_t   ulOffset;   /* UL offset to Point A */
461    uint16_t   dlOffset;   /* DL offset to Point A */
462 }F1EutraFDDInfo;
463
464 typedef struct f1EutraTddInfo
465 {
466    uint16_t   tddOffset;  /* Offset to Point A */
467 }F1EutraTDDInfo;
468
469 typedef struct f1EutraModeInfo
470 {
471    union
472    {
473       F1EutraFDDInfo  fdd;
474       F1EutraTDDInfo  tdd;
475    }mode;
476 }F1EutraModeInfo;
477
478 typedef struct f1Snsaai
479 {
480    uint8_t   sst;
481    uint32_t  sd;
482 }F1Snsaai;
483
484 typedef struct epIpAddr
485 {
486    char transportAddr[20]; /* Transport Layer Address */
487 }EpIpAddr;
488
489 typedef struct epIpAddrPort
490 {
491     EpIpAddr epIpAddr;
492     char   port[2];
493 }EpIpAddrPort;
494
495 typedef struct f1TaiSliceSuppLst
496 {
497    bool       pres;
498    F1Snsaai   snssai[MAX_NUM_OF_SLICE_ITEMS];   
499 }F1TaiSliceSuppLst;
500
501 typedef struct f1SrvdPlmn
502 {
503    Plmn              plmn;
504    F1TaiSliceSuppLst   taiSliceSuppLst;
505 }F1SrvdPlmn;
506
507 typedef struct f1BrdcstPlmnInfo
508 {
509    Plmn   plmn[MAX_PLMN];     /* PLMN id list */
510    Plmn   extPlmn[MAX_PLMN];   /* Extended PLMN id list */
511    uint16_t      tac;                     /* 5GS-TAC */
512    uint32_t      nrCellId;                /* NR Cell id */
513    uint8_t       ranac;                   /* RAN Area code */
514 }F1BrdcstPlmnInfo;
515
516 typedef struct f1CellInfo
517 {
518    NrEcgi   nrCgi;                   /* Cell global Identity */
519    uint32_t      nrPci;                   /* Physical Cell Identity */
520    Plmn   plmn[MAX_PLMN];     /* Available PLMN list */
521    Plmn   extPlmn[MAX_PLMN];  /* Extended available PLMN list */
522 }F1CellInfo;
523
524 typedef struct f1DuCellInfo
525 {
526    F1CellInfo         cellInfo;     /* cell info */
527    uint16_t                tac;          /* tracking area code */
528    uint16_t                epsTac;       /* Configured EPS TAC */
529    NrModeInfo         f1Mode;       /* NR mode info : FDD/TDD */
530    uint8_t                 measTimeCfg;  /* Measurement timing configuration */
531    F1CellDir          cellDir;      /* Cell Direction */
532    F1CellType         cellType;     /* Cell Type */
533    F1BrdcstPlmnInfo   brdcstPlmnInfo[MAXBPLMNNRMINUS1]; /* Broadcast PLMN Identity Info List */
534 }F1DuCellInfo;
535
536 typedef struct f1DuSysInfo
537 {
538    uint8_t   *mibMsg;   /* MIB message */
539    uint8_t   *sib1Msg;  /* SIB1 message */
540 }F1DuSysInfo;
541
542 typedef struct f1CuSysInfo
543 {
544    F1SibType   sibTypeToUpd[MAXNUMOFSIBTYPES];   /* SIB types to be updated */
545 }F1CuSysInfo;
546
547 typedef struct f1DuSrvdCellInfo
548 {
549    F1DuCellInfo   duCellInfo;   /* gNB-DU served cell info */
550    F1DuSysInfo    duSysInfo;    /* gNB-DU System Information */
551 }F1DuSrvdCellInfo;
552
553 typedef struct f1DuSrvdCellToDel
554 {
555    NrEcgi             oldNrCgi;     /* Old NR CGI */
556    F1DuSrvdCellInfo   srvdCellInfo; /* Info of served cell to be deleted */ 
557 }F1DuSrvdCellToDel;
558
559 typedef struct f1CuActCellInfo
560 {
561    F1CellInfo    cuCellInfo;   /* gNB-CU available cell info */
562    F1CuSysInfo   cuSysInfo;    /* gNB-CU System Information */
563 }F1CuActCellInfo;
564
565 typedef struct f1ActCellFail
566 {
567    NrEcgi        nrCgi;
568    F1FailCause   cause;
569 }F1ActCellFail;
570
571 typedef struct srvStatus
572 {
573   SrvState    state;
574   bool        switchOffOngoing;
575 }SrvStatus;
576
577 typedef struct f1CellStatus
578 {
579    NrEcgi      nrEcgi;
580    SrvStatus   status;   /* Service status */
581 }F1CellStatus;
582
583 typedef struct f1DedSIDelUE
584 {
585    uint32_t      gnbCuUeF1apId;
586    NrEcgi   nrEcgi;
587 }F1DedSIDelUE;
588
589 typedef struct tnlAssocInfo
590 {
591    bool           pres;
592    EpIpAddr       epIpAddr;      /* Endpoint-IP Address */
593    EpIpAddrPort   epIpAddrport;  /* Endpoint-IP Address and Port */
594 }F1TnlAssocAddr;
595
596 typedef struct f1TnlAssocUsage
597 {
598     bool           pres;
599     F1AssocUsage   usage;
600 }F1TnlAssocUsage;
601
602 typedef struct f1TnlAssoc
603 {
604    F1TnlAssocAddr   assocInfo;    /* TNL Assoc Transport Layer Info */
605    F1TnlAssocUsage  assocUsage;   /* TNL Assoc usage */
606 }F1TnlAssoc;
607
608 typedef struct f1TnlAssocToRmv
609 {
610    F1TnlAssocAddr   assocInfoCu;   /* TNL Assoc Transport Layer Info of CU */
611    F1TnlAssocAddr   assocInfoDu;   /* TNL Assoc Transport Layer Info of DU */
612 }F1TnlAssocToRmv;
613
614 typedef struct f1TnlAssocSetupFail
615 {
616    F1TnlAssocAddr   assocInfo;
617    F1FailCause      cause;
618 }F1TnlAssocSetupFail;
619
620
621 typedef struct f1CellBarred
622 {
623    NrEcgi       nrcgi;
624    CellBarred   cellBarred;
625 }F1CellBarred;
626
627 typedef struct f1EutraCell
628 {
629    uint32_t                eutraCellId; /* EUTRA cell id */
630    F1EutraModeInfo    mode;        /* EUTRA mode info : FDD/TDD */
631    uint8_t                 rsrcInd;     /* Protected EUTRA resource Indication */
632 }F1EutraCell;
633
634 typedef struct f1ProtectEUTRARsrc
635 {
636    uint32_t           specShareGrpId;               /* Spectrum sharing group id */
637    F1EutraCell   eutraCellList[MAXCELLINENB];  /* EUTRA cells list */
638 }F1ProtectEUTRARsrc;
639
640 typedef struct f1UacOperatorDefined
641 {
642    uint8_t   accessCategory;
643    uint8_t   accessId; 
644 }F1UacOperatorDefined;
645
646 typedef struct f1UacCategoryType
647 {
648    union
649    {
650       F1UacStandardAction    action;      /* UAC standardized action */
651       F1UacOperatorDefined   operatorDef; /* UAC operator defined */
652    }type;
653 }F1UacCategoryType;
654
655 typedef struct f1UacType
656 {
657    uint8_t                  uacReducInd;     /* Value 0 means no access rate reduction. Value 100 means full access rate reduction */
658    F1UacCategoryType   uacCategoryType; /* UAC Category type */
659 }F1UacType;
660
661 /* Unified Access Class Assistance Information */
662 typedef struct f1UacAssistInfo
663 {
664    Plmn      plmn[MAXNUMOFUACPLMN];        /* UAC PLMN list */
665    F1UacType   uacType[MAXNUMOFUACPERPLMN];  /* UAC Type list */
666 }F1UacAssistInfo;
667
668 /* F1 setup related structures */
669
670 typedef struct f1SetupReq
671 {
672   uint32_t                transId;                       /* Uniquely identify transaction */
673   uint32_t                duId;                          /* DU ID */ 
674   char               duName[CU_DU_NAME_LEN_MAX];    /* DU name */
675   F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list */
676   F1RrcVersion       rrcVersion;                    /* RRC version */
677 }F1SetupReq;
678
679 typedef struct f1setupRsp
680 {
681   uint32_t               transId;                      /* Uniquely identify transaction */
682   char              cuName[CU_DU_NAME_LEN_MAX];   /* CU Name */
683   F1CuActCellInfo   actCellInfo;                  /* cells to be activated */
684   F1RrcVersion      rrcVersion;                   /* RRC version */
685 }F1SetupRsp;
686
687 typedef struct f1SetupFail
688 {
689    F1FailureIE   setupFail;
690 }F1SetupFail;
691
692 /* At reception of the RESET message the gNB-DU shall release all allocated resources on F1 
693  * and radio resources related to the UE association(s) indicated explicitly or implicitly in 
694  * the RESET message and remove the indicated UE contexts including F1AP ID. */
695 typedef struct f1Reset
696 {
697   uint32_t              transId;   /* Uniquely identify transaction */
698   F1FailCause      cause;     /* Failure cause */
699   F1ResetType      resetType; /* type of reset */
700 }F1Reset;
701
702 /* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated
703  * UE associations which can be used for new UE-associated logical F1-connections over the F1 interface,
704  *  the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */
705 typedef struct f1ResetAck
706 {
707   uint32_t                    transId;         /* Uniquely identify transaction */
708   F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */
709   F1CritDiagnostic       critDiagnostic;  /* Critical diagnostics */
710 }F1ResetAck;
711
712 typedef struct f1ErrorInd
713 {
714   uint32_t                transId;         /* Uniquely identify transaction */
715   F1Entity           errorOrigin;     /* Specifies if error is originated at DU or CU */
716   F1FailCause        cause;           /* Failure cause */
717 /* If failure is due to Ue related message. */
718   uint32_t                gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
719   uint32_t                gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
720   F1CritDiagnostic   critDiagnostic;  /* Critical diagnostics */
721 }F1ErrorInd;
722
723 typedef struct f1GnbDuCfgUpd
724 {
725   uint32_t                 transId;                             /* Uniquely identify transaction */
726   F1DuSrvdCellInfo    srvdCellLstAdd[DU_MAX_CELLS];      /* Served cell list to be added */
727   F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
728   NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
729   F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
730   F1DedSIDelUE        ueLst[MAX_UEID];                     /* Ue list that requires dedicated SI delivery */
731   uint32_t            gnbDuId;
732   F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
733 }F1GnbDuCfgUpd;
734
735 typedef struct f1GnbDuCfgUpdAck
736 {
737    uint32_t           transId;                      /* Uniquely identify transaction */
738    F1CuActCellInfo    cellLstAct[DU_MAX_CELLS];    /* List of cells to be activated */   
739    F1CritDiagnostic   critDiagnostic;               /* Critical diagnostics */
740    NrEcgi             cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */
741 }F1GnbDuCfgUpdAck;
742
743 typedef struct f1GnbDuCfgUpdFail
744 {
745    F1FailureIE   gnbDuCfgUpdFail;
746 }F1GnbDuCfgUpdFail;
747
748 /* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */
749 typedef struct f1GnbCuCfgUpd
750 {
751     uint32_t            transId;                            /* Uniquely identifies transaction */
752     F1CuActCellInfo     cellLstAct[DU_MAX_CELLS];         /* List of cells to be activated */
753     NrEcgi              cellLstDeact[DU_MAX_CELLS];       /* List of cells to be deactivated */
754     F1TnlAssoc          assocLstAdd[MAX_TNL_ASSOC];     /* List of TNL assocs to be added */
755     F1TnlAssoc          assocLstUpd[MAX_TNL_ASSOC];     /* List of TNL assocs to be updated */
756     F1TnlAssocToRmv     assocLstRmv[MAX_TNL_ASSOC];     /* List of TNL assocs to be removed */
757     F1CellBarred        cellToBarList[DU_MAX_CELLS];      /* List of Cells to be barred */
758     F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
759 }F1GnbCuCfgUpd;
760
761 /* Sent by a gNB-DU to a gNB-CU to acknowledge update of information
762  * associated to an F1-C interface instance */
763 typedef struct f1GnbCuCfgUpdAck
764 {
765     uint32_t              transId;                              /* Uniquely identify transaction */
766     F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
767     F1CritDiagnostic      critDiagnostic;                       /* Critical diagnostics */
768     F1TnlAssocAddr        assocSetupList[MAX_TNL_ASSOC];     /* TNL Assoc Setup list */
769     F1TnlAssocSetupFail   assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */
770     F1DedSIDelUE          dedSiDelUelist[MAX_NUM_OF_UE_ID];          /* Dedicated SI delivery needed UE list */
771 }F1GnbCuCfgUpdAck;
772
773 typedef struct f1GnbCuCfgUpdFail
774 {
775     F1FailureIE   gnbCuCfgUpdFail;
776 }F1GnbCuCfgUpdFail;
777
778 /* This procedure enables coordination of radio resource allocation between a gNB-CU and
779  * a gNB-DU. Coordination request is sent by CU to DU */
780 typedef struct f1GnbDuRsrcCoordReq
781 {
782    uint32_t      transId;              /* Uniquely identifies transaction */
783    F1ReqType     reqType;              /* Request type */
784    uint8_t       cellResCoordReqCont;  /* Container for X2AP E-UTRA - NR cell resource coordination request */
785    F1IgnoreReq   ignoreReq;            /* Ignore coordination request */
786 }F1GnbDuRsrcCoordReq;
787
788 /* This message is sent by a gNB-DU to a gNB-CU, to express the desired resource allocation
789  * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */
790 typedef struct f1GnbDuRsrcCoordRsp
791 {
792     uint32_t   transId;               /* Uniquely identifies transaction */
793     uint8_t    cellResCoordRspCont;   /* Container for X2AP E-UTRA - NR cell resource coordination response */
794 }F1GnbDuRsrcCoordRsp;
795
796 /* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */
797 typedef struct f1GnbDuStatusInd
798 {
799    uint32_t                  transId;      /* Uniquely identifies transaction */
800    F1GnbDuOvrloadInfo   ovrloadInfo;  /* gNB-DU overloaded information */
801 }F1GnbDuStatusInd;
802
803 /* This message is sent by either the gNB-DU or the gNB-CU to intiate the removal
804  * of the interface instance and the related resources */
805 typedef struct f1RmvReq
806 {
807    uint32_t   transId; /* Uniquely identifies transaction */
808 }F1RmvReq;
809
810 /* This message acknowledges the initiation of removal of the interface
811  * instance and the related resources */
812 typedef struct f1RmvRsp
813 {
814    uint32_t           transId;     /* Uniquely identifies transaction */
815    F1CritDiagnostic   critDiagnos; /* Crititcality diagnostics */
816 }F1RmvRsp;
817
818 /* This message indicates that removing the interface instance and the related
819  * resources cannot be accepted */
820 typedef struct f1RmvFail
821 {
822    uint32_t           transId;         /* Uniquely identifies transaction */
823    F1FailCause        cause;          /* Failure cause */
824    F1CritDiagnostic   critDiagnostic; /* Criticality diagnostics */
825 }F1RmvFail;
826
827 /* This message is sent by the gNB-CU to indicate to the gNB-DU a need to reduce
828  * the rate at which UEs access the network. */
829 typedef struct f1NwkAccessRateRed
830 {
831    uint32_t          transId;        /* Uniquely identifies transaction */
832    F1UacAssistInfo   uacAssistInfo;  /* UAC Assistance Information */
833 }F1NwkAccessRateRed;
834
835 typedef struct f1Ipaddr
836 {
837  bool ipV4Pres;
838  uint32_t  ipV4Addr; 
839 }F1IpAddr;
840
841 typedef struct sctpParams
842 {
843    F1IpAddr  duIpAddr;
844    U16       duPort[MAX_DU_PORT];
845    F1IpAddr  cuIpAddr;
846    U16       cuPort;
847    F1IpAddr  ricIpAddr;
848    U16       ricPort;
849 }SctpParams;
850
851 typedef struct f1EgtpParams
852 {
853    F1IpAddr  localIp;      /* Ip address of local node */
854    uint16_t  localPort;    /* Sender Port at local node */
855    F1IpAddr  destIp;       /* Ip address of peer node */
856    uint16_t  destPort;     /* Sender port at peer node */
857    uint32_t  minTunnelId;
858    uint32_t  maxTunnelId;
859 }F1EgtpParams;
860
861 typedef struct schedulerCfg
862 {
863    uint8_t         numTxAntPorts;    /*!< Number of Tx antenna ports */
864    uint8_t         ulSchdType;     /*!< Indicates which UL scheduler to use, range
865                                * is 0..(number of schedulers - 1) */
866    uint8_t         dlSchdType;     /*!< Indicates which DL scheduler to use, range
867                                * is 0..(number of schedulers - 1) */
868    uint8_t         numCells;       /*!< Max number of cells */
869    uint8_t         maxUlUePerTti;  /*!< Max number of UE in UL per TTI */
870    uint8_t         maxDlUePerTti;  /*!< Max number of UE in DL per TTI */
871 }SchedulerCfg;
872
873 typedef struct mibParams
874 {
875         uint8_t sysFrmNum;
876         long    subCarrierSpacingCommon;
877         long    ssb_SubcarrierOffset;
878         long    dmrs_TypeA_Position;
879         long    controlResourceSetZero;
880         long    searchSpaceZero;
881         long    cellBarred;
882         long    intraFreqReselection;
883 }MibParams;
884
885 typedef struct sib1Params
886 {
887         Plmn    plmn;
888         uint8_t   tac;
889         long      ranac;
890         uint8_t   cellIdentity;
891         long      cellResvdForOpUse;
892 }Sib1Params;
893
894 typedef struct duCfgParams
895 {
896    SctpParams         sctpParams;                  /* SCTP Params */
897    F1EgtpParams       egtpParams;                  /* EGTP Params */
898    uint32_t           maxUe;
899    uint32_t           duId;
900    uint8_t            duName[CU_DU_NAME_LEN_MAX];
901    SchedulerCfg       schedCfg;
902    F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];  /* Serving cell list *///TODO: this must be removed eventually
903    F1RrcVersion       rrcVersion;                 /* RRC version */
904    MacCellCfg          macCellCfg;                    /* MAC cell configuration */
905    MibParams          mibParams;                  /* MIB Params */
906    Sib1Params         sib1Params;                 /* SIB1 Params */
907 }DuCfgParams;
908
909 /*function declarations */
910 void FillSlotConfig();
911 S16 readClCfg();
912 S16 readCfg();
913 S16 duReadCfg(); 
914 S16 bitStringToInt(BIT_STRING_t *bitString, uint16_t *val);
915
916 #endif /* __DU_CONFIG_H__ */
917
918 /**********************************************************************
919          End of file
920 **********************************************************************/