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
76b14805
Commit
76b14805
authored
Mar 25, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update NAS
parent
27b9f1d2
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
186 additions
and
167 deletions
+186
-167
src/nas/3gpp_24.501.h
src/nas/3gpp_24.501.h
+140
-137
src/nas/ies/PDUSessionIdentity.c
src/nas/ies/PDUSessionIdentity.c
+17
-17
src/nas/ies/PDUSessionIdentity.h
src/nas/ies/PDUSessionIdentity.h
+1
-1
src/nas/ies/ProcedureTransactionIdentity.c
src/nas/ies/ProcedureTransactionIdentity.c
+22
-0
src/nas/nas_message.c
src/nas/nas_message.c
+3
-5
src/nas/sm/msg/PDUSessionEstablishmentAccept.c
src/nas/sm/msg/PDUSessionEstablishmentAccept.c
+1
-1
src/nas/sm/msg/sm_msg.c
src/nas/sm/msg/sm_msg.c
+2
-6
No files found.
src/nas/3gpp_24.501.h
View file @
76b14805
This diff is collapsed.
Click to expand it.
src/nas/ies/PDUSessionIdentity.c
View file @
76b14805
...
...
@@ -6,30 +6,30 @@
#include "TLVDecoder.h"
#include "PDUSessionIdentity.h"
int
encode_pdu_session_identity
(
PDUSessionIdentity
pdusessionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
int
encode_pdu_session_identity
(
PDUSessionIdentity
pdusessionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
encoded
=
0
;
int
encode_result
;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
PDU_SESSION_IDENTITY_MINIMUM_LENGTH
,
len
);
if
((
encode_result
=
encode_bstring
(
pdusessionidentity
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//加密,实体,首地址,长度
return
encode_result
;
else
encoded
+=
encode_result
;
uint8_t
bitStream
=
0x0
;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
PDU_SESSION_IDENTITY_MINIMUM_LENGTH
,
len
);
if
(
iei
>
0
){
bitStream
=
0x00
|
(
iei
&
0xf0
)
|
(
pdusessionidentity
&
0x0f
);
}
ENCODE_U8
(
buffer
+
encoded
,
bitStream
,
encoded
);
return
encoded
;
}
int
decode_pdu_session_identity
(
PDUSessionIdentity
*
pdusessionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
int
decode_pdu_session_identity
(
PDUSessionIdentity
*
pdusessionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
;
if
((
decode_result
=
decode_bstring
(
pdusessionidentity
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decode_result
;
else
decoded
+=
decode_result
;
int
decoded
=
0
;
uint8_t
bitStream
=
0x0
;
DECODE_U8
(
buffer
+
decoded
,
bitStream
,
decoded
);
if
(
iei
!=
(
bitStream
&
0xf0
))
return
-
1
;
*
pdusessionidentity
=
bitStream
&
0x0f
;
return
decoded
;
}
src/nas/ies/PDUSessionIdentity.h
View file @
76b14805
...
...
@@ -4,7 +4,7 @@
#define PDU_SESSION_IDENTITY_MINIMUM_LENGTH 1
#define PDU_SESSION_IDENTITY_MAXIMUM_LENGTH 1
typedef
bstring
PDUSessionIdentity
;
typedef
uint8_t
PDUSessionIdentity
;
int
encode_pdu_session_identity
(
PDUSessionIdentity
pdusessionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
;
int
decode_pdu_session_identity
(
PDUSessionIdentity
*
pdusessionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
;
...
...
src/nas/ies/ProcedureTransactionIdentity.c
View file @
76b14805
...
...
@@ -18,8 +18,20 @@ int encode_procedure_transaction_identity ( ProcedureTransactionIdentity procedu
encoded
+=
encode_result
;
return
encoded
;
/*
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PROCEDURE_TRANSACTION_IDENTITY_MINIMUM_LENGTH, len);
if(iei > 0){
bitStream = 0x00 | (iei & 0xf0) | (proceduretransactionidentity & 0x0f);
}
ENCODE_U8(buffer + encoded, bitStream, encoded);
return encoded;
*/
}
int
decode_procedure_transaction_identity
(
ProcedureTransactionIdentity
*
proceduretransactionidentity
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
...
...
@@ -31,5 +43,15 @@ int decode_procedure_transaction_identity ( ProcedureTransactionIdentity * proce
else
decoded
+=
decode_result
;
return
decoded
;
/*
int decoded = 0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer + decoded, bitStream, decoded);
if(iei != (bitStream & 0xf0))
return -1;
*proceduretransactionidentity = bitStream & 0x0f;
return decoded;
*/
}
src/nas/nas_message.c
View file @
76b14805
...
...
@@ -373,21 +373,19 @@ static int _nas_message_header_encode (
*/
//ENCODE_U8 (buffer, *(uint8_t *) (header), size);
ENCODE_U8
(
buffer
,
header
->
extended_protocol_discriminator
,
size
);
printf
(
"extended_protocol_discriminator %d
\n
"
,
header
->
extended_protocol_discriminator
);
//Security header type associated with a spare half octet;
ENCODE_U8
(
buffer
+
size
,
*
((
uint8_t
*
)
(
header
)
+
1
),
size
);
//ENCODE_U8 (buffer+size,header->security_header_type,size);
printf
(
"
security_header_type %d
\n
"
,
header
->
security_header_type
);
printf
(
"
extended_protocol_discriminator %d, security_header_type %d
\n
"
,
header
->
extended_protocol_discriminator
,
header
->
security_header_type
);
//printf("security_header_type size = %d\n",size);
//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
||
header
->
extended_protocol_discriminator
==
EPD_5GS_SESSION_MANAGEMENT_MESSAGES
)
{
if
(
header
->
security_header_type
!=
SECURITY_HEADER_TYPE_NOT_PROTECTED
)
{
printf
(
"
header->
security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED
\n
"
);
printf
(
"security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED
\n
"
);
if
(
length
<
NAS_MESSAGE_SECURITY_HEADER_SIZE
)
{
/*
* The buffer is not big enough to contain security header
...
...
@@ -406,7 +404,7 @@ static int _nas_message_header_encode (
*/
ENCODE_U8
(
buffer
+
size
,
header
->
sequence_number
,
size
);
}
printf
(
"
header->security_header_type ==
SECURITY_HEADER_TYPE_NOT_PROTECTED
\n
"
);
printf
(
"
security_header_type:
SECURITY_HEADER_TYPE_NOT_PROTECTED
\n
"
);
}
return
size
;
//OAILOG_STREAM_HEX(OAILOG_LEVEL_DEBUG, LOG_NAS, "encode nas header Incoming NAS message: ", buffer, size)
...
...
src/nas/sm/msg/PDUSessionEstablishmentAccept.c
View file @
76b14805
...
...
@@ -174,7 +174,7 @@ int encode_pdu_session_establishment_accept( pdu_session_establishment_accept_ms
uint32_t
encoded
=
0
;
int
encoded_result
=
0
;
printf
(
"
\n
******************* encode_pdu_session_establishment_accept*****************
\n
"
);
printf
(
"
Encode PDU Session Establishment Accept
\n
"
);
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
PDU_SESSION_ESTABLISHMENT_ACCEPT_MINIMUM_LENGTH
,
len
);
/*
...
...
src/nas/sm/msg/sm_msg.c
View file @
76b14805
...
...
@@ -191,7 +191,6 @@ fivegsm_msg_encode (
uint8_t
*
buffer
,
uint32_t
len
)
{
printf
(
"fivegsm_msg_encode , start ----------------------
\n
"
);
//OAILOG_FUNC_IN (LOG_NAS);
int
header_result
=
0
;
int
encode_result
=
0
;
...
...
@@ -211,7 +210,7 @@ fivegsm_msg_encode (
buffer
+=
header_result
;
len
-=
header_result
;
printf
(
"
************************** m
sg type %d"
,
msg
->
header
.
message_type
);
printf
(
"
M
sg type %d"
,
msg
->
header
.
message_type
);
switch
(
msg
->
header
.
message_type
)
{
case
PDU_SESSION_ESTABLISHMENT_REQUEST
:
encode_result
=
encode_pdu_session_establishment_request
(
&
msg
->
pdu_session_establishment_request
,
buffer
,
len
);
...
...
@@ -404,14 +403,11 @@ _fivegsm_msg_encode_header (
* Encode the procedure transaction identity
*/
ENCODE_U8
(
buffer
+
size
,
header
->
procedure_transaction_identity
,
size
);
printf
(
"
*********** _fivegsm_msg_encode_header******** %d
\n
"
,
header
->
procedure_transaction_identity
);
printf
(
"
fivegsm_msg_encode_header, procedure transaction identity %d
"
,
header
->
procedure_transaction_identity
);
/*
* Encode the message type
*/
ENCODE_U8
(
buffer
+
size
,
header
->
message_type
,
size
);
printf
(
"*********** _fivegsm_msg_encode_header********
\n
"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
printf
(
"%02x "
,
buffer
[
i
]);
return
(
size
);
}
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