X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fsrc%2Fmessagerouting%2Fe2ap_message_handler.cpp;h=0e23c8d6ca8ff0c7b1c07d35803b2dcc734b3bff;hp=3e8da635e12b5c23c2bcdfbe219e120807078397;hb=50c32c08fb607bb7b1ac098f90c4b3a21eac169c;hpb=a9733dbcc47e93a3b2843056f1d587196296c324 diff --git a/e2sim/src/messagerouting/e2ap_message_handler.cpp b/e2sim/src/messagerouting/e2ap_message_handler.cpp index 3e8da63..0e23c8d 100644 --- a/e2sim/src/messagerouting/e2ap_message_handler.cpp +++ b/e2sim/src/messagerouting/e2ap_message_handler.cpp @@ -115,8 +115,23 @@ void e2ap_handle_sctp_data(int &socket_fd, sctp_buffer_t &data, bool xmlenc, E2S LOG_I("[E2AP] Received RIC-SUBSCRIPTION-REQUEST"); // e2ap_handle_RICSubscriptionRequest(pdu, socket_fd); long func_id = encoding::get_function_id_from_subscription(pdu); - SubscriptionCallback cb = e2sim->get_subscription_callback(func_id); - cb(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); }