diff --git a/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt index 40bfcbabcd..a4bb516b89 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/CMakeLists.txt @@ -11,3 +11,5 @@ target_link_libraries(fgs_5gmm_ies_lib PUBLIC nas_common_ies_lib PRIVATE log_headers ) + +target_include_directories(fgs_5gmm_ies_lib PRIVATE ../../) diff --git a/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h index b7e66019cc..4d6d4d7eed 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h @@ -30,8 +30,8 @@ #include #include #include - #include "OctetString.h" +#include "fgs_nas_utils.h" #ifndef FGS_MOBILE_IDENTITY_H_ #define FGS_MOBILE_IDENTITY_H_ @@ -129,15 +129,22 @@ typedef struct { uint8_t macaddr; } Macaddr5GSMobileIdentity_t; +#define FOREACH_IDENTITY_TYPE(TYPE_DEF) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_NOIDENTITY, 0) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_SUCI, 1) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_5G_GUTI, 2) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_IMEI, 3) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_5GS_TMSI, 4) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_IMEISV, 5) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_MAC_ADDR, 6) \ + TYPE_DEF(FGS_MOBILE_IDENTITY_EUI64, 7) + +typedef enum { FOREACH_IDENTITY_TYPE(TO_ENUM) } fgs_identity_type_t; + +static const text_info_t fgs_identity_type_text[] = {FOREACH_IDENTITY_TYPE(TO_TEXT)}; + // clang-format off typedef union FGSMobileIdentity_tag { -#define FGS_MOBILE_IDENTITY_NOIDENTITY 0b000 -#define FGS_MOBILE_IDENTITY_SUCI 0b001 -#define FGS_MOBILE_IDENTITY_5G_GUTI 0b010 -#define FGS_MOBILE_IDENTITY_IMEI 0b011 -#define FGS_MOBILE_IDENTITY_5GS_TMSI 0b100 -#define FGS_MOBILE_IDENTITY_IMEISV 0b101 -#define FGS_MOBILE_IDENTITY_MAC_ADDR 0b110 NoIdentity5GSMobileIdentity_t noidentity; Suci5GSMobileIdentity_t suci; Guti5GSMobileIdentity_t guti; diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt index 3b51ec748c..bf47e478b9 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/CMakeLists.txt @@ -5,6 +5,7 @@ add_library(fgs_5gmm_lib OBJECT fgmm_service_reject.c RegistrationRequest.c RegistrationAccept.c + fgmm_identity_request.c FGSIdentityResponse.c FGSAuthenticationResponse.c FGSNASSecurityModeComplete.c diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c new file mode 100644 index 0000000000..b41035f6ea --- /dev/null +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c @@ -0,0 +1,37 @@ +/* + * 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 + */ + +#include "fgmm_identity_request.h" +#include +#include "FGSMobileIdentity.h" + +int decode_fgs_identity_request(fgs_identity_request_msg_t *msg, const byte_array_t *buffer) +{ + if (buffer->len < 1) { + PRINT_NAS_ERROR("Failed to decode NAS Identity Request: invalid buffer length %ld\n", buffer->len); + return -1; + } + + // Bits 3-1 (least significant 3 bits) + msg->fgsmobileidentity = buffer->buf[0] & 0x07; + + return 1; +} diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.h new file mode 100644 index 0000000000..104f133ed1 --- /dev/null +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.h @@ -0,0 +1,36 @@ +/* + * 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 + */ + +#ifndef FGS_IDENTITY_REQUEST_H +#define FGS_IDENTITY_REQUEST_H + +#include +#include +#include "common/utils/ds/byte_array.h" +#include "FGSMobileIdentity.h" + +typedef struct { + fgs_identity_type_t fgsmobileidentity; +} fgs_identity_request_msg_t; + +int decode_fgs_identity_request(fgs_identity_request_msg_t *msg, const byte_array_t *buffer); + +#endif /* FGS_IDENTITY_REQUEST_H */