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
63795a6c
Commit
63795a6c
authored
Oct 30, 2020
by
heshanyun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement identityresponse
parent
9fddd09d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
354 additions
and
24 deletions
+354
-24
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+2
-0
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+28
-8
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/IES/FGSMobileIdentity.c
openair3/NAS/COMMON/IES/FGSMobileIdentity.c
+42
-0
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
+1
-0
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+107
-16
openair3/NAS/NR_UE/nr_nas_msg_sim.h
openair3/NAS/NR_UE/nr_nas_msg_sim.h
+15
-0
No files found.
cmake_targets/CMakeLists.txt
View file @
63795a6c
...
@@ -2455,6 +2455,8 @@ if(ITTI_SIM)
...
@@ -2455,6 +2455,8 @@ if(ITTI_SIM)
set
(
libnrnas_emm_msg_OBJS
set
(
libnrnas_emm_msg_OBJS
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationRequest.c
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationRequest.c
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationAccept.c
${
NAS_SRC
}
COMMON/EMM/MSG/RegistrationAccept.c
${
NAS_SRC
}
COMMON/EMM/MSG/FGSIdentityResponse.c
${
NAS_SRC
}
COMMON/EMM/MSG/FGSAuthenticationResponse.c
)
)
set
(
libnrnas_ies_OBJS
set
(
libnrnas_ies_OBJS
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
63795a6c
...
@@ -2349,14 +2349,34 @@ nr_rrc_ue_decode_dcch(
...
@@ -2349,14 +2349,34 @@ nr_rrc_ue_decode_dcch(
#ifdef ITTI_SIM
#ifdef 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
,
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
);
ctxt_pP
->
module_id
,
pdu_length
,
pdu_buffer
);
//nas_proc_dl_transfer_ind (user, pdu_buffer, pdu_length);
as_nas_info_t
initialNasMsg
;
/* MessageDef *message_p;
memset
(
&
initialNasMsg
,
0
,
sizeof
(
as_nas_info_t
));
message_p = itti_alloc_new_message(TASK_RRC_NRUE, NAS_UPLINK_DATA_REQ);
if
((
pdu_buffer
+
2
)
==
NULL
){
NAS_UPLINK_DATA_REQ(message_p).UEid = ctxt_pP->module_id;
LOG_W
(
NR_RRC
,
"[UE] Received invalid downlink message
\n
"
);
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = pdu_buffer;
return
0
;
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = pdu_length;
}
itti_send_msg_to_task(TASK_RRC_NRUE, ctxt_pP->instance, message_p);
uint8_t
msg_type
=
*
(
pdu_buffer
+
2
);
LOG_I(NR_RRC, " Send NAS_UPLINK_DATA_REQ message\n");*/
switch
(
msg_type
){
case
FGS_IDENTITY_REQUEST
:
generateIdentityResponse
(
&
initialNasMsg
,
*
(
pdu_buffer
+
3
));
break
;
// case FGS_AUTHENTICATION_REQUEST:
// generateAuthenticationResp(&initialNasMsg);
// break;
default:
LOG_W
(
NR_RRC
,
"unknow message type %d
\n
"
,
msg_type
);
break
;
}
if
(
initialNasMsg
.
length
>
0
){
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_RRC_NRUE
,
NAS_UPLINK_DATA_REQ
);
NAS_UPLINK_DATA_REQ
(
message_p
).
UEid
=
ctxt_pP
->
module_id
;
NAS_UPLINK_DATA_REQ
(
message_p
).
nasMsg
.
data
=
(
uint8_t
*
)
initialNasMsg
.
data
;
NAS_UPLINK_DATA_REQ
(
message_p
).
nasMsg
.
length
=
initialNasMsg
.
length
;
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
ctxt_pP
->
instance
,
message_p
);
LOG_I
(
NR_RRC
,
" Send NAS_UPLINK_DATA_REQ message
\n
"
);
}
#else
#else
MessageDef
*
msg_p
;
MessageDef
*
msg_p
;
msg_p
=
itti_alloc_new_message
(
TASK_RRC_UE
,
NAS_DOWNLINK_DATA_IND
);
msg_p
=
itti_alloc_new_message
(
TASK_RRC_UE
,
NAS_DOWNLINK_DATA_IND
);
...
...
openair3/NAS/COMMON/EMM/MSG/FGSAuthenticationResponse.c
0 → 100644
View file @
63795a6c
/*! \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 @
63795a6c
/*! \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 @
63795a6c
/*! \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 @
63795a6c
/*! \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/IES/FGSMobileIdentity.c
View file @
63795a6c
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
static
int
decode_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
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_guti_5gs_mobile_identity
(
Guti5GSMobileIdentity_t
*
guti
,
uint8_t
*
buffer
);
static
int
encode_suci_5gs_mobile_identity
(
Suci5GSMobileIdentity_t
*
suci
,
uint8_t
*
buffer
);
int
decode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
int
decode_5gs_mobile_identity
(
FGSMobileIdentity
*
fgsmobileidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
{
...
@@ -66,6 +67,11 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
...
@@ -66,6 +67,11 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
buffer
+
encoded
);
buffer
+
encoded
);
}
}
if
(
fgsmobileidentity
->
suci
.
typeofidentity
==
FGS_MOBILE_IDENTITY_SUCI
)
{
encoded_rc
=
encode_suci_5gs_mobile_identity
(
&
fgsmobileidentity
->
suci
,
buffer
+
encoded
);
}
if
(
encoded_rc
<
0
)
{
if
(
encoded_rc
<
0
)
{
return
encoded_rc
;
return
encoded_rc
;
}
}
...
@@ -152,3 +158,39 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
...
@@ -152,3 +158,39 @@ static int encode_guti_5gs_mobile_identity(Guti5GSMobileIdentity_t *guti, uint8_
return
encoded
;
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
;
}
openair3/NAS/COMMON/IES/FGSMobileIdentity.h
View file @
63795a6c
...
@@ -43,6 +43,7 @@ typedef struct {
...
@@ -43,6 +43,7 @@ typedef struct {
uint8_t
spare6
:
1
;
uint8_t
spare6
:
1
;
uint8_t
protectionschemeId
:
4
;
uint8_t
protectionschemeId
:
4
;
uint8_t
homenetworkpki
;
uint8_t
homenetworkpki
;
uint32_t
schemeoutput
;
}
Suci5GSMobileIdentity_t
;
}
Suci5GSMobileIdentity_t
;
typedef
struct
{
typedef
struct
{
...
...
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
63795a6c
...
@@ -66,7 +66,12 @@ int mm_msg_encode(MM_msg *mm_msg, uint8_t *buffer, uint32_t len) {
...
@@ -66,7 +66,12 @@ int mm_msg_encode(MM_msg *mm_msg, uint8_t *buffer, uint32_t len) {
case
REGISTRATION_REQUEST
:
case
REGISTRATION_REQUEST
:
encode_result
=
encode_registration_request
(
&
mm_msg
->
registration_request
,
buffer
,
len
);
encode_result
=
encode_registration_request
(
&
mm_msg
->
registration_request
,
buffer
,
len
);
break
;
break
;
case
FGS_IDENTITY_RESPONSE
:
encode_result
=
encode_identiy_response
(
&
mm_msg
->
fgs_identity_response
,
buffer
,
len
);
break
;
case
FGS_AUTHENTICATION_RESPONSE
:
encode_result
=
encode_fgs_authentication_response
(
&
mm_msg
->
fgs_auth_response
,
buffer
,
len
);
break
;
default:
default:
LOG_TRACE
(
ERROR
,
"EMM-MSG - Unexpected message type: 0x%x"
,
LOG_TRACE
(
ERROR
,
"EMM-MSG - Unexpected message type: 0x%x"
,
mm_msg
->
header
.
message_type
);
mm_msg
->
header
.
message_type
);
...
@@ -87,7 +92,6 @@ int mm_msg_encode(MM_msg *mm_msg, uint8_t *buffer, uint32_t len) {
...
@@ -87,7 +92,6 @@ int mm_msg_encode(MM_msg *mm_msg, uint8_t *buffer, uint32_t len) {
}
}
void
generateRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
)
{
void
generateRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
)
{
int
size
=
sizeof
(
mm_msg_header_t
);
int
size
=
sizeof
(
mm_msg_header_t
);
fgs_nas_message_t
nas_msg
;
fgs_nas_message_t
nas_msg
;
...
@@ -109,21 +113,35 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
...
@@ -109,21 +113,35 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
mm_msg
->
registration_request
.
messagetype
=
REGISTRATION_REQUEST
;
mm_msg
->
registration_request
.
messagetype
=
REGISTRATION_REQUEST
;
size
+=
1
;
size
+=
1
;
mm_msg
->
registration_request
.
fgsregistrationtype
=
INITIAL_REGISTRATION
;
mm_msg
->
registration_request
.
fgsregistrationtype
=
INITIAL_REGISTRATION
;
mm_msg
->
registration_request
.
naskeysetidentifier
.
naskeysetidentifier
=
NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE
;
mm_msg
->
registration_request
.
naskeysetidentifier
.
naskeysetidentifier
=
1
;
size
+=
1
;
size
+=
1
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
typeofidentity
=
FGS_MOBILE_IDENTITY_5G_GUTI
;
if
(
0
){
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfregionid
=
0xca
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
typeofidentity
=
FGS_MOBILE_IDENTITY_5G_GUTI
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfpointer
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfregionid
=
0xca
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfsetid
=
1016
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfpointer
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
tmsi
=
10
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfsetid
=
1016
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mncdigit1
=
9
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
tmsi
=
10
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mncdigit2
=
3
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mncdigit1
=
9
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mncdigit3
=
0xf
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mncdigit2
=
3
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mccdigit1
=
2
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mncdigit3
=
0xf
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mccdigit2
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mccdigit1
=
2
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mccdigit3
=
8
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mccdigit2
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
mccdigit3
=
8
;
size
+=
13
;
size
+=
13
;
}
else
{
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
typeofidentity
=
FGS_MOBILE_IDENTITY_SUCI
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mncdigit1
=
9
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mncdigit2
=
3
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mncdigit3
=
0xf
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mccdigit1
=
2
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mccdigit2
=
0
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
mccdigit3
=
8
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
suci
.
schemeoutput
=
0x4778
;
size
+=
14
;
}
mm_msg
->
registration_request
.
presencemask
|=
REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT
;
mm_msg
->
registration_request
.
presencemask
|=
REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT
;
mm_msg
->
registration_request
.
fgmmcapability
.
iei
=
REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI
;
mm_msg
->
registration_request
.
fgmmcapability
.
iei
=
REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI
;
...
@@ -147,3 +165,76 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
...
@@ -147,3 +165,76 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
}
}
void
generateIdentityResponse
(
as_nas_info_t
*
initialNasMsg
,
uint8_t
identitytype
)
{
int
size
=
sizeof
(
mm_msg_header_t
);
fgs_nas_message_t
nas_msg
;
memset
(
&
nas_msg
,
0
,
sizeof
(
fgs_nas_message_t
));
MM_msg
*
mm_msg
;
mm_msg
=
&
nas_msg
.
plain
.
mm_msg
;
// set header
mm_msg
->
header
.
ex_protocol_discriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
mm_msg
->
header
.
security_header_type
=
PLAIN_5GS_MSG
;
mm_msg
->
header
.
message_type
=
FGS_IDENTITY_RESPONSE
;
// set identity response
mm_msg
->
fgs_identity_response
.
protocoldiscriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
size
+=
1
;
mm_msg
->
fgs_identity_response
.
securityheadertype
=
PLAIN_5GS_MSG
;
size
+=
1
;
mm_msg
->
fgs_identity_response
.
messagetype
=
FGS_IDENTITY_RESPONSE
;
size
+=
1
;
if
(
identitytype
==
FGS_MOBILE_IDENTITY_SUCI
){
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
typeofidentity
=
FGS_MOBILE_IDENTITY_SUCI
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
mncdigit1
=
9
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
mncdigit2
=
3
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
mncdigit3
=
0xf
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
mccdigit1
=
2
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
mccdigit2
=
0
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
mccdigit3
=
8
;
mm_msg
->
fgs_identity_response
.
fgsmobileidentity
.
suci
.
schemeoutput
=
0x4778
;
size
+=
14
;
}
// encode the message
initialNasMsg
->
data
=
(
Byte_t
*
)
malloc
(
size
*
sizeof
(
Byte_t
));
initialNasMsg
->
length
=
mm_msg_encode
(
mm_msg
,
(
uint8_t
*
)(
initialNasMsg
->
data
),
size
);
}
uint8_t
tempbuf
[
16
]
=
{
0x0e
,
0xa9
,
0xf1
,
0x39
,
0xb9
,
0x8c
,
0xdb
,
0x20
,
0x81
,
0x9f
,
0x98
,
0x43
,
0xca
,
0x03
,
0x98
,
0x36
};
OctetString
res
=
{
0x10
,
tempbuf
};
void
generateAuthenticationResp
(
as_nas_info_t
*
initialNasMsg
){
int
size
=
sizeof
(
mm_msg_header_t
);
fgs_nas_message_t
nas_msg
;
memset
(
&
nas_msg
,
0
,
sizeof
(
fgs_nas_message_t
));
MM_msg
*
mm_msg
;
mm_msg
=
&
nas_msg
.
plain
.
mm_msg
;
// set header
mm_msg
->
header
.
ex_protocol_discriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
mm_msg
->
header
.
security_header_type
=
PLAIN_5GS_MSG
;
mm_msg
->
header
.
message_type
=
FGS_AUTHENTICATION_RESPONSE
;
// set authentication response
mm_msg
->
fgs_identity_response
.
protocoldiscriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
size
+=
1
;
mm_msg
->
fgs_identity_response
.
securityheadertype
=
PLAIN_5GS_MSG
;
size
+=
1
;
mm_msg
->
fgs_identity_response
.
messagetype
=
FGS_AUTHENTICATION_RESPONSE
;
size
+=
1
;
//set response parameter
mm_msg
->
fgs_auth_response
.
authenticationresponseparameter
.
res
=
res
;
size
+=
18
;
// encode the message
initialNasMsg
->
data
=
(
Byte_t
*
)
malloc
(
size
*
sizeof
(
Byte_t
));
initialNasMsg
->
length
=
mm_msg_encode
(
mm_msg
,
(
uint8_t
*
)(
initialNasMsg
->
data
),
size
);
}
openair3/NAS/NR_UE/nr_nas_msg_sim.h
View file @
63795a6c
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
#define __NR_NAS_MSG_SIM_H__
#define __NR_NAS_MSG_SIM_H__
#include "RegistrationRequest.h"
#include "RegistrationRequest.h"
#include "FGSIdentityResponse.h"
#include "FGSAuthenticationResponse.h"
#include "as_message.h"
#include "as_message.h"
...
@@ -19,6 +21,13 @@
...
@@ -19,6 +21,13 @@
#define INTEGRITY_PROTECTED 0b0001
#define INTEGRITY_PROTECTED 0b0001
#define REGISTRATION_REQUEST 0b01000001
/* 65 = 0x41 */
#define REGISTRATION_REQUEST 0b01000001
/* 65 = 0x41 */
#define FGS_AUTHENTICATION_REQUEST 0b01010110
/* 86 = 0x56 */
#define FGS_AUTHENTICATION_RESPONSE 0b01010111
/* 87 = 0x57 */
#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 INITIAL_REGISTRATION 0b001
#define INITIAL_REGISTRATION 0b001
...
@@ -48,6 +57,8 @@ typedef struct {
...
@@ -48,6 +57,8 @@ typedef struct {
typedef
union
{
typedef
union
{
mm_msg_header_t
header
;
mm_msg_header_t
header
;
registration_request_msg
registration_request
;
registration_request_msg
registration_request
;
fgs_identiy_response_msg
fgs_identity_response
;
fgs_authentication_response_msg
fgs_auth_response
;
}
MM_msg
;
}
MM_msg
;
...
@@ -69,5 +80,9 @@ typedef union {
...
@@ -69,5 +80,9 @@ typedef union {
}
fgs_nas_message_t
;
}
fgs_nas_message_t
;
void
generateRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
);
void
generateRegistrationRequest
(
as_nas_info_t
*
initialNasMsg
);
void
generateIdentityResponse
(
as_nas_info_t
*
initialNasMsg
,
uint8_t
identitytype
);
void
generateAuthenticationResp
(
as_nas_info_t
*
initialNasMsg
);
#endif
/* __NR_NAS_MSG_SIM_H__*/
#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