Commit d8496bdf authored by luhan's avatar luhan

update libngap: add UEAggregateMaximumBitRate

parent a4562ebf
......@@ -711,7 +711,8 @@ void amf_n2::handle_itti_message(
item.pduSessionResourceSetupRequestTransfer.size = blength(itti_msg.n2sm);
list.push_back(item);
psrsr->setPduSessionResourceSetupRequestList(list);
psrsr->setUEAggregateMaxBitRate(
0x08a7d8c0, 0x20989680);
size_t buffer_size = BUFFER_SIZE_512;
char* buffer = (char*) calloc(1, buffer_size);
int encoded_size = 0;
......
......@@ -21508,6 +21508,19 @@ static asn_TYPE_member_t asn_MBR_Ngap_value_120[] = {
0,
0, /* No default value */
"PDUSessionResourceSetupListSUReq"},
{ATF_NOFLAGS,
0,
offsetof(
struct Ngap_PDUSessionResourceSetupRequestIEs__value,
choice.UEAggregateMaximumBitRate),
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_Ngap_UEAggregateMaximumBitRate,
0,
{0, 0, 0},
0,
0, /* No default value */
"UEAggregateMaximumBitRate"},
};
static const asn_TYPE_tag2member_t asn_MAP_Ngap_value_tag2el_120[] = {
{(ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2}, /* AMF-UE-NGAP-ID */
......@@ -21540,7 +21553,7 @@ static /* Use -fall-defs-global to expose */
0, /* No tags (count) */
{0, 0, OPEN_TYPE_constraint},
asn_MBR_Ngap_value_120,
5, /* Elements count */
6, /* Elements count */
&asn_SPC_Ngap_value_specs_120 /* Additional specs */
};
......@@ -302,7 +302,8 @@ typedef enum Ngap_PDUSessionResourceSetupRequestIEs__value_PR {
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_RAN_UE_NGAP_ID,
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_RANPagingPriority,
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_NAS_PDU,
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_PDUSessionResourceSetupListSUReq
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_PDUSessionResourceSetupListSUReq,
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_UEAggregateMaximumBitRate
} Ngap_PDUSessionResourceSetupRequestIEs__value_PR;
typedef enum Ngap_PDUSessionResourceSetupResponseIEs__value_PR {
Ngap_PDUSessionResourceSetupResponseIEs__value_PR_NOTHING, /* No components
......@@ -1389,6 +1390,7 @@ typedef struct Ngap_PDUSessionResourceSetupRequestIEs {
Ngap_RANPagingPriority_t RANPagingPriority;
Ngap_NAS_PDU_t NAS_PDU;
Ngap_PDUSessionResourceSetupListSUReq_t PDUSessionResourceSetupListSUReq;
Ngap_UEAggregateMaximumBitRate_t UEAggregateMaximumBitRate;
} choice;
/* Context for parsing across buffer boundaries */
......
......@@ -50,10 +50,39 @@ PduSessionResourceSetupRequestMsg::PduSessionResourceSetupRequestMsg() {
ranPagingPriority = NULL;
nasPdu = NULL;
pduSessionResourceSetupRequestList = NULL;
uEAggregateMaxBitRate = NULL;
}
//------------------------------------------------------------------------------
PduSessionResourceSetupRequestMsg::~PduSessionResourceSetupRequestMsg() {}
//-----------------------------------------------------------------------------
void PduSessionResourceSetupRequestMsg::setUEAggregateMaxBitRate(
long bit_rate_downlink, long bit_rate_uplink) {
if (!uEAggregateMaxBitRate)
uEAggregateMaxBitRate = new UEAggregateMaxBitRate();
uEAggregateMaxBitRate->setUEAggregateMaxBitRate(
bit_rate_downlink, bit_rate_uplink);
Ngap_PDUSessionResourceSetupRequestIEs_t* ie =
(Ngap_PDUSessionResourceSetupRequestIEs_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceSetupRequestIEs_t));
ie->id = Ngap_ProtocolIE_ID_id_UEAggregateMaximumBitRate;
ie->criticality = Ngap_Criticality_reject;
ie->value.present =
Ngap_PDUSessionResourceSetupRequestIEs__value_PR_UEAggregateMaximumBitRate;
int ret = uEAggregateMaxBitRate->encode2UEAggregateMaxBitRate(
ie->value.choice.UEAggregateMaximumBitRate);
if (!ret) {
cout << "encode UEAggregateMaxBitRate IE error" << endl;
return;
}
ret = ASN_SEQUENCE_ADD(&pduSessionResourceSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UEAggregateMaxBitRate IE error" << endl;
}
//------------------------------------------------------------------------------
void PduSessionResourceSetupRequestMsg::setMessageType() {
......@@ -266,7 +295,7 @@ int PduSessionResourceSetupRequestMsg::encode2buffer(
//------------------------------------------------------------------------------
void PduSessionResourceSetupRequestMsg::encode2buffer_new(
char* buf, int& encoded_size) {
char* buffer = (char*) calloc(1, 512); // TODO: remove hardcoded value
char* buffer = (char*) calloc(1, 1024); // TODO: remove hardcoded value
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pduSessionResourceSetupRequestPdu);
encoded_size = aper_encode_to_new_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupRequestPdu,
......
......@@ -38,7 +38,7 @@
#include "NAS-PDU.hpp"
#include "PDUSessionResourceSetupListSUReq.hpp"
#include "PduSessionAggregateMaximumBitRate.hpp"
#include "UEAggregateMaxBitRate.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
......@@ -61,6 +61,7 @@ class PduSessionResourceSetupRequestMsg {
std::vector<PDUSessionResourceSetupRequestItem_t> list);
void setPduSessionAggregateMaximumBitRate(
long bit_rate_downlink, long bit_rate_uplink);
void setUEAggregateMaxBitRate(long bit_rate_downlink, long bit_rate_uplink);
int encode2buffer(uint8_t* buf, int buf_size);
void encode2buffer_new(char* buf, int& encoded_size);
// Decapsulation
......@@ -84,6 +85,7 @@ class PduSessionResourceSetupRequestMsg {
NAS_PDU* nasPdu;
PDUSessionResourceSetupListSUReq* pduSessionResourceSetupRequestList;
PduSessionAggregateMaximumBitRate* pduSessionAggregateMaximumBitRate;
UEAggregateMaxBitRate* uEAggregateMaxBitRate;
};
} // namespace ngap
......
......@@ -81,7 +81,7 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(
"Request body, part 2: \n %s", parts[1].body.c_str());
bool is_ngap = false;
if (size > 0) {
if (size > 2) { //change 0 to 2, to fix crashes when pdu session rejected is received
is_ngap = true;
Logger::amf_server().debug(
"Request body, part 3: \n %s", parts[2].body.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