X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fsrc%2Fmessagerouting%2Fe2ap_message_handler.cpp;h=7b712a7891320691f976e278086f42d6784294ba;hb=e85fb7a1b55499d2a450a628783cbd00eeb9f1e5;hp=ef21c13a6c519a5f757f68ebce1dc69cf63008ae;hpb=eb80dc1196968a4d34ece42dd1c2e1d31923dec8;p=sim%2Fe2-interface.git diff --git a/e2sim/src/messagerouting/e2ap_message_handler.cpp b/e2sim/src/messagerouting/e2ap_message_handler.cpp index ef21c13..7b712a7 100755 --- a/e2sim/src/messagerouting/e2ap_message_handler.cpp +++ b/e2sim/src/messagerouting/e2ap_message_handler.cpp @@ -46,13 +46,13 @@ void e2ap_handle_sctp_data(int& socket_fd, sctp_buffer_t& data, bool xmlenc, E2S break; } - int procedureCode = e2ap_asn1c_get_procedureCode(pdu); - int index = (int)pdu->present; - - LOG_D("Unpacked E2AP-PDU: index = %d, procedureCode = %d\n", index, procedureCode); - - switch (procedureCode) { - case ProcedureCode_id_E2setup: + int procedureCode = e2ap_asn1c_get_procedureCode(pdu); + int index = (int)pdu->present; + + LOG_D("Unpacked E2AP-PDU: index = %d, procedureCode = %d", index, procedureCode); + + switch (procedureCode) { + case ProcedureCode_id_E2setup: LOG_I("Received a message of E2 setup procedure"); switch (index) { case E2AP_PDU_PR_initiatingMessage: @@ -94,35 +94,26 @@ void e2ap_handle_sctp_data(int& socket_fd, sctp_buffer_t& data, bool xmlenc, E2S break; case ProcedureCode_id_RICsubscription: // RIC SUBSCRIPTION = 201 - LOG_I("Received a message of RIC subscription procedure"); - switch (index) { - case E2AP_PDU_PR_initiatingMessage: { // initiatingMessage - LOG_I("Received RIC-SUBSCRIPTION-REQUEST"); - // e2ap_handle_RICSubscriptionRequest(pdu, socket_fd); - long func_id = encoding::get_function_id_from_subscription(pdu); - fprintf(stderr, "Function Id of message is %d\n", func_id); - SubscriptionCallback cb; - - bool func_exists = true; - - try { - cb = e2sim->get_subscription_callback(func_id); - } catch (const std::out_of_range& e) { - func_exists = false; - } - - if (func_exists) { - fprintf(stderr, "Calling callback function\n"); - cb(pdu); - } else { - fprintf(stderr, "Error: No RAN Function with this ID exists\n"); - } - // callback_kpm_subscription_request(pdu, socket_fd); - - } break; - - case E2AP_PDU_PR_successfulOutcome: - LOG_I("Received RIC-SUBSCRIPTION-RESPONSE"); + LOG_I("Received a message of RIC subscription procedure"); + switch (index) { + case E2AP_PDU_PR_initiatingMessage: { // initiatingMessage + long func_id = encoding::get_function_id_from_subscription(pdu); + LOG_I("Received RIC subscription request for function with ID %d", func_id); + + try { + SubscriptionCallback cb; + cb = e2sim->get_subscription_callback(func_id); + LOG_I("Calling callback subscription function to handle subscription request to function with ID %d", func_id); + cb(pdu); + } catch (const std::out_of_range& e) { + LOG_E("No RAN Function with this ID exists\n"); + } + + break; + } + + case E2AP_PDU_PR_successfulOutcome: + LOG_I("Received RIC-SUBSCRIPTION-RESPONSE"); break; case E2AP_PDU_PR_unsuccessfulOutcome: