Trigger_macCellCfg
[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 OFFSET_TO_POINT_A 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    uint16_t  mibLen;
540    uint8_t   *sib1Msg;  /* SIB1 message */
541    uint16_t  sib1Len;
542 }F1DuSysInfo;
543
544 typedef struct f1CuSysInfo
545 {
546    F1SibType   sibTypeToUpd[MAXNUMOFSIBTYPES];   /* SIB types to be updated */
547 }F1CuSysInfo;
548
549 typedef struct f1DuSrvdCellInfo
550 {
551    F1DuCellInfo   duCellInfo;   /* gNB-DU served cell info */
552    F1DuSysInfo    duSysInfo;    /* gNB-DU System Information */
553 }F1DuSrvdCellInfo;
554
555 typedef struct f1DuSrvdCellToDel
556 {
557    NrEcgi             oldNrCgi;     /* Old NR CGI */
558    F1DuSrvdCellInfo   srvdCellInfo; /* Info of served cell to be deleted */ 
559 }F1DuSrvdCellToDel;
560
561 typedef struct f1CuActCellInfo
562 {
563    F1CellInfo    cuCellInfo;   /* gNB-CU available cell info */
564    F1CuSysInfo   cuSysInfo;    /* gNB-CU System Information */
565 }F1CuActCellInfo;
566
567 typedef struct f1ActCellFail
568 {
569    NrEcgi        nrCgi;
570    F1FailCause   cause;
571 }F1ActCellFail;
572
573 typedef struct srvStatus
574 {
575   SrvState    state;
576   bool        switchOffOngoing;
577 }SrvStatus;
578
579 typedef struct f1CellStatus
580 {
581    NrEcgi      nrEcgi;
582    SrvStatus   status;   /* Service status */
583 }F1CellStatus;
584
585 typedef struct f1DedSIDelUE
586 {
587    uint32_t      gnbCuUeF1apId;
588    NrEcgi   nrEcgi;
589 }F1DedSIDelUE;
590
591 typedef struct tnlAssocInfo
592 {
593    bool           pres;
594    EpIpAddr       epIpAddr;      /* Endpoint-IP Address */
595    EpIpAddrPort   epIpAddrport;  /* Endpoint-IP Address and Port */
596 }F1TnlAssocAddr;
597
598 typedef struct f1TnlAssocUsage
599 {
600     bool           pres;
601     F1AssocUsage   usage;
602 }F1TnlAssocUsage;
603
604 typedef struct f1TnlAssoc
605 {
606    F1TnlAssocAddr   assocInfo;    /* TNL Assoc Transport Layer Info */
607    F1TnlAssocUsage  assocUsage;   /* TNL Assoc usage */
608 }F1TnlAssoc;
609
610 typedef struct f1TnlAssocToRmv
611 {
612    F1TnlAssocAddr   assocInfoCu;   /* TNL Assoc Transport Layer Info of CU */
613    F1TnlAssocAddr   assocInfoDu;   /* TNL Assoc Transport Layer Info of DU */
614 }F1TnlAssocToRmv;
615
616 typedef struct f1TnlAssocSetupFail
617 {
618    F1TnlAssocAddr   assocInfo;
619    F1FailCause      cause;
620 }F1TnlAssocSetupFail;
621
622
623 typedef struct f1CellBarred
624 {
625    NrEcgi       nrcgi;
626    CellBarred   cellBarred;
627 }F1CellBarred;
628
629 typedef struct f1EutraCell
630 {
631    uint32_t                eutraCellId; /* EUTRA cell id */
632    F1EutraModeInfo    mode;        /* EUTRA mode info : FDD/TDD */
633    uint8_t                 rsrcInd;     /* Protected EUTRA resource Indication */
634 }F1EutraCell;
635
636 typedef struct f1ProtectEUTRARsrc
637 {
638    uint32_t           specShareGrpId;               /* Spectrum sharing group id */
639    F1EutraCell   eutraCellList[MAXCELLINENB];  /* EUTRA cells list */
640 }F1ProtectEUTRARsrc;
641
642 typedef struct f1UacOperatorDefined
643 {
644    uint8_t   accessCategory;
645    uint8_t   accessId; 
646 }F1UacOperatorDefined;
647
648 typedef struct f1UacCategoryType
649 {
650    union
651    {
652       F1UacStandardAction    action;      /* UAC standardized action */
653       F1UacOperatorDefined   operatorDef; /* UAC operator defined */
654    }type;
655 }F1UacCategoryType;
656
657 typedef struct f1UacType
658 {
659    uint8_t                  uacReducInd;     /* Value 0 means no access rate reduction. Value 100 means full access rate reduction */
660    F1UacCategoryType   uacCategoryType; /* UAC Category type */
661 }F1UacType;
662
663 /* Unified Access Class Assistance Information */
664 typedef struct f1UacAssistInfo
665 {
666    Plmn      plmn[MAXNUMOFUACPLMN];        /* UAC PLMN list */
667    F1UacType   uacType[MAXNUMOFUACPERPLMN];  /* UAC Type list */
668 }F1UacAssistInfo;
669
670 /* F1 setup related structures */
671
672 typedef struct f1SetupReq
673 {
674   uint32_t                transId;                       /* Uniquely identify transaction */
675   uint32_t                duId;                          /* DU ID */ 
676   char               duName[CU_DU_NAME_LEN_MAX];    /* DU name */
677   F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];   /* Serving cell list */
678   F1RrcVersion       rrcVersion;                    /* RRC version */
679 }F1SetupReq;
680
681 typedef struct f1setupRsp
682 {
683   uint32_t               transId;                      /* Uniquely identify transaction */
684   char              cuName[CU_DU_NAME_LEN_MAX];   /* CU Name */
685   F1CuActCellInfo   actCellInfo;                  /* cells to be activated */
686   F1RrcVersion      rrcVersion;                   /* RRC version */
687 }F1SetupRsp;
688
689 typedef struct f1SetupFail
690 {
691    F1FailureIE   setupFail;
692 }F1SetupFail;
693
694 /* At reception of the RESET message the gNB-DU shall release all allocated resources on F1 
695  * and radio resources related to the UE association(s) indicated explicitly or implicitly in 
696  * the RESET message and remove the indicated UE contexts including F1AP ID. */
697 typedef struct f1Reset
698 {
699   uint32_t              transId;   /* Uniquely identify transaction */
700   F1FailCause      cause;     /* Failure cause */
701   F1ResetType      resetType; /* type of reset */
702 }F1Reset;
703
704 /* After the gNB-CU has released all assigned F1 resources and the UE F1AP IDs for all indicated
705  * UE associations which can be used for new UE-associated logical F1-connections over the F1 interface,
706  *  the gNB-CU shall respond with the RESET ACKNOWLEDGE message. */
707 typedef struct f1ResetAck
708 {
709   uint32_t                    transId;         /* Uniquely identify transaction */
710   F1LogicalConnUeAssoc   ueAssocLogicalConn[MAX_F1_CONNECTIONS]; /* UE associated logical F1-connection list */
711   F1CritDiagnostic       critDiagnostic;  /* Critical diagnostics */
712 }F1ResetAck;
713
714 typedef struct f1ErrorInd
715 {
716   uint32_t                transId;         /* Uniquely identify transaction */
717   F1Entity           errorOrigin;     /* Specifies if error is originated at DU or CU */
718   F1FailCause        cause;           /* Failure cause */
719 /* If failure is due to Ue related message. */
720   uint32_t                gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
721   uint32_t                gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
722   F1CritDiagnostic   critDiagnostic;  /* Critical diagnostics */
723 }F1ErrorInd;
724
725 typedef struct f1GnbDuCfgUpd
726 {
727   uint32_t                 transId;                             /* Uniquely identify transaction */
728   F1DuSrvdCellInfo    srvdCellLstAdd[DU_MAX_CELLS];      /* Served cell list to be added */
729   F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
730   NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
731   F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
732   F1DedSIDelUE        ueLst[MAX_UEID];                     /* Ue list that requires dedicated SI delivery */
733   uint32_t            gnbDuId;
734   F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
735 }F1GnbDuCfgUpd;
736
737 typedef struct f1GnbDuCfgUpdAck
738 {
739    uint32_t           transId;                      /* Uniquely identify transaction */
740    F1CuActCellInfo    cellLstAct[DU_MAX_CELLS];    /* List of cells to be activated */   
741    F1CritDiagnostic   critDiagnostic;               /* Critical diagnostics */
742    NrEcgi             cellLstDeact[DU_MAX_CELLS]; /* List of cells to be deactivated */
743 }F1GnbDuCfgUpdAck;
744
745 typedef struct f1GnbDuCfgUpdFail
746 {
747    F1FailureIE   gnbDuCfgUpdFail;
748 }F1GnbDuCfgUpdFail;
749
750 /* Sent by the gNB-CU to transfer updated information associated to an F1-C interface instance */
751 typedef struct f1GnbCuCfgUpd
752 {
753     uint32_t            transId;                            /* Uniquely identifies transaction */
754     F1CuActCellInfo     cellLstAct[DU_MAX_CELLS];         /* List of cells to be activated */
755     NrEcgi              cellLstDeact[DU_MAX_CELLS];       /* List of cells to be deactivated */
756     F1TnlAssoc          assocLstAdd[MAX_TNL_ASSOC];     /* List of TNL assocs to be added */
757     F1TnlAssoc          assocLstUpd[MAX_TNL_ASSOC];     /* List of TNL assocs to be updated */
758     F1TnlAssocToRmv     assocLstRmv[MAX_TNL_ASSOC];     /* List of TNL assocs to be removed */
759     F1CellBarred        cellToBarList[DU_MAX_CELLS];      /* List of Cells to be barred */
760     F1ProtectEUTRARsrc  protectEutraRsrcList[MAXCELLINENB]; /* List of Protected EUTRA resources */
761 }F1GnbCuCfgUpd;
762
763 /* Sent by a gNB-DU to a gNB-CU to acknowledge update of information
764  * associated to an F1-C interface instance */
765 typedef struct f1GnbCuCfgUpdAck
766 {
767     uint32_t              transId;                              /* Uniquely identify transaction */
768     F1ActCellFail         actCellFailList[DU_MAX_CELLS];      /* Cells failed to be activated list */
769     F1CritDiagnostic      critDiagnostic;                       /* Critical diagnostics */
770     F1TnlAssocAddr        assocSetupList[MAX_TNL_ASSOC];     /* TNL Assoc Setup list */
771     F1TnlAssocSetupFail   assocSetupFailList[MAX_TNL_ASSOC]; /* TNL Assoc Setup fail list */
772     F1DedSIDelUE          dedSiDelUelist[MAX_NUM_OF_UE_ID];          /* Dedicated SI delivery needed UE list */
773 }F1GnbCuCfgUpdAck;
774
775 typedef struct f1GnbCuCfgUpdFail
776 {
777     F1FailureIE   gnbCuCfgUpdFail;
778 }F1GnbCuCfgUpdFail;
779
780 /* This procedure enables coordination of radio resource allocation between a gNB-CU and
781  * a gNB-DU. Coordination request is sent by CU to DU */
782 typedef struct f1GnbDuRsrcCoordReq
783 {
784    uint32_t      transId;              /* Uniquely identifies transaction */
785    F1ReqType     reqType;              /* Request type */
786    uint8_t       cellResCoordReqCont;  /* Container for X2AP E-UTRA - NR cell resource coordination request */
787    F1IgnoreReq   ignoreReq;            /* Ignore coordination request */
788 }F1GnbDuRsrcCoordReq;
789
790 /* This message is sent by a gNB-DU to a gNB-CU, to express the desired resource allocation
791  * for data traffic, as a response to the GNB-DU RESOURCE COORDINATION REQUEST. */
792 typedef struct f1GnbDuRsrcCoordRsp
793 {
794     uint32_t   transId;               /* Uniquely identifies transaction */
795     uint8_t    cellResCoordRspCont;   /* Container for X2AP E-UTRA - NR cell resource coordination response */
796 }F1GnbDuRsrcCoordRsp;
797
798 /* This message is sent by the gNB-DU to indicate to the gNB-CU its status of overload */
799 typedef struct f1GnbDuStatusInd
800 {
801    uint32_t                  transId;      /* Uniquely identifies transaction */
802    F1GnbDuOvrloadInfo   ovrloadInfo;  /* gNB-DU overloaded information */
803 }F1GnbDuStatusInd;
804
805 /* This message is sent by either the gNB-DU or the gNB-CU to intiate the removal
806  * of the interface instance and the related resources */
807 typedef struct f1RmvReq
808 {
809    uint32_t   transId; /* Uniquely identifies transaction */
810 }F1RmvReq;
811
812 /* This message acknowledges the initiation of removal of the interface
813  * instance and the related resources */
814 typedef struct f1RmvRsp
815 {
816    uint32_t           transId;     /* Uniquely identifies transaction */
817    F1CritDiagnostic   critDiagnos; /* Crititcality diagnostics */
818 }F1RmvRsp;
819
820 /* This message indicates that removing the interface instance and the related
821  * resources cannot be accepted */
822 typedef struct f1RmvFail
823 {
824    uint32_t           transId;         /* Uniquely identifies transaction */
825    F1FailCause        cause;          /* Failure cause */
826    F1CritDiagnostic   critDiagnostic; /* Criticality diagnostics */
827 }F1RmvFail;
828
829 /* This message is sent by the gNB-CU to indicate to the gNB-DU a need to reduce
830  * the rate at which UEs access the network. */
831 typedef struct f1NwkAccessRateRed
832 {
833    uint32_t          transId;        /* Uniquely identifies transaction */
834    F1UacAssistInfo   uacAssistInfo;  /* UAC Assistance Information */
835 }F1NwkAccessRateRed;
836
837 typedef struct f1Ipaddr
838 {
839  bool ipV4Pres;
840  uint32_t  ipV4Addr; 
841 }F1IpAddr;
842
843 typedef struct sctpParams
844 {
845    F1IpAddr  duIpAddr;
846    U16       duPort[MAX_DU_PORT];
847    F1IpAddr  cuIpAddr;
848    U16       cuPort;
849    F1IpAddr  ricIpAddr;
850    U16       ricPort;
851 }SctpParams;
852
853 typedef struct f1EgtpParams
854 {
855    F1IpAddr  localIp;      /* Ip address of local node */
856    uint16_t  localPort;    /* Sender Port at local node */
857    F1IpAddr  destIp;       /* Ip address of peer node */
858    uint16_t  destPort;     /* Sender port at peer node */
859    uint32_t  minTunnelId;
860    uint32_t  maxTunnelId;
861 }F1EgtpParams;
862
863 typedef struct schedulerCfg
864 {
865    uint8_t         numTxAntPorts;    /*!< Number of Tx antenna ports */
866    uint8_t         ulSchdType;     /*!< Indicates which UL scheduler to use, range
867                                * is 0..(number of schedulers - 1) */
868    uint8_t         dlSchdType;     /*!< Indicates which DL scheduler to use, range
869                                * is 0..(number of schedulers - 1) */
870    uint8_t         numCells;       /*!< Max number of cells */
871    uint8_t         maxUlUePerTti;  /*!< Max number of UE in UL per TTI */
872    uint8_t         maxDlUePerTti;  /*!< Max number of UE in DL per TTI */
873 }SchedulerCfg;
874
875 typedef struct mibParams
876 {
877         uint8_t sysFrmNum;
878         long    subCarrierSpacingCommon;
879         long    ssb_SubcarrierOffset;
880         long    dmrs_TypeA_Position;
881         long    controlResourceSetZero;
882         long    searchSpaceZero;
883         long    cellBarred;
884         long    intraFreqReselection;
885 }MibParams;
886
887 typedef struct sib1Params
888 {
889         Plmn    plmn;
890         uint8_t   tac;
891         long      ranac;
892         uint8_t   cellIdentity;
893         long      cellResvdForOpUse;
894 }Sib1Params;
895
896 typedef struct duCfgParams
897 {
898    SctpParams         sctpParams;                  /* SCTP Params */
899    F1EgtpParams       egtpParams;                  /* EGTP Params */
900    uint32_t           maxUe;
901    uint32_t           duId;
902    uint8_t            duName[CU_DU_NAME_LEN_MAX];
903    SchedulerCfg       schedCfg;
904    F1DuSrvdCellInfo   srvdCellLst[DU_MAX_CELLS];  /* Serving cell list *///TODO: this must be removed eventually
905    F1RrcVersion       rrcVersion;                 /* RRC version */
906    MacCellCfg          macCellCfg;                    /* MAC cell configuration */
907    MibParams          mibParams;                  /* MIB Params */
908    Sib1Params         sib1Params;                 /* SIB1 Params */
909 }DuCfgParams;
910
911 /*function declarations */
912 void FillSlotConfig();
913 S16 readClCfg();
914 S16 readCfg();
915 S16 duReadCfg(); 
916 S16 bitStringToInt(BIT_STRING_t *bitString, uint16_t *val);
917
918 #endif /* __DU_CONFIG_H__ */
919
920 /**********************************************************************
921          End of file
922 **********************************************************************/