Commit 1c0a44e5 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for bstring

parent c3107524
......@@ -94,19 +94,13 @@ void util::ipv4_to_bstring(struct in_addr ipv4_address, bstring str) {
bitstream_addr[2] = (uint8_t)(((ipv4_address.s_addr) & 0x00ff0000) >> 16);
bitstream_addr[3] = (uint8_t)(((ipv4_address.s_addr) & 0xff000000) >> 24);
str = bfromcstralloc(4, "\0");
// str = bfromcstralloc(4, "\0");
str->slen = 4;
memcpy(str->data, bitstream_addr, sizeof(bitstream_addr));
}
void util::string_to_bstring(const std::string& str, bstring bstr) {
bstr = bfromcstralloc(str.length(), "\0");
// bstr = bfromcstralloc(str.length(), "\0");
bstr->slen = str.length();
memcpy((void*) bstr->data, (void*) str.c_str(), str.length());
/*
std::string s(
(char *)bstr->data,
bstr->slen);
Logger::nrf_app().debug("Str %s", s.c_str());
*/
}
......@@ -59,7 +59,9 @@ int encode_pdu_address(
encoded += encode_result;
// set length
*(uint8_t*) (lenPtr) = encoded - len_pos;
uint16_t temp = 0;
//*(uint8_t*) (lenPtr) = encoded - len_pos;
ENCODE_U8(lenPtr, encoded - len_pos, temp);
return encoded;
}
......
......@@ -152,7 +152,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
return false;
}
sm_msg->pdu_session_establishment_accept.presence = 0x018b;
sm_msg->pdu_session_establishment_accept.presence = 0xff;
sm_msg->pdu_session_establishment_accept._5gsmcause =
static_cast<uint8_t>(sm_cause);
Logger::smf_n1().debug(
......@@ -160,6 +160,8 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
// PDUAddress
paa_t paa = sm_context_res.get_paa();
sm_msg->pdu_session_establishment_accept.pduaddress
.pdu_address_information = bfromcstralloc(4, "\0");
util::ipv4_to_bstring(
paa.ipv4_address, sm_msg->pdu_session_establishment_accept.pduaddress
.pdu_address_information);
......@@ -226,6 +228,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(
.extendedprotocolconfigurationoptions);
// DNN
sm_msg->pdu_session_establishment_accept.dnn = bfromcstralloc(sm_context_res.get_dnn().length(), "\0");
util::string_to_bstring(
sm_context_res.get_dnn(), sm_msg->pdu_session_establishment_accept.dnn);
Logger::smf_n1().debug("DNN %s", sm_context_res.get_dnn().c_str());
......
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