* move enc/dec definitions to NR_NAS_defs.h and add new lib file nr_fgs_nas_lib.c both used by nr_nas_msg.c * move utility macros to fgs_nas_utils.h: this can be used in all the 5GMM, 5GSM lib files * use nr_nas_msg.c for handlers/callbacks only, it should call the enc/dec functions in nr_fgs_nas_lib and in the 5GMM, 5GSM libs * 5GMM, 5GSM libs should only do the enc/dec of the NAS message contents
94 lines
2.9 KiB
C
94 lines
2.9 KiB
C
/*
|
|
* 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 nr_nas_msg.h
|
|
* \brief simulator for nr nas message
|
|
* \author Yoshio INOUE, Masayuki HARADA
|
|
* \email yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
|
* \protocol 5GS (5GMM and 5GSM)
|
|
* \date 2020
|
|
* \version 0.1
|
|
*/
|
|
|
|
#ifndef __NR_NAS_MSG_SIM_H__
|
|
#define __NR_NAS_MSG_SIM_H__
|
|
|
|
#include <common/utils/assertions.h>
|
|
#include <openair3/UICC/usim_interface.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "as_message.h"
|
|
#include "NR_NAS_defs.h"
|
|
#include "secu_defs.h"
|
|
#include "NR_NAS_defs.h"
|
|
|
|
#define INITIAL_REGISTRATION 0b001
|
|
|
|
#define PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH 3
|
|
#define SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH 7
|
|
#define PAYLOAD_CONTAINER_LENGTH_MIN 3
|
|
#define PAYLOAD_CONTAINER_LENGTH_MAX 65537
|
|
|
|
/* 3GPP TS 24.501: 9.11.3.50 Service type */
|
|
#define SERVICE_TYPE_DATA 0x1
|
|
|
|
/* List of allowed NSSAI from NAS messaging. */
|
|
typedef struct {
|
|
int sst;
|
|
int hplmn_sst;
|
|
int sd;
|
|
int hplmn_sd;
|
|
} nr_nas_msg_snssai_t;
|
|
|
|
/* Security Key for SA UE */
|
|
typedef struct {
|
|
uint8_t kausf[32];
|
|
uint8_t kseaf[32];
|
|
uint8_t kamf[32];
|
|
uint8_t knas_int[16];
|
|
uint8_t knas_enc[16];
|
|
uint8_t res[16];
|
|
uint8_t rand[16];
|
|
uint8_t kgnb[32];
|
|
uint32_t nas_count_ul;
|
|
uint32_t nas_count_dl;
|
|
} ue_sa_security_key_t;
|
|
|
|
typedef struct {
|
|
uicc_t *uicc;
|
|
ue_sa_security_key_t security;
|
|
stream_security_container_t *security_container;
|
|
Guti5GSMobileIdentity_t *guti;
|
|
bool termination_procedure;
|
|
uint8_t *registration_request_buf;
|
|
uint32_t registration_request_len;
|
|
instance_t UE_id;
|
|
} nr_ue_nas_t;
|
|
|
|
nr_ue_nas_t *get_ue_nas_info(module_id_t module_id);
|
|
void generateRegistrationRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas);
|
|
void generateServiceRequest(as_nas_info_t *initialNasMsg, nr_ue_nas_t *nas);
|
|
void *nas_nrue_task(void *args_p);
|
|
void *nas_nrue(void *args_p);
|
|
void nas_init_nrue(int num_ues);
|
|
|
|
#endif /* __NR_NAS_MSG_SIM_H__*/
|