From c0583be24e77a8a55d48cf30ee73e2b5ed10e527 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 12 Nov 2024 13:27:29 +0100 Subject: [PATCH] Migrated NAS 5GS (5GMM & 5GSM) to NR folders and refactor CMakeLists.txt files This commit is introducing the following macro changes: (1) Migrate NAS 5GS lib files to a new 5GS subfolder in NR_UE and organize NAS 5GS lib messages into 5GMM and 5GSM subfolders. A nested CMake structure was implemented and CMakeLists.txt were added whenever necessary. This is effectively separating 5GS libraries from LTE libraries. (2) In order to simplify the separation of 5GS libs from LTE libs, remaining dependencies from NAS LTE (e.g. nas_ue_task.c, ue-idx-standalone) were removed in the process (3) ExtendedProtocolDiscriminator.c/.h and SpareHalfOctet.c/.h were deleted and affected types were replaced with simple integer types (4) Cleanup: unused definitions and libs (e.g. LIB_5GNAS_GNB) were removed (5) Update doc/Doxyfile (6) clang-formatted the migrated files in the process (7) Update includes of headers in affected files --- CMakeLists.txt | 74 +--------- doc/Doxyfile | 36 +---- executables/nr-uesoftmodem.h | 1 - openair3/CMakeLists.txt | 3 +- openair3/NAS/CMakeLists.txt | 2 + openair3/NAS/COMMON/CMakeLists.txt | 2 +- openair3/NAS/COMMON/EMM/MSG/CMakeLists.txt | 10 -- openair3/NAS/COMMON/IES/CMakeLists.txt | 11 +- .../IES/ExtendedProtocolDiscriminator.c | 50 ------- .../IES/ExtendedProtocolDiscriminator.h | 48 ------ openair3/NAS/COMMON/IES/SpareHalfOctet.c | 50 ------- openair3/NAS/COMMON/IES/SpareHalfOctet.h | 51 ------- openair3/NAS/COMMON/UTIL/CMakeLists.txt | 6 + .../NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt | 9 ++ .../5GS/5GMM}/IES/FGCNasMessageContainer.c | 10 +- .../5GS/5GMM}/IES/FGCNasMessageContainer.h | 1 - .../5GS/5GMM}/IES/FGMMCapability.c | 16 +- .../5GS/5GMM}/IES/FGMMCapability.h | 4 - .../5GS/5GMM}/IES/FGSDeregistrationType.h | 0 .../5GS/5GMM}/IES/FGSMobileIdentity.c | 75 ++++------ .../5GS/5GMM}/IES/FGSMobileIdentity.h | 138 +++++++++--------- .../5GS/5GMM}/IES/FGSRegistrationResult.c | 10 +- .../5GS/5GMM}/IES/FGSRegistrationResult.h | 14 +- .../5GS/5GMM}/IES/FGSRegistrationType.c | 5 +- .../5GS/5GMM}/IES/FGSRegistrationType.h | 5 +- .../5GS/5GMM}/IES/NrUESecurityCapability.c | 33 ++--- .../5GS/5GMM}/IES/NrUESecurityCapability.h | 3 - .../5GS/5GMM}/IES/SORTransparentContainer.c | 19 +-- .../5GS/5GMM}/IES/SORTransparentContainer.h | 1 - .../NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt | 13 ++ .../5GS/5GMM}/MSG/FGSAuthenticationResponse.c | 11 +- .../5GS/5GMM}/MSG/FGSAuthenticationResponse.h | 16 +- .../FGSDeregistrationRequestUEOriginating.c | 10 +- .../FGSDeregistrationRequestUEOriginating.h | 16 +- .../5GS/5GMM}/MSG/FGSIdentityResponse.c | 16 +- .../5GS/5GMM}/MSG/FGSIdentityResponse.h | 19 +-- .../5GMM}/MSG/FGSNASSecurityModeComplete.c | 41 +++--- .../5GMM}/MSG/FGSNASSecurityModeComplete.h | 24 ++- .../5GS/5GMM}/MSG/FGSUplinkNasTransport.c | 69 ++++----- .../5GS/5GMM}/MSG/FGSUplinkNasTransport.h | 42 +++--- .../5GS/5GMM}/MSG/RegistrationAccept.c | 7 +- .../5GS/5GMM}/MSG/RegistrationAccept.h | 14 +- .../5GS/5GMM}/MSG/RegistrationComplete.c | 18 +-- .../5GS/5GMM}/MSG/RegistrationComplete.h | 20 +-- .../5GS/5GMM}/MSG/RegistrationRequest.c | 43 +++--- .../5GS/5GMM}/MSG/RegistrationRequest.h | 80 +++++----- .../5GS/5GMM}/MSG/fgs_service_request.c | 0 .../5GS/5GMM}/MSG/fgs_service_request.h | 3 - .../NAS/NR_UE/5GS/5GSM/MSG/CMakeLists.txt | 3 + .../5GSM}/MSG/PduSessionEstablishRequest.c | 14 +- .../5GSM}/MSG/PduSessionEstablishRequest.h | 27 ++-- .../5GSM}/MSG/PduSessionEstablishmentAccept.c | 19 +-- .../5GSM}/MSG/PduSessionEstablishmentAccept.h | 80 +++++----- openair3/NAS/NR_UE/5GS/CMakeLists.txt | 7 + .../EMM => NR_UE/5GS}/tests/CMakeLists.txt | 5 +- .../EMM => NR_UE/5GS}/tests/nas_lib_test.c | 0 openair3/NAS/NR_UE/CMakeLists.txt | 19 +++ openair3/NAS/NR_UE/nr_nas_msg.c | 2 +- openair3/NAS/NR_UE/nr_nas_msg.h | 2 +- openair3/NAS/UE/API/CMakeLists.txt | 1 + openair3/NAS/UE/API/USIM/CMakeLists.txt | 9 ++ openair3/NAS/UE/CMakeLists.txt | 1 + openair3/UICC/CMakeLists.txt | 2 + 63 files changed, 475 insertions(+), 865 deletions(-) delete mode 100644 openair3/NAS/COMMON/EMM/MSG/CMakeLists.txt delete mode 100644 openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c delete mode 100644 openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h delete mode 100644 openair3/NAS/COMMON/IES/SpareHalfOctet.c delete mode 100644 openair3/NAS/COMMON/IES/SpareHalfOctet.h create mode 100644 openair3/NAS/COMMON/UTIL/CMakeLists.txt create mode 100644 openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGCNasMessageContainer.c (92%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGCNasMessageContainer.h (99%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGMMCapability.c (90%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGMMCapability.h (99%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSDeregistrationType.h (100%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSMobileIdentity.c (81%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSMobileIdentity.h (64%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSRegistrationResult.c (93%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSRegistrationResult.h (93%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSRegistrationType.c (94%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/FGSRegistrationType.h (98%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/NrUESecurityCapability.c (76%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/NrUESecurityCapability.h (99%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/SORTransparentContainer.c (84%) rename openair3/NAS/{COMMON => NR_UE/5GS/5GMM}/IES/SORTransparentContainer.h (99%) create mode 100644 openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSAuthenticationResponse.c (79%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSAuthenticationResponse.h (81%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSDeregistrationRequestUEOriginating.c (89%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSDeregistrationRequestUEOriginating.h (91%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSIdentityResponse.c (83%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSIdentityResponse.h (81%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSNASSecurityModeComplete.c (70%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSNASSecurityModeComplete.h (79%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSUplinkNasTransport.c (71%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/FGSUplinkNasTransport.h (69%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/RegistrationAccept.c (94%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/RegistrationAccept.h (84%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/RegistrationComplete.c (78%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/RegistrationComplete.h (81%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/RegistrationRequest.c (78%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/RegistrationRequest.h (57%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/fgs_service_request.c (100%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS/5GMM}/MSG/fgs_service_request.h (95%) create mode 100644 openair3/NAS/NR_UE/5GS/5GSM/MSG/CMakeLists.txt rename openair3/NAS/{COMMON/ESM => NR_UE/5GS/5GSM}/MSG/PduSessionEstablishRequest.c (95%) rename openair3/NAS/{COMMON/ESM => NR_UE/5GS/5GSM}/MSG/PduSessionEstablishRequest.h (75%) rename openair3/NAS/{COMMON/ESM => NR_UE/5GS/5GSM}/MSG/PduSessionEstablishmentAccept.c (93%) rename openair3/NAS/{COMMON/ESM => NR_UE/5GS/5GSM}/MSG/PduSessionEstablishmentAccept.h (74%) create mode 100644 openair3/NAS/NR_UE/5GS/CMakeLists.txt rename openair3/NAS/{COMMON/EMM => NR_UE/5GS}/tests/CMakeLists.txt (74%) rename openair3/NAS/{COMMON/EMM => NR_UE/5GS}/tests/nas_lib_test.c (100%) create mode 100644 openair3/NAS/NR_UE/CMakeLists.txt create mode 100644 openair3/NAS/UE/API/CMakeLists.txt create mode 100644 openair3/NAS/UE/API/USIM/CMakeLists.txt create mode 100644 openair3/NAS/UE/CMakeLists.txt create mode 100644 openair3/UICC/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 211af664fd..9e2763671d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1477,6 +1477,7 @@ target_link_libraries(L2_UE PRIVATE asn1_lte_rrc_hdrs) add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} ) target_link_libraries(NR_L2_UE PRIVATE f1ap nr_rlc) target_link_libraries(NR_L2_UE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs nr_common nr_ue_power_procedures nr_ue_ra_procedures) +target_link_libraries(NR_L2_UE PRIVATE nr_nas) add_library(MAC_NR_COMMON ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -1521,6 +1522,7 @@ add_library(SCTP_CLIENT ${SCTP_SRC}) target_link_libraries(SCTP_CLIENT PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) set(NAS_SRC ${OPENAIR3_DIR}/NAS/) + set(libnas_api_OBJS ${NAS_SRC}COMMON/API/NETWORK/as_message.c ${NAS_SRC}COMMON/API/NETWORK/nas_message.c @@ -1560,10 +1562,6 @@ set(libnas_emm_msg_OBJS ${NAS_SRC}COMMON/EMM/MSG/UplinkNasTransport.c ) -set(libnas_fgs_msg_OBJS - ${NAS_SRC}COMMON/EMM/MSG/fgs_service_request.c -) - set(libnas_esm_msg_OBJS ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c @@ -1752,61 +1750,6 @@ set(libnas_ue_esm_sap_OBJS ${NAS_SRC}UE/ESM/SAP/esm_sap.c ) -set(libnrnas_emm_msg_OBJS - ${NAS_SRC}COMMON/EMM/MSG/RegistrationRequest.c - ${NAS_SRC}COMMON/EMM/MSG/RegistrationAccept.c - ${NAS_SRC}COMMON/EMM/MSG/FGSIdentityResponse.c - ${NAS_SRC}COMMON/EMM/MSG/FGSAuthenticationResponse.c - ${NAS_SRC}COMMON/EMM/MSG/FGSNASSecurityModeComplete.c - ${NAS_SRC}COMMON/EMM/MSG/RegistrationComplete.c - ${NAS_SRC}COMMON/EMM/MSG/FGSUplinkNasTransport.c - ${NAS_SRC}COMMON/ESM/MSG/PduSessionEstablishRequest.c - ${NAS_SRC}COMMON/ESM/MSG/PduSessionEstablishmentAccept.c - ${NAS_SRC}COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.c - ) - -set(libnrnas_ies_OBJS - ${NAS_SRC}COMMON/IES/ExtendedProtocolDiscriminator.c - ${NAS_SRC}COMMON/IES/FGSMobileIdentity.c - ${NAS_SRC}COMMON/IES/FGSRegistrationType.c - ${NAS_SRC}COMMON/IES/SpareHalfOctet.c - ${NAS_SRC}COMMON/IES/FGSRegistrationResult.c - ${NAS_SRC}COMMON/IES/FGMMCapability.c - ${NAS_SRC}COMMON/IES/NrUESecurityCapability.c - ${NAS_SRC}COMMON/IES/FGCNasMessageContainer.c - ${NAS_SRC}COMMON/IES/SORTransparentContainer.c - ) - -add_library(LIB_NAS_SIMUE - ${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 - ${NAS_SRC}NR_UE/nr_nas_msg.c - ${libnas_api_OBJS} - ${libnas_ue_api_OBJS} - ${libnas_emm_msg_OBJS} - ${libnas_fgs_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} - ${libnrnas_emm_msg_OBJS} - ${libnrnas_ies_OBJS} - $ - ) -target_include_directories(LIB_NAS_SIMUE PRIVATE ${OPENAIR_DIR}/common/utils/ds/) -target_link_libraries(LIB_NAS_SIMUE PRIVATE lte_rrc) - - - -set(NAS_SIM_LIB LIB_NAS_SIMUE) -target_link_libraries(LIB_NAS_SIMUE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) - add_library(LIB_NAS_UE ${NAS_SRC}UE/nas_itti_messaging.c ${NAS_SRC}UE/nas_network.c @@ -1846,15 +1789,6 @@ set (NBIOT_SOURCES ) add_library(NB_IoT MODULE ${NBIOT_SOURCES} ) -add_library(LIB_5GNAS_GNB - ${NAS_SRC}/COMMON/nr_common.c - ${OPENAIR3_DIR}//UICC/usim_interface.c - ) - -target_include_directories(LIB_5GNAS_GNB PRIVATE ${OPENAIR_DIR}/common/utils/ds/) -target_link_libraries(LIB_5GNAS_GNB PRIVATE SECURITY) -target_link_libraries(LIB_5GNAS_GNB PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) - # Simulation library ########################## set (SIMUSRC @@ -2075,7 +2009,6 @@ add_executable(nr-uesoftmodem ${OPENAIR_DIR}/radio/COMMON/common_lib.c ${OPENAIR_DIR}/radio/COMMON/record_player.c ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c - ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c ) @@ -2084,11 +2017,12 @@ target_link_libraries(nr-uesoftmodem PRIVATE nr_rrc SECURITY UTIL HASHTABLE SCHED_RU_LIB SCHED_NR_UE_LIB PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_NR_LIB - ITTI LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB} SIMU shlib_loader + ITTI SIMU shlib_loader -Wl,--end-group z dl) target_link_libraries(nr-uesoftmodem PRIVATE pthread m CONFIG_LIB rt nr_ue_phy_meas) target_link_libraries(nr-uesoftmodem PRIVATE ${T_LIB}) +target_link_libraries(nr-uesoftmodem PRIVATE nr_nas lib_uicc usim_lib) target_link_libraries(nr-uesoftmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) add_dependencies( nr-uesoftmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc ) diff --git a/doc/Doxyfile b/doc/Doxyfile index 564c43bb3f..096c0882ff 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -1134,7 +1134,7 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/UICC/usim_interface.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/ocp-gtpu/gtp_itf.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msg.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msgc \ +@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/nr_nas_msg.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/nas_itti_messaging.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/user_defs.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/UE/EMM/emm_proc.h \ @@ -1275,12 +1275,10 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/emm_msg.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachReject.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/SecurityModeReject.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/UplinkNasTransport.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AuthenticationResponse.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachComplete.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/ExtendedServiceRequest.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/DownlinkNasTransport.h \ @@ -1290,7 +1288,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachReject.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachAccept.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/ServiceReject.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachComplete.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachRequest.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c \ @@ -1302,17 +1299,14 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachAccept.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/IdentityResponse.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/GutiReallocationComplete.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/ServiceRequest.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/IdentityRequest.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/DetachAccept.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AttachRequest.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/EmmStatus.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AuthenticationFailure.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/AuthenticationReject.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h \ @@ -1322,13 +1316,14 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/IdentityResponse.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/emm_cause.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/EmmInformation.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/IdentityRequest.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/GutiReallocationCommand.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h \ +@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/5GS/5GMM/MSG \ +@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/5GS/5GMM/IES \ +@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/5GS/5GSM \ +@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/NR_UE/5GS/5GSM/MSG \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/parser.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/device.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/device.c \ @@ -1354,7 +1349,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AuthenticationParameterRand.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ProtocolDiscriminator.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/CsfbResponse.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EsmCause.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.h \ @@ -1368,7 +1362,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/LlcServiceAccessPointIdentifier.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TransactionIdentifier.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/GutiType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SupportedCodecList.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MobileStationClassmark3.c \ @@ -1392,12 +1385,10 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/UeSecurityCapability.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ApnAggregateMaximumBitRate.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ImeisvRequest.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SpareHalfOctet.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PdnType.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ShortMac.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MobileStationClassmark3.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TrafficFlowTemplate.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SORTransparentContainer.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NasPagingIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NasMessageContainer.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/Cli.h \ @@ -1407,18 +1398,15 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/DetachType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EmergencyNumberList.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EsmMessageContainer.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSRegistrationResult.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/GprsTimer.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TmsiStatus.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/IdentityType2.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsQualityOfService.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/LocationAreaIdentification.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGCNasMessageContainer.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TrackingAreaIdentityList.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MsNetworkCapability.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ShortMac.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSRegistrationResult.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AuthenticationFailureParameter.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TrackingAreaIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EmmCause.h \ @@ -1433,12 +1421,10 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AuthenticationParameterAutn.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PdnAddress.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EsmInformationTransferFlag.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SpareHalfOctet.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/KsiAndSequenceNumber.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/LocationAreaIdentification.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/QualityOfService.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ProcedureTransactionIdentity.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NrUESecurityCapability.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ProtocolConfigurationOptions.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SsCode.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsQualityOfService.h \ @@ -1448,12 +1434,10 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsMobileIdentity.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MobileIdentity.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SsCode.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSRegistrationType.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TrackingAreaIdentity.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsBearerIdentity.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NasMessageContainer.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/DetachType.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGMMCapability.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TmsiStatus.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MobileStationClassmark2.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MessageType.c \ @@ -1467,13 +1451,10 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AdditionalUpdateType.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NasRequestType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsBearerContextStatus.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSMobileIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/LcsClientIdentity.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSMobileIdentity.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/ServiceType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PagingIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/UeNetworkCapability.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NrUESecurityCapability.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AuthenticationParameterAutn.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PdnAddress.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsUpdateType.h \ @@ -1481,7 +1462,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PTmsiSignature.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PacketFlowIdentifier.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGCNasMessageContainer.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/PTmsiSignature.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsMobileIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/GutiType.h \ @@ -1497,16 +1477,13 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NasKeySetIdentifier.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsAttachResult.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AccessPointName.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGMMCapability.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AdditionalUpdateResult.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsAttachType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/UeNetworkCapability.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSDeregistrationType.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EsmMessageContainer.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SecurityHeaderType.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EsmCause.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NasSecurityAlgorithms.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SORTransparentContainer.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AdditionalUpdateType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/MsNetworkFeatureSupport.c \ @@ -1519,14 +1496,12 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsBearerIdentity.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EsmInformationTransferFlag.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/TimeZoneAndTime.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/FGSRegistrationType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsUpdateResult.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/EpsUpdateType.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/AuthenticationResponseParameter.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/NetworkName.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/LinkedEpsBearerIdentity.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/IES/SupportedCodecList.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/NR_NAS_defs.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/milenage.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/ESM/MSG/EsmStatus.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h \ @@ -1581,7 +1556,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/ESM/MSG/EsmInformationResponse.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/userDef.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/nr_common.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/UTILS/conversions.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/X2AP/x2ap_eNB_encoder.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/X2AP/x2ap_eNB_management_procedures.c \ diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 40ff2075a5..c689e6531d 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -47,7 +47,6 @@ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, .strptr=&nrUE_params.uecap_file, .defstrval="./uecap_ports1.xml", TYPE_STRING, 0}, \ {"reconfig-file", CONFIG_HLP_RE_CFG_FILE, 0, .strptr=&nrUE_params.reconfig_file, .defstrval="./reconfig.raw", TYPE_STRING, 0}, \ {"rbconfig-file", CONFIG_HLP_RB_CFG_FILE, 0, .strptr=&nrUE_params.rbconfig_file, .defstrval="./rbconfig.raw", TYPE_STRING, 0}, \ - {"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \ {"ue-rxgain", CONFIG_HLP_UERXG, 0, .dblptr=&nrUE_params.rx_gain, .defdblval=110, TYPE_DOUBLE, 0}, \ {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, .dblptr=&nrUE_params.rx_gain_off, .defdblval=0, TYPE_DOUBLE, 0}, \ {"ue-txgain", CONFIG_HLP_UETXG, 0, .dblptr=&nrUE_params.tx_gain, .defdblval=0, TYPE_DOUBLE, 0}, \ diff --git a/openair3/CMakeLists.txt b/openair3/CMakeLists.txt index f638abbaaa..55f9fe91d6 100644 --- a/openair3/CMakeLists.txt +++ b/openair3/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(LPP) add_subdirectory(M3AP) add_subdirectory(S1AP) +add_subdirectory(NAS) add_subdirectory(NGAP) add_subdirectory(NRPPA) -add_subdirectory(NAS) +add_subdirectory(UICC) diff --git a/openair3/NAS/CMakeLists.txt b/openair3/NAS/CMakeLists.txt index 50cbedd280..50bfe97bc3 100644 --- a/openair3/NAS/CMakeLists.txt +++ b/openair3/NAS/CMakeLists.txt @@ -1 +1,3 @@ add_subdirectory(COMMON) +add_subdirectory(NR_UE) +add_subdirectory(UE) diff --git a/openair3/NAS/COMMON/CMakeLists.txt b/openair3/NAS/COMMON/CMakeLists.txt index 21de73f92f..820b03f2b8 100644 --- a/openair3/NAS/COMMON/CMakeLists.txt +++ b/openair3/NAS/COMMON/CMakeLists.txt @@ -1,2 +1,2 @@ add_subdirectory(IES) -add_subdirectory(EMM) +add_subdirectory(UTIL) diff --git a/openair3/NAS/COMMON/EMM/MSG/CMakeLists.txt b/openair3/NAS/COMMON/EMM/MSG/CMakeLists.txt deleted file mode 100644 index fed78e453d..0000000000 --- a/openair3/NAS/COMMON/EMM/MSG/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_library(fgs_lib OBJECT - fgs_service_request.c -) - -target_link_libraries(fgs_lib PUBLIC fgs_ies_lib) - -target_include_directories(fgs_lib PUBLIC - ${CMAKE_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} -) diff --git a/openair3/NAS/COMMON/IES/CMakeLists.txt b/openair3/NAS/COMMON/IES/CMakeLists.txt index 99df08e7b0..bf80586fbc 100644 --- a/openair3/NAS/COMMON/IES/CMakeLists.txt +++ b/openair3/NAS/COMMON/IES/CMakeLists.txt @@ -1,9 +1,8 @@ -add_library(fgs_ies_lib OBJECT - NasKeySetIdentifier.c - FGSMobileIdentity.c +add_library(nas_common_ies_lib OBJECT + AuthenticationResponseParameter.c + NasKeySetIdentifier.c ) -target_include_directories(fgs_ies_lib PUBLIC - ${CMAKE_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} +target_include_directories(nas_common_ies_lib PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c b/openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c deleted file mode 100644 index e3b4bd021a..0000000000 --- a/openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file ExtendedProtocolDiscriminator.c - -\brief Extended protocol discriminator for registration request procedures -\author Yoshio INOUE, Masayuki HARADA -\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com -\date 2020 -\version 0.1 -*/ - -#include -#include -#include - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "ExtendedProtocolDiscriminator.h" - -int encode_ex_protocol_discriminator(ExtendedProtocolDiscriminator *exprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int decode_ex_protocol_discriminator(ExtendedProtocolDiscriminator *exprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h b/openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h deleted file mode 100644 index 3bf1f6ec8f..0000000000 --- a/openair3/NAS/COMMON/IES/ExtendedProtocolDiscriminator.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file ExtendedProtocolDiscriminator.h - -\brief Extended protocol discriminator for registration request procedures -\author Yoshio INOUE, Masayuki HARADA -\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com -\date 2020 -\version 0.1 -*/ - -#include -#include -#include - -#include "OctetString.h" - -#ifndef EXTENDED_PROTOCOL_DISCRIMINATOR_H_ -#define EXTENDED_PROTOCOL_DISCRIMINATOR_H_ - -typedef uint8_t ExtendedProtocolDiscriminator; - -int encode_ex_protocol_discriminator(ExtendedProtocolDiscriminator *exprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_ex_protocol_discriminator(ExtendedProtocolDiscriminator *exprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* EXTENDED PROTOCOL DISCRIMINATOR_H_ */ - diff --git a/openair3/NAS/COMMON/IES/SpareHalfOctet.c b/openair3/NAS/COMMON/IES/SpareHalfOctet.c deleted file mode 100644 index 60c45e07c2..0000000000 --- a/openair3/NAS/COMMON/IES/SpareHalfOctet.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file SpareHalfOctet.c - -\brief registration request procedures for gNB -\author Yoshio INOUE, Masayuki HARADA -\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com -\date 2020 -\version 0.1 -*/ - -#include -#include -#include - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" -#include "SpareHalfOctet.h" - -int decode_spare_half_octet(SpareHalfOctet *sparehalfoctet, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - -int encode_spare_half_octet(SpareHalfOctet *sparehalfoctet, uint8_t iei, uint8_t *buffer, uint32_t len) -{ - return 0; -} - diff --git a/openair3/NAS/COMMON/IES/SpareHalfOctet.h b/openair3/NAS/COMMON/IES/SpareHalfOctet.h deleted file mode 100644 index fbf410d4f8..0000000000 --- a/openair3/NAS/COMMON/IES/SpareHalfOctet.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file SpareHalfOctet.h - -\brief registration request procedures for gNB -\author Yoshio INOUE, Masayuki HARADA -\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com -\date 2020 -\version 0.1 -*/ - -#include -#include -#include - -#include "OctetString.h" - -#ifndef SPARE_HALF_OCTET_H_ -#define SPARE_HALF_OCTET_H_ - -#define SPARE_HALF_OCTET_MINIMUM_LENGTH 1 -#define SPARE_HALF_OCTET_MAXIMUM_LENGTH 1 - -typedef uint8_t SpareHalfOctet; - -int encode_spare_half_octet(SpareHalfOctet *sparehalfoctet, uint8_t iei, uint8_t *buffer, uint32_t len); - -int decode_spare_half_octet(SpareHalfOctet *sparehalfoctet, uint8_t iei, uint8_t *buffer, uint32_t len); - -#endif /* SPARE HALF OCTET_H_ */ - diff --git a/openair3/NAS/COMMON/UTIL/CMakeLists.txt b/openair3/NAS/COMMON/UTIL/CMakeLists.txt new file mode 100644 index 0000000000..dc29dff207 --- /dev/null +++ b/openair3/NAS/COMMON/UTIL/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(nas_utils OBJECT + TLVDecoder.c + OctetString.c +) + +target_include_directories(nas_utils PRIVATE .) diff --git a/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt new file mode 100644 index 0000000000..0915eed19c --- /dev/null +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(fgs_5gmm_ies_lib OBJECT + FGSMobileIdentity.c + FGSRegistrationType.c + FGSRegistrationResult.c + FGMMCapability.c + NrUESecurityCapability.c + FGCNasMessageContainer.c + SORTransparentContainer.c +) diff --git a/openair3/NAS/COMMON/IES/FGCNasMessageContainer.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGCNasMessageContainer.c similarity index 92% rename from openair3/NAS/COMMON/IES/FGCNasMessageContainer.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGCNasMessageContainer.c index 4e8de951a5..9c317c59d5 100644 --- a/openair3/NAS/COMMON/IES/FGCNasMessageContainer.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGCNasMessageContainer.c @@ -32,7 +32,6 @@ #include #include - #include "TLVEncoder.h" #include "TLVDecoder.h" #include "FGCNasMessageContainer.h" @@ -52,7 +51,9 @@ int decode_fgc_nas_message_container(FGCNasMessageContainer *nasmessagecontainer decoded += 2; CHECK_LENGTH_DECODER(len - decoded, ielen); - if ((decode_result = decode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, ielen, buffer + decoded, len - decoded)) < 0) + if ((decode_result = + decode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, ielen, buffer + decoded, len - decoded)) + < 0) return decode_result; else decoded += decode_result; @@ -73,7 +74,8 @@ int encode_fgc_nas_message_container(FGCNasMessageContainer *nasmessagecontainer encoded += 2; - if ((encode_result = encode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, buffer + encoded, len - encoded)) < 0) { + if ((encode_result = encode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, buffer + encoded, len - encoded)) + < 0) { return encode_result; } else { uint16_t tmp = htons(encoded + encode_result - 3); @@ -95,5 +97,3 @@ void dump_fgc_nas_message_container_xml(FGCNasMessageContainer *nasmessagecontai printf("%s", dump_octet_string_xml(&nasmessagecontainer->nasmessagecontainercontents)); printf("\n"); } - - diff --git a/openair3/NAS/COMMON/IES/FGCNasMessageContainer.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGCNasMessageContainer.h similarity index 99% rename from openair3/NAS/COMMON/IES/FGCNasMessageContainer.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGCNasMessageContainer.h index 19a1679b7e..5e9c8aac12 100644 --- a/openair3/NAS/COMMON/IES/FGCNasMessageContainer.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGCNasMessageContainer.h @@ -51,4 +51,3 @@ int decode_fgc_nas_message_container(FGCNasMessageContainer *nasmessagecontainer void dump_fgc_nas_message_container_xml(FGCNasMessageContainer *nasmessagecontainer, uint8_t iei); #endif /* FGC NAS MESSAGE CONTAINER_H_ */ - diff --git a/openair3/NAS/COMMON/IES/FGMMCapability.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGMMCapability.c similarity index 90% rename from openair3/NAS/COMMON/IES/FGMMCapability.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGMMCapability.c index ce156e63bf..3a275ced7f 100644 --- a/openair3/NAS/COMMON/IES/FGMMCapability.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGMMCapability.c @@ -31,24 +31,20 @@ #include #include - #include "TLVEncoder.h" #include "TLVDecoder.h" #include "FGMMCapability.h" - - int encode_5gmm_capability(FGMMCapability *fgmmcapability, uint8_t iei, uint8_t *buffer, uint32_t len) { int encoded = 0; - if(iei){ + if (iei) { *buffer = fgmmcapability->iei; - encoded++; - *(buffer+encoded) = fgmmcapability->length; - encoded++; - *(buffer+encoded) = fgmmcapability->value; - encoded++; + encoded++; + *(buffer + encoded) = fgmmcapability->length; + encoded++; + *(buffer + encoded) = fgmmcapability->value; + encoded++; } return encoded; } - diff --git a/openair3/NAS/COMMON/IES/FGMMCapability.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGMMCapability.h similarity index 99% rename from openair3/NAS/COMMON/IES/FGMMCapability.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGMMCapability.h index d427896338..a28ba2ff3b 100644 --- a/openair3/NAS/COMMON/IES/FGMMCapability.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGMMCapability.h @@ -27,7 +27,6 @@ * \version 0.1 */ - #include #include #include @@ -37,15 +36,12 @@ #ifndef FGMM_CAPABILITY_H_ #define FGMM_CAPABILITY_H_ - typedef struct { uint8_t iei; uint8_t length; uint8_t value; } FGMMCapability; - int encode_5gmm_capability(FGMMCapability *fgmmcapability, uint8_t iei, uint8_t *buffer, uint32_t len); #endif /* FGMM_CAPABILITY_H_ */ - diff --git a/openair3/NAS/COMMON/IES/FGSDeregistrationType.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSDeregistrationType.h similarity index 100% rename from openair3/NAS/COMMON/IES/FGSDeregistrationType.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSDeregistrationType.h diff --git a/openair3/NAS/COMMON/IES/FGSMobileIdentity.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.c similarity index 81% rename from openair3/NAS/COMMON/IES/FGSMobileIdentity.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.c index f70dfc66ed..6407448279 100644 --- a/openair3/NAS/COMMON/IES/FGSMobileIdentity.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.c @@ -27,7 +27,6 @@ * \version 0.1 */ - #include #include #include @@ -115,8 +114,7 @@ int decode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei uint8_t typeofidentity = *(buffer + decoded) & 0x7; if (typeofidentity == FGS_MOBILE_IDENTITY_5G_GUTI) { - decoded_rc = decode_guti_5gs_mobile_identity(&fgsmobileidentity->guti, - buffer + decoded); + decoded_rc = decode_guti_5gs_mobile_identity(&fgsmobileidentity->guti, buffer + decoded); } else { AssertFatal(false, "Mobile Identity encoding of type %d not implemented\n", typeofidentity); } @@ -146,18 +144,15 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei len -= encoded; if (fgsmobileidentity->guti.typeofidentity == FGS_MOBILE_IDENTITY_5G_GUTI) { - encoded_rc = encode_guti_5gs_mobile_identity(&fgsmobileidentity->guti, - buffer + encoded); + encoded_rc = encode_guti_5gs_mobile_identity(&fgsmobileidentity->guti, buffer + encoded); } if (fgsmobileidentity->suci.typeofidentity == FGS_MOBILE_IDENTITY_SUCI) { - encoded_rc = encode_suci_5gs_mobile_identity(&fgsmobileidentity->suci, - buffer + encoded); + encoded_rc = encode_suci_5gs_mobile_identity(&fgsmobileidentity->suci, buffer + encoded); } if (fgsmobileidentity->imeisv.typeofidentity == FGS_MOBILE_IDENTITY_IMEISV) { - encoded_rc = encode_imeisv_5gs_mobile_identity(&fgsmobileidentity->imeisv, - buffer + encoded); + encoded_rc = encode_imeisv_5gs_mobile_identity(&fgsmobileidentity->imeisv, buffer + encoded); } if (fgsmobileidentity->stmsi.typeofidentity == FGS_MOBILE_IDENTITY_5GS_TMSI) { @@ -168,7 +163,7 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei return encoded_rc; } - if(iei > 0){ + if (iei > 0) { uint16_t tmp = htons(encoded + encoded_rc - 3); memcpy(buffer + 1, &tmp, sizeof(tmp)); } else { @@ -192,7 +187,6 @@ static int decode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, const return (TLV_ENCODE_VALUE_DOESNT_MATCH); } - guti->oddeven = (*(buffer + decoded) >> 3) & 0x1; /* @@ -218,33 +212,27 @@ static int decode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, const guti->mncdigit1 = *(buffer + decoded) & 0xf; decoded++; - - guti->amfregionid = *(buffer+decoded); + guti->amfregionid = *(buffer + decoded); decoded++; IES_DECODE_U16(buffer, decoded, temp); - guti->amfsetid = temp>>3; - guti->amfpointer = temp&0x3f; + guti->amfsetid = temp >> 3; + guti->amfpointer = temp & 0x3f; IES_DECODE_U32(buffer, decoded, guti->tmsi); return decoded; } - static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_t *buffer) { uint32_t encoded = 0; uint16_t temp; - *(buffer + encoded) = 0xf0 | ((guti->oddeven & 0x1) << 3) | - (guti->typeofidentity & 0x7); + *(buffer + encoded) = 0xf0 | ((guti->oddeven & 0x1) << 3) | (guti->typeofidentity & 0x7); encoded++; - *(buffer + encoded) = 0x00 | ((guti->mccdigit2 & 0xf) << 4) | - (guti->mccdigit1 & 0xf); + *(buffer + encoded) = 0x00 | ((guti->mccdigit2 & 0xf) << 4) | (guti->mccdigit1 & 0xf); encoded++; - *(buffer + encoded) = 0x00 | ((guti->mncdigit3 & 0xf) << 4) | - (guti->mccdigit3 & 0xf); + *(buffer + encoded) = 0x00 | ((guti->mncdigit3 & 0xf) << 4) | (guti->mccdigit3 & 0xf); encoded++; - *(buffer + encoded) = 0x00 | ((guti->mncdigit2 & 0xf) << 4) | - (guti->mncdigit1 & 0xf); + *(buffer + encoded) = 0x00 | ((guti->mncdigit2 & 0xf) << 4) | (guti->mncdigit1 & 0xf); encoded++; *(buffer + encoded) = guti->amfregionid; @@ -257,28 +245,22 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_ return encoded; } - static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_t *buffer) { uint32_t encoded = 0; *(buffer + encoded) = (suci->supiformat << 4) | (suci->typeofidentity); encoded++; - *(buffer + encoded) = ((suci->mccdigit2 & 0xf) << 4) | - (suci->mccdigit1 & 0xf); + *(buffer + encoded) = ((suci->mccdigit2 & 0xf) << 4) | (suci->mccdigit1 & 0xf); encoded++; - *(buffer + encoded) = ((suci->mncdigit3 & 0xf) << 4) | - (suci->mccdigit3 & 0xf); + *(buffer + encoded) = ((suci->mncdigit3 & 0xf) << 4) | (suci->mccdigit3 & 0xf); encoded++; - *(buffer + encoded) = ((suci->mncdigit2 & 0xf) << 4) | - (suci->mncdigit1 & 0xf); + *(buffer + encoded) = ((suci->mncdigit2 & 0xf) << 4) | (suci->mncdigit1 & 0xf); encoded++; - *(buffer + encoded) = ((suci->routingindicatordigit2 & 0xf) << 4) | - (suci->routingindicatordigit1 & 0xf); + *(buffer + encoded) = ((suci->routingindicatordigit2 & 0xf) << 4) | (suci->routingindicatordigit1 & 0xf); encoded++; - *(buffer + encoded) = ((suci->routingindicatordigit4 & 0xf) << 4) | - (suci->routingindicatordigit3 & 0xf); + *(buffer + encoded) = ((suci->routingindicatordigit4 & 0xf) << 4) | (suci->routingindicatordigit3 & 0xf); encoded++; *(buffer + encoded) = 0x00 | (suci->protectionschemeId & 0xf); @@ -287,15 +269,15 @@ static int encode_suci_5gs_mobile_identity(Suci5GSMobileIdentity_t *suci, uint8_ *(buffer + encoded) = suci->homenetworkpki; encoded++; - char *ptr=suci->schemeoutput; - while ( ptr < suci->schemeoutput+strlen(suci->schemeoutput) ) { - buffer[encoded]=((*(ptr+1)-'0')<<4) | (*(ptr) -'0'); + char *ptr = suci->schemeoutput; + while (ptr < suci->schemeoutput + strlen(suci->schemeoutput)) { + buffer[encoded] = ((*(ptr + 1) - '0') << 4) | (*(ptr) - '0'); encoded++; - ptr+=2; + ptr += 2; } - if (strlen(suci->schemeoutput)%2 == 1) - buffer[encoded++]=((*(ptr-1)-'0')) | 0xF0; + if (strlen(suci->schemeoutput) % 2 == 1) + buffer[encoded++] = ((*(ptr - 1) - '0')) | 0xF0; return encoded; } @@ -310,17 +292,16 @@ static int encode_imeisv_5gs_mobile_identity(Imeisv5GSMobileIdentity_t *imeisv, encoded++; *(buffer + encoded) = 0x00 | (imeisv->digittac07 << 4) | (imeisv->digittac06); encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit09 << 4) | (imeisv->digittac08); + *(buffer + encoded) = 0x00 | (imeisv->digit09 << 4) | (imeisv->digittac08); encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit11 << 4) | (imeisv->digit10); + *(buffer + encoded) = 0x00 | (imeisv->digit11 << 4) | (imeisv->digit10); encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | (imeisv->digit12); + *(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | (imeisv->digit12); encoded++; - *(buffer + encoded) = 0x00 | (imeisv->digitsv1 << 4) | (imeisv->digit14); + *(buffer + encoded) = 0x00 | (imeisv->digitsv1 << 4) | (imeisv->digit14); encoded++; - *(buffer + encoded) = 0x00 | (imeisv->spare << 4) | (imeisv->digitsv2); + *(buffer + encoded) = 0x00 | (imeisv->spare << 4) | (imeisv->digitsv2); encoded++; return encoded; } - diff --git a/openair3/NAS/COMMON/IES/FGSMobileIdentity.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h similarity index 64% rename from openair3/NAS/COMMON/IES/FGSMobileIdentity.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h index e4747461e9..a66b74dc51 100644 --- a/openair3/NAS/COMMON/IES/FGSMobileIdentity.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h @@ -27,7 +27,6 @@ * \version 0.1 */ - #include #include #include @@ -41,97 +40,96 @@ #define DIGIT1 0xF typedef struct { - uint8_t spare:5; - uint8_t typeofidentity:3; + uint8_t spare: 5; + uint8_t typeofidentity: 3; } NoIdentity5GSMobileIdentity_t; typedef struct { - uint8_t spare1:1; - uint8_t supiformat:3; - uint8_t spare2:1; - uint8_t typeofidentity:3; - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint8_t routingindicatordigit2:4; - uint8_t routingindicatordigit1:4; - uint8_t routingindicatordigit4:4; - uint8_t routingindicatordigit3:4; - uint8_t spare3:1; - uint8_t spare4:1; - uint8_t spare5:1; - uint8_t spare6:1; - uint8_t protectionschemeId:4; - uint8_t homenetworkpki; + uint8_t spare1: 1; + uint8_t supiformat: 3; + uint8_t spare2: 1; + uint8_t typeofidentity: 3; + uint8_t mccdigit2: 4; + uint8_t mccdigit1: 4; + uint8_t mncdigit3: 4; + uint8_t mccdigit3: 4; + uint8_t mncdigit2: 4; + uint8_t mncdigit1: 4; + uint8_t routingindicatordigit2: 4; + uint8_t routingindicatordigit1: 4; + uint8_t routingindicatordigit4: 4; + uint8_t routingindicatordigit3: 4; + uint8_t spare3: 1; + uint8_t spare4: 1; + uint8_t spare5: 1; + uint8_t spare6: 1; + uint8_t protectionschemeId: 4; + uint8_t homenetworkpki; char schemeoutput[32]; } Suci5GSMobileIdentity_t; typedef struct { - uint8_t spare:4; - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint8_t mccdigit2:4; - uint8_t mccdigit1:4; - uint8_t mncdigit3:4; - uint8_t mccdigit3:4; - uint8_t mncdigit2:4; - uint8_t mncdigit1:4; - uint8_t amfregionid; - uint16_t amfsetid:10; - uint16_t amfpointer:6; + uint8_t spare: 4; + uint8_t oddeven: 1; + uint8_t typeofidentity: 3; + uint8_t mccdigit2: 4; + uint8_t mccdigit1: 4; + uint8_t mncdigit3: 4; + uint8_t mccdigit3: 4; + uint8_t mncdigit2: 4; + uint8_t mncdigit1: 4; + uint8_t amfregionid; + uint16_t amfsetid: 10; + uint16_t amfpointer: 6; uint32_t tmsi; } Guti5GSMobileIdentity_t; - typedef struct { - uint8_t digit1:4; - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint8_t digitp1:4; - uint8_t digitp:4; + uint8_t digit1: 4; + uint8_t oddeven: 1; + uint8_t typeofidentity: 3; + uint8_t digitp1: 4; + uint8_t digitp: 4; } Imei5GSMobileIdentity_t; typedef struct { - uint8_t digittac01:4; - uint8_t oddeven:1; - uint8_t typeofidentity:3; - uint8_t digittac02:4; - uint8_t digittac03:4; - uint8_t digittac04:4; - uint8_t digittac05:4; - uint8_t digittac06:4; - uint8_t digittac07:4; - uint8_t digittac08:4; - uint8_t digit09:4; - uint8_t digit10:4; - uint8_t digit11:4; - uint8_t digit12:4; - uint8_t digit13:4; - uint8_t digit14:4; - uint8_t digitsv1:4; - uint8_t digitsv2:4; - uint8_t spare:4; + uint8_t digittac01: 4; + uint8_t oddeven: 1; + uint8_t typeofidentity: 3; + uint8_t digittac02: 4; + uint8_t digittac03: 4; + uint8_t digittac04: 4; + uint8_t digittac05: 4; + uint8_t digittac06: 4; + uint8_t digittac07: 4; + uint8_t digittac08: 4; + uint8_t digit09: 4; + uint8_t digit10: 4; + uint8_t digit11: 4; + uint8_t digit12: 4; + uint8_t digit13: 4; + uint8_t digit14: 4; + uint8_t digitsv1: 4; + uint8_t digitsv2: 4; + uint8_t spare: 4; } Imeisv5GSMobileIdentity_t; - typedef struct { - uint8_t digit1:4; - uint8_t spare:1; - uint8_t typeofidentity:3; - uint16_t amfsetid:10; - uint16_t amfpointer:6; + uint8_t digit1: 4; + uint8_t spare: 1; + uint8_t typeofidentity: 3; + uint16_t amfsetid: 10; + uint16_t amfpointer: 6; uint32_t tmsi; } Stmsi5GSMobileIdentity_t; typedef struct { - uint8_t spare:5; - uint8_t typeofidentity:3; - uint8_t macaddr; + uint8_t spare: 5; + uint8_t typeofidentity: 3; + uint8_t macaddr; } Macaddr5GSMobileIdentity_t; +// clang-format off typedef union FGSMobileIdentity_tag { #define FGS_MOBILE_IDENTITY_NOIDENTITY 0b000 #define FGS_MOBILE_IDENTITY_SUCI 0b001 @@ -148,6 +146,7 @@ typedef union FGSMobileIdentity_tag { Imeisv5GSMobileIdentity_t imeisv; Macaddr5GSMobileIdentity_t macaddress; } FGSMobileIdentity; +// clang-format on int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei, uint8_t *buffer, uint32_t len); @@ -157,4 +156,3 @@ int encode_stmsi_5gs_mobile_identity(uint8_t *buffer, Stmsi5GSMobileIdentity_t * int decode_stmsi_5gs_mobile_identity(Stmsi5GSMobileIdentity_t *stmsi, const uint8_t *buffer, uint32_t len); #endif /* FGS MOBILE IDENTITY_H_ */ - diff --git a/openair3/NAS/COMMON/IES/FGSRegistrationResult.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationResult.c similarity index 93% rename from openair3/NAS/COMMON/IES/FGSRegistrationResult.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationResult.c index e580b14409..88eb1b810b 100644 --- a/openair3/NAS/COMMON/IES/FGSRegistrationResult.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationResult.c @@ -32,19 +32,17 @@ #include #include - #include "TLVEncoder.h" #include "TLVDecoder.h" #include "FGSRegistrationResult.h" - int decode_fgs_registration_result(FGSRegistrationResult *fgsregistrationresult, uint8_t iei, uint16_t value, uint32_t len) { int decoded = 0; uint16_t *buffer = &value; fgsregistrationresult->registrationresult = *buffer & 0x7; fgsregistrationresult->smsallowed = *buffer & 0x8; - decoded = decoded+2; + decoded = decoded + 2; return decoded; } @@ -53,10 +51,8 @@ uint16_t encode_fgs_registration_result(FGSRegistrationResult *fgsregistrationre uint16_t bufferReturn; uint16_t *buffer = &bufferReturn; uint8_t encoded = 0; - *(buffer + encoded) = 0x00 | (fgsregistrationresult->smsallowed & 0x8) | - (fgsregistrationresult->registrationresult & 0x7); - encoded= encoded+2; + *(buffer + encoded) = 0x00 | (fgsregistrationresult->smsallowed & 0x8) | (fgsregistrationresult->registrationresult & 0x7); + encoded = encoded + 2; return bufferReturn; } - diff --git a/openair3/NAS/COMMON/IES/FGSRegistrationResult.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationResult.h similarity index 93% rename from openair3/NAS/COMMON/IES/FGSRegistrationResult.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationResult.h index 0a2dedc2e5..b792dad13c 100644 --- a/openair3/NAS/COMMON/IES/FGSRegistrationResult.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationResult.h @@ -34,8 +34,6 @@ #include "OctetString.h" - - #ifndef FGS_REGISTRATION_RESULT_H_ #define FGS_REGISTRATION_RESULT_H_ #define FGS_REGISTRATION_RESULT_3GPP 0b001 @@ -43,17 +41,15 @@ #define FGS_REGISTRATION_RESULT_3GPP_AND_NON_3GPP 0b011 typedef struct { - uint8_t iei; - uint8_t resultlength; - uint8_t spare:4; - uint8_t smsallowed:1; - uint8_t registrationresult:3; + uint8_t iei; + uint8_t resultlength; + uint8_t spare: 4; + uint8_t smsallowed: 1; + uint8_t registrationresult: 3; } FGSRegistrationResult; - uint16_t encode_fgs_registration_result(FGSRegistrationResult *fgsregistrationresult); int decode_fgs_registration_result(FGSRegistrationResult *fgsregistrationresult, uint8_t iei, uint16_t value, uint32_t len); #endif /* FGS REGISTRATION RESULT_H_*/ - diff --git a/openair3/NAS/COMMON/IES/FGSRegistrationType.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationType.c similarity index 94% rename from openair3/NAS/COMMON/IES/FGSRegistrationType.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationType.c index 7f1c3ae667..d50d7bc852 100644 --- a/openair3/NAS/COMMON/IES/FGSRegistrationType.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationType.c @@ -31,7 +31,6 @@ #include #include - #include "TLVEncoder.h" #include "TLVDecoder.h" #include "FGSRegistrationType.h" @@ -56,10 +55,8 @@ int encode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype) uint8_t *buffer = &bufferReturn; uint8_t encoded = 0; uint8_t iei = 0; - *(buffer + encoded) = 0x00 | (iei & 0xf0) | 0x8| - (*fgsregistrationtype & 0x7); + *(buffer + encoded) = 0x00 | (iei & 0xf0) | 0x8 | (*fgsregistrationtype & 0x7); encoded++; return bufferReturn; } - diff --git a/openair3/NAS/COMMON/IES/FGSRegistrationType.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationType.h similarity index 98% rename from openair3/NAS/COMMON/IES/FGSRegistrationType.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationType.h index a548d45d93..4298a33504 100644 --- a/openair3/NAS/COMMON/IES/FGSRegistrationType.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSRegistrationType.h @@ -40,16 +40,15 @@ typedef uint8_t FGSRegistrationType; - +// clang-format off #define INITIAL_REGISTRATION 0b001 #define MOBILITY_REGISTRATION_UPDATING 0b010 #define PERIODIC_REGISTRATION_UPDATING 0b011 #define EMERGENCY_REGISTRATION 0b100 +// clang-format on int encode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype); int decode_5gs_registration_type(FGSRegistrationType *fgsregistrationtype, uint8_t iei, uint8_t value, uint32_t len); - #endif /* FGS_REGISTRATION_TYPE_H_*/ - diff --git a/openair3/NAS/COMMON/IES/NrUESecurityCapability.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/NrUESecurityCapability.c similarity index 76% rename from openair3/NAS/COMMON/IES/NrUESecurityCapability.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/NrUESecurityCapability.c index 6c0ff7e7c7..d069b50a39 100644 --- a/openair3/NAS/COMMON/IES/NrUESecurityCapability.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/NrUESecurityCapability.c @@ -27,37 +27,32 @@ * \version 0.1 */ - #include #include #include - #include "TLVEncoder.h" #include "TLVDecoder.h" #include "NrUESecurityCapability.h" - - int encode_nrue_security_capability(NrUESecurityCapability *nruesecuritycapability, uint8_t iei, uint8_t *buffer, uint32_t len) { int encoded = 0; - if(iei){ + if (iei) { *buffer = nruesecuritycapability->iei; - encoded++; - *(buffer+encoded) = nruesecuritycapability->length; - encoded++; - *(buffer+encoded) = nruesecuritycapability->fg_EA; - encoded++; - *(buffer+encoded) = nruesecuritycapability->fg_IA; - encoded++; - *(buffer+encoded) = nruesecuritycapability->EEA; - encoded++; - *(buffer+encoded) = nruesecuritycapability->EIA; - encoded++; - if((nruesecuritycapability->length - 4) > 0) - encoded = encoded + nruesecuritycapability->length - 4; + encoded++; + *(buffer + encoded) = nruesecuritycapability->length; + encoded++; + *(buffer + encoded) = nruesecuritycapability->fg_EA; + encoded++; + *(buffer + encoded) = nruesecuritycapability->fg_IA; + encoded++; + *(buffer + encoded) = nruesecuritycapability->EEA; + encoded++; + *(buffer + encoded) = nruesecuritycapability->EIA; + encoded++; + if ((nruesecuritycapability->length - 4) > 0) + encoded = encoded + nruesecuritycapability->length - 4; } return encoded; } - diff --git a/openair3/NAS/COMMON/IES/NrUESecurityCapability.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/NrUESecurityCapability.h similarity index 99% rename from openair3/NAS/COMMON/IES/NrUESecurityCapability.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/NrUESecurityCapability.h index 10aa0cf0ea..b772feeba7 100644 --- a/openair3/NAS/COMMON/IES/NrUESecurityCapability.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/NrUESecurityCapability.h @@ -36,7 +36,6 @@ #ifndef NRUE_SECURITY_CAPABILITY_H_ #define NRUE_SECURITY_CAPABILITY_H_ - typedef struct { uint8_t iei; uint8_t length; @@ -46,8 +45,6 @@ typedef struct { uint8_t EIA; } NrUESecurityCapability; - int encode_nrue_security_capability(NrUESecurityCapability *nruesecuritycapability, uint8_t iei, uint8_t *buffer, uint32_t len); #endif /* NRUE_SECURITY_CAPABILITY_H_ */ - diff --git a/openair3/NAS/COMMON/IES/SORTransparentContainer.c b/openair3/NAS/NR_UE/5GS/5GMM/IES/SORTransparentContainer.c similarity index 84% rename from openair3/NAS/COMMON/IES/SORTransparentContainer.c rename to openair3/NAS/NR_UE/5GS/5GMM/IES/SORTransparentContainer.c index 3ab2a14c3d..3bbcb89f92 100644 --- a/openair3/NAS/COMMON/IES/SORTransparentContainer.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/SORTransparentContainer.c @@ -47,14 +47,15 @@ int decode_sor_transparent_container(SORTransparentContainer *sortransparentcont CHECK_LENGTH_DECODER(len - decoded, ielen); - - if ((decode_result = decode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, ielen, buffer + decoded, len - decoded)) < 0) { + if ((decode_result = + decode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, ielen, buffer + decoded, len - decoded)) + < 0) { LOG_FUNC_RETURN(decode_result); } else { decoded += decode_result; } -#if defined (NAS_DEBUG) +#if defined(NAS_DEBUG) dump_sor_transparent_container_xml(sortransparentcontainer, iei); #endif LOG_FUNC_RETURN(decoded); @@ -67,7 +68,7 @@ int encode_sor_transparent_container(SORTransparentContainer *sortransparentcont int32_t encode_result; /* Checking IEI and pointer */ CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH, len); -#if defined (NAS_DEBUG) +#if defined(NAS_DEBUG) dump_sor_transparent_container_xml(sortransparentcontainer, iei); #endif @@ -76,11 +77,12 @@ int encode_sor_transparent_container(SORTransparentContainer *sortransparentcont encoded++; } - lenPtr = (buffer + encoded); + lenPtr = (buffer + encoded); - //encoded += 2; - //if ((encode_result = encode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, buffer + sizeof(uint16_t), len - sizeof(uint16_t))) < 0) - if ((encode_result = encode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, lenPtr + sizeof(uint16_t), len - sizeof(uint16_t))) < 0) + if ((encode_result = encode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, + lenPtr + sizeof(uint16_t), + len - sizeof(uint16_t))) + < 0) return encode_result; else encoded += encode_result; @@ -100,4 +102,3 @@ void dump_sor_transparent_container_xml(SORTransparentContainer *sortransparentc printf("%s", dump_octet_string_xml(&sortransparentcontainer->sortransparentcontainercontents)); printf("\n"); } - diff --git a/openair3/NAS/COMMON/IES/SORTransparentContainer.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/SORTransparentContainer.h similarity index 99% rename from openair3/NAS/COMMON/IES/SORTransparentContainer.h rename to openair3/NAS/NR_UE/5GS/5GMM/IES/SORTransparentContainer.h index 587419b1f9..652710c0b3 100644 --- a/openair3/NAS/COMMON/IES/SORTransparentContainer.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/SORTransparentContainer.h @@ -42,4 +42,3 @@ int decode_sor_transparent_container(SORTransparentContainer *sortransparentcont void dump_sor_transparent_container_xml(SORTransparentContainer *sortransparentcontainer, uint8_t iei); #endif /* ESM MESSAGE CONTAINER_H_ */ - diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt new file mode 100644 index 0000000000..fab8d6b6ff --- /dev/null +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt @@ -0,0 +1,13 @@ +add_library(fgs_5gmm_lib OBJECT + fgs_service_request.c + RegistrationRequest.c + RegistrationAccept.c + FGSIdentityResponse.c + FGSAuthenticationResponse.c + FGSNASSecurityModeComplete.c + RegistrationComplete.c + FGSUplinkNasTransport.c + FGSDeregistrationRequestUEOriginating.c +) + +target_include_directories(fgs_5gmm_lib PUBLIC . ../IES) diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSAuthenticationResponse.c similarity index 79% rename from openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSAuthenticationResponse.c index 5e1ff25151..d93f03aed5 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSAuthenticationResponse.c @@ -37,20 +37,19 @@ #include "FGSAuthenticationResponse.h" - int encode_fgs_authentication_response(fgs_authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len) { int encoded = 0; int encode_result = 0; - - if ((encode_result = - encode_authentication_response_parameter(&authentication_response->authenticationresponseparameter, - AUTHENTICATION_RESPONSE_PARAMETER_IEI, buffer + encoded, len - encoded)) < 0) //Return in case of error + if ((encode_result = encode_authentication_response_parameter(&authentication_response->authenticationresponseparameter, + AUTHENTICATION_RESPONSE_PARAMETER_IEI, + buffer + encoded, + len - encoded)) + < 0) // Return in case of error return encode_result; else encoded += encode_result; return encoded; } - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSAuthenticationResponse.h similarity index 81% rename from openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSAuthenticationResponse.h index 0acee3382f..d67e43bb7b 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSAuthenticationResponse.h @@ -32,16 +32,14 @@ #include #include -#include "ExtendedProtocolDiscriminator.h" #include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" #include "MessageType.h" #include "AuthenticationResponseParameter.h" #ifndef FGS_AUTHENTICATION_RESPONSE_H_ #define FGS_AUTHENTICATION_RESPONSE_H_ -#define AUTHENTICATION_RESPONSE_PARAMETER_IEI 0x2d +#define AUTHENTICATION_RESPONSE_PARAMETER_IEI 0x2d /* * Message name: Identity response @@ -52,15 +50,13 @@ typedef struct fgs_authentication_response_msg_tag { /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; - AuthenticationResponseParameter authenticationresponseparameter; + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; + AuthenticationResponseParameter authenticationresponseparameter; } fgs_authentication_response_msg; int encode_fgs_authentication_response(fgs_authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len); #endif /* ! defined(FGS_AUTHENTICATION_RESPONSE_H_) */ - - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSDeregistrationRequestUEOriginating.c similarity index 89% rename from openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSDeregistrationRequestUEOriginating.c index af8dfd8c20..b5fdc5591a 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSDeregistrationRequestUEOriginating.c @@ -27,13 +27,9 @@ * \version 0.1 */ -#include -#include -#include -#include - #include "FGSDeregistrationRequestUEOriginating.h" #include "NR_NAS_defs.h" +#include int encode_fgs_deregistration_request_ue_originating(fgs_deregistration_request_ue_originating_msg *drr, uint8_t *buffer, @@ -41,9 +37,7 @@ int encode_fgs_deregistration_request_ue_originating(fgs_deregistration_request_ { int encoded = 0; FGSDeregistrationType *dt = &drr->deregistrationtype; - *(buffer + encoded) = ((dt->switchoff & 0x1) << 7) - | ((dt->reregistration_required & 0x1) << 6) - | ((dt->access_type & 0x3) << 4); + *(buffer + encoded) = ((dt->switchoff & 0x1) << 7) | ((dt->reregistration_required & 0x1) << 6) | ((dt->access_type & 0x3) << 4); int encode_result; if ((encode_result = encode_nas_key_set_identifier(&drr->naskeysetidentifier, IEI_NULL)) < 0) diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSDeregistrationRequestUEOriginating.h similarity index 91% rename from openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSDeregistrationRequestUEOriginating.h index 2bccd8a5bd..566c00c11c 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSDeregistrationRequestUEOriginating.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSDeregistrationRequestUEOriginating.h @@ -22,17 +22,12 @@ #ifndef FGS_DEREGISTRATION_REQUEST_UE_ORIGINATING_H_ #define FGS_DEREGISTRATION_REQUEST_UE_ORIGINATING_H_ -#include -#include #include - -#include "ExtendedProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" -#include "MessageType.h" #include "FGSDeregistrationType.h" -#include "NasKeySetIdentifier.h" #include "FGSMobileIdentity.h" +#include "MessageType.h" +#include "NasKeySetIdentifier.h" +#include "SecurityHeaderType.h" /* * Message name: De-registration request (UE originating de-registration) @@ -43,9 +38,9 @@ typedef struct fgs_deregistration_request_ue_originating_msg_tag { /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; + uint8_t protocoldiscriminator; SecurityHeaderType securityheadertype: 4; - SpareHalfOctet sparehalfoctet: 4; + uint8_t sparehalfoctet: 4; MessageType messagetype; FGSDeregistrationType deregistrationtype; NasKeySetIdentifier naskeysetidentifier; @@ -57,4 +52,3 @@ int encode_fgs_deregistration_request_ue_originating(fgs_deregistration_request_ uint32_t len); #endif /* ! defined(REGISTRATION_REQUEST_H_) */ - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSIdentityResponse.c similarity index 83% rename from openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSIdentityResponse.c index 4f8f6dd321..573d1022d5 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSIdentityResponse.c @@ -28,29 +28,19 @@ \version 0.1 */ -#include -#include -#include -#include - -#include "nas_log.h" - #include "FGSIdentityResponse.h" - +#include int encode_identiy_response(fgs_identiy_response_msg *fgs_identity_reps, uint8_t *buffer, uint32_t len) { int encoded = 0; int encode_result = 0; - if ((encode_result = - encode_5gs_mobile_identity(&fgs_identity_reps->fgsmobileidentity, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error + if ((encode_result = encode_5gs_mobile_identity(&fgs_identity_reps->fgsmobileidentity, 0, buffer + encoded, len - encoded)) + < 0) // Return in case of error return encode_result; else encoded += encode_result; return encoded; } - - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSIdentityResponse.h similarity index 81% rename from openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSIdentityResponse.h index 431293e03e..519e49410e 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSIdentityResponse.h @@ -28,15 +28,10 @@ \version 0.1 */ -#include -#include #include - -#include "ExtendedProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" #include "FGSMobileIdentity.h" #include "MessageType.h" +#include "SecurityHeaderType.h" #ifndef FGS_IDENTITY_RESPONSE_H_ #define FGS_IDENTITY_RESPONSE_H_ @@ -50,16 +45,14 @@ typedef struct fgs_identiy_response_msg_tag { /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; - FGSMobileIdentity fgsmobileidentity; + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; + FGSMobileIdentity fgsmobileidentity; } fgs_identiy_response_msg; int encode_identiy_response(fgs_identiy_response_msg *fgs_identity_reps, uint8_t *buffer, uint32_t len); #endif /* ! defined(FGS_IDENTITY_RESPONSE_H_) */ - - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeComplete.c similarity index 70% rename from openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeComplete.c index e0be56145f..369f3a3e2d 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeComplete.c @@ -28,39 +28,32 @@ \version 0.1 */ -#include -#include -#include -#include - -#include "nas_log.h" - #include "FGSNASSecurityModeComplete.h" -#include "FGSMobileIdentity.h" +#include #include "FGCNasMessageContainer.h" +#include "FGSMobileIdentity.h" int encode_fgs_security_mode_complete(fgs_security_mode_complete_msg *fgs_security_mode_comp, uint8_t *buffer, uint32_t len) { - int encoded = 0; - int encode_result = 0; + int encoded = 0; + int encode_result = 0; - if ((encode_result = - encode_5gs_mobile_identity(&fgs_security_mode_comp->fgsmobileidentity, 0x77, buffer + - encoded, len - encoded)) < 0) { //Return in case of error + if ((encode_result = + encode_5gs_mobile_identity(&fgs_security_mode_comp->fgsmobileidentity, 0x77, buffer + encoded, len - encoded)) + < 0) { // Return in case of error + return encode_result; + } else { + encoded += encode_result; + if ((encode_result = encode_fgc_nas_message_container(&fgs_security_mode_comp->fgsnasmessagecontainer, + 0x71, + buffer + encoded, + len - encoded)) + < 0) { return encode_result; } else { encoded += encode_result; - if ((encode_result = - encode_fgc_nas_message_container(&fgs_security_mode_comp->fgsnasmessagecontainer, 0x71, buffer + - encoded, len - encoded)) < 0) { - return encode_result; - } else { - encoded += encode_result; - } } + } - return encoded; + return encoded; } - - - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeComplete.h similarity index 79% rename from openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeComplete.h index 702dca3dc5..36ec4ed2b2 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeComplete.h @@ -28,16 +28,11 @@ \version 0.1 */ -#include -#include #include - -#include "ExtendedProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" +#include "FGCNasMessageContainer.h" #include "FGSMobileIdentity.h" #include "MessageType.h" -#include "FGCNasMessageContainer.h" +#include "SecurityHeaderType.h" #ifndef FGS_NAS_SECURITY_MODE_COMPLETE_H_ #define FGS_NAS_SECURITY_MODE_COMPLETE_H_ @@ -50,16 +45,15 @@ */ typedef struct fgs_security_mode_complete_msg_tag { - /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; - FGSMobileIdentity fgsmobileidentity; - FGCNasMessageContainer fgsnasmessagecontainer; + /* Mandatory fields */ + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; + FGSMobileIdentity fgsmobileidentity; + FGCNasMessageContainer fgsnasmessagecontainer; } fgs_security_mode_complete_msg; int encode_fgs_security_mode_complete(fgs_security_mode_complete_msg *fgs_security_mode_comp, uint8_t *buffer, uint32_t len); #endif /* ! defined(FGS_NAS_SECURITY_MODE_COMPLETE_H_) */ - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSUplinkNasTransport.c similarity index 71% rename from openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSUplinkNasTransport.c index 741ec095c3..26d2e9ad61 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSUplinkNasTransport.c @@ -28,13 +28,10 @@ \version 0.1 */ -#include -#include -#include -#include -#include - #include "FGSUplinkNasTransport.h" +#include +#include +#include #include "TLVEncoder.h" int encode_fgs_payload_container(FGSPayloadContainer *paycontainer, uint8_t iei, uint8_t *buffer, uint32_t len) @@ -54,7 +51,7 @@ int encode_fgs_payload_container(FGSPayloadContainer *paycontainer, uint8_t iei, } else { encoded += encode_result; } - if(iei > 0){ + if (iei > 0) { uint16_t tmp = htons(encoded - 3); memcpy(buffer + 1, &tmp, sizeof(tmp)); } else { @@ -78,7 +75,6 @@ int encode_nssai(OctetString *nssai, uint8_t iei, uint8_t *buffer) *(buffer + encoded) = nssai->length; encoded++; - if ((encode_result = encode_octet_string(nssai, buffer + encoded, nssai->length)) < 0) { return encode_result; } else { @@ -112,41 +108,40 @@ int encode_dnn(OctetString *dnn, uint8_t iei, uint8_t *buffer) int encode_fgs_uplink_nas_transport(fgs_uplink_nas_transport_msg *fgs_up_nas_transport, uint8_t *buffer, uint32_t len) { - int encoded = 0; - int encode_result = 0; + int encoded = 0; + int encode_result = 0; - *(buffer + encoded) = (fgs_up_nas_transport->payloadcontainertype.iei << 4) | (fgs_up_nas_transport->payloadcontainertype.type &0xf); - encoded++; + *(buffer + encoded) = + (fgs_up_nas_transport->payloadcontainertype.iei << 4) | (fgs_up_nas_transport->payloadcontainertype.type & 0xf); + encoded++; - if ((encode_result = encode_fgs_payload_container(&fgs_up_nas_transport->fgspayloadcontainer, - 0, buffer +encoded, len - encoded)) < 0) { - return encode_result; - } else { - encoded += encode_result; - } + if ((encode_result = encode_fgs_payload_container(&fgs_up_nas_transport->fgspayloadcontainer, 0, buffer + encoded, len - encoded)) + < 0) { + return encode_result; + } else { + encoded += encode_result; + } - *(buffer + encoded) = 0x12; - encoded++; + *(buffer + encoded) = 0x12; + encoded++; - IES_ENCODE_U8(buffer, encoded, fgs_up_nas_transport->pdusessionid); + IES_ENCODE_U8(buffer, encoded, fgs_up_nas_transport->pdusessionid); - // set request type - *(buffer + encoded) = (0x8<<4)|(fgs_up_nas_transport->requesttype &0x7); - encoded++; + // set request type + *(buffer + encoded) = (0x8 << 4) | (fgs_up_nas_transport->requesttype & 0x7); + encoded++; - if ((encode_result = encode_nssai(&fgs_up_nas_transport->snssai, 0x22, buffer +encoded)) < 0) { - return encode_result; - } else { - encoded += encode_result; - } + if ((encode_result = encode_nssai(&fgs_up_nas_transport->snssai, 0x22, buffer + encoded)) < 0) { + return encode_result; + } else { + encoded += encode_result; + } - if ((encode_result = encode_dnn(&fgs_up_nas_transport->dnn, 0x25, buffer +encoded)) < 0) { - return encode_result; - } else { - encoded += encode_result; - } + if ((encode_result = encode_dnn(&fgs_up_nas_transport->dnn, 0x25, buffer + encoded)) < 0) { + return encode_result; + } else { + encoded += encode_result; + } - return encoded; + return encoded; } - - diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSUplinkNasTransport.h similarity index 69% rename from openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSUplinkNasTransport.h index 5fabcea173..6c045d7d48 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSUplinkNasTransport.h @@ -28,14 +28,10 @@ \version 0.1 */ -#include -#include #include - -#include "ExtendedProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" #include "MessageType.h" +#include "OctetString.h" +#include "SecurityHeaderType.h" #ifndef FGS_UPLINK_NAS_TRANSPORT_H_ #define FGS_UPLINK_NAS_TRANSPORT_H_ @@ -47,31 +43,29 @@ * Direction: UE to network */ -typedef struct PayloadContainerType_tag{ - uint8_t iei:4; - uint8_t type:4; -}PayloadContainerType; +typedef struct PayloadContainerType_tag { + uint8_t iei: 4; + uint8_t type: 4; +} PayloadContainerType; typedef struct FGSPayloadContainer_tag { OctetString payloadcontainercontents; } FGSPayloadContainer; typedef struct fgs_uplink_nas_transport_msg_tag { - /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; - PayloadContainerType payloadcontainertype; - FGSPayloadContainer fgspayloadcontainer; - /* Optional fields */ - uint16_t pdusessionid; - uint8_t requesttype; - OctetString snssai; - OctetString dnn; + /* Mandatory fields */ + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; + PayloadContainerType payloadcontainertype; + FGSPayloadContainer fgspayloadcontainer; + /* Optional fields */ + uint16_t pdusessionid; + uint8_t requesttype; + OctetString snssai; + OctetString dnn; } fgs_uplink_nas_transport_msg; int encode_fgs_uplink_nas_transport(fgs_uplink_nas_transport_msg *fgs_security_mode_comp, uint8_t *buffer, uint32_t len); #endif /* ! defined(FGS_UPLINK_NAS_TRANSPORT_H_) */ - - diff --git a/openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c similarity index 94% rename from openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c index d7c5c5d719..b110ca75a3 100644 --- a/openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c @@ -33,7 +33,6 @@ #include #include - #include "TLVEncoder.h" #include "TLVDecoder.h" #include "RegistrationAccept.h" @@ -45,7 +44,9 @@ int decode_registration_accept(registration_accept_msg *registration_accept, con int decoded_result = 0; /* Decoding mandatory fields */ - if ((decoded_result = decode_fgs_registration_result(®istration_accept->fgsregistrationresult, 0, *(buffer + decoded), len - decoded)) < 0) + if ((decoded_result = + decode_fgs_registration_result(®istration_accept->fgsregistrationresult, 0, *(buffer + decoded), len - decoded)) + < 0) return decoded_result; decoded += decoded_result; @@ -70,7 +71,6 @@ int encode_registration_accept(registration_accept_msg *registration_accept, uin LOG_FUNC_IN; - *(buffer + encoded) = encode_fgs_registration_result(®istration_accept->fgsregistrationresult); encoded = encoded + 2; @@ -84,4 +84,3 @@ int encode_registration_accept(registration_accept_msg *registration_accept, uin // todo ,Encoding optional fields LOG_FUNC_RETURN(encoded); } - diff --git a/openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.h similarity index 84% rename from openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.h index 30c434c662..61c987db4b 100644 --- a/openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.h @@ -32,10 +32,7 @@ #include #include - -#include "ExtendedProtocolDiscriminator.h" #include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" #include "MessageType.h" #include "FGSRegistrationResult.h" #include "FGSMobileIdentity.h" @@ -52,11 +49,11 @@ typedef struct registration_accept_msg_tag { /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; - FGSRegistrationResult fgsregistrationresult; + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; + FGSRegistrationResult fgsregistrationresult; /* Optional fields */ FGSMobileIdentity *guti; @@ -67,4 +64,3 @@ int decode_registration_accept(registration_accept_msg *registrationaccept, cons int encode_registration_accept(registration_accept_msg *registrationaccept, uint8_t *buffer, uint32_t len); #endif /* ! defined(REGISTRATION_ACCEPT_H_) */ - diff --git a/openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationComplete.c similarity index 78% rename from openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationComplete.c index 668e665351..5c1bf38bd8 100644 --- a/openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationComplete.c @@ -19,15 +19,8 @@ * contact@openairinterface.org */ -#include -#include -#include -#include - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" #include "RegistrationComplete.h" +#include #include "SORTransparentContainer.h" int decode_registration_complete(registration_complete_msg *registration_complete, uint8_t *buffer, uint32_t len) @@ -36,7 +29,9 @@ int decode_registration_complete(registration_complete_msg *registration_complet int decoded_result = 0; /* Decoding mandatory fields */ - if ((decoded_result = decode_sor_transparent_container(®istration_complete->sortransparentcontainer, 0, buffer + decoded, len - decoded)) < 0) + if ((decoded_result = + decode_sor_transparent_container(®istration_complete->sortransparentcontainer, 0, buffer + decoded, len - decoded)) + < 0) return decoded_result; else decoded += decoded_result; @@ -50,12 +45,11 @@ int encode_registration_complete(registration_complete_msg *registration_complet int encode_result = 0; if ((encode_result = - encode_sor_transparent_container(®istration_complete->sortransparentcontainer, 0, - buffer + encoded, len - encoded)) < 0) //Return in case of error + encode_sor_transparent_container(®istration_complete->sortransparentcontainer, 0, buffer + encoded, len - encoded)) + < 0) // Return in case of error return encode_result; else encoded += encode_result; return encoded; } - diff --git a/openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationComplete.h similarity index 81% rename from openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationComplete.h index 0fbf2abde1..b49cc28dd4 100644 --- a/openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationComplete.h @@ -28,35 +28,27 @@ \version 0.1 */ -#include -#include #include - -#include "ExtendedProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" #include "MessageType.h" #include "SORTransparentContainer.h" +#include "SecurityHeaderType.h" #ifndef REGISTRATION_COMPLETE_H_ #define REGISTRATION_COMPLETE_H_ - typedef struct registration_complete_msg_tag { /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; /* Optional fields */ - SORTransparentContainer sortransparentcontainer; + SORTransparentContainer sortransparentcontainer; } registration_complete_msg; - int decode_registration_complete(registration_complete_msg *registrationcomplete, uint8_t *buffer, uint32_t len); int encode_registration_complete(registration_complete_msg *registrationcomplete, uint8_t *buffer, uint32_t len); #endif /* ! defined(REGISTRATION_COMPLETE_H_) */ - diff --git a/openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationRequest.c similarity index 78% rename from openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationRequest.c index cf18e46ca2..e2278c8988 100644 --- a/openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationRequest.c @@ -27,15 +27,11 @@ * \version 0.1 */ -#include -#include -#include -#include - -#include "nas_log.h" - #include "RegistrationRequest.h" #include "NR_NAS_defs.h" +#include +#include "T.h" +#include "nas_log.h" int decode_registration_request(registration_request_msg *registration_request, uint8_t *buffer, uint32_t len) { @@ -43,12 +39,12 @@ int decode_registration_request(registration_request_msg *registration_request, int decoded_result = 0; LOG_FUNC_IN; - LOG_TRACE(INFO, "EMM - registration_request len = %d", - len); + LOG_TRACE(INFO, "5GMM: Registration Request len = %d", len); /* Decoding mandatory fields */ - if ((decoded_result = decode_5gs_registration_type(®istration_request->fgsregistrationtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0) { - // return decoded_result; + if ((decoded_result = + decode_5gs_registration_type(®istration_request->fgsregistrationtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) + < 0) { LOG_FUNC_RETURN(decoded_result); } @@ -60,13 +56,12 @@ int decode_registration_request(registration_request_msg *registration_request, decoded++; - if ((decoded_result = decode_5gs_mobile_identity(®istration_request->fgsmobileidentity, 0, buffer + decoded, len - decoded)) < 0) { - // return decoded_result; + if ((decoded_result = decode_5gs_mobile_identity(®istration_request->fgsmobileidentity, 0, buffer + decoded, len - decoded)) + < 0) { LOG_FUNC_RETURN(decoded_result); } else decoded += decoded_result; - // TODO, Decoding optional fields return decoded; @@ -81,9 +76,9 @@ int encode_registration_request(registration_request_msg *registration_request, | (encode_5gs_registration_type(®istration_request->fgsregistrationtype) & 0x0f); encoded++; - if ((encode_result = - encode_5gs_mobile_identity(®istration_request->fgsmobileidentity, 0, buffer + - encoded, len - encoded)) < 0) //Return in case of error + if ((encode_result = encode_5gs_mobile_identity(®istration_request->fgsmobileidentity, 0, buffer + encoded, len - encoded)) + < 0) + // Return in case of error return encode_result; else encoded += encode_result; @@ -91,8 +86,10 @@ int encode_registration_request(registration_request_msg *registration_request, if ((registration_request->presencemask & REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT) == REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT) { if ((encode_result = encode_5gmm_capability(®istration_request->fgmmcapability, - REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI, buffer + encoded, len - - encoded)) < 0) + REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI, + buffer + encoded, + len - encoded)) + < 0) // Return in case of error return encode_result; else @@ -102,16 +99,16 @@ int encode_registration_request(registration_request_msg *registration_request, if ((registration_request->presencemask & REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT) == REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT) { if ((encode_result = encode_nrue_security_capability(®istration_request->nruesecuritycapability, - REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI, buffer + encoded, len - - encoded)) < 0) + REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI, + buffer + encoded, + len - encoded)) + < 0) // Return in case of error return encode_result; else encoded += encode_result; } - // TODO, Encoding optional fields return encoded; } - diff --git a/openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationRequest.h similarity index 57% rename from openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationRequest.h index ce534bfff9..3ae943a5f1 100644 --- a/openair3/NAS/COMMON/EMM/MSG/RegistrationRequest.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationRequest.h @@ -27,25 +27,19 @@ * \version 0.1 */ - -#include -#include #include - -#include "ExtendedProtocolDiscriminator.h" -#include "SecurityHeaderType.h" -#include "SpareHalfOctet.h" +#include "FGMMCapability.h" #include "FGSMobileIdentity.h" -#include "NasKeySetIdentifier.h" #include "FGSRegistrationType.h" #include "MessageType.h" -#include "FGMMCapability.h" +#include "NasKeySetIdentifier.h" #include "NrUESecurityCapability.h" +#include "SecurityHeaderType.h" #ifndef REGISTRATION_REQUEST_H_ #define REGISTRATION_REQUEST_H_ - +// clang-format off # define REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEYSET_PRESENT (1<<0) # define REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT (1<<1) # define REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT (1<<2) @@ -70,29 +64,30 @@ # define REGISTRATION_REQUEST_EPS_BEARER_CONTEXT_STATUS_PRESENT (1<<21) typedef enum registration_request_iei_tag { - REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEYSET_IEI = 0xC0, /* 0xC- = 192- */ - REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI = 0x10, /* 0x10 = 16 */ - REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI = 0x2E, /* 0x2E = 46 */ - REGISTRATION_REQUEST_REQUESTED_NSSAI_IEI = 0x2F, /* 0x2F = 47 */ - REGISTRATION_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI = 0x52, /* 0x52 = 82 */ - REGISTRATION_REQUEST_S1_UE_NETWORK_CAPABILITY_IEI = 0x17, /* 0x17 = 23 */ - REGISTRATION_REQUEST_UPLINK_DATA_STATUS_IEI = 0x40, /* 0x40 = 64 */ - REGISTRATION_REQUEST_PDU_SESSION_STATUS_IEI = 0x50, /* 0x50 = 80 */ - REGISTRATION_REQUEST_MICO_INDICATION_IEI = 0xB0, /* 0xB- = 176- */ - REGISTRATION_REQUEST_UE_STATUS_IEI = 0x2B, /* 0x2B = 43 */ - REGISTRATION_REQUEST_ADDITIONAL_GUTI_IEI = 0x77, /* 0x77 = 119 */ - REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_IEI = 0x25, /* 0x25 = 37 */ - REGISTRATION_REQUEST_UE_USAGE_SETTING_IEI = 0x18, /* 0x18 = 24 */ - REGISTRATION_REQUEST_REQUESTED_DRX_PARAMETERS_IEI = 0x51, /* 0x51 = 81 */ - REGISTRATION_REQUEST_EPS_NAS_MESSAGE_CONTAINER_IEI = 0x70, /* 0x70 = 112 */ - REGISTRATION_REQUEST_LADN_INDICATION_IEI = 0x74, /* 0x74 = 116 */ - REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_IEI = 0x80, /* 0x80 = 128 */ - REGISTRATION_REQUEST_PAYLOAD_CONTAINER_IEI = 0x7B, /* 0x7B = 123 */ - REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_IEI = 0x90, /* 0x90 = 144 */ - REGISTRATION_REQUEST_5GS_UPDATE_TYPE_IEI = 0x53, /* 0x53 = 83 */ - REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_IEI = 0x71, /* 0x71 = 113 */ - REGISTRATION_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI = 0x60 /* 0x60 = 96 */ + REGISTRATION_REQUEST_NON_CURRENT_NATIVE_NAS_KEYSET_IEI = 0xC0, /* 0xC- = 192- */ + REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI = 0x10, /* 0x10 = 16 */ + REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_IEI = 0x2E, /* 0x2E = 46 */ + REGISTRATION_REQUEST_REQUESTED_NSSAI_IEI = 0x2F, /* 0x2F = 47 */ + REGISTRATION_REQUEST_LAST_VISITED_REGISTERED_TAI_IEI = 0x52, /* 0x52 = 82 */ + REGISTRATION_REQUEST_S1_UE_NETWORK_CAPABILITY_IEI = 0x17, /* 0x17 = 23 */ + REGISTRATION_REQUEST_UPLINK_DATA_STATUS_IEI = 0x40, /* 0x40 = 64 */ + REGISTRATION_REQUEST_PDU_SESSION_STATUS_IEI = 0x50, /* 0x50 = 80 */ + REGISTRATION_REQUEST_MICO_INDICATION_IEI = 0xB0, /* 0xB- = 176- */ + REGISTRATION_REQUEST_UE_STATUS_IEI = 0x2B, /* 0x2B = 43 */ + REGISTRATION_REQUEST_ADDITIONAL_GUTI_IEI = 0x77, /* 0x77 = 119 */ + REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_IEI = 0x25, /* 0x25 = 37 */ + REGISTRATION_REQUEST_UE_USAGE_SETTING_IEI = 0x18, /* 0x18 = 24 */ + REGISTRATION_REQUEST_REQUESTED_DRX_PARAMETERS_IEI = 0x51, /* 0x51 = 81 */ + REGISTRATION_REQUEST_EPS_NAS_MESSAGE_CONTAINER_IEI = 0x70, /* 0x70 = 112 */ + REGISTRATION_REQUEST_LADN_INDICATION_IEI = 0x74, /* 0x74 = 116 */ + REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_IEI = 0x80, /* 0x80 = 128 */ + REGISTRATION_REQUEST_PAYLOAD_CONTAINER_IEI = 0x7B, /* 0x7B = 123 */ + REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_IEI = 0x90, /* 0x90 = 144 */ + REGISTRATION_REQUEST_5GS_UPDATE_TYPE_IEI = 0x53, /* 0x53 = 83 */ + REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_IEI = 0x71, /* 0x71 = 113 */ + REGISTRATION_REQUEST_EPS_BEARER_CONTEXT_STATUS_IEI = 0x60 /* 0x60 = 96 */ } registration_request_iei; +// clang-format on /* * Message name: Registration request @@ -103,18 +98,18 @@ typedef enum registration_request_iei_tag { typedef struct registration_request_msg_tag { /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - SecurityHeaderType securityheadertype:4; - SpareHalfOctet sparehalfoctet:4; - MessageType messagetype; - FGSRegistrationType fgsregistrationtype; - NasKeySetIdentifier naskeysetidentifier; - FGSMobileIdentity fgsmobileidentity; + uint8_t protocoldiscriminator; + SecurityHeaderType securityheadertype: 4; + uint8_t sparehalfoctet: 4; + MessageType messagetype; + FGSRegistrationType fgsregistrationtype; + NasKeySetIdentifier naskeysetidentifier; + FGSMobileIdentity fgsmobileidentity; /* Optional fields */ - uint32_t presencemask; - FGMMCapability fgmmcapability; - NrUESecurityCapability nruesecuritycapability; + uint32_t presencemask; + FGMMCapability fgmmcapability; + NrUESecurityCapability nruesecuritycapability; } registration_request_msg; int decode_registration_request(registration_request_msg *registrationrequest, uint8_t *buffer, uint32_t len); @@ -122,4 +117,3 @@ int decode_registration_request(registration_request_msg *registrationrequest, u int encode_registration_request(registration_request_msg *registrationrequest, uint8_t *buffer, uint32_t len); #endif /* ! defined(REGISTRATION_REQUEST_H_) */ - diff --git a/openair3/NAS/COMMON/EMM/MSG/fgs_service_request.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgs_service_request.c similarity index 100% rename from openair3/NAS/COMMON/EMM/MSG/fgs_service_request.c rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/fgs_service_request.c diff --git a/openair3/NAS/COMMON/EMM/MSG/fgs_service_request.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgs_service_request.h similarity index 95% rename from openair3/NAS/COMMON/EMM/MSG/fgs_service_request.h rename to openair3/NAS/NR_UE/5GS/5GMM/MSG/fgs_service_request.h index eecd1ee34a..79c7c00c62 100644 --- a/openair3/NAS/COMMON/EMM/MSG/fgs_service_request.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgs_service_request.h @@ -27,11 +27,8 @@ #include "SecurityHeaderType.h" #include "NasKeySetIdentifier.h" #include "ServiceType.h" -#include "ExtendedProtocolDiscriminator.h" #include "FGCNasMessageContainer.h" -//#include "PDUSessionStatus.h" #include "MessageType.h" -#include "SpareHalfOctet.h" #include "FGSMobileIdentity.h" #ifndef FGS_SERVICE_REQUEST_H_ diff --git a/openair3/NAS/NR_UE/5GS/5GSM/MSG/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/5GSM/MSG/CMakeLists.txt new file mode 100644 index 0000000000..cea7b5c552 --- /dev/null +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(fgs_5gsm_lib OBJECT PduSessionEstablishRequest.c + PduSessionEstablishmentAccept.c) +target_include_directories(fgs_5gsm_lib PUBLIC .) diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishRequest.c similarity index 95% rename from openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c rename to openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishRequest.c index 1c9198b720..6c4592e2e2 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishRequest.c @@ -28,22 +28,14 @@ \version 0.1 */ -#include -#include -#include -#include - - -#include "TLVEncoder.h" -#include "TLVDecoder.h" #include "PduSessionEstablishRequest.h" - +#include +#include "TLVEncoder.h" int encode_pdu_session_establishment_request(pdu_session_establishment_request_msg *pdusessionestablishrequest, uint8_t *buffer) { int encoded = 0; - *(buffer + encoded) = pdusessionestablishrequest->protocoldiscriminator; encoded++; *(buffer + encoded) = pdusessionestablishrequest->pdusessionid; @@ -59,5 +51,3 @@ int encode_pdu_session_establishment_request(pdu_session_establishment_request_m return encoded; } - - diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishRequest.h similarity index 75% rename from openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h rename to openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishRequest.h index e2742ebc38..3d61491968 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishRequest.h @@ -31,35 +31,28 @@ #include #include #include - -#include "ExtendedProtocolDiscriminator.h" #include "MessageType.h" #ifndef PDU_SESSION_ESTABLISHMENT_REQUEST_H_ #define PDU_SESSION_ESTABLISHMENT_REQUEST_H_ - /* * Message name: pdu session establishment request - * Description: The PDU SESSION ESTABLISHMENT REQUEST message is sent by the UE to the SMF to initiate establishment of a PDU session. See table 8.3.1.1.1. - * Significance: dual - * Direction: UE to network + * Description: The PDU SESSION ESTABLISHMENT REQUEST message is sent by the UE to the SMF to initiate establishment of a PDU + * session. See table 8.3.1.1.1. Significance: dual Direction: UE to network */ typedef struct pdu_session_establishment_request_msg_tag { - /* Mandatory fields */ - ExtendedProtocolDiscriminator protocoldiscriminator; - uint8_t pdusessionid; - uint8_t pti; - MessageType pdusessionestblishmsgtype; - uint16_t maxdatarate; - uint8_t pdusessiontype; - /* Optional fields */ + /* Mandatory fields */ + uint8_t protocoldiscriminator; + uint8_t pdusessionid; + uint8_t pti; + MessageType pdusessionestblishmsgtype; + uint16_t maxdatarate; + uint8_t pdusessiontype; + /* Optional fields */ } pdu_session_establishment_request_msg; - int encode_pdu_session_establishment_request(pdu_session_establishment_request_msg *pdusessionestablishrequest, uint8_t *buffer); #endif /* ! defined(PDU_SESSION_ESTABLISHMENT_REQUEST_H_) */ - - diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c similarity index 93% rename from openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c rename to openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c index 87994f383f..77c2a1d921 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c @@ -20,11 +20,10 @@ */ #include +#include #include "PduSessionEstablishmentAccept.h" #include "common/utils/LOG/log.h" -#include "nr_nas_msg.h" #include "common/utils/tun_if.h" -#include "openair2/SDAP/nr_sdap/nr_sdap.h" static uint16_t getShort(uint8_t *input) { @@ -66,7 +65,6 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ security_protected_plain_nas_5gs_msg_t sec_nas_msg; pdu_session_establishment_accept_msg_t psea_msg; uint8_t *curPtr = buffer; - // Security protected NAS header (7 bytes) sec_nas_hdr.epd = *curPtr++; sec_nas_hdr.sht = *curPtr++; uint32_t tmp; @@ -74,7 +72,6 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ sec_nas_hdr.mac = htonl(tmp); curPtr += sizeof(sec_nas_hdr.mac); sec_nas_hdr.sqn = *curPtr++; - // Security protected plain NAS message sec_nas_msg.epd = *curPtr++; sec_nas_msg.sht = *curPtr++; sec_nas_msg.msg_type = *curPtr++; @@ -99,12 +96,11 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ qos_rule.dqr = (*(curPtr)&0x10) >> 4; qos_rule.nb_pf = *curPtr++ & 0x0F; - if(qos_rule.nb_pf) { + if (qos_rule.nb_pf) { packet_filter_t pf; - if(qos_rule.oc == ROC_CREATE_NEW_QOS_RULE || - qos_rule.oc == ROC_MODIFY_QOS_RULE_ADD_PF || - qos_rule.oc == ROC_MODIFY_QOS_RULE_REPLACE_PF) { + if (qos_rule.oc == ROC_CREATE_NEW_QOS_RULE || qos_rule.oc == ROC_MODIFY_QOS_RULE_ADD_PF + || qos_rule.oc == ROC_MODIFY_QOS_RULE_REPLACE_PF) { pf.pf_type.type_1.pf_dir = (*curPtr & 0x30) >> 4; pf.pf_type.type_1.pf_id = *curPtr++ & 0x0F; pf.pf_type.type_1.length = *curPtr++; @@ -150,8 +146,7 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ capture_ipv4_addr(&addr[0], ip, sizeof(ip)); tun_config(1, ip, NULL, "oaitun_ue"); setup_ue_ipv4_route(1, ip, "oaitun_ue"); - LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %u.%u.%u.%u\n", - addr[0], addr[1], addr[2], addr[3]); + LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %u.%u.%u.%u\n", addr[0], addr[1], addr[2], addr[3]); } else if (psea_msg.pdu_addr_ie.pdu_type == PDU_SESSION_TYPE_IPV6) { for (int i = 0; i < IPv6_INTERFACE_ID_LENGTH; ++i) addr[i] = *curPtr++; @@ -219,8 +214,7 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ psea_msg.dnn_ie.dnn_length = *curPtr++; char apn[APN_MAX_LEN]; - if(psea_msg.dnn_ie.dnn_length <= APN_MAX_LEN && - psea_msg.dnn_ie.dnn_length >= APN_MIN_LEN) { + if (psea_msg.dnn_ie.dnn_length <= APN_MAX_LEN && psea_msg.dnn_ie.dnn_length >= APN_MIN_LEN) { memcpy(apn, curPtr, psea_msg.dnn_ie.dnn_length); LOG_T(NAS, "PDU SESSION ESTABLISHMENT ACCEPT - APN: %s\n", apn); } else @@ -236,6 +230,5 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ } } - set_qfi_pduid(qos_rule.qfi, psea_msg.pdu_id); return; } diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.h b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h similarity index 74% rename from openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.h rename to openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h index 8576418e21..a85d5c4aec 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.h +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h @@ -45,15 +45,16 @@ typedef enum { FOREACH_IEI(TO_ENUM) } pduSessionEstablishment_IEI_t; /* PDU Session type value - TS 24.501 Table 9.11.4.10.1*/ -#define PDU_SESSION_TYPE_IPV4 0b001 -#define PDU_SESSION_TYPE_IPV6 0b010 +#define PDU_SESSION_TYPE_IPV4 0b001 +#define PDU_SESSION_TYPE_IPV6 0b010 #define PDU_SESSION_TYPE_IPV4V6 0b011 -#define IPv4_ADDRESS_LENGTH 4 // length of the IPv4 address associated with a PDU session +#define IPv4_ADDRESS_LENGTH 4 // length of the IPv4 address associated with a PDU session #define IPv6_INTERFACE_ID_LENGTH 8 // interface identifier for the IPv6 link local address #define SMF_IPv6_LLA_LENGTH 16 /* Rule operation codes - TS 24.501 Table 9.11.4.13.1 */ +// clang-format off #define ROC_RESERVED_0 0b000 /* Reserved */ #define ROC_CREATE_NEW_QOS_RULE 0b001 /* Create new QoS rule */ #define ROC_DELETE_QOS_RULE 0b010 /* Delete existing QoS rule */ @@ -62,13 +63,14 @@ typedef enum { FOREACH_IEI(TO_ENUM) } pduSessionEstablishment_IEI_t; #define ROC_MODIFY_QOS_RULE_DELETE_PF 0b101 /* Modify existing QoS rule and delete packet filters */ #define ROC_MODIFY_QOS_RULE_WITHOUT_PF 0b110 /* Modify existing QoS rule without modifying packet filters */ #define ROC_RESERVED_1 0b111 /* Reserved */ +// clang-format on -/* DNN - APN +/* DNN - APN * TS 23.003 9.1 * The APN is composed of two parts, the APN Network Identifier (9.1.1) & The APN Operator Identifier (9.1.2). - * + * * The DNN information element has a length in the range of 3 to 102 octets. - * The Header is consisted of two octets, the DNN IEI and the Length of the DNN contents fields, each is 1 octet. + * The Header is consisted of two octets, the DNN IEI and the Length of the DNN contents fields, each is 1 octet. * The DNN value payload starts from the 3rd octet. * The accumulated max length of APN payload is 100 octets. * The min length of the APN payload is 1 octet. @@ -80,12 +82,12 @@ typedef enum { FOREACH_IEI(TO_ENUM) } pduSessionEstablishment_IEI_t; typedef struct packet_filter_create_qos_rule_s { uint8_t pf_dir; /* Packet filter direction */ - uint8_t pf_id; /* Packet filter identifier */ + uint8_t pf_id; /* Packet filter identifier */ uint8_t length; /* Length of packet filter contents */ } packet_filter_type1_t; /* TS 24.501 Figure 9.11.4.13.3 */ typedef struct packet_filter_modify_qos_rule_s { - uint8_t pf_id; /* Packet filter identifier */ + uint8_t pf_id; /* Packet filter identifier */ } packet_filter_type2_t; /* TS 24.501 Figure 9.11.4.13.4 */ typedef struct packet_filter_s { @@ -96,26 +98,26 @@ typedef struct packet_filter_s { } packet_filter_t; typedef struct qos_rule_s { - uint8_t id; /* QoS rule identifier */ - uint16_t length; /* Length of QoS Rule */ - uint8_t oc; /* Rule operation code (3bits) */ - uint8_t dqr; /* DQR bit (1 bit) */ - uint8_t nb_pf; /* Number of packet filters (4 bits) */ - uint8_t prcd; /* QoS rule precedence */ - uint8_t qfi; /* QoS Flow Identifier */ + uint8_t id; /* QoS rule identifier */ + uint16_t length; /* Length of QoS Rule */ + uint8_t oc; /* Rule operation code (3bits) */ + uint8_t dqr; /* DQR bit (1 bit) */ + uint8_t nb_pf; /* Number of packet filters (4 bits) */ + uint8_t prcd; /* QoS rule precedence */ + uint8_t qfi; /* QoS Flow Identifier */ } qos_rule_t; typedef struct auth_qos_rules_s { - uint16_t length; /* Length of QoS rules IE */ -} auth_qos_rule_t; /* QoS Rule as defined in 24.501 Figure 9.11.4.13.2 */ + uint16_t length; /* Length of QoS rules IE */ +} auth_qos_rule_t; /* QoS Rule as defined in 24.501 Figure 9.11.4.13.2 */ typedef struct session_ambr_s { - uint8_t length; /* Length of Session-AMBR contents */ - uint8_t unit_dl; /* Unit for Session-AMBR for downlink */ + uint8_t length; /* Length of Session-AMBR contents */ + uint8_t unit_dl; /* Unit for Session-AMBR for downlink */ uint16_t sess_dl; /* Session-AMBR for downlink */ - uint8_t unit_ul; /* Unit for Session-AMBR for uplink */ + uint8_t unit_ul; /* Unit for Session-AMBR for uplink */ uint16_t sess_ul; /* Session-AMBR for uplink */ -} session_ambr_t; /* TS 24.501 Figure 9.11.4.14.1 */ +} session_ambr_t; /* TS 24.501 Figure 9.11.4.14.1 */ /* Optional Presence IE - TS 24.501 Table 8.3.2.1.1 */ @@ -131,7 +133,7 @@ typedef struct pdu_address_s { } pdu_address_t; /* TS 24.501 9.11.4.10 */ typedef struct dnn_s { - uint8_t dnn_iei; /* DNN IEI (0x25) */ + uint8_t dnn_iei; /* DNN IEI (0x25) */ uint8_t dnn_length; /* Length of DNN contents */ } dnn_t; /* TS 24.501 9.11.2.1A */ @@ -145,28 +147,28 @@ typedef struct qos_fd_s { typedef struct pdu_session_establishment_accept_msg_s { /* Mandatory presence */ - uint8_t epd; /* Extended Protocol Discriminator */ - uint8_t pdu_id; /* PDU Session ID */ - uint8_t pti; /* Procedure Transaction Identity */ - uint8_t msg_type; /* Message Type */ - uint8_t pdu_type; /* PDU Session Type */ - uint8_t ssc_mode; /* SSC mode */ - auth_qos_rule_t qos_rules; /* Authorized QoS rules */ - session_ambr_t sess_ambr; /* Session-AMBR */ + uint8_t epd; /* Extended Protocol Discriminator */ + uint8_t pdu_id; /* PDU Session ID */ + uint8_t pti; /* Procedure Transaction Identity */ + uint8_t msg_type; /* Message Type */ + uint8_t pdu_type; /* PDU Session Type */ + uint8_t ssc_mode; /* SSC mode */ + auth_qos_rule_t qos_rules; /* Authorized QoS rules */ + session_ambr_t sess_ambr; /* Session-AMBR */ /* Optional presence */ - dnn_t dnn_ie; /* Data Network Name */ - pdu_address_t pdu_addr_ie; /* PDU Address */ - ext_pP_t ext_pp_ie; /* Extended Protocol Configuration Options */ - qos_fd_t qos_fd_ie; /* QoS flow descriptions */ + dnn_t dnn_ie; /* Data Network Name */ + pdu_address_t pdu_addr_ie; /* PDU Address */ + ext_pP_t ext_pp_ie; /* Extended Protocol Configuration Options */ + qos_fd_t qos_fd_ie; /* QoS flow descriptions */ } pdu_session_establishment_accept_msg_t; /* 24.501 Table 8.3.2.1.1 */ typedef struct security_protected_plain_nas_5gs_msg_s { - uint8_t epd; /* Extended Protocol Discriminator */ - uint8_t sht; /* Security Header Type */ - uint8_t msg_type; /* Message Type */ - uint8_t payload_type; /* Payload Container Type */ - uint16_t payload_len; /* Payload Container Length */ + uint8_t epd; /* Extended Protocol Discriminator */ + uint8_t sht; /* Security Header Type */ + uint8_t msg_type; /* Message Type */ + uint8_t payload_type; /* Payload Container Type */ + uint16_t payload_len; /* Payload Container Length */ } security_protected_plain_nas_5gs_msg_t; typedef struct security_protected_nas_5gs_msg_s { diff --git a/openair3/NAS/NR_UE/5GS/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/CMakeLists.txt new file mode 100644 index 0000000000..4c0810b5f6 --- /dev/null +++ b/openair3/NAS/NR_UE/5GS/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(5GMM/MSG) +add_subdirectory(5GMM/IES) +add_subdirectory(5GSM/MSG) + +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() diff --git a/openair3/NAS/COMMON/EMM/tests/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/tests/CMakeLists.txt similarity index 74% rename from openair3/NAS/COMMON/EMM/tests/CMakeLists.txt rename to openair3/NAS/NR_UE/5GS/tests/CMakeLists.txt index 3f960c5562..a72a47700f 100644 --- a/openair3/NAS/COMMON/EMM/tests/CMakeLists.txt +++ b/openair3/NAS/NR_UE/5GS/tests/CMakeLists.txt @@ -5,9 +5,10 @@ add_executable(nas_lib_test nas_lib_test.c) add_dependencies(tests nas_lib_test) add_test(NAME nas_lib_test COMMAND nas_lib_test) -target_link_libraries(nas_lib_test PRIVATE fgs_lib fgs_ies_lib) +target_link_libraries(nas_lib_test PRIVATE + nr_nas +) target_include_directories(nas_lib_test PRIVATE - ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/openair3/NAS/COMMON/EMM/tests/nas_lib_test.c b/openair3/NAS/NR_UE/5GS/tests/nas_lib_test.c similarity index 100% rename from openair3/NAS/COMMON/EMM/tests/nas_lib_test.c rename to openair3/NAS/NR_UE/5GS/tests/nas_lib_test.c diff --git a/openair3/NAS/NR_UE/CMakeLists.txt b/openair3/NAS/NR_UE/CMakeLists.txt new file mode 100644 index 0000000000..90502078ac --- /dev/null +++ b/openair3/NAS/NR_UE/CMakeLists.txt @@ -0,0 +1,19 @@ +add_subdirectory(5GS) + +add_library(nr_nas STATIC + nr_nas_msg.c + ../COMMON/nr_common.c +) + +target_link_libraries(nr_nas PUBLIC asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) +target_link_libraries(nr_nas PUBLIC + fgs_5gmm_lib + fgs_5gsm_lib + fgs_5gmm_ies_lib + nas_common_ies_lib + nas_utils +) + +target_include_directories(nr_nas PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/openair3/NAS/NR_UE/nr_nas_msg.c b/openair3/NAS/NR_UE/nr_nas_msg.c index f198077f69..d944589f22 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.c +++ b/openair3/NAS/NR_UE/nr_nas_msg.c @@ -36,6 +36,7 @@ #include "TLVDecoder.h" #include "TLVEncoder.h" #include "nr_nas_msg.h" +#include "NR_NAS_defs.h" #include "aka_functions.h" #include "secu_defs.h" #include "kdf.h" @@ -46,7 +47,6 @@ #include "FGSDeregistrationRequestUEOriginating.h" #include "intertask_interface.h" #include "common/utils/tun_if.h" -#include #include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "openair3/SECU/nas_stream_eia2.h" #include "openair3/UTILS/conversions.h" diff --git a/openair3/NAS/NR_UE/nr_nas_msg.h b/openair3/NAS/NR_UE/nr_nas_msg.h index 7d6730a297..6ceb3edd23 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg.h +++ b/openair3/NAS/NR_UE/nr_nas_msg.h @@ -37,7 +37,7 @@ #include "FGSNASSecurityModeComplete.h" #include "FGSDeregistrationRequestUEOriginating.h" #include "RegistrationComplete.h" -#include "EMM/MSG/fgs_service_request.h" +#include "fgs_service_request.h" #include "as_message.h" #include "FGSUplinkNasTransport.h" #include diff --git a/openair3/NAS/UE/API/CMakeLists.txt b/openair3/NAS/UE/API/CMakeLists.txt new file mode 100644 index 0000000000..0810099d9e --- /dev/null +++ b/openair3/NAS/UE/API/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(USIM) diff --git a/openair3/NAS/UE/API/USIM/CMakeLists.txt b/openair3/NAS/UE/API/USIM/CMakeLists.txt new file mode 100644 index 0000000000..90a9cb40fe --- /dev/null +++ b/openair3/NAS/UE/API/USIM/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(usim_lib OBJECT + ${OPENAIR_DIR}/common/utils/mem/memory.c + aka_functions.c + usim_api.c +) + +target_include_directories(usim_lib PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/openair3/NAS/UE/CMakeLists.txt b/openair3/NAS/UE/CMakeLists.txt new file mode 100644 index 0000000000..01e40a3c9e --- /dev/null +++ b/openair3/NAS/UE/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(API) diff --git a/openair3/UICC/CMakeLists.txt b/openair3/UICC/CMakeLists.txt new file mode 100644 index 0000000000..0570c7238f --- /dev/null +++ b/openair3/UICC/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(lib_uicc OBJECT usim_interface.c) +target_include_directories(lib_uicc PRIVATE .)