Commit b184e52a authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Fix encode NGAP message

parent 3314affb
......@@ -1031,11 +1031,10 @@ void amf_n2::handle_itti_message(
psrsr->setPduSessionResourceSetupRequestList(list);
psrsr->setUEAggregateMaxBitRate(
UE_AGGREGATE_MAXIMUM_BIT_RATE_DL, UE_AGGREGATE_MAXIMUM_BIT_RATE_UL);
size_t buffer_size = BUFFER_SIZE_512;
uint8_t buffer[BUFFER_SIZE_4096]; // = (uint8_t*) calloc(1, buffer_size);
uint8_t* buffer = (uint8_t*) calloc(1, BUFFER_SIZE_4096);
int encoded_size = 0;
psrsr->encode2NewBuffer((uint8_t**) &buffer, encoded_size);
psrsr->encode2NewBuffer(buffer, encoded_size);
#if DEBUG_IS_ON
Logger::amf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
......@@ -1094,9 +1093,9 @@ void amf_n2::handle_itti_message(
modify_request_msg->setPduSessionResourceModifyRequestList(list);
uint8_t buffer[BUFFER_SIZE_4096];
uint8_t* buffer = (uint8_t*) calloc(1, BUFFER_SIZE_4096);
int encoded_size = 0;
modify_request_msg->encode2NewBuffer((uint8_t**) &buffer, encoded_size);
modify_request_msg->encode2NewBuffer(buffer, encoded_size);
#if DEBUG_IS_ON
Logger::amf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
......@@ -1151,9 +1150,9 @@ void amf_n2::handle_itti_message(
list.push_back(item);
release_cmd_msg->setPduSessionResourceToReleaseList(list);
uint8_t buffer[BUFFER_SIZE_4096];
uint8_t* buffer = (uint8_t*) calloc(1, BUFFER_SIZE_4096);
int encoded_size = 0;
release_cmd_msg->encode2NewBuffer((uint8_t**) &buffer, encoded_size);
release_cmd_msg->encode2NewBuffer(buffer, encoded_size);
#if DEBUG_IS_ON
Logger::amf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
......
......@@ -469,10 +469,10 @@ int NgapMessage::encode2Buffer(uint8_t* buf, int bufSize) {
}
//------------------------------------------------------------------------------
void NgapMessage::encode2NewBuffer(uint8_t** buf, int& encoded_size) {
void NgapMessage::encode2NewBuffer(uint8_t*& buf, int& encoded_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngapPdu);
encoded_size = aper_encode_to_new_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngapPdu, (void**) buf);
&asn_DEF_Ngap_NGAP_PDU, NULL, ngapPdu, (void**) &buf);
Logger::ngap().debug("Encoded message size ( %d )", encoded_size);
return;
}
......
......@@ -126,7 +126,7 @@ class NgapMessage {
void setMessageType(NgapMessageType messageType);
virtual bool decodeFromPdu(Ngap_NGAP_PDU_t* msgPdu) = 0;
int encode2Buffer(uint8_t* buf, int bufSize);
void encode2NewBuffer(uint8_t** buf, int& encoded_size);
void encode2NewBuffer(uint8_t*& buf, int& encoded_size);
protected:
Ngap_NGAP_PDU_t* ngapPdu;
......
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