/*****************************************************************************
# *
# Copyright 2020 AT&T Intellectual Property *
+# Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved. *
# *
# Licensed under the Apache License, Version 2.0 (the "License"); *
# you may not use this file except in compliance with the License. *
int client_fd = 0;
+std::unordered_map<long, OCTET_STRING_t*> E2Sim::getRegistered_ran_functions() {
+ return ran_functions_registered;
+}
+
void E2Sim::register_subscription_callback(long func_id, SubscriptionCallback cb) {
- printf("%%%%about to register callback for subscription for func_id %d\n", func_id);
+ fprintf(stderr,"%%%%about to register callback for subscription for func_id %d\n", func_id);
subscription_callbacks[func_id] = cb;
}
SubscriptionCallback E2Sim::get_subscription_callback(long func_id) {
- printf("%%%%we are getting the subscription callback for func id %d\n", func_id);
- SubscriptionCallback cb = subscription_callbacks[func_id];
+ fprintf(stderr, "%%%%we are getting the subscription callback for func id %d\n", func_id);
+ SubscriptionCallback cb;
+
+ try {
+ cb = subscription_callbacks.at(func_id);
+ } catch(const std::out_of_range& e) {
+ throw std::out_of_range("Function ID is not registered");
+ }
return cb;
}
data.len = e2ap_asn1c_encode_pdu(pdu, &buf);
memcpy(data.buffer, buf, min(data.len, MAX_SCTP_BUFFER));
+ if (buf) free(buf);
sctp_send_data(client_fd, data);
}
sctp_buffer_t data;
- char *error_buf = (char*)calloc(300, sizeof(char));
+ char error_buf[300] = {0, };
size_t errlen;
asn_check_constraints(&asn_DEF_E2AP_PDU, pdu_setup, error_buf, &errlen);