Commit 1b62c915 authored by Laurent THOMAS's avatar Laurent THOMAS

add configurable USIM

parent 6749c5f7
...@@ -997,7 +997,6 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w ...@@ -997,7 +997,6 @@ add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION w
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE") add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
add_boolean_option(ITTI_SIM False "enable itti simulator") add_boolean_option(ITTI_SIM False "enable itti simulator")
add_boolean_option(RFSIM_NAS False "enable rfsim nas")
######################## ########################
# Include order # Include order
########################## ##########################
...@@ -2443,108 +2442,6 @@ set (libnas_utils_OBJS ...@@ -2443,108 +2442,6 @@ set (libnas_utils_OBJS
${NAS_SRC}COMMON/UTIL/OctetString.c ${NAS_SRC}COMMON/UTIL/OctetString.c
) )
if(NAS_UE)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
${NAS_SRC}UE/API/USER/at_response.c
${NAS_SRC}UE/API/USER/user_api.c
${NAS_SRC}UE/API/USER/user_indication.c
${NAS_SRC}UE/API/USIM/aka_functions.c
${NAS_SRC}UE/API/USIM/usim_api.c
)
set(libnas_ue_emm_OBJS
${NAS_SRC}UE/EMM/Attach.c
${NAS_SRC}UE/EMM/Authentication.c
${NAS_SRC}UE/EMM/Detach.c
${NAS_SRC}UE/EMM/emm_main.c
${NAS_SRC}UE/EMM/EmmStatusHdl.c
${NAS_SRC}UE/EMM/Identification.c
${NAS_SRC}UE/EMM/IdleMode.c
${NAS_SRC}UE/EMM/LowerLayer.c
${NAS_SRC}UE/EMM/SecurityModeControl.c
${NAS_SRC}UE/EMM/ServiceRequestHdl.c
${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
)
set(libnas_ue_emm_sap_OBJS
${NAS_SRC}UE/EMM/SAP/emm_as.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c
${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
${NAS_SRC}UE/EMM/SAP/emm_esm.c
${NAS_SRC}UE/EMM/SAP/emm_fsm.c
${NAS_SRC}UE/EMM/SAP/EmmNull.c
${NAS_SRC}UE/EMM/SAP/emm_recv.c
${NAS_SRC}UE/EMM/SAP/emm_reg.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
${NAS_SRC}UE/EMM/SAP/EmmRegistered.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c
${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
${NAS_SRC}UE/EMM/SAP/emm_sap.c
${NAS_SRC}UE/EMM/SAP/emm_send.c
${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c
${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
)
set (libnas_ue_esm_OBJS
${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c
${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c
${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c
${NAS_SRC}UE/ESM/esm_ebr.c
${NAS_SRC}UE/ESM/esm_ebr_context.c
${NAS_SRC}UE/ESM/esm_ip.c
${NAS_SRC}UE/ESM/esm_main.c
${NAS_SRC}UE/ESM/esm_pt.c
${NAS_SRC}UE/ESM/EsmStatusHdl.c
${NAS_SRC}UE/ESM/PdnConnectivity.c
${NAS_SRC}UE/ESM/PdnDisconnect.c
)
set(libnas_ue_esm_sap_OBJS
${NAS_SRC}UE/ESM/SAP/esm_recv.c
${NAS_SRC}UE/ESM/SAP/esm_send.c
${NAS_SRC}UE/ESM/SAP/esm_sap.c
)
add_library(LIB_NAS_UE
${NAS_SRC}UE/nas_itti_messaging.c
${NAS_SRC}UE/nas_network.c
${NAS_SRC}UE/nas_parser.c
${NAS_SRC}UE/nas_proc.c
${NAS_SRC}UE/nas_user.c
${libnas_api_OBJS}
${libnas_ue_api_OBJS}
${libnas_emm_msg_OBJS}
${libnas_esm_msg_OBJS}
${libnas_ies_OBJS}
${libnas_utils_OBJS}
${libnas_ue_emm_OBJS}
${libnas_ue_emm_sap_OBJS}
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
add_dependencies(LIB_NAS_UE rrc_flag)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
include_directories(${NAS_SRC}UE/API/USIM)
include_directories(${NAS_SRC}UE/EMM)
include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP)
endif()
#if(ITTI_SIM OR RFSIM_NAS)
set(libnas_ue_api_OBJS set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c ${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c ${NAS_SRC}UE/API/USER/at_error.c
...@@ -2662,6 +2559,27 @@ endif() ...@@ -2662,6 +2559,27 @@ endif()
add_dependencies(LIB_NAS_SIMUE rrc_flag) add_dependencies(LIB_NAS_SIMUE rrc_flag)
set(NAS_SIM_LIB LIB_NAS_SIMUE) set(NAS_SIM_LIB LIB_NAS_SIMUE)
add_library(LIB_NAS_UE
${NAS_SRC}UE/nas_itti_messaging.c
${NAS_SRC}UE/nas_network.c
${NAS_SRC}UE/nas_parser.c
${NAS_SRC}UE/nas_proc.c
${NAS_SRC}UE/nas_user.c
${libnas_api_OBJS}
${libnas_ue_api_OBJS}
${libnas_emm_msg_OBJS}
${libnas_esm_msg_OBJS}
${libnas_ies_OBJS}
${libnas_utils_OBJS}
${libnas_ue_emm_OBJS}
${libnas_ue_emm_sap_OBJS}
${libnas_ue_esm_OBJS}
${libnas_ue_esm_sap_OBJS}
)
add_dependencies(LIB_NAS_UE rrc_flag)
set(NAS_UE_LIB LIB_NAS_UE)
include_directories(${NAS_SRC}NR_UE) include_directories(${NAS_SRC}NR_UE)
include_directories(${NAS_SRC}UE) include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER) include_directories(${NAS_SRC}UE/API/USER)
...@@ -2670,7 +2588,6 @@ endif() ...@@ -2670,7 +2588,6 @@ endif()
include_directories(${NAS_SRC}UE/EMM/SAP) include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM) include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP) include_directories(${NAS_SRC}UE/ESM/SAP)
#endif()
# nbiot # nbiot
add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16") add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16")
......
...@@ -68,7 +68,6 @@ USRP_REC_PLAY="False" ...@@ -68,7 +68,6 @@ USRP_REC_PLAY="False"
BUILD_ECLIPSE=0 BUILD_ECLIPSE=0
NR="False" NR="False"
ITTI_SIM="False" ITTI_SIM="False"
RFSIM_NAS="False"
SANITIZE_ADDRESS="False" SANITIZE_ADDRESS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
trap handle_ctrl_c INT trap handle_ctrl_c INT
...@@ -264,7 +263,6 @@ function main() { ...@@ -264,7 +263,6 @@ function main() {
nrUE=1 nrUE=1
NR="True" NR="True"
rfsimNas=1 rfsimNas=1
RFSIM_NAS="True"
echo_info "Will compile NR UE" echo_info "Will compile NR UE"
shift;; shift;;
--mu) --mu)
...@@ -619,7 +617,6 @@ function main() { ...@@ -619,7 +617,6 @@ function main() {
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
echo "set ( RFSIM_NAS $RFSIM_NAS )" >> $cmake_file
echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
cd $DIR/$build_dir/build cd $DIR/$build_dir/build
......
...@@ -159,16 +159,8 @@ install_protobuf_from_source(){ ...@@ -159,16 +159,8 @@ install_protobuf_from_source(){
#cd protobuf-2.6.1/ #cd protobuf-2.6.1/
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0
wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner
cd protobuf-3.3.0/ cd protobuf-3.3.0/ || exit
else
export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs
rm -rf /tmp/protobuf
git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf
cd /tmp/protobuf
git submodule update --init --recursive
./autogen.sh
fi
./configure ./configure
echo "Compiling protobuf" echo "Compiling protobuf"
make -j"$(nproc)" make -j"$(nproc)"
...@@ -339,6 +331,10 @@ check_install_ubuntu_packages() { ...@@ -339,6 +331,10 @@ check_install_ubuntu_packages() {
$SUDO apt install -y software-properties-common $SUDO apt install -y software-properties-common
case "$(get_distribution_release)" in case "$(get_distribution_release)" in
"ubuntu20.04") "ubuntu20.04")
specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev"
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
;;
"ubuntu21.04") "ubuntu21.04")
specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev"
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
......
...@@ -87,9 +87,7 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -87,9 +87,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "executables/softmodem-common.h" #include "executables/softmodem-common.h"
#include "executables/thread-common.h" #include "executables/thread-common.h"
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h" #include "nr_nas_msg_sim.h"
#endif
extern const char *duplex_mode[]; extern const char *duplex_mode[];
THREAD_STRUCT thread_struct; THREAD_STRUCT thread_struct;
...@@ -193,12 +191,10 @@ int create_tasks_nrue(uint32_t ue_nb) { ...@@ -193,12 +191,10 @@ int create_tasks_nrue(uint32_t ue_nb) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n"); LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1; return -1;
} }
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NAS UE failed\n"); LOG_E(NR_RRC, "Create task for NAS UE failed\n");
return -1; return -1;
} }
#endif
} }
itti_wait_ready(0); itti_wait_ready(0);
......
...@@ -83,11 +83,11 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ ...@@ -83,11 +83,11 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
mu = nrUE_config->prach_config.prach_sub_c_spacing; mu = nrUE_config->prach_config.prach_sub_c_spacing;
restricted_set = prach_pdu->restricted_set; restricted_set = prach_pdu->restricted_set;
rootSequenceIndex = prach_pdu->root_seq_id; rootSequenceIndex = prach_pdu->root_seq_id;
fd_occasion = 0;
n_ra_prb = nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1,//prach_pdu->freq_msg1; n_ra_prb = nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1,//prach_pdu->freq_msg1;
NCS = prach_pdu->num_cs; NCS = prach_pdu->num_cs;
prach_fmt_id = prach_pdu->prach_format; prach_fmt_id = prach_pdu->prach_format;
preamble_index = prach_resources->ra_PreambleIndex; preamble_index = prach_resources->ra_PreambleIndex;
fd_occasion = 0;
prach_len = 0; prach_len = 0;
dftlen = 0; dftlen = 0;
first_nonzero_root_idx = 0; first_nonzero_root_idx = 0;
......
...@@ -1071,6 +1071,7 @@ typedef struct { ...@@ -1071,6 +1071,7 @@ typedef struct {
#endif #endif
int dl_stats[5]; int dl_stats[5];
void * uicc;
} PHY_VARS_NR_UE; } PHY_VARS_NR_UE;
......
...@@ -69,9 +69,7 @@ ...@@ -69,9 +69,7 @@
#include "SIMULATION/TOOLS/sim.h" // for taus #include "SIMULATION/TOOLS/sim.h" // for taus
#include <executables/softmodem-common.h> #include <executables/softmodem-common.h>
#if defined(ITTI_SIM) || defined(RFSIM_NAS)
#include "nr_nas_msg_sim.h" #include "nr_nas_msg_sim.h"
#endif
NR_UE_RRC_INST_t *NR_UE_rrc_inst; NR_UE_RRC_INST_t *NR_UE_rrc_inst;
/* NAS Attach request with IMSI */ /* NAS Attach request with IMSI */
...@@ -1349,14 +1347,21 @@ static void rrc_ue_generate_RRCSetupComplete( ...@@ -1349,14 +1347,21 @@ static void rrc_ue_generate_RRCSetupComplete(
AssertFatal(1==0,"2 > csi_MeasConfig is not null\n"); AssertFatal(1==0,"2 > csi_MeasConfig is not null\n");
if (AMF_MODE_ENABLED) { if (AMF_MODE_ENABLED) {
#if defined(ITTI_SIM) || defined(RFSIM_NAS) #if defined(ITTI_SIM)
as_nas_info_t initialNasMsg; as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg); generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
nas_msg = (char*)initialNasMsg.data; nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length; nas_msg_length = initialNasMsg.length;
#else #else
if (get_softmodem_params()->sa) {
as_nas_info_t initialNasMsg;
generateRegistrationRequest(&initialNasMsg, ctxt_pP->module_id);
nas_msg = (char*)initialNasMsg.data;
nas_msg_length = initialNasMsg.length;
} else {
nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; nas_msg = (char *) NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; nas_msg_length = NR_UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
}
#endif #endif
} else { } else {
nas_msg = nr_nas_attach_req_imsi; nas_msg = nr_nas_attach_req_imsi;
......
...@@ -194,23 +194,23 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_ ...@@ -194,23 +194,23 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_t *buffer) static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_t *buffer)
{ {
uint32_t encoded = 0; uint32_t encoded = 0;
*(buffer + encoded) = 0x00 | (suci->supiformat << 4) | (suci->typeofidentity); *(buffer + encoded) = (suci->supiformat << 4) | (suci->typeofidentity);
encoded++; encoded++;
*(buffer + encoded) = 0x00 | ((suci->mccdigit2 & 0xf) << 4) | *(buffer + encoded) = ((suci->mccdigit2 & 0xf) << 4) |
(suci->mccdigit1 & 0xf); (suci->mccdigit1 & 0xf);
encoded++; encoded++;
*(buffer + encoded) = 0x00 | ((suci->mncdigit3 & 0xf) << 4) | *(buffer + encoded) = ((suci->mncdigit3 & 0xf) << 4) |
(suci->mccdigit3 & 0xf); (suci->mccdigit3 & 0xf);
encoded++; encoded++;
*(buffer + encoded) = 0x00 | ((suci->mncdigit2 & 0xf) << 4) | *(buffer + encoded) = ((suci->mncdigit2 & 0xf) << 4) |
(suci->mncdigit1 & 0xf); (suci->mncdigit1 & 0xf);
encoded++; encoded++;
*(buffer + encoded) = 0x00 | ((suci->routingindicatordigit2 & 0xf) << 4) | *(buffer + encoded) = ((suci->routingindicatordigit2 & 0xf) << 4) |
(suci->routingindicatordigit1 & 0xf); (suci->routingindicatordigit1 & 0xf);
encoded++; encoded++;
*(buffer + encoded) = 0x00 | ((suci->routingindicatordigit4 & 0xf) << 4) | *(buffer + encoded) = ((suci->routingindicatordigit4 & 0xf) << 4) |
(suci->routingindicatordigit3 & 0xf); (suci->routingindicatordigit3 & 0xf);
encoded++; encoded++;
...@@ -220,8 +220,15 @@ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_ ...@@ -220,8 +220,15 @@ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_
*(buffer + encoded) = suci->homenetworkpki; *(buffer + encoded) = suci->homenetworkpki;
encoded++; encoded++;
IES_ENCODE_U32(buffer, encoded, suci->schemeoutput); char *ptr=suci->schemeoutput;
while ( ptr < suci->schemeoutput+strlen(suci->schemeoutput) ) {
buffer[encoded]=((*(ptr+1)-'0')<<4) | (*(ptr) -'0');
encoded++;
ptr+=2;
}
if (strlen(suci->schemeoutput)%2 == 1)
buffer[encoded++]=((*(ptr-1)-'0')) | 0xF0;
return encoded; return encoded;
} }
......
...@@ -64,7 +64,7 @@ typedef struct { ...@@ -64,7 +64,7 @@ typedef struct {
uint8_t spare6:1; uint8_t spare6:1;
uint8_t protectionschemeId:4; uint8_t protectionschemeId:4;
uint8_t homenetworkpki; uint8_t homenetworkpki;
uint32_t schemeoutput; char schemeoutput[32];
} Suci5GSMobileIdentity_t; } Suci5GSMobileIdentity_t;
typedef struct { typedef struct {
......
...@@ -387,5 +387,6 @@ void processNAS(void *msg, NRUEcontext_t *UE); ...@@ -387,5 +387,6 @@ void processNAS(void *msg, NRUEcontext_t *UE);
int identityRequest(void **msg, NRUEcontext_t *UE); int identityRequest(void **msg, NRUEcontext_t *UE);
int authenticationRequest(void **msg, NRUEcontext_t *UE); int authenticationRequest(void **msg, NRUEcontext_t *UE);
int securityModeCommand(void **msg, NRUEcontext_t *UE); int securityModeCommand(void **msg, NRUEcontext_t *UE);
void servingNetworkName(uint8_t *msg, char * imsiStr, int nmc_size);
#endif #endif
This diff is collapsed.
...@@ -115,9 +115,7 @@ typedef union { ...@@ -115,9 +115,7 @@ typedef union {
fgs_nas_message_plain_t plain; fgs_nas_message_plain_t plain;
} fgs_nas_message_t; } fgs_nas_message_t;
void generateRegistrationRequest(as_nas_info_t *initialNasMsg); void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id);
void generateIdentityResponse(as_nas_info_t *initialNasMsg, uint8_t identitytype);
void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf);
void generateSecurityModeComplete(as_nas_info_t *initialNasMsg); void generateSecurityModeComplete(as_nas_info_t *initialNasMsg);
void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer); void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer);
void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg); void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance: * For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include <ctype.h>
#include <openair3/UICC/usim_interface.h> #include <openair3/UICC/usim_interface.h>
#include <openair3/NAS/COMMON/milenage.h> #include <openair3/NAS/COMMON/milenage.h>
...@@ -34,10 +35,10 @@ ...@@ -34,10 +35,10 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define UICC_PARAMS_DESC {\ #define UICC_PARAMS_DESC {\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"", TYPE_STRING, 0 },\ {"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"2089900007487", TYPE_STRING, 0 },\
{"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\ {"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"", TYPE_STRING, 0 },\ {"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"", TYPE_STRING, 0 },\ {"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\
{"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\ {"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\ {"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\
}; };
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
const char *hexTable="0123456789abcdef"; const char *hexTable="0123456789abcdef";
static inline uint8_t mkDigit(unsigned char in) { static inline uint8_t mkDigit(unsigned char in) {
for (int i=0; i<16; i++) for (int i=0; i<16; i++)
if (in==hexTable[i]) if (tolower(in)==hexTable[i])
return i; return i;
LOG_E(SIM,"Impossible hexa input: %c\n",in); LOG_E(SIM,"Impossible hexa input: %c\n",in);
return 0; return 0;
...@@ -65,7 +66,7 @@ uicc_t *init_uicc(char *sectionName) { ...@@ -65,7 +66,7 @@ uicc_t *init_uicc(char *sectionName) {
// we can read the IMSI from the USIM // we can read the IMSI from the USIM
// key, OPc, sqn, amf don't need to be read from the true USIM // key, OPc, sqn, amf don't need to be read from the true USIM
int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName); int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName);
AssertFatal(ret >= 0, "configuration couldn't be performed"); AssertFatal(ret >= 0, "configuration couldn't be performed for uicc name: %s", sectionName);
LOG_I(SIM, "UICC simulation: IMSI=%s, Ki=%s, OPc=%s\n", uicc->imsiStr, uicc->keyStr, uicc->opcStr); LOG_I(SIM, "UICC simulation: IMSI=%s, Ki=%s, OPc=%s\n", uicc->imsiStr, uicc->keyStr, uicc->opcStr);
to_hex(uicc->keyStr,uicc->key, sizeof(uicc->key) ); to_hex(uicc->keyStr,uicc->key, sizeof(uicc->key) );
to_hex(uicc->opcStr,uicc->opc, sizeof(uicc->opc) ); to_hex(uicc->opcStr,uicc->opc, sizeof(uicc->opc) );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment