Replace type Byte_t used in NAS directly with uint8_t

* the goal is to simplify the code
This commit is contained in:
Guido Casati
2025-01-08 20:11:09 +01:00
parent 21df50b31e
commit f87388099d
16 changed files with 140 additions and 111 deletions
+3 -3
View File
@@ -167,7 +167,7 @@ typedef struct as_stmsi_s {
/* Dedicated NAS information */
typedef struct as_nas_info_s {
uint32_t length; /* Length of the NAS information data */
Byte_t* nas_data; /* Dedicated NAS information data container */
uint8_t* nas_data; /* Dedicated NAS information data container */
} as_nas_info_t;
/* Radio Access Bearer identity */
@@ -216,7 +216,7 @@ typedef struct broadcast_info_ind_s {
* NAS request AS to refresh its KeNB key
*/
typedef struct kenb_refresh_req_s {
Byte_t kenb[32];
uint8_t kenb[32];
} kenb_refresh_req_t;
typedef struct nsa_oai_tun_nsa_s {
@@ -230,7 +230,7 @@ typedef struct nsa_oai_tun_nsa_s {
*/
typedef struct cell_info_req_s {
plmn_t plmnID; /* Selected PLMN identity */
Byte_t rat; /* Bitmap - set of radio access technologies */
uint8_t rat; /* Bitmap - set of radio access technologies */
} cell_info_req_t;
/*
+44 -33
View File
@@ -43,7 +43,6 @@ Description Contains global common definitions
#include <stddef.h>
#include <stdbool.h>
#include "common/platform_constants.h"
typedef uint8_t Byte_t; /* 8 bit unsigned integer */
/*
-----------------------------------------------------------------------------
@@ -62,30 +61,30 @@ typedef uint8_t AcT_t; /* Access Technology */
* International Mobile Subscriber Identity
*/
typedef struct {
Byte_t length;
uint8_t length;
union {
struct {
Byte_t digit2:4;
Byte_t digit1:4;
Byte_t digit4:4;
Byte_t digit3:4;
Byte_t digit6:4;
Byte_t digit5:4;
Byte_t digit8:4;
Byte_t digit7:4;
Byte_t digit10:4;
Byte_t digit9:4;
Byte_t digit12:4;
Byte_t digit11:4;
Byte_t digit14:4;
Byte_t digit13:4;
uint8_t digit2: 4;
uint8_t digit1: 4;
uint8_t digit4: 4;
uint8_t digit3: 4;
uint8_t digit6: 4;
uint8_t digit5: 4;
uint8_t digit8: 4;
uint8_t digit7: 4;
uint8_t digit10: 4;
uint8_t digit9: 4;
uint8_t digit12: 4;
uint8_t digit11: 4;
uint8_t digit14: 4;
uint8_t digit13: 4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
Byte_t parity:4;
Byte_t digit15:4;
uint8_t parity: 4;
uint8_t digit15: 4;
} num;
#define IMSI_SIZE 8
Byte_t value[IMSI_SIZE];
uint8_t value[IMSI_SIZE];
} u;
} imsi_t;
@@ -119,7 +118,7 @@ typedef struct {
* Mobile subscriber dialing number
*/
typedef struct {
Byte_t ext:1;
uint8_t ext: 1;
/* Type Of Number */
#define MSISDN_TON_UNKNOWKN 0b000
#define MSISDN_TON_INTERNATIONAL 0b001
@@ -128,7 +127,7 @@ typedef struct {
#define MSISDN_TON_SUBCRIBER 0b100
#define MSISDN_TON_ABBREVIATED 0b110
#define MSISDN_TON_RESERVED 0b111
Byte_t ton:3;
uint8_t ton: 3;
/* Numbering Plan Identification */
#define MSISDN_NPI_UNKNOWN 0b0000
#define MSISDN_NPI_ISDN_TELEPHONY 0b0001
@@ -140,11 +139,11 @@ typedef struct {
#define MSISDN_NPI_ISDN_MOBILE 0b0111
#define MSISDN_NPI_PRIVATE 0b1110
#define MSISDN_NPI_RESERVED 0b1111
Byte_t npi:4;
uint8_t npi: 4;
/* Dialing Number */
struct {
Byte_t lsb:4;
Byte_t msb:4;
uint8_t lsb: 4;
uint8_t msb: 4;
#define MSISDN_DIGIT_SIZE 10
} digit[MSISDN_DIGIT_SIZE];
} msisdn_t;
@@ -159,12 +158,12 @@ typedef imsi_t imei_t;
* PLMN = BCD encoding (Mobile Country Code + Mobile Network Code)
*/
typedef struct {
Byte_t MCCdigit2:4;
Byte_t MCCdigit1:4;
Byte_t MNCdigit3:4;
Byte_t MCCdigit3:4;
Byte_t MNCdigit2:4;
Byte_t MNCdigit1:4;
uint8_t MCCdigit2: 4;
uint8_t MCCdigit1: 4;
uint8_t MNCdigit3: 4;
uint8_t MCCdigit3: 4;
uint8_t MNCdigit2: 4;
uint8_t MNCdigit1: 4;
} plmn_t;
/*
@@ -256,17 +255,29 @@ typedef struct {
/*
* A list of PLMNs
*/
#define PLMN_LIST_T(SIZE) struct {Byte_t n_plmns; plmn_t plmn[SIZE];}
#define PLMN_LIST_T(SIZE) \
struct { \
uint8_t n_plmns; \
plmn_t plmn[SIZE]; \
}
/*
* A list of TACs
*/
#define TAC_LIST_T(SIZE) struct {Byte_t n_tacs; TAC_t tac[SIZE];}
#define TAC_LIST_T(SIZE) \
struct { \
uint8_t n_tacs; \
TAC_t tac[SIZE]; \
}
/*
* A list of TAIs
*/
#define TAI_LIST_T(SIZE) struct {Byte_t n_tais; tai_t tai[SIZE];}
#define TAI_LIST_T(SIZE) \
struct { \
uint8_t n_tais; \
tai_t tai[SIZE]; \
}
typedef enum eps_protocol_discriminator_e {
/* Protocol discriminator identifier for EPS Mobility Management */
+1 -1
View File
@@ -461,7 +461,7 @@ typedef struct UE_RRC_INST_NB_IoT_s {
Rrc_State_NB_IoT_t RrcState;
Rrc_Sub_State_NB_IoT_t RrcSubState;
plmn_t plmnID;
Byte_t rat;
uint8_t rat;
as_nas_info_t initialNasMsg;
OAI_UECapability_NB_IoT_t *UECap;
uint8_t *UECapability;
+1 -1
View File
@@ -812,7 +812,7 @@ typedef struct UE_RRC_INST_s {
Rrc_State_t RrcState;
Rrc_Sub_State_t RrcSubState;
plmn_t plmnID;
Byte_t rat;
uint8_t rat;
uint8_t selected_plmn_identity;
as_nas_info_t initialNasMsg;
OAI_UECapability_t *UECap;