as per legacy code, the NAS functions in nr_nas_msg.c were encoding the header in the plain header contained in MM_msg (e.g. plain -> mm_msg -> header in fgs_nas_message_t). The same header was encoded in the mobility management message contained in the same struct (e.g. plain -> mm_msg -> registration_request -> protocoldiscriminator). As this was more complicated than necessary, the goal of this commit is to simplify the code and improve readability. Namely: * Refactor MM_msg into fgmm_nas_message_plain_t to contain (1) 5GMM Header (2) 5GMM Payload union * Use fgmm_nas_message_plain_t and fgmm_nas_msg_security_protected_t in the 5GMM NAS procedures * Remove NAS header IEs from 5GMM messages structs and use the header in fgs_nas_message_plain_t. This reduce also the repetitions of header members in each of the 5GMM messages structs. * Rename struct to distinguish between 5GMM and 5GSM * Remove fgs_nas_message_t and nas_msg_header_t, use directly basic 5GS struct definitions, simplify the code * The callbacks in nr_nas_msg.c are now doing (1) encode header with the common NAS lib (2) encode contents with the 5GMM libs * improve code readibility in the process
56 lines
2.1 KiB
C
56 lines
2.1 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 FGSNASSecurityModeComplete.h
|
|
|
|
\brief security mode complete procedures for gNB
|
|
\author Yoshio INOUE, Masayuki HARADA
|
|
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
|
\date 2020
|
|
\version 0.1
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include "FGCNasMessageContainer.h"
|
|
#include "FGSMobileIdentity.h"
|
|
#include "MessageType.h"
|
|
#include "SecurityHeaderType.h"
|
|
|
|
#ifndef FGS_NAS_SECURITY_MODE_COMPLETE_H_
|
|
#define FGS_NAS_SECURITY_MODE_COMPLETE_H_
|
|
|
|
/*
|
|
* Message name: security mode complete
|
|
* Description: This message is sent by the UE to the AMF in response to a SECURITY MODE COMMAND message. See table 8.2.26.1.1.
|
|
* Significance: dual
|
|
* Direction: UE to AMF
|
|
*/
|
|
|
|
typedef struct fgs_security_mode_complete_msg_tag {
|
|
/* Mandatory fields */
|
|
FGSMobileIdentity fgsmobileidentity;
|
|
FGCNasMessageContainer fgsnasmessagecontainer;
|
|
} fgs_security_mode_complete_msg;
|
|
|
|
int encode_fgs_security_mode_complete(const fgs_security_mode_complete_msg *fgs_security_mode_comp, uint8_t *buffer, uint32_t len);
|
|
|
|
#endif /* ! defined(FGS_NAS_SECURITY_MODE_COMPLETE_H_) */
|