Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
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
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-SMF
Commits
da7a9288
Commit
da7a9288
authored
Oct 11, 2019
by
yunshou-yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sm: update nas_message
parent
2c0f33bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2739 additions
and
31 deletions
+2739
-31
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+3
-1
src/nas/nas_message.c
src/nas/nas_message.c
+11
-6
src/nas/test/NasMain.c
src/nas/test/NasMain.c
+2725
-24
No files found.
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
da7a9288
...
...
@@ -18,6 +18,7 @@
extern
"C"
{
#include "nas_message.h"
#include "mmData.h"
#include "NasMain.h"
}
namespace
oai
{
...
...
@@ -52,7 +53,8 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//bsafe (disable temporarily warning for strncpy)
//std::strncpy((char *)data, n1SmMessage.c_str(), sizeof(data));
memcpy
((
void
*
)
data
,
(
void
*
)
n1SmMessage
.
c_str
(),
sizeof
(
data
));
memcpy
((
void
*
)
data
,
(
void
*
)
n1SmMessage
.
c_str
(),
strlen
(
n1SmMessage
.
c_str
()));
//establishment_request(data);
//use a temporary security mechanism
fivegmm_security_context_t
*
security
=
(
fivegmm_security_context_t
*
)
std
::
calloc
(
1
,
sizeof
(
fivegmm_security_context_t
));
...
...
src/nas/nas_message.c
View file @
da7a9288
...
...
@@ -120,6 +120,7 @@ int nas_message_encode (
//printf("_nas_message_header_encode, size:%d\n", size);
if
(
size
<
0
)
{
//OAILOG_FUNC_RETURN (LOG_NAS, TLV_BUFFER_TOO_SHORT);
return
TLV_BUFFER_TOO_SHORT
;
}
else
if
(
size
>
2
)
{
/*
* Encode security protected NAS message
...
...
@@ -348,7 +349,8 @@ static int _nas_message_header_encode (
//printf("encoded nas security header type: %x\n",buffer[size-1]);
//printf("encoded nas security header type: %x\n",header->security_header_type);
if
(
header
->
extended_protocol_discriminator
==
EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
==
EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES
||
header
->
extended_protocol_discriminator
==
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
)
{
//printf("header->extended_protocol_discriminator == EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES\n");
//printf("%x\n",header->security_header_type);
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
...
...
@@ -359,16 +361,17 @@ static int _nas_message_header_encode (
*/
//OAILOG_WARNING(LOG_NAS, "NET-API - The size of the header (%u) " "exceeds the buffer length (%lu)\n", NAS_MESSAGE_SECURITY_HEADER_SIZE, length);
//OAILOG_FUNC_RETURN (LOG_NAS, RETURNerror);
return
RETURNerror
;
}
/*
* Encode the message authentication code
*/
//
ENCODE_U32 (buffer + size, header->message_authentication_code, size);
ENCODE_U32
(
buffer
+
size
,
header
->
message_authentication_code
,
size
);
/*
* Encode the sequence number
*/
//
ENCODE_U8 (buffer + size, header->sequence_number, size);
ENCODE_U8
(
buffer
+
size
,
header
->
sequence_number
,
size
);
}
}
return
size
;
...
...
@@ -754,7 +757,8 @@ static int _nas_message_header_decode (
DECODE_U8
(
buffer
+
size
,
header
->
security_header_type
,
size
);
//OAILOG_DEBUG(LOG_NAS,"security header type(%x)\n",header->security_header_type&0x0f);
*
is_sr
=
false
;
if
(
header
->
extended_protocol_discriminator
==
EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES
)
{
if
(
header
->
extended_protocol_discriminator
==
EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES
||
header
->
extended_protocol_discriminator
==
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
)
{
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
if
(
status
)
{
switch
(
header
->
security_header_type
)
{
...
...
@@ -785,11 +789,12 @@ static int _nas_message_header_decode (
*/
//OAILOG_WARNING(LOG_NAS, "NET-API - The size of the header (%u) " "exceeds the buffer length (%lu)\n", NAS_MESSAGE_SECURITY_HEADER_SIZE, length);
//OAILOG_FUNC_RETURN (LOG_NAS, RETURNerror);
return
RETURNerror
;
}
// Decode the message authentication code
//
DECODE_U32 (buffer + size, header->message_authentication_code, size);
DECODE_U32
(
buffer
+
size
,
header
->
message_authentication_code
,
size
);
// Decode the sequence number
//
DECODE_U8 (buffer + size, header->sequence_number, size);
DECODE_U8
(
buffer
+
size
,
header
->
sequence_number
,
size
);
#if 0
printf("decode size:%d, message_authentication_code:0x%x,sequence_number:0x%x\n",
...
...
src/nas/test/NasMain.c
View file @
da7a9288
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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