Commit 90ca2e36 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Fix length of PayloadContainer

parent e046c042
...@@ -39,7 +39,7 @@ Payload_Container::Payload_Container(uint8_t iei, bstring b) { ...@@ -39,7 +39,7 @@ Payload_Container::Payload_Container(uint8_t iei, bstring b) {
_iei = iei; _iei = iei;
content = std::optional<bstring>(b); content = std::optional<bstring>(b);
CONTENT = std::nullopt; CONTENT = std::nullopt;
length = 1 + blength(b); length = blength(b);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -48,15 +48,12 @@ Payload_Container::Payload_Container( ...@@ -48,15 +48,12 @@ Payload_Container::Payload_Container(
_iei = iei; _iei = iei;
content = std::nullopt; content = std::nullopt;
if (_iei) { length = 1; // for number of entries
length = 4; // 1 for IEI, 2 for length, 1 for number of entries
} else {
length = 3; // 2 for length, 1 for number of entries
}
// CONTENT.assign(content.begin(), content.end()); // CONTENT.assign(content.begin(), content.end());
CONTENT = std::optional<std::vector<PayloadContainerEntry>>(contents); CONTENT = std::optional<std::vector<PayloadContainerEntry>>(contents);
for (int i = 0; i < contents.size(); i++) { for (int i = 0; i < contents.size(); i++) {
length = length + 1 + contents.at(i).length; length = length + 2 +
contents.at(i).length; // 2 for Length of Payload container entry
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment