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
1a38a436
Commit
1a38a436
authored
Nov 24, 2020
by
cucengineer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NAS ok except identity
parent
aaf4bb81
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
47 deletions
+99
-47
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+4
-4
openair2/RRC/NR_UE/rrc_UE.c
openair2/RRC/NR_UE/rrc_UE.c
+1
-1
openair3/NAS/NR_UE/nas_nrue_task.c
openair3/NAS/NR_UE/nas_nrue_task.c
+90
-39
openair3/NAS/NR_UE/nas_nrue_task.h
openair3/NAS/NR_UE/nas_nrue_task.h
+4
-3
No files found.
executables/nr-uesoftmodem.c
View file @
1a38a436
...
...
@@ -597,7 +597,7 @@ void *rrc_enb_process_msg(void *notUsed) {
}
extern
void
tesths
(
void
);
// extern void tesths(void);//CUC:test
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -662,9 +662,9 @@ int main( int argc, char **argv ) {
#endif
#endif
*/
printf
(
"1111111"
);
tesths
();
printf
(
"1111111
"
);
// printf("witcomm111witcomm: \n");//CUC:test
//
tesths ();
// printf("witcomm111witcomm \n
");
NB_UE_INST
=
1
;
NB_INST
=
1
;
...
...
openair2/RRC/NR_UE/rrc_UE.c
View file @
1a38a436
...
...
@@ -2445,7 +2445,7 @@ void *rrc_nrue_task( void *args_p ) {
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
);
length
=
do_ULInformationTransfer
(
&
buffer
,
NAS_UPLINK_DATA_REQ
(
msg_p
).
nasMsg
.
length
,
NAS_UPLINK_DATA_REQ
(
msg_p
).
nasMsg
.
data
);
//QUES:
break
;
}
...
...
openair3/NAS/NR_UE/nas_nrue_task.c
View file @
1a38a436
...
...
@@ -154,9 +154,8 @@ void *nas_ue_task(void *args_p)
void
nr_nas_proc_dl_transfer_ind
(
UENAS_msg
*
msg
,
Byte_t
*
data
,
uint32_t
len
)
{
//QUES: 解出的msg干什么
uint8_t
buffer
[
100
];
UENAS_msg
*
msg1
;
UENAS_msg
msg1
;
uint32_t
len1
=
0
;
nr_user_nas_t
UErrc
=
{
0
};
//QUES:user
int
size
;
decodeNasMsg
(
msg
,
data
,
len
);
switch
(
msg
->
header
.
message_type
)
{
...
...
@@ -172,36 +171,45 @@ void nr_nas_proc_dl_transfer_ind (UENAS_msg *msg, Byte_t *data, uint32_t len) {
// break;
// }
case
A
UTHENTICATION_REQUEST
:
{
//send authenticationResponse
len1
+=
authenticationResponse
((
void
**
)
&
msg1
->
identity_response
,
&
UErrc
);
size
=
encodeNasMsg
(
msg1
,
buffer
,
len1
);
case
A
uthenticationrequest
:
{
//send authenticationResponse
len1
+=
authenticationResponse
5g
(
&
msg1
.
authentication_response
);
size
=
encodeNasMsg
(
&
msg1
,
buffer
,
len1
);
nas_itti_ul_data_req
(
0
,
buffer
,
size
,
0
);
break
;
}
case
S
ECURITY_MODE_COMMAND
:
{
len1
+=
securityModeComplete5g
(
(
void
**
)
&
msg1
->
securitymode_complete
);
size
=
encodeNasMsg
(
msg1
,
buffer
,
len1
);
case
S
ecuritymodecommand
:
{
len1
+=
securityModeComplete5g
(
&
msg1
.
securitymode_complete
);
size
=
encodeNasMsg
(
&
msg1
,
buffer
,
len1
);
nas_itti_ul_data_req
(
0
,
buffer
,
size
,
0
);
break
;
}
case
R
EGISTRATION_ACCEPT
:
{
len1
+=
registrationComplete5g
(
(
void
**
)
&
msg1
->
registration_complete
);
size
=
encodeNasMsg
(
msg1
,
buffer
,
len1
);
case
R
egistrationaccept
:
{
len1
+=
registrationComplete5g
(
&
msg1
.
registration_complete
);
size
=
encodeNasMsg
(
&
msg1
,
buffer
,
len1
);
nas_itti_ul_data_req
(
0
,
buffer
,
size
,
0
);
break
;
}
}
printf
(
"aaaaaaaaaaaaa: "
);
printf
(
"%d
\n
"
,
size
);
//****************************** //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
<
size
;
i
++
)
{
printf
(
"%02x "
,
*
(
buffer
+
i
));
}
printf
(
"aaaaaaaaaaaaa
\n
"
);
printf
(
"encodeaaaencode
\n
"
);
//******************************
}
...
...
@@ -223,15 +231,29 @@ int string2ByteArray(char* input,uint8_t* output)
return
i
;
}
void
tesths
(
void
)
void
tesths
(
void
)
//CUC:test
{
UENAS_msg
msg
;
char
name
[]
=
"7e005601020000217d003b4a2e3bb80403de19020f57b16a2010583f0d352eb89001539b2cb2cbf1da5c"
;
uint32_t
len
=
42
;
Byte_t
*
data
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
*
len
);
string2ByteArray
(
name
,
data
);
nr_nas_proc_dl_transfer_ind
(
&
msg
,
data
,
len
);
printf
(
"Authentication:
\n
"
);
UENAS_msg
msg1
;
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
(
&
msg1
,
data1
,
len1
);
printf
(
"Security mode:
\n
"
);
UENAS_msg
msg2
;
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
(
&
msg2
,
data2
,
len2
);
printf
(
"Registration:
\n
"
);
UENAS_msg
msg3
;
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
(
&
msg3
,
data3
,
len3
);
}
...
...
@@ -254,6 +276,21 @@ int decodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len) {
switch
(
msg
->
header
.
message_type
)
{
case
Authenticationrequest
:
break
;
case
Securitymodecommand
:
break
;
case
Registrationaccept
:
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
);
...
...
@@ -280,17 +317,17 @@ int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len) { //QUES:UENAS_m
// encode_result = encode_identity_response(&msg->identity_response, buffer, len);
// break;
// }
case
A
UTHENTICATION_RESPONSE
:
{
case
A
uthenticationresponse
:
{
encode_result
=
encode_authentication_response5g
(
&
msg
->
authentication_response
,
buffer
,
len
);
break
;
}
case
S
ECURITY_MODE_COMPLETE
:
{
case
S
ecuritymodecomplete
:
{
encode_result
=
encode_security_mode_complete5g
(
&
msg
->
securitymode_complete
,
buffer
,
len
);
//TODO:encode_security_mode_complete5g
break
;
}
case
R
EGISTRATION_COMPLETE
:
{
case
R
egistrationcomplete
:
{
encode_result
=
encode_registration_complete5g
(
&
msg
->
registration_complete
,
buffer
,
len
);
//TODO:encode_security_mode_complete5g
break
;
}
...
...
@@ -302,7 +339,9 @@ static int _nas_mm_msg_decode_header(mm_msg_header_t *header, const uint8_t *buf
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
);
...
...
@@ -312,7 +351,11 @@ static int _nas_mm_msg_decode_header(mm_msg_header_t *header, const uint8_t *buf
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
);
}
...
...
@@ -376,20 +419,28 @@ int encode_registration_complete5g(registrationcomplete_t *registrationcomplete,
return
encoded
;
}
int
securityModeComplete5g
(
void
**
msg
)
{
myCalloc
(
resp
,
securityModeComplete_t
);
resp
->
epd
=
SGSmobilitymanagementmessages
;
resp
->
sh
=
0
;
resp
->
mt
=
Registrationcomplete
;
*
msg
=
resp
;
int
authenticationResponse5g
(
authenticationresponse_t
*
msg
)
{
msg
->
epd
=
SGSmobilitymanagementmessages
;
msg
->
sh
=
0
;
msg
->
mt
=
Authenticationresponse
;
msg
->
iei
=
IEI_AuthenticationResponse
;
msg
->
RESlen
=
sizeof
(
msg
->
RES
);
uint8_t
AUTN
[
16
]
=
{
0
};
memcpy
(
&
msg
->
RES
,
AUTN
,
msg
->
RESlen
);
return
sizeof
(
authenticationresponse_t
);
}
int
securityModeComplete5g
(
securityModeComplete_t
*
msg
)
{
msg
->
epd
=
SGSmobilitymanagementmessages
;
msg
->
sh
=
0
;
msg
->
mt
=
Securitymodecomplete
;
return
sizeof
(
securityModeComplete_t
);
}
int
registrationComplete5g
(
void
**
msg
)
{
myCalloc
(
resp
,
registrationcomplete_t
);
resp
->
epd
=
SGSmobilitymanagementmessages
;
resp
->
sh
=
0
;
resp
->
mt
=
Securitymodecomplete
;
*
msg
=
resp
;
int
registrationComplete5g
(
registrationcomplete_t
*
msg
)
{
msg
->
epd
=
SGSmobilitymanagementmessages
;
msg
->
sh
=
0
;
msg
->
mt
=
Registrationcomplete
;
return
sizeof
(
registrationcomplete_t
);
}
openair3/NAS/NR_UE/nas_nrue_task.h
View file @
1a38a436
...
...
@@ -80,10 +80,11 @@ int encodeNasMsg(UENAS_msg *msg, uint8_t *buffer, uint32_t len);
int
encode_authentication_response5g
(
authenticationresponse_t
*
authentication_response
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_security_mode_complete5g
(
securityModeComplete_t
*
securitymodecomplete
,
uint8_t
*
buffer
,
uint32_t
len
);
int
encode_registration_complete5g
(
registrationcomplete_t
*
registrationcomplete
,
uint8_t
*
buffer
,
uint32_t
len
);
int
securityModeComplete5g
(
void
**
msg
);
int
registrationComplete5g
(
void
**
msg
);
int
authenticationResponse5g
(
authenticationresponse_t
*
msg
);
int
securityModeComplete5g
(
securityModeComplete_t
*
msg
);
int
registrationComplete5g
(
registrationcomplete_t
*
msg
);
int
string2ByteArray
(
char
*
input
,
uint8_t
*
output
);
int
string2ByteArray
(
char
*
input
,
uint8_t
*
output
);
//CUC:test
void
tesths
(
void
);
#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