Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
65d86435
Commit
65d86435
authored
Nov 27, 2020
by
Chenyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
session establishment request to upf ,but no response
parent
8dc01636
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1733 additions
and
28 deletions
+1733
-28
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+13
-3
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+2
-2
openair2/RRC/NR/rrc_gNB_NGAP.c
openair2/RRC/NR/rrc_gNB_NGAP.c
+1
-1
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+8
-4
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c
+35
-0
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h
+45
-0
openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c
openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c
+35
-0
openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h
openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h
+44
-0
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
+45
-0
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h
+44
-0
openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c
openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c
+129
-0
openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h
openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h
+56
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.c
openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.c
+49
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h
openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h
+45
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c
+61
-0
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h
+41
-0
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c
+45
-0
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h
+43
-0
openair3/NAS/COMMON/IES/FGCNasMessageContainer.c
openair3/NAS/COMMON/IES/FGCNasMessageContainer.c
+77
-0
openair3/NAS/COMMON/IES/FGCNasMessageContainer.h
openair3/NAS/COMMON/IES/FGCNasMessageContainer.h
+33
-0
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
+66
-2
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
+1
-0
openair3/NAS/COMMON/IES/FGSRegistrationResult.c
openair3/NAS/COMMON/IES/FGSRegistrationResult.c
+41
-0
openair3/NAS/COMMON/IES/FGSRegistrationResult.h
openair3/NAS/COMMON/IES/FGSRegistrationResult.h
+38
-0
openair3/NAS/COMMON/IES/SORTransparentContainer.c
openair3/NAS/COMMON/IES/SORTransparentContainer.c
+103
-0
openair3/NAS/COMMON/IES/SORTransparentContainer.h
openair3/NAS/COMMON/IES/SORTransparentContainer.h
+45
-0
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+535
-15
openair3/NAS/NR_UE/nr_nas_msg_sim.h
openair3/NAS/NR_UE/nr_nas_msg_sim.h
+53
-1
No files found.
cmake_targets/CMakeLists.txt
View file @
65d86435
...
...
@@ -2511,7 +2511,7 @@ if(NAS_UE)
endif
()
if
(
ITTI_SIM
)
#
if(ITTI_SIM)
set
(
libnas_ue_api_OBJS
${
NAS_SRC
}
UE/API/USER/at_command.c
${
NAS_SRC
}
UE/API/USER/at_error.c
...
...
@@ -2585,6 +2585,13 @@ if(ITTI_SIM)
set
(
libnrnas_emm_msg_OBJS
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationRequest.c
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationAccept.c
${
NAS_SRC
}
COMMON/EMM/MSG/FGSIdentityResponse.c
${
NAS_SRC
}
COMMON/EMM/MSG/FGSAuthenticationResponse.c
${
NAS_SRC
}
COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationComplete.c
${
NAS_SRC
}
COMMON/EMM/MSG/FGSUplinkNasTransport.c
${
NAS_SRC
}
COMMON/ESM/MSG/PduSessionEstablishRequest.c
)
set
(
libnrnas_ies_OBJS
...
...
@@ -2592,8 +2599,11 @@ if(ITTI_SIM)
${
NAS_SRC
}
COMMON/IES/FGSMobileIdentity.c
${
NAS_SRC
}
COMMON/IES/FGSRegistrationType.c
${
NAS_SRC
}
COMMON/IES/SpareHalfOctet.c
${
NAS_SRC
}
COMMON/IES/FGSRegistrationResult.c
${
NAS_SRC
}
COMMON/IES/FGMMCapability.c
${
NAS_SRC
}
COMMON/IES/NrUESecurityCapability.c
${
NAS_SRC
}
COMMON/IES/FGCNasMessageContainer.c
${
NAS_SRC
}
COMMON/IES/SORTransparentContainer.c
)
add_library
(
LIB_NAS_SIMUE
...
...
@@ -2627,7 +2637,7 @@ if(ITTI_SIM)
include_directories
(
${
NAS_SRC
}
UE/EMM/SAP
)
include_directories
(
${
NAS_SRC
}
UE/ESM
)
include_directories
(
${
NAS_SRC
}
UE/ESM/SAP
)
endif
()
#
endif()
# nbiot
add_definitions
(
"-DNUMBER_OF_UE_MAX_NB_IoT=16"
)
...
...
@@ -3111,7 +3121,7 @@ target_link_libraries (nr-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
${
NAS_SIM_LIB
}
${
MSC_LIB
}
${
RAL_LIB
}
${
NAS_UE_LIB
}
${
ITTI_LIB
}
${
FLPT_MSG_LIB
}
${
ASYNC_IF_LIB
}
LFDS7
${
ATLAS_LIBRARIES
}
LIB_5GNAS_GNB
-Wl,--end-group z dl
)
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
65d86435
...
...
@@ -1248,9 +1248,9 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Trans
memset
(
&
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
dedicatedNAS_Message
,
0
,
sizeof
(
OCTET_STRING_t
));
OCTET_STRING_fromBuf
(
&
RrcSetupComplete
->
criticalExtensions
.
choice
.
rrcSetupComplete
->
dedicatedNAS_Message
,
dedicatedInfoNAS
,
dedicatedInfoNASLength
);
if
(
LOG_DEBUGFLAG
(
DEBUG_ASN1
)
)
{
//
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint
(
stdout
,
&
asn_DEF_NR_UL_DCCH_Message
,
(
void
*
)
&
ul_dcch_msg
);
}
//
}
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_UL_DCCH_Message
,
NULL
,
...
...
openair2/RRC/NR/rrc_gNB_NGAP.c
View file @
65d86435
...
...
@@ -800,7 +800,7 @@ rrc_gNB_process_NGAP_DOWNLINK_NAS(
/* Transfer data to PDCP */
nr_rrc_data_req
(
&
ctxt
,
ue_context_p
->
ue_context
.
Srb2
.
Srb_info
.
Srb_id
,
DCCH
,
//
ue_context_p->ue_context.Srb2.Srb_info.Srb_id,
(
*
rrc_gNB_mui
)
++
,
SDU_CONFIRM_NO
,
length
,
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
65d86435
...
...
@@ -68,7 +68,7 @@
#include "RRC/NAS/rb_config.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
#if ITTI_SIM
#if
1 //
ITTI_SIM
#include "nr_nas_msg_sim.h"
#endif
...
...
@@ -1365,6 +1365,10 @@ static void rrc_ue_generate_RRCSetupComplete(
nas_msg
=
nr_nas_attach_req_imsi
;
nas_msg_length
=
sizeof
(
nr_nas_attach_req_imsi
);
}
as_nas_info_t
initialNasMsg
;
generateRegistrationRequest
(
&
initialNasMsg
);
nas_msg
=
(
char
*
)
initialNasMsg
.
data
;
nas_msg_length
=
initialNasMsg
.
length
;
size
=
do_RRCSetupComplete
(
ctxt_pP
->
module_id
,
buffer
,
Transaction_id
,
sel_plmn_id
,
nas_msg_length
,
nas_msg
);
LOG_I
(
NR_RRC
,
"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d, gNB %d)
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
size
,
gNB_index
);
...
...
@@ -2333,7 +2337,7 @@ nr_rrc_ue_decode_dcch(
nr_rrc_ue_generate_RRCReconfigurationComplete
(
ctxt_pP
,
gNB_indexP
,
dl_dcch_msg
->
message
.
choice
.
c1
->
choice
.
rrcReconfiguration
->
rrc_TransactionIdentifier
);
#ifdef ITTI_SIM
#if
1//
def ITTI_SIM
as_nas_info_t
initialNasMsg
;
memset
(
&
initialNasMsg
,
0
,
sizeof
(
as_nas_info_t
));
generateRegistrationComplete
(
&
initialNasMsg
,
NULL
);
...
...
@@ -2402,7 +2406,7 @@ nr_rrc_ue_decode_dcch(
uint8_t
*
pdu_buffer
;
pdu_length
=
dedicatedNAS_Message
->
size
;
pdu_buffer
=
dedicatedNAS_Message
->
buf
;
#ifdef ITTI_SIM
#if
1 //
def ITTI_SIM
LOG_I
(
NR_RRC
,
"[UE %d] Received %s: UEid %u, length %u , buffer %p
\n
"
,
ctxt_pP
->
module_id
,
messages_info
[
NAS_DOWNLINK_DATA_IND
].
name
,
ctxt_pP
->
module_id
,
pdu_length
,
pdu_buffer
);
as_nas_info_t
initialNasMsg
;
...
...
@@ -2590,7 +2594,7 @@ void *rrc_nrue_task( void *args_p ) {
PDCP_TRANSMISSION_MODE_CONTROL
);
}
else
{
rrc_data_req_ue
(
&
ctxt
,
DCCH
1
,
DCCH
,
nr_rrc_mui
++
,
SDU_CONFIRM_NO
,
length
,
buffer
,
...
...
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c
0 → 100644
View file @
65d86435
/*! \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
;
}
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.h
0 → 100644
View file @
65d86435
/*! \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_) */
openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.c
0 → 100644
View file @
65d86435
/*! \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
;
}
openair3/NAS/COMMON/EMM/MSG/FGSIdentityResponse.h
0 → 100644
View file @
65d86435
/*! \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_) */
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.c
0 → 100644
View file @
65d86435
/*! \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
;
}
openair3/NAS/COMMON/EMM/MSG/FGSNASSecurityModeComplete.h
0 → 100644
View file @
65d86435
/*! \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_) */
openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c
0 → 100644
View file @
65d86435
/*! \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
;
}
openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.h
0 → 100644
View file @
65d86435
/*! \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_) */
openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.c
0 → 100644
View file @
65d86435
/*! \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
(
&
registration_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
(
&
registration_accept
->
fgsregistrationresult
);
encoded
=
encoded
+
2
;
// todo ,Encoding optional fields
LOG_FUNC_RETURN
(
encoded
);
}
openair3/NAS/COMMON/EMM/MSG/RegistrationAccept.h
0 → 100644
View file @
65d86435
/*! \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_) */
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.c
0 → 100644
View file @
65d86435
/*
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "RegistrationComplete.h"
#include "SORTransparentContainer.h"
int
decode_registration_complete
(
registration_complete_msg
*
registration_complete
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
decoded
=
0
;
int
decoded_result
=
0
;
/* Decoding mandatory fields */
if
((
decoded_result
=
decode_sor_transparent_container
(
&
registration_complete
->
sortransparentcontainer
,
0
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decoded_result
;
else
decoded
+=
decoded_result
;
return
decoded
;
}
int
encode_registration_complete
(
registration_complete_msg
*
registration_complete
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
encoded
=
0
;
int
encode_result
=
0
;
if
((
encode_result
=
encode_sor_transparent_container
(
&
registration_complete
->
sortransparentcontainer
,
0
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//Return in case of error
return
encode_result
;
else
encoded
+=
encode_result
;
return
encoded
;
}
openair3/NAS/COMMON/EMM/MSG/RegistrationComplete.h
0 → 100644
View file @
65d86435
/*! \file RegistrationRequest.h
\brief registration request 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 "MessageType.h"
#include "SORTransparentContainer.h"
#ifndef REGISTRATION_COMPLETE_H_
#define REGISTRATION_COMPLETE_H_
typedef
struct
registration_complete_msg_tag
{
/* Mandatory fields */
ExtendedProtocolDiscriminator
protocoldiscriminator
;
SecurityHeaderType
securityheadertype
:
4
;
SpareHalfOctet
sparehalfoctet
:
4
;
MessageType
messagetype
;
/* Optional fields */
SORTransparentContainer
sortransparentcontainer
;
}
registration_complete_msg
;
int
decode_registration_complete
(
registration_complete_msg
*
registrationcomplete
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_registration_complete
(
registration_complete_msg
*
registrationcomplete
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* ! defined(REGISTRATION_COMPLETE_H_) */
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.c
0 → 100644
View file @
65d86435
/*! \file PduSessionEstablishRequest.c
\brief pdu session establishment request 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 "PduSessionEstablishRequest.h"
int
encode_pdu_session_establishment_request
(
pdu_session_establishment_request_msg
*
pdusessionestablishrequest
,
uint8_t
*
buffer
)
{
int
encoded
=
0
;
*
(
buffer
+
encoded
)
=
pdusessionestablishrequest
->
protocoldiscriminator
;
encoded
++
;
*
(
buffer
+
encoded
)
=
pdusessionestablishrequest
->
pdusessionid
;
encoded
++
;
*
(
buffer
+
encoded
)
=
pdusessionestablishrequest
->
pti
;
encoded
++
;
*
(
buffer
+
encoded
)
=
pdusessionestablishrequest
->
pdusessionestblishmsgtype
;
encoded
++
;
IES_ENCODE_U16
(
buffer
,
encoded
,
pdusessionestablishrequest
->
maxdatarate
);
*
(
buffer
+
encoded
)
=
0x91
;
encoded
++
;
*
(
buffer
+
encoded
)
=
0xA1
;
encoded
++
;
return
encoded
;
}
openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishRequest.h
0 → 100644
View file @
65d86435
/*! \file PduSessionEstablishRequest.h
\brief pdu session establishment request 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 "MessageType.h"
#ifndef PDU_SESSION_ESTABLISHMENT_REQUEST_H_
#define PDU_SESSION_ESTABLISHMENT_REQUEST_H_
/*
* Message name: pdu session establishment request
* Description: The PDU SESSION ESTABLISHMENT REQUEST message is sent by the UE to the SMF to initiate establishment of a PDU session. See table 8.3.1.1.1.
* Significance: dual
* Direction: UE to network
*/
typedef
struct
pdu_session_establishment_request_msg_tag
{
/* Mandatory fields */
ExtendedProtocolDiscriminator
protocoldiscriminator
;
uint8_t
pdusessionid
;
uint8_t
pti
;
MessageType
pdusessionestblishmsgtype
;
uint16_t
maxdatarate
;
/* Optional fields */
}
pdu_session_establishment_request_msg
;
int
encode_pdu_session_establishment_request
(
pdu_session_establishment_request_msg
*
pdusessionestablishrequest
,
uint8_t
*
buffer
);
#endif
/* ! defined(PDU_SESSION_ESTABLISHMENT_REQUEST_H_) */
openair3/NAS/COMMON/IES/FGCNasMessageContainer.c
0 → 100644
View file @
65d86435
/*! \file FGCNasMessageContainer.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 <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "FGCNasMessageContainer.h"
int
decode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
ielen
=
*
(
buffer
+
decoded
);
decoded
+=
2
;
CHECK_LENGTH_DECODER
(
len
-
decoded
,
ielen
);
if
((
decode_result
=
decode_octet_string
(
&
nasmessagecontainer
->
nasmessagecontainercontents
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decode_result
;
else
decoded
+=
decode_result
;
return
decoded
;
}
int
encode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
encoded
=
0
;
int
encode_result
;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
FGC_NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH
,
len
);
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
encoded
+=
2
;
if
((
encode_result
=
encode_octet_string
(
&
nasmessagecontainer
->
nasmessagecontainercontents
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
{
return
encode_result
;
}
else
{
*
(
uint16_t
*
)
(
buffer
+
1
)
=
htons
(
encoded
+
encode_result
-
3
);
encoded
+=
encode_result
;
}
return
encoded
;
}
void
dump_fgc_nas_message_container_xml
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
)
{
printf
(
"<Nas Message Container>
\n
"
);
if
(
iei
>
0
)
/* Don't display IEI if = 0 */
printf
(
" <IEI>0x%X</IEI>
\n
"
,
iei
);
printf
(
"%s"
,
dump_octet_string_xml
(
&
nasmessagecontainer
->
nasmessagecontainercontents
));
printf
(
"</Nas Message Container>
\n
"
);
}
openair3/NAS/COMMON/IES/FGCNasMessageContainer.h
0 → 100644
View file @
65d86435
/*! \file FGCNasMessageContainer.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 "OctetString.h"
#ifndef FGC_NAS_MESSAGE_CONTAINER_H_
#define FGC_NAS_MESSAGE_CONTAINER_H_
#define FGC_NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH 4
#define FGC_NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH 65535
typedef
struct
FGCNasMessageContainer_tag
{
OctetString
nasmessagecontainercontents
;
}
FGCNasMessageContainer
;
int
encode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_fgc_nas_message_container
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
void
dump_fgc_nas_message_container_xml
(
FGCNasMessageContainer
*
nasmessagecontainer
,
uint8_t
iei
);
#endif
/* FGC NAS MESSAGE CONTAINER_H_ */
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
View file @
65d86435
...
...
@@ -40,6 +40,8 @@
static
int
decode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
static
int
encode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
static
int
encode_suci_5gs_mobile_identity
(
Suci5GSMobileIdentity_t
*
suci
,
uint8_t
*
buffer
);
static
int
encode_imeisv_5gs_mobile_identity
(
Imeisv5GSMobileIdentity_t
*
imeisv
,
uint8_t
*
buffer
);
int
decode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
...
...
@@ -87,11 +89,26 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
buffer
+
encoded
);
}
if
(
fgsmobileidentity
->
suci
.
typeofidentity
==
FGS_MOBILE_IDENTITY_SUCI
)
{
encoded_rc
=
encode_suci_5gs_mobile_identity
(
&
fgsmobileidentity
->
suci
,
buffer
+
encoded
);
}
if
(
fgsmobileidentity
->
imeisv
.
typeofidentity
==
FGS_MOBILE_IDENTITY_IMEISV
)
{
encoded_rc
=
encode_imeisv_5gs_mobile_identity
(
&
fgsmobileidentity
->
imeisv
,
buffer
+
encoded
);
}
if
(
encoded_rc
<
0
)
{
return
encoded_rc
;
}
*
(
uint16_t
*
)
buffer
=
htons
(
encoded
+
encoded_rc
-
2
-
((
iei
>
0
)
?
1
:
0
));
if
(
iei
>
0
){
*
(
uint16_t
*
)
(
buffer
+
1
)
=
htons
(
encoded
+
encoded_rc
-
3
);
}
else
{
*
(
uint16_t
*
)
buffer
=
htons
(
encoded
+
encoded_rc
-
2
);
}
return
(
encoded
+
encoded_rc
);
}
...
...
@@ -166,10 +183,57 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
*
(
buffer
+
encoded
)
=
guti
->
amfregionid
;
encoded
++
;
temp
=
0x00
|
((
guti
->
amfsetid
&
0x3f
)
<<
6
)
|
(
guti
->
amfpointer
&
0x3f
);
temp
=
0x00
|
((
guti
->
amfsetid
)
<<
6
)
|
(
guti
->
amfpointer
&
0x3f
);
IES_ENCODE_U16
(
buffer
,
encoded
,
temp
);
IES_ENCODE_U32
(
buffer
,
encoded
,
guti
->
tmsi
);
return
encoded
;
}
static
int
encode_suci_5gs_mobile_identity
(
Suci5GSMobileIdentity_t
*
suci
,
uint8_t
*
buffer
)
{
uint32_t
encoded
=
0
;
*
(
buffer
+
encoded
)
=
0x00
|
(
suci
->
supiformat
<<
4
)
|
(
suci
->
typeofidentity
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
mccdigit2
&
0xf
)
<<
4
)
|
(
suci
->
mccdigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
mncdigit3
&
0xf
)
<<
4
)
|
(
suci
->
mccdigit3
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
mncdigit2
&
0xf
)
<<
4
)
|
(
suci
->
mncdigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
routingindicatordigit2
&
0xf
)
<<
4
)
|
(
suci
->
routingindicatordigit1
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
((
suci
->
routingindicatordigit4
&
0xf
)
<<
4
)
|
(
suci
->
routingindicatordigit3
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
(
suci
->
protectionschemeId
&
0xf
);
encoded
++
;
*
(
buffer
+
encoded
)
=
suci
->
homenetworkpki
;
encoded
++
;
IES_ENCODE_U32
(
buffer
,
encoded
,
suci
->
schemeoutput
);
return
encoded
;
}
static
int
encode_imeisv_5gs_mobile_identity
(
Imeisv5GSMobileIdentity_t
*
imeisv
,
uint8_t
*
buffer
)
{
uint32_t
encoded
=
0
;
*
(
buffer
+
encoded
)
=
0x00
|
(
imeisv
->
digit1
<<
4
)
|
(
imeisv
->
oddeven
<<
3
)
|
(
imeisv
->
typeofidentity
);
encoded
++
;
*
(
buffer
+
encoded
)
=
0x00
|
(
imeisv
->
digitp1
<<
4
)
|
(
imeisv
->
digitp
);
encoded
++
;
return
encoded
;
}
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
View file @
65d86435
...
...
@@ -64,6 +64,7 @@ typedef struct {
uint8_t
spare6
:
1
;
uint8_t
protectionschemeId
:
4
;
uint8_t
homenetworkpki
;
uint32_t
schemeoutput
;
}
Suci5GSMobileIdentity_t
;
typedef
struct
{
...
...
openair3/NAS/COMMON/IES/FGSRegistrationResult.c
0 → 100644
View file @
65d86435
/*! \file FGSRegistrationResult.c
\brief 5GS Registration result for registration request 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 "TLVEncoder.h"
#include "TLVDecoder.h"
#include "FGSRegistrationResult.h"
int
decode_fgs_registration_result
(
FGSRegistrationResult
*
fgsregistrationresult
,
uint8_t
iei
,
uint16_t
value
,
uint32_t
len
)
{
int
decoded
=
0
;
uint16_t
*
buffer
=
&
value
;
fgsregistrationresult
->
registrationresult
=
*
buffer
&
0x7
;
fgsregistrationresult
->
smsallowed
=
*
buffer
&
0x8
;
decoded
=
decoded
+
2
;
return
decoded
;
}
uint16_t
encode_fgs_registration_result
(
FGSRegistrationResult
*
fgsregistrationresult
)
{
uint16_t
bufferReturn
;
uint16_t
*
buffer
=
&
bufferReturn
;
uint8_t
encoded
=
0
;
*
(
buffer
+
encoded
)
=
0x00
|
(
fgsregistrationresult
->
smsallowed
&
0x8
)
|
(
fgsregistrationresult
->
registrationresult
&
0x7
);
encoded
=
encoded
+
2
;
return
bufferReturn
;
}
openair3/NAS/COMMON/IES/FGSRegistrationResult.h
0 → 100644
View file @
65d86435
/*! \file FGSRegistrationResult.h
\brief 5GS Registration result for registration request 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 "OctetString.h"
#ifndef FGS_REGISTRATION_RESULT_H_
#define FGS_REGISTRATION_RESULT_H_
#define FGS_REGISTRATION_RESULT_3GPP 0b001
#define FGS_REGISTRATION_RESULT_NON_3GPP 0b010
#define FGS_REGISTRATION_RESULT_3GPP_AND_NON_3GPP 0b011
typedef
struct
{
uint8_t
iei
;
uint8_t
resultlength
;
uint8_t
spare
:
4
;
uint8_t
smsallowed
:
1
;
uint8_t
registrationresult
:
3
;
}
FGSRegistrationResult
;
uint16_t
encode_fgs_registration_result
(
FGSRegistrationResult
*
fgsregistrationresult
);
int
decode_fgs_registration_result
(
FGSRegistrationResult
*
fgsregistrationresult
,
uint8_t
iei
,
uint16_t
value
,
uint32_t
len
);
#endif
/* FGS REGISTRATION RESULT_H_*/
openair3/NAS/COMMON/IES/SORTransparentContainer.c
0 → 100644
View file @
65d86435
/*
* 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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "SORTransparentContainer.h"
#include "nas_log.h"
//#define NAS_DEBUG 1
int
decode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
int
decode_result
;
uint16_t
ielen
;
LOG_FUNC_IN
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
DECODE_LENGTH_U16
(
buffer
+
decoded
,
ielen
,
decoded
);
CHECK_LENGTH_DECODER
(
len
-
decoded
,
ielen
);
if
((
decode_result
=
decode_octet_string
(
&
sortransparentcontainer
->
sortransparentcontainercontents
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
{
LOG_FUNC_RETURN
(
decode_result
);
}
else
{
decoded
+=
decode_result
;
}
#if defined (NAS_DEBUG)
dump_sor_transparent_container_xml
(
sortransparentcontainer
,
iei
);
#endif
LOG_FUNC_RETURN
(
decoded
);
}
int
encode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint8_t
*
lenPtr
;
uint32_t
encoded
=
0
;
int32_t
encode_result
;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH
,
len
);
#if defined (NAS_DEBUG)
dump_sor_transparent_container_xml
(
sortransparentcontainer
,
iei
);
#endif
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
lenPtr
=
(
buffer
+
encoded
);
//encoded += 2;
//if ((encode_result = encode_octet_string(&sortransparentcontainer->sortransparentcontainercontents, buffer + sizeof(uint16_t), len - sizeof(uint16_t))) < 0)
if
((
encode_result
=
encode_octet_string
(
&
sortransparentcontainer
->
sortransparentcontainercontents
,
lenPtr
+
sizeof
(
uint16_t
),
len
-
sizeof
(
uint16_t
)))
<
0
)
return
encode_result
;
else
encoded
+=
encode_result
;
ENCODE_U16
(
lenPtr
,
encode_result
,
encoded
);
return
encoded
;
}
void
dump_sor_transparent_container_xml
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
)
{
printf
(
"<SOR Transparent Container>
\n
"
);
if
(
iei
>
0
)
/* Don't display IEI if = 0 */
printf
(
" <IEI>0x%X</IEI>
\n
"
,
iei
);
printf
(
"%s"
,
dump_octet_string_xml
(
&
sortransparentcontainer
->
sortransparentcontainercontents
));
printf
(
"</SOR Transparent Container>
\n
"
);
}
openair3/NAS/COMMON/IES/SORTransparentContainer.h
0 → 100644
View file @
65d86435
/*
* 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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "OctetString.h"
#ifndef SOR_TRANSPARENT_CONTAINER_H_
#define SOR_TRANSPARENT_CONTAINER_H_
#define SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH 2 // [length]+[length]
#define SOR_TRANSPARENT_CONTAINER_MAXIMUM_LENGTH 65538 // [IEI]+[length]+[length]+[ESM msg]
typedef
struct
SORTransparentContainer_tag
{
OctetString
sortransparentcontainercontents
;
}
SORTransparentContainer
;
int
encode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_sor_transparent_container
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
void
dump_sor_transparent_container_xml
(
SORTransparentContainer
*
sortransparentcontainer
,
uint8_t
iei
);
#endif
/* ESM MESSAGE CONTAINER_H_ */
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
65d86435
This diff is collapsed.
Click to expand it.
openair3/NAS/NR_UE/nr_nas_msg_sim.h
View file @
65d86435
...
...
@@ -33,13 +33,52 @@
#define __NR_NAS_MSG_SIM_H__
#include "RegistrationRequest.h"
#include "FGSIdentityResponse.h"
#include "FGSAuthenticationResponse.h"
#include "FGSNASSecurityModeComplete.h"
#include "RegistrationComplete.h"
#include "as_message.h"
#include "FGSUplinkNasTransport.h"
#define PLAIN_5GS_MSG 0b0000
#define INTEGRITY_PROTECTED 0b0001
#define INTEGRITY_PROTECTED_AND_CIPHERED 0b0010
#define INTEGRITY_PROTECTED_WITH_NEW_SECU_CTX 0b0011 // only for SECURITY MODE COMMAND
#define INTEGRITY_PROTECTED_AND_CIPHERED_WITH_NEW_SECU_CTX 0b0100 // only for SECURITY MODE COMPLETE
#define REGISTRATION_REQUEST 0b01000001
/* 65 = 0x41 */
#define REGISTRATION_ACCEPT 0b01000010
/* 66 = 0x42 */
#define REGISTRATION_COMPLETE 0b01000011
/* 67 = 0x43 */
#define REGISTRATION_REJECT 0b01000100
/* 68 = 0x44 */
#define DEREGISTRATION_REQUEST_UE_ORIGINATING 0b01000101
/* 69 = 0x45 */
#define DEREGISTRATION_ACCEPT_UE_ORIGINATING 0b01000110
/* 70 = 0x46 */
#define DEREGISTRATION_REQUEST_UE_TERMINATED 0b01000111
/* 71 = 0x47 */
#define DEREGISTRATION_ACCEPT_UE_TERMINATED 0b01001000
/* 72 = 0x48 */
#define FIVEGMM_SERVICE_REQUEST 0b01001100
/* 76 = 0x4c */
#define FIVEGMM_SERVICE_REJECT 0b01001101
/* 77 = 0x4d */
#define FIVEGMM_SERVICE_ACCEPT 0b01001110
/* 78 = 0x4e */
#define CONFIGURATION_UPDATE_COMMAND 0b01010100
/* 84 = 0x54 */
#define CONFIGURATION_UPDATE_COMPLETE 0b01010101
/* 85 = 0x55 */
#define FGS_AUTHENTICATION_REQUEST 0b01010110
/* 86 = 0x56 */
#define FGS_AUTHENTICATION_RESPONSE 0b01010111
/* 87 = 0x57 */
#define AUTHENTICATION_REJECT 0b01011000
/* 88 = 0x58 */
#define AUTHENTICATION_FAILURE 0b01011001
/* 89 = 0x59 */
#define AUTHENTICATION_RESULT 0b01011010
/* 90 = 0x5a */
#define FGS_IDENTITY_REQUEST 0b01011011
/* 91 = 0x5b */
#define FGS_IDENTITY_RESPONSE 0b01011100
/* 92 = 0x5c */
#define FGS_SECURITY_MODE_COMMAND 0b01011101
/* 93 = 0x5d */
#define FGS_SECURITY_MODE_COMPLETE 0b01011110
/* 94 = 0x5e */
#define FIVEGMM_SECURITY_MODE_REJECT 0b01011111
/* 95 = 0x5f */
#define FIVEGMM_STATUS 0b01100100
/* 100 = 0x64 */
#define NOTIFICATION 0b01100101
/* 101 = 0x65 */
#define NOTIFICATION_RESPONSE 0b01100110
/* 102 = 0x66 */
#define FGS_UPLINK_NAS_TRANSPORT 0b01100111
/* 103= 0x67 */
#define DL_NAS_TRANSPORT 0b01101000
/* 104 = 0x68 */
// message type for 5GS session management
#define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001
/* 193= 0xc1 */
#define INITIAL_REGISTRATION 0b001
...
...
@@ -69,6 +108,11 @@ typedef struct {
typedef
union
{
mm_msg_header_t
header
;
registration_request_msg
registration_request
;
fgs_identiy_response_msg
fgs_identity_response
;
fgs_authentication_response_msg
fgs_auth_response
;
fgs_security_mode_complete_msg
fgs_security_mode_complete
;
registration_complete_msg
registration_complete
;
fgs_uplink_nas_transport_msg
uplink_nas_transport
;
}
MM_msg
;
...
...
@@ -90,5 +134,13 @@ typedef union {
}
fgs_nas_message_t
;
void
generateRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
);
void
generateIdentityResponse
(
as_nas_info_t
*
initialNasMsg
,
uint8_t
identitytype
);
void
generateAuthenticationResp
(
as_nas_info_t
*
initialNasMsg
,
uint8_t
*
buf
);
void
generateSecurityModeComplete
(
as_nas_info_t
*
initialNasMsg
);
void
generateRegistrationComplete
(
as_nas_info_t
*
initialNasMsg
,
SORTransparentContainer
*
sortransparentcontainer
);
void
generatePduSessionEstablishRequest
(
as_nas_info_t
*
initialNasMsg
);
#endif
/* __NR_NAS_MSG_SIM_H__*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment