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
wangjie
OpenXG-RAN
Commits
1589152e
Commit
1589152e
authored
Nov 19, 2020
by
cucengineer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build ok
parent
a0148c46
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
217 additions
and
4 deletions
+217
-4
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+26
-0
openair3/NAS/NR_UE/nas_nrue_task.c
openair3/NAS/NR_UE/nas_nrue_task.c
+166
-4
openair3/NAS/NR_UE/nas_nrue_task.h
openair3/NAS/NR_UE/nas_nrue_task.h
+25
-0
No files found.
openair2/RRC/NR_UE/rrc_UE.c
View file @
1589152e
...
...
@@ -2423,6 +2423,32 @@ void *rrc_nrue_task( void *args_p ) {
NR_RRC_DCCH_DATA_IND
(
msg_p
).
gNB_index
);
break
;
//store NAS msgs for msg5
case
NAS_CONN_ESTABLI_REQ
:
//CUC:NAS_CONN_ESTABLI_REQ √
LOG_D
(
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
);
UE_rrc_inst
[
ue_mod_id
].
initialNasMsg
=
NAS_CONN_ESTABLI_REQ
(
msg_p
).
initialNasMsg
;
break
;
//send ulinfo to PDCP
case
NAS_UPLINK_DATA_REQ
:
{
//CUC:NAS_UPLINK_DATA_REQ √
uint32_t
length
;
uint8_t
*
buffer
;
LOG_D
(
RRC
,
"[UE %d] Received %s: UEid %d
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
),
NAS_UPLINK_DATA_REQ
(
msg_p
).
UEid
);
/* Create message for PDCP (ULInformationTransfer_t) */
length
=
do_ULInformationTransfer
(
&
buffer
,
NAS_UPLINK_DATA_REQ
(
msg_p
).
nasMsg
.
length
,
NAS_UPLINK_DATA_REQ
(
msg_p
).
nasMsg
.
data
);
break
;
}
default:
LOG_E
(
NR_RRC
,
"[UE %d] Received unexpected message %s
\n
"
,
ue_mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
...
...
openair3/NAS/NR_UE/nas_nrue_task.c
View file @
1589152e
...
...
@@ -19,6 +19,9 @@
* 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"
...
...
@@ -50,6 +53,7 @@ void *nas_ue_task(void *args_p)
unsigned
int
Mod_id
;
int
result
;
nas_user_container_t
*
users
=
args_p
;
UENAS_msg
*
nrue_msg
;
itti_mark_task_ready
(
TASK_NAS_UE
);
MSC_START_USE
();
...
...
@@ -81,10 +85,13 @@ void *nas_ue_task(void *args_p)
LOG_I
(
NAS
,
"[UE %d] Received %s
\n
"
,
Mod_id
,
ITTI_MSG_NAME
(
msg_p
));
break
;
case
NAS_CELL_SELECTION_CNF
:
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
};
plmn_t
plmnID
=
{
0
,
0
,
0
,
0
};
Byte_t
data
=
0
;
nas_itti_nas_establish_req
(
0
,
AS_TYPE_ORIGINATING_SIGNAL
,
s_tmsi
,
plmnID
,
&
data
,
0
,
0
);
break
;
case
NAS_CELL_SELECTION_IND
:
...
...
@@ -119,10 +126,10 @@ void *nas_ue_task(void *args_p)
break
;
case
NAS_DOWNLINK_DATA_IND
:
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
(
nrue_msg
,
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
data
,
NAS_DOWNLINK_DATA_IND
(
msg_p
).
nasMsg
.
length
);
//handle dl info NAS mesaages.
break
;
default:
...
...
@@ -141,3 +148,158 @@ void *nas_ue_task(void *args_p)
free
(
users
);
return
NULL
;
}
void
nr_nas_proc_dl_transfer_ind
(
UENAS_msg
*
msg
,
Byte_t
*
data
,
uint32_t
len
)
{
//QUES: 解出的msg干什么
uint8_t
*
buffer
;
UENAS_msg
*
msg1
;
uint32_t
len1
;
nr_user_nas_t
UErrc
=
{
0
};
//QUES:user
int
size
;
decodeNasMsg
(
msg
,
data
,
len
);
switch
(
msg
->
header
.
message_type
)
{
case
IDENTITY_REQUEST
:
{
//send identityResponse in NAS_UPLINK_DATA_REQ
msg1
->
header
.
protocol_discriminator
=
0
;
msg1
->
header
.
security_header_type
=
0
;
len1
+=
sizeof
(
uint8_t
);
msg1
->
header
.
message_type
=
IDENTITY_RESPONSE
;
len1
+=
sizeof
(
uint8_t
);
len1
+=
identityResponse
((
void
**
)
&
msg1
->
identity_response
,
&
UErrc
);
size
=
encodeNasMsg
(
msg1
,
buffer
,
len1
);
nas_itti_ul_data_req
(
0
,
buffer
,
size
,
0
);
break
;
}
case
AUTHENTICATION_REQUEST
:
{
//send authenticationResponse
msg1
->
header
.
protocol_discriminator
=
0
;
msg1
->
header
.
security_header_type
=
0
;
len1
+=
sizeof
(
uint8_t
);
msg1
->
header
.
message_type
=
AUTHENTICATION_RESPONSE
;
len1
+=
sizeof
(
uint8_t
);
len1
+=
authenticationResponse
((
void
**
)
&
msg1
->
identity_response
,
&
UErrc
);
size
=
encodeNasMsg
(
msg1
,
buffer
,
len1
);
nas_itti_ul_data_req
(
0
,
buffer
,
size
,
0
);
break
;
}
}
}
int
decodeNasMsg
(
UENAS_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
header_result
;
int
decode_result
=
0
;
/* First decode the EMM message header */
header_result
=
_emm_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
)
{
}
LOG_FUNC_RETURN
(
header_result
+
decode_result
);
}
int
encodeNasMsg
(
UENAS_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
)
{
//QUES:UENAS_msg *msg
int
header_result
;
int
encode_result
=
0
;
/* First encode the EMM message header */
header_result
=
_emm_msg_encode_header
(
&
msg
->
header
,
buffer
,
len
);
if
(
header_result
<
0
)
{
LOG_TRACE
(
ERROR
,
"NR_UE - Failed to encode EMM message header "
"(%d)"
,
header_result
);
LOG_FUNC_RETURN
(
header_result
);
}
buffer
+=
header_result
;
len
-=
header_result
;
switch
(
msg
->
header
.
message_type
)
{
case
IDENTITY_RESPONSE
:
{
encode_result
=
encode_IdentityresponseIMSI
(
&
msg
->
identity_response
,
buffer
,
len
);
break
;
}
case
AUTHENTICATION_RESPONSE
:
{
encode_result
=
encode_authenticationresponse
(
&
msg
->
authentication_response
,
buffer
,
len
);
break
;
}
}
LOG_FUNC_RETURN
(
header_result
+
encode_result
);
}
static
int
_emm_msg_decode_header
(
emm_msg_header_t
*
header
,
const
uint8_t
*
buffer
,
uint32_t
len
)
{
int
size
=
0
;
/* Check the buffer length */
/* Decode the security header type and the protocol discriminator */
DECODE_U8
(
buffer
+
size
,
*
(
uint8_t
*
)(
header
),
size
);
/* Decode the message type */
DECODE_U8
(
buffer
+
size
,
header
->
message_type
,
size
);
/* Check the protocol discriminator */
return
(
size
);
}
static
int
_emm_msg_encode_header
(
const
emm_msg_header_t
*
header
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
size
=
0
;
/* Check the buffer length */
/* Check the protocol discriminator */
/* Encode the security header type and the protocol discriminator */
ENCODE_U8
(
buffer
+
size
,
*
(
uint8_t
*
)(
header
),
size
);
/* Encode the message type */
ENCODE_U8
(
buffer
+
size
,
header
->
message_type
,
size
);
return
(
size
);
}
int
encode_IdentityresponseIMSI
(
IdentityresponseIMSI_t
*
identity_response
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
encoded
=
0
;
int
encode_result
=
0
;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
IDENTITY_RESPONSE_MINIMUM_LENGTH
,
len
);
if
((
encode_result
=
encode_mobile_identity
(
&
identity_response
->
mobileidentity
,
0
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//Return in case of error
return
encode_result
;
else
encoded
+=
encode_result
;
return
encoded
;
}
int
encode_authenticationresponse
(
authenticationresponse_t
*
authentication_response
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
encoded
=
0
;
int
encode_result
=
0
;
/* Checking IEI and pointer */
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
AUTHENTICATION_RESPONSE_MINIMUM_LENGTH
,
len
);
if
((
encode_result
=
encode_authentication_response_parameter
(
&
authentication_response
->
authenticationresponseparameter
,
0
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//Return in case of error
return
encode_result
;
else
encoded
+=
encode_result
;
return
encoded
;
}
\ No newline at end of file
openair3/NAS/NR_UE/nas_nrue_task.h
View file @
1589152e
...
...
@@ -24,6 +24,31 @@
#include "openairinterface5g_limits.h"
//CUC:add nas_nrue_task.h √
#include "platform_types.h"
#include "nas_ue_task.h"
#include "nas_itti_messaging.h"
#include "nas_log.h"
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#include "NR_NAS_defs.h"
#include "nas_itti_messaging.h"
typedef
union
{
emm_msg_header_t
header
;
authenticationrequestHeader_t
authentication_request
;
authenticationresponse_t
authentication_response
;
Identityrequest_t
identity_request
;
IdentityresponseIMSI_t
identity_response
;
}
UENAS_msg
;
void
*
nas_nrue_task
(
void
*
args_p
);
void
nr_nas_proc_dl_transfer_ind
(
UENAS_msg
*
msg
,
Byte_t
*
data
,
uint32_t
len
);
int
decodeNasMsg
(
UENAS_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encodeNasMsg
(
UENAS_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
);
static
int
_emm_msg_decode_header
(
emm_msg_header_t
*
header
,
const
uint8_t
*
buffer
,
uint32_t
len
);
//QUES: defined in emm_msg.c and no check
static
int
_emm_msg_encode_header
(
const
emm_msg_header_t
*
header
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_IdentityresponseIMSI
(
IdentityresponseIMSI_t
*
identity_response
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_authenticationresponse
(
authenticationresponse_t
*
authentication_response
,
uint8_t
*
buffer
,
uint32_t
len
);
#endif
/* NAS_TASK_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