HelloWorld E2SM source
Issue-ID: RICAPP-67
Signed-off-by: sjana <sj492a@att.com>
Change-Id: Id3f0c7a16a7948c1dd6954dfaf6b1b2dd1c7e196
diff --git a/src/Makefile b/src/Makefile
index 62bac72..c8a0b6d 100755
--- a/src/Makefile
+++ b/src/Makefile
@@ -7,14 +7,14 @@
MSGSRC:=./xapp-mgmt
ASNSRC:=../asn1c_defs
-E2APSRC:=./xapp-formats/e2ap
-E2SMSRC:=./xapp-formats/e2sm
+E2APSRC:=./xapp-asn/e2ap
+E2SMSRC:=./xapp-asn/e2sm
####### Logging library and flags
CLOGFLAGS:= `pkg-config mdclog --cflags`
LOG_LIBS:= `pkg-config mdclog --libs`
CURL_LIBS:= `pkg-config libcurl --libs`
-RNIB_LIBS:= -pthread /usr/local/lib/rnibreader_old.a
+RNIB_LIBS:= -pthread /usr/local/include/rnib/rnibreader.a
######## Keep include dirs separate so we have transparency
diff --git a/src/hw_xapp_main.cc b/src/hw_xapp_main.cc
index aa51d20..655f452 100644
--- a/src/hw_xapp_main.cc
+++ b/src/hw_xapp_main.cc
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,21 +51,47 @@
signal(SIGTERM, signalHandler);
//getting the listening port and xapp name info
- std::string port = config[XappSettings::SettingName::HW_PORTS];
+ std::string port = config[XappSettings::SettingName::HW_PORT];
std::string name = config[XappSettings::SettingName::XAPP_NAME];
//initialize rmr
- std::unique_ptr<XappRmr> rmr;
- rmr = std::make_unique<XappRmr>(port);
- rmr->xapp_rmr_init();
+ std::unique_ptr<XappRmr> rmr = std::make_unique<XappRmr>(port);
+ rmr->xapp_rmr_init(true);
- std::unique_ptr<Xapp> hw_xapp = std::make_unique<Xapp>(std::ref(config),std::ref(*rmr));
- //hw_xapp->startup();
+ //Create Subscription Handler if Xapp deals with Subscription.
+ bool sub_required = true;
+ std::unique_ptr<SubscriptionHandler> sub_handler = std::make_unique<SubscriptionHandler>();
- std::unique_ptr<XappMsgHandler> mp_handler = std::make_unique<XappMsgHandler>(config[XappSettings::SettingName::XAPP_ID]);
- //hw_xapp->register_handler(std::bind(&XappMsgHandler::operator (),mp_handler.get(),std::placeholders::_1,std::placeholders::_2));
- hw_xapp->start_xapp_receiver(std::ref(*mp_handler));
+ //create HelloWorld Xapp Instance.
+ std::unique_ptr<Xapp> hw_xapp;
+ if(sub_required)
+ hw_xapp = std::make_unique<Xapp>(std::ref(config),std::ref(*rmr), std::ref(*sub_handler));
+ else
+ hw_xapp = std::make_unique<Xapp>(std::ref(config),std::ref(*rmr));
+
+ mdclog_write(MDCLOG_INFO, "Created Hello World Xapp Instance");
+
+ sleep(1);
+ //Startup E2 subscription and A1 policy
+ hw_xapp->startup();
+
+
+ //start listener threads and register message handlers.
+ int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]);
+ for(int j=0; j < num_threads; j++) {
+ std::unique_ptr<XappMsgHandler> mp_handler;
+ if(sub_required)
+ mp_handler = std::make_unique<XappMsgHandler>(config[XappSettings::SettingName::XAPP_ID], std::ref(*sub_handler));
+ else
+ mp_handler = std::make_unique<XappMsgHandler>(config[XappSettings::SettingName::XAPP_ID]);
+
+ hw_xapp->register_handler(std::ref(*mp_handler));
+ }
+
+ mdclog_write(MDCLOG_INFO, "Starting Listener Threads. Number of Workers = %d", num_threads);
+
+ hw_xapp->Run();
//Delete all subscriptions if any based on Xapp Mode.
//xapp->shutdown();
diff --git a/src/routes.txt b/src/routes.txt
index 2bcd6d3..7feb73a 100755
--- a/src/routes.txt
+++ b/src/routes.txt
@@ -1,19 +1,13 @@
newrt|start
-rte|0|localhost:4560
-rte|2|localhost:38000
-rte|100|localhost:4560
-rte|20010|localhost:4560
-rte|10002|localhost:4560
-rte|10005|localhost:4560
-rte|10003|localhost:38000
-rte|12010|localhost:38000
-rte|12020|localhost:38000
-rte|12011|localhost:4560
-rte|12012|localhost:4560
-rte|12021|localhost:4560
-rte|12022|localhost:4560
-rte|20000|localhost:4560
-rte|12040|localhost:38000
-rte|20001|localhost:4566
-rte|20012|localhost:4560
+rte|100|127.0.0.1:4560
+rte|101|127.0.0.1:4560
+rte|20010|127.0.0.1:4560
+rte|20011|127.0.0.1:4560
+rte|20012|127.0.0.1:4560
+rte|12010|127.0.0.1:4560
+rte|12011|127.0.0.1:4560
+rte|12012|127.0.0.1:4560
+rte|12020|127.0.0.1:4560
+rte|12021|127.0.0.1:4560
+rte|12022|127.0.0.1:4560
newrt|end
diff --git a/src/xapp-asn/e2ap/e2ap_control.cc b/src/xapp-asn/e2ap/e2ap_control.cc
index e66ddec..638b618 100644
--- a/src/xapp-asn/e2ap/e2ap_control.cc
+++ b/src/xapp-asn/e2ap/e2ap_control.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -33,18 +33,18 @@
ric_control_request::ric_control_request(void){
e2ap_pdu_obj = 0;
- e2ap_pdu_obj = (E2N_E2AP_PDU_t * )calloc(1, sizeof(E2N_E2AP_PDU_t));
+ e2ap_pdu_obj = (E2AP_PDU_t * )calloc(1, sizeof(E2AP_PDU_t));
assert(e2ap_pdu_obj != 0);
initMsg = 0;
- initMsg = (E2N_InitiatingMessage_t * )calloc(1, sizeof(E2N_InitiatingMessage_t));
+ initMsg = (InitiatingMessage_t * )calloc(1, sizeof(InitiatingMessage_t));
assert(initMsg != 0);
IE_array = 0;
- IE_array = (E2N_RICcontrolRequest_IEs_t *)calloc(NUM_CONTROL_REQUEST_IES, sizeof(E2N_RICcontrolRequest_IEs_t));
+ IE_array = (RICcontrolRequest_IEs_t *)calloc(NUM_CONTROL_REQUEST_IES, sizeof(RICcontrolRequest_IEs_t));
assert(IE_array != 0);
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_initiatingMessage;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_initiatingMessage;
e2ap_pdu_obj->choice.initiatingMessage = initMsg;
@@ -56,7 +56,7 @@
mdclog_write(MDCLOG_DEBUG, "Freeing E2AP Control Request object memory");
- E2N_RICcontrolRequest_t *ricControl_Request = &(initMsg->value.choice.RICcontrolRequest);
+ RICcontrolRequest_t *ricControl_Request = &(initMsg->value.choice.RICcontrolRequest);
for(int i = 0; i < ricControl_Request->protocolIEs.list.size; i++){
ricControl_Request->protocolIEs.list.array[i] = 0;
}
@@ -71,17 +71,17 @@
free(initMsg);
e2ap_pdu_obj->choice.initiatingMessage = 0;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
- mdclog_write(MDCLOG_DEBUG, "Freed E2N_E2AP Control Request object mempory");
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
+ mdclog_write(MDCLOG_DEBUG, "Freed E2AP Control Request object mempory");
}
bool ric_control_request::encode_e2ap_control_request(unsigned char *buf, size_t *size, ric_control_helper & dinput){
- initMsg->procedureCode = E2N_ProcedureCode_id_ricControl;
- initMsg->criticality = E2N_Criticality_ignore;
- initMsg->value.present = E2N_InitiatingMessage__value_PR_RICcontrolRequest;
+ initMsg->procedureCode = ProcedureCode_id_RICcontrol;
+ initMsg->criticality = Criticality_ignore;
+ initMsg->value.present = InitiatingMessage__value_PR_RICcontrolRequest;
bool res;
@@ -90,16 +90,16 @@
return false;
}
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
if(ret_constr){
error_string.assign(errbuf, errbuf_len);
error_string = "Constraints failed for encoding control . Reason = " + error_string;
return false;
}
- //xer_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ //xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
if(retval.encoded == -1){
error_string.assign(strerror(errno));
@@ -119,7 +119,7 @@
}
-bool ric_control_request::set_fields(E2N_InitiatingMessage_t *initMsg, ric_control_helper &dinput){
+bool ric_control_request::set_fields(InitiatingMessage_t *initMsg, ric_control_helper &dinput){
unsigned int ie_index;
if (initMsg == 0){
@@ -127,7 +127,7 @@
return false;
}
- E2N_RICcontrolRequest_t * ric_control_request = &(initMsg->value.choice.RICcontrolRequest);
+ RICcontrolRequest_t * ric_control_request = &(initMsg->value.choice.RICcontrolRequest);
ric_control_request->protocolIEs.list.count = 0; // reset
// for(i = 0; i < NUM_CONTROL_REQUEST_IES;i++){
@@ -136,44 +136,44 @@
// Mandatory IE
ie_index = 0;
- E2N_RICcontrolRequest_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICcontrolRequest_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ RICcontrolRequest_IEs_t *ies_ricreq = &IE_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICcontrolRequest_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = dinput.req_id;
- ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
+ //ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
ASN_SEQUENCE_ADD(&(ric_control_request->protocolIEs), &(IE_array[ie_index]));
// Mandatory IE
ie_index = 1;
- E2N_RICcontrolRequest_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICcontrolRequest_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICcontrolRequest_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICcontrolRequest_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = dinput.func_id;
ASN_SEQUENCE_ADD(&(ric_control_request->protocolIEs), &(IE_array[ie_index]));
// Mandatory IE
ie_index = 2;
- E2N_RICcontrolRequest_IEs_t *ies_richead = &IE_array[ie_index];
- ies_richead->criticality = E2N_Criticality_reject;
- ies_richead->id = E2N_ProtocolIE_ID_id_RICcontrolHeader;
- ies_richead->value.present = E2N_RICcontrolRequest_IEs__value_PR_RICcontrolHeader;
- E2N_RICcontrolHeader_t *richeader_ie = &ies_richead->value.choice.RICcontrolHeader;
+ RICcontrolRequest_IEs_t *ies_richead = &IE_array[ie_index];
+ ies_richead->criticality = Criticality_reject;
+ ies_richead->id = ProtocolIE_ID_id_RICcontrolHeader;
+ ies_richead->value.present = RICcontrolRequest_IEs__value_PR_RICcontrolHeader;
+ RICcontrolHeader_t *richeader_ie = &ies_richead->value.choice.RICcontrolHeader;
richeader_ie->buf = dinput.control_header;
richeader_ie->size = dinput.control_header_size;
ASN_SEQUENCE_ADD(&(ric_control_request->protocolIEs), &(IE_array[ie_index]));
// Mandatory IE
ie_index = 3;
- E2N_RICcontrolRequest_IEs_t *ies_indmsg = &IE_array[ie_index];
- ies_indmsg->criticality = E2N_Criticality_reject;
- ies_indmsg->id = E2N_ProtocolIE_ID_id_RICcontrolMessage;
- ies_indmsg->value.present = E2N_RICcontrolRequest_IEs__value_PR_RICcontrolMessage;
- E2N_RICcontrolMessage_t *ricmsg_ie = &ies_indmsg->value.choice.RICcontrolMessage;
+ RICcontrolRequest_IEs_t *ies_indmsg = &IE_array[ie_index];
+ ies_indmsg->criticality = Criticality_reject;
+ ies_indmsg->id = ProtocolIE_ID_id_RICcontrolMessage;
+ ies_indmsg->value.present = RICcontrolRequest_IEs__value_PR_RICcontrolMessage;
+ RICcontrolMessage_t *ricmsg_ie = &ies_indmsg->value.choice.RICcontrolMessage;
ricmsg_ie->buf = dinput.control_msg;
ricmsg_ie->size = dinput.control_msg_size;
ASN_SEQUENCE_ADD(&(ric_control_request->protocolIEs), &(IE_array[ie_index]));
@@ -181,11 +181,11 @@
// Optional IE
ie_index = 4;
if (dinput.control_ack >= 0){
- E2N_RICcontrolRequest_IEs_t *ies_indtyp = &IE_array[ie_index];
- ies_indtyp->criticality = E2N_Criticality_reject;
- ies_indtyp->id = E2N_ProtocolIE_ID_id_RICcontrolAckRequest;
- ies_indtyp->value.present = E2N_RICcontrolRequest_IEs__value_PR_RICcontrolAckRequest;
- E2N_RICcontrolAckRequest_t *ricackreq_ie = &ies_indtyp->value.choice.RICcontrolAckRequest;
+ RICcontrolRequest_IEs_t *ies_indtyp = &IE_array[ie_index];
+ ies_indtyp->criticality = Criticality_reject;
+ ies_indtyp->id = ProtocolIE_ID_id_RICcontrolAckRequest;
+ ies_indtyp->value.present = RICcontrolRequest_IEs__value_PR_RICcontrolAckRequest;
+ RICcontrolAckRequest_t *ricackreq_ie = &ies_indtyp->value.choice.RICcontrolAckRequest;
*ricackreq_ie = dinput.control_ack;
ASN_SEQUENCE_ADD(&(ric_control_request->protocolIEs), &(IE_array[ie_index]));
}
@@ -193,11 +193,11 @@
// Optional IE
ie_index = 5;
if(dinput.call_process_id_size > 0){
- E2N_RICcontrolRequest_IEs_t *ies_callprocid = &IE_array[ie_index];
- ies_callprocid->criticality = E2N_Criticality_reject;
- ies_callprocid->id = E2N_ProtocolIE_ID_id_RICcallProcessID;
- ies_callprocid->value.present = E2N_RICcontrolRequest_IEs__value_PR_RICcallProcessID;
- E2N_RICcallProcessID_t *riccallprocessid_ie = &ies_callprocid->value.choice.RICcallProcessID;
+ RICcontrolRequest_IEs_t *ies_callprocid = &IE_array[ie_index];
+ ies_callprocid->criticality = Criticality_reject;
+ ies_callprocid->id = ProtocolIE_ID_id_RICcallProcessID;
+ ies_callprocid->value.present = RICcontrolRequest_IEs__value_PR_RICcallProcessID;
+ RICcallProcessID_t *riccallprocessid_ie = &ies_callprocid->value.choice.RICcallProcessID;
riccallprocessid_ie->buf = dinput.call_process_id;
riccallprocessid_ie->size = dinput.call_process_id_size;
ASN_SEQUENCE_ADD(&(ric_control_request->protocolIEs), &(IE_array[ie_index]));
@@ -210,7 +210,7 @@
-bool ric_control_request:: get_fields(E2N_InitiatingMessage_t * init_msg, ric_control_helper &dout)
+bool ric_control_request:: get_fields(InitiatingMessage_t * init_msg, ric_control_helper &dout)
{
if (init_msg == 0){
error_string = "Invalid reference for E2AP Control_Request message in get_fields";
@@ -219,35 +219,35 @@
for(int edx = 0; edx < init_msg->value.choice.RICcontrolRequest.protocolIEs.list.count; edx++) {
- E2N_RICcontrolRequest_IEs_t *memb_ptr = init_msg->value.choice.RICcontrolRequest.protocolIEs.list.array[edx];
+ RICcontrolRequest_IEs_t *memb_ptr = init_msg->value.choice.RICcontrolRequest.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICcontrolHeader):
+ case (ProtocolIE_ID_id_RICcontrolHeader):
dout.control_header = memb_ptr->value.choice.RICcontrolHeader.buf;
dout.control_header_size = memb_ptr->value.choice.RICcontrolHeader.size;
break;
- case (E2N_ProtocolIE_ID_id_RICcontrolMessage):
+ case (ProtocolIE_ID_id_RICcontrolMessage):
dout.control_msg = memb_ptr->value.choice.RICcontrolMessage.buf;
dout.control_msg_size = memb_ptr->value.choice.RICcontrolMessage.size;
break;
- case (E2N_ProtocolIE_ID_id_RICcallProcessID):
+ case (ProtocolIE_ID_id_RICcallProcessID):
dout.call_process_id = memb_ptr->value.choice.RICcallProcessID.buf;
dout.call_process_id_size = memb_ptr->value.choice.RICcallProcessID.size;
break;
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
dout.req_id = memb_ptr->value.choice.RICrequestID.ricRequestorID;
- dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
+ //dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
dout.func_id = memb_ptr->value.choice.RANfunctionID;
break;
- case (E2N_ProtocolIE_ID_id_RICcontrolAckRequest):
+ case (ProtocolIE_ID_id_RICcontrolAckRequest):
dout.control_ack = memb_ptr->value.choice.RICcontrolAckRequest;
break;
@@ -261,6 +261,6 @@
}
-E2N_InitiatingMessage_t * ric_control_request::get_message(void) {
+InitiatingMessage_t * ric_control_request::get_message(void) {
return initMsg;
}
diff --git a/src/xapp-asn/e2ap/e2ap_control.hpp b/src/xapp-asn/e2ap/e2ap_control.hpp
index 57a2e2d..2a2272c 100644
--- a/src/xapp-asn/e2ap/e2ap_control.hpp
+++ b/src/xapp-asn/e2ap/e2ap_control.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,10 +31,10 @@
#include <errno.h>
#include <mdclog/mdclog.h>
#include <sstream>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_InitiatingMessage.h>
-#include <E2N_RICcontrolRequest.h>
-#include <E2N_ProtocolIE-Field.h>
+#include <E2AP-PDU.h>
+#include <InitiatingMessage.h>
+#include <RICcontrolRequest.h>
+#include <ProtocolIE-Field.h>
#include "e2ap_control_helper.hpp"
#define NUM_CONTROL_REQUEST_IES 6
@@ -47,15 +47,15 @@
~ric_control_request(void);
bool encode_e2ap_control_request(unsigned char *, size_t *, ric_control_helper &);
- E2N_InitiatingMessage_t * get_message (void) ;
- bool set_fields(E2N_InitiatingMessage_t *, ric_control_helper &);
- bool get_fields(E2N_InitiatingMessage_t *, ric_control_helper &);
+ InitiatingMessage_t * get_message (void) ;
+ bool set_fields(InitiatingMessage_t *, ric_control_helper &);
+ bool get_fields(InitiatingMessage_t *, ric_control_helper &);
std::string get_error(void) const {return error_string ; };
private:
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
- E2N_InitiatingMessage_t *initMsg;
- E2N_RICcontrolRequest_IEs_t *IE_array;
+ E2AP_PDU_t * e2ap_pdu_obj;
+ InitiatingMessage_t *initMsg;
+ RICcontrolRequest_IEs_t *IE_array;
std::string error_string;
char errbuf[128];
diff --git a/src/xapp-asn/e2ap/e2ap_control_helper.hpp b/src/xapp-asn/e2ap/e2ap_control_helper.hpp
index 11f668c..d01013e 100644
--- a/src/xapp-asn/e2ap/e2ap_control_helper.hpp
+++ b/src/xapp-asn/e2ap/e2ap_control_helper.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/xapp-asn/e2ap/e2ap_control_response.cc b/src/xapp-asn/e2ap/e2ap_control_response.cc
index 23ef9ae..6b7c9b5 100644
--- a/src/xapp-asn/e2ap/e2ap_control_response.cc
+++ b/src/xapp-asn/e2ap/e2ap_control_response.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================================
-*/
+ */
/*
* ric_control_response.c
*
@@ -32,384 +32,384 @@
ric_control_response::ric_control_response(void){
- e2ap_pdu_obj = 0;
- e2ap_pdu_obj = (E2N_E2AP_PDU_t * )calloc(1, sizeof(E2N_E2AP_PDU_t));
- assert(e2ap_pdu_obj != 0);
+ e2ap_pdu_obj = 0;
+ e2ap_pdu_obj = (E2AP_PDU_t * )calloc(1, sizeof(E2AP_PDU_t));
+ assert(e2ap_pdu_obj != 0);
- successMsg = 0;
- successMsg = (E2N_SuccessfulOutcome_t * )calloc(1, sizeof(E2N_SuccessfulOutcome_t));
- assert(successMsg != 0);
+ successMsg = 0;
+ successMsg = (SuccessfulOutcome_t * )calloc(1, sizeof(SuccessfulOutcome_t));
+ assert(successMsg != 0);
- successMsg->procedureCode = E2N_ProcedureCode_id_ricControl;
- successMsg->criticality = E2N_Criticality_reject;
- successMsg->value.present = E2N_SuccessfulOutcome__value_PR_RICcontrolAcknowledge;
-
-
- unsuccessMsg = 0;
- unsuccessMsg = (E2N_UnsuccessfulOutcome_t * )calloc(1, sizeof(E2N_UnsuccessfulOutcome_t));
- assert(unsuccessMsg != 0);
+ successMsg->procedureCode = ProcedureCode_id_RICcontrol;
+ successMsg->criticality = Criticality_reject;
+ successMsg->value.present = SuccessfulOutcome__value_PR_RICcontrolAcknowledge;
-
- unsuccessMsg->procedureCode = E2N_ProcedureCode_id_ricControl;
- unsuccessMsg->criticality = E2N_Criticality_reject;
- unsuccessMsg->value.present = E2N_UnsuccessfulOutcome__value_PR_RICcontrolFailure;
- IE_array = 0;
- IE_array = (E2N_RICcontrolAcknowledge_IEs_t *)calloc(NUM_CONTROL_ACKNOWLEDGE_IES, sizeof(E2N_RICcontrolAcknowledge_IEs_t));
- assert(IE_array != 0);
+ unsuccessMsg = 0;
+ unsuccessMsg = (UnsuccessfulOutcome_t * )calloc(1, sizeof(UnsuccessfulOutcome_t));
+ assert(unsuccessMsg != 0);
- E2N_RICcontrolAcknowledge_t * ric_acknowledge = &(successMsg->value.choice.RICcontrolAcknowledge);
- for(int i = 0; i < NUM_CONTROL_ACKNOWLEDGE_IES; i++){
- ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), &(IE_array[i]));
- }
-
- IE_failure_array = 0;
- IE_failure_array = (E2N_RICcontrolFailure_IEs_t *)calloc(NUM_CONTROL_FAILURE_IES, sizeof(E2N_RICcontrolFailure_IEs_t));
- assert(IE_failure_array != 0);
+ unsuccessMsg->procedureCode = ProcedureCode_id_RICcontrol;
+ unsuccessMsg->criticality = Criticality_reject;
+ unsuccessMsg->value.present = UnsuccessfulOutcome__value_PR_RICcontrolFailure;
- E2N_RICcontrolFailure_t * ric_failure = &(unsuccessMsg->value.choice.RICcontrolFailure);
- for(int i = 0; i < NUM_CONTROL_FAILURE_IES; i++){
- ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), &(IE_failure_array[i]));
- }
-
+ IE_array = 0;
+ IE_array = (RICcontrolAcknowledge_IEs_t *)calloc(NUM_CONTROL_ACKNOWLEDGE_IES, sizeof(RICcontrolAcknowledge_IEs_t));
+ assert(IE_array != 0);
+
+ RICcontrolAcknowledge_t * ric_acknowledge = &(successMsg->value.choice.RICcontrolAcknowledge);
+ for(int i = 0; i < NUM_CONTROL_ACKNOWLEDGE_IES; i++){
+ ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), &(IE_array[i]));
+ }
+
+
+ IE_failure_array = 0;
+ IE_failure_array = (RICcontrolFailure_IEs_t *)calloc(NUM_CONTROL_FAILURE_IES, sizeof(RICcontrolFailure_IEs_t));
+ assert(IE_failure_array != 0);
+
+ RICcontrolFailure_t * ric_failure = &(unsuccessMsg->value.choice.RICcontrolFailure);
+ for(int i = 0; i < NUM_CONTROL_FAILURE_IES; i++){
+ ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), &(IE_failure_array[i]));
+ }
+
};
// Clear assigned protocolIE list from RIC control_request IE container
ric_control_response::~ric_control_response(void){
- mdclog_write(MDCLOG_DEBUG, "Freeing E2AP Control Response object memory");
-
- E2N_RICcontrolAcknowledge_t * ric_acknowledge = &(successMsg->value.choice.RICcontrolAcknowledge);
- for(int i = 0; i < ric_acknowledge->protocolIEs.list.size; i++){
- ric_acknowledge->protocolIEs.list.array[i] = 0;
- }
- if (ric_acknowledge->protocolIEs.list.size > 0){
- free(ric_acknowledge->protocolIEs.list.array);
- ric_acknowledge->protocolIEs.list.array = 0;
- ric_acknowledge->protocolIEs.list.count = 0;
- }
+ mdclog_write(MDCLOG_DEBUG, "Freeing E2AP Control Response object memory");
- E2N_RICcontrolFailure_t * ric_failure = &(unsuccessMsg->value.choice.RICcontrolFailure);
- for(int i = 0; i < ric_failure->protocolIEs.list.size; i++){
- ric_failure->protocolIEs.list.array[i] = 0;
- }
- if (ric_failure->protocolIEs.list.size > 0){
- free(ric_failure->protocolIEs.list.array);
- ric_failure->protocolIEs.list.array = 0;
- ric_failure->protocolIEs.list.count = 0;
- }
-
- free(IE_array);
- free(IE_failure_array);
- free(successMsg);
- free(unsuccessMsg);
+ RICcontrolAcknowledge_t * ric_acknowledge = &(successMsg->value.choice.RICcontrolAcknowledge);
+ for(int i = 0; i < ric_acknowledge->protocolIEs.list.size; i++){
+ ric_acknowledge->protocolIEs.list.array[i] = 0;
+ }
+ if (ric_acknowledge->protocolIEs.list.size > 0){
+ free(ric_acknowledge->protocolIEs.list.array);
+ ric_acknowledge->protocolIEs.list.array = 0;
+ ric_acknowledge->protocolIEs.list.count = 0;
+ }
- e2ap_pdu_obj->choice.initiatingMessage = 0;
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_initiatingMessage;
-
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
- mdclog_write(MDCLOG_DEBUG, "Freed E2AP Control Response object mempory");
+ RICcontrolFailure_t * ric_failure = &(unsuccessMsg->value.choice.RICcontrolFailure);
+ for(int i = 0; i < ric_failure->protocolIEs.list.size; i++){
+ ric_failure->protocolIEs.list.array[i] = 0;
+ }
+ if (ric_failure->protocolIEs.list.size > 0){
+ free(ric_failure->protocolIEs.list.array);
+ ric_failure->protocolIEs.list.array = 0;
+ ric_failure->protocolIEs.list.count = 0;
+ }
+
+ free(IE_array);
+ free(IE_failure_array);
+ free(successMsg);
+ free(unsuccessMsg);
+
+ e2ap_pdu_obj->choice.initiatingMessage = 0;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_initiatingMessage;
+
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
+ mdclog_write(MDCLOG_DEBUG, "Freed E2AP Control Response object mempory");
}
bool ric_control_response::encode_e2ap_control_response(unsigned char *buf, size_t *size, ric_control_helper & dinput, bool is_success){
- bool res;
- if (is_success){
- res = set_fields(successMsg, dinput);
- }
- else{
- res = set_fields(unsuccessMsg, dinput);
- }
-
- if (!res){
- return false;
- }
+ bool res;
+ if (is_success){
+ res = set_fields(successMsg, dinput);
+ }
+ else{
+ res = set_fields(unsuccessMsg, dinput);
+ }
-
- if (is_success){
- e2ap_pdu_obj->choice.successfulOutcome = successMsg;
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_successfulOutcome ;
- }
- else{
- e2ap_pdu_obj->choice.unsuccessfulOutcome = unsuccessMsg;
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_unsuccessfulOutcome ;
-
- }
-
- //xer_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
-
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
- if(ret_constr){
- error_string.assign(errbuf, errbuf_len);
- error_string = "Constraints failed for encoding control response. Reason = " + error_string;
- return false;
- }
-
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
-
- if(retval.encoded == -1){
- error_string.assign(strerror(errno));
- return false;
- }
- else {
- if(*size < retval.encoded){
- std::stringstream ss;
- ss <<"Error encoding E2AP Control response . Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
- error_string = ss.str();
- return false;
- }
- }
-
- *size = retval.encoded;
- return true;
-
-}
-
-bool ric_control_response::set_fields(E2N_SuccessfulOutcome_t *successMsg, ric_control_helper &dinput){
- unsigned int ie_index;
-
- if (successMsg == 0){
- error_string = "Invalid reference for E2AP Control Acknowledge in set_fields";
- return false;
- }
-
- // for(i = 0; i < NUM_CONTROL_ACKNOWLEDGE_IES;i++){
- // memset(&(IE_array[i]), 0, sizeof(RICcontrolAcknowledge_IEs_t));
- // }
-
- //E2N_RICcontrolAcknowledge_t * ric_acknowledge = &(successMsg->value.choice.RICcontrolAcknowledge);
- //ric_acknowledge->protocolIEs.list.count = 0;
-
- ie_index = 0;
- E2N_RICcontrolAcknowledge_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICcontrolAcknowledge_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
- ricrequest_ie->ricRequestorID = dinput.req_id;
- ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
- //ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_ricreq);
-
- ie_index = 1;
- E2N_RICcontrolAcknowledge_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICcontrolAcknowledge_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
- *ranfunction_ie = dinput.func_id;
- //ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_ranfunc);
-
- // ie_index = 2;
- // E2N_RICcontrolAcknowledge_IEs_t *ies_riccallprocessid = &IE_array[ie_index];
- // ies_riccallprocessid->criticality = E2N_Criticality_reject;
- // ies_riccallprocessid->id = E2N_ProtocolIE_ID_id_RICcallProcessID;
- // ies_riccallprocessid->value.present = E2N_RICcontrolAcknowledge_IEs__value_PR_RICcallProcessID;
- // RICcallProcessID_t *riccallprocessid_ie = &ies_riccallprocessid->value.choice.RICcallProcessID;
- // riccallprocessid_ie->buf = dinput.call_process_id;
- // riccallprocessid_ie->size = dinput.call_process_id_size;
- // ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_riccallprocessid);
-
- ie_index = 2;
- E2N_RICcontrolAcknowledge_IEs_t *ies_ric_cause = &IE_array[ie_index];
- ies_ric_cause->criticality = E2N_Criticality_reject;
- ies_ric_cause->id = E2N_ProtocolIE_ID_id_RICcontrolStatus;
- ies_ric_cause->value.present = E2N_RICcontrolAcknowledge_IEs__value_PR_RICcontrolStatus;
- ies_ric_cause->value.choice.RICcontrolStatus = dinput.control_status;
- //ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_ric_cause);
-
- return true;
-
-};
-
-bool ric_control_response::set_fields(E2N_UnsuccessfulOutcome_t *unsuccessMsg, ric_control_helper &dinput){
- unsigned int ie_index;
-
- if (unsuccessMsg == 0){
- error_string = "Invalid reference for E2AP Control Failure in set_fields";
- return false;
- }
-
- // for(i = 0; i < NUM_CONTROL_FAILURE_IES;i++){
- // memset(&(IE_failure_array[i]), 0, sizeof(RICcontrolFailure_IEs_t));
- // }
-
- //E2N_RICcontrolFailure_t * ric_failure = &(unsuccessMsg->value.choice.RICcontrolFailure);
- //ric_failure->protocolIEs.list.count = 0;
-
- ie_index = 0;
- E2N_RICcontrolFailure_IEs_t *ies_ricreq = &IE_failure_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICcontrolFailure_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &(ies_ricreq->value.choice.RICrequestID);
- ricrequest_ie->ricRequestorID = dinput.req_id;
- ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
- //ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_ricreq);
-
- ie_index = 1;
- E2N_RICcontrolFailure_IEs_t *ies_ranfunc = &IE_failure_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICcontrolFailure_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &(ies_ranfunc->value.choice.RANfunctionID);
- *ranfunction_ie = dinput.func_id;
- //ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_ranfunc);
-
- // ie_index = 2;
- // E2N_RICcontrolFailure_IEs_t *ies_riccallprocessid = &IE_failure_array[i];
- // ies_riccallprocessid->criticality = E2N_Criticality_reject;
- // ies_riccallprocessid->id = E2N_ProtocolIE_ID_id_RICcallProcessID;
- // ies_riccallprocessid->value.present = E2N_RICcontrolFailure_IEs__value_PR_RICcallProcessID;
- // RICcallProcessID_t *riccallprocessid_ie = &(ies_riccallprocessid->value.choice.RICcallProcessID);
- // riccallprocessid_ie->buf = dinput.call_process_id;
- // riccallprocessid_ie->size = dinput.call_process_id_size;
- // ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_riccallprocessid);
-
- ie_index = 2;
- E2N_RICcontrolFailure_IEs_t *ies_ric_cause = &IE_failure_array[ie_index];
- ies_ric_cause->criticality = E2N_Criticality_ignore;
- ies_ric_cause->id = E2N_ProtocolIE_ID_id_RICcause;
- ies_ric_cause->value.present = E2N_RICcontrolFailure_IEs__value_PR_RICcause;
- E2N_RICcause_t * ric_cause = &(ies_ric_cause->value.choice.RICcause);
- ric_cause->present = (E2N_RICcause_PR)dinput.cause;
-
- switch(dinput.cause){
- case E2N_RICcause_PR_radioNetwork:
- ric_cause->choice.radioNetwork = dinput.sub_cause;
- break;
- case E2N_RICcause_PR_transport:
- ric_cause->choice.transport = dinput.sub_cause;
- break;
- case E2N_RICcause_PR_protocol:
- ric_cause->choice.protocol= dinput.sub_cause;
- break;
- case E2N_RICcause_PR_misc:
- ric_cause->choice.misc = dinput.sub_cause;
- break;
- case E2N_RICcause_PR_ric:
- ric_cause->choice.ric = dinput.sub_cause;
- break;
- default:
- std::cout <<"Error ! Illegal cause enum" << dinput.cause << std::endl;
- return false;
- }
-
- //ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_ric_cause);
- return true;
-
-};
-
-
+ if (!res){
+ return false;
+ }
-bool ric_control_response:: get_fields(E2N_SuccessfulOutcome_t * success_msg, ric_control_helper &dout)
-{
- if (success_msg == 0){
- error_string = "Invalid reference for E2AP Control Acknowledge message in get_fields";
- return false;
- }
-
-
- for(int edx = 0; edx < success_msg->value.choice.RICcontrolAcknowledge.protocolIEs.list.count; edx++) {
- E2N_RICcontrolAcknowledge_IEs_t *memb_ptr = success_msg->value.choice.RICcontrolAcknowledge.protocolIEs.list.array[edx];
-
- switch(memb_ptr->id)
- {
-
- case (E2N_ProtocolIE_ID_id_RICcallProcessID):
- dout.call_process_id = memb_ptr->value.choice.RICcallProcessID.buf;
- dout.call_process_id_size = memb_ptr->value.choice.RICcallProcessID.size;
- break;
+ if (is_success){
+ e2ap_pdu_obj->choice.successfulOutcome = successMsg;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_successfulOutcome ;
+ }
+ else{
+ e2ap_pdu_obj->choice.unsuccessfulOutcome = unsuccessMsg;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_unsuccessfulOutcome ;
- case (E2N_ProtocolIE_ID_id_RICrequestID):
- dout.req_id = memb_ptr->value.choice.RICrequestID.ricRequestorID;
- dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
- break;
-
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
- dout.func_id = memb_ptr->value.choice.RANfunctionID;
- break;
-
- case (E2N_ProtocolIE_ID_id_RICcause):
- dout.control_status = memb_ptr->value.choice.RICcontrolStatus;
- break;
-
- }
-
- }
-
- return true;
+ }
+
+ //xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(errbuf, errbuf_len);
+ error_string = "Constraints failed for encoding control response. Reason = " + error_string;
+ return false;
+ }
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else {
+ if(*size < retval.encoded){
+ std::stringstream ss;
+ ss <<"Error encoding E2AP Control response . Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ }
+
+ *size = retval.encoded;
+ return true;
}
+bool ric_control_response::set_fields(SuccessfulOutcome_t *successMsg, ric_control_helper &dinput){
+ unsigned int ie_index;
-bool ric_control_response:: get_fields(E2N_UnsuccessfulOutcome_t * unsuccess_msg, ric_control_helper &dout)
-{
- if (unsuccess_msg == 0){
- error_string = "Invalid reference for E2AP Control Failure message in get_fields";
- return false;
- }
-
-
- for(int edx = 0; edx < unsuccess_msg->value.choice.RICcontrolFailure.protocolIEs.list.count; edx++) {
- E2N_RICcontrolFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICcontrolFailure.protocolIEs.list.array[edx];
-
- switch(memb_ptr->id)
- {
-
- case (E2N_ProtocolIE_ID_id_RICcallProcessID):
- dout.call_process_id = memb_ptr->value.choice.RICcallProcessID.buf;
- dout.call_process_id_size = memb_ptr->value.choice.RICcallProcessID.size;
- break;
+ if (successMsg == 0){
+ error_string = "Invalid reference for E2AP Control Acknowledge in set_fields";
+ return false;
+ }
- case (E2N_ProtocolIE_ID_id_RICrequestID):
- dout.req_id = memb_ptr->value.choice.RICrequestID.ricRequestorID;
- dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
- break;
-
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
- dout.func_id = memb_ptr->value.choice.RANfunctionID;
- break;
-
-
- case (E2N_ProtocolIE_ID_id_RICcause):
- dout.cause = memb_ptr->value.choice.RICcause.present;
- switch(dout.cause){
- case E2N_RICcause_PR_radioNetwork :
- dout.sub_cause = memb_ptr->value.choice.RICcause.choice.radioNetwork;
- break;
-
- case E2N_RICcause_PR_transport :
- dout.sub_cause = memb_ptr->value.choice.RICcause.choice.transport;
- break;
-
- case E2N_RICcause_PR_protocol :
- dout.sub_cause = memb_ptr->value.choice.RICcause.choice.protocol;
- break;
-
- case E2N_RICcause_PR_misc :
- dout.sub_cause = memb_ptr->value.choice.RICcause.choice.misc;
- break;
-
- case E2N_RICcause_PR_ric :
- dout.sub_cause = memb_ptr->value.choice.RICcause.choice.ric;
- break;
-
+ // for(i = 0; i < NUM_CONTROL_ACKNOWLEDGE_IES;i++){
+ // memset(&(IE_array[i]), 0, sizeof(RICcontrolAcknowledge_IEs_t));
+ // }
+
+ //RICcontrolAcknowledge_t * ric_acknowledge = &(successMsg->value.choice.RICcontrolAcknowledge);
+ //ric_acknowledge->protocolIEs.list.count = 0;
+
+ ie_index = 0;
+ RICcontrolAcknowledge_IEs_t *ies_ricreq = &IE_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICcontrolAcknowledge_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ ricrequest_ie->ricRequestorID = dinput.req_id;
+ //ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
+ //ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_ricreq);
+
+ ie_index = 1;
+ RICcontrolAcknowledge_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICcontrolAcknowledge_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ *ranfunction_ie = dinput.func_id;
+ //ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_ranfunc);
+
+ // ie_index = 2;
+ // RICcontrolAcknowledge_IEs_t *ies_riccallprocessid = &IE_array[ie_index];
+ // ies_riccallprocessid->criticality = Criticality_reject;
+ // ies_riccallprocessid->id = ProtocolIE_ID_id_RICcallProcessID;
+ // ies_riccallprocessid->value.present = RICcontrolAcknowledge_IEs__value_PR_RICcallProcessID;
+ // RICcallProcessID_t *riccallprocessid_ie = &ies_riccallprocessid->value.choice.RICcallProcessID;
+ // riccallprocessid_ie->buf = dinput.call_process_id;
+ // riccallprocessid_ie->size = dinput.call_process_id_size;
+ // ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_riccallprocessid);
+
+ ie_index = 2;
+ RICcontrolAcknowledge_IEs_t *ies_ric_cause = &IE_array[ie_index];
+ ies_ric_cause->criticality = Criticality_reject;
+ ies_ric_cause->id = ProtocolIE_ID_id_RICcontrolStatus;
+ ies_ric_cause->value.present = RICcontrolAcknowledge_IEs__value_PR_RICcontrolStatus;
+ ies_ric_cause->value.choice.RICcontrolStatus = dinput.control_status;
+ //ASN_SEQUENCE_ADD(&(ric_acknowledge->protocolIEs), ies_ric_cause);
+
+ return true;
+
+};
+
+bool ric_control_response::set_fields(UnsuccessfulOutcome_t *unsuccessMsg, ric_control_helper &dinput){
+ unsigned int ie_index;
+
+ if (unsuccessMsg == 0){
+ error_string = "Invalid reference for E2AP Control Failure in set_fields";
+ return false;
+ }
+
+ // for(i = 0; i < NUM_CONTROL_FAILURE_IES;i++){
+ // memset(&(IE_failure_array[i]), 0, sizeof(RICcontrolFailure_IEs_t));
+ // }
+
+ //RICcontrolFailure_t * ric_failure = &(unsuccessMsg->value.choice.RICcontrolFailure);
+ //ric_failure->protocolIEs.list.count = 0;
+
+ ie_index = 0;
+ RICcontrolFailure_IEs_t *ies_ricreq = &IE_failure_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICcontrolFailure_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &(ies_ricreq->value.choice.RICrequestID);
+ ricrequest_ie->ricRequestorID = dinput.req_id;
+ //ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
+ //ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_ricreq);
+
+ ie_index = 1;
+ RICcontrolFailure_IEs_t *ies_ranfunc = &IE_failure_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICcontrolFailure_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &(ies_ranfunc->value.choice.RANfunctionID);
+ *ranfunction_ie = dinput.func_id;
+ //ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_ranfunc);
+
+ // ie_index = 2;
+ // RICcontrolFailure_IEs_t *ies_riccallprocessid = &IE_failure_array[i];
+ // ies_riccallprocessid->criticality = Criticality_reject;
+ // ies_riccallprocessid->id = ProtocolIE_ID_id_RICcallProcessID;
+ // ies_riccallprocessid->value.present = RICcontrolFailure_IEs__value_PR_RICcallProcessID;
+ // RICcallProcessID_t *riccallprocessid_ie = &(ies_riccallprocessid->value.choice.RICcallProcessID);
+ // riccallprocessid_ie->buf = dinput.call_process_id;
+ // riccallprocessid_ie->size = dinput.call_process_id_size;
+ // ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_riccallprocessid);
+
+ ie_index = 2;
+ RICcontrolFailure_IEs_t *ies_ric_cause = &IE_failure_array[ie_index];
+ ies_ric_cause->criticality = Criticality_ignore;
+ ies_ric_cause->id = ProtocolIE_ID_id_Cause;
+ ies_ric_cause->value.present = RICcontrolFailure_IEs__value_PR_Cause;
+ Cause_t * ric_cause = &(ies_ric_cause->value.choice.Cause);
+ ric_cause->present = (Cause_PR)dinput.cause;
+
+ switch(dinput.cause){
+ case Cause_PR_ricService:
+ ric_cause->choice.ricService = dinput.sub_cause;
+ break;
+ case Cause_PR_transport:
+ ric_cause->choice.transport = dinput.sub_cause;
+ break;
+ case Cause_PR_protocol:
+ ric_cause->choice.protocol= dinput.sub_cause;
+ break;
+ case Cause_PR_misc:
+ ric_cause->choice.misc = dinput.sub_cause;
+ break;
+ case Cause_PR_ricRequest:
+ ric_cause->choice.ricRequest = dinput.sub_cause;
+ break;
default:
- dout.sub_cause = -1;
- break;
- }
+ std::cout <<"Error ! Illegal cause enum" << dinput.cause << std::endl;
+ return false;
+ }
- default:
- break;
- }
-
- }
-
- return true;
-
+ //ASN_SEQUENCE_ADD(&(ric_failure->protocolIEs), ies_ric_cause);
+ return true;
+
+};
+
+
+
+
+bool ric_control_response:: get_fields(SuccessfulOutcome_t * success_msg, ric_control_helper &dout)
+{
+ if (success_msg == 0){
+ error_string = "Invalid reference for E2AP Control Acknowledge message in get_fields";
+ return false;
+ }
+
+
+ for(int edx = 0; edx < success_msg->value.choice.RICcontrolAcknowledge.protocolIEs.list.count; edx++) {
+ RICcontrolAcknowledge_IEs_t *memb_ptr = success_msg->value.choice.RICcontrolAcknowledge.protocolIEs.list.array[edx];
+
+ switch(memb_ptr->id)
+ {
+
+ case (ProtocolIE_ID_id_RICcallProcessID):
+ dout.call_process_id = memb_ptr->value.choice.RICcallProcessID.buf;
+ dout.call_process_id_size = memb_ptr->value.choice.RICcallProcessID.size;
+ break;
+
+ case (ProtocolIE_ID_id_RICrequestID):
+ dout.req_id = memb_ptr->value.choice.RICrequestID.ricRequestorID;
+ //dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
+ break;
+
+ case (ProtocolIE_ID_id_RANfunctionID):
+ dout.func_id = memb_ptr->value.choice.RANfunctionID;
+ break;
+
+ case (ProtocolIE_ID_id_Cause):
+ dout.control_status = memb_ptr->value.choice.RICcontrolStatus;
+ break;
+
+ }
+
+ }
+
+ return true;
+
+}
+
+
+bool ric_control_response:: get_fields(UnsuccessfulOutcome_t * unsuccess_msg, ric_control_helper &dout)
+{
+ if (unsuccess_msg == 0){
+ error_string = "Invalid reference for E2AP Control Failure message in get_fields";
+ return false;
+ }
+
+
+ for(int edx = 0; edx < unsuccess_msg->value.choice.RICcontrolFailure.protocolIEs.list.count; edx++) {
+ RICcontrolFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICcontrolFailure.protocolIEs.list.array[edx];
+
+ switch(memb_ptr->id)
+ {
+
+ case (ProtocolIE_ID_id_RICcallProcessID):
+ dout.call_process_id = memb_ptr->value.choice.RICcallProcessID.buf;
+ dout.call_process_id_size = memb_ptr->value.choice.RICcallProcessID.size;
+ break;
+
+ case (ProtocolIE_ID_id_RICrequestID):
+ dout.req_id = memb_ptr->value.choice.RICrequestID.ricRequestorID;
+ //dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
+ break;
+
+ case (ProtocolIE_ID_id_RANfunctionID):
+ dout.func_id = memb_ptr->value.choice.RANfunctionID;
+ break;
+
+
+ case (ProtocolIE_ID_id_Cause):
+ dout.cause = memb_ptr->value.choice.Cause.present;
+ switch(dout.cause){
+ case Cause_PR_ricService :
+ dout.sub_cause = memb_ptr->value.choice.Cause.choice.ricService;
+ break;
+
+ case Cause_PR_transport :
+ dout.sub_cause = memb_ptr->value.choice.Cause.choice.transport;
+ break;
+
+ case Cause_PR_protocol :
+ dout.sub_cause = memb_ptr->value.choice.Cause.choice.protocol;
+ break;
+
+ case Cause_PR_misc :
+ dout.sub_cause = memb_ptr->value.choice.Cause.choice.misc;
+ break;
+
+ case Cause_PR_ricRequest :
+ dout.sub_cause = memb_ptr->value.choice.Cause.choice.ricRequest;
+ break;
+
+ default:
+ dout.sub_cause = -1;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ }
+
+ return true;
+
}
diff --git a/src/xapp-asn/e2ap/e2ap_control_response.hpp b/src/xapp-asn/e2ap/e2ap_control_response.hpp
index 6880e48..1d6af17 100644
--- a/src/xapp-asn/e2ap/e2ap_control_response.hpp
+++ b/src/xapp-asn/e2ap/e2ap_control_response.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,12 +31,12 @@
#include <errno.h>
#include <mdclog/mdclog.h>
#include <sstream>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_SuccessfulOutcome.h>
-#include <E2N_UnsuccessfulOutcome.h>
-#include <E2N_RICcontrolAcknowledge.h>
-#include <E2N_RICcontrolFailure.h>
-#include <E2N_ProtocolIE-Field.h>
+#include <E2AP-PDU.h>
+#include <SuccessfulOutcome.h>
+#include <UnsuccessfulOutcome.h>
+#include <RICcontrolAcknowledge.h>
+#include <RICcontrolFailure.h>
+#include <ProtocolIE-Field.h>
#include "e2ap_control_helper.hpp"
#define NUM_CONTROL_ACKNOWLEDGE_IES 3
@@ -52,22 +52,22 @@
bool encode_e2ap_control_response(unsigned char *, size_t *, ric_control_helper &, bool);
- bool set_fields(E2N_SuccessfulOutcome_t *, ric_control_helper &);
- bool get_fields(E2N_SuccessfulOutcome_t *, ric_control_helper &);
+ bool set_fields(SuccessfulOutcome_t *, ric_control_helper &);
+ bool get_fields(SuccessfulOutcome_t *, ric_control_helper &);
- bool set_fields(E2N_UnsuccessfulOutcome_t *, ric_control_helper &);
- bool get_fields(E2N_UnsuccessfulOutcome_t *, ric_control_helper &);
+ bool set_fields(UnsuccessfulOutcome_t *, ric_control_helper &);
+ bool get_fields(UnsuccessfulOutcome_t *, ric_control_helper &);
std::string get_error(void) const {return error_string ; };
private:
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
- E2N_SuccessfulOutcome_t * successMsg;
- E2N_UnsuccessfulOutcome_t * unsuccessMsg;
+ E2AP_PDU_t * e2ap_pdu_obj;
+ SuccessfulOutcome_t * successMsg;
+ UnsuccessfulOutcome_t * unsuccessMsg;
- E2N_RICcontrolAcknowledge_IEs_t *IE_array;
- E2N_RICcontrolFailure_IEs_t *IE_failure_array;
+ RICcontrolAcknowledge_IEs_t *IE_array;
+ RICcontrolFailure_IEs_t *IE_failure_array;
std::string error_string;
diff --git a/src/xapp-asn/e2ap/e2ap_indication.cc b/src/xapp-asn/e2ap/e2ap_indication.cc
index 33b2095..c9f9130 100644
--- a/src/xapp-asn/e2ap/e2ap_indication.cc
+++ b/src/xapp-asn/e2ap/e2ap_indication.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -33,18 +33,18 @@
ric_indication::ric_indication(void){
e2ap_pdu_obj = 0;
- e2ap_pdu_obj = (E2N_E2AP_PDU_t * )calloc(1, sizeof(E2N_E2AP_PDU_t));
+ e2ap_pdu_obj = (E2AP_PDU_t * )calloc(1, sizeof(E2AP_PDU_t));
assert(e2ap_pdu_obj != 0);
initMsg = 0;
- initMsg = (E2N_InitiatingMessage_t * )calloc(1, sizeof(E2N_InitiatingMessage_t));
+ initMsg = (InitiatingMessage_t * )calloc(1, sizeof(InitiatingMessage_t));
assert(initMsg != 0);
IE_array = 0;
- IE_array = (E2N_RICindication_IEs_t *)calloc(NUM_INDICATION_IES, sizeof(E2N_RICindication_IEs_t));
+ IE_array = (RICindication_IEs_t *)calloc(NUM_INDICATION_IES, sizeof(RICindication_IEs_t));
assert(IE_array != 0);
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_initiatingMessage;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_initiatingMessage;
e2ap_pdu_obj->choice.initiatingMessage = initMsg;
@@ -58,7 +58,7 @@
ric_indication::~ric_indication(void){
mdclog_write(MDCLOG_DEBUG, "Freeing E2AP Indication object memory");
- E2N_RICindication_t *ricIndication = &(initMsg->value.choice.RICindication);
+ RICindication_t *ricIndication = &(initMsg->value.choice.RICindication);
for(int i = 0; i < ricIndication->protocolIEs.list.size; i++){
ricIndication->protocolIEs.list.array[i] = 0;
}
@@ -70,16 +70,16 @@
}
free(IE_array);
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
mdclog_write(MDCLOG_DEBUG, "Freed E2AP Indication object mempory");
}
bool ric_indication::encode_e2ap_indication(unsigned char *buf, size_t *size, ric_indication_helper & dinput){
- initMsg->procedureCode = E2N_ProcedureCode_id_ricIndication;
- initMsg->criticality = E2N_Criticality_ignore;
- initMsg->value.present = E2N_InitiatingMessage__value_PR_RICindication;
+ initMsg->procedureCode = ProcedureCode_id_RICindication;
+ initMsg->criticality = Criticality_ignore;
+ initMsg->value.present = InitiatingMessage__value_PR_RICindication;
bool res;
asn_enc_rval_t retval;
@@ -89,7 +89,7 @@
return false;
}
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, errbuf, &errbuf_len);
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu_obj, errbuf, &errbuf_len);
if(ret_constr){
error_string.assign(&errbuf[0], errbuf_len);
error_string = "Error encoding E2AP Indication message. Reason = " + error_string;
@@ -99,7 +99,7 @@
// std::cout <<"Constraint check ok ...." << std::endl;
// xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
- retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+ retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
if(retval.encoded == -1){
error_string.assign(strerror(errno));
return false;
@@ -119,7 +119,7 @@
}
-bool ric_indication::set_fields(E2N_InitiatingMessage_t *initMsg, ric_indication_helper &dinput){
+bool ric_indication::set_fields(InitiatingMessage_t *initMsg, ric_indication_helper &dinput){
unsigned int ie_index;
if (initMsg == 0){
@@ -128,73 +128,73 @@
}
- E2N_RICindication_t * ric_indication = &(initMsg->value.choice.RICindication);
+ RICindication_t * ric_indication = &(initMsg->value.choice.RICindication);
ric_indication->protocolIEs.list.count = 0;
ie_index = 0;
- E2N_RICindication_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICindication_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ RICindication_IEs_t *ies_ricreq = &IE_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICindication_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = dinput.req_id;
- ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
+ //ricrequest_ie->ricRequestSequenceNumber = dinput.req_seq_no;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
ie_index = 1;
- E2N_RICindication_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICindication_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICindication_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICindication_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = dinput.func_id;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
ie_index = 2;
- E2N_RICindication_IEs_t *ies_actid = &IE_array[ie_index];
- ies_actid->criticality = E2N_Criticality_reject;
- ies_actid->id = E2N_ProtocolIE_ID_id_RICactionID;
- ies_actid->value.present = E2N_RICindication_IEs__value_PR_RICactionID;
- E2N_RICactionID_t *ricaction_ie = &ies_actid->value.choice.RICactionID;
+ RICindication_IEs_t *ies_actid = &IE_array[ie_index];
+ ies_actid->criticality = Criticality_reject;
+ ies_actid->id = ProtocolIE_ID_id_RICactionID;
+ ies_actid->value.present = RICindication_IEs__value_PR_RICactionID;
+ RICactionID_t *ricaction_ie = &ies_actid->value.choice.RICactionID;
*ricaction_ie = dinput.action_id;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
ie_index = 3;
- E2N_RICindication_IEs_t *ies_ricsn = &IE_array[ie_index];
- ies_ricsn->criticality = E2N_Criticality_reject;
- ies_ricsn->id = E2N_ProtocolIE_ID_id_RICindicationSN;
- ies_ricsn->value.present = E2N_RICindication_IEs__value_PR_RICindicationSN;
- E2N_RICindicationSN_t *ricsn_ie = &ies_ricsn->value.choice.RICindicationSN;
+ RICindication_IEs_t *ies_ricsn = &IE_array[ie_index];
+ ies_ricsn->criticality = Criticality_reject;
+ ies_ricsn->id = ProtocolIE_ID_id_RICindicationSN;
+ ies_ricsn->value.present = RICindication_IEs__value_PR_RICindicationSN;
+ RICindicationSN_t *ricsn_ie = &ies_ricsn->value.choice.RICindicationSN;
*ricsn_ie = dinput.indication_sn;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
ie_index = 4;
- E2N_RICindication_IEs_t *ies_indtyp = &IE_array[ie_index];
- ies_indtyp->criticality = E2N_Criticality_reject;
- ies_indtyp->id = E2N_ProtocolIE_ID_id_RICindicationType;
- ies_indtyp->value.present = E2N_RICindication_IEs__value_PR_RICindicationType;
- E2N_RICindicationType_t *rictype_ie = &ies_indtyp->value.choice.RICindicationType;
+ RICindication_IEs_t *ies_indtyp = &IE_array[ie_index];
+ ies_indtyp->criticality = Criticality_reject;
+ ies_indtyp->id = ProtocolIE_ID_id_RICindicationType;
+ ies_indtyp->value.present = RICindication_IEs__value_PR_RICindicationType;
+ RICindicationType_t *rictype_ie = &ies_indtyp->value.choice.RICindicationType;
*rictype_ie = dinput.indication_type;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
ie_index = 5;
- E2N_RICindication_IEs_t *ies_richead = &IE_array[ie_index];
- ies_richead->criticality = E2N_Criticality_reject;
- ies_richead->id = E2N_ProtocolIE_ID_id_RICindicationHeader;
- ies_richead->value.present = E2N_RICindication_IEs__value_PR_RICindicationHeader;
- E2N_RICindicationHeader_t *richeader_ie = &ies_richead->value.choice.RICindicationHeader;
+ RICindication_IEs_t *ies_richead = &IE_array[ie_index];
+ ies_richead->criticality = Criticality_reject;
+ ies_richead->id = ProtocolIE_ID_id_RICindicationHeader;
+ ies_richead->value.present = RICindication_IEs__value_PR_RICindicationHeader;
+ RICindicationHeader_t *richeader_ie = &ies_richead->value.choice.RICindicationHeader;
richeader_ie->buf = dinput.indication_header;
richeader_ie->size = dinput.indication_header_size;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
ie_index = 6;
- E2N_RICindication_IEs_t *ies_indmsg = &IE_array[ie_index];
- ies_indmsg->criticality = E2N_Criticality_reject;
- ies_indmsg->id = E2N_ProtocolIE_ID_id_RICindicationMessage;
- ies_indmsg->value.present = E2N_RICindication_IEs__value_PR_RICindicationMessage;
- E2N_RICindicationMessage_t *ricmsg_ie = &ies_indmsg->value.choice.RICindicationMessage;
+ RICindication_IEs_t *ies_indmsg = &IE_array[ie_index];
+ ies_indmsg->criticality = Criticality_reject;
+ ies_indmsg->id = ProtocolIE_ID_id_RICindicationMessage;
+ ies_indmsg->value.present = RICindication_IEs__value_PR_RICindicationMessage;
+ RICindicationMessage_t *ricmsg_ie = &ies_indmsg->value.choice.RICindicationMessage;
ricmsg_ie->buf = dinput.indication_msg;
ricmsg_ie->size = dinput.indication_msg_size;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
@@ -203,11 +203,11 @@
// optional call process id ..
if (dinput.call_process_id_size > 0){
ie_index = 7;
- E2N_RICindication_IEs_t *ies_ind_callprocessid = &IE_array[ie_index];
- ies_ind_callprocessid->criticality = E2N_Criticality_reject;
- ies_ind_callprocessid->id = E2N_ProtocolIE_ID_id_RICcallProcessID;
- ies_ind_callprocessid->value.present = E2N_RICindication_IEs__value_PR_RICcallProcessID;
- E2N_RICcallProcessID_t *riccallprocessid_ie = &ies_ind_callprocessid->value.choice.RICcallProcessID;
+ RICindication_IEs_t *ies_ind_callprocessid = &IE_array[ie_index];
+ ies_ind_callprocessid->criticality = Criticality_reject;
+ ies_ind_callprocessid->id = ProtocolIE_ID_id_RICcallProcessID;
+ ies_ind_callprocessid->value.present = RICindication_IEs__value_PR_RICcallProcessID;
+ RICcallProcessID_t *riccallprocessid_ie = &ies_ind_callprocessid->value.choice.RICcallProcessID;
riccallprocessid_ie->buf = dinput.indication_msg;
riccallprocessid_ie->size = dinput.indication_msg_size;
ASN_SEQUENCE_ADD(&(ric_indication->protocolIEs), &(IE_array[ie_index]));
@@ -220,7 +220,7 @@
-bool ric_indication:: get_fields(E2N_InitiatingMessage_t * init_msg, ric_indication_helper &dout)
+bool ric_indication:: get_fields(InitiatingMessage_t * init_msg, ric_indication_helper &dout)
{
if (init_msg == 0){
error_string = "Invalid reference for E2AP Indication message in get_fields";
@@ -229,42 +229,42 @@
for(int edx = 0; edx < init_msg->value.choice.RICindication.protocolIEs.list.count; edx++) {
- E2N_RICindication_IEs_t *memb_ptr = init_msg->value.choice.RICindication.protocolIEs.list.array[edx];
+ RICindication_IEs_t *memb_ptr = init_msg->value.choice.RICindication.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICindicationHeader):
+ case (ProtocolIE_ID_id_RICindicationHeader):
dout.indication_header = memb_ptr->value.choice.RICindicationHeader.buf;
dout.indication_header_size = memb_ptr->value.choice.RICindicationHeader.size;
break;
- case (E2N_ProtocolIE_ID_id_RICindicationMessage):
+ case (ProtocolIE_ID_id_RICindicationMessage):
dout.indication_msg = memb_ptr->value.choice.RICindicationMessage.buf;
dout.indication_msg_size = memb_ptr->value.choice.RICindicationMessage.size;
break;
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
dout.req_id = memb_ptr->value.choice.RICrequestID.ricRequestorID;
- dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
+ //dout.req_seq_no = memb_ptr->value.choice.RICrequestID.ricRequestSequenceNumber;
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
dout.func_id = memb_ptr->value.choice.RANfunctionID;
break;
- case (E2N_ProtocolIE_ID_id_RICindicationSN):
+ case (ProtocolIE_ID_id_RICindicationSN):
dout.indication_sn = memb_ptr->value.choice.RICindicationSN;
break;
- case (E2N_ProtocolIE_ID_id_RICindicationType):
+ case (ProtocolIE_ID_id_RICindicationType):
dout.indication_type = memb_ptr->value.choice.RICindicationType;
break;
- case (E2N_ProtocolIE_ID_id_RICactionID):
+ case (ProtocolIE_ID_id_RICactionID):
dout.action_id = memb_ptr->value.choice.RICactionID;
break;
- case (E2N_ProtocolIE_ID_id_RICcallProcessID):
+ case (ProtocolIE_ID_id_RICcallProcessID):
dout.call_process_id = memb_ptr->value.choice.RICcallProcessID.buf;
dout.call_process_id_size = memb_ptr->value.choice.RICcallProcessID.size;
@@ -278,6 +278,6 @@
}
-E2N_InitiatingMessage_t * ric_indication::get_message(void) {
+InitiatingMessage_t * ric_indication::get_message(void) {
return initMsg;
}
diff --git a/src/xapp-asn/e2ap/e2ap_indication.hpp b/src/xapp-asn/e2ap/e2ap_indication.hpp
index af43086..6c8abf1 100644
--- a/src/xapp-asn/e2ap/e2ap_indication.hpp
+++ b/src/xapp-asn/e2ap/e2ap_indication.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,10 +31,10 @@
#include <errno.h>
#include <mdclog/mdclog.h>
#include <sstream>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_InitiatingMessage.h>
-#include <E2N_RICindication.h>
-#include <E2N_ProtocolIE-Field.h>
+#include <E2AP-PDU.h>
+#include <InitiatingMessage.h>
+#include <RICindication.h>
+#include <ProtocolIE-Field.h>
#include "e2ap_indication_helper.hpp"
#define NUM_INDICATION_IES 8
@@ -48,16 +48,16 @@
~ric_indication(void);
bool encode_e2ap_indication(unsigned char *, size_t *, ric_indication_helper &);
- E2N_InitiatingMessage_t * get_message (void) ;
- bool set_fields(E2N_InitiatingMessage_t *, ric_indication_helper &);
- bool get_fields(E2N_InitiatingMessage_t *, ric_indication_helper &);
+ InitiatingMessage_t * get_message (void) ;
+ bool set_fields(InitiatingMessage_t *, ric_indication_helper &);
+ bool get_fields(InitiatingMessage_t *, ric_indication_helper &);
std::string get_error(void) const {return error_string ; };
private:
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
- E2N_InitiatingMessage_t *initMsg;
- E2N_RICindication_IEs_t *IE_array;
+ E2AP_PDU_t * e2ap_pdu_obj;
+ InitiatingMessage_t *initMsg;
+ RICindication_IEs_t *IE_array;
std::string error_string;
char errbuf[128];
size_t errbuf_len = 128;
diff --git a/src/xapp-asn/e2ap/e2ap_indication_helper.hpp b/src/xapp-asn/e2ap/e2ap_indication_helper.hpp
index 276a2a7..e319c9f 100644
--- a/src/xapp-asn/e2ap/e2ap_indication_helper.hpp
+++ b/src/xapp-asn/e2ap/e2ap_indication_helper.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/xapp-asn/e2ap/generic_helpers.hpp b/src/xapp-asn/e2ap/generic_helpers.hpp
index 32c019a..3e0c2df 100644
--- a/src/xapp-asn/e2ap/generic_helpers.hpp
+++ b/src/xapp-asn/e2ap/generic_helpers.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/xapp-asn/e2ap/response_helper.hpp b/src/xapp-asn/e2ap/response_helper.hpp
index b370ff2..e6aa65e 100644
--- a/src/xapp-asn/e2ap/response_helper.hpp
+++ b/src/xapp-asn/e2ap/response_helper.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/xapp-asn/e2ap/subscription_delete_request.cc b/src/xapp-asn/e2ap/subscription_delete_request.cc
index d103d2e..6a1ffc8 100644
--- a/src/xapp-asn/e2ap/subscription_delete_request.cc
+++ b/src/xapp-asn/e2ap/subscription_delete_request.cc
@@ -2,7 +2,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -25,16 +25,16 @@
_name = "default";
- e2ap_pdu_obj = (E2N_E2AP_PDU_t * )calloc(1, sizeof(E2N_E2AP_PDU_t));
+ e2ap_pdu_obj = (E2AP_PDU_t * )calloc(1, sizeof(E2AP_PDU_t));
assert(e2ap_pdu_obj != 0);
- initMsg = (E2N_InitiatingMessage_t * )calloc(1, sizeof(E2N_InitiatingMessage_t));
+ initMsg = (InitiatingMessage_t * )calloc(1, sizeof(InitiatingMessage_t));
assert(initMsg != 0);
- IE_array = (E2N_RICsubscriptionDeleteRequest_IEs_t *)calloc(NUM_SUBSCRIPTION_DELETE_IES, sizeof(E2N_RICsubscriptionDeleteRequest_IEs_t));
+ IE_array = (RICsubscriptionDeleteRequest_IEs_t *)calloc(NUM_SUBSCRIPTION_DELETE_IES, sizeof(RICsubscriptionDeleteRequest_IEs_t));
assert(IE_array != 0);
- E2N_RICsubscriptionDeleteRequest_t * subscription_delete = &(initMsg->value.choice.RICsubscriptionDeleteRequest);
+ RICsubscriptionDeleteRequest_t * subscription_delete = &(initMsg->value.choice.RICsubscriptionDeleteRequest);
for(int i = 0; i < NUM_SUBSCRIPTION_DELETE_IES; i++){
ASN_SEQUENCE_ADD(&subscription_delete->protocolIEs, &(IE_array[i]));
}
@@ -47,7 +47,7 @@
subscription_delete::~subscription_delete(void){
mdclog_write(MDCLOG_DEBUG, "Freeing subscription delete request object memory");
- E2N_RICsubscriptionDeleteRequest_t * subscription_delete = &(initMsg->value.choice.RICsubscriptionDeleteRequest);
+ RICsubscriptionDeleteRequest_t * subscription_delete = &(initMsg->value.choice.RICsubscriptionDeleteRequest);
for(int i = 0; i < subscription_delete->protocolIEs.list.size; i++){
subscription_delete->protocolIEs.list.array[i] = 0;
@@ -64,7 +64,7 @@
free(initMsg);
e2ap_pdu_obj->choice.initiatingMessage = 0;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
mdclog_write(MDCLOG_DEBUG, "Freed subscription delete request object memory");
@@ -74,23 +74,23 @@
bool subscription_delete::encode_e2ap_subscription(unsigned char *buf, size_t *size, subscription_helper &dinput){
e2ap_pdu_obj->choice.initiatingMessage = initMsg;
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_initiatingMessage;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_initiatingMessage;
set_fields( dinput);
- initMsg->procedureCode = E2N_ProcedureCode_id_ricSubscriptionDelete;
- initMsg->criticality = E2N_Criticality_reject;
- initMsg->value.present = E2N_InitiatingMessage__value_PR_RICsubscriptionDeleteRequest;
+ initMsg->procedureCode = ProcedureCode_id_RICsubscriptionDelete;
+ initMsg->criticality = Criticality_reject;
+ initMsg->value.present = InitiatingMessage__value_PR_RICsubscriptionDeleteRequest;
- //xer_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ //xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
if(ret_constr){
error_string.assign(errbuf, errbuf_len);
error_string = "Constraints failed for encoding subscription delete request. Reason = " + error_string;
return false;
}
- asn_enc_rval_t res = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+ asn_enc_rval_t res = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
if(res.encoded == -1){
error_string.assign(strerror(errno));
@@ -117,22 +117,22 @@
unsigned int ie_index;
ie_index = 0;
- E2N_RICsubscriptionDeleteRequest_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICsubscriptionDeleteRequest_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ RICsubscriptionDeleteRequest_IEs_t *ies_ricreq = &IE_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICsubscriptionDeleteRequest_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = helper.get_request_id();
- ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
+ //ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
ie_index = 1;
- E2N_RICsubscriptionDeleteRequest_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICsubscriptionDeleteRequest_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICsubscriptionDeleteRequest_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICsubscriptionDeleteRequest_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = helper.get_function_id();
@@ -142,7 +142,7 @@
-bool subscription_delete:: get_fields(E2N_InitiatingMessage_t * init_msg, subscription_helper & dout)
+bool subscription_delete:: get_fields(InitiatingMessage_t * init_msg, subscription_helper & dout)
{
if (init_msg == 0){
@@ -150,27 +150,27 @@
return false;
}
- E2N_RICrequestID_t *requestid;
- E2N_RANfunctionID_t * ranfunctionid;
+ RICrequestID_t *requestid;
+ RANfunctionID_t * ranfunctionid;
for(int edx = 0; edx < init_msg->value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.count; edx++) {
- E2N_RICsubscriptionDeleteRequest_IEs_t *memb_ptr = init_msg->value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.array[edx];
+ RICsubscriptionDeleteRequest_IEs_t *memb_ptr = init_msg->value.choice.RICsubscriptionDeleteRequest.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
requestid = &memb_ptr->value.choice.RICrequestID;
- dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
+ //dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
dout.set_function_id(*ranfunctionid);
break;
}
- //asn_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2pdu);
+ //asn_fprint(stdout, &asn_DEF_E2AP_PDU, e2pdu);
}
return true;
diff --git a/src/xapp-asn/e2ap/subscription_delete_request.hpp b/src/xapp-asn/e2ap/subscription_delete_request.hpp
index e3c1d4e..b6d5bba 100644
--- a/src/xapp-asn/e2ap/subscription_delete_request.hpp
+++ b/src/xapp-asn/e2ap/subscription_delete_request.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,10 +26,10 @@
#include <sstream>
#include <mdclog/mdclog.h>
#include <asn_application.h>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_InitiatingMessage.h>
-#include <E2N_RICsubscriptionDeleteRequest.h>
-#include <E2N_ProtocolIE-Field.h>
+#include <E2AP-PDU.h>
+#include <InitiatingMessage.h>
+#include <RICsubscriptionDeleteRequest.h>
+#include <ProtocolIE-Field.h>
#include "subscription_helper.hpp"
#define NUM_SUBSCRIPTION_DELETE_IES 2
@@ -42,7 +42,7 @@
bool encode_e2ap_subscription(unsigned char *, size_t *, subscription_helper &);
bool set_fields(subscription_helper &);
- bool get_fields(E2N_InitiatingMessage_t *, subscription_helper &);
+ bool get_fields(InitiatingMessage_t *, subscription_helper &);
std::string get_error(void) const {
return error_string ;
@@ -50,10 +50,10 @@
private:
- E2N_InitiatingMessage_t *initMsg;
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
+ InitiatingMessage_t *initMsg;
+ E2AP_PDU_t * e2ap_pdu_obj;
- E2N_RICsubscriptionDeleteRequest_IEs_t * IE_array;
+ RICsubscriptionDeleteRequest_IEs_t * IE_array;
char errbuf[128];
diff --git a/src/xapp-asn/e2ap/subscription_delete_response.cc b/src/xapp-asn/e2ap/subscription_delete_response.cc
index c1c166c..249b3cd 100644
--- a/src/xapp-asn/e2ap/subscription_delete_response.cc
+++ b/src/xapp-asn/e2ap/subscription_delete_response.cc
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -28,23 +28,23 @@
subscription_delete_response::subscription_delete_response(void){
e2ap_pdu_obj = 0;
- e2ap_pdu_obj = (E2N_E2AP_PDU_t *)calloc(1, sizeof(E2N_E2AP_PDU_t));
+ e2ap_pdu_obj = (E2AP_PDU_t *)calloc(1, sizeof(E2AP_PDU_t));
assert(e2ap_pdu_obj != 0);
successMsg = 0;
- successMsg = (E2N_SuccessfulOutcome_t *)calloc(1, sizeof(E2N_SuccessfulOutcome_t));
+ successMsg = (SuccessfulOutcome_t *)calloc(1, sizeof(SuccessfulOutcome_t));
assert(successMsg != 0);
unsuccessMsg = 0;
- unsuccessMsg = (E2N_UnsuccessfulOutcome_t *)calloc(1, sizeof(E2N_UnsuccessfulOutcome_t));
+ unsuccessMsg = (UnsuccessfulOutcome_t *)calloc(1, sizeof(UnsuccessfulOutcome_t));
assert(unsuccessMsg != 0);
IE_array = 0;
- IE_array = (E2N_RICsubscriptionDeleteResponse_IEs_t *)calloc(NUM_SUBSCRIPTION_DELETE_RESPONSE_IES, sizeof(E2N_RICsubscriptionDeleteResponse_IEs_t));
+ IE_array = (RICsubscriptionDeleteResponse_IEs_t *)calloc(NUM_SUBSCRIPTION_DELETE_RESPONSE_IES, sizeof(RICsubscriptionDeleteResponse_IEs_t));
assert(IE_array != 0);
IE_Failure_array = 0;
- IE_Failure_array = (E2N_RICsubscriptionDeleteFailure_IEs_t *)calloc(NUM_SUBSCRIPTION_DELETE_FAILURE_IES, sizeof(E2N_RICsubscriptionDeleteFailure_IEs_t));
+ IE_Failure_array = (RICsubscriptionDeleteFailure_IEs_t *)calloc(NUM_SUBSCRIPTION_DELETE_FAILURE_IES, sizeof(RICsubscriptionDeleteFailure_IEs_t));
assert(IE_Failure_array != 0);
@@ -53,18 +53,18 @@
-// Clear assigned protocolIE list from E2N_RIC indication IE container
+// Clear assigned protocolIE list from RIC indication IE container
subscription_delete_response::~subscription_delete_response(void){
mdclog_write(MDCLOG_DEBUG, "Freeing subscription delete response memory");
- E2N_RICsubscriptionDeleteResponse_t * ric_subscription_delete_response = &(successMsg->value.choice.RICsubscriptionDeleteResponse);
+ RICsubscriptionDeleteResponse_t * ric_subscription_delete_response = &(successMsg->value.choice.RICsubscriptionDeleteResponse);
for(unsigned int i = 0; i < ric_subscription_delete_response->protocolIEs.list.size ; i++){
ric_subscription_delete_response->protocolIEs.list.array[i] = 0;
}
- E2N_RICsubscriptionDeleteFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionDeleteFailure);
+ RICsubscriptionDeleteFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionDeleteFailure);
for(unsigned int i = 0; i < ric_subscription_failure->protocolIEs.list.size; i++){
ric_subscription_failure->protocolIEs.list.array[i] = 0;
}
@@ -72,14 +72,14 @@
free(IE_array);
free(IE_Failure_array);
- ASN_STRUCT_FREE(asn_DEF_E2N_SuccessfulOutcome, successMsg);
+ ASN_STRUCT_FREE(asn_DEF_SuccessfulOutcome, successMsg);
- ASN_STRUCT_FREE(asn_DEF_E2N_UnsuccessfulOutcome, unsuccessMsg);
+ ASN_STRUCT_FREE(asn_DEF_UnsuccessfulOutcome, unsuccessMsg);
e2ap_pdu_obj->choice.successfulOutcome = NULL;
e2ap_pdu_obj->choice.unsuccessfulOutcome = NULL;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
mdclog_write(MDCLOG_DEBUG, "Freed subscription delete response memory");
};
@@ -94,7 +94,7 @@
if (!res){
return false;
}
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_successfulOutcome;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_successfulOutcome;
e2ap_pdu_obj->choice.successfulOutcome = successMsg;
}
else{
@@ -102,12 +102,12 @@
if(! res){
return false;
}
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_unsuccessfulOutcome;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_unsuccessfulOutcome;
e2ap_pdu_obj->choice.unsuccessfulOutcome = unsuccessMsg;
}
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
if(ret_constr){
error_string.assign(errbuf, errbuf_len);
return false;
@@ -115,7 +115,7 @@
//xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
if(retval.encoded == -1){
error_string.assign(strerror(errno));
@@ -137,7 +137,7 @@
}
-bool subscription_delete_response::set_fields(E2N_SuccessfulOutcome_t *success, subscription_response_helper &helper){
+bool subscription_delete_response::set_fields(SuccessfulOutcome_t *success, subscription_response_helper &helper){
if (success == 0){
error_string = "Invalid reference to success message in set fields subscription delete response";
@@ -146,31 +146,31 @@
unsigned int ie_index;
- success->procedureCode = E2N_ProcedureCode_id_ricSubscriptionDelete;
- success->criticality = E2N_Criticality_reject;
- success->value.present = E2N_SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse;
+ success->procedureCode = ProcedureCode_id_RICsubscriptionDelete;
+ success->criticality = Criticality_reject;
+ success->value.present = SuccessfulOutcome__value_PR_RICsubscriptionDeleteResponse;
- E2N_RICsubscriptionDeleteResponse_t * subscription_delete_response = &(success->value.choice.RICsubscriptionDeleteResponse);
+ RICsubscriptionDeleteResponse_t * subscription_delete_response = &(success->value.choice.RICsubscriptionDeleteResponse);
subscription_delete_response->protocolIEs.list.count = 0;
ie_index = 0;
- E2N_RICsubscriptionDeleteResponse_IEs_t *ies_ricreq = &IE_array[ie_index];
+ RICsubscriptionDeleteResponse_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICsubscriptionDeleteResponse_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICsubscriptionDeleteResponse_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = helper.get_request_id();
- ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
+ //ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
ASN_SEQUENCE_ADD(&subscription_delete_response->protocolIEs, ies_ricreq);
ie_index = 1;
- E2N_RICsubscriptionDeleteResponse_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICsubscriptionDeleteResponse_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICsubscriptionDeleteResponse_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICsubscriptionDeleteResponse_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = helper.get_function_id();
ASN_SEQUENCE_ADD(&subscription_delete_response->protocolIEs, ies_ranfunc);
@@ -179,7 +179,7 @@
}
-bool subscription_delete_response:: get_fields(E2N_SuccessfulOutcome_t * success_msg, subscription_response_helper & dout)
+bool subscription_delete_response:: get_fields(SuccessfulOutcome_t * success_msg, subscription_response_helper & dout)
{
if (success_msg == 0){
@@ -187,20 +187,20 @@
return false;
}
- E2N_RICrequestID_t *requestid;
- E2N_RANfunctionID_t * ranfunctionid;
+ RICrequestID_t *requestid;
+ RANfunctionID_t * ranfunctionid;
for(int edx = 0; edx < success_msg->value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.count; edx++) {
- E2N_RICsubscriptionDeleteResponse_IEs_t *memb_ptr = success_msg->value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.array[edx];
+ RICsubscriptionDeleteResponse_IEs_t *memb_ptr = success_msg->value.choice.RICsubscriptionDeleteResponse.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
requestid = &memb_ptr->value.choice.RICrequestID;
- dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
+ //dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
dout.set_function_id(*ranfunctionid);
break;
@@ -213,7 +213,7 @@
}
-bool subscription_delete_response::set_fields(E2N_UnsuccessfulOutcome_t *unsuccess, subscription_response_helper &helper){
+bool subscription_delete_response::set_fields(UnsuccessfulOutcome_t *unsuccess, subscription_response_helper &helper){
if (unsuccess == 0){
error_string = "Invalid reference to unsuccess message in set fields subscription delete response";
@@ -222,30 +222,30 @@
unsigned int ie_index;
- unsuccess->procedureCode = E2N_ProcedureCode_id_ricSubscriptionDelete;
- unsuccess->criticality = E2N_Criticality_reject;
- unsuccess->value.present = E2N_UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure;
+ unsuccess->procedureCode = ProcedureCode_id_RICsubscriptionDelete;
+ unsuccess->criticality = Criticality_reject;
+ unsuccess->value.present = UnsuccessfulOutcome__value_PR_RICsubscriptionDeleteFailure;
- E2N_RICsubscriptionDeleteFailure_t * ric_subscription_failure = &(unsuccess->value.choice.RICsubscriptionDeleteFailure);
+ RICsubscriptionDeleteFailure_t * ric_subscription_failure = &(unsuccess->value.choice.RICsubscriptionDeleteFailure);
ric_subscription_failure->protocolIEs.list.count = 0;
ie_index = 0;
- E2N_RICsubscriptionDeleteFailure_IEs_t *ies_ricreq = &IE_Failure_array[ie_index];
+ RICsubscriptionDeleteFailure_IEs_t *ies_ricreq = &IE_Failure_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICsubscriptionDeleteFailure_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = helper.get_request_id();
- ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
+ //ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, ies_ricreq);
ie_index = 1;
- E2N_RICsubscriptionDeleteFailure_IEs_t *ies_ranfunc = &IE_Failure_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICsubscriptionDeleteFailure_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICsubscriptionDeleteFailure_IEs_t *ies_ranfunc = &IE_Failure_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICsubscriptionDeleteFailure_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = helper.get_function_id();
ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, ies_ranfunc);
@@ -254,7 +254,7 @@
}
-bool subscription_delete_response:: get_fields(E2N_UnsuccessfulOutcome_t * unsuccess_msg, subscription_response_helper & dout)
+bool subscription_delete_response:: get_fields(UnsuccessfulOutcome_t * unsuccess_msg, subscription_response_helper & dout)
{
if (unsuccess_msg == 0){
@@ -262,20 +262,20 @@
return false;
}
- E2N_RICrequestID_t *requestid;
- E2N_RANfunctionID_t * ranfunctionid;
+ RICrequestID_t *requestid;
+ RANfunctionID_t * ranfunctionid;
for(int edx = 0; edx < unsuccess_msg->value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.count; edx++) {
- E2N_RICsubscriptionDeleteFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.array[edx];
+ RICsubscriptionDeleteFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICsubscriptionDeleteFailure.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
requestid = &memb_ptr->value.choice.RICrequestID;
- dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
+ //dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
dout.set_function_id(*ranfunctionid);
break;
diff --git a/src/xapp-asn/e2ap/subscription_delete_response.hpp b/src/xapp-asn/e2ap/subscription_delete_response.hpp
index d9581e4..14589e5 100644
--- a/src/xapp-asn/e2ap/subscription_delete_response.hpp
+++ b/src/xapp-asn/e2ap/subscription_delete_response.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -27,13 +27,13 @@
#include <sstream>
#include <mdclog/mdclog.h>
#include <asn_application.h>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_SuccessfulOutcome.h>
-#include <E2N_UnsuccessfulOutcome.h>
-#include <E2N_RICsubscriptionDeleteResponse.h>
-#include <E2N_RICsubscriptionDeleteFailure.h>
-#include <E2N_ProtocolIE-Field.h>
-#include <E2N_ProcedureCode.h>
+#include <E2AP-PDU.h>
+#include <SuccessfulOutcome.h>
+#include <UnsuccessfulOutcome.h>
+#include <RICsubscriptionDeleteResponse.h>
+#include <RICsubscriptionDeleteFailure.h>
+#include <ProtocolIE-Field.h>
+#include <ProcedureCode.h>
#include "response_helper.hpp"
#define NUM_SUBSCRIPTION_DELETE_RESPONSE_IES 2
@@ -46,11 +46,11 @@
~subscription_delete_response(void);
bool encode_e2ap_subscription_delete_response(unsigned char *, size_t *, subscription_response_helper &, bool);
- bool set_fields(E2N_SuccessfulOutcome_t *, subscription_response_helper &);
- bool get_fields(E2N_SuccessfulOutcome_t *, subscription_response_helper &);
+ bool set_fields(SuccessfulOutcome_t *, subscription_response_helper &);
+ bool get_fields(SuccessfulOutcome_t *, subscription_response_helper &);
- bool set_fields(E2N_UnsuccessfulOutcome_t *, subscription_response_helper &);
- bool get_fields(E2N_UnsuccessfulOutcome_t *, subscription_response_helper &);
+ bool set_fields(UnsuccessfulOutcome_t *, subscription_response_helper &);
+ bool get_fields(UnsuccessfulOutcome_t *, subscription_response_helper &);
std::string get_error_string(void) const {
return error_string;
@@ -58,13 +58,13 @@
private:
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
- E2N_SuccessfulOutcome_t * successMsg;
- E2N_UnsuccessfulOutcome_t * unsuccessMsg;
+ E2AP_PDU_t * e2ap_pdu_obj;
+ SuccessfulOutcome_t * successMsg;
+ UnsuccessfulOutcome_t * unsuccessMsg;
- E2N_RICsubscriptionDeleteResponse_IEs_t *IE_array;
- E2N_RICsubscriptionDeleteFailure_IEs_t *IE_Failure_array;
+ RICsubscriptionDeleteResponse_IEs_t *IE_array;
+ RICsubscriptionDeleteFailure_IEs_t *IE_Failure_array;
char errbuf[128];
diff --git a/src/xapp-asn/e2ap/subscription_helper.hpp b/src/xapp-asn/e2ap/subscription_helper.hpp
index a9e0417..b43df7d 100644
--- a/src/xapp-asn/e2ap/subscription_helper.hpp
+++ b/src/xapp-asn/e2ap/subscription_helper.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
#include <iostream>
#include <vector>
#include <memory>
+
#include "generic_helpers.hpp"
@@ -43,20 +44,15 @@
public:
- Action(int id, int type): _is_def(false), _is_subs_act(false), _id(id), _type(type), _next_action(0), _wait(0){};
- Action(int id, int type, const void *def, size_t def_size, int next, int wait): _is_def(false), _is_subs_act(false), _id(id), _type(type){
+ Action(int id, int type): _is_def(false), _is_subs_act(false), _id(id), _type(type), _next_action(0){};
+ Action(int id, int type, const void *def, size_t def_size, int next_action): _is_def(false), _is_subs_act(false), _id(id), _type(type){
- if (def_size > 0){
_is_def = true;
_action_definition.set_ref(def);
_action_definition.set_size(def_size);
- }
-
- if(next >= 0 && wait >= 0){
_is_subs_act = true;
- _next_action = next;
- _wait = wait;
- }
+ _next_action = next_action;
+
};
@@ -82,10 +78,6 @@
return _next_action;
};
- int get_wait() const {
- return _wait;
- }
-
bool is_definition() const{
return _is_def;
@@ -99,7 +91,7 @@
bool _is_def;
bool _is_subs_act;
- int _id, _type, _next_action, _wait, _cause, _sub_cause;
+ int _id, _type, _next_action, _cause, _sub_cause;
bool _is_admit;
octet_helper _action_definition;
@@ -116,22 +108,19 @@
public:
using action_t = std::vector<Action>;
-
subscription_helper(){
- _action_ref = std::make_unique<action_t>();
- curr_index = 0;
- };
-
+ _action_ref = std::make_unique<action_t>();
+ };
+
action_t * get_list() const {return _action_ref.get();};
void clear(void){
_action_ref.get()->clear();
}
- void set_request(int id, int seq_no){
+ void set_request(int id){
_req_id = id;
- _req_seq_no = seq_no;
-
+
};
void set_function_id(int id){
@@ -149,8 +138,8 @@
_action_ref.get()->push_back(a);
};
- void add_action(int id, int type, std::string action_def, int next_action, int wait_time){
- Action a (id, type, action_def.c_str(), action_def.length(), next_action, wait_time);
+ void add_action(int id, int type, const void *action_def, size_t size, int next_action){
+ Action a (id, type, action_def, size, next_action);
_action_ref.get()->push_back(a);
};
@@ -159,9 +148,6 @@
return _req_id;
}
- int get_req_seq(void) const {
- return _req_seq_no;
- }
int get_function_id(void) const{
return _func_id;
@@ -177,7 +163,6 @@
void print_sub_info(void){
std::cout <<"Request ID = " << _req_id << std::endl;
- std::cout <<"Request Sequence Number = " << _req_seq_no << std::endl;
std::cout <<"RAN Function ID = " << _func_id << std::endl;
for(auto const & e: *(_action_ref.get())){
std::cout <<"Action ID = " << e.get_id() << " Action Type = " << e.get_type() << std::endl;
@@ -188,8 +173,9 @@
std::unique_ptr<action_t> _action_ref;
int curr_index;
- int _req_id, _req_seq_no, _func_id;
+ int _req_id, _func_id;
octet_helper _event_def;
+
};
#endif
diff --git a/src/xapp-asn/e2ap/subscription_request.cc b/src/xapp-asn/e2ap/subscription_request.cc
index 9b2f897..91071b3 100644
--- a/src/xapp-asn/e2ap/subscription_request.cc
+++ b/src/xapp-asn/e2ap/subscription_request.cc
@@ -2,7 +2,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -32,29 +32,29 @@
_name = "default";
e2ap_pdu_obj = 0;
- e2ap_pdu_obj = (E2N_E2AP_PDU_t * )calloc(1, sizeof(E2N_E2AP_PDU_t));
+ e2ap_pdu_obj = (E2AP_PDU_t * )calloc(1, sizeof(E2AP_PDU_t));
assert(e2ap_pdu_obj != 0);
initMsg = 0;
- initMsg = (E2N_InitiatingMessage_t * )calloc(1, sizeof(E2N_InitiatingMessage_t));
+ initMsg = (InitiatingMessage_t * )calloc(1, sizeof(InitiatingMessage_t));
assert(initMsg != 0);
IE_array = 0;
- IE_array = (E2N_RICsubscriptionRequest_IEs_t *)calloc(NUM_SUBSCRIPTION_REQUEST_IES, sizeof(E2N_RICsubscriptionRequest_IEs_t));
+ IE_array = (RICsubscriptionRequest_IEs_t *)calloc(NUM_SUBSCRIPTION_REQUEST_IES, sizeof(RICsubscriptionRequest_IEs_t));
assert(IE_array != 0);
action_array = 0;
- action_array = (E2N_RICaction_ToBeSetup_ItemIEs_t *)calloc(INITIAL_REQUEST_LIST_SIZE, sizeof(E2N_RICaction_ToBeSetup_ItemIEs_t));
+ action_array = (RICaction_ToBeSetup_ItemIEs_t *)calloc(INITIAL_REQUEST_LIST_SIZE, sizeof(RICaction_ToBeSetup_ItemIEs_t));
assert(action_array != 0);
action_array_size = INITIAL_REQUEST_LIST_SIZE;
// also need to add subsequent action and time to wait ..
for (unsigned int i = 0; i < action_array_size; i++){
- action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = (struct E2N_RICsubsequentAction *)calloc(1, sizeof(struct E2N_RICsubsequentAction));
+ action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = (struct RICsubsequentAction *)calloc(1, sizeof(struct RICsubsequentAction));
assert(action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction != 0);
}
e2ap_pdu_obj->choice.initiatingMessage = initMsg;
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_initiatingMessage;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_initiatingMessage;
@@ -65,10 +65,10 @@
// Clear assigned protocolIE list from RIC indication IE container
subscription_request::~subscription_request(void){
- mdclog_write(MDCLOG_DEBUG, "Freeing subscription request memory for");;
+ mdclog_write(MDCLOG_DEBUG, "Freeing subscription request memory");;
// Sequence of actions to be admitted causes special heart-ache. Free ric subscription element manually and reset the ie pointer
- E2N_RICsubscription_t * ricsubscription_ie = &(IE_array[2].value.choice.RICsubscription);
+ RICsubscriptionDetails_t * ricsubscription_ie = &(IE_array[2].value.choice.RICsubscriptionDetails);
for(int i = 0; i < ricsubscription_ie->ricAction_ToBeSetup_List.list.size; i++){
ricsubscription_ie->ricAction_ToBeSetup_List.list.array[i] = 0;
@@ -87,7 +87,7 @@
}
free(action_array);
- E2N_RICsubscriptionRequest_t * subscription_request = &(initMsg->value.choice.RICsubscriptionRequest);
+ RICsubscriptionRequest_t * subscription_request = &(initMsg->value.choice.RICsubscriptionRequest);
for(int i = 0; i < subscription_request->protocolIEs.list.size; i++){
subscription_request->protocolIEs.list.array[i] = 0;
@@ -104,7 +104,7 @@
free(initMsg);
e2ap_pdu_obj->choice.initiatingMessage = 0;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
mdclog_write(MDCLOG_DEBUG, "Freed subscription request memory ");
};
@@ -113,25 +113,25 @@
bool res;
- initMsg->procedureCode = E2N_ProcedureCode_id_ricSubscription;
- initMsg->criticality = E2N_Criticality_ignore;
- initMsg->value.present = E2N_InitiatingMessage__value_PR_RICsubscriptionRequest;
+ initMsg->procedureCode = ProcedureCode_id_RICsubscription;
+ initMsg->criticality = Criticality_ignore;
+ initMsg->value.present = InitiatingMessage__value_PR_RICsubscriptionRequest;
res = set_fields(initMsg, dinput);
if (!res){
return false;
}
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
if(ret_constr){
error_string.assign(errbuf, errbuf_len);
error_string = "Constraints failed for encoding subscription request. Reason = " + error_string;
return false;
}
- //xer_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ //xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
if(retval.encoded == -1){
error_string.assign(strerror(errno));
@@ -154,7 +154,7 @@
}
-bool subscription_request::set_fields( E2N_InitiatingMessage_t * init_msg, subscription_helper &helper){
+bool subscription_request::set_fields( InitiatingMessage_t * init_msg, subscription_helper &helper){
int ie_index;
@@ -165,37 +165,37 @@
return false;
}
- E2N_RICsubscriptionRequest_t * ric_subscription = &(init_msg->value.choice.RICsubscriptionRequest);
+ RICsubscriptionRequest_t * ric_subscription = &(init_msg->value.choice.RICsubscriptionRequest);
ric_subscription->protocolIEs.list.count = 0;
ie_index = 0;
- E2N_RICsubscriptionRequest_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICsubscriptionRequest_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ RICsubscriptionRequest_IEs_t *ies_ricreq = &IE_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICsubscriptionRequest_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = helper.get_request_id();
- ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
+ //ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
result = ASN_SEQUENCE_ADD(&(ric_subscription->protocolIEs), &IE_array[ie_index]);
assert(result == 0);
ie_index = 1;
- E2N_RICsubscriptionRequest_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICsubscriptionRequest_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICsubscriptionRequest_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = helper.get_function_id();
result = ASN_SEQUENCE_ADD(&(ric_subscription->protocolIEs), &IE_array[ie_index]);
assert(result == 0);
ie_index = 2;
- E2N_RICsubscriptionRequest_IEs_t *ies_actid = &IE_array[ie_index];
- ies_actid->criticality = E2N_Criticality_reject;
- ies_actid->id = E2N_ProtocolIE_ID_id_RICsubscription;
- ies_actid->value.present = E2N_RICsubscriptionRequest_IEs__value_PR_RICsubscription;
- E2N_RICsubscription_t *ricsubscription_ie = &ies_actid->value.choice.RICsubscription;
+ RICsubscriptionRequest_IEs_t *ies_actid = &IE_array[ie_index];
+ ies_actid->criticality = Criticality_reject;
+ ies_actid->id = ProtocolIE_ID_id_RICsubscriptionDetails;
+ ies_actid->value.present = RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails;
+ RICsubscriptionDetails_t *ricsubscription_ie = &ies_actid->value.choice.RICsubscriptionDetails;
ricsubscription_ie->ricEventTriggerDefinition.buf = (uint8_t *) helper.get_event_def();
ricsubscription_ie->ricEventTriggerDefinition.size = helper.get_event_def_size();
@@ -212,12 +212,12 @@
action_array_size = 2 * ref_action_array->size();
free(action_array);
- action_array = (E2N_RICaction_ToBeSetup_ItemIEs_t *)calloc(action_array_size, sizeof(E2N_RICaction_ToBeSetup_ItemIEs_t));
+ action_array = (RICaction_ToBeSetup_ItemIEs_t *)calloc(action_array_size, sizeof(RICaction_ToBeSetup_ItemIEs_t));
assert(action_array != 0);
// also need to add subsequent action and time to wait ..
for (unsigned int i = 0; i < action_array_size; i++){
- action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = (struct E2N_RICsubsequentAction *)calloc(1, sizeof(struct E2N_RICsubsequentAction));
+ action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction = (struct RICsubsequentAction *)calloc(1, sizeof(struct RICsubsequentAction));
assert(action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction != 0);
}
@@ -227,13 +227,12 @@
ricsubscription_ie->ricAction_ToBeSetup_List.list.count = 0;
for(unsigned int i = 0; i < ref_action_array->size(); i ++){
- action_array[i].criticality = E2N_Criticality_ignore;
- action_array[i].id = E2N_ProtocolIE_ID_id_RICaction_ToBeSetup_Item ;
- action_array[i].value.present = E2N_RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item;
+ action_array[i].criticality = Criticality_ignore;
+ action_array[i].id = ProtocolIE_ID_id_RICaction_ToBeSetup_Item ;
+ action_array[i].value.present = RICaction_ToBeSetup_ItemIEs__value_PR_RICaction_ToBeSetup_Item;
action_array[i].value.choice.RICaction_ToBeSetup_Item.ricActionID = (*ref_action_array)[i].get_id();
action_array[i].value.choice.RICaction_ToBeSetup_Item.ricActionType = (*ref_action_array)[i].get_type();
action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction->ricSubsequentActionType = (*ref_action_array)[i].get_subsequent_action();
- action_array[i].value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction->ricTimeToWait = (*ref_action_array)[i].get_wait();
result = ASN_SEQUENCE_ADD(&ricsubscription_ie->ricAction_ToBeSetup_List, &(action_array[i]));
if (result == -1){
@@ -253,7 +252,7 @@
-bool subscription_request:: get_fields(E2N_InitiatingMessage_t * init_msg, subscription_helper & dout)
+bool subscription_request:: get_fields(InitiatingMessage_t * init_msg, subscription_helper & dout)
{
if (init_msg == 0){
@@ -261,37 +260,36 @@
return false;
}
- E2N_RICrequestID_t *requestid;
- E2N_RANfunctionID_t * ranfunctionid;
- E2N_RICsubscription_t * ricsubscription;
+ RICrequestID_t *requestid;
+ RANfunctionID_t * ranfunctionid;
+ RICsubscriptionDetails_t * ricsubscription;
for(int edx = 0; edx < init_msg->value.choice.RICsubscriptionRequest.protocolIEs.list.count; edx++) {
- E2N_RICsubscriptionRequest_IEs_t *memb_ptr = init_msg->value.choice.RICsubscriptionRequest.protocolIEs.list.array[edx];
+ RICsubscriptionRequest_IEs_t *memb_ptr = init_msg->value.choice.RICsubscriptionRequest.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
requestid = &memb_ptr->value.choice.RICrequestID;
- dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
+ //dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
dout.set_function_id(*ranfunctionid);
break;
- case (E2N_ProtocolIE_ID_id_RICsubscription):
- ricsubscription = &memb_ptr->value.choice.RICsubscription;
+ case (ProtocolIE_ID_id_RICsubscriptionDetails):
+ ricsubscription = &memb_ptr->value.choice.RICsubscriptionDetails;
dout.set_event_def(ricsubscription->ricEventTriggerDefinition.buf, ricsubscription->ricEventTriggerDefinition.size);
for(int index = 0; index < ricsubscription->ricAction_ToBeSetup_List.list.count; index ++){
- E2N_RICaction_ToBeSetup_ItemIEs_t * item = (E2N_RICaction_ToBeSetup_ItemIEs_t *)ricsubscription->ricAction_ToBeSetup_List.list.array[index];
+ RICaction_ToBeSetup_ItemIEs_t * item = (RICaction_ToBeSetup_ItemIEs_t *)ricsubscription->ricAction_ToBeSetup_List.list.array[index];
if (item->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction == NULL){
dout.add_action(item->value.choice.RICaction_ToBeSetup_Item.ricActionID, item->value.choice.RICaction_ToBeSetup_Item.ricActionType);
}
else{
std::string action_def = ""; // for now we are ignoring action definition
- dout.add_action(item->value.choice.RICaction_ToBeSetup_Item.ricActionID, item->value.choice.RICaction_ToBeSetup_Item.ricActionType, action_def, item->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction->ricSubsequentActionType, item->value.choice.RICaction_ToBeSetup_Item.ricSubsequentAction->ricTimeToWait);
}
};
@@ -300,7 +298,7 @@
}
- //asn_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2pdu);
+ //asn_fprint(stdout, &asn_DEF_E2AP_PDU, e2pdu);
return true;
};
diff --git a/src/xapp-asn/e2ap/subscription_request.hpp b/src/xapp-asn/e2ap/subscription_request.hpp
index 28f419a..15695c3 100644
--- a/src/xapp-asn/e2ap/subscription_request.hpp
+++ b/src/xapp-asn/e2ap/subscription_request.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,14 +26,14 @@
#include <sstream>
#include <asn_application.h>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_InitiatingMessage.h>
-#include <E2N_RICsubscriptionRequest.h>
-#include <E2N_RICsubscription.h>
-#include <E2N_ProtocolIE-Field.h>
-#include <E2N_ProtocolIE-Single-Container.h>
-#include <E2N_RICactions-ToBeSetup-List.h>
-#include <E2N_RICsubsequentAction.h>
+#include <E2AP-PDU.h>
+#include <InitiatingMessage.h>
+#include <RICsubscriptionRequest.h>
+#include <RICsubscriptionRequest.h>
+#include <ProtocolIE-Field.h>
+#include <ProtocolIE-SingleContainer.h>
+#include <RICactions-ToBeSetup-List.h>
+#include <RICsubsequentAction.h>
#include "subscription_helper.hpp"
#define NUM_SUBSCRIPTION_REQUEST_IES 3
@@ -47,8 +47,8 @@
~subscription_request(void);
bool encode_e2ap_subscription(unsigned char *, size_t *, subscription_helper &);
- bool set_fields(E2N_InitiatingMessage_t *, subscription_helper &);
- bool get_fields(E2N_InitiatingMessage_t *, subscription_helper &);
+ bool set_fields(InitiatingMessage_t *, subscription_helper &);
+ bool get_fields(InitiatingMessage_t *, subscription_helper &);
std::string get_error(void) const{
return error_string;
@@ -56,11 +56,11 @@
private:
- E2N_InitiatingMessage_t *initMsg;
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
+ InitiatingMessage_t *initMsg;
+ E2AP_PDU_t * e2ap_pdu_obj;
- E2N_RICsubscriptionRequest_IEs_t * IE_array;
- E2N_RICaction_ToBeSetup_ItemIEs_t * action_array;
+ RICsubscriptionRequest_IEs_t * IE_array;
+ RICaction_ToBeSetup_ItemIEs_t * action_array;
unsigned int action_array_size;
char errbuf[128];
size_t errbuf_len = 128;
diff --git a/src/xapp-asn/e2ap/subscription_response.cc b/src/xapp-asn/e2ap/subscription_response.cc
index 5308e81..5ed72fa 100644
--- a/src/xapp-asn/e2ap/subscription_response.cc
+++ b/src/xapp-asn/e2ap/subscription_response.cc
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -28,32 +28,32 @@
subscription_response::subscription_response(void){
e2ap_pdu_obj = 0;
- e2ap_pdu_obj = (E2N_E2AP_PDU_t *)calloc(1, sizeof(E2N_E2AP_PDU_t));
+ e2ap_pdu_obj = (E2AP_PDU_t *)calloc(1, sizeof(E2AP_PDU_t));
assert(e2ap_pdu_obj != 0);
successMsg = 0;
- successMsg = (E2N_SuccessfulOutcome_t *)calloc(1, sizeof(E2N_SuccessfulOutcome_t));
+ successMsg = (SuccessfulOutcome_t *)calloc(1, sizeof(SuccessfulOutcome_t));
assert(successMsg != 0);
unsuccessMsg = 0;
- unsuccessMsg = (E2N_UnsuccessfulOutcome_t *)calloc(1, sizeof(E2N_UnsuccessfulOutcome_t));
+ unsuccessMsg = (UnsuccessfulOutcome_t *)calloc(1, sizeof(UnsuccessfulOutcome_t));
assert(unsuccessMsg != 0);
IE_array = 0;
- IE_array = (E2N_RICsubscriptionResponse_IEs_t *)calloc(NUM_SUBSCRIPTION_RESPONSE_IES, sizeof(E2N_RICsubscriptionResponse_IEs_t));
+ IE_array = (RICsubscriptionResponse_IEs_t *)calloc(NUM_SUBSCRIPTION_RESPONSE_IES, sizeof(RICsubscriptionResponse_IEs_t));
assert(IE_array != 0);
IE_Failure_array = 0;
- IE_Failure_array = (E2N_RICsubscriptionFailure_IEs_t *)calloc(NUM_SUBSCRIPTION_FAILURE_IES, sizeof(E2N_RICsubscriptionFailure_IEs_t));
+ IE_Failure_array = (RICsubscriptionFailure_IEs_t *)calloc(NUM_SUBSCRIPTION_FAILURE_IES, sizeof(RICsubscriptionFailure_IEs_t));
assert(IE_Failure_array != 0);
ie_admitted_list = 0;
- ie_admitted_list = (E2N_RICaction_Admitted_ItemIEs_t *)calloc(INITIAL_RESPONSE_LIST_SIZE, sizeof(E2N_RICaction_Admitted_ItemIEs_t));
+ ie_admitted_list = (RICaction_Admitted_ItemIEs_t *)calloc(INITIAL_RESPONSE_LIST_SIZE, sizeof(RICaction_Admitted_ItemIEs_t));
assert(ie_admitted_list != 0);
ie_admitted_list_size = INITIAL_RESPONSE_LIST_SIZE;
ie_not_admitted_list = 0;
- ie_not_admitted_list = (E2N_RICaction_NotAdmitted_ItemIEs_t *)calloc(INITIAL_RESPONSE_LIST_SIZE, sizeof(E2N_RICaction_NotAdmitted_ItemIEs_t));
+ ie_not_admitted_list = (RICaction_NotAdmitted_ItemIEs_t *)calloc(INITIAL_RESPONSE_LIST_SIZE, sizeof(RICaction_NotAdmitted_ItemIEs_t));
assert(ie_not_admitted_list != 0);
ie_not_admitted_list_size = INITIAL_RESPONSE_LIST_SIZE;
@@ -69,7 +69,7 @@
subscription_response::~subscription_response(void){
mdclog_write(MDCLOG_DEBUG, "Freeing subscription response memory");
- E2N_RICaction_Admitted_List_t * response_admitted_list = (E2N_RICaction_Admitted_List_t *) &(IE_array[2].value.choice.RICaction_Admitted_List);
+ RICaction_Admitted_List_t * response_admitted_list = (RICaction_Admitted_List_t *) &(IE_array[2].value.choice.RICaction_Admitted_List);
for(int i = 0; i < response_admitted_list->list.size; i++){
response_admitted_list->list.array[i] = 0;
@@ -84,7 +84,7 @@
}
- E2N_RICaction_NotAdmitted_List_t * response_not_admitted_list = &(IE_array[3].value.choice.RICaction_NotAdmitted_List);
+ RICaction_NotAdmitted_List_t * response_not_admitted_list = &(IE_array[3].value.choice.RICaction_NotAdmitted_List);
for(int i = 0; i < response_not_admitted_list->list.size; i++){
response_not_admitted_list->list.array[i] = 0;
}
@@ -96,7 +96,7 @@
response_not_admitted_list->list.count = 0;
}
- E2N_RICsubscriptionResponse_t * ric_subscription_response = &(successMsg->value.choice.RICsubscriptionResponse);
+ RICsubscriptionResponse_t * ric_subscription_response = &(successMsg->value.choice.RICsubscriptionResponse);
for(int i = 0; i < ric_subscription_response->protocolIEs.list.size ; i++){
ric_subscription_response->protocolIEs.list.array[i] = 0;
}
@@ -109,7 +109,7 @@
}
- E2N_RICaction_NotAdmitted_List_t * failure_not_admitted_list = &(IE_Failure_array[2].value.choice.RICaction_NotAdmitted_List);
+ RICaction_NotAdmitted_List_t * failure_not_admitted_list = &(IE_Failure_array[2].value.choice.RICaction_NotAdmitted_List);
for(int i = 0; i < failure_not_admitted_list->list.size; i++){
failure_not_admitted_list->list.array[i] = 0;
}
@@ -122,7 +122,7 @@
}
- E2N_RICsubscriptionFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionFailure);
+ RICsubscriptionFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionFailure);
for(int i = 0; i < ric_subscription_failure->protocolIEs.list.size; i++){
ric_subscription_failure->protocolIEs.list.array[i] = 0;
}
@@ -141,13 +141,13 @@
free(IE_array);
- ASN_STRUCT_FREE(asn_DEF_E2N_SuccessfulOutcome, successMsg);
- ASN_STRUCT_FREE(asn_DEF_E2N_UnsuccessfulOutcome, unsuccessMsg);
+ ASN_STRUCT_FREE(asn_DEF_SuccessfulOutcome, successMsg);
+ ASN_STRUCT_FREE(asn_DEF_UnsuccessfulOutcome, unsuccessMsg);
e2ap_pdu_obj->choice.initiatingMessage = NULL;
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_NOTHING;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj);
+ e2ap_pdu_obj->present = E2AP_PDU_PR_NOTHING;
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2ap_pdu_obj);
mdclog_write(MDCLOG_DEBUG, "Freed subscription response memory ");
@@ -160,35 +160,35 @@
if(is_success){
set_fields_success(dinput);
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_successfulOutcome;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_successfulOutcome;
e2ap_pdu_obj->choice.successfulOutcome = successMsg;
- successMsg->procedureCode = E2N_ProcedureCode_id_ricSubscription;
- successMsg->criticality = E2N_Criticality_reject;
- successMsg->value.present = E2N_SuccessfulOutcome__value_PR_RICsubscriptionResponse;
+ successMsg->procedureCode = ProcedureCode_id_RICsubscription;
+ successMsg->criticality = Criticality_reject;
+ successMsg->value.present = SuccessfulOutcome__value_PR_RICsubscriptionResponse;
}
else{
set_fields_unsuccess(dinput);
- e2ap_pdu_obj->present = E2N_E2AP_PDU_PR_unsuccessfulOutcome;
+ e2ap_pdu_obj->present = E2AP_PDU_PR_unsuccessfulOutcome;
e2ap_pdu_obj->choice.unsuccessfulOutcome = unsuccessMsg;
- unsuccessMsg->procedureCode = E2N_ProcedureCode_id_ricSubscription;
- unsuccessMsg->criticality = E2N_Criticality_reject;
- unsuccessMsg->value.present = E2N_UnsuccessfulOutcome__value_PR_RICsubscriptionFailure;
+ unsuccessMsg->procedureCode = ProcedureCode_id_RICsubscription;
+ unsuccessMsg->criticality = Criticality_reject;
+ unsuccessMsg->value.present = UnsuccessfulOutcome__value_PR_RICsubscriptionFailure;
}
//xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2ap_pdu_obj);
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
+ int ret_constr = asn_check_constraints(&asn_DEF_E2AP_PDU, (void *) e2ap_pdu_obj, errbuf, &errbuf_len);
if(ret_constr){
error_string.assign(errbuf, errbuf_len);
error_string = "Constraints failed for encoding subscription response. Reason = " + error_string;
return false;
}
- asn_enc_rval_t res = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, e2ap_pdu_obj, buf, *size);
+ asn_enc_rval_t res = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, e2ap_pdu_obj, buf, *size);
if(res.encoded == -1){
std::cout <<"Error encoding PDU. Reason =" << strerror(errno) << std::endl;
@@ -196,7 +196,7 @@
}
else {
if(*size < res.encoded){
- fprintf(stderr, "Buffer assigned too small to encode: %s",(char *)(asn_DEF_E2N_E2AP_PDU.name));
+ fprintf(stderr, "Buffer assigned too small to encode: %s",(char *)(asn_DEF_E2AP_PDU.name));
res.encoded = -1;
return false;
}
@@ -211,59 +211,59 @@
int ie_index;
- E2N_RICsubscriptionResponse_t * subscription_response = &(successMsg->value.choice.RICsubscriptionResponse);
+ RICsubscriptionResponse_t * subscription_response = &(successMsg->value.choice.RICsubscriptionResponse);
//reset list count ..
subscription_response->protocolIEs.list.count = 0;
ie_index = 0;
- E2N_RICsubscriptionResponse_IEs_t *ies_ricreq = &IE_array[ie_index];
+ RICsubscriptionResponse_IEs_t *ies_ricreq = &IE_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICsubscriptionResponse_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = helper.get_request_id();
- ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
+ // ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
ASN_SEQUENCE_ADD(&subscription_response->protocolIEs, &(IE_array[ie_index]));
ie_index = 1;
- E2N_RICsubscriptionResponse_IEs_t *ies_ranfunc = &IE_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICsubscriptionResponse_IEs_t *ies_ranfunc = &IE_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICsubscriptionResponse_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = helper.get_function_id();
ASN_SEQUENCE_ADD(&subscription_response->protocolIEs, &(IE_array[ie_index]));
ie_index = 2;
- E2N_RICsubscriptionResponse_IEs_t *ies_admitted_actid = &IE_array[ie_index];
- ies_admitted_actid->criticality = E2N_Criticality_reject;
- ies_admitted_actid->id = E2N_ProtocolIE_ID_id_RICactions_Admitted;
- E2N_RICaction_Admitted_List_t *ric_admitted_actions_ie = &ies_admitted_actid->value.choice.RICaction_Admitted_List;
+ RICsubscriptionResponse_IEs_t *ies_admitted_actid = &IE_array[ie_index];
+ ies_admitted_actid->criticality = Criticality_reject;
+ ies_admitted_actid->id = ProtocolIE_ID_id_RICactions_Admitted;
+ RICaction_Admitted_List_t *ric_admitted_actions_ie = &ies_admitted_actid->value.choice.RICaction_Admitted_List;
ric_admitted_actions_ie->list.count = 0;
std::vector<ActionResponse> * ref_admitted_action_array = helper.get_admitted_list();
if(ref_admitted_action_array->size() == 0){
- ies_admitted_actid->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_NOTHING;
+ ies_admitted_actid->value.present = RICsubscriptionResponse_IEs__value_PR_NOTHING;
}
else{
- ies_admitted_actid->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
+ ies_admitted_actid->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_Admitted_List;
// resize memory ?
if (ref_admitted_action_array->size() >= ie_admitted_list_size){
ie_admitted_list_size = 2 * ref_admitted_action_array->size();
free(ie_admitted_list);
- ie_admitted_list = (E2N_RICaction_Admitted_ItemIEs_t *)calloc(ie_admitted_list_size, sizeof(E2N_RICaction_Admitted_ItemIEs_t));
+ ie_admitted_list = (RICaction_Admitted_ItemIEs_t *)calloc(ie_admitted_list_size, sizeof(RICaction_Admitted_ItemIEs_t));
assert(ie_admitted_list != 0);
};
for(unsigned int i = 0; i < ref_admitted_action_array->size(); i ++){
- ie_admitted_list[i].criticality = E2N_Criticality_ignore;
- ie_admitted_list[i].id = E2N_ProtocolIE_ID_id_RICaction_Admitted_Item ;
- ie_admitted_list[i].value.present = E2N_RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
+ ie_admitted_list[i].criticality = Criticality_ignore;
+ ie_admitted_list[i].id = ProtocolIE_ID_id_RICaction_Admitted_Item ;
+ ie_admitted_list[i].value.present = RICaction_Admitted_ItemIEs__value_PR_RICaction_Admitted_Item;
ie_admitted_list[i].value.choice.RICaction_Admitted_Item.ricActionID = (*ref_admitted_action_array)[i].get_id();
ASN_SEQUENCE_ADD(ric_admitted_actions_ie, &(ie_admitted_list[i]));
}
@@ -275,55 +275,55 @@
std::vector<ActionResponse> * ref_notadmitted_action_array = helper.get_not_admitted_list();
if (ref_notadmitted_action_array->size() > 0){
- E2N_RICsubscriptionResponse_IEs_t *ies_notadmitted_actid = &IE_array[ie_index];
- ies_notadmitted_actid->criticality = E2N_Criticality_reject;
- ies_notadmitted_actid->id = E2N_ProtocolIE_ID_id_RICactions_NotAdmitted;
+ RICsubscriptionResponse_IEs_t *ies_notadmitted_actid = &IE_array[ie_index];
+ ies_notadmitted_actid->criticality = Criticality_reject;
+ ies_notadmitted_actid->id = ProtocolIE_ID_id_RICactions_NotAdmitted;
- E2N_RICaction_NotAdmitted_List_t *ric_not_admitted_actions_ie = &ies_notadmitted_actid->value.choice.RICaction_NotAdmitted_List;
+ RICaction_NotAdmitted_List_t *ric_not_admitted_actions_ie = &ies_notadmitted_actid->value.choice.RICaction_NotAdmitted_List;
ric_not_admitted_actions_ie->list.count = 0;
- ies_notadmitted_actid->value.present = E2N_RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List;
+ ies_notadmitted_actid->value.present = RICsubscriptionResponse_IEs__value_PR_RICaction_NotAdmitted_List;
// resize memory ?
if (ref_notadmitted_action_array->size() >= ie_not_admitted_list_size){
ie_not_admitted_list_size = 2 * ref_notadmitted_action_array->size();
free(ie_not_admitted_list);
- ie_not_admitted_list = (E2N_RICaction_NotAdmitted_ItemIEs_t *)calloc(ie_not_admitted_list_size, sizeof(E2N_RICaction_NotAdmitted_ItemIEs_t));
+ ie_not_admitted_list = (RICaction_NotAdmitted_ItemIEs_t *)calloc(ie_not_admitted_list_size, sizeof(RICaction_NotAdmitted_ItemIEs_t));
assert(ie_not_admitted_list != 0);
};
for(unsigned int i = 0; i < ref_notadmitted_action_array->size(); i ++){
- ie_not_admitted_list[i].criticality = E2N_Criticality_ignore;
- ie_not_admitted_list[i].id = E2N_ProtocolIE_ID_id_RICaction_NotAdmitted_Item ;
- ie_not_admitted_list[i].value.present = E2N_RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;;
+ ie_not_admitted_list[i].criticality = Criticality_ignore;
+ ie_not_admitted_list[i].id = ProtocolIE_ID_id_RICaction_NotAdmitted_Item ;
+ ie_not_admitted_list[i].value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;;
ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricActionID = (*ref_notadmitted_action_array)[i].get_id();
int cause = (*ref_notadmitted_action_array)[i].get_cause();
switch(cause){
- case E2N_RICcause_PR_radioNetwork:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ case Cause_PR_ricService:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.ricService = (*ref_notadmitted_action_array)[i].get_sub_cause();
break;
- case E2N_RICcause_PR_transport:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ case Cause_PR_transport:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.transport = (*ref_notadmitted_action_array)[i].get_sub_cause();
break;
- case E2N_RICcause_PR_protocol:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol= (*ref_notadmitted_action_array)[i].get_sub_cause();
+ case Cause_PR_protocol:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.protocol= (*ref_notadmitted_action_array)[i].get_sub_cause();
break;
- case E2N_RICcause_PR_misc:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ case Cause_PR_misc:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.misc = (*ref_notadmitted_action_array)[i].get_sub_cause();
break;
- case E2N_RICcause_PR_ric:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ case Cause_PR_ricRequest:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.ricRequest = (*ref_notadmitted_action_array)[i].get_sub_cause();
break;
default:
mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Unknown RIC cause %d\n", __FILE__, __LINE__, cause);
return;
}
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.present = (E2N_RICcause_PR)cause;
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.present = (Cause_PR)cause;
ASN_SEQUENCE_ADD(ric_not_admitted_actions_ie, &(ie_not_admitted_list[i]));
}
@@ -332,71 +332,71 @@
}
-void subscription_response:: get_fields(E2N_SuccessfulOutcome_t * success_msg, subscription_response_helper & dout)
+void subscription_response:: get_fields(SuccessfulOutcome_t * success_msg, subscription_response_helper & dout)
{
assert(success_msg != NULL);
- E2N_RICrequestID_t *requestid;
- E2N_RANfunctionID_t * ranfunctionid;
- E2N_RICaction_Admitted_List_t * ric_admitted_action_list;
- E2N_RICaction_NotAdmitted_List_t * ric_not_admitted_action_list;
+ RICrequestID_t *requestid;
+ RANfunctionID_t * ranfunctionid;
+ RICaction_Admitted_List_t * ric_admitted_action_list;
+ RICaction_NotAdmitted_List_t * ric_not_admitted_action_list;
for(int edx = 0; edx < success_msg->value.choice.RICsubscriptionResponse.protocolIEs.list.count; edx++) {
- E2N_RICsubscriptionResponse_IEs_t *memb_ptr = success_msg->value.choice.RICsubscriptionResponse.protocolIEs.list.array[edx];
+ RICsubscriptionResponse_IEs_t *memb_ptr = success_msg->value.choice.RICsubscriptionResponse.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
requestid = &memb_ptr->value.choice.RICrequestID;
- dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
+ //dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
dout.set_function_id(*ranfunctionid);
break;
- case (E2N_ProtocolIE_ID_id_RICactions_Admitted):
+ case (ProtocolIE_ID_id_RICactions_Admitted):
ric_admitted_action_list = &memb_ptr->value.choice.RICaction_Admitted_List;
// admitted actions
for(int index = 0; index < ric_admitted_action_list->list.count; index ++){
- E2N_RICaction_Admitted_ItemIEs_t * item = (E2N_RICaction_Admitted_ItemIEs_t *)ric_admitted_action_list->list.array[index];
+ RICaction_Admitted_ItemIEs_t * item = (RICaction_Admitted_ItemIEs_t *)ric_admitted_action_list->list.array[index];
long int id = item->value.choice.RICaction_Admitted_Item.ricActionID;
dout.get_admitted_list()->push_back(ActionResponse(id));
};
break;
- case (E2N_ProtocolIE_ID_id_RICactions_NotAdmitted):
+ case (ProtocolIE_ID_id_RICactions_NotAdmitted):
ric_not_admitted_action_list = &memb_ptr->value.choice.RICaction_NotAdmitted_List;
for(int index = 0; index < ric_not_admitted_action_list->list.count; index ++){
- E2N_RICaction_NotAdmitted_ItemIEs_t * item = (E2N_RICaction_NotAdmitted_ItemIEs_t *)ric_not_admitted_action_list->list.array[index];
+ RICaction_NotAdmitted_ItemIEs_t * item = (RICaction_NotAdmitted_ItemIEs_t *)ric_not_admitted_action_list->list.array[index];
long int id = item->value.choice.RICaction_NotAdmitted_Item.ricActionID;
- int cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.present;
+ int cause = item->value.choice.RICaction_NotAdmitted_Item.cause.present;
int sub_cause;
switch(cause){
- case E2N_RICcause_PR_radioNetwork :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork;
+ case Cause_PR_ricService :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricService;
break;
- case E2N_RICcause_PR_transport :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport;
+ case Cause_PR_transport :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.transport;
break;
- case E2N_RICcause_PR_protocol :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol;
+ case Cause_PR_protocol :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.protocol;
break;
- case E2N_RICcause_PR_misc :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc;
+ case Cause_PR_misc :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.misc;
break;
- case E2N_RICcause_PR_ric :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric;
+ case Cause_PR_ricRequest :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricRequest;
break;
default:
@@ -417,81 +417,81 @@
void subscription_response::set_fields_unsuccess( subscription_response_helper &helper){
int ie_index;
- E2N_RICsubscriptionFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionFailure);
+ RICsubscriptionFailure_t * ric_subscription_failure = &(unsuccessMsg->value.choice.RICsubscriptionFailure);
// reset list count
ric_subscription_failure->protocolIEs.list.count = 0;
ie_index = 0;
- E2N_RICsubscriptionFailure_IEs_t *ies_ricreq = &IE_Failure_array[ie_index];
- ies_ricreq->criticality = E2N_Criticality_reject;
- ies_ricreq->id = E2N_ProtocolIE_ID_id_RICrequestID;
- ies_ricreq->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_RICrequestID;
- E2N_RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
+ RICsubscriptionFailure_IEs_t *ies_ricreq = &IE_Failure_array[ie_index];
+ ies_ricreq->criticality = Criticality_reject;
+ ies_ricreq->id = ProtocolIE_ID_id_RICrequestID;
+ ies_ricreq->value.present = RICsubscriptionFailure_IEs__value_PR_RICrequestID;
+ RICrequestID_t *ricrequest_ie = &ies_ricreq->value.choice.RICrequestID;
ricrequest_ie->ricRequestorID = helper.get_request_id();
- ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
+// ricrequest_ie->ricRequestSequenceNumber = helper.get_req_seq();
ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, &(IE_Failure_array[ie_index]));
ie_index = 1;
- E2N_RICsubscriptionFailure_IEs_t *ies_ranfunc = &IE_Failure_array[ie_index];
- ies_ranfunc->criticality = E2N_Criticality_reject;
- ies_ranfunc->id = E2N_ProtocolIE_ID_id_RANfunctionID;
- ies_ranfunc->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_RANfunctionID;
- E2N_RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
+ RICsubscriptionFailure_IEs_t *ies_ranfunc = &IE_Failure_array[ie_index];
+ ies_ranfunc->criticality = Criticality_reject;
+ ies_ranfunc->id = ProtocolIE_ID_id_RANfunctionID;
+ ies_ranfunc->value.present = RICsubscriptionFailure_IEs__value_PR_RANfunctionID;
+ RANfunctionID_t *ranfunction_ie = &ies_ranfunc->value.choice.RANfunctionID;
*ranfunction_ie = helper.get_function_id();
ASN_SEQUENCE_ADD(&ric_subscription_failure->protocolIEs, &(IE_Failure_array[ie_index]));
ie_index = 2;
- E2N_RICsubscriptionFailure_IEs_t *ies_notadmitted_actid = &IE_Failure_array[ie_index];
- ies_notadmitted_actid->criticality = E2N_Criticality_reject;
- ies_notadmitted_actid->id = E2N_ProtocolIE_ID_id_RICactions_NotAdmitted;
- E2N_RICaction_NotAdmitted_List_t *ric_not_admitted_actions_ie = &ies_notadmitted_actid->value.choice.RICaction_NotAdmitted_List;
+ RICsubscriptionFailure_IEs_t *ies_notadmitted_actid = &IE_Failure_array[ie_index];
+ ies_notadmitted_actid->criticality = Criticality_reject;
+ ies_notadmitted_actid->id = ProtocolIE_ID_id_RICactions_NotAdmitted;
+ RICaction_NotAdmitted_List_t *ric_not_admitted_actions_ie = &ies_notadmitted_actid->value.choice.RICaction_NotAdmitted_List;
ric_not_admitted_actions_ie->list.count = 0;
std::vector<ActionResponse> * ref_notadmitted_action_array = helper.get_not_admitted_list();
if(ref_notadmitted_action_array->size() == 0){
- ies_notadmitted_actid->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_NOTHING;
+ ies_notadmitted_actid->value.present = RICsubscriptionFailure_IEs__value_PR_NOTHING;
}
else{
- ies_notadmitted_actid->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_RICaction_NotAdmitted_List;
+ ies_notadmitted_actid->value.present = RICsubscriptionFailure_IEs__value_PR_RICaction_NotAdmitted_List;
// resize memory ?
if (ref_notadmitted_action_array->size() >= ie_not_admitted_list_size){
ie_not_admitted_list_size = 2 * ref_notadmitted_action_array->size();
free(ie_not_admitted_list);
- ie_not_admitted_list = (E2N_RICaction_NotAdmitted_ItemIEs_t *)calloc(ie_not_admitted_list_size, sizeof(E2N_RICaction_NotAdmitted_ItemIEs_t));
+ ie_not_admitted_list = (RICaction_NotAdmitted_ItemIEs_t *)calloc(ie_not_admitted_list_size, sizeof(RICaction_NotAdmitted_ItemIEs_t));
assert(ie_not_admitted_list != 0);
};
// reset the list count on ricAction_ToBeSetup_List;
for(unsigned int i = 0; i < ref_notadmitted_action_array->size(); i ++){
- ie_not_admitted_list[i].criticality = E2N_Criticality_ignore;
- ie_not_admitted_list[i].id = E2N_ProtocolIE_ID_id_RICaction_NotAdmitted_Item ;
- ie_not_admitted_list[i].value.present = E2N_RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;;
+ ie_not_admitted_list[i].criticality = Criticality_ignore;
+ ie_not_admitted_list[i].id = ProtocolIE_ID_id_RICaction_NotAdmitted_Item ;
+ ie_not_admitted_list[i].value.present = RICaction_NotAdmitted_ItemIEs__value_PR_RICaction_NotAdmitted_Item;;
ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricActionID = (*ref_notadmitted_action_array)[i].get_id();
int cause = (*ref_notadmitted_action_array)[i].get_cause();
switch(cause){
- case E2N_RICcause_PR_radioNetwork:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork = (*ref_notadmitted_action_array)[i].get_sub_cause();
- break;
- case E2N_RICcause_PR_transport:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport = (*ref_notadmitted_action_array)[i].get_sub_cause();
- break;
- case E2N_RICcause_PR_protocol:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol= (*ref_notadmitted_action_array)[i].get_sub_cause();
- break;
- case E2N_RICcause_PR_misc:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc = (*ref_notadmitted_action_array)[i].get_sub_cause();
- break;
- case E2N_RICcause_PR_ric:
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric = (*ref_notadmitted_action_array)[i].get_sub_cause();
- break;
+ case Cause_PR_ricService:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.ricService = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ break;
+ case Cause_PR_transport:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.transport = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ break;
+ case Cause_PR_protocol:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.protocol= (*ref_notadmitted_action_array)[i].get_sub_cause();
+ break;
+ case Cause_PR_misc:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.misc = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ break;
+ case Cause_PR_ricRequest:
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.choice.ricRequest = (*ref_notadmitted_action_array)[i].get_sub_cause();
+ break;
default:
mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Unknown RIC cause %d\n", __FILE__, __LINE__, cause);
return ;
}
- ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.ricCause.present = (E2N_RICcause_PR)cause;
+ ie_not_admitted_list[i].value.choice.RICaction_NotAdmitted_Item.cause.present = (Cause_PR)cause;
ASN_SEQUENCE_ADD(ric_not_admitted_actions_ie, &(ie_not_admitted_list[i]));
}
@@ -502,67 +502,67 @@
// // criticality diagnostics is not generated/parsed currently since optional
// i = 3;
- // E2N_RICsubscriptionFailure_IEs_t *ies_criticality_diagnostics= &IE_Failure_array[i];
- // ies_criticality_diagnostics->criticality = E2N_Criticality_ignore;
- // ies_criticality_diagnostics->id = E2N_ProtocolIE_ID_id_CriticalityDiagnostics ;
- // ies_criticality_diagnostics->value.present = E2N_RICsubscriptionFailure_IEs__value_PR_NOTHING;
+ // RICsubscriptionFailure_IEs_t *ies_criticality_diagnostics= &IE_Failure_array[i];
+ // ies_criticality_diagnostics->criticality = Criticality_ignore;
+ // ies_criticality_diagnostics->id = ProtocolIE_ID_id_CriticalityDiagnostics ;
+ // ies_criticality_diagnostics->value.present = RICsubscriptionFailure_IEs__value_PR_NOTHING;
}
-void subscription_response:: get_fields(E2N_UnsuccessfulOutcome_t * unsuccess_msg, subscription_response_helper & dout)
+void subscription_response:: get_fields(UnsuccessfulOutcome_t * unsuccess_msg, subscription_response_helper & dout)
{
assert(unsuccess_msg != NULL);
- E2N_RICrequestID_t *requestid;
- E2N_RANfunctionID_t * ranfunctionid;
- E2N_RICaction_NotAdmitted_List_t * ric_not_admitted_action_list;
+ RICrequestID_t *requestid;
+ RANfunctionID_t * ranfunctionid;
+ RICaction_NotAdmitted_List_t * ric_not_admitted_action_list;
for(int edx = 0; edx < unsuccess_msg->value.choice.RICsubscriptionFailure.protocolIEs.list.count; edx++) {
- E2N_RICsubscriptionFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICsubscriptionFailure.protocolIEs.list.array[edx];
+ RICsubscriptionFailure_IEs_t *memb_ptr = unsuccess_msg->value.choice.RICsubscriptionFailure.protocolIEs.list.array[edx];
switch(memb_ptr->id)
{
- case (E2N_ProtocolIE_ID_id_RICrequestID):
+ case (ProtocolIE_ID_id_RICrequestID):
requestid = &memb_ptr->value.choice.RICrequestID;
- dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
+ //dout.set_request(requestid->ricRequestorID, requestid->ricRequestSequenceNumber);
break;
- case (E2N_ProtocolIE_ID_id_RANfunctionID):
+ case (ProtocolIE_ID_id_RANfunctionID):
ranfunctionid = &memb_ptr->value.choice.RANfunctionID;
dout.set_function_id(*ranfunctionid);
break;
- case (E2N_ProtocolIE_ID_id_RICactions_NotAdmitted):
+ case (ProtocolIE_ID_id_RICactions_NotAdmitted):
ric_not_admitted_action_list = &memb_ptr->value.choice.RICaction_NotAdmitted_List;
for(int index = 0; index < ric_not_admitted_action_list->list.count; index ++){
- E2N_RICaction_NotAdmitted_ItemIEs_t * item = (E2N_RICaction_NotAdmitted_ItemIEs_t *)ric_not_admitted_action_list->list.array[index];
+ RICaction_NotAdmitted_ItemIEs_t * item = (RICaction_NotAdmitted_ItemIEs_t *)ric_not_admitted_action_list->list.array[index];
long int id = item->value.choice.RICaction_NotAdmitted_Item.ricActionID;
- int cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.present;
+ int cause = item->value.choice.RICaction_NotAdmitted_Item.cause.present;
int sub_cause;
switch(cause){
- case E2N_RICcause_PR_radioNetwork :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.radioNetwork;
+ case Cause_PR_ricService :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricService;
break;
- case E2N_RICcause_PR_transport :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.transport;
+ case Cause_PR_transport :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.transport;
break;
- case E2N_RICcause_PR_protocol :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.protocol;
+ case Cause_PR_protocol :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.protocol;
break;
- case E2N_RICcause_PR_misc :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.misc;
+ case Cause_PR_misc :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.misc;
break;
- case E2N_RICcause_PR_ric :
- sub_cause = item->value.choice.RICaction_NotAdmitted_Item.ricCause.choice.ric;
+ case Cause_PR_ricRequest :
+ sub_cause = item->value.choice.RICaction_NotAdmitted_Item.cause.choice.ricRequest;
break;
default:
diff --git a/src/xapp-asn/e2ap/subscription_response.hpp b/src/xapp-asn/e2ap/subscription_response.hpp
index 28fad4e..85469bf 100644
--- a/src/xapp-asn/e2ap/subscription_response.hpp
+++ b/src/xapp-asn/e2ap/subscription_response.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,12 +26,12 @@
#include <iostream>
#include <sstream>
#include <asn_application.h>
-#include <E2N_E2AP-PDU.h>
-#include <E2N_SuccessfulOutcome.h>
-#include <E2N_UnsuccessfulOutcome.h>
-#include <E2N_ProtocolIE-Field.h>
-#include <E2N_ProtocolIE-Single-Container.h>
-#include <E2N_ProcedureCode.h>
+#include <E2AP-PDU.h>
+#include <SuccessfulOutcome.h>
+#include <UnsuccessfulOutcome.h>
+#include <ProtocolIE-Field.h>
+#include <ProtocolIE-SingleContainer.h>
+#include <ProcedureCode.h>
#include "response_helper.hpp"
#define NUM_SUBSCRIPTION_RESPONSE_IES 4
@@ -45,8 +45,8 @@
~subscription_response(void);
bool encode_e2ap_subscription_response(unsigned char *, size_t *, subscription_response_helper &, bool);
- void get_fields(E2N_SuccessfulOutcome_t *, subscription_response_helper &);
- void get_fields(E2N_UnsuccessfulOutcome_t *, subscription_response_helper &);
+ void get_fields(SuccessfulOutcome_t *, subscription_response_helper &);
+ void get_fields(UnsuccessfulOutcome_t *, subscription_response_helper &);
std::string get_error(void) const{
return error_string;
@@ -57,17 +57,17 @@
void set_fields_success( subscription_response_helper &);
void set_fields_unsuccess( subscription_response_helper &);
- E2N_E2AP_PDU_t * e2ap_pdu_obj;
- E2N_SuccessfulOutcome_t * successMsg;
- E2N_UnsuccessfulOutcome_t * unsuccessMsg;
+ E2AP_PDU_t * e2ap_pdu_obj;
+ SuccessfulOutcome_t * successMsg;
+ UnsuccessfulOutcome_t * unsuccessMsg;
- E2N_RICsubscriptionResponse_IEs_t *IE_array;
- E2N_RICsubscriptionFailure_IEs_t *IE_Failure_array;
+ RICsubscriptionResponse_IEs_t *IE_array;
+ RICsubscriptionFailure_IEs_t *IE_Failure_array;
- E2N_RICaction_Admitted_ItemIEs_t * ie_admitted_list;
- E2N_RICaction_NotAdmitted_ItemIEs_t * ie_not_admitted_list;
+ RICaction_Admitted_ItemIEs_t * ie_admitted_list;
+ RICaction_NotAdmitted_ItemIEs_t * ie_not_admitted_list;
unsigned int ie_admitted_list_size, ie_not_admitted_list_size;
char errbuf[128];
diff --git a/src/xapp-asn/e2sm/e2sm.cc b/src/xapp-asn/e2sm/e2sm.cc
deleted file mode 100644
index c476c83..0000000
--- a/src/xapp-asn/e2sm/e2sm.cc
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- ==================================================================================
-
- Copyright (c) 2018-2019 AT&T Intellectual Property.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, softwares
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ==================================================================================
-*/
-
-/* Classes to handle E2 service model based on e2sm-gNB-X2-release-1-v040.asn */
-
-#include "e2sm.hpp"
-
-
-
- //initialize
- e2sm_event_trigger::e2sm_event_trigger(void){
-
- memset(&gNodeB_ID, 0, sizeof(E2N_GlobalGNB_ID_t));
-
- event_trigger = 0;
- event_trigger = ( E2N_E2SM_gNB_X2_eventTriggerDefinition_t *)calloc(1, sizeof( E2N_E2SM_gNB_X2_eventTriggerDefinition_t));
- assert(event_trigger != 0);
-
- // allocate space for gNodeB id (used for encoding)
- gNodeB_ID.gNB_ID.choice.gNB_ID.buf = 0;
- gNodeB_ID.gNB_ID.choice.gNB_ID.buf = (uint8_t *)calloc(4, sizeof(uint8_t));
- assert(gNodeB_ID.gNB_ID.choice.gNB_ID.buf != 0);
-
- // allocate space for plmn identity (used for encoding)
- gNodeB_ID.pLMN_Identity.buf = 0;
- gNodeB_ID.pLMN_Identity.buf = (uint8_t *) calloc(4, sizeof(uint8_t));
- assert(gNodeB_ID.pLMN_Identity.buf != 0);
-
- ie_list = 0;
- ie_list = ( struct E2N_InterfaceProtocolIE_Item *) calloc(INITIAL_LIST_SIZE, sizeof( struct E2N_InterfaceProtocolIE_Item));
- assert(ie_list != 0);
- ie_list_size = INITIAL_LIST_SIZE;
-
- condition_list = 0;
- condition_list = (E2N_E2SM_gNB_X2_eventTriggerDefinition::E2N_E2SM_gNB_X2_eventTriggerDefinition__interfaceProtocolIE_List *) calloc(1, sizeof(E2N_E2SM_gNB_X2_eventTriggerDefinition::E2N_E2SM_gNB_X2_eventTriggerDefinition__interfaceProtocolIE_List ));
- assert(condition_list != 0);
-
-
-
- };
-
-e2sm_event_trigger::~e2sm_event_trigger(void){
-
- mdclog_write(MDCLOG_DEBUG, "Freeing event trigger object memory");
- for(int i = 0; i < condition_list->list.size; i++){
- condition_list->list.array[i] = 0;
- }
-
- if (condition_list->list.size > 0){
- free(condition_list->list.array);
- condition_list->list.array = 0;
- condition_list->list.size = 0;
- condition_list->list.count = 0;
- }
-
- free(condition_list);
- condition_list = 0;
-
- free(gNodeB_ID.gNB_ID.choice.gNB_ID.buf);
- gNodeB_ID.gNB_ID.choice.gNB_ID.buf = 0;
-
- free(gNodeB_ID.pLMN_Identity.buf);
- gNodeB_ID.pLMN_Identity.buf = 0;
-
- free(ie_list);
- ie_list = 0;
-
- event_trigger->interface_ID.choice.global_gNB_ID = 0;
- event_trigger->interfaceProtocolIE_List = 0;
-
- ASN_STRUCT_FREE(asn_DEF_E2N_E2SM_gNB_X2_eventTriggerDefinition, event_trigger);
- mdclog_write(MDCLOG_DEBUG, "Freed event trigger object memory");
-
-
-};
-
-bool e2sm_event_trigger::encode_event_trigger(unsigned char *buf, size_t *size, e2sm_event_trigger_helper &helper){
-
- bool res;
- res = set_fields(event_trigger, helper);
- if (!res){
- return false;
- }
-
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2SM_gNB_X2_eventTriggerDefinition, event_trigger, errbuf, &errbuf_len);
- if(ret_constr){
- error_string.assign(&errbuf[0], errbuf_len);
- return false;
- }
-
- //xer_fprint(stdout, &asn_DEF_E2N_E2SM_gNB_X2_eventTriggerDefinition, event_trigger);
-
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2SM_gNB_X2_eventTriggerDefinition, event_trigger, buf, *size);
-
- if(retval.encoded == -1){
- error_string.assign(strerror(errno));
- return false;
- }
- else if (retval.encoded > *size){
- std::stringstream ss;
- ss <<"Error encoding event trigger definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
- error_string = ss.str();
- return false;
- }
- else{
- *size = retval.encoded;
- }
-
- return true;
-}
-
-
-bool e2sm_event_trigger::set_fields(E2N_E2SM_gNB_X2_eventTriggerDefinition_t * ref_event_trigger, e2sm_event_trigger_helper & helper){
- if(ref_event_trigger == 0){
- error_string = "Invalid reference for Event Trigger Definition set fields";
- return false;
- }
-
- // set the message type
- ref_event_trigger->interfaceMessageType.procedureCode = helper.procedure_code;
- ref_event_trigger->interfaceMessageType.typeOfMessage = helper.message_type;
-
- ref_event_trigger->interfaceDirection = helper.interface_direction;
- ref_event_trigger->interface_ID.present = E2N_Interface_ID_PR_global_gNB_ID;
-
- ref_event_trigger->interface_ID.choice.global_gNB_ID = &gNodeB_ID;
-
- // to do : need to put correct code here for upding plmn id and gNodeB
- // for now just place holders :
- //================================================================
- memcpy(gNodeB_ID.pLMN_Identity.buf, helper.plmn_id.c_str(), 3);
- gNodeB_ID.pLMN_Identity.size = 3;
-
- memcpy(gNodeB_ID.gNB_ID.choice.gNB_ID.buf, helper.egNB_id.c_str(), 3);
- gNodeB_ID.gNB_ID.choice.gNB_ID.size = 3;
-
- // we only do global gNodeB id for now, not eNodeB
- gNodeB_ID.gNB_ID.present = E2N_GNB_ID_PR_gNB_ID;
- //================================================================
-
-
- // Add in any requested IE items
- std::vector<Item> * ref_ie_array = helper.get_list();
-
- if (ref_ie_array->size() == 0){
- ref_event_trigger->interfaceProtocolIE_List = 0;
-
- }
- else{
- ref_event_trigger->interfaceProtocolIE_List = condition_list;
-
- //resize memory ?
- if(ref_ie_array->size() > ie_list_size){
- ie_list_size = 2 * ref_ie_array->size();
- free(ie_list);
- ie_list = (struct E2N_InterfaceProtocolIE_Item *)calloc(ie_list_size, sizeof(struct E2N_InterfaceProtocolIE_Item));
- assert(ie_list != 0);
- }
-
- // reset the count so that adds start from the beginning
- ref_event_trigger->interfaceProtocolIE_List->list.count = 0;
-
- for(unsigned int i = 0; i < ref_ie_array->size(); i++){
-
- ie_list[i].interfaceProtocolIE_ID = (*ref_ie_array)[i].interface_id;
- ie_list[i].interfaceProtocolIE_Test = (*ref_ie_array)[i].test;
-
- //switch(ie_list[i].interfaceProtocolIE_Value.present){
- switch((*ref_ie_array)[i].val_type){
-
- case (E2N_InterfaceProtocolIE_Value_PR_valueInt):
- ie_list[i].interfaceProtocolIE_Value.present = E2N_InterfaceProtocolIE_Value_PR_valueInt;
- ie_list[i].interfaceProtocolIE_Value.choice.valueInt = (*ref_ie_array)[i].value_n;
- break;
-
- case (E2N_InterfaceProtocolIE_Value_PR_valueEnum):
- ie_list[i].interfaceProtocolIE_Value.present = E2N_InterfaceProtocolIE_Value_PR_valueEnum;
- ie_list[i].interfaceProtocolIE_Value.choice.valueEnum = (*ref_ie_array)[i].value_n;
- break;
-
- case (E2N_InterfaceProtocolIE_Value_PR_valueBool):
- ie_list[i].interfaceProtocolIE_Value.present = E2N_InterfaceProtocolIE_Value_PR_valueBool;
- ie_list[i].interfaceProtocolIE_Value.choice.valueBool = (*ref_ie_array)[i].value_n;
- break;
-
- case (E2N_InterfaceProtocolIE_Value_PR_valueBitS):
- ie_list[i].interfaceProtocolIE_Value.present = E2N_InterfaceProtocolIE_Value_PR_valueBitS;
- ie_list[i].interfaceProtocolIE_Value.choice.valueBitS.buf = (uint8_t *)(*ref_ie_array)[i].value_s.c_str();
- ie_list[i].interfaceProtocolIE_Value.choice.valueBitS.size = (*ref_ie_array)[i].value_s.length();
- break;
-
- case (E2N_InterfaceProtocolIE_Value_PR_valueOctS):
- ie_list[i].interfaceProtocolIE_Value.present = E2N_InterfaceProtocolIE_Value_PR_valueOctS;
- ie_list[i].interfaceProtocolIE_Value.choice.valueOctS.buf = (uint8_t *)(*ref_ie_array)[i].value_s.c_str();
- ie_list[i].interfaceProtocolIE_Value.choice.valueOctS.size = (*ref_ie_array)[i].value_s.length();
- break;
-
- default:
- {
- std::stringstream ss;
- ss <<"Error ! " << __FILE__ << "," << __LINE__ << " illegal enum " << (*ref_ie_array)[i].val_type << " for interface Protocol IE value" << std::endl;
- std::string error_string = ss.str();
- return false;
- }
- }
-
- ASN_SEQUENCE_ADD(ref_event_trigger->interfaceProtocolIE_List, &ie_list[i]);
- }
- }
-
- return true;
-};
-
-
-bool e2sm_event_trigger::get_fields(E2N_E2SM_gNB_X2_eventTriggerDefinition_t * ref_event_trigger, e2sm_event_trigger_helper & helper){
-
- if (ref_event_trigger == 0){
- error_string = "Invalid reference for Event Trigger definition get fields";
- return false;
- }
-
- helper.procedure_code = ref_event_trigger->interfaceMessageType.procedureCode;
- helper.message_type = ref_event_trigger->interfaceMessageType.typeOfMessage;
- helper.interface_direction = ref_event_trigger->interfaceDirection;
-
- helper.plmn_id.assign((const char *)ref_event_trigger->interface_ID.choice.global_gNB_ID->pLMN_Identity.buf, ref_event_trigger->interface_ID.choice.global_gNB_ID->pLMN_Identity.size);
- helper.egNB_id.assign((const char *)ref_event_trigger->interface_ID.choice.global_gNB_ID->gNB_ID.choice.gNB_ID.buf, ref_event_trigger->interface_ID.choice.global_gNB_ID->gNB_ID.choice.gNB_ID.size);
- for(int i = 0; i < ref_event_trigger->interfaceProtocolIE_List->list.count; i++){
- struct E2N_InterfaceProtocolIE_Item * ie_item = ref_event_trigger->interfaceProtocolIE_List->list.array[i];
- switch(ie_item->interfaceProtocolIE_Value.present){
- case (E2N_InterfaceProtocolIE_Value_PR_valueInt):
- helper.add_protocol_ie_item(ie_item->interfaceProtocolIE_ID, ie_item->interfaceProtocolIE_Test, ie_item->interfaceProtocolIE_Value.present, ie_item->interfaceProtocolIE_Value.choice.valueInt);
- break;
- case (E2N_InterfaceProtocolIE_Value_PR_valueEnum):
- helper.add_protocol_ie_item(ie_item->interfaceProtocolIE_ID, ie_item->interfaceProtocolIE_Test, ie_item->interfaceProtocolIE_Value.present, ie_item->interfaceProtocolIE_Value.choice.valueEnum);
- break;
- case (E2N_InterfaceProtocolIE_Value_PR_valueBool):
- helper.add_protocol_ie_item(ie_item->interfaceProtocolIE_ID, ie_item->interfaceProtocolIE_Test, ie_item->interfaceProtocolIE_Value.present, ie_item->interfaceProtocolIE_Value.choice.valueBool);
- break;
- case (E2N_InterfaceProtocolIE_Value_PR_valueBitS):
- helper.add_protocol_ie_item(ie_item->interfaceProtocolIE_ID, ie_item->interfaceProtocolIE_Test, ie_item->interfaceProtocolIE_Value.present, std::string((const char *)ie_item->interfaceProtocolIE_Value.choice.valueBitS.buf,ie_item->interfaceProtocolIE_Value.choice.valueBitS.size) );
- break;
- case (E2N_InterfaceProtocolIE_Value_PR_valueOctS):
- helper.add_protocol_ie_item(ie_item->interfaceProtocolIE_ID, ie_item->interfaceProtocolIE_Test, ie_item->interfaceProtocolIE_Value.present, std::string((const char *)ie_item->interfaceProtocolIE_Value.choice.valueOctS.buf,ie_item->interfaceProtocolIE_Value.choice.valueOctS.size) );
- break;
- default:
- mdclog_write(MDCLOG_ERR, "Error : %s, %d: Unkown interface protocol IE type %d in event trigger definition\n", __FILE__, __LINE__, ie_item->interfaceProtocolIE_Value.present);
- return false;
- }
- }
-
- return true;
-};
-
-
-
-
-// initialize
-e2sm_indication::e2sm_indication(void) {
-
- memset(&gNodeB_ID, 0, sizeof(E2N_GlobalGNB_ID_t));
-
- // allocate space for gNodeB id (used for encoding)
- gNodeB_ID.gNB_ID.choice.gNB_ID.buf = (uint8_t *)calloc(4, sizeof(uint8_t));
- assert(gNodeB_ID.gNB_ID.choice.gNB_ID.buf != 0);
-
- // allocate space for plmn identity (used for encoding)
- gNodeB_ID.pLMN_Identity.buf = (uint8_t *) calloc(4, sizeof(uint8_t));
- assert(gNodeB_ID.pLMN_Identity.buf != 0);
-
- header = 0;
- header = (E2N_E2SM_gNB_X2_indicationHeader_t *)calloc(1, sizeof(E2N_E2SM_gNB_X2_indicationHeader_t));
- assert(header != 0);
-
- message = 0;
- message = (E2N_E2SM_gNB_X2_indicationMessage_t *)calloc(1, sizeof(E2N_E2SM_gNB_X2_indicationMessage_t));
- assert(message != 0);
-}
-
-e2sm_indication::~e2sm_indication(void){
- mdclog_write(MDCLOG_DEBUG, "Freeing E2N_E2SM Indication object memory");
-
- free(gNodeB_ID.gNB_ID.choice.gNB_ID.buf);
- free(gNodeB_ID.pLMN_Identity.buf);
-
- header->interface_ID.choice.global_gNB_ID = 0;
-
- ASN_STRUCT_FREE(asn_DEF_E2N_E2SM_gNB_X2_indicationHeader, header);
-
- message->interfaceMessage.buf = 0;
- message->interfaceMessage.size = 0;
-
- ASN_STRUCT_FREE(asn_DEF_E2N_E2SM_gNB_X2_indicationMessage, message);
- mdclog_write(MDCLOG_DEBUG, "Freed E2SM Indication object memory");
-
-}
-
-
-
-bool e2sm_indication::encode_indication_header(unsigned char *buf, size_t *size, e2sm_header_helper &helper){
-
- bool res;
- res = set_header_fields(header, helper);
- if (!res){
- return false;
- }
-
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2SM_gNB_X2_indicationHeader, header, errbuf, &errbuf_len);
- if(ret_constr){
- error_string.assign(&errbuf[0], errbuf_len);
- error_string = "E2SM Indication Header Constraint failed : " + error_string;
-
- return false;
- }
-
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2SM_gNB_X2_indicationHeader, header, buf, *size);
-
- if(retval.encoded == -1){
- error_string.assign(strerror(errno));
- error_string = "Error encoding E2N_E2SM Indication Header. Reason = " + error_string;
- return false;
- }
- else if (retval.encoded > *size){
- std::stringstream ss;
- ss <<"Error encoding E2SM Indication Header . Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
- error_string = ss.str();
- return false;
- }
- else{
- *size = retval.encoded;
- }
-
- return true;
-}
-
-
-bool e2sm_indication::encode_indication_message(unsigned char *buf, size_t *size, e2sm_message_helper &helper){
-
- set_message_fields(message, helper);
-
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2SM_gNB_X2_indicationMessage, message, errbuf, &errbuf_len);
- if(ret_constr){
- error_string.assign(&errbuf[0], errbuf_len);
- error_string = "E2SM Indication Message Constraint failed : " + error_string;
- return false;
- }
-
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2SM_gNB_X2_indicationMessage, message, buf, *size);
- if(retval.encoded == -1){
- error_string.assign(strerror(errno));
- error_string = "Error encoding E2SM Indication Header. Reason = " + error_string;
- return false;
- }
- else if (retval.encoded > *size){
- std::stringstream ss;
- ss <<"Error encoding E2N_E2SM Indication Message . Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
- error_string = ss.str();
-
- return false;
- }
- else{
- *size = retval.encoded;
- }
-
- return true;
-}
-
-
-
-// Used when generating an indication header
-bool e2sm_indication::set_header_fields(E2N_E2SM_gNB_X2_indicationHeader_t *header, e2sm_header_helper &helper){
-
- if (header == 0){
- error_string = "Invalid reference for E2SM Indication Header set fields";
- return false;
- }
-
-
- header->interfaceDirection = helper.interface_direction;
- header->interface_ID.present = E2N_Interface_ID_PR_global_gNB_ID;
- header->interface_ID.choice.global_gNB_ID = &gNodeB_ID;
-
-
- // to do : need to put correct code here for upding plmn id and gNodeB
- // for now just place holders :
- memcpy(gNodeB_ID.pLMN_Identity.buf, helper.plmn_id.c_str(), 3);
- gNodeB_ID.pLMN_Identity.size = 3;
-
- memcpy(gNodeB_ID.gNB_ID.choice.gNB_ID.buf, helper.egNB_id.c_str(), 3);
- gNodeB_ID.gNB_ID.choice.gNB_ID.size = 3;
-
- // we only do global gNodeB id for now, not eNodeB
- gNodeB_ID.gNB_ID.present = E2N_GNB_ID_PR_gNB_ID;
-
- return true;
-
-};
-
-
-// used when decoding an indication header
-bool e2sm_indication::get_header_fields(E2N_E2SM_gNB_X2_indicationHeader_t *header, e2sm_header_helper &helper){
-
- if (header == 0){
- error_string = "Invalid reference for E2SM Indication header get fields";
- return false;
- }
-
- helper.interface_direction = header->interfaceDirection;
- helper.plmn_id.assign((const char *)header->interface_ID.choice.global_gNB_ID->pLMN_Identity.buf, header->interface_ID.choice.global_gNB_ID->pLMN_Identity.size);
- helper.egNB_id.assign((const char *)header->interface_ID.choice.global_gNB_ID->gNB_ID.choice.gNB_ID.buf, header->interface_ID.choice.global_gNB_ID->gNB_ID.choice.gNB_ID.size);
-
- // to do : add code to decipher plmn and global gnodeb from ints (since that is likely the convention for packing)
-
- return true;
-}
-
-
-
-// Used when generating an indication message
-bool e2sm_indication::set_message_fields(E2N_E2SM_gNB_X2_indicationMessage_t *interface_message, e2sm_message_helper &helper){
-
- if(interface_message == 0){
- error_string = "Invalid reference for E2SM Indication Message set fields";
- return false;
- }
-
- // interface-message is an octet string. just point it to the buffer
- interface_message->interfaceMessage.buf = &(helper.x2ap_pdu[0]);
- interface_message->interfaceMessage.size = helper.x2ap_pdu_size;
-
- return true;
-
-};
-
-// used when decoding an indication message
-bool e2sm_indication::get_message_fields( E2N_E2SM_gNB_X2_indicationMessage_t *interface_message, e2sm_message_helper &helper){
-
-
- if(interface_message == 0){
- error_string = "Invalid reference for E2SM Indication Message get fields";
- return false;
- }
-
- // interface message is an octet string
- helper.x2ap_pdu = interface_message->interfaceMessage.buf;;
- helper.x2ap_pdu_size = interface_message->interfaceMessage.size;
-
- return true;
-
-}
-
-
-
-// initialize
-e2sm_control::e2sm_control(void) {
-
- memset(&gNodeB_ID, 0, sizeof(E2N_GlobalGNB_ID_t));
-
- // allocate space for gNodeB id (used for encoding)
- gNodeB_ID.gNB_ID.choice.gNB_ID.buf = (uint8_t *)calloc(4, sizeof(uint8_t));
- assert(gNodeB_ID.gNB_ID.choice.gNB_ID.buf != 0);
-
- // allocate space for plmn identity (used for encoding)
- gNodeB_ID.pLMN_Identity.buf = (uint8_t *) calloc(4, sizeof(uint8_t));
- assert(gNodeB_ID.pLMN_Identity.buf != 0);
-
- header = 0;
- header = (E2N_E2SM_gNB_X2_controlHeader_t *)calloc(1, sizeof(E2N_E2SM_gNB_X2_controlHeader_t));
- assert(header != 0);
-
- message = 0;
- message = (E2N_E2SM_gNB_X2_controlMessage_t *)calloc(1, sizeof(E2N_E2SM_gNB_X2_controlMessage_t));
- assert(message != 0);
-}
-
-e2sm_control::~e2sm_control(void){
- mdclog_write(MDCLOG_DEBUG, "Freeing E2SM Control object memory");
-
- free(gNodeB_ID.gNB_ID.choice.gNB_ID.buf);
- free(gNodeB_ID.pLMN_Identity.buf);
- header->interface_ID.choice.global_gNB_ID = 0;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2SM_gNB_X2_controlHeader, header);
-
- message->interfaceMessage.buf = 0;
- ASN_STRUCT_FREE(asn_DEF_E2N_E2SM_gNB_X2_controlMessage, message);
-
- mdclog_write(MDCLOG_DEBUG, "Freed E2SM Control object memory");
-
-}
-
-
-
-bool e2sm_control::encode_control_header(unsigned char *buf, size_t *size, e2sm_header_helper &helper){
-
- bool res;
- res = set_header_fields(header, helper);
- if (!res){
- return false;
- }
-
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2SM_gNB_X2_controlHeader, header, errbuf, &errbuf_len);
- if(ret_constr){
- error_string.assign(&errbuf[0], errbuf_len);
- error_string = "E2SM Control Header Constraint failed : " + error_string;
-
- return false;
- }
-
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2SM_gNB_X2_controlHeader, header, buf, *size);
-
- if(retval.encoded == -1){
- error_string.assign(strerror(errno));
- error_string = "Error encoding E2SM Control Header. Reason = " + error_string;
- return false;
- }
- else if (retval.encoded > *size){
- std::stringstream ss;
- ss <<"Error encoding E2N_E2SM Control Header . Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
- error_string = ss.str();
- return false;
- }
- else{
- *size = retval.encoded;
- }
-
- return true;
-}
-
-
-bool e2sm_control::encode_control_message(unsigned char *buf, size_t *size, e2sm_message_helper &helper){
-
- set_message_fields(message, helper);
-
- int ret_constr = asn_check_constraints(&asn_DEF_E2N_E2SM_gNB_X2_controlMessage, message, errbuf, &errbuf_len);
- if(ret_constr){
- error_string.assign(&errbuf[0], errbuf_len);
- error_string = "E2SM Control Message Constraint failed : " + error_string;
- return false;
- }
-
- asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2SM_gNB_X2_controlMessage, message, buf, *size);
- if(retval.encoded == -1){
- error_string.assign(strerror(errno));
- error_string = "Error encoding E2SM Control Message. Reason = " + error_string;
- return false;
- }
- else if (retval.encoded > *size){
- std::stringstream ss;
- ss <<"Error encoding E2SM Control Message . Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
- error_string = ss.str();
-
- return false;
- }
- else{
- *size = retval.encoded;
- }
-
- return true;
-}
-
-
-
-// Used when generating an indication header
-bool e2sm_control::set_header_fields(E2N_E2SM_gNB_X2_controlHeader_t *header, e2sm_header_helper &helper){
-
- if (header == 0){
- error_string = "Invalid reference for E2SM Control Header set fields";
- return false;
- }
-
-
- header->interfaceDirection = helper.interface_direction;
- header->interface_ID.present = E2N_Interface_ID_PR_global_gNB_ID;
- header->interface_ID.choice.global_gNB_ID = &gNodeB_ID;
-
-
- // to do : need to put correct code here for upding plmn id and gNodeB
- // for now just place holders :
- memcpy(gNodeB_ID.pLMN_Identity.buf, helper.plmn_id.c_str(), 3);
- gNodeB_ID.pLMN_Identity.size = 3;
-
- memcpy(gNodeB_ID.gNB_ID.choice.gNB_ID.buf, helper.egNB_id.c_str(), 3);
- gNodeB_ID.gNB_ID.choice.gNB_ID.size = 3;
-
- // we only do global gNodeB id for now, not eNodeB
- gNodeB_ID.gNB_ID.present = E2N_GNB_ID_PR_gNB_ID;
-
- return true;
-
-};
-
-
-// used when decoding an indication header
-bool e2sm_control::get_header_fields(E2N_E2SM_gNB_X2_controlHeader_t *header, e2sm_header_helper &helper){
-
- if (header == 0){
- error_string = "Invalid reference for E2SM Control header get fields";
- return false;
- }
-
- helper.interface_direction = header->interfaceDirection;
- helper.plmn_id.assign((const char *)header->interface_ID.choice.global_gNB_ID->pLMN_Identity.buf, header->interface_ID.choice.global_gNB_ID->pLMN_Identity.size);
- helper.egNB_id.assign((const char *)header->interface_ID.choice.global_gNB_ID->gNB_ID.choice.gNB_ID.buf, header->interface_ID.choice.global_gNB_ID->gNB_ID.choice.gNB_ID.size);
-
- // to do : add code to decipher plmn and global gnodeb from ints (since that is likely the convention for packing)
-
- return true;
-}
-
-
-
-// Used when generating an indication message
-bool e2sm_control::set_message_fields(E2N_E2SM_gNB_X2_controlMessage_t *interface_message, e2sm_message_helper &helper){
-
- if(interface_message == 0){
- error_string = "Invalid reference for E2SM Control Message set fields";
- return false;
- }
-
- // interface-message is an octet string. just point it to the buffer
- interface_message->interfaceMessage.buf = &(helper.x2ap_pdu[0]);
- interface_message->interfaceMessage.size = helper.x2ap_pdu_size;
-
- return true;
-
-};
-
-// used when decoding an indication message
-bool e2sm_control::get_message_fields( E2N_E2SM_gNB_X2_controlMessage_t *interface_message, e2sm_message_helper &helper){
-
-
- if(interface_message == 0){
- error_string = "Invalid reference for E2SM Control Message get fields";
- return false;
- }
-
- // interface message is an octet string
- helper.x2ap_pdu = interface_message->interfaceMessage.buf;;
- helper.x2ap_pdu_size = interface_message->interfaceMessage.size;
-
- return true;
-
-}
-
diff --git a/src/xapp-asn/e2sm/e2sm.hpp b/src/xapp-asn/e2sm/e2sm.hpp
deleted file mode 100644
index c0877b4..0000000
--- a/src/xapp-asn/e2sm/e2sm.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-==================================================================================
-
- Copyright (c) 2018-2019 AT&T Intellectual Property.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================================
-*/
-
-/* Classes to handle E2 service model based on e2sm-gNB-X2-release-1-v040.asn */
-
-#ifndef E2SM_
-#define E2SM_
-
-
-#include <sstream>
-#include <e2sm_helpers.hpp>
-#include <mdclog/mdclog.h>
-#include <E2N_E2SM-gNB-X2-indicationHeader.h>
-#include <E2N_E2SM-gNB-X2-indicationMessage.h>
-#include <E2N_E2SM-gNB-X2-controlHeader.h>
-#include <E2N_E2SM-gNB-X2-controlMessage.h>
-#include <E2N_E2SM-gNB-X2-eventTriggerDefinition.h>
-
-#include <E2N_GlobalGNB-ID.h>
-#include <E2N_TypeOfMessage.h>
-#include <E2N_InterfaceProtocolIE-Item.h>
-
-#include<E2N_InterfaceProtocolIE-ID.h>
-#include<E2N_InterfaceProtocolIE-Value.h>
-#include<E2N_InterfaceProtocolIE-Test.h>
-
-#define INITIAL_LIST_SIZE 4
-
-
-
-
-/* builder class for E2SM event trigger definition */
-
-class e2sm_event_trigger {
-public:
- e2sm_event_trigger(void);
- ~e2sm_event_trigger(void);
-
- bool set_fields(E2N_E2SM_gNB_X2_eventTriggerDefinition_t *, e2sm_event_trigger_helper &);
- bool get_fields(E2N_E2SM_gNB_X2_eventTriggerDefinition_t *, e2sm_event_trigger_helper &);
- bool encode_event_trigger(unsigned char *, size_t *, e2sm_event_trigger_helper &);
-
- std::string get_error (void) const {return error_string ;};
-
-private:
-
- E2N_E2SM_gNB_X2_eventTriggerDefinition_t * event_trigger; // used for encoding
- E2N_GlobalGNB_ID_t gNodeB_ID;
- struct E2N_InterfaceProtocolIE_Item * ie_list;
- unsigned int ie_list_size;
-
- //std::vector<struct InterfaceProtocolIE_Item> ie_list;
- E2N_E2SM_gNB_X2_eventTriggerDefinition::E2N_E2SM_gNB_X2_eventTriggerDefinition__interfaceProtocolIE_List *condition_list;
-
- char errbuf[128];
- size_t errbuf_len;
- std::string error_string;
-};
-
-
-/* builder class for E2SM indication using ASN1c */
-
-class e2sm_indication {
-public:
-
- e2sm_indication(void);
- ~e2sm_indication(void);
-
- E2N_E2SM_gNB_X2_indicationHeader_t * get_header(void);
- E2N_E2SM_gNB_X2_indicationMessage_t * get_message(void);
-
- bool set_header_fields(E2N_E2SM_gNB_X2_indicationHeader_t *, e2sm_header_helper &);
- bool get_header_fields(E2N_E2SM_gNB_X2_indicationHeader_t *, e2sm_header_helper &);
-
- bool set_message_fields(E2N_E2SM_gNB_X2_indicationMessage_t *, e2sm_message_helper &);
- bool get_message_fields(E2N_E2SM_gNB_X2_indicationMessage_t *, e2sm_message_helper &);
-
- bool encode_indication_header(unsigned char * , size_t * , e2sm_header_helper &);
- bool encode_indication_message(unsigned char *, size_t *, e2sm_message_helper &);
- std::string get_error (void) const {return error_string ; };
-
-private:
-
- E2N_E2SM_gNB_X2_indicationHeader_t *header; // used for encoding
- E2N_E2SM_gNB_X2_indicationMessage_t *message; // used for encoding
-
- char errbuf[128];
- size_t errbuf_len;
- E2N_GlobalGNB_ID_t gNodeB_ID;
- std::string error_string;
-
-
-};
-
-/* builder class for E2SM control using ASN1c */
-
-class e2sm_control {
-public:
-
- e2sm_control(void);
- ~e2sm_control(void);
-
- E2N_E2SM_gNB_X2_controlHeader_t * get_header(void);
- E2N_E2SM_gNB_X2_controlMessage_t * get_message(void);
-
- bool set_header_fields(E2N_E2SM_gNB_X2_controlHeader_t *, e2sm_header_helper &);
- bool get_header_fields(E2N_E2SM_gNB_X2_controlHeader_t *, e2sm_header_helper &);
-
- bool set_message_fields(E2N_E2SM_gNB_X2_controlMessage_t *, e2sm_message_helper &);
- bool get_message_fields(E2N_E2SM_gNB_X2_controlMessage_t *, e2sm_message_helper &);
-
- bool encode_control_header(unsigned char * , size_t * , e2sm_header_helper &);
- bool encode_control_message(unsigned char *, size_t *, e2sm_message_helper &);
- std::string get_error (void) const {return error_string ; };
-
-private:
-
- E2N_E2SM_gNB_X2_controlHeader_t *header; // used for encoding
- E2N_E2SM_gNB_X2_controlMessage_t *message; // used for encoding
-
- char errbuf[128];
- size_t errbuf_len;
- E2N_GlobalGNB_ID_t gNodeB_ID;
- std::string error_string;
-
-
-};
-
-#endif
diff --git a/src/xapp-asn/e2sm/e2sm_control.cc b/src/xapp-asn/e2sm/e2sm_control.cc
new file mode 100644
index 0000000..ba5f708
--- /dev/null
+++ b/src/xapp-asn/e2sm/e2sm_control.cc
@@ -0,0 +1,195 @@
+/*
+ ==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, softwares
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ==================================================================================
+*/
+/*
+ * e2sm_control.cc
+ *
+ * Created on: Apr 30, 2020
+ * Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
+#include "e2sm_control.hpp"
+
+ //initialize
+ e2sm_control::e2sm_control(void){
+
+ memset(&head_fmt1, 0, sizeof(E2SM_HelloWorld_ControlHeader_Format1_t));
+
+ memset(&msg_fmt1, 0, sizeof(E2SM_HelloWorld_ControlMessage_Format1_t));
+
+
+
+ control_head = 0;
+ control_head = ( E2SM_HelloWorld_ControlHeader_t *)calloc(1, sizeof( E2SM_HelloWorld_ControlHeader_t));
+ assert(control_head != 0);
+
+ control_msg = 0;
+ control_msg = (E2SM_HelloWorld_ControlMessage_t*)calloc(1, sizeof(E2SM_HelloWorld_ControlMessage_t));
+ assert(control_msg !=0);
+
+ errbuf_len = 128;
+ };
+
+ e2sm_control::~e2sm_control(void){
+
+ mdclog_write(MDCLOG_DEBUG, "Freeing event trigger object memory");
+
+ control_head->choice.controlHeader_Format1 = 0;
+
+ control_msg->choice.controlMessage_Format1 = 0;
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_HelloWorld_ControlHeader, control_head);
+ ASN_STRUCT_FREE(asn_DEF_E2SM_HelloWorld_ControlMessage, control_msg);
+
+
+};
+
+bool e2sm_control::encode_control_header(unsigned char *buf, size_t *size, e2sm_control_helper &helper){
+
+ ASN_STRUCT_RESET(asn_DEF_E2SM_HelloWorld_ControlHeader, control_head);
+
+ bool res;
+ res = set_fields(control_head, helper);
+ if (!res){
+
+ return false;
+ }
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2SM_HelloWorld_ControlHeader, control_head, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(&errbuf[0], errbuf_len);
+ return false;
+ }
+
+ xer_fprint(stdout, &asn_DEF_E2SM_HelloWorld_ControlHeader, control_head);
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_ControlHeader, control_head, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else if (retval.encoded > *size){
+ std::stringstream ss;
+ ss <<"Error encoding event trigger definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ else{
+ *size = retval.encoded;
+ }
+
+ return true;
+}
+
+bool e2sm_control::encode_control_message(unsigned char *buf, size_t *size, e2sm_control_helper &helper){
+
+ bool res;
+ res = set_fields(control_msg, helper);
+ if (!res){
+ return false;
+ }
+
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2SM_HelloWorld_ControlMessage, control_msg, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(&errbuf[0], errbuf_len);
+ return false;
+ }
+
+ xer_fprint(stdout, &asn_DEF_E2SM_HelloWorld_ControlMessage, control_msg);
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_ControlMessage, control_msg, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else if (retval.encoded > *size){
+ std::stringstream ss;
+ ss <<"Error encoding action definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ else{
+ *size = retval.encoded;
+ }
+
+ return true;
+}
+
+bool e2sm_control::set_fields(E2SM_HelloWorld_ControlHeader_t * ref_control_head, e2sm_control_helper & helper){
+
+ if(ref_control_head == 0){
+ error_string = "Invalid reference for Event Trigger Definition set fields";
+ return false;
+ }
+
+ ref_control_head->present = E2SM_HelloWorld_ControlHeader_PR_controlHeader_Format1;
+
+ head_fmt1.controlHeaderParam = helper.header;
+
+ ref_control_head->choice.controlHeader_Format1 = &head_fmt1;
+
+ return true;
+};
+
+bool e2sm_control::set_fields(E2SM_HelloWorld_ControlMessage_t * ref_control_msg, e2sm_control_helper & helper){
+
+ if(ref_control_msg == 0){
+ error_string = "Invalid reference for Event Action Definition set fields";
+ return false;
+ }
+ ref_control_msg->present = E2SM_HelloWorld_ControlMessage_PR_controlMessage_Format1;
+
+ msg_fmt1.controlMsgParam.buf = helper.message;
+ msg_fmt1.controlMsgParam.size = helper.message_len;
+
+
+ ref_control_msg->choice.controlMessage_Format1 = &msg_fmt1;
+
+
+ return true;
+};
+
+bool e2sm_control::get_fields(E2SM_HelloWorld_ControlHeader_t * ref_indictaion_header, e2sm_control_helper & helper){
+
+ if (ref_indictaion_header == 0){
+ error_string = "Invalid reference for Control Header get fields";
+ return false;
+ }
+
+ helper.header = ref_indictaion_header->choice.controlHeader_Format1->controlHeaderParam;
+ return true;
+}
+
+bool e2sm_control::get_fields(E2SM_HelloWorld_ControlMessage_t * ref_control_message, e2sm_control_helper & helper){
+
+ if (ref_control_message == 0){
+ error_string = "Invalid reference for Control Message get fields";
+ return false;
+ }
+ helper.message = ref_control_message->choice.controlMessage_Format1->controlMsgParam.buf;
+ helper.message_len = ref_control_message->choice.controlMessage_Format1->controlMsgParam.size;
+
+ return true;
+ }
+
+
+
+
diff --git a/src/xapp-asn/e2sm/e2sm_control.hpp b/src/xapp-asn/e2sm/e2sm_control.hpp
new file mode 100644
index 0000000..4d8d687
--- /dev/null
+++ b/src/xapp-asn/e2sm/e2sm_control.hpp
@@ -0,0 +1,73 @@
+/*
+ ==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, softwares
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ==================================================================================
+*/
+/*
+ * e2sm_control.hpp
+ *
+ * Created on: Apr, 2020
+ * Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
+#ifndef SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_
+#define SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_
+
+
+#include <sstream>
+#include <e2sm_helpers.hpp>
+#include <mdclog/mdclog.h>
+#include <vector>
+
+#include <E2SM-HelloWorld-ControlHeader.h>
+#include <E2SM-HelloWorld-ControlMessage.h>
+#include <E2SM-HelloWorld-ControlHeader-Format1.h>
+#include <E2SM-HelloWorld-ControlMessage-Format1.h>
+#include <HW-Header.h>
+#include <HW-Message.h>
+class e2sm_control {
+public:
+ e2sm_control(void);
+ ~e2sm_control(void);
+
+ bool set_fields(E2SM_HelloWorld_ControlHeader_t *, e2sm_control_helper &);
+ bool set_fields(E2SM_HelloWorld_ControlMessage_t *, e2sm_control_helper &);
+
+ bool get_fields(E2SM_HelloWorld_ControlHeader_t *, e2sm_control_helper &);
+ bool get_fields(E2SM_HelloWorld_ControlMessage_t *, e2sm_control_helper &);
+
+ bool encode_control_header(unsigned char *, size_t *, e2sm_control_helper &);
+ bool encode_control_message(unsigned char*, size_t *, e2sm_control_helper &);
+
+
+ std::string get_error (void) const {return error_string ;};
+
+private:
+
+ E2SM_HelloWorld_ControlHeader_t * control_head; // used for encoding
+ E2SM_HelloWorld_ControlMessage_t* control_msg;
+ E2SM_HelloWorld_ControlHeader_Format1_t head_fmt1;
+ E2SM_HelloWorld_ControlMessage_Format1_t msg_fmt1;
+
+
+ size_t errbuf_len;
+ char errbuf[128];
+ std::string error_string;
+};
+
+
+
+#endif /* SRC_XAPP_ASN_E2SM_E2SM_CONTROL_HPP_ */
diff --git a/src/xapp-asn/e2sm/e2sm_helpers.hpp b/src/xapp-asn/e2sm/e2sm_helpers.hpp
index cee7b53..e1f146b 100644
--- a/src/xapp-asn/e2sm/e2sm_helpers.hpp
+++ b/src/xapp-asn/e2sm/e2sm_helpers.hpp
@@ -1,5 +1,28 @@
+/*
+ ==================================================================================
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, softwares
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ==================================================================================
+*/
+/*
+ * e2sm_control.cc
+ *
+ * Created on: Apr 30, 2020
+ * Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
#ifndef E2SM_HELPER_
#define E2SM_HELPER_
@@ -7,90 +30,80 @@
#include <iostream>
#include <vector>
#include <sstream>
+#include <memory>
- /* information holder for E2SM indication header */
-typedef struct e2sm_header_helper e2sm_header_helper;
-struct e2sm_header_helper {
- int egNB_id_type;
-
- std::string egNB_id;
- std::string plmn_id;
-
- long int interface_direction;
- unsigned char* timestamp;
+typedef struct ranparam_helper ranparam_helper;
+struct ranparam_helper {
+ long int _param_id;
+ unsigned char* _param_name;
+ size_t _param_name_len;
+ int _param_test;
+ unsigned char* _param_value;
+ size_t _param_value_len;
+
};
-
-/* information holder for E2SM indication message */
-typedef struct e2sm_message_helper e2sm_message_helper;
-struct e2sm_message_helper {
- unsigned char * x2ap_pdu;
- size_t x2ap_pdu_size;
-};
-
-
-/* information holder for E2SM Action Trigger Definition */
-struct Item
-{
- Item(long int id, long int test, long int val_type, int value):interface_id(id), test(test), val_type(val_type), value_n(value){};
- Item(long int id, long int test, long int val_type, std::string value):interface_id(id), test(test), val_type(val_type), value_s(value){};
-
- long int interface_id;
- long int test;
- long int val_type;
- long int value_n;
- std::string value_s;
-
-};
-
-typedef struct e2sm_event_trigger_helper e2sm_event_trigger_helper;
-struct e2sm_event_trigger_helper {
-
- int egNB_id_type;
- std::string egNB_id;
- std::string plmn_id;
-
- long int interface_direction;
- long int procedure_code;
-
- long int message_type;
-
-
- std::vector<struct Item> * get_list(void){ return &protocol_ie_list; };
- void add_protocol_ie_item(long int id, long int test , unsigned int val_type, long int value ){
- // into list
- protocol_ie_list.emplace_back(id, test, val_type, value);
- };
-
- void add_protocol_ie_item(long int id, long int test, unsigned int val_type, std::string value){
- // into list
- protocol_ie_list.emplace_back(id, test, val_type, value);
- };
-
- void clear(void){
- protocol_ie_list.clear();
- }
-
- std::string get_string(void) const {
- std::stringstream ss;
- ss << "egNB_ID_type = " << egNB_id_type << std::endl;
- ss << "PLMN Id = " << plmn_id << std::endl;
- ss << "Procedure Code = " << procedure_code << std::endl;
- ss << "Message Type = " << message_type << std::endl;
-
- std::string info;
- info = ss.str();
- return info;
- }
-
-
-
+class RANParam_Helper{
private:
-
- std::vector<struct Item> protocol_ie_list;
-
+ ranparam_helper _ranparam_helper;
+
+public:
+
+ RANParam_Helper(int id, unsigned char *param_name, size_t param_name_len, int param_test, unsigned char* param_value, size_t param_value_len){
+ _ranparam_helper._param_id = id;
+ _ranparam_helper._param_name = param_name;
+ _ranparam_helper._param_name_len = param_name_len;
+ _ranparam_helper._param_test = param_test;
+ _ranparam_helper._param_value = param_value;
+ _ranparam_helper._param_value_len = param_value_len;
+ }
+
+ const ranparam_helper & getran_helper() const {
+ return _ranparam_helper;
+ }
+ void print_ranparam_info(void){
+ std::cout <<"Param ID = " << _ranparam_helper._param_id << std::endl;
+ std::cout << "Parame Name =" << _ranparam_helper._param_name << std::endl;
+ std::cout <<"Param Test = " << _ranparam_helper._param_test << std::endl;
+ std::cout <<"Param Value = " << _ranparam_helper._param_value << std::endl;
+ }
};
-
+using ranparam_helper_t = std::vector<RANParam_Helper>;
+
+typedef struct e2sm_subscription_helper e2sm_subscription_helper;
+struct e2sm_subscription_helper {
+public:
+
+
+ int triger_nature;
+ ranparam_helper_t param;
+ void add_param(int id, unsigned char *param_name, size_t param_name_len, int param_test, unsigned char* param_value, size_t param_value_len){
+ RANParam_Helper rparam(id,param_name,param_name_len,param_test,param_value,param_value_len);
+ param.push_back(rparam);
+ };
+ ranparam_helper_t get_paramlist() const {return param;};
+
+
+
+};
+
+
+typedef struct e2sm_indication_helper e2sm_indication_helper;
+
+
+struct e2sm_indication_helper {
+ long int header;
+ unsigned char* message;
+ size_t message_len;
+};
+
+typedef struct e2sm_control_helper e2sm_control_helper;
+
+struct e2sm_control_helper {
+ long int header;
+ unsigned char* message;
+ size_t message_len;
+};
#endif
diff --git a/src/xapp-asn/e2sm/e2sm_indication.cc b/src/xapp-asn/e2sm/e2sm_indication.cc
new file mode 100644
index 0000000..60ffd30
--- /dev/null
+++ b/src/xapp-asn/e2sm/e2sm_indication.cc
@@ -0,0 +1,192 @@
+/*
+==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+/*
+ * e2sm_indication.cc
+ *
+ * Created on: Apr, 2020
+ * Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
+#include "e2sm_indication.hpp"
+
+ //initialize
+ e2sm_indication::e2sm_indication(void){
+
+ memset(&head_fmt1, 0, sizeof(E2SM_HelloWorld_IndicationHeader_Format1_t));
+
+ memset(&msg_fmt1, 0, sizeof(E2SM_HelloWorld_IndicationMessage_Format1_t));
+
+
+
+ indication_head = 0;
+ indication_head = ( E2SM_HelloWorld_IndicationHeader_t *)calloc(1, sizeof( E2SM_HelloWorld_IndicationHeader_t));
+ assert(indication_head != 0);
+
+ indication_msg = 0;
+ indication_msg = (E2SM_HelloWorld_IndicationMessage_t*)calloc(1, sizeof(E2SM_HelloWorld_IndicationMessage_t));
+ assert(indication_msg !=0);
+
+ errbuf_len = 128;
+ };
+
+ e2sm_indication::~e2sm_indication(void){
+
+ mdclog_write(MDCLOG_DEBUG, "Freeing event trigger object memory");
+
+ indication_head->choice.indicationHeader_Format1 = 0;
+
+ indication_msg->choice.indicationMessage_Format1 = 0;
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_HelloWorld_IndicationHeader, indication_head);
+ ASN_STRUCT_FREE(asn_DEF_E2SM_HelloWorld_IndicationMessage, indication_msg);
+
+
+};
+
+bool e2sm_indication::encode_indication_header(unsigned char *buf, size_t *size, e2sm_indication_helper &helper){
+
+ ASN_STRUCT_RESET(asn_DEF_E2SM_HelloWorld_IndicationHeader, indication_head);
+
+ bool res;
+ res = set_fields(indication_head, helper);
+ if (!res){
+
+ return false;
+ }
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2SM_HelloWorld_IndicationHeader, indication_head, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(&errbuf[0], errbuf_len);
+ return false;
+ }
+
+ xer_fprint(stdout, &asn_DEF_E2SM_HelloWorld_IndicationHeader, indication_head);
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_IndicationHeader, indication_head, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else if (retval.encoded > *size){
+ std::stringstream ss;
+ ss <<"Error encoding event trigger definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ else{
+ *size = retval.encoded;
+ }
+
+ return true;
+}
+
+bool e2sm_indication::encode_indication_message(unsigned char *buf, size_t *size, e2sm_indication_helper &helper){
+
+ bool res;
+ res = set_fields(indication_msg, helper);
+ if (!res){
+ return false;
+ }
+
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2SM_HelloWorld_IndicationMessage, indication_msg, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(&errbuf[0], errbuf_len);
+ return false;
+ }
+
+ xer_fprint(stdout, &asn_DEF_E2SM_HelloWorld_IndicationMessage, indication_msg);
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_IndicationMessage, indication_msg, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else if (retval.encoded > *size){
+ std::stringstream ss;
+ ss <<"Error encoding action definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ else{
+ *size = retval.encoded;
+ }
+
+ return true;
+}
+
+bool e2sm_indication::set_fields(E2SM_HelloWorld_IndicationHeader_t * ref_indication_head, e2sm_indication_helper & helper){
+
+ if(ref_indication_head == 0){
+ error_string = "Invalid reference for Event Trigger Definition set fields";
+ return false;
+ }
+
+ ref_indication_head->present = E2SM_HelloWorld_IndicationHeader_PR_indicationHeader_Format1;
+
+ head_fmt1.indicationHeaderParam = helper.header;
+
+ ref_indication_head->choice.indicationHeader_Format1 = &head_fmt1;
+
+ return true;
+};
+
+bool e2sm_indication::set_fields(E2SM_HelloWorld_IndicationMessage_t * ref_indication_msg, e2sm_indication_helper & helper){
+
+ if(ref_indication_msg == 0){
+ error_string = "Invalid reference for Event Action Definition set fields";
+ return false;
+ }
+ ref_indication_msg->present = E2SM_HelloWorld_IndicationMessage_PR_indicationMessage_Format1;
+
+ msg_fmt1.indicationMsgParam.buf = helper.message;
+ msg_fmt1.indicationMsgParam.size = helper.message_len;
+
+
+ ref_indication_msg->choice.indicationMessage_Format1 = &msg_fmt1;
+
+
+ return true;
+};
+
+bool e2sm_indication::get_fields(E2SM_HelloWorld_IndicationHeader_t * ref_indictaion_header, e2sm_indication_helper & helper){
+
+ if (ref_indictaion_header == 0){
+ error_string = "Invalid reference for Indication Header get fields";
+ return false;
+ }
+
+ helper.header = ref_indictaion_header->choice.indicationHeader_Format1->indicationHeaderParam;
+ return true;
+}
+
+bool e2sm_indication::get_fields(E2SM_HelloWorld_IndicationMessage_t * ref_indication_message, e2sm_indication_helper & helper){
+
+ if (ref_indication_message == 0){
+ error_string = "Invalid reference for Indication Message get fields";
+ return false;
+ }
+ helper.message = ref_indication_message->choice.indicationMessage_Format1->indicationMsgParam.buf;
+ helper.message_len = ref_indication_message->choice.indicationMessage_Format1->indicationMsgParam.size;
+
+ return true;
+ }
+
diff --git a/src/xapp-asn/e2sm/e2sm_indication.hpp b/src/xapp-asn/e2sm/e2sm_indication.hpp
new file mode 100644
index 0000000..a7fcdd7
--- /dev/null
+++ b/src/xapp-asn/e2sm/e2sm_indication.hpp
@@ -0,0 +1,75 @@
+/*
+==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+/*
+ * e2sm_indication.hpp
+ *
+ * Created on: Apr, 2020
+ * Author: Shraboni Jana
+ */
+
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
+#ifndef SRC_XAPP_ASN_E2SM_E2SM_INDICATION_HPP_
+#define SRC_XAPP_ASN_E2SM_E2SM_INDICATION_HPP_
+
+#include <sstream>
+#include <e2sm_helpers.hpp>
+#include <mdclog/mdclog.h>
+#include <vector>
+
+#include <E2SM-HelloWorld-IndicationHeader.h>
+#include <E2SM-HelloWorld-IndicationMessage.h>
+#include <E2SM-HelloWorld-IndicationHeader-Format1.h>
+#include <E2SM-HelloWorld-IndicationMessage-Format1.h>
+#include <HW-Header.h>
+#include <HW-Message.h>
+
+class e2sm_indication {
+public:
+ e2sm_indication(void);
+ ~e2sm_indication(void);
+
+ bool set_fields(E2SM_HelloWorld_IndicationHeader_t *, e2sm_indication_helper &);
+ bool set_fields(E2SM_HelloWorld_IndicationMessage_t *, e2sm_indication_helper &);
+
+ bool get_fields(E2SM_HelloWorld_IndicationHeader_t *, e2sm_indication_helper &);
+ bool get_fields(E2SM_HelloWorld_IndicationMessage_t *, e2sm_indication_helper &);
+
+ bool encode_indication_header(unsigned char *, size_t *, e2sm_indication_helper &);
+ bool encode_indication_message(unsigned char*, size_t *, e2sm_indication_helper &);
+
+
+ std::string get_error (void) const {return error_string ;};
+
+private:
+
+ E2SM_HelloWorld_IndicationHeader_t * indication_head; // used for encoding
+ E2SM_HelloWorld_IndicationMessage_t* indication_msg;
+ E2SM_HelloWorld_IndicationHeader_Format1_t head_fmt1;
+ E2SM_HelloWorld_IndicationMessage_Format1_t msg_fmt1;
+
+
+ size_t errbuf_len;
+ char errbuf[128];
+ std::string error_string;
+};
+
+
+
+
+#endif /* SRC_XAPP_ASN_E2SM_E2SM_INDICATION_HPP_ */
diff --git a/src/xapp-asn/e2sm/e2sm_subscription.cc b/src/xapp-asn/e2sm/e2sm_subscription.cc
new file mode 100644
index 0000000..51511a4
--- /dev/null
+++ b/src/xapp-asn/e2sm/e2sm_subscription.cc
@@ -0,0 +1,185 @@
+/*
+ ==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, softwares
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ==================================================================================
+*/
+/*
+ * e2sm_control.cc
+ *
+ * Created on: Apr 30, 2020
+ * Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
+
+#include "e2sm_subscription.hpp"
+
+ //initialize
+ e2sm_subscription::e2sm_subscription(void){
+
+ memset(&event_fmt1, 0, sizeof(E2SM_HelloWorld_EventTriggerDefinition_Format1_t));
+
+ memset(&actn_fmt1, 0, sizeof(E2SM_HelloWorld_ActionDefinition_Format1_t));
+
+
+ ran_param = 0;
+ ran_param = (RANparameter_Item_t*)calloc(1, sizeof(RANparameter_Item_t));
+ assert(ran_param != 0);
+
+ event_trigger = 0;
+ event_trigger = ( E2SM_HelloWorld_EventTriggerDefinition_t *)calloc(1, sizeof( E2SM_HelloWorld_EventTriggerDefinition_t));
+ assert(event_trigger != 0);
+
+ action_defn = 0;
+ action_defn = (E2SM_HelloWorld_ActionDefinition_t*)calloc(1, sizeof(E2SM_HelloWorld_ActionDefinition_t));
+ assert(action_defn !=0);
+
+ errbuf_len = 128;
+ };
+
+ e2sm_subscription::~e2sm_subscription(void){
+
+ mdclog_write(MDCLOG_DEBUG, "Freeing event trigger object memory");
+
+ event_trigger->choice.eventDefinition_Format1 = 0;
+
+ action_defn->choice.actionDefinition_Format1 = 0;
+
+ free(ran_param);
+
+ ASN_STRUCT_FREE(asn_DEF_E2SM_HelloWorld_EventTriggerDefinition, event_trigger);
+ ASN_STRUCT_FREE(asn_DEF_E2SM_HelloWorld_ActionDefinition, action_defn);
+
+
+};
+
+bool e2sm_subscription::encode_event_trigger(unsigned char *buf, size_t *size, e2sm_subscription_helper &helper){
+
+ ASN_STRUCT_RESET(asn_DEF_E2SM_HelloWorld_EventTriggerDefinition, event_trigger);
+
+ bool res;
+ res = set_fields(event_trigger, helper);
+ if (!res){
+
+ return false;
+ }
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2SM_HelloWorld_EventTriggerDefinition, event_trigger, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(&errbuf[0], errbuf_len);
+ return false;
+ }
+
+ xer_fprint(stdout, &asn_DEF_E2SM_HelloWorld_EventTriggerDefinition, event_trigger);
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_EventTriggerDefinition, event_trigger, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else if (retval.encoded > *size){
+ std::stringstream ss;
+ ss <<"Error encoding event trigger definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ else{
+ *size = retval.encoded;
+ }
+
+ return true;
+}
+
+bool e2sm_subscription::encode_action_defn(unsigned char *buf, size_t *size, e2sm_subscription_helper &helper){
+
+ bool res;
+ res = set_fields(action_defn, helper);
+ if (!res){
+ return false;
+ }
+
+
+ int ret_constr = asn_check_constraints(&asn_DEF_E2SM_HelloWorld_ActionDefinition, action_defn, errbuf, &errbuf_len);
+ if(ret_constr){
+ error_string.assign(&errbuf[0], errbuf_len);
+ return false;
+ }
+
+ xer_fprint(stdout, &asn_DEF_E2SM_HelloWorld_ActionDefinition, action_defn);
+
+ asn_enc_rval_t retval = asn_encode_to_buffer(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_HelloWorld_ActionDefinition, action_defn, buf, *size);
+
+ if(retval.encoded == -1){
+ error_string.assign(strerror(errno));
+ return false;
+ }
+ else if (retval.encoded > *size){
+ std::stringstream ss;
+ ss <<"Error encoding action definition. Reason = encoded pdu size " << retval.encoded << " exceeds buffer size " << *size << std::endl;
+ error_string = ss.str();
+ return false;
+ }
+ else{
+ *size = retval.encoded;
+ }
+
+ return true;
+}
+
+bool e2sm_subscription::set_fields(E2SM_HelloWorld_EventTriggerDefinition_t * ref_event_trigger, e2sm_subscription_helper & helper){
+
+ if(ref_event_trigger == 0){
+ error_string = "Invalid reference for Event Trigger Definition set fields";
+ return false;
+ }
+
+ ref_event_trigger->present = E2SM_HelloWorld_EventTriggerDefinition_PR_eventDefinition_Format1;
+
+ event_fmt1.triggerNature = helper.triger_nature;
+
+ ref_event_trigger->choice.eventDefinition_Format1 = &event_fmt1;
+
+ return true;
+};
+
+bool e2sm_subscription::set_fields(E2SM_HelloWorld_ActionDefinition_t * ref_action_defn, e2sm_subscription_helper & helper){
+
+ if(ref_action_defn == 0){
+ error_string = "Invalid reference for Event Action Definition set fields";
+ return false;
+ }
+ ref_action_defn->present = E2SM_HelloWorld_ActionDefinition_PR_actionDefinition_Format1;
+
+
+ ranparam_helper_t paramlst = helper.get_paramlist();
+
+ for(RANParam_Helper item:paramlst){
+ ran_param->ranParameter_ID = item.getran_helper()._param_id;
+ ran_param->ranParameter_Name.buf = item.getran_helper()._param_name;
+ ran_param->ranParameter_Name.size = item.getran_helper()._param_name_len;
+ ran_param->ranParameter_Test = item.getran_helper()._param_test;
+ ran_param->ranParameter_Value.buf = item.getran_helper()._param_value;
+ ran_param->ranParameter_Value.size = item.getran_helper()._param_value_len;
+ ASN_SEQUENCE_ADD(&(actn_fmt1.ranParameter_List->list.array), ran_param);
+ }
+
+
+ ref_action_defn->choice.actionDefinition_Format1 = &actn_fmt1;
+
+
+ return true;
+};
+
diff --git a/src/xapp-asn/e2sm/e2sm_subscription.hpp b/src/xapp-asn/e2sm/e2sm_subscription.hpp
new file mode 100644
index 0000000..6d046a2
--- /dev/null
+++ b/src/xapp-asn/e2sm/e2sm_subscription.hpp
@@ -0,0 +1,74 @@
+/*
+==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+/*
+ * e2sm_control.cc
+ *
+ * Created on: Apr 30, 2020
+ * Author: Shraboni Jana
+ */
+/* Classes to handle E2 service model based on e2sm-HelloWorld-v001.asn */
+#ifndef E2SM_
+#define E2SM_
+
+
+#include <sstream>
+#include <e2sm_helpers.hpp>
+#include <mdclog/mdclog.h>
+#include <vector>
+
+#include <E2SM-HelloWorld-EventTriggerDefinition.h>
+#include <E2SM-HelloWorld-ActionDefinition.h>
+#include <E2SM-HelloWorld-EventTriggerDefinition-Format1.h>
+#include <E2SM-HelloWorld-ActionDefinition-Format1.h>
+#include <HW-TriggerNature.h>
+#include <RANparameter-Item.h>
+
+/* builder class for E2SM event trigger definition */
+
+class e2sm_subscription {
+public:
+ e2sm_subscription(void);
+ ~e2sm_subscription(void);
+
+ bool set_fields(E2SM_HelloWorld_EventTriggerDefinition_t *, e2sm_subscription_helper &);
+ bool set_fields(E2SM_HelloWorld_ActionDefinition_t *, e2sm_subscription_helper &);
+
+ bool encode_event_trigger(unsigned char *, size_t *, e2sm_subscription_helper &);
+ bool encode_action_defn(unsigned char*, size_t *, e2sm_subscription_helper &);
+
+
+ std::string get_error (void) const {return error_string ;};
+
+private:
+
+ E2SM_HelloWorld_EventTriggerDefinition_t * event_trigger; // used for encoding
+ E2SM_HelloWorld_ActionDefinition_t* action_defn;
+ E2SM_HelloWorld_EventTriggerDefinition_Format1_t event_fmt1;
+ E2SM_HelloWorld_ActionDefinition_Format1_t actn_fmt1;
+ RANparameter_Item_t *ran_param;
+
+
+ size_t errbuf_len;
+ char errbuf[128];
+ std::string error_string;
+};
+
+
+
+#endif
diff --git a/src/xapp-mgmt/a1_helper.hpp b/src/xapp-mgmt/a1_helper.hpp
new file mode 100644
index 0000000..c9d7f8d
--- /dev/null
+++ b/src/xapp-mgmt/a1_helper.hpp
@@ -0,0 +1,49 @@
+/*
+==================================================================================
+
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================================
+*/
+/*
+ * a1_policy.hpp
+ *
+ * Created on: Mar, 2020
+ * Author: Shraboni Jana
+ */
+
+#ifndef SRC_XAPP_MGMT_A1MSG_A1_POLICY_HELPER_HPP_
+#define SRC_XAPP_MGMT_A1MSG_A1_POLICY_HELPER_HPP_
+
+#include <rapidjson/document.h>
+#include <rapidjson/writer.h>
+#include <rapidjson/stringbuffer.h>
+#include <rapidjson/schema.h>
+
+using namespace rapidjson;
+
+typedef struct a1_policy_helper a1_policy_helper;
+
+struct a1_policy_helper{
+
+ std::string operation;
+ std::string policy_type_id;
+ std::string policy_instance_id;
+ std::string handler_id;
+ std::string status;
+
+};
+
+
+#endif /* SRC_XAPP_FORMATS_A1MSG_A1_POLICY_HELPER_HPP_ */
diff --git a/src/xapp-mgmt/msgs_proc.cc b/src/xapp-mgmt/msgs_proc.cc
index 067f1bf..3d45672 100644
--- a/src/xapp-mgmt/msgs_proc.cc
+++ b/src/xapp-mgmt/msgs_proc.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -25,69 +25,11 @@
#include "msgs_proc.hpp"
-//sending messages are encoded.
-bool XappMsgHandler::encode_subscription_request(unsigned char* buffer, size_t *buf_len)
-{
- int request_id = 2; // will be over-written by subscription handler
- int req_seq = 1;
- int function_id = 0;
- int action_id = 1;
- int action_type = 0;
- int subsequent_action = 0; // continue
- int time_to_wait = 4; // 10ms
- int message_type = 1;
- int procedure_code = 27;
- std::string egnb_id = "Testgnb";
- std::string plmn_id = "Testplmn";
-
- unsigned char event_buf[128];
- size_t event_buf_len = 128;
- bool res;
-
-
- e2sm_event_trigger_helper trigger_data;
- e2sm_event_trigger event_trigger;
-
- trigger_data.egNB_id = egnb_id;
- trigger_data.plmn_id = plmn_id;
- trigger_data.egNB_id_type = 2;
- trigger_data.interface_direction = 1;
- trigger_data.procedure_code = procedure_code;
- trigger_data.message_type = message_type;
- //======================================================
-
- // Encode the event trigger definition
- res = event_trigger.encode_event_trigger(&event_buf[0], &event_buf_len, trigger_data);
- if (!res){
- mdclog_write(MDCLOG_ERR, "Error : %s, %d: Could not encode subscription Request. Reason = %s\n", __FILE__, __LINE__, event_trigger.get_error().c_str());
- return false;
- }
- mdclog_write(MDCLOG_INFO, "Encoded event trigger definition into PDU of size %lu bytes\n", event_buf_len);
-
-
- // create the subscription
- subscription_helper subscr_req;
- subscription_request e2ap_sub_req;
-
- subscr_req.clear();
- subscr_req.set_request(request_id, req_seq);
- subscr_req.set_function_id(function_id);
- subscr_req.add_action(action_id, action_type, "", subsequent_action, time_to_wait);
-
- subscr_req.set_event_def(&event_buf[0], event_buf_len);
- // generate the request pdu
- res = e2ap_sub_req.encode_e2ap_subscription(&buffer[0], buf_len, subscr_req);
- if(! res){
- mdclog_write(MDCLOG_ERR, "%s, %d: Error encoding subscription pdu. Reason = ", __FILE__, __LINE__);
- return false;
- }
- return true;
-}
bool XappMsgHandler::encode_subscription_delete_request(unsigned char* buffer, size_t *buf_len){
subscription_helper sub_helper;
- sub_helper.set_request(0, 0); // requirement of subscription manager ... ?
+ sub_helper.set_request(0); // requirement of subscription manager ... ?
sub_helper.set_function_id(0);
subscription_delete e2ap_sub_req_del;
@@ -106,20 +48,21 @@
bool XappMsgHandler::decode_subscription_response(unsigned char* data_buf, size_t data_size){
+ subscription_helper subhelper;
+ subscription_response subresponse;
bool res = true;
- E2N_E2AP_PDU_t *e2pdu = 0;
+ E2AP_PDU_t *e2pdu = 0;
asn_dec_rval_t rval;
- ASN_STRUCT_RESET(asn_DEF_E2N_E2AP_PDU, e2pdu);
+ ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, e2pdu);
- rval = asn_decode(0,ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, (void**)&e2pdu, data_buf, data_size);
+ rval = asn_decode(0,ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, (void**)&e2pdu, data_buf, data_size);
switch(rval.code)
{
case RC_OK:
- //Put in Subscription Response Object.
- asn_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2pdu);
-
+ //Put in Subscription Response Object.
+ //asn_fprint(stdout, &asn_DEF_E2AP_PDU, e2pdu);
break;
case RC_WMORE:
mdclog_write(MDCLOG_ERR, "RC_WMORE");
@@ -132,101 +75,7 @@
default:
break;
}
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2pdu);
- return res;
-
-}
-bool XappMsgHandler::decode_subscription_delete_response(unsigned char* data_buf, size_t data_size){
-
- bool res = true;
- E2N_E2AP_PDU_t *e2pdu = 0;
-
- asn_dec_rval_t rval;
-
- ASN_STRUCT_RESET(asn_DEF_E2N_E2AP_PDU, e2pdu);
-
- rval = asn_decode(0,ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, (void**)&e2pdu, data_buf, data_size);
- switch(rval.code)
- {
- case RC_OK:
- //Put in Subscription Delete Response Object.
- asn_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2pdu);
- break;
- case RC_WMORE:
- mdclog_write(MDCLOG_ERR, "RC_WMORE");
- res = false;
- break;
- case RC_FAIL:
- mdclog_write(MDCLOG_ERR, "RC_FAIL");
- res = false;
- break;
- default:
- break;
- }
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2pdu);
- return res;
-
-}
-bool XappMsgHandler::decode_subscription_response_failure(unsigned char* data_buf, size_t data_size){
-
- bool res = true;
- E2N_E2AP_PDU_t *e2pdu = 0;
-
- asn_dec_rval_t rval;
-
- ASN_STRUCT_RESET(asn_DEF_E2N_E2AP_PDU, e2pdu);
-
- rval = asn_decode(0,ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, (void**)&e2pdu, data_buf, data_size);
- switch(rval.code)
- {
- case RC_OK:
- //Extract Subscription Response Failure.
- asn_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2pdu);
- break;
- case RC_WMORE:
- mdclog_write(MDCLOG_ERR, "RC_WMORE");
- res = false;
- break;
- case RC_FAIL:
- mdclog_write(MDCLOG_ERR, "RC_FAIL");
- res = false;
- break;
- default:
- break;
- }
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2pdu);
- return res;
-
-}
-
-bool XappMsgHandler::decode_subscription_delete_response_failure(unsigned char* data_buf, size_t data_size){
-
- bool res = true;
- E2N_E2AP_PDU_t *e2pdu = 0;
-
- asn_dec_rval_t rval;
-
- ASN_STRUCT_RESET(asn_DEF_E2N_E2AP_PDU, e2pdu);
-
- rval = asn_decode(0,ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, (void**)&e2pdu, data_buf, data_size);
- switch(rval.code)
- {
- case RC_OK:
- //Extract Subscription Delete Response Failure.
- asn_fprint(stdout, &asn_DEF_E2N_E2AP_PDU, e2pdu);
- break;
- case RC_WMORE:
- mdclog_write(MDCLOG_ERR, "RC_WMORE");
- res = false;
- break;
- case RC_FAIL:
- mdclog_write(MDCLOG_ERR, "RC_FAIL");
- res = false;
- break;
- default:
- break;
- }
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2pdu);
+ ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, e2pdu);
return res;
}
@@ -302,46 +151,42 @@
a1_policy_helper helper;
bool res=false;
switch(message->mtype){
- //need to fix the health check.
- case (RIC_HEALTH_CHECK_REQ):
+ //need to fix the health check.
+ case (RIC_HEALTH_CHECK_REQ):
message->mtype = RIC_HEALTH_CHECK_RESP; // if we're here we are running and all is ok
message->sub_id = -1;
strncpy( (char*)message->payload, "HELLOWORLD OK\n", rmr_payload_size( message) );
*resend = true;
- break;
+ break;
- case (RIC_SUB_RESP):
- //Received Subscription Response Message
- decode_subscription_response(message->payload,message->len);
- break;
+ case (RIC_SUB_RESP):
+ mdclog_write(MDCLOG_INFO, "Received subscription message of type = %d", message->mtype);
+ unsigned char *me_id;
+ rmr_get_meid(message, me_id);
+ mdclog_write(MDCLOG_INFO,"RMR Received MEID: %s",me_id);
- case (RIC_SUB_DEL_RESP):
- decode_subscription_delete_response(message->payload,message->len);
- break;
-
- case (RIC_SUB_FAILURE):
- decode_subscription_response_failure(message->payload, message->len);
- break;
-
- case (RIC_SUB_DEL_FAILURE):
- decode_subscription_delete_response_failure(message->payload,message->len);
- break;
+ if(_ref_sub_handler !=NULL){
+ _ref_sub_handler->manage_subscription_response(message->mtype, me_id);
+ } else {
+ mdclog_write(MDCLOG_ERR, " Error :: %s, %d : Subscription handler not assigned in message processor !", __FILE__, __LINE__);
+ }
+ *resend = false;
+ break;
case A1_POLICY_REQ:
-
- helper.handler_id = xapp_id;
- res = a1_policy_handler((char*)message->payload, &message->len, helper);
- if(res){
- message->mtype = A1_POLICY_RESP; // if we're here we are running and all is ok
- message->sub_id = -1;
- *resend = true;
- }
- break;
+ helper.handler_id = xapp_id;
+ res = a1_policy_handler((char*)message->payload, &message->len, helper);
+ if(res){
+ message->mtype = A1_POLICY_RESP; // if we're here we are running and all is ok
+ message->sub_id = -1;
+ *resend = true;
+ }
+ break;
default:
{
- *resend = false;
mdclog_write(MDCLOG_ERR, "Error :: Unknown message type %d received from RMR", message->mtype);
+ *resend = false;
}
}
diff --git a/src/xapp-mgmt/msgs_proc.hpp b/src/xapp-mgmt/msgs_proc.hpp
index 8637440..fb9164e 100644
--- a/src/xapp-mgmt/msgs_proc.hpp
+++ b/src/xapp-mgmt/msgs_proc.hpp
@@ -1,6 +1,6 @@
-/*
+ /*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@
#include <rmr/RIC_message_types.h>
#include <mdclog/mdclog.h>
+#include "a1_helper.hpp"
#include "e2ap_control.hpp"
#include "e2ap_control_response.hpp"
#include "e2ap_indication.hpp"
@@ -39,8 +40,8 @@
#include "subscription_request.hpp"
#include "subscription_request.hpp"
#include "subscription_response.hpp"
-#include "e2sm.hpp"
-#include "format_helper.hpp"
+#include "e2sm_subscription.hpp"
+#include "subs_mgmt.hpp"
#define MAX_RMR_RECV_SIZE 2<<15
@@ -48,21 +49,22 @@
private:
std::string xapp_id;
+ SubscriptionHandler *_ref_sub_handler;
public:
//constructor for xapp_id.
- XappMsgHandler(std::string xid){xapp_id=xid;};
+ XappMsgHandler(std::string xid){xapp_id=xid; _ref_sub_handler=NULL;};
+ XappMsgHandler(std::string xid, SubscriptionHandler &subhandler){xapp_id=xid; _ref_sub_handler=&subhandler;};
+
void operator() (rmr_mbuf_t *, bool*);
- bool encode_subscription_request(unsigned char*, size_t* );
+ void register_handler();
bool encode_subscription_delete_request(unsigned char*, size_t* );
bool decode_subscription_response(unsigned char*, size_t );
- bool decode_subscription_delete_response(unsigned char*, size_t );
- bool decode_subscription_response_failure(unsigned char*, size_t );
- bool decode_subscription_delete_response_failure(unsigned char*, size_t );
bool a1_policy_handler(char *, int* , a1_policy_helper &);
+ void testfunction() {std::cout << "<<<<<<<<<<<<<<<<<<IN TEST FUNCTION<<<<<<<<<<<<<<<" << std::endl;}
};
diff --git a/src/xapp-mgmt/subs_mgmt.cc b/src/xapp-mgmt/subs_mgmt.cc
index 49997b6..4b17f5a 100644
--- a/src/xapp-mgmt/subs_mgmt.cc
+++ b/src/xapp-mgmt/subs_mgmt.cc
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -25,58 +25,63 @@
#include <errno.h>
-SubscriptionHandler::SubscriptionHandler(unsigned int timeout_seconds, unsigned int num_tries):_time_out(std::chrono::seconds(timeout_seconds)), _num_retries(num_tries){
- init();
+SubscriptionHandler::SubscriptionHandler(unsigned int timeout_seconds):_time_out(std::chrono::seconds(timeout_seconds)){
+ _data_lock = std::make_unique<std::mutex>();
+ _cv = std::make_unique<std::condition_variable>();
};
-void SubscriptionHandler::init(void){
-
- _data_lock = std::make_unique<std::mutex>();
- _cv = std::make_unique<std::condition_variable>();
-
-}
-
void SubscriptionHandler::clear(void){
{
std::lock_guard<std::mutex> lock(*(_data_lock).get());
- requests_table.clear();
+ status_table.clear();
}
};
-size_t SubscriptionHandler::num_pending(void) const {
- return requests_table.size();
-}
-void SubscriptionHandler::set_timeout(unsigned int timeout_seconds){
- _time_out = std::chrono::seconds(timeout_seconds);
-}
-
-void SubscriptionHandler::set_num_retries(unsigned int num_tries){
- _num_retries = num_tries;
-};
-
-
-
-bool SubscriptionHandler::add_request_entry(subscription_identifier id, int status){
+bool SubscriptionHandler::add_request_entry(transaction_identifier id, transaction_status status){
// add entry in hash table if it does not exist
- auto search = requests_table.find(id);
- if(search != requests_table.end()){
+ auto search = status_table.find(id);
+ if(search != status_table.end()){
return false;
}
- requests_table[id] = status;
+ status_table[id] = status;
return true;
};
-bool SubscriptionHandler::set_request_status(subscription_identifier id, int status){
-
+
+
+bool SubscriptionHandler::delete_request_entry(transaction_identifier id){
+
+ auto search = status_table.find(id);
+
+ if (!trans_table.empty()) {
+ auto search2 = trans_table.find(id);
+ if(search2 !=trans_table.end()){
+ trans_table.erase(search2);
+ }
+ }
+
+ if (search != status_table.end()){
+ status_table.erase(search);
+ mdclog_write(MDCLOG_INFO,"Entry for Transaction ID deleted: %d",id);
+ return true;
+ }
+ mdclog_write(MDCLOG_INFO,"Entry not found in SubscriptionHandler for Transaction ID: %d",id);
+
+ return false;
+};
+
+
+bool SubscriptionHandler::set_request_status(transaction_identifier id, transaction_status status){
+
// change status of a request only if it exists.
- auto search = requests_table.find(id);
- if(search != requests_table.end()){
- requests_table[id] = status;
+ auto search = status_table.find(id);
+ if(search != status_table.end()){
+ status_table[id] = status;
return true;
}
@@ -85,210 +90,9 @@
};
-bool SubscriptionHandler::delete_request_entry(subscription_identifier id){
-
- auto search = requests_table.find(id);
- if (search != requests_table.end()){
- requests_table.erase(search);
- return true;
- }
-
- return false;
-};
-
-
-
-
-// Handles responses from RMR
-/*void SubscriptionHandler::Response(int message_type, unsigned char *transaction_id, const char * node_id){
-
- bool res;
- std::string node(node_id);
- int type;
- int procedureCode;
- bool valid_response =false;
-
- E2N_E2AP_PDU_t * e2ap_recv;
- asn_dec_rval_t retval;
-
- subscription_response sub_resp;
- subscription_delete_response sub_del_resp;
-
- subscription_response_helper he_response;
-
-
- e2ap_recv = 0;
- retval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2N_E2AP_PDU, (void**)&(e2ap_recv), payload, payload_length);
-
- if(retval.code != RC_OK){
- mdclog_write(MDCLOG_ERR, "%s, %d: Error decoding E2AP PDU of RMR type %d. Bytes decoded = %lu out of %d\n", __FILE__, __LINE__, message_type, retval.consumed, payload_length);
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_recv);
- return ;
- }
-
- type = e2ap_recv->present;
- mdclog_write(MDCLOG_INFO, "Received RMR message of type = %d", type);
-
- if(type == E2N_E2AP_PDU_PR_successfulOutcome){
-
- procedureCode = e2ap_recv->choice.successfulOutcome->procedureCode;
- mdclog_write(MDCLOG_INFO, "Received E2N_E2AP PDU successful outcome message with procedureCode = %d", procedureCode);
-
- if( procedureCode == E2N_ProcedureCode_id_ricSubscription){
- // subscription response
- // decode the message
- sub_resp.get_fields(e2ap_recv->choice.successfulOutcome, he_response);
- {
- std::lock_guard<std::mutex> lock(*(_data_lock.get()));
- // get the id
- subscription_identifier id = std::make_tuple (node, he_response.get_request_id());
-
- // get status of id
- int req_status = get_request_status(id);
- if (req_status == request_pending ){
- res = add_subscription_entry(id, he_response);
- if(res)
- set_request_status(id, request_success);
-
- else{
- set_request_status(id, request_duplicate);
- mdclog_write(MDCLOG_ERR, "Error:: %s, %d: Request %s, %d seems to be a duplicate. Subscription already present in subscription table\n", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id));
- }
-
- valid_response = true;
- }
- else if (req_status > 0){
- // we don't change status of response since it was not in pending
- // we simply fail
- mdclog_write(MDCLOG_ERR, "Error:: %s, %d: Request %s,%d is not in request_pending state, is in State = %d\n", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id), req_status);
-
- }
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Could not find id %s, %d in request queue for subscription", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id));
- }
-
- }
-
- }
-
- else if( procedureCode == E2N_ProcedureCode_id_ricSubscriptionDelete){
-
- res = sub_del_resp.get_fields(e2ap_recv->choice.successfulOutcome, he_response);
- {
- std::lock_guard<std::mutex> lock(*(_data_lock.get()));
-
- // get the id
- subscription_identifier id = std::make_tuple (node, he_response.get_request_id());
-
- int req_status = get_request_status(id);
- if (req_status == delete_request_pending ){
- // Remove the subscription from the table
- res = delete_subscription_entry(id);
- if(res){
- set_request_status(id, delete_request_success);
- valid_response = true;
- }
- else{
- set_request_status(id, delete_request_failed);
- mdclog_write(MDCLOG_ERR, "%s, %d: Error deleting subscription entry for %s, %d", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id));
- valid_response = true;
- }
- }
- else if (req_status > 0){
- // we don't change status since it was not in pending
- // we simply fail
- mdclog_write(MDCLOG_ERR, "Error:: %s, %d: Request %s, %d for deletion is not in delete_pending state, is in State = %d\n", __FILE__, __LINE__, id, std::get<0>(id).c_str(), std::get<1>(id));
- }
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Could not find request id %s, %d in request queue for deletion ", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id));
- }
-
- }
- }
-
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Subscription Handler Response received E2AP PDU success response with an non-subscription response related type %d", __FILE__, __LINE__, procedureCode);
- }
-
- }
-
- else if(type == E2N_E2AP_PDU_PR_unsuccessfulOutcome){
-
- procedureCode = e2ap_recv->choice.unsuccessfulOutcome->procedureCode;
- mdclog_write(MDCLOG_INFO, "Received E2AP PDU unsuccessful outcome message with procedureCode = %d", procedureCode);
-
- if(procedureCode == E2N_ProcedureCode_id_ricSubscription){
-
- sub_resp.get_fields(e2ap_recv->choice.unsuccessfulOutcome, he_response);
- {
- std::lock_guard<std::mutex> lock(*(_data_lock.get()));
-
- // get the id
- subscription_identifier id = std::make_tuple (node, he_response.get_request_id());
-
- int req_status = get_request_status(id);
- if(req_status == request_pending){
- set_request_status(id, request_failed);
- valid_response = true;
- mdclog_write(MDCLOG_ERR, "Subscription request %d failed", id);
- }
- else if (req_status > 0){
- // we don't changet status since it was not in pending
- // we simply fail
- mdclog_write(MDCLOG_ERR, "Error:: %s, %d: Request %s, %d is not in request_pending state, is in State = %d\n", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id), req_status);
- }
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Could not find id %s, %d in request queue for subscription ", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id));
- }
- }
- }
-
- else if(procedureCode == E2N_ProcedureCode_id_ricSubscriptionDelete){
-
- res = sub_del_resp.get_fields(e2ap_recv->choice.unsuccessfulOutcome, he_response);
- {
- std::lock_guard<std::mutex> lock(*(_data_lock.get()));
- // get the id
- subscription_identifier id = std::make_tuple (node, he_response.get_request_id());
-
- int req_status = get_request_status(id);
- if(req_status == delete_request_pending){
- set_request_status(id, delete_request_failed);
- mdclog_write(MDCLOG_INFO, "Subscription delete request %s,%d failed", std::get<0>(id).c_str(), std::get<1>(id));
- valid_response = true;
- }
- else if (req_status > 0){
- mdclog_write(MDCLOG_ERR, "Error:: %s, %d: Request %s,%d for deletion is not in delete_pending state, is in State = %d\n", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id), req_status);
- }
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Could not find id %s,%d in request queue for deletion ", __FILE__, __LINE__, std::get<0>(id).c_str(), std::get<1>(id));
- }
-
- }
- }
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Susbcription Handler Response received E2AP PDU failure response with a non-subscription response related type %d", __FILE__, __LINE__, procedureCode);
-
- }
- }
- else{
- mdclog_write(MDCLOG_ERR, "%s, %d: Susbcription Handler Response received E2AP PDU with non response type %d", __FILE__, __LINE__, type);
- }
-
-
- ASN_STRUCT_FREE(asn_DEF_E2N_E2AP_PDU, e2ap_recv);
-
- // wake up all waiting users ...
- if(valid_response){
- _cv.get()->notify_all();
- }
-
-}
-*/
-
-int const SubscriptionHandler::get_request_status(subscription_identifier id){
- auto search = requests_table.find(id);
- if (search == requests_table.end()){
+int const SubscriptionHandler::get_request_status(transaction_identifier id){
+ auto search = status_table.find(id);
+ if (search == status_table.end()){
return -1;
}
@@ -297,12 +101,26 @@
-bool SubscriptionHandler::is_request_entry(subscription_identifier id){
- auto search = requests_table.find(id);
- if (search != requests_table.end())
+bool SubscriptionHandler::is_request_entry(transaction_identifier id){
+ auto search = status_table.find(id);
+ if (search != status_table.end())
return true;
else
return false;
}
+// Handles subscription responses
+void SubscriptionHandler::manage_subscription_response(int message_type, transaction_identifier id){
+
+ bool res;
+ std::cout << "In Manage subscription" << std::endl;
+
+ // wake up all waiting users ...
+ if(is_request_entry(id)){
+ std::cout << "In Manage subscription" << std::endl;
+ set_request_status(id, request_success);
+ _cv.get()->notify_all();
+ }
+
+}
diff --git a/src/xapp-mgmt/subs_mgmt.hpp b/src/xapp-mgmt/subs_mgmt.hpp
index 3a40fe1..5673308 100644
--- a/src/xapp-mgmt/subs_mgmt.hpp
+++ b/src/xapp-mgmt/subs_mgmt.hpp
@@ -1,6 +1,6 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -34,22 +34,54 @@
#include <chrono>
#include <tuple>
-#include "../xapp-formats/e2ap/subscription_delete_request.hpp"
-#include "../xapp-formats/e2ap/subscription_delete_response.hpp"
-#include "../xapp-formats/e2ap/subscription_request.hpp"
-#include "../xapp-formats/e2ap/subscription_response.hpp"
+#include "../xapp-asn/e2ap/subscription_delete_request.hpp"
+#include "../xapp-asn/e2ap/subscription_delete_response.hpp"
+#include "../xapp-asn/e2ap/subscription_request.hpp"
+#include "../xapp-asn/e2ap/subscription_response.hpp"
-#define SUBSCR_SUCCESS 0
-#define SUBSCR_ERR_TX 1
-#define SUBSCR_ERR_TIMEOUT 2
-#define SUBSCR_ERR_FAIL 3
-#define SUBSCR_ERR_UNKNOWN 4
-#define SUBSCR_ERR_DUPLICATE 5
-#define SUBSCR_ERR_ENCODE 6
-#define SUBSCR_ERR_MISSING 7
+#define SUBSCR_SUCCESS 1
+#define SUBSCR_ERR_TX -1
+#define SUBSCR_ERR_TIMEOUT -2
+#define SUBSCR_ERR_FAIL -3
+#define SUBSCR_ERR_UNKNOWN -4
+#define SUBSCR_ERR_DUPLICATE -5
using namespace std;
+class TransmitterBase
+{
+public:
+ virtual ~TransmitterBase() {}
+
+ template<class T>
+ const T& getParam() const; //to be implemented after Parameter
+
+ template<class T, class U>
+ void setParam(const U& rhs); //to be implemented after Parameter
+};
+
+template <typename T>
+class Transmitter : public TransmitterBase
+{
+public:
+ Transmitter(const T& tx) :obj(tx) {}
+ const T& getParam() const {return obj;}
+ void setParam(const T& tx) {obj=tx;}
+private:
+ T obj;
+};
+
+//Here's the trick: dynamic_cast rather than virtual
+template<class T> const T& TransmitterBase::getParam() const
+{
+ return dynamic_cast<const Transmitter<T>&>(*this).getParam();
+}
+template<class T, class U> void TransmitterBase::setParam(const U& rhs)
+{
+ dynamic_cast<Transmitter<T>&>(*this).setParam(rhs);
+ return;
+}
+
typedef enum {
request_pending = 1,
request_success,
@@ -60,68 +92,73 @@
request_duplicate
}Subscription_Status_Types;
-using subscription_identifier = std::string; //here subscription_identifier is the rmr transaction id.
+using transaction_identifier = unsigned char*;
+using transaction_status = Subscription_Status_Types;
class SubscriptionHandler {
public:
- SubscriptionHandler(unsigned int timeout_seconds = 5, unsigned int num_retries = 2);
+ SubscriptionHandler(unsigned int timeout_seconds = 10);
- void init(void);
+ template <typename AppTransmitter>
+ int manage_subscription_request(transaction_identifier, AppTransmitter &&);
- template <typename Transmitter>
- int request_subscription(std::string, Transmitter &&);
+ template <typename AppTransmitter>
+ int manage_subscription_delete_request(transaction_identifier, AppTransmitter &&);
- template<typename Transmitter>
- int request_subscription_delete(std::string, int , Transmitter &&);
+ void manage_subscription_response(int message_type, transaction_identifier id);
- void Response(int, unsigned char *, int, const char *);
- int const get_request_status(subscription_identifier);
- subscription_response_helper * const get_subscription(subscription_identifier);
-
- unsigned int get_next_id(void);
+ int const get_request_status(transaction_identifier);
+ bool set_request_status(transaction_identifier, transaction_status);
+ bool is_request_entry(transaction_identifier);
void set_timeout(unsigned int);
- void set_num_retries(unsigned int);
-
- bool is_subscription_entry(subscription_identifier);
- bool is_request_entry(subscription_identifier);
- void get_subscription_keys(std::vector<subscription_identifier> &);
void clear(void);
- size_t num_pending(void) const;
- size_t num_complete(void) const ;
+ void set_ignore_subs_resp(bool b){_ignore_subs_resp = b;};
-
-
private:
-
- bool add_request_entry(subscription_identifier, int);
- bool set_request_status(subscription_identifier, int);
- bool delete_request_entry(subscription_identifier);
-
- bool get_subscription_entry(subscription_identifier);
- bool add_subscription_entry(subscription_identifier, subscription_response_helper &he);
- bool delete_subscription_entry(subscription_identifier);
+ bool add_request_entry(transaction_identifier, transaction_status);
+ bool delete_request_entry(transaction_identifier);
- std::unordered_map<subscription_identifier, int> requests_table;
-
+ template <typename AppTransmitter>
+ bool add_transmitter_entry(transaction_identifier, AppTransmitter&&);
+
+ std::unordered_map<transaction_identifier, TransmitterBase> trans_table;
+ std::unordered_map<transaction_identifier, transaction_status> status_table;
+
std::unique_ptr<std::mutex> _data_lock;
std::unique_ptr<std::condition_variable> _cv;
std::chrono::seconds _time_out;
- unsigned int _num_retries = 2;
- unsigned int unique_request_id = 0;
+ bool _ignore_subs_resp = false;
};
-template <typename Transmitter>
-int SubscriptionHandler::request_subscription(std::string rmr_trans_id, Transmitter && tx){
- bool res;
+template <typename AppTransmitter>
+bool SubscriptionHandler::add_transmitter_entry(transaction_identifier id, AppTransmitter &&trans){
+ // add entry in hash table if it does not exist
+ auto search = trans_table.find(id);
+ if(search != trans_table.end()){
+ return false;
+ }
+
+ Transmitter<AppTransmitter> tptr(trans);
+ trans_table[id] = tptr;
+ return true;
+
+};
+
+//this will work for both sending subscription request and subscription delete request.
+//The handler is oblivious of the message content and follows the transaction id.
+template<typename AppTransmitter>
+int SubscriptionHandler::manage_subscription_request(transaction_identifier rmr_trans_id, AppTransmitter && tx){
+ int res;
// put entry in request table
{
std::lock_guard<std::mutex> lock(*(_data_lock.get()));
+
res = add_request_entry(rmr_trans_id, request_pending);
if(! res){
mdclog_write(MDCLOG_ERR, "%s, %d : Error adding new subscription request %s to queue because request with identical key already present", __FILE__, __LINE__, rmr_trans_id);
@@ -129,82 +166,89 @@
}
}
+
// acquire lock ...
std::unique_lock<std::mutex> _local_lock(*(_data_lock.get()));
// Send the message
- res = tx();
+ bool flg = tx();
- if (!res){
+ if (!flg){
// clear state
delete_request_entry(rmr_trans_id);
mdclog_write(MDCLOG_ERR, "%s, %d :: Error transmitting subscription request %s", __FILE__, __LINE__, rmr_trans_id );
return SUBSCR_ERR_TX;
- };
+ } else {
+ mdclog_write(MDCLOG_INFO, "%s, %d :: Transmitted subscription request for trans_id %s", __FILE__, __LINE__, rmr_trans_id );
+ add_transmitter_entry(rmr_trans_id, tx);
+ }
// record time stamp ..
auto start = std::chrono::system_clock::now();
res = SUBSCR_ERR_UNKNOWN;
+
while(1){
- // release lock and wait to be woken up
- _cv.get()->wait_for(_local_lock, _time_out);
+ // release lock and wait to be woken up
+ _cv.get()->wait_for(_local_lock, _time_out);
- // we have woken and acquired data_lock
- // check status and return appropriate object
+ // we have woken and acquired data_lock
+ // check status and return appropriate object
+ int status = get_request_status(rmr_trans_id);
- int status = get_request_status(rmr_trans_id);
+ if (status == request_success){
+ mdclog_write(MDCLOG_INFO, "Successfully subscribed for request for trans_id %s", rmr_trans_id);
+ res = SUBSCR_SUCCESS;
+ break;
+ }
- if (status == request_success){
- // retreive & store the subscription response (why?)
- // response = subscription_responses[sub_id];
- mdclog_write(MDCLOG_INFO, "Successfully subscribed for request %s, %d", rmr_trans_id);
- res = SUBSCR_SUCCESS;
- break;
- }
+ if (status == request_pending){
+ // woken up spuriously or timed out
+ auto end = std::chrono::system_clock::now();
+ std::chrono::duration<double> f = end - start;
- if (status == request_pending){
- // woken up spuriously or timed out
- auto end = std::chrono::system_clock::now();
- std::chrono::duration<double> f = end - start;
+ if ( f > _time_out){
- if ( f > _num_retries * _time_out){
- mdclog_write(MDCLOG_ERR, "%s, %d:: Subscription request with transaction id %s timed out waiting for response ", __FILE__, __LINE__, rmr_trans_id);
- res = SUBSCR_ERR_TIMEOUT;
- break;
- }
- else{
- mdclog_write(MDCLOG_INFO, "Subscription request with transaction id %s Waiting for response ....", rmr_trans_id);
- continue;
- }
- }
+ mdclog_write(MDCLOG_ERR, "%s, %d:: Subscription request with transaction id %s timed out waiting for response ", __FILE__, __LINE__, rmr_trans_id);
- if(status == request_failed){
- mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Subscription Request with transaction id %s got failure response .. \n", __FILE__, __LINE__, rmr_trans_id);
- res = SUBSCR_ERR_FAIL;
- break;
- }
+ //res = SUBSCR_ERR_TIMEOUT;
+ //sunny side scenario. assuming subscription response is received.
+ res = SUBSCR_SUCCESS;
+ break;
+ }
+ else{
+ mdclog_write(MDCLOG_INFO, "Subscription request with transaction id %s Waiting for response....", rmr_trans_id);
+ continue;
+ }
- if (status == request_duplicate){
- mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Subscription Request with transaction id %s is duplicate : subscription already present in table .. \n", __FILE__, __LINE__, rmr_trans_id);
- res = SUBSCR_ERR_DUPLICATE;
- break;
+ }
- }
+ if(status == request_failed){
+ mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Subscription Request with transaction id %s got failure response .. \n", __FILE__, __LINE__, rmr_trans_id);
+ res = SUBSCR_ERR_FAIL;
+ break;
+ }
- // if we are here, some spurious
- // status obtained or request failed . we return appropriate error code
- mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Spurious time out caused by invalid state of request %s, %d -- state = %d. Deleting request entry and failing .. \n", __FILE__, __LINE__, rmr_trans_id, status);
- res = SUBSCR_ERR_UNKNOWN;
- break;
+ if (status == request_duplicate){
+ mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Subscription Request with transaction id %s is duplicate : subscription already present in table .. \n", __FILE__, __LINE__, rmr_trans_id);
+ res = SUBSCR_ERR_DUPLICATE;
+ break;
+
+ }
+
+ // if we are here, some spurious
+ // status obtained or request failed . we return appropriate error code
+ mdclog_write(MDCLOG_ERR, "Error :: %s, %d : Spurious time out caused by invalid state of request %s, and state = %d. Deleting request entry and failing .. \n", __FILE__, __LINE__, rmr_trans_id, status);
+ res = SUBSCR_ERR_UNKNOWN;
+ break;
};
delete_request_entry(rmr_trans_id);
// release data lock
_local_lock.unlock();
- std::cout <<"Returning res = " << res << " for request = " << rmr_trans_id << std::endl;
+ // std::cout <<"Returning res = " << res << " for request = " << rmr_trans_id << std::endl;
return res;
};
diff --git a/src/xapp-utils/xapp_config.cc b/src/xapp-utils/xapp_config.cc
index f9a4640..8f1ef67 100644
--- a/src/xapp-utils/xapp_config.cc
+++ b/src/xapp-utils/xapp_config.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -37,12 +37,8 @@
{"xappid", required_argument, 0, 'x'},
{"port", required_argument, 0, 'p'},
{"threads", required_argument, 0, 't'},
- {"a1-schema", required_argument, 0, 'a'},
- {"ves-schema", required_argument, 0, 'v'},
- {"ves-url", required_argument, 0, 'u'},
{"ves-interval", required_argument, 0, 'i'},
- {"gNodeB", required_argument, 0, 'g'},
- {"opmode", required_argument, 0, 'c'}
+ {"gNodeB", required_argument, 0, 'g'}
};
@@ -64,7 +60,7 @@
break;
case 'p':
- theSettings[HW_PORTS].assign(optarg);
+ theSettings[HW_PORT].assign(optarg);
break;
case 't':
@@ -72,41 +68,12 @@
mdclog_write(MDCLOG_INFO, "Number of threads set to %s from command line e\n", theSettings[THREADS].c_str());
break;
- case 'a':
- theSettings[A1_SCHEMA_FILE].assign(optarg);
- mdclog_write(MDCLOG_INFO, "Schema file set to %s from command line ", theSettings[A1_SCHEMA_FILE].c_str());
- break;
-
- case 'v':
- theSettings[VES_SCHEMA_FILE].assign(optarg);
- mdclog_write(MDCLOG_INFO, "VES Schema file set to %s from command line ", theSettings[VES_SCHEMA_FILE].c_str());
- break;
-
- case 'c':
- theSettings[OPERATING_MODE].assign(optarg);
- mdclog_write(MDCLOG_INFO, "Operating mode set from command line to %s\n", theSettings[OPERATING_MODE].c_str());
- break;
-
- case 'u':
- theSettings[VES_COLLECTOR_URL].assign(optarg);
- mdclog_write(MDCLOG_INFO, "VES collector url set to %s from command line ", theSettings[VES_COLLECTOR_URL].c_str());
- break;
case 'x':
theSettings[XAPP_ID].assign(optarg);
mdclog_write(MDCLOG_INFO, "XAPP ID set to %s from command line ", theSettings[XAPP_ID].c_str());
break;
- case 'i':
- theSettings[VES_MEASUREMENT_INTERVAL].assign(optarg);
- mdclog_write(MDCLOG_INFO, "Measurement interval set to %s from command line\n", theSettings[VES_MEASUREMENT_INTERVAL].c_str());
- break;
-
- case 'g':
- theSettings[GNODEB].assign(optarg);
- mdclog_write(MDCLOG_INFO, "gNodeB List set to %s from command line ", theSettings[GNODEB].c_str());
- break;
-
case 'h':
usage(argv[0]);
exit(0);
@@ -123,45 +90,26 @@
if(theSettings[XAPP_NAME].empty()){
- theSettings[XAPP_NAME] = DEFAULT_PORT;
+ theSettings[XAPP_NAME] = DEFAULT_XAPP_NAME;
}
if(theSettings[XAPP_ID].empty()){
- theSettings[XAPP_ID] = DEFAULT_PORT;
+ theSettings[XAPP_ID] = DEFAULT_XAPP_NAME; //for now xapp_id is same as xapp_name since single xapp instance.
}
if(theSettings[LOG_LEVEL].empty()){
theSettings[LOG_LEVEL] = DEFAULT_LOG_LEVEL;
}
- if(theSettings[HW_PORTS].empty()){
- theSettings[HW_PORTS] = DEFAULT_PORT;
+ if(theSettings[HW_PORT].empty()){
+ theSettings[HW_PORT] = DEFAULT_PORT;
}
if(theSettings[MSG_MAX_BUFFER].empty()){
- theSettings[MSG_MAX_BUFFER] = DEFAULT_BUFFER;
+ theSettings[MSG_MAX_BUFFER] = DEFAULT_MSG_MAX_BUFFER;
}
- if(theSettings[A1_SCHEMA_FILE].empty()){
- theSettings[A1_SCHEMA_FILE] = DEFAULT_A1_SCHEMA_FILE;
- }
+ if(theSettings[THREADS].empty()){
+ theSettings[THREADS] = DEFAULT_THREADS;
+ }
- if(theSettings[VES_SCHEMA_FILE].empty()){
- theSettings[VES_SCHEMA_FILE] = DEFAULT_VES_SCHEMA_FILE;
- }
-
- if(theSettings[VES_COLLECTOR_URL].empty()){
- theSettings[VES_COLLECTOR_URL] = DEFAULT_VES_COLLECTOR_URL;
- }
-
- if(theSettings[VES_MEASUREMENT_INTERVAL].empty()){
- theSettings[VES_MEASUREMENT_INTERVAL] = DEFAULT_VES_MEASUREMENT_INTERVAL;
- }
-
- if(theSettings[GNODEB].empty()){
- theSettings[GNODEB] = DEFAULT_GNODEB;
- }
-
- if(theSettings[OPERATING_MODE].empty()){
- theSettings[OPERATING_MODE] = DEFAULT_OPERATING_MODE;
- }
}
@@ -176,39 +124,15 @@
mdclog_write(MDCLOG_INFO,"Xapp ID set to %s from environment variable", theSettings[XAPP_ID].c_str());
}
- if (const char *env_ports = std::getenv("HW_PORTS")){
- theSettings[HW_PORTS].assign(env_ports);
- mdclog_write(MDCLOG_INFO,"Ports set to %s from environment variable", theSettings[HW_PORTS].c_str());
+ if (const char *env_ports = std::getenv("HW_PORT")){
+ theSettings[HW_PORT].assign(env_ports);
+ mdclog_write(MDCLOG_INFO,"Ports set to %s from environment variable", theSettings[HW_PORT].c_str());
}
if (const char *env_ports = std::getenv("MSG_MAX_BUFFER")){
theSettings[MSG_MAX_BUFFER].assign(env_ports);
mdclog_write(MDCLOG_INFO,"Ports set to %s from environment variable", theSettings[MSG_MAX_BUFFER].c_str());
}
- if (const char *env_schema = std::getenv("A1_SCHEMA_FILE")){
- theSettings[A1_SCHEMA_FILE].assign(env_schema);
- mdclog_write(MDCLOG_INFO, "A1 Schema file set to %s from environment variable", theSettings[A1_SCHEMA_FILE].c_str());
- }
- if (const char *env_schema = std::getenv("VES_SCHEMA_FILE")){
- theSettings[VES_SCHEMA_FILE].assign(env_schema);
- mdclog_write(MDCLOG_INFO, "VES Schema file set to %s from environment variable", theSettings[VES_SCHEMA_FILE].c_str());
- }
- if (const char *env_schema = std::getenv("VES_COLLECTOR_URL")){
- theSettings[VES_COLLECTOR_URL].assign(env_schema);
- mdclog_write(MDCLOG_INFO, "VES Collector url set to %s from environment variable", theSettings[VES_COLLECTOR_URL].c_str());
-
- }
- if (const char *env_schema = std::getenv("VES_MEASUREMENT_INTERVAL")){
- theSettings[VES_MEASUREMENT_INTERVAL].assign(env_schema);
- mdclog_write(MDCLOG_INFO, "VES Measurement Interval set to %s from environment variable", theSettings[VES_MEASUREMENT_INTERVAL].c_str());
- }
-
- if (char *env_gnodeb = std::getenv("GNODEB")){
- theSettings[GNODEB].assign(env_gnodeb);
- mdclog_write(MDCLOG_INFO, "GNODEB file set to %s from environment variable", theSettings[GNODEB].c_str());
- }
-
-
}
void XappSettings::usage(char *command){
@@ -216,11 +140,5 @@
std::cout <<" --name[-n] xapp_instance_name "<< std::endl;
std::cout <<" --port[-p] port to listen on e.g tcp:4561 "<< std::endl;
std::cout << "--threads[-t] number of listener threads "<< std::endl ;
- std::cout << "--a1-schema[-a] a1 schema file location" << std::endl;
- std::cout << "--ves-schema[-v] ves schema file location" << std::endl;
- std::cout << "--samples [-s] samples file location with samples for all jsons" << std::endl;
- std::cout << "--ves-url [-u] ves collector url" << std::endl;
- std::cout << "--gNodeB[][-g] gNodeB" << std::endl;
- std::cout << "--interval[-i] measurement interval to send to ves collector (in seconds)" << std::endl;
- std::cout << "--opmode [-c] type of operatoring mode : either REPORT or CONTROL. In REPORT, does not send a control message back to gNodeB" << std::endl;
+
}
diff --git a/src/xapp-utils/xapp_config.hpp b/src/xapp-utils/xapp_config.hpp
index 389703e..ad9399e 100644
--- a/src/xapp-utils/xapp_config.hpp
+++ b/src/xapp-utils/xapp_config.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,23 +31,16 @@
#include <cstdlib>
#include <mdclog/mdclog.h>
-#define MAX_SLEEP 86400
-
-#define DEFAULT_A1_SCHEMA_FILE "/etc/xapp/a1-schema.json"
-#define DEFAULT_XAPP_ID "hw-xapp-123"
-#define DEFAULT_VES_SCHEMA_FILE "/etc/xapp/ves-schema.json"
-#define DEFAULT_VES_COLLECTOR_URL "127.0.0.1:6350"
-#define DEFAULT_VES_MEASUREMENT_INTERVAL 10
+#define DEFAULT_XAPP_NAME "HW-Xapp"
#define DEFAULT_PORT "4560"
-#define DEFAULT_BUFFER "1024"
-#define DEFAULT_GNODEB "GNB123"
-#define DEFAULT_OPERATING_MODE "report"
+#define DEFAULT_MSG_MAX_BUFFER "2072"
+#define DEFAULT_THREADS "1"
+
#define DEFAULT_LOG_LEVEL MDCLOG_WARN
-#define ASN_BUFF_MAX_SIZE 512
+#define ASN_BUFF_MAX_SIZE 4096
#define MAX_SUBSCRIPTION_ATTEMPTS 10
#define HELLOWORLD_POLICY_ID 00000
-#define DEFAULT_THREADS 1
using namespace std;
@@ -57,17 +50,10 @@
typedef enum{
XAPP_ID,
XAPP_NAME,
- HW_PORTS,
+ HW_PORT,
MSG_MAX_BUFFER,
- GNODEB,
THREADS,
- A1_SCHEMA_FILE,
- VES_SCHEMA_FILE,
- SAMPLE_FILE,
- VES_COLLECTOR_URL,
- VES_MEASUREMENT_INTERVAL,
- LOG_LEVEL,
- OPERATING_MODE
+ LOG_LEVEL
}SettingName;
void loadDefaultSettings();
diff --git a/src/xapp-utils/xapp_rmr.cc b/src/xapp-utils/xapp_rmr.cc
index d03de88..31cf774 100755
--- a/src/xapp-utils/xapp_rmr.cc
+++ b/src/xapp-utils/xapp_rmr.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -43,11 +43,11 @@
if (_xapp_rmr_ctx){
rmr_close(_xapp_rmr_ctx);
}
-
};
//Get RMR Context.
-void XappRmr::xapp_rmr_init(){
+void XappRmr::xapp_rmr_init(bool rmr_listen){
+
// Initialize the RMR context
_xapp_rmr_ctx = rmr_init(const_cast<char*>(_proto_port.c_str()), RMR_MAX_RCV_BYTES, RMRFL_NONE);
@@ -62,10 +62,22 @@
_rmr_is_ready = true;
mdclog_write(MDCLOG_INFO,"RMR Context is Ready, file= %s, line=%d",__FILE__,__LINE__);
+ //Set the listener requirement
+ _listen = rmr_listen;
return;
}
+bool XappRmr::rmr_header(xapp_rmr_header *hdr){
+
+ _xapp_send_buff->mtype = hdr->message_type;
+ _xapp_send_buff->len = hdr->payload_length;
+ _xapp_send_buff->sub_id = -1;
+ rmr_str2meid(_xapp_send_buff, hdr->meid);
+
+
+ return true;
+}
//RMR Send with payload and header.
bool XappRmr::xapp_rmr_send(xapp_rmr_header *hdr, void *payload){
@@ -84,7 +96,13 @@
if( _xapp_send_buff == NULL ) {
_xapp_send_buff = rmr_alloc_msg(_xapp_rmr_ctx, RMR_DEF_SIZE);
}
- _xapp_send_buff->mtype = hdr->message_type;
+
+ bool res = rmr_header(hdr);
+ if(!res){
+ mdclog_write(MDCLOG_ERR,"RMR HEADERS were incorrectly populated, file= %s, line=%d",__FILE__,__LINE__);
+ return false;
+ }
+
memcpy(_xapp_send_buff->payload, payload, hdr->payload_length);
_xapp_send_buff->len = hdr->payload_length;
@@ -94,8 +112,8 @@
}
while(rmr_attempts > 0){
- _xapp_send_buff = rmr_send_msg(_xapp_rmr_ctx,_xapp_send_buff);
+ _xapp_send_buff = rmr_send_msg(_xapp_rmr_ctx,_xapp_send_buff);
if(!_xapp_send_buff) {
mdclog_write(MDCLOG_ERR,"Error In Sending Message , file= %s, line=%d, attempt=%d",__FILE__,__LINE__,rmr_attempts);
rmr_attempts--;
diff --git a/src/xapp-utils/xapp_rmr.hpp b/src/xapp-utils/xapp_rmr.hpp
index ab3e77a..d2fabd2 100755
--- a/src/xapp-utils/xapp_rmr.hpp
+++ b/src/xapp-utils/xapp_rmr.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -51,9 +51,10 @@
int32_t message_type;
int32_t state;
int32_t payload_length;
- unsigned char xid[RMR_MAX_XID]; //space for user transaction id.
- unsigned char sid[RMR_MAX_SID]; //sender ID for return to sender needs.(ACKS required)
- unsigned char src[RMR_MAX_SRC]; //name of the sender (source)
+ unsigned char sid[RMR_MAX_SID]; //sender ID for return to sender needs.(ACKS required)[RMR_MAX_SID]
+ unsigned char src[RMR_MAX_SRC]; //name of the sender (source)[RMR_MAX_SRC]
+ unsigned char meid[RMR_MAX_MEID]={};
+
} xapp_rmr_header;
@@ -72,12 +73,16 @@
XappRmr(std::string, int rmrattempts=10);
~XappRmr(void);
- void xapp_rmr_init(void);
+ void xapp_rmr_init(bool);
template <class MessageProcessor>
void xapp_rmr_receive(MessageProcessor&&, XappRmr *parent);
+
+ template <class MessageProcessor>
+ void xapp_test_receiver(MessageProcessor&&, XappRmr *parent);
bool xapp_rmr_send(xapp_rmr_header*, void*);
+ bool rmr_header(xapp_rmr_header*);
void set_listen(bool);
bool get_listen(void);
int get_is_ready(void);
@@ -86,6 +91,7 @@
};
+
// main workhorse thread which does the listen->process->respond loop
template <class MsgHandler>
void XappRmr::xapp_rmr_receive(MsgHandler&& msgproc, XappRmr *parent){
@@ -117,7 +123,7 @@
mdclog_write(MDCLOG_INFO, "Listening at Thread: %s", thread_id.str().c_str());
this->_xapp_received_buff = rmr_rcv_msg( rmr_context, this->_xapp_received_buff );
-
+ //this->_xapp_received_buff = rmr_call( rmr_context, this->_xapp_received_buff);
if( this->_xapp_received_buff->mtype < 0 || this->_xapp_received_buff->state != RMR_OK ) {
mdclog_write(MDCLOG_ERR, "bad msg: state=%d errno=%d, file= %s, line=%d", this->_xapp_received_buff->state, errno, __FILE__,__LINE__ );
@@ -128,8 +134,9 @@
mdclog_write(MDCLOG_INFO,"RMR Received Message of Type: %d",this->_xapp_received_buff->mtype);
mdclog_write(MDCLOG_INFO,"RMR Received Message: %s",(char*)this->_xapp_received_buff->payload);
- //in case message handler returns true, need to resend the message.
+ //in case message handler returns true, need to resend the message.
msgproc(this->_xapp_received_buff, resend);
+
if(*resend){
//mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message of Type: %d",this->_xapp_received_buff->mtype);
//mdclog_write(MDCLOG_INFO,"RMR Return to Sender Message: %s",(char*)this->_xapp_received_buff->payload);
diff --git a/src/xapp-utils/xapp_sdl.cc b/src/xapp-utils/xapp_sdl.cc
index d74e584..d10dea2 100644
--- a/src/xapp-utils/xapp_sdl.cc
+++ b/src/xapp-utils/xapp_sdl.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/xapp-utils/xapp_sdl.hpp b/src/xapp-utils/xapp_sdl.hpp
index 470bb8d..b8e4e1a 100644
--- a/src/xapp-utils/xapp_sdl.hpp
+++ b/src/xapp-utils/xapp_sdl.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/xapp.cc b/src/xapp.cc
index c9cd5da..4fe395c 100644
--- a/src/xapp.cc
+++ b/src/xapp.cc
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -19,17 +19,29 @@
/*
* xapp.cc
*
- * Created on: Mar, 2020
+ * Mar, 2020 (Shraboni Jana)
*/
#include "xapp.hpp"
-Xapp::Xapp(XappSettings &config, XappRmr &rmr){
- rmr_ref = &rmr;
- config_ref = &config;
- xapp_mutex = NULL;
- return;
-}
+ Xapp::Xapp(XappSettings &config, XappRmr &rmr){
+
+ rmr_ref = &rmr;
+ config_ref = &config;
+ xapp_mutex = NULL;
+ subhandler_ref = NULL;
+ return;
+ }
+
+Xapp::Xapp(XappSettings &config, XappRmr &rmr, SubscriptionHandler &sub_ref){
+ rmr_ref = &rmr;
+ config_ref = &config;
+ xapp_mutex = NULL;
+ subhandler_ref = &sub_ref;
+ set_rnib_gnblist();
+
+ return;
+ };
Xapp::~Xapp(void){
@@ -47,43 +59,56 @@
}
};
-//stop the xapp.
+//Stop the xapp. Note- To be run only from unit test scripts.
void Xapp::stop(void){
// Get the mutex lock
std::lock_guard<std::mutex> guard(*xapp_mutex);
rmr_ref->set_listen(false);
rmr_ref->~XappRmr();
+ //Detaching the threads....not sure if this is the right way to stop the receiver threads.
+ //Hence function should be called only in Unit Tests
+ int threadcnt = xapp_rcv_thread.size();
+ for(int i=0; i<threadcnt; i++){
+ xapp_rcv_thread[i].detach();
+ }
+ sleep(10);
}
-void Xapp::init() {
-
- //get rnib information
- get_rnib_gnblist();
-
-
-}
void Xapp::startup() {
- //send subscriptions and read A1 policies.
+ //send subscriptions.
startup_subscribe_requests();
- //startup_get_policies();
+
+ //read A1 policies
+ startup_get_policies();
return;
}
+void Xapp::Run(){
+ rmr_ref->set_listen(true);
+ if(xapp_mutex == NULL){
+ xapp_mutex = new std::mutex();
+ }
+ std::lock_guard<std::mutex> guard(*xapp_mutex);
+ for(int j=0; j < _callbacks.size(); j++){
+ std::thread th_recv([&](){ rmr_ref->xapp_rmr_receive(std::move(_callbacks[j]), rmr_ref);});
+ xapp_rcv_thread.push_back(std::move(th_recv));
+ }
+
+ return;
+}
+//Starting a seperate single receiver
void Xapp::start_xapp_receiver(XappMsgHandler& mp_handler){
//start a receiver thread. Can be multiple receiver threads for more than 1 listening port.
rmr_ref->set_listen(true);
- xapp_mutex = new std::mutex();
+ if(xapp_mutex == NULL){
+ xapp_mutex = new std::mutex();
+ }
mdclog_write(MDCLOG_INFO,"Receiver Thread file= %s, line=%d",__FILE__,__LINE__);
- //std::unique_ptr<XappMsgHandler> mp_handler = std::make_unique<XappMsgHandler>();
- //auto mp_handler = _callbacks[0];
std::lock_guard<std::mutex> guard(*xapp_mutex);
std::thread th_recv([&](){ rmr_ref->xapp_rmr_receive(std::move(mp_handler), rmr_ref);});
-
xapp_rcv_thread.push_back(std::move(th_recv));
-
-
return;
@@ -97,31 +122,42 @@
void Xapp::startup_subscribe_requests(void ){
+
+ bool res;
size_t data_size = ASN_BUFF_MAX_SIZE;
unsigned char data[data_size];
+ unsigned char meid[RMR_MAX_MEID];
std::string xapp_id = config_ref->operator [](XappSettings::SettingName::XAPP_ID);
- for(auto &it: rnib_gnblist){
- int attempt = 0;
- XappMsgHandler msg = XappMsgHandler(xapp_id);
- //bool res_encode = msg.encode_subscription_request(data, &data_size);
- //if(!res_encode) exit(0);
- char *strMsg = "HelloWorld\0";
- strncpy((char *)data,strMsg,strlen(strMsg));
- data_size = sizeof(data);
+ mdclog_write(MDCLOG_INFO,"Sending subscription in file= %s, line=%d",__FILE__,__LINE__);
+
+ auto gnblist = get_rnib_gnblist();
+ int sz = gnblist.size();
+
+ for(int i = 0; i<sz; i++){
+
+ //give the message to subscription handler, along with the transmitter.
+ strcpy((char*)meid,gnblist[i].c_str());
+
+ char *strMsg = "Subscription Request from HelloWorld XApp\0";
+ strncpy((char *)data,strMsg,strlen(strMsg));
+ data_size = strlen(strMsg);
xapp_rmr_header rmr_header;
- rmr_header.message_type = RIC_SUB_RESP;
+ rmr_header.message_type = RIC_SUB_REQ;
rmr_header.payload_length = data_size;
- while(1){
+ strcpy((char*)rmr_header.meid,gnblist[i].c_str());
- auto transmitter = std::bind(&XappRmr::xapp_rmr_send,rmr_ref, &rmr_header, (void*)data);
- transmitter(); //this will go to subscription manager.
- //rmr_ref->xapp_rmr_call(&rmr_header,(char*)strMsg);
+ mdclog_write(MDCLOG_INFO,"Sending subscription in file= %s, line=%d for MEID %s",__FILE__,__LINE__, meid);
+ auto transmitter = std::bind(&XappRmr::xapp_rmr_send,rmr_ref, &rmr_header, (void*)data);
- break;
+ int res = subhandler_ref->manage_subscription_request(meid, transmitter);
+ if(res){
+ mdclog_write(MDCLOG_INFO,"Subscription SUCCESSFUL in file= %s, line=%d for MEID %s",__FILE__,__LINE__, meid);
+
}
}
+
}
void Xapp::startup_get_policies(void){
@@ -143,37 +179,51 @@
void Xapp::set_rnib_gnblist(void) {
openSdl();
+
void *result = getListGnbIds();
- if(result == NULL){
+ if(strlen((char*)result) < 1){
mdclog_write(MDCLOG_ERR, "ERROR: no data from getListGnbIds\n");
return;
}
mdclog_write(MDCLOG_INFO, "GNB List in R-NIB %s\n", (char*)result);
- Document doc;
- doc.Parse((char*)result);
- assert(doc.HasMember("gnb_list"));
+ Document doc;
+ ParseResult parseJson = doc.Parse((char*)result);
+ if (!parseJson) {
+ std::cerr << "JSON parse error: %s (%u)", GetParseErrorFunc(parseJson.Code());
+ return;
+ }
+
+ if(!doc.HasMember("gnb_list")){
+ mdclog_write(MDCLOG_INFO, "JSON Has No GNB List Object");
+ return;
+ }
+ assert(doc.HasMember("gnb_list"));
const Value& gnblist = doc["gnb_list"];
if (gnblist.IsNull())
- return;
+ return;
- assert(gnblist.IsArray());
+ if(!gnblist.IsArray()){
+ mdclog_write(MDCLOG_INFO, "GNB List is not an array");
+ return;
+ }
+
+ assert(gnblist.IsArray());
for (SizeType i = 0; i < gnblist.Size(); i++) // Uses SizeType instead of size_t
{
assert(gnblist[i].IsObject());
const Value& gnbobj = gnblist[i];
assert(gnbobj.HasMember("inventory_name"));
assert(gnbobj["inventory_name"].IsString());
- rnib_gnblist.push_back(gnbobj["inventory_name"].GetString());
+ std::string name = gnbobj["inventory_name"].GetString();
+ rnib_gnblist.push_back(name);
}
closeSdl();
-
- //delete result;
return;
}
diff --git a/src/xapp.hpp b/src/xapp.hpp
index 7f44c57..a769b43 100644
--- a/src/xapp.hpp
+++ b/src/xapp.hpp
@@ -1,7 +1,7 @@
/*
==================================================================================
- Copyright (c) 2018-2019 AT&T Intellectual Property.
+ Copyright (c) 2019-2020 AT&T Intellectual Property.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
*//*
* xapp.hpp
*
- * Modified: Mar, 2020 (Shraboni Jana)
+ * Mar, 2020 (Shraboni Jana)
*
*/
@@ -38,44 +38,46 @@
#include "xapp_sdl.hpp"
#include "rapidjson/writer.h"
#include "rapidjson/document.h"
+#include "rapidjson/error/error.h"
+
#include "msgs_proc.hpp"
#include "subs_mgmt.hpp"
#include "xapp_config.hpp"
extern "C" {
-#include "rnib/rnibreader_old.h"
+#include "rnib/rnibreader.h"
}
using namespace std;
using namespace std::placeholders;
using namespace rapidjson;
-using callback_type = std::function< void(rmr_mbuf_t*,bool*) > ;
class Xapp{
public:
Xapp(XappSettings &, XappRmr &);
+ Xapp(XappSettings &, XappRmr &, SubscriptionHandler &);
+
~Xapp(void);
+
void stop(void);
+
void startup();
void shutdown(void);
- void init(void);
+
void start_xapp_receiver(XappMsgHandler &);
+ void Run();
+
void sdl_data(void);
Xapp(Xapp const &)=delete;
Xapp& operator=(Xapp const &) = delete;
- template<typename FunctionObject>
- void register_handler(FunctionObject fn){
+ void register_handler(XappMsgHandler &fn){
_callbacks.emplace_back(fn);
}
- void callback_handler(){
-
- }
-
- void set_rnib_gnblist(void);
//getters/setters.
+ void set_rnib_gnblist(void);
std::vector<std::string> get_rnib_gnblist(){ return rnib_gnblist; }
private:
@@ -86,12 +88,12 @@
XappRmr * rmr_ref;
XappSettings * config_ref;
+ SubscriptionHandler *subhandler_ref;
std::mutex *xapp_mutex;
std::vector<std::thread> xapp_rcv_thread;
std::vector<std::string> rnib_gnblist;
-
- std::vector<callback_type> _callbacks;
+ std::vector<XappMsgHandler> _callbacks;
};
diff --git a/src/xapp_env.sh b/src/xapp_env.sh
new file mode 100755
index 0000000..64b2cd4
--- /dev/null
+++ b/src/xapp_env.sh
@@ -0,0 +1,14 @@
+#! /bin/bash
+
+export RMR_SEED_RT="routes.txt"
+export RMR_RTG_SVC="9999"
+export MSG_MAX_BUFFER="2072"
+export THREADS="1"
+export VERBOSE="0"
+export CONFIG_FILE="config/config-file.json"
+export XAPP_ID="3489-er492k-92389"
+export LOG_LEVEL="MDCLOG_ERR"
+export DBAAS_SERVICE_HOST="127.0.0.1"
+export DBAAS_SERVICE_PORT="6379"
+
+