Replace type Byte_t used in NAS directly with uint8_t
* the goal is to simplify the code
This commit is contained in:
@@ -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
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -192,7 +192,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
|
||||
|
||||
int bytes = sizeof(msg->msgID);
|
||||
as_nas_info_t nas_msg;
|
||||
Byte_t *dataptr=NULL;
|
||||
uint8_t* dataptr = NULL;
|
||||
uint32_t len=0;
|
||||
|
||||
memset(&nas_msg, 0, sizeof(as_nas_info_t));
|
||||
@@ -230,30 +230,30 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
|
||||
|
||||
case AS_NAS_ESTABLISH_REQ:
|
||||
/* NAS signalling connection establish request */
|
||||
bytes += sizeof(nas_establish_req_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(nas_establish_req_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.nas_establish_req.initialNasMsg;
|
||||
break;
|
||||
|
||||
case AS_NAS_ESTABLISH_IND:
|
||||
/* NAS signalling connection establish indication */
|
||||
bytes += sizeof(nas_establish_ind_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(nas_establish_ind_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.nas_establish_ind.initialNasMsg;
|
||||
dataptr = (Byte_t*)&(msg->msg.nas_establish_ind.initialNasMsg.nas_data);
|
||||
dataptr = (uint8_t*)&(msg->msg.nas_establish_ind.initialNasMsg.nas_data);
|
||||
len=msg->msg.nas_establish_ind.initialNasMsg.length;
|
||||
break;
|
||||
|
||||
case AS_NAS_ESTABLISH_RSP:
|
||||
/* NAS signalling connection establish response */
|
||||
bytes += sizeof(nas_establish_rsp_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(nas_establish_rsp_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.nas_establish_rsp.nasMsg;
|
||||
|
||||
break;
|
||||
|
||||
case AS_NAS_ESTABLISH_CNF:
|
||||
/* NAS signalling connection establish confirm */
|
||||
bytes += sizeof(nas_establish_cnf_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(nas_establish_cnf_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.nas_establish_cnf.nasMsg;
|
||||
dataptr = (Byte_t*)&(msg->msg.nas_establish_cnf.nasMsg.nas_data);
|
||||
dataptr = (uint8_t*)&(msg->msg.nas_establish_cnf.nasMsg.nas_data);
|
||||
len=msg->msg.nas_establish_ind.initialNasMsg.length;
|
||||
break;
|
||||
|
||||
@@ -269,7 +269,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
|
||||
|
||||
case AS_UL_INFO_TRANSFER_REQ:
|
||||
/* Uplink L3 data transfer request */
|
||||
bytes += sizeof(ul_info_transfer_req_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(ul_info_transfer_req_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.ul_info_transfer_req.nasMsg;
|
||||
break;
|
||||
|
||||
@@ -280,13 +280,13 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
|
||||
|
||||
case AS_UL_INFO_TRANSFER_IND:
|
||||
/* Uplink L3 data transfer indication */
|
||||
bytes += sizeof(ul_info_transfer_ind_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(ul_info_transfer_ind_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.ul_info_transfer_ind.nasMsg;
|
||||
break;
|
||||
|
||||
case AS_DL_INFO_TRANSFER_REQ:
|
||||
/* Downlink L3 data transfer */
|
||||
bytes += sizeof(dl_info_transfer_req_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(dl_info_transfer_req_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.dl_info_transfer_req.nasMsg;
|
||||
break;
|
||||
|
||||
@@ -297,7 +297,7 @@ int as_message_encode(char* buffer, as_message_t* msg, int length)
|
||||
|
||||
case AS_DL_INFO_TRANSFER_IND:
|
||||
/* Downlink L3 data transfer indication */
|
||||
bytes += sizeof(dl_info_transfer_ind_t) - sizeof(Byte_t*);
|
||||
bytes += sizeof(dl_info_transfer_ind_t) - sizeof(uint8_t*);
|
||||
nas_msg = msg->msg.dl_info_transfer_ind.nasMsg;
|
||||
|
||||
break;
|
||||
|
||||
@@ -558,7 +558,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas)
|
||||
size += 10;
|
||||
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = malloc16_clear(size * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc16_clear(size * sizeof(*initialNasMsg->nas_data));
|
||||
nas->registration_request_buf = initialNasMsg->nas_data;
|
||||
|
||||
initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size);
|
||||
@@ -603,7 +603,7 @@ void generateServiceRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas)
|
||||
size += fill_fgstmsi(&mm_msg->service_request.fiveg_s_tmsi, nas->guti);
|
||||
|
||||
/* message encoding */
|
||||
initialNasMsg->nas_data = (Byte_t *)malloc(size * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc_or_fail(size * sizeof(*initialNasMsg->nas_data));
|
||||
if (security_protected) {
|
||||
// security protected encoding
|
||||
int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size);
|
||||
@@ -668,7 +668,7 @@ void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype
|
||||
}
|
||||
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = malloc(size * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc_or_fail(size * sizeof(*initialNasMsg->nas_data));
|
||||
|
||||
initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size);
|
||||
}
|
||||
@@ -704,7 +704,7 @@ static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialN
|
||||
mm_msg->fgs_auth_response.authenticationresponseparameter.res = res;
|
||||
size += 18;
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = malloc(size * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc_or_fail(size * sizeof(*initialNasMsg->nas_data));
|
||||
|
||||
initialNasMsg->length = mm_msg_encode(mm_msg, initialNasMsg->nas_data, size);
|
||||
// Free res value after encode
|
||||
@@ -756,7 +756,7 @@ static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initia
|
||||
size += (nas->registration_request_len + 2);
|
||||
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = malloc(size * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc_or_fail(size * sizeof(*initialNasMsg->nas_data));
|
||||
|
||||
int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size);
|
||||
|
||||
@@ -884,7 +884,7 @@ static void generateRegistrationComplete(nr_ue_nas_t *nas,
|
||||
}
|
||||
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = malloc(length * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc_or_fail(length * sizeof(*initialNasMsg->nas_data));
|
||||
initialNasMsg->length = length;
|
||||
|
||||
/* Encode the first octet of the header (extended protocol discriminator) */
|
||||
@@ -981,7 +981,7 @@ static void generateDeregistrationRequest(nr_ue_nas_t *nas, as_nas_info_t *initi
|
||||
size += fill_guti(&dereg_req->fgsmobileidentity, nas->guti);
|
||||
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = calloc(size, sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = calloc_or_fail(size, sizeof(*initialNasMsg->nas_data));
|
||||
int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &nas_msg.header, size);
|
||||
|
||||
initialNasMsg->length =
|
||||
@@ -1089,7 +1089,7 @@ static void generatePduSessionEstablishRequest(nr_ue_nas_t *nas, as_nas_info_t *
|
||||
size += (1 + 1 + dnnSize + 1);
|
||||
|
||||
// encode the message
|
||||
initialNasMsg->nas_data = (Byte_t *)malloc(size * sizeof(Byte_t));
|
||||
initialNasMsg->nas_data = malloc_or_fail(size * sizeof(*initialNasMsg->nas_data));
|
||||
int security_header_len = nas_protected_security_header_encode((char *)(initialNasMsg->nas_data), &(nas_msg.header), size);
|
||||
|
||||
initialNasMsg->length =
|
||||
|
||||
@@ -173,7 +173,7 @@ int process_nas_establish_req(int msg_id, const nas_establish_req_t* req,
|
||||
ind->tac = DEFAULT_TAC;
|
||||
|
||||
if (req->initialNasMsg.length > 0) {
|
||||
ind->initialNasMsg.data = (Byte_t*)malloc(req->initialNasMsg.length);
|
||||
ind->initialNasMsg.data = malloc(req->initialNasMsg.length);
|
||||
|
||||
if (ind->initialNasMsg.data) {
|
||||
memcpy(ind->initialNasMsg.data, req->initialNasMsg.data,
|
||||
@@ -250,7 +250,7 @@ int process_ul_info_transfer_req(int msg_id, const ul_info_transfer_req_t* req,
|
||||
ind->UEid = 1; // Valid UEid starts at index 1
|
||||
|
||||
if (req->nasMsg.length > 0) {
|
||||
ind->nasMsg.data = (Byte_t*)malloc(req->nasMsg.length);
|
||||
ind->nasMsg.data = malloc(req->nasMsg.length);
|
||||
|
||||
if (ind->nasMsg.data) {
|
||||
memcpy(ind->nasMsg.data, req->nasMsg.data, req->nasMsg.length);
|
||||
@@ -360,7 +360,7 @@ int process_nas_establish_rsp(int msg_id, const nas_establish_rsp_t* rsp,
|
||||
cnf->errCode = rsp->errCode;
|
||||
|
||||
if (rsp->nasMsg.length > 0) {
|
||||
cnf->nasMsg.data = (Byte_t*)malloc(rsp->nasMsg.length);
|
||||
cnf->nasMsg.data = malloc(rsp->nasMsg.length);
|
||||
|
||||
if (cnf->nasMsg.data) {
|
||||
memcpy(cnf->nasMsg.data, rsp->nasMsg.data,
|
||||
@@ -426,7 +426,7 @@ int process_dl_info_transfer_req(int msg_id, const dl_info_transfer_req_t* req,
|
||||
|
||||
/* Setup downlink information indication message */
|
||||
if (req->nasMsg.length > 0) {
|
||||
ind->nasMsg.data = (Byte_t*)malloc(req->nasMsg.length);
|
||||
ind->nasMsg.data = malloc(req->nasMsg.length);
|
||||
|
||||
if (ind->nasMsg.data) {
|
||||
memcpy(ind->nasMsg.data, req->nasMsg.data, req->nasMsg.length);
|
||||
|
||||
@@ -228,7 +228,7 @@ static int _process_activate_default_eps_bearer_context_accept(const activate_de
|
||||
static int _process_activate_default_eps_bearer_context_reject(const activate_default_eps_bearer_context_reject_msg* msg);
|
||||
static int _process_deactivate_eps_bearer_context_accept(const deactivate_eps_bearer_context_accept_msg* msg);
|
||||
|
||||
static void _dump_buffer(const Byte_t* buffer, size_t len)
|
||||
static void _dump_buffer(const uint8_t* buffer, size_t len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
if ( (i%16) == 0 ) printf("\n\t");
|
||||
@@ -538,7 +538,7 @@ static int _process_establish_req(const nas_establish_req_t* req,
|
||||
if (bytes > 0) {
|
||||
/* Setup signalling connection establishment confirm message */
|
||||
rsp->errCode = AS_SUCCESS;
|
||||
rsp->nasMsg.data = (Byte_t*)malloc(bytes * sizeof(Byte_t));
|
||||
rsp->nasMsg.data = malloc(bytes * sizeof(uint8_t));
|
||||
|
||||
if (rsp->nasMsg.data) {
|
||||
rsp->nasMsg.length = bytes;
|
||||
@@ -618,7 +618,7 @@ static int _process_ul_info_transfer_req(const ul_info_transfer_req_t* req,
|
||||
return (AS_UL_INFO_TRANSFER_CNF);
|
||||
} else if (bytes > 0) {
|
||||
/* Some data has to be sent back to the UE */
|
||||
ind->nasMsg.data = (Byte_t*)malloc(bytes * sizeof(Byte_t));
|
||||
ind->nasMsg.data = malloc(bytes * sizeof(uint8_t));
|
||||
|
||||
if (ind->nasMsg.data) {
|
||||
ind->nasMsg.length = bytes;
|
||||
@@ -1258,12 +1258,12 @@ static int _assign_pdn_address(int ue_pdn_type, int is_initial, int* pdn_type, O
|
||||
U8 cause = [04] - NET_ESTABLISH_CAUSE_MO_SIGNAL
|
||||
U8 type = [10] - NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL
|
||||
plmn_t plmnID = [20 8f 10]
|
||||
Byte_t MCCdigit2:4 = [0]
|
||||
Byte_t MCCdigit1:4 = [2]
|
||||
Byte_t MNCdigit3:4 = [f]
|
||||
Byte_t MCCdigit3:4 = [8]
|
||||
Byte_t MNCdigit2:4 = [0]
|
||||
Byte_t MNCdigit1:4 = [1]
|
||||
uint8_t MCCdigit2:4 = [0]
|
||||
uint8_t MCCdigit1:4 = [2]
|
||||
uint8_t MNCdigit3:4 = [f]
|
||||
uint8_t MCCdigit3:4 = [8]
|
||||
uint8_t MNCdigit2:4 = [0]
|
||||
uint8_t MNCdigit1:4 = [1]
|
||||
as_stmsi_t s_tmsi
|
||||
U8 MMEcode = [0f]
|
||||
U32 m_tmsi = [00 00 00 01]
|
||||
|
||||
@@ -73,7 +73,12 @@ Description Implements the API used by the NAS layer to read/write
|
||||
* USIM TLV parameter structure
|
||||
* ----------------------------
|
||||
*/
|
||||
#define USIM_TLV_T(SIZE) struct {uint8_t type; uint8_t length; Byte_t value[SIZE];}
|
||||
#define USIM_TLV_T(SIZE) \
|
||||
struct { \
|
||||
uint8_t type; \
|
||||
uint8_t length; \
|
||||
uint8_t value[SIZE]; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Non Access Stratum Configuration
|
||||
@@ -116,13 +121,13 @@ typedef struct {
|
||||
#define USIM_KSI_MIN 0b000
|
||||
#define USIM_KSI_MAX 0b110
|
||||
#define USIM_KSI_NOT_AVAILABLE 0b111
|
||||
Byte_t ksi;
|
||||
uint8_t ksi;
|
||||
/* Cyphering key */
|
||||
#define USIM_CK_SIZE 16
|
||||
Byte_t ck[USIM_CK_SIZE];
|
||||
uint8_t ck[USIM_CK_SIZE];
|
||||
/* Integrity key */
|
||||
#define USIM_IK_SIZE 16
|
||||
Byte_t ik[USIM_IK_SIZE];
|
||||
uint8_t ik[USIM_IK_SIZE];
|
||||
uint8_t usim_api_k[USIM_API_K_SIZE];
|
||||
uint8_t opc[16];
|
||||
} usim_keys_t;
|
||||
@@ -195,10 +200,10 @@ typedef struct {
|
||||
* ----------------------------
|
||||
*/
|
||||
typedef struct {
|
||||
Byte_t length; /* Length of BCD number/SSC contents */
|
||||
uint8_t length; /* Length of BCD number/SSC contents */
|
||||
msisdn_t number; /* Mobile subscriber dialing number */
|
||||
Byte_t conf1_record_id; /* Configuration1 Record Identifier */
|
||||
Byte_t ext1_record_id; /* Extension1 Record Identifier */
|
||||
uint8_t conf1_record_id; /* Configuration1 Record Identifier */
|
||||
uint8_t ext1_record_id; /* Extension1 Record Identifier */
|
||||
} usim_msisdn_t;
|
||||
|
||||
/*
|
||||
@@ -251,12 +256,12 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint32_t tmsi; /* Temporary Mobile Subscriber Identity */
|
||||
lai_t lai; /* Location Area Identity */
|
||||
Byte_t reserved; /* Reserved for future use */
|
||||
uint8_t reserved; /* Reserved for future use */
|
||||
#define USIM_LOCI_UPDATED 0x00
|
||||
#define USIM_LOCI_NOT_UPDATED 0x01
|
||||
#define USIM_LOCI_PLMN_NOT_ALLOWED 0x02
|
||||
#define USIM_LOCI_LA_NOT_ALLOWED 0x03
|
||||
Byte_t status; /* Location update status */
|
||||
uint8_t status; /* Location update status */
|
||||
} usim_loci_t;
|
||||
|
||||
/*
|
||||
@@ -265,13 +270,13 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t p_tmsi; /* Packet Temporary Mobile Subscriber Identity */
|
||||
Byte_t signature[3]; /* P-TMSI signature value */
|
||||
uint8_t signature[3]; /* P-TMSI signature value */
|
||||
RAI_t rai; /* Routing Area Identity */
|
||||
#define USIM_PSLOCI_UPDATED 0x00
|
||||
#define USIM_PSLOCI_NOT_UPDATED 0x01
|
||||
#define USIM_PSLOCI_PLMN_NOT_ALLOWED 0x02
|
||||
#define USIM_PSLOCI_LA_NOT_ALLOWED 0x03
|
||||
Byte_t status; /* Routing Area update status */
|
||||
uint8_t status; /* Routing Area update status */
|
||||
} usim_psloci_t;
|
||||
|
||||
/*
|
||||
@@ -284,7 +289,7 @@ typedef struct {
|
||||
#define USIM_EPSLOCI_UPDATED 0x00
|
||||
#define USIM_EPSLOCI_NOT_UPDATED 0x01
|
||||
#define USIM_EPSLOCI_ROAMING_NOT_ALLOWED 0x02
|
||||
Byte_t status; /* EPS update status */
|
||||
uint8_t status; /* EPS update status */
|
||||
} usim_epsloci_t;
|
||||
|
||||
/*
|
||||
@@ -308,11 +313,11 @@ typedef struct {
|
||||
#define USIM_TYPE_APPROVAL_SPECIFIC_MODE 0x81U
|
||||
#define USIM_MAINTENANCE_MODE 0x02U
|
||||
#define USIM_CELL_TEST_MODE 0x04U
|
||||
Byte_t UE_Operation_Mode; /* Mode of operation for the UE */
|
||||
uint8_t UE_Operation_Mode; /* Mode of operation for the UE */
|
||||
uint16_t Additional_Info; /* Additional information depending on
|
||||
* the UE operation mode */
|
||||
Byte_t MNC_Length; /* Number of digits used for extracting
|
||||
* the MNC from the IMSI */
|
||||
uint8_t MNC_Length; /* Number of digits used for extracting
|
||||
* the MNC from the IMSI */
|
||||
} usim_ad_t;
|
||||
|
||||
/*
|
||||
@@ -328,7 +333,7 @@ typedef struct {
|
||||
*/
|
||||
imsi_t imsi; /* International Mobile Subscriber Identity */
|
||||
usim_keys_t keys; /* Ciphering and Integrity Keys */
|
||||
Byte_t hpplmn; /* Higher Priority PLMN search period */
|
||||
uint8_t hpplmn; /* Higher Priority PLMN search period */
|
||||
#define USIM_FPLMN_MAX 4
|
||||
plmn_t fplmn[USIM_FPLMN_MAX]; /* List of Forbidden PLMNs */
|
||||
usim_loci_t loci; /* Location Information */
|
||||
|
||||
@@ -837,7 +837,7 @@ _emm_as_encode(
|
||||
}
|
||||
|
||||
/* Allocate memory to the NAS information container */
|
||||
info->nas_data = malloc(length * sizeof(Byte_t));
|
||||
info->nas_data = malloc(length * sizeof(uint8_t));
|
||||
|
||||
if (info->nas_data != NULL) {
|
||||
/* Encode the NAS message */
|
||||
@@ -889,7 +889,7 @@ _emm_as_encrypt(
|
||||
}
|
||||
|
||||
/* Allocate memory to the NAS information container */
|
||||
info->nas_data = malloc(length * sizeof(Byte_t));
|
||||
info->nas_data = malloc(length * sizeof(uint8_t));
|
||||
|
||||
if (info->nas_data != NULL) {
|
||||
/* Encrypt the NAS information message */
|
||||
|
||||
@@ -229,7 +229,7 @@ typedef struct emm_as_cell_info_s {
|
||||
#define EMM_AS_PLMN_LIST_SIZE 6
|
||||
PLMN_LIST_T(EMM_AS_PLMN_LIST_SIZE) plmnIDs;
|
||||
/* List of identifiers of available PLMNs */
|
||||
Byte_t rat; /* Bitmap of Radio Access Technologies */
|
||||
uint8_t rat; /* Bitmap of Radio Access Technologies */
|
||||
tac_t tac; /* Tracking Area Code */
|
||||
ci_t cellID; /* cell identity */
|
||||
} emm_as_cell_info_t;
|
||||
|
||||
@@ -345,12 +345,12 @@ typedef struct emm_data_s {
|
||||
* ----------------------------
|
||||
* see "Non Access Stratum Configuration" in USIM API header file
|
||||
*/
|
||||
Byte_t NAS_SignallingPriority;
|
||||
Byte_t NMO_I_Behaviour;
|
||||
Byte_t AttachWithImsi;
|
||||
Byte_t MinimumPeriodicSearchTimer;
|
||||
Byte_t ExtendedAccessBarring;
|
||||
Byte_t Timer_T3245_Behaviour;
|
||||
uint8_t NAS_SignallingPriority;
|
||||
uint8_t NMO_I_Behaviour;
|
||||
uint8_t AttachWithImsi;
|
||||
uint8_t MinimumPeriodicSearchTimer;
|
||||
uint8_t ExtendedAccessBarring;
|
||||
uint8_t Timer_T3245_Behaviour;
|
||||
|
||||
/*
|
||||
* EMM data stored in the UE's memory
|
||||
|
||||
@@ -96,14 +96,16 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i
|
||||
}
|
||||
#endif
|
||||
|
||||
int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) {
|
||||
int nas_itti_kenb_refresh_req(const uint8_t kenb[32], int user_id)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_KENB_REFRESH_REQ);
|
||||
memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb));
|
||||
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
|
||||
}
|
||||
|
||||
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) {
|
||||
int nas_itti_cell_info_req(const plmn_t plmnID, const uint8_t rat, int user_id)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_CELL_SELECTION_REQ);
|
||||
NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID;
|
||||
@@ -111,7 +113,14 @@ int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) {
|
||||
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
|
||||
}
|
||||
|
||||
int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, uint32_t length, int user_id) {
|
||||
int nas_itti_nas_establish_req(as_cause_t cause,
|
||||
as_call_type_t type,
|
||||
as_stmsi_t s_tmsi,
|
||||
plmn_t plmnID,
|
||||
uint8_t *data,
|
||||
uint32_t length,
|
||||
int user_id)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_CONN_ESTABLI_REQ);
|
||||
NAS_CONN_ESTABLI_REQ(message_p).cause = cause;
|
||||
|
||||
@@ -47,11 +47,17 @@ int nas_itti_protected_msg(
|
||||
|
||||
# if defined(NAS_BUILT_IN_UE)
|
||||
|
||||
int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id);
|
||||
int nas_itti_kenb_refresh_req(const uint8_t kenb[32], int user_id);
|
||||
|
||||
int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id);
|
||||
int nas_itti_cell_info_req(const plmn_t plmnID, const uint8_t rat, int user_id);
|
||||
|
||||
int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data_pP, uint32_t lengthP, int user_id);
|
||||
int nas_itti_nas_establish_req(as_cause_t cause,
|
||||
as_call_type_t type,
|
||||
as_stmsi_t s_tmsi,
|
||||
plmn_t plmnID,
|
||||
uint8_t *data_pP,
|
||||
uint32_t lengthP,
|
||||
int user_id);
|
||||
|
||||
int nas_itti_ul_data_req(const uint32_t ue_idP, void *const data_pP, const uint32_t lengthP, int user_id);
|
||||
|
||||
|
||||
@@ -311,11 +311,11 @@ int nas_proc_get_msisdn(nas_user_t *user, char *msisdn_str, int *ton_npi)
|
||||
if (msisdn != NULL) {
|
||||
union {
|
||||
struct {
|
||||
Byte_t ext:1;
|
||||
Byte_t ton:3;
|
||||
Byte_t npi:4;
|
||||
uint8_t ext: 1;
|
||||
uint8_t ton: 3;
|
||||
uint8_t npi: 4;
|
||||
} ext_ton_npi;
|
||||
Byte_t type;
|
||||
uint8_t type;
|
||||
} converter;
|
||||
converter.ext_ton_npi.ext = msisdn->ext;
|
||||
converter.ext_ton_npi.ton = msisdn->ton;
|
||||
@@ -1058,7 +1058,7 @@ int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t Ac
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int nas_proc_establish_cnf(nas_user_t *user, const Byte_t *data, uint32_t len)
|
||||
int nas_proc_establish_cnf(nas_user_t *user, const uint8_t *data, uint32_t len)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
@@ -1236,7 +1236,7 @@ int nas_proc_ul_transfer_rej(nas_user_t *user)
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
int nas_proc_dl_transfer_ind(nas_user_t *user, const Byte_t *data, uint32_t len)
|
||||
int nas_proc_dl_transfer_ind(nas_user_t *user, const uint8_t *data, uint32_t len)
|
||||
{
|
||||
LOG_FUNC_IN;
|
||||
|
||||
|
||||
@@ -113,15 +113,13 @@ int nas_proc_activate_pdn(nas_user_t *user, int cid);
|
||||
*/
|
||||
int nas_proc_cell_info(nas_user_t *user, int found, tac_t tac, ci_t ci, AcT_t AcT, uint8_t rsrq, uint8_t rsrp);
|
||||
|
||||
int nas_proc_establish_cnf(nas_user_t *user, const Byte_t *data, uint32_t len);
|
||||
int nas_proc_establish_cnf(nas_user_t *user, const uint8_t *data, uint32_t len);
|
||||
int nas_proc_establish_rej(nas_user_t *user);
|
||||
|
||||
int nas_proc_release_ind(nas_user_t *user, int cause);
|
||||
|
||||
int nas_proc_ul_transfer_cnf(nas_user_t *user);
|
||||
int nas_proc_ul_transfer_rej(nas_user_t *user);
|
||||
int nas_proc_dl_transfer_ind(nas_user_t *user, const Byte_t *data, uint32_t len);
|
||||
|
||||
|
||||
int nas_proc_dl_transfer_ind(nas_user_t *user, const uint8_t *data, uint32_t len);
|
||||
|
||||
#endif /* __NAS_PROC_H__*/
|
||||
|
||||
Reference in New Issue
Block a user