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
d5c229ae
Commit
d5c229ae
authored
Jan 03, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ENCODE_U24 in _5GSTrackingAreaIdList
parent
770d97d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
src/common/common_defs.h
src/common/common_defs.h
+14
-4
src/nas/ies/_5GSTrackingAreaIdList.cpp
src/nas/ies/_5GSTrackingAreaIdList.cpp
+8
-6
No files found.
src/common/common_defs.h
View file @
d5c229ae
...
@@ -63,8 +63,14 @@ typedef enum {
...
@@ -63,8 +63,14 @@ typedef enum {
sIZE += sizeof(uint16_t)
sIZE += sizeof(uint16_t)
#define DECODE_U24(bUFFER, vALUE, sIZE) \
#define DECODE_U24(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*) (bUFFER)) >> 8; \
do { \
sIZE += sizeof(uint8_t) + sizeof(uint16_t)
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) \
#define DECODE_U32(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*) (bUFFER)); \
vALUE = ntohl(*(uint32_t*) (bUFFER)); \
...
@@ -89,8 +95,12 @@ typedef enum {
...
@@ -89,8 +95,12 @@ typedef enum {
size += sizeof(uint16_t)
size += sizeof(uint16_t)
#define ENCODE_U24(buffer, value, size) \
#define ENCODE_U24(buffer, value, size) \
*(uint32_t*) (buffer) = htonl(value); \
do { \
size += sizeof(uint8_t) + sizeof(uint16_t)
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) \
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*) (buffer) = htonl(value); \
*(uint32_t*) (buffer) = htonl(value); \
...
...
src/nas/ies/_5GSTrackingAreaIdList.cpp
View file @
d5c229ae
...
@@ -87,12 +87,14 @@ int _5GSTrackingAreaIdList::encode_00_type(
...
@@ -87,12 +87,14 @@ int _5GSTrackingAreaIdList::encode_00_type(
// Encode TAC list
// Encode TAC list
for
(
int
i
=
0
;
i
<
item
.
tac_list
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
item
.
tac_list
.
size
();
i
++
)
{
// TODO: use ENCODE_U24
// TODO: use ENCODE_U24
octet
=
(
item
.
tac_list
[
i
]
&
0x00ff0000
)
>>
16
;
ENCODE_U24
(
buf
+
encoded_size
,
item
.
tac_list
[
i
],
encoded_size
);
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
/*
octet
=
(
item
.
tac_list
[
i
]
&
0x0000ff00
)
>>
8
;
octet = (item.tac_list[i] & 0x00ff0000) >> 16;
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
ENCODE_U8(buf + encoded_size, octet, encoded_size);
octet
=
(
item
.
tac_list
[
i
]
&
0x000000ff
)
>>
0
;
octet = (item.tac_list[i] & 0x0000ff00) >> 8;
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
ENCODE_U8(buf + encoded_size, octet, encoded_size);
octet = (item.tac_list[i] & 0x000000ff) >> 0;
ENCODE_U8(buf + encoded_size, octet, encoded_size);*/
}
}
return
encoded_size
;
return
encoded_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