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
8fc1cc06
Commit
8fc1cc06
authored
Apr 14, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solve warnings (related to NAS) when compiling SMF
parent
1b31813a
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
66 additions
and
120 deletions
+66
-120
src/nas/3gpp_24.501.h
src/nas/3gpp_24.501.h
+2
-1
src/nas/ies/MessageType.c
src/nas/ies/MessageType.c
+8
-29
src/nas/ies/MessageType.h
src/nas/ies/MessageType.h
+4
-3
src/nas/ies/NSSAI.c
src/nas/ies/NSSAI.c
+6
-4
src/nas/ies/QOSRules.c
src/nas/ies/QOSRules.c
+1
-2
src/nas/ies/SecurityHeaderType.c
src/nas/ies/SecurityHeaderType.c
+1
-1
src/nas/ies/TimeZone.c
src/nas/ies/TimeZone.c
+28
-37
src/nas/ies/_5GSMCapability.c
src/nas/ies/_5GSMCapability.c
+0
-1
src/nas/ies/_5GSMobileIdentity.c
src/nas/ies/_5GSMobileIdentity.c
+1
-1
src/nas/mm/msg/DeregistrationRequest.c
src/nas/mm/msg/DeregistrationRequest.c
+2
-2
src/nas/mm/msg/RegistrationRequest.c
src/nas/mm/msg/RegistrationRequest.c
+1
-1
src/nas/mm/msg/ServiceRequest.c
src/nas/mm/msg/ServiceRequest.c
+2
-2
src/nas/mm/msg/mm_msg.c
src/nas/mm/msg/mm_msg.c
+5
-5
src/nas/nas_message.c
src/nas/nas_message.c
+3
-3
src/nas/sm/msg/PDUSessionModificationCommand.c
src/nas/sm/msg/PDUSessionModificationCommand.c
+1
-23
src/nas/sm/sm_msg.c
src/nas/sm/sm_msg.c
+1
-5
No files found.
src/nas/3gpp_24.501.h
View file @
8fc1cc06
...
...
@@ -318,7 +318,8 @@ enum class pdu_session_status_e {
static
const
std
::
vector
<
std
::
string
>
pdu_session_status_e2str
=
{
"PDU_SESSION_INACTIVE"
,
"PDU_SESSION_INACTIVE_PENDING"
,
"PDU_SESSION_MODIFICATION_PENDING"
,
"PDU_SESSION_ACTIVE"
};
"PDU_SESSION_MODIFICATION_PENDING"
,
"PDU_SESSION_ESTABLISHMENT_PENDING"
,
"PDU_SESSION_ACTIVE"
};
//see Table 9.11.4.12.1: QoS flow descriptions information element
typedef
struct
flow_bit_rate_type_s
{
...
...
src/nas/ies/MessageType.c
View file @
8fc1cc06
...
...
@@ -6,36 +6,15 @@
#include "TLVDecoder.h"
#include "MessageType.h"
int
encode_message_type
(
MessageType
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
/*
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,MESSAGE_TYPE_MINIMUM_LENGTH , len);
if ((encode_result = encode_bstring (messagetype, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
else
encoded += encode_result;
return encoded;
*/
int
encode_message_type
(
MessageType
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
//we don't need this since it's done in encode header ENCODE_U8
return
0
;
}
int
decode_message_type
(
MessageType
*
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
/*
int decoded=0;
int decode_result;
if((decode_result = decode_bstring (messagetype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
*/
int
decode_message_type
(
MessageType
*
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
//we don't need this since it's done in decode header (DECODE_U8)
return
0
;
}
src/nas/ies/MessageType.h
View file @
8fc1cc06
...
...
@@ -6,6 +6,7 @@
typedef
uint8_t
MessageType
;
int
encode_message_type
(
MessageType
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
;
int
decode_message_type
(
MessageType
*
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
;
int
encode_message_type
(
MessageType
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
int
decode_message_type
(
MessageType
*
messagetype
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
);
src/nas/ies/NSSAI.c
View file @
8fc1cc06
...
...
@@ -21,8 +21,9 @@ int encode_nssai ( NSSAI nssai, uint8_t iei, uint8_t * buffer, uint32_t len )
lenPtr
=
(
buffer
+
encoded
);
encoded
++
;
//TODO: fix it for MM
/*
if ((encode_result = encode_bstring (nssai, buffer + encoded, len - encoded)) < 0)
//加密,实体,首地址,长度
if ((encode_result = encode_bstring (nssai, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
...
...
@@ -35,7 +36,7 @@ int decode_nssai ( NSSAI * nssai, uint8_t iei, uint8_t * buffer, uint32_t len )
{
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
;
//
int decode_result;
if
(
iei
>
0
)
{
...
...
@@ -47,12 +48,13 @@ int decode_nssai ( NSSAI * nssai, uint8_t iei, uint8_t * buffer, uint32_t len )
ielen
=
*
(
buffer
+
decoded
);
decoded
++
;
CHECK_LENGTH_DECODER
(
len
-
decoded
,
ielen
);
//TODO: fix it for MM
/*
if((decode_result = decode_bstring (nssai, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
*/
return
decoded
;
}
src/nas/ies/QOSRules.c
View file @
8fc1cc06
...
...
@@ -12,7 +12,6 @@ int encode_qos_rules ( QOSRules qosrules, uint8_t iei, uint8_t * buffer, uint32_
uint8_t
*
len_qosrulesie
=
NULL
;
uint8_t
len_pos_qos_rule
=
0
;
uint8_t
bitstream
=
0
;
uint16_t
lenqosrule_16
=
0
;
uint32_t
encoded
=
0
;
int
encode_result
=
0
;
int
i
=
0
,
j
=
0
;
...
...
@@ -102,7 +101,7 @@ int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint3
uint16_t
ielen
=
0
;
int
decode_result
=
0
;
uint16_t
numberrules
=
0
;
uint16_t
lenqosrule
=
0
;
//
uint16_t lenqosrule = 0;
uint8_t
bitstream
=
0
;
int
i
=
0
,
j
=
0
;
...
...
src/nas/ies/SecurityHeaderType.c
View file @
8fc1cc06
...
...
@@ -12,7 +12,7 @@ int encode_security_header_type ( SecurityHeaderType securityheadertype, uint8_t
int
encode_result
;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
SECURITY_HEADER_TYPE_MINIMUM_LENGTH
,
len
);
if
((
encode_result
=
encode_bstring
(
securityheadertype
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//加密,实体,首地址,长度
if
((
encode_result
=
encode_bstring
(
securityheadertype
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
return
encode_result
;
else
encoded
+=
encode_result
;
...
...
src/nas/ies/TimeZone.c
View file @
8fc1cc06
...
...
@@ -8,50 +8,41 @@
int
encode_time_zone
(
TimeZone
timezone
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint8_t
*
lenPtr
;
uint32_t
encoded
=
0
;
int
encode_result
;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
TIME_ZONE_MINIMUM_LENGTH
,
len
);
uint32_t
encoded
=
0
;
int
encode_result
;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
TIME_ZONE_MINIMUM_LENGTH
,
len
);
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
if
(
iei
>
0
)
{
*
buffer
=
iei
;
encoded
++
;
}
if
((
encode_result
=
encode_bstring
(
timezone
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
return
encode_result
;
else
encoded
+=
encode_result
;
if
((
encode_result
=
encode_bstring
(
timezone
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
//加密,实体,首地址,长度
return
encode_result
;
else
encoded
+=
encode_result
;
return
encoded
;
return
encoded
;
}
int
decode_time_zone
(
TimeZone
*
timezone
,
uint8_t
iei
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
if
((
decode_result
=
decode_bstring
(
timezone
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decode_result
;
else
decoded
+=
decode_result
;
return
decoded
;
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
;
if
(
iei
>
0
)
{
CHECK_IEI_DECODER
(
iei
,
*
buffer
);
decoded
++
;
}
if
((
decode_result
=
decode_bstring
(
timezone
,
ielen
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decode_result
;
else
decoded
+=
decode_result
;
return
decoded
;
}
src/nas/ies/_5GSMCapability.c
View file @
8fc1cc06
...
...
@@ -45,7 +45,6 @@ int decode__5gsm_capability ( _5GSMCapability * _5gsmcapability, uint8_t iei, ui
{
int
decoded
=
0
;
uint8_t
ielen
=
0
;
int
decode_result
=
0
;
uint8_t
_5gsmcapability_bits
=
0
;
...
...
src/nas/ies/_5GSMobileIdentity.c
View file @
8fc1cc06
...
...
@@ -10,7 +10,7 @@ int encode__5gs_mobile_identity ( _5GSMobileIdentity _5gsmobileidentity, uint8_
{
uint8_t
*
lenPtr
;
uint32_t
encoded
=
0
;
int
encode_result
;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH
,
len
);
lenPtr
=
(
buffer
+
encoded
);
...
...
src/nas/mm/msg/DeregistrationRequest.c
View file @
8fc1cc06
...
...
@@ -9,7 +9,7 @@
int
decode_deregistration_request
(
deregistration_request_msg
*
deregistration_request
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
decoded
=
0
;
int
decoded_result
=
0
;
//
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER
(
buffer
,
DEREGISTRATION_REQUEST_MINIMUM_LENGTH
,
len
);
...
...
@@ -52,7 +52,7 @@ int decode_deregistration_request( deregistration_request_msg *deregistration_re
int
encode_deregistration_request
(
deregistration_request_msg
*
deregistration_request
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
encoded
=
0
;
int
encoded_result
=
0
;
//
int encoded_result = 0;
// 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
,
DEREGISTRATION_REQUEST_MINIMUM_LENGTH
,
len
);
...
...
src/nas/mm/msg/RegistrationRequest.c
View file @
8fc1cc06
...
...
@@ -375,7 +375,7 @@ int encode_registration_request( registration_request_msg *registration_request,
}
*/
//test
if
(
registration_request
->
presence
&
REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT
if
(
(
registration_request
->
presence
&
REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT
)
==
REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT
){
if
((
encoded_result
=
encode_allowed_pdu_session_status
(
registration_request
->
allowedpdusessionstatus
,
REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_IEI
,
buffer
+
encoded
,
len
-
encoded
))
<
0
)
return
encoded_result
;
...
...
src/nas/mm/msg/ServiceRequest.c
View file @
8fc1cc06
...
...
@@ -9,7 +9,7 @@
int
decode_service_request
(
service_request_msg
*
service_request
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
decoded
=
0
;
int
decoded_result
=
0
;
//
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER
(
buffer
,
SERVICE_REQUEST_MINIMUM_LENGTH
,
len
);
...
...
@@ -72,7 +72,7 @@ int decode_service_request( service_request_msg *service_request, uint8_t* buffe
int
encode_service_request
(
service_request_msg
*
service_request
,
uint8_t
*
buffer
,
uint32_t
len
)
{
uint32_t
encoded
=
0
;
int
encoded_result
=
0
;
//
int encoded_result = 0;
// 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
,
SERVICE_REQUEST_MINIMUM_LENGTH
,
len
);
...
...
src/nas/mm/msg/mm_msg.c
View file @
8fc1cc06
...
...
@@ -65,8 +65,8 @@ fivegmm_msg_encode (
//OAILOG_FUNC_IN (LOG_NAS_EMM);
int
header_result
;
int
encode_result
;
uint8_t
*
buffer_log
=
buffer
;
bool
is_down_link
=
true
;
//
uint8_t *buffer_log = buffer;
//
bool is_down_link = true;
/*
* First encode the EMM message header
*/
...
...
@@ -202,9 +202,9 @@ mm_msg_decode (
//OAILOG_FUNC_IN (LOG_NAS);
int
header_result
=
0
;
int
decode_result
=
0
;
uint8_t
*
buffer_log
=
buffer
;
uint32_t
len_log
=
len
;
bool
is_down_link
=
false
;
//
uint8_t *buffer_log = buffer;
//
uint32_t len_log = len;
//
bool is_down_link = false;
/*
* First decode the MM message header
...
...
src/nas/nas_message.c
View file @
8fc1cc06
...
...
@@ -630,7 +630,7 @@ static uint32_t _nas_message_get_mac(
switch
(
fivegmm_security_context
->
selected_algorithms
.
integrity
)
{
case
NAS_SECURITY_ALGORITHMS_NIA1
:
{
uint8_t
mac
[
4
];
nas_stream_cipher_t
stream_cipher
;
nas_stream_cipher_t
stream_cipher
=
{
0
}
;
uint32_t
count
;
uint32_t
*
mac32
;
...
...
@@ -668,7 +668,7 @@ static uint32_t _nas_message_get_mac(
break
;
case
NAS_SECURITY_ALGORITHMS_NIA2
:
{
uint8_t
mac
[
4
];
nas_stream_cipher_t
stream_cipher
;
nas_stream_cipher_t
stream_cipher
=
{
0
}
;
uint32_t
count
;
uint32_t
*
mac32
;
...
...
@@ -866,7 +866,7 @@ static int _nas_message_decrypt(
//stream_cipher.message = (uint8_t*)src;
uint8_t
*
src_encrypt
=
NULL
;
src_encrypt
=
(
uint8_t
*
)
calloc
(
1
,
length
+
3
);
memset
(
src_encrypt
,
0
,
sizeof
(
src_encryp
t
));
memset
(
src_encrypt
,
0
,
sizeof
(
uint8_
t
));
memcpy
(
src_encrypt
,
src
,
length
);
stream_cipher
.
message
=
(
uint8_t
*
)
src_encrypt
;
...
...
src/nas/sm/msg/PDUSessionModificationCommand.c
View file @
8fc1cc06
...
...
@@ -111,7 +111,7 @@ int decode_pdu_session_modification_command(
case
PDU_SESSION_MODIFICATION_COMMAND_E_P_C_O_IEI
:
if
((
decoded_result
=
decode_extended_protocol_configuration_options
(
&
pdu_session_modification_command
->
extendedprotocolconfigurationoptions
,
->
extendedprotocolconfigurationoptions
,
PDU_SESSION_MODIFICATION_COMMAND_E_P_C_O_IEI
,
buffer
+
decoded
,
len
-
decoded
))
<
0
)
return
decoded_result
;
...
...
@@ -137,28 +137,6 @@ int encode_pdu_session_modification_command(
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(
buffer
,
PDU_SESSION_MODIFICATION_COMMAND_MINIMUM_LENGTH
,
len
);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_modification_command->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_modification_command->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_modification_command->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_modification_command->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if
((
pdu_session_modification_command
->
presence
&
PDU_SESSION_MODIFICATION_COMMAND__5GSM_CAUSE_PRESENCE
)
==
PDU_SESSION_MODIFICATION_COMMAND__5GSM_CAUSE_PRESENCE
)
{
...
...
src/nas/sm/sm_msg.c
View file @
8fc1cc06
...
...
@@ -50,9 +50,7 @@ static int _fivegsm_msg_encode_header(const sm_msg_header_t *header,
int
sm_msg_decode
(
SM_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
header_result
=
0
;
int
decode_result
=
0
;
uint8_t
*
buffer_log
=
buffer
;
uint32_t
len_log
=
len
;
int
down_link
=
0
;
//OAILOG_FUNC_IN (LOG_NAS);
/*
* First decode the SM message header
...
...
@@ -165,8 +163,6 @@ int sm_msg_decode(SM_msg *msg, uint8_t *buffer, uint32_t len) {
int
fivegsm_msg_encode
(
SM_msg
*
msg
,
uint8_t
*
buffer
,
uint32_t
len
)
{
int
header_result
=
0
;
int
encode_result
=
0
;
uint8_t
*
buffer_log
=
buffer
;
int
down_link
=
1
;
/*
* First encode the ESM message header
*/
...
...
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