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
ZhouShuya
OpenXG-RAN
Commits
4feecfa5
Commit
4feecfa5
authored
Dec 01, 2020
by
Chenyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nasUE is ok
parent
5ddc8a43
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
535 additions
and
15 deletions
+535
-15
cmake_targets/CMakeLists.txt
cmake_targets/CMakeLists.txt
+2
-1
common/utils/ocp_itti/intertask_interface.h
common/utils/ocp_itti/intertask_interface.h
+1
-0
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+20
-4
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+26
-5
openair3/GTPV1-U/gtpv1u_gNB.c
openair3/GTPV1-U/gtpv1u_gNB.c
+1
-1
openair3/NAS/NR_UE/nas_nrue_task.c
openair3/NAS/NR_UE/nas_nrue_task.c
+345
-0
openair3/NAS/NR_UE/nas_nrue_task.h
openair3/NAS/NR_UE/nas_nrue_task.h
+43
-0
openair3/NAS/NR_UE/nr_nas_itti_messaging.c
openair3/NAS/NR_UE/nr_nas_itti_messaging.c
+56
-0
openair3/NAS/NR_UE/nr_nas_itti_messaging.h
openair3/NAS/NR_UE/nr_nas_itti_messaging.h
+37
-0
openair3/NAS/NR_UE/nr_nas_msg_sim.c
openair3/NAS/NR_UE/nr_nas_msg_sim.c
+4
-4
No files found.
cmake_targets/CMakeLists.txt
View file @
4feecfa5
...
...
@@ -2612,6 +2612,7 @@ endif()
${
NAS_SRC
}
UE/nas_parser.c
${
NAS_SRC
}
UE/nas_proc.c
${
NAS_SRC
}
UE/nas_user.c
${
NAS_SRC
}
NR_UE/nr_nas_itti_messaging.c
${
NAS_SRC
}
NR_UE/nr_nas_msg_sim.c
${
libnas_api_OBJS
}
${
libnas_ue_api_OBJS
}
...
...
@@ -3106,7 +3107,7 @@ add_executable(nr-uesoftmodem
${
OPENAIR2_DIR
}
/LAYER2/NR_MAC_COMMON/nr_mac_common.c
${
OPENAIR2_DIR
}
/RRC/NAS/rb_config.c
${
OPENAIR1_DIR
}
/SIMULATION/ETH_TRANSPORT/netlink_init.c
${
OPENAIR3_DIR
}
/NAS/
UE/nas_
ue_task.c
${
OPENAIR3_DIR
}
/NAS/
NR_UE/nas_nr
ue_task.c
${
OPENAIR_DIR
}
/common/utils/utils.c
${
OPENAIR_DIR
}
/common/utils/system.c
${
OPENAIR_DIR
}
/common/utils/nr/nr_common.c
...
...
common/utils/ocp_itti/intertask_interface.h
View file @
4feecfa5
...
...
@@ -338,6 +338,7 @@ void * rrc_enb_process_msg(void*);
TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
...
...
executables/nr-uesoftmodem.c
View file @
4feecfa5
...
...
@@ -84,6 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include <executables/nr-uesoftmodem.h>
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
#include "nas_nrue_task.h"
// Raphael : missing
pthread_cond_t
nfapi_sync_cond
;
...
...
@@ -234,6 +235,10 @@ int create_tasks_nrue(uint32_t ue_nb) {
LOG_E
(
NR_RRC
,
"Create task for RRC UE failed
\n
"
);
return
-
1
;
}
if
(
itti_create_task
(
TASK_NAS_NRUE
,
nas_nrue_task
,
NULL
)
<
0
)
{
LOG_E
(
NR_RRC
,
"Create task for NAS UE failed
\n
"
);
return
-
1
;
}
}
itti_wait_ready
(
0
);
...
...
@@ -791,14 +796,25 @@ int main( int argc, char **argv ) {
// wait for end of program
printf
(
"TYPE <CTRL-C> TO TERMINATE
\n
"
);
protocol_ctxt_t
ctxt_pP
=
{
0
};
ctxt_pP
.
enb_flag
=
ENB_FLAG_NO
;
ctxt_pP
.
rnti
=
0x1234
;
rrc_ue_generate_RRCSetupRequest
(
&
ctxt_pP
,
0
);
//
protocol_ctxt_t ctxt_pP = {0};
//
ctxt_pP.enb_flag = ENB_FLAG_NO;
//
ctxt_pP.rnti = 0x1234;
//
rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0);
if
(
create_tasks_nrue
(
1
)
<
0
)
{
printf
(
"cannot create ITTI tasks
\n
"
);
exit
(
-
1
);
// need a softer mode
}
MessageDef
*
msg_p
;
msg_p
=
itti_alloc_new_message
(
TASK_RRC_UE
,
NAS_CELL_SELECTION_CNF
);
NAS_CELL_SELECTION_CNF
(
msg_p
).
errCode
=
AS_SUCCESS
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
cellID
=
0
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
tac
=
0
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
rat
=
0xFF
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
rsrq
=
0
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
rsrp
=
0
;
itti_send_msg_to_task
(
TASK_NAS_NRUE
,
0
,
msg_p
);
while
(
true
)
sleep
(
3600
);
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
4feecfa5
...
...
@@ -1169,7 +1169,7 @@ int nr_decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_inde
NAS_CELL_SELECTION_CNF
(
msg_p
).
rat
=
0xFF
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
rsrq
=
rsrq
;
NAS_CELL_SELECTION_CNF
(
msg_p
).
rsrp
=
rsrp
;
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
itti_send_msg_to_task
(
TASK_NAS_
NR
UE
,
ctxt_pP
->
instance
,
msg_p
);
cell_valid
=
1
;
NR_UE_rrc_inst
[
ctxt_pP
->
module_id
].
selected_plmn_identity
=
plmn
+
1
;
break
;
...
...
@@ -2235,7 +2235,7 @@ rrc_ue_process_rrcReconfiguration(
NAS_CONN_ESTABLI_CNF
(
msg_p
).
errCode
=
AS_SUCCESS
;
NAS_CONN_ESTABLI_CNF
(
msg_p
).
nasMsg
.
length
=
pdu_length
;
NAS_CONN_ESTABLI_CNF
(
msg_p
).
nasMsg
.
data
=
pdu_buffer
;
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
itti_send_msg_to_task
(
TASK_NAS_
NR
UE
,
ctxt_pP
->
instance
,
msg_p
);
}
free
(
ie
->
nonCriticalExtension
->
dedicatedNAS_MessageList
);
...
...
@@ -2381,7 +2381,7 @@ nr_rrc_ue_decode_dcch(
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency
;
}
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
itti_send_msg_to_task
(
TASK_NAS_
NR
UE
,
ctxt_pP
->
instance
,
msg_p
);
break
;
case
NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry
:
LOG_I
(
NR_RRC
,
"[UE %d] Received Capability Enquiry (gNB %d)
\n
"
,
...
...
@@ -2406,7 +2406,7 @@ nr_rrc_ue_decode_dcch(
uint8_t
*
pdu_buffer
;
pdu_length
=
dedicatedNAS_Message
->
size
;
pdu_buffer
=
dedicatedNAS_Message
->
buf
;
#if
1
//def ITTI_SIM
#if
0
//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;
...
...
@@ -2453,7 +2453,7 @@ nr_rrc_ue_decode_dcch(
NAS_DOWNLINK_DATA_IND
(
msg_p
).
UEid
=
ctxt_pP
->
module_id
;
// TODO set the UEid to something else ?
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
length
=
pdu_length
;
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
data
=
pdu_buffer
;
itti_send_msg_to_task
(
TASK_NAS_UE
,
ctxt_pP
->
instance
,
msg_p
);
itti_send_msg_to_task
(
TASK_NAS_
NR
UE
,
ctxt_pP
->
instance
,
msg_p
);
#endif
}
}
...
...
@@ -2560,6 +2560,27 @@ void *rrc_nrue_task( void *args_p ) {
NR_RRC_DCCH_DATA_IND
(
msg_p
).
gNB_index
);
break
;
case
NAS_CONN_ESTABLI_REQ
:
LOG_I
(
RRC
,
"[UE %d] Received %s: cause %d, type %d, s_tmsi (mme code %"
PRIu8
", m-tmsi %"
PRIu32
"), plmnID (%d%d%d.%d%d%d)
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_CONN_ESTABLI_REQ
(
msg_p
).
cause
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
type
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
s_tmsi
.
MMEcode
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
s_tmsi
.
m_tmsi
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
plmnID
.
MCCdigit1
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
plmnID
.
MCCdigit2
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
plmnID
.
MCCdigit3
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
plmnID
.
MNCdigit1
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
plmnID
.
MNCdigit2
,
NAS_CONN_ESTABLI_REQ
(
msg_p
).
plmnID
.
MNCdigit3
);
PROTOCOL_CTXT_SET_BY_MODULE_ID
(
&
ctxt
,
ue_mod_id
,
ENB_FLAG_NO
,
NOT_A_RNTI
,
0
,
0
,
0
);
NR_UE_rrc_inst
[
ue_mod_id
].
initialNasMsg
=
NAS_CONN_ESTABLI_REQ
(
msg_p
).
initialNasMsg
;
ctxt
.
enb_flag
=
ENB_FLAG_NO
;
ctxt
.
rnti
=
0x1234
;
rrc_ue_generate_RRCSetupRequest
(
&
ctxt
,
0
);
// rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING);
break
;
case
NAS_UPLINK_DATA_REQ
:
{
uint32_t
length
;
uint8_t
*
buffer
;
...
...
openair3/GTPV1-U/gtpv1u_gNB.c
View file @
4feecfa5
...
...
@@ -190,7 +190,7 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req(
&
ctxt
,
SRB_FLAG_NO
,
//(gtpv1u_teid_data_p->eps_bearer_id) ? gtpv1u_teid_data_p->eps_bearer_id - 4: 5-4,
1
,
4
,
0
,
// mui
SDU_CONFIRM_NO
,
// confirm
buffer_len
,
...
...
openair3/NAS/NR_UE/nas_nrue_task.c
0 → 100644
View file @
4feecfa5
/*
* 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
*/
#define NAS_BUILT_IN_UE 1 //QUES: #undef
// #define __LITTLE_ENDIAN_BITFIELD 1
#include "utils.h"
# include "assertions.h"
# include "intertask_interface.h"
# include "nas_nrue_task.h"
# include "common/utils/LOG/log.h"
# include "user_defs.h"
# include "user_api.h"
# include "nas_parser.h"
# include "nas_proc.h"
# include "msc.h"
# include "memory.h"
#include "nas_user.h"
// FIXME make command line option for NAS_UE_AUTOSTART
# define NAS_UE_AUTOSTART 1
// FIXME review these externs
extern
unsigned
char
NB_eNB_INST
;
extern
uint16_t
NB_UE_INST
;
static
int
_nas_mm_msg_decode_header
(
mm_msg_header_t
*
header
,
const
uint8_t
*
buffer
,
uint32_t
len
);
void
*
nas_nrue_task
(
void
*
args_p
)
{
int
nb_events
;
struct
epoll_event
*
events
;
MessageDef
*
msg_p
;
instance_t
instance
;
unsigned
int
Mod_id
;
int
result
;
nas_user_container_t
*
users
=
args_p
;
itti_mark_task_ready
(
TASK_NAS_NRUE
);
MSC_START_USE
();
while
(
1
)
{
// Wait for a message or an event
itti_receive_msg
(
TASK_NAS_NRUE
,
&
msg_p
);
if
(
msg_p
!=
NULL
)
{
instance
=
ITTI_MSG_INSTANCE
(
msg_p
);
Mod_id
=
instance
-
NB_eNB_INST
;
if
(
instance
==
INSTANCE_DEFAULT
)
{
printf
(
"%s:%d: FATAL: instance is INSTANCE_DEFAULT, should not happen.
\n
"
,
__FILE__
,
__LINE__
);
exit_fun
(
"exit...
\n
"
);
}
switch
(
ITTI_MSG_ID
(
msg_p
))
{
case
INITIALIZE_MESSAGE
:
LOG_I
(
NAS
,
"[UE %d] Received %s
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
case
TERMINATE_MESSAGE
:
itti_exit_task
();
break
;
case
MESSAGE_TEST
:
LOG_I
(
NAS
,
"[UE %d] Received %s
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
case
NAS_CELL_SELECTION_CNF
:
//CUC:NAS_CELL_SELECTION_CNF √
LOG_I
(
NAS
,
"[UE %d] Received %s: errCode %u, cellID %u, tac %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_CELL_SELECTION_CNF
(
msg_p
).
errCode
,
NAS_CELL_SELECTION_CNF
(
msg_p
).
cellID
,
NAS_CELL_SELECTION_CNF
(
msg_p
).
tac
);
as_stmsi_t
s_tmsi
=
{
0
,
0
};
as_nas_info_t
nas_info
;
plmn_t
plmnID
=
{
0
,
0
,
0
,
0
};
generateRegistrationRequest
(
&
nas_info
);
nr_nas_itti_nas_establish_req
(
0
,
AS_TYPE_ORIGINATING_SIGNAL
,
s_tmsi
,
plmnID
,
nas_info
.
data
,
nas_info
.
length
,
0
);
break
;
case
NAS_CELL_SELECTION_IND
:
LOG_I
(
NAS
,
"[UE %d] Received %s: cellID %u, tac %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_CELL_SELECTION_IND
(
msg_p
).
cellID
,
NAS_CELL_SELECTION_IND
(
msg_p
).
tac
);
/* TODO not processed by NAS currently */
break
;
case
NAS_PAGING_IND
:
LOG_I
(
NAS
,
"[UE %d] Received %s: cause %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_PAGING_IND
(
msg_p
).
cause
);
/* TODO not processed by NAS currently */
break
;
case
NAS_CONN_ESTABLI_CNF
:
LOG_I
(
NAS
,
"[UE %d] Received %s: errCode %u, length %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_CONN_ESTABLI_CNF
(
msg_p
).
errCode
,
NAS_CONN_ESTABLI_CNF
(
msg_p
).
nasMsg
.
length
);
break
;
case
NAS_CONN_RELEASE_IND
:
LOG_I
(
NAS
,
"[UE %d] Received %s: cause %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_CONN_RELEASE_IND
(
msg_p
).
cause
);
break
;
case
NAS_UPLINK_DATA_CNF
:
LOG_I
(
NAS
,
"[UE %d] Received %s: UEid %u, errCode %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_UPLINK_DATA_CNF
(
msg_p
).
UEid
,
NAS_UPLINK_DATA_CNF
(
msg_p
).
errCode
);
break
;
case
NAS_DOWNLINK_DATA_IND
:
//CUC:NAS_DOWNLINK_DATA_IND √
LOG_I
(
NAS
,
"[UE %d] Received %s: UEid %u, length %u
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_DOWNLINK_DATA_IND
(
msg_p
).
UEid
,
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
length
);
nr_nas_proc_dl_transfer_ind
(
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
data
,
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
length
);
//handle dl info NAS mesaages.
break
;
default:
LOG_E
(
NAS
,
"[UE %d] Received unexpected message %s
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
msg_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
msg_p
=
NULL
;
}
}
free
(
users
);
return
NULL
;
}
void
nr_nas_proc_dl_transfer_ind
(
Byte_t
*
data
,
uint32_t
len
)
{
as_nas_info_t
nas_info
;
MM_msg
msg
;
decodeNasMsg
(
&
msg
,
data
,
len
);
switch
(
msg
.
header
.
message_type
)
{
case
FGS_IDENTITY_REQUEST
:
{
generateIdentityResponse
(
&
nas_info
,
FGS_MOBILE_IDENTITY_SUCI
);
nr_nas_itti_ul_data_req
(
0
,
nas_info
.
data
,
nas_info
.
length
,
0
);
break
;
}
case
FGS_AUTHENTICATION_REQUEST
:
{
uint8_t
buf
=
0
;
generateAuthenticationResp
(
&
nas_info
,
&
buf
);
nr_nas_itti_ul_data_req
(
0
,
nas_info
.
data
,
nas_info
.
length
,
0
);
break
;
}
case
FGS_SECURITY_MODE_COMMAND
:
{
generateSecurityModeComplete
(
&
nas_info
);
nr_nas_itti_ul_data_req
(
0
,
nas_info
.
data
,
nas_info
.
length
,
0
);
break
;
}
case
REGISTRATION_ACCEPT
:
{
generateRegistrationComplete
(
&
nas_info
,
0
);
nr_nas_itti_ul_data_req
(
0
,
nas_info
.
data
,
nas_info
.
length
,
0
);
break
;
}
}
// //****************************** //CUC:test
// printf("decodeaaadecode:");
// for (int i = 0; i < len; i++)
// {
// printf("%02x ",*(data+i));
// }
// printf("decodeaaadecode \n ");
// printf("encodeaaaencode:");
// for (int i = 0; i < nas_info.length; i++)
// {
// printf("%02x ",*(nas_info.data+i));
// }
// printf("encodeaaaencode \n ");
// //******************************
}
#define CHAR_TO_UINT8(input) ((input & 0xf) + 9*(input>>6))
//function to convert string to byte array
int
string2ByteArray
(
char
*
input
,
uint8_t
*
output
)
{
int
loop
;
int
i
;
loop
=
0
;
i
=
0
;
while
(
input
[
loop
]
!=
'\0'
)
{
output
[
i
++
]
=
(
CHAR_TO_UINT8
(
input
[
loop
]))
<<
4
|
CHAR_TO_UINT8
(
input
[
loop
+
1
]);
loop
+=
2
;
}
return
i
;
}
void
tesths
(
void
)
//CUC:test
{
printf
(
"Authentication:
\n
"
);
char
Authenticationrequest
[]
=
"7e005601020000217d003b4a2e3bb80403de19020f57b16a2010583f0d352eb89001539b2cb2cbf1da5c"
;
uint32_t
len1
=
84
;
Byte_t
*
data1
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
*
len1
);
string2ByteArray
(
Authenticationrequest
,
data1
);
nr_nas_proc_dl_transfer_ind
(
data1
,
len1
);
printf
(
"Security mode:
\n
"
);
char
Securitymodecommand
[]
=
"7e005d0201028020e1360102"
;
uint32_t
len2
=
24
;
Byte_t
*
data2
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
*
len2
);
string2ByteArray
(
Securitymodecommand
,
data2
);
nr_nas_proc_dl_transfer_ind
(
data2
,
len2
);
printf
(
"Registration:
\n
"
);
char
Registrationrequest
[]
=
"7e0042010177000bf202f8398000410000000154070002f83900000115020101210200005e01be"
;
uint32_t
len3
=
94
;
Byte_t
*
data3
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
*
len3
);
string2ByteArray
(
Registrationrequest
,
data3
);
nr_nas_proc_dl_transfer_ind
(
data3
,
len3
);
printf
(
"Registration request:
\n
"
);
as_nas_info_t
nas_info
;
generateRegistrationRequest
(
&
nas_info
);
printf
(
"length:%02x
\n
"
,
nas_info
.
length
);
printf
(
"encodeaaaencode:"
);
for
(
int
i
=
0
;
i
<
nas_info
.
length
;
i
++
)
{
printf
(
"%02x "
,
*
(
nas_info
.
data
+
i
));
}
printf
(
"encodeaaaencode
\n
"
);
//******************************
}
int
decodeNasMsg
(
MM_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
header_result
;
int
decode_result
=
0
;
/* First decode the EMM message header */
header_result
=
_nas_mm_msg_decode_header
(
&
msg
->
header
,
buffer
,
len
);
if
(
header_result
<
0
)
{
LOG_TRACE
(
ERROR
,
"NR_UE - Failed to decode EMM message header "
"(%d)"
,
header_result
);
LOG_FUNC_RETURN
(
header_result
);
}
buffer
+=
header_result
;
len
-=
header_result
;
LOG_TRACE
(
INFO
,
"NR_UE - Message Type 0x%02x"
,
msg
->
header
.
message_type
);
switch
(
msg
->
header
.
message_type
)
{
case
FGS_IDENTITY_REQUEST
:
{
break
;
}
case
FGS_AUTHENTICATION_REQUEST
:
{
break
;
}
case
FGS_SECURITY_MODE_COMMAND
:
{
break
;
}
case
REGISTRATION_ACCEPT
:
{
break
;
}
default:
LOG_TRACE
(
ERROR
,
"NR_UE - Unexpected message type: 0x%x"
,
msg
->
header
.
message_type
);
decode_result
=
TLV_ENCODE_WRONG_MESSAGE_TYPE
;
break
;
}
LOG_FUNC_RETURN
(
header_result
+
decode_result
);
}
static
int
_nas_mm_msg_decode_header
(
mm_msg_header_t
*
header
,
const
uint8_t
*
buffer
,
uint32_t
len
)
{
//QUES: 静态函数在哪声明?
int
size
=
0
;
/* Check the buffer length */
if
(
len
<
sizeof
(
mm_msg_header_t
))
{
return
(
TLV_ENCODE_BUFFER_TOO_SHORT
);
}
/* Encode the extendedprotocol discriminator */
DECODE_U8
(
buffer
+
size
,
header
->
ex_protocol_discriminator
,
size
);
/* Encode the security header type */
DECODE_U8
(
buffer
+
size
,
header
->
security_header_type
,
size
);
/* Encode the message type */
if
(
header
->
security_header_type
==
0x00
)
{
DECODE_U8
(
buffer
+
size
,
header
->
message_type
,
size
);
}
if
(
header
->
security_header_type
==
0x03
)
{
size
+=
7
;
DECODE_U8
(
buffer
+
size
,
header
->
message_type
,
size
);
}
/* Check the protocol discriminator */
if
(
header
->
ex_protocol_discriminator
!=
FGS_MOBILITY_MANAGEMENT_MESSAGE
)
{
LOG_TRACE
(
ERROR
,
"ESM-MSG - Unexpected extened protocol discriminator: 0x%x"
,
header
->
ex_protocol_discriminator
);
return
(
TLV_ENCODE_PROTOCOL_NOT_SUPPORTED
);
}
return
(
size
);
}
openair3/NAS/NR_UE/nas_nrue_task.h
0 → 100644
View file @
4feecfa5
/*
* 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
*/
#ifndef NAS_NRUE_TASK_H_
#define NAS_NRUE_TASK_H_
#include "openairinterface5g_limits.h"
//CUC:add nas_nrue_task.h √
#include "platform_types.h"
#include "nr_nas_itti_messaging.h"
#include "nas_log.h"
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#include "nr_nas_msg_sim.h"
void
*
nas_nrue_task
(
void
*
args_p
);
void
nr_nas_proc_dl_transfer_ind
(
Byte_t
*
data
,
uint32_t
len
);
int
decodeNasMsg
(
MM_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
);
int
string2ByteArray
(
char
*
input
,
uint8_t
*
output
);
//CUC:test
void
tesths
(
void
);
#endif
/* NAS_TASK_H_ */
openair3/NAS/NR_UE/nr_nas_itti_messaging.c
0 → 100644
View file @
4feecfa5
/*
* 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 <string.h>
#include "intertask_interface.h"
#include "nr_nas_itti_messaging.h"
#include "msc.h"
int
nr_nas_itti_nas_establish_req
(
as_cause_t
cause
,
as_call_type_t
type
,
as_stmsi_t
s_tmsi
,
plmn_t
plmnID
,
Byte_t
*
data
,
uint32_t
length
,
int
user_id
)
{
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_NAS_NRUE
,
NAS_CONN_ESTABLI_REQ
);
NAS_CONN_ESTABLI_REQ
(
message_p
).
cause
=
cause
;
NAS_CONN_ESTABLI_REQ
(
message_p
).
type
=
type
;
NAS_CONN_ESTABLI_REQ
(
message_p
).
s_tmsi
=
s_tmsi
;
NAS_CONN_ESTABLI_REQ
(
message_p
).
plmnID
=
plmnID
;
NAS_CONN_ESTABLI_REQ
(
message_p
).
initialNasMsg
.
data
=
data
;
NAS_CONN_ESTABLI_REQ
(
message_p
).
initialNasMsg
.
length
=
length
;
MSC_LOG_TX_MESSAGE
(
MSC_NAS_UE
,
MSC_RRC_UE
,
NULL
,
0
,
"0 NAS_CONN_ESTABLI_REQ MME code %u m-TMSI %u PLMN %X%X%X.%X%X%X"
,
s_tmsi
.
MMEcode
,
s_tmsi
.
m_tmsi
,
plmnID
.
MCCdigit1
,
plmnID
.
MCCdigit2
,
plmnID
.
MCCdigit3
,
plmnID
.
MNCdigit1
,
plmnID
.
MNCdigit2
,
plmnID
.
MNCdigit3
);
return
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
user_id
,
message_p
);
}
int
nr_nas_itti_ul_data_req
(
const
uint32_t
ue_id
,
void
*
const
data
,
const
uint32_t
length
,
int
user_id
)
{
MessageDef
*
message_p
;
message_p
=
itti_alloc_new_message
(
TASK_NAS_NRUE
,
NAS_UPLINK_DATA_REQ
);
NAS_UPLINK_DATA_REQ
(
message_p
).
UEid
=
ue_id
;
NAS_UPLINK_DATA_REQ
(
message_p
).
nasMsg
.
data
=
data
;
NAS_UPLINK_DATA_REQ
(
message_p
).
nasMsg
.
length
=
length
;
return
itti_send_msg_to_task
(
TASK_RRC_NRUE
,
user_id
,
message_p
);
}
\ No newline at end of file
openair3/NAS/NR_UE/nr_nas_itti_messaging.h
0 → 100644
View file @
4feecfa5
/*
* 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
*/
#ifndef NR_NAS_ITTI_MESSAGING_H_
#define NR_NAS_ITTI_MESSAGING_H_
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include "assertions.h"
#include "intertask_interface.h"
#include "msc.h"
int
nr_nas_itti_nas_establish_req
(
as_cause_t
cause
,
as_call_type_t
type
,
as_stmsi_t
s_tmsi
,
plmn_t
plmnID
,
Byte_t
*
data_pP
,
uint32_t
lengthP
,
int
user_id
);
int
nr_nas_itti_ul_data_req
(
const
uint32_t
ue_idP
,
void
*
const
data_pP
,
const
uint32_t
lengthP
,
int
user_id
);
#endif
/* NAS_ITTI_MESSAGING_H_ */
openair3/NAS/NR_UE/nr_nas_msg_sim.c
View file @
4feecfa5
...
...
@@ -273,7 +273,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg) {
mm_msg
->
registration_request
.
fgsregistrationtype
=
INITIAL_REGISTRATION
;
mm_msg
->
registration_request
.
naskeysetidentifier
.
naskeysetidentifier
=
1
;
size
+=
1
;
if
(
1
){
if
(
0
){
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
typeofidentity
=
FGS_MOBILE_IDENTITY_5G_GUTI
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfregionid
=
0xca
;
mm_msg
->
registration_request
.
fgsmobileidentity
.
guti
.
amfpointer
=
0
;
...
...
@@ -441,11 +441,11 @@ void generateAuthenticationResp(as_nas_info_t *initialNasMsg, uint8_t *buf){
mm_msg
->
header
.
message_type
=
FGS_AUTHENTICATION_RESPONSE
;
// set authentication response
mm_msg
->
fgs_
identity
_response
.
protocoldiscriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
mm_msg
->
fgs_
auth
_response
.
protocoldiscriminator
=
FGS_MOBILITY_MANAGEMENT_MESSAGE
;
size
+=
1
;
mm_msg
->
fgs_
identity
_response
.
securityheadertype
=
PLAIN_5GS_MSG
;
mm_msg
->
fgs_
auth
_response
.
securityheadertype
=
PLAIN_5GS_MSG
;
size
+=
1
;
mm_msg
->
fgs_
identity
_response
.
messagetype
=
FGS_AUTHENTICATION_RESPONSE
;
mm_msg
->
fgs_
auth
_response
.
messagetype
=
FGS_AUTHENTICATION_RESPONSE
;
size
+=
1
;
//set response parameter
...
...
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