Add library for NAS Identity Request
* Add Identity Request decoding function * Define type for Identity Type NAS IE * Target include directory in NAS IEs CMakeLists.txt (for NAS utils)
This commit is contained in:
@@ -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 ../../)
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <string.h>
|
||||
#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;
|
||||
}
|
||||
@@ -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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#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 */
|
||||
Reference in New Issue
Block a user