Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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-AMF
Commits
194884c1
Commit
194884c1
authored
Jan 02, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue for decoding/encoding SD
parent
a5e32590
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
src/common/common_defs.h
src/common/common_defs.h
+14
-4
src/nas/ies/Rejected_SNSSAI.cpp
src/nas/ies/Rejected_SNSSAI.cpp
+5
-4
No files found.
src/common/common_defs.h
View file @
194884c1
...
...
@@ -63,8 +63,14 @@ typedef enum {
sIZE += sizeof(uint16_t)
#define DECODE_U24(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*) (bUFFER)) >> 8; \
sIZE += sizeof(uint8_t) + sizeof(uint16_t)
do { \
uint32_t value_tmp = 0; \
uint8_t size_tmp = sizeof(uint8_t) + sizeof(uint16_t); \
memcpy((unsigned char*) &value_tmp, bUFFER, size_tmp); \
vALUE = ntohl(value_tmp); \
vALUE = vALUE >> 8; \
sIZE += size_tmp; \
} while (0)
#define DECODE_U32(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*) (bUFFER)); \
...
...
@@ -89,8 +95,12 @@ typedef enum {
size += sizeof(uint16_t)
#define ENCODE_U24(buffer, value, size) \
*(uint32_t*) (buffer) = htonl(value); \
size += sizeof(uint8_t) + sizeof(uint16_t)
do { \
uint32_t value_tmp = htonl(value << 8); \
uint8_t size_tmp = sizeof(uint8_t) + sizeof(uint16_t); \
memcpy(buffer, (unsigned char*) &value_tmp, size_tmp); \
size += size_tmp; \
} while (0)
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*) (buffer) = htonl(value); \
...
...
src/nas/ies/Rejected_SNSSAI.cpp
View file @
194884c1
...
...
@@ -125,12 +125,13 @@ int Rejected_SNSSAI::encode2buffer(uint8_t* buf, int len) {
ENCODE_U8
(
buf
+
encoded_size
,
sst_
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"SST %d"
,
sst_
);
if
(
sd_
.
has_value
())
{
//
ENCODE_U24(buf + encoded_size, sd_.value(), encoded_size);
ENCODE_U8
(
ENCODE_U24
(
buf
+
encoded_size
,
sd_
.
value
(),
encoded_size
);
/*
ENCODE_U8(
buf + encoded_size, (sd_.value() & 0x00ff0000) >> 16, encoded_size);
ENCODE_U8(
buf + encoded_size, (sd_.value() & 0x0000ff00) >> 8, encoded_size);
ENCODE_U8(buf + encoded_size, (sd_.value() & 0x000000ff), encoded_size);
*/
Logger
::
nas_mm
().
debug
(
"SD 0x%x"
,
sd_
.
value
());
}
Logger
::
nas_mm
().
debug
(
"Encoded Rejected_SNSSAI (len %d)"
,
encoded_size
);
...
...
@@ -152,10 +153,10 @@ int Rejected_SNSSAI::decodefrombuffer(uint8_t* buf, int len) {
cause_
,
sst_
);
}
else
if
(
length_
==
4
)
{
uint32_t
sd
=
0
;
DECODE_U
8
(
buf
+
decoded_size
,
sd
,
decoded_size
);
DECODE_U
24
(
buf
+
decoded_size
,
sd
,
decoded_size
);
sd_
=
std
::
optional
<
uint32_t
>
(
sd
);
Logger
::
nas_mm
().
debug
(
"Decoded Rejected_SNSSAI length 0x%x,cause 0x%x, SST 0x%x, SD 0x%x"
,
"Decoded Rejected_SNSSAI length 0x%x,
cause 0x%x, SST 0x%x, SD 0x%x"
,
length_
,
cause_
,
sst_
,
sd
);
}
else
{
return
-
1
;
// invalid value
...
...
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