X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fsrc%2Fbase%2Fe2sim.hpp;fp=e2sim%2Fsrc%2Fbase%2Fe2sim.hpp;h=16015eac31faea549754ac8da40642e44109e040;hb=a9733dbcc47e93a3b2843056f1d587196296c324;hp=0000000000000000000000000000000000000000;hpb=3ebf932d23dcbec9ed19f4a51f9d00a0a54f5124;p=sim%2Fe2-interface.git diff --git a/e2sim/src/base/e2sim.hpp b/e2sim/src/base/e2sim.hpp new file mode 100644 index 0000000..16015ea --- /dev/null +++ b/e2sim/src/base/e2sim.hpp @@ -0,0 +1,59 @@ +/***************************************************************************** +# * +# Copyright 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. * +# * +******************************************************************************/ + +#ifndef E2SIM_HPP +#define E2SIM_HPP + +#include + +extern "C" { +#include "E2AP-PDU.h" +#include "OCTET_STRING.h" +} + +typedef void (*SubscriptionCallback)(E2AP_PDU_t*); + +class E2Sim; +class E2Sim { + +private: + + std::unordered_map ran_functions_registered; + std::unordered_map subscription_callbacks; + + void wait_for_sctp_data(); + +public: + + void generate_e2apv1_subscription_response_success(E2AP_PDU *e2ap_pdu, long reqActionIdsAccepted[], long reqActionIdsRejected[], int accept_size, int reject_size, long reqRequestorId, long reqInstanceId); + + void generate_e2apv1_indication_request_parameterized(E2AP_PDU *e2ap_pdu, long requestorId, long instanceId, long ranFunctionId, long actionId, long seqNum, uint8_t *ind_header_buf, int header_length, uint8_t *ind_message_buf, int message_length); + + SubscriptionCallback get_subscription_callback(long func_id); + + void register_e2sm(long func_id, OCTET_STRING_t* ostr); + + void register_subscription_callback(long func_id, SubscriptionCallback cb); + + void encode_and_send_sctp_data(E2AP_PDU_t* pdu); + + int run_loop(int argc, char* argv[]); + +}; + +#endif