Merge branch 'develop_SA_SIM' into develop_SA_L3
Conflicts: common/utils/ocp_itti/intertask_interface.h openair2/COMMON/gtpv1_u_messages_types.h openair2/GNB_APP/gnb_config.c openair2/RRC/NR/MESSAGES/asn1_msg.c openair2/RRC/NR/nr_rrc_proto.h openair2/RRC/NR/rrc_gNB.c openair2/RRC/NR/rrc_gNB_NGAP.c openair2/RRC/NR_UE/rrc_UE.c openair3/NAS/NR_UE/nr_nas_msg_sim.h openair3/NGAP/ngap_gNB_nas_procedures.c
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*! \file FGSAuthenticationResponse.c
|
||||
|
||||
\brief authentication response procedures
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nas_log.h"
|
||||
|
||||
#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
|
||||
return encode_result;
|
||||
else
|
||||
encoded += encode_result;
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*! \file FGSAuthenticationResponse.h
|
||||
|
||||
\brief authentication response procedures
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
|
||||
/*
|
||||
* Message name: Identity response
|
||||
* Description: This message is sent by the UE to the AMF to provide the requested identity. See table 8.2.22.1.
|
||||
* Significance: dual
|
||||
* Direction: UE to AMF
|
||||
*/
|
||||
|
||||
typedef struct fgs_authentication_response_msg_tag {
|
||||
/* Mandatory fields */
|
||||
ExtendedProtocolDiscriminator protocoldiscriminator;
|
||||
SecurityHeaderType securityheadertype:4;
|
||||
SpareHalfOctet 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_) */
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*! \file FGSIdentityResponse.c
|
||||
|
||||
\brief identity response procedures for gNB
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nas_log.h"
|
||||
|
||||
#include "FGSIdentityResponse.h"
|
||||
|
||||
|
||||
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
|
||||
return encode_result;
|
||||
else
|
||||
encoded += encode_result;
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*! \file FGSIdentityResponse.h
|
||||
|
||||
\brief identity response procedures for gNB
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ExtendedProtocolDiscriminator.h"
|
||||
#include "SecurityHeaderType.h"
|
||||
#include "SpareHalfOctet.h"
|
||||
#include "FGSMobileIdentity.h"
|
||||
#include "MessageType.h"
|
||||
|
||||
#ifndef FGS_IDENTITY_RESPONSE_H_
|
||||
#define FGS_IDENTITY_RESPONSE_H_
|
||||
|
||||
/*
|
||||
* Message name: Identity response
|
||||
* Description: This message is sent by the UE to the AMF to provide the requested identity. See table 8.2.22.1.
|
||||
* Significance: dual
|
||||
* Direction: UE to AMF
|
||||
*/
|
||||
|
||||
typedef struct fgs_identiy_response_msg_tag {
|
||||
/* Mandatory fields */
|
||||
ExtendedProtocolDiscriminator protocoldiscriminator;
|
||||
SecurityHeaderType securityheadertype:4;
|
||||
SpareHalfOctet 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_) */
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*! \file FGSNASSecurityModeComplete.c
|
||||
|
||||
\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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nas_log.h"
|
||||
|
||||
#include "FGSNASSecurityModeComplete.h"
|
||||
#include "FGSMobileIdentity.h"
|
||||
#include "FGCNasMessageContainer.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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*! \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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ExtendedProtocolDiscriminator.h"
|
||||
#include "SecurityHeaderType.h"
|
||||
#include "SpareHalfOctet.h"
|
||||
#include "FGSMobileIdentity.h"
|
||||
#include "MessageType.h"
|
||||
#include "FGCNasMessageContainer.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 */
|
||||
ExtendedProtocolDiscriminator protocoldiscriminator;
|
||||
SecurityHeaderType securityheadertype:4;
|
||||
SpareHalfOctet 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_) */
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
/*! \file FGSUplinkNasTransport.c
|
||||
|
||||
\brief uplink nas transport procedures
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "FGSUplinkNasTransport.h"
|
||||
#include "TLVEncoder.h"
|
||||
|
||||
int encode_fgs_payload_container(FGSPayloadContainer *paycontainer, uint8_t iei, uint8_t *buffer, uint32_t len)
|
||||
{
|
||||
uint32_t encoded = 0;
|
||||
int encode_result;
|
||||
|
||||
if (iei > 0) {
|
||||
*buffer = iei;
|
||||
encoded++;
|
||||
}
|
||||
|
||||
encoded += 2;
|
||||
|
||||
if ((encode_result = encode_octet_string(&paycontainer->payloadcontainercontents, buffer + encoded, len - encoded)) < 0) {
|
||||
return encode_result;
|
||||
} else {
|
||||
encoded += encode_result;
|
||||
}
|
||||
if(iei > 0){
|
||||
*(uint16_t*) (buffer+1) = htons(encoded - 3);
|
||||
} else {
|
||||
*(uint16_t*) (buffer) = htons(encoded - 2);
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
int encode_nssai(OctetString *nssai, uint8_t iei, uint8_t *buffer)
|
||||
{
|
||||
uint32_t encoded = 0;
|
||||
int encode_result;
|
||||
|
||||
if (iei > 0) {
|
||||
*buffer = iei;
|
||||
encoded++;
|
||||
}
|
||||
|
||||
*(buffer + encoded) = nssai->length;
|
||||
encoded++;
|
||||
|
||||
|
||||
if ((encode_result = encode_octet_string(nssai, buffer + encoded, nssai->length)) < 0) {
|
||||
return encode_result;
|
||||
} else {
|
||||
encoded += encode_result;
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
int encode_dnn(OctetString *dnn, uint8_t iei, uint8_t *buffer)
|
||||
{
|
||||
uint32_t encoded = 0;
|
||||
int encode_result;
|
||||
|
||||
if (iei > 0) {
|
||||
*buffer = iei;
|
||||
encoded++;
|
||||
}
|
||||
|
||||
*(buffer + encoded) = dnn->length;
|
||||
encoded++;
|
||||
|
||||
if ((encode_result = encode_octet_string(dnn, buffer + encoded, dnn->length)) < 0) {
|
||||
return encode_result;
|
||||
} else {
|
||||
encoded += encode_result;
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
*(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;
|
||||
}
|
||||
|
||||
*(buffer + encoded) = 0x12;
|
||||
encoded++;
|
||||
|
||||
IES_ENCODE_U8(buffer, encoded, fgs_up_nas_transport->pdusessionid);
|
||||
|
||||
// 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_dnn(&fgs_up_nas_transport->dnn, 0x25, buffer +encoded)) < 0) {
|
||||
return encode_result;
|
||||
} else {
|
||||
encoded += encode_result;
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*! \file FGSUplinkNasTransport.h
|
||||
|
||||
\brief uplink nas transport procedures
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ExtendedProtocolDiscriminator.h"
|
||||
#include "SecurityHeaderType.h"
|
||||
#include "SpareHalfOctet.h"
|
||||
#include "MessageType.h"
|
||||
|
||||
#ifndef FGS_UPLINK_NAS_TRANSPORT_H_
|
||||
#define FGS_UPLINK_NAS_TRANSPORT_H_
|
||||
|
||||
/*
|
||||
* Message name: uplink nas transpaort
|
||||
* Description: The UL NAS TRANSPORT message transports message payload and associated information to the AMF. See table 8.2.10.1.1.
|
||||
* Significance: dual
|
||||
* Direction: UE to network
|
||||
*/
|
||||
|
||||
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;
|
||||
} 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_) */
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*! \file RegistrationAccept.c
|
||||
|
||||
\brief 5GS registration accept procedures
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "TLVEncoder.h"
|
||||
#include "TLVDecoder.h"
|
||||
#include "RegistrationAccept.h"
|
||||
#include "assertions.h"
|
||||
|
||||
int decode_registration_accept(registration_accept_msg *registration_accept, uint8_t *buffer, uint32_t len)
|
||||
{
|
||||
uint32_t decoded = 0;
|
||||
int decoded_result = 0;
|
||||
|
||||
/* Decoding mandatory fields */
|
||||
if ((decoded_result = decode_fgs_registration_result(®istration_accept->fgsregistrationresult, 0, *(buffer + decoded), len - decoded)) < 0)
|
||||
return decoded_result;
|
||||
|
||||
decoded += decoded_result;
|
||||
|
||||
// todo ,Decoding optional fields
|
||||
return decoded;
|
||||
}
|
||||
|
||||
int encode_registration_accept(registration_accept_msg *registration_accept, uint8_t *buffer, uint32_t len)
|
||||
{
|
||||
int encoded = 0;
|
||||
|
||||
LOG_FUNC_IN;
|
||||
|
||||
|
||||
*(buffer + encoded) = encode_fgs_registration_result(®istration_accept->fgsregistrationresult);
|
||||
encoded = encoded + 2;
|
||||
|
||||
// todo ,Encoding optional fields
|
||||
LOG_FUNC_RETURN(encoded);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*! \file RegistrationAccept.h
|
||||
|
||||
\brief 5GS registration accept procedures
|
||||
\author Yoshio INOUE, Masayuki HARADA
|
||||
\email: yoshio.inoue@fujitsu.com,masayuki.harada@fujitsu.com
|
||||
\date 2020
|
||||
\version 0.1
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include "ExtendedProtocolDiscriminator.h"
|
||||
#include "SecurityHeaderType.h"
|
||||
#include "SpareHalfOctet.h"
|
||||
#include "MessageType.h"
|
||||
#include "FGSRegistrationResult.h"
|
||||
|
||||
#ifndef REGISTRATION_ACCEPT_H_
|
||||
#define REGISTRATION_ACCEPT_H_
|
||||
|
||||
/*
|
||||
* Message name: Registration accept
|
||||
* Description: The REGISTRATION ACCEPT message is sent by the AMF to the UE. See table 8.2.7.1.1.
|
||||
* Significance: dual
|
||||
* Direction: network to UE
|
||||
*/
|
||||
|
||||
typedef struct registration_accept_msg_tag {
|
||||
/* Mandatory fields */
|
||||
ExtendedProtocolDiscriminator protocoldiscriminator;
|
||||
SecurityHeaderType securityheadertype:4;
|
||||
SpareHalfOctet sparehalfoctet:4;
|
||||
MessageType messagetype;
|
||||
FGSRegistrationResult fgsregistrationresult;
|
||||
} registration_accept_msg;
|
||||
|
||||
int decode_registration_accept(registration_accept_msg *registrationaccept, uint8_t *buffer, uint32_t len);
|
||||
|
||||
int encode_registration_accept(registration_accept_msg *registrationaccept, uint8_t *buffer, uint32_t len);
|
||||
|
||||
#endif /* ! defined(REGISTRATION_ACCEPT_H_) */
|
||||
|
||||
Reference in New Issue
Block a user