X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fsrc%2Fbase%2Fe2sim.cpp;h=a0dc723829ad047176447b92db97beb34bc46c8e;hb=f86662b5b6481f27e18313a36355871f3a947193;hp=fa62bede560f06ba884bc919aa1eac46efd79041;hpb=50c32c08fb607bb7b1ac098f90c4b3a21eac169c;p=sim%2Fe2-interface.git diff --git a/e2sim/src/base/e2sim.cpp b/e2sim/src/base/e2sim.cpp old mode 100644 new mode 100755 index fa62bed..a0dc723 --- a/e2sim/src/base/e2sim.cpp +++ b/e2sim/src/base/e2sim.cpp @@ -1,6 +1,7 @@ /***************************************************************************** # * # 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. * @@ -28,11 +29,16 @@ #include "e2sim_sctp.hpp" #include "e2ap_message_handler.hpp" #include "encode_e2apv1.hpp" +#include "RANfunctionOID.h" using namespace std; int client_fd = 0; +std::unordered_map E2Sim::getRegistered_ran_functions() { + return ran_functions_registered; +} + void E2Sim::register_subscription_callback(long func_id, SubscriptionCallback cb) { fprintf(stderr,"%%%%about to register callback for subscription for func_id %d\n", func_id); subscription_callbacks[func_id] = cb; @@ -71,6 +77,7 @@ void E2Sim::encode_and_send_sctp_data(E2AP_PDU_t* pdu) 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); } @@ -132,6 +139,11 @@ int E2Sim::run_loop(int argc, char* argv[]){ printf("client_fd value is %d\n", client_fd); std::vector all_funcs; + RANfunctionOID_t *ranFunctionOIDe = (RANfunctionOID_t*)calloc(1,sizeof(RANfunctionOID_t)); + uint8_t *buf = (uint8_t*)"OID123"; + ranFunctionOIDe->buf = (uint8_t*)calloc(1,strlen((char*)buf)+1); + memcpy(ranFunctionOIDe->buf, buf, strlen((char*)buf)+1); + ranFunctionOIDe->size = strlen((char*)buf); //Loop through RAN function definitions that are registered @@ -142,12 +154,14 @@ int E2Sim::run_loop(int argc, char* argv[]){ next_func.ranFunctionId = elem.first; next_func.ranFunctionDesc = elem.second; next_func.ranFunctionRev = (long)2; + next_func.ranFunctionOId = ranFunctionOIDe; + all_funcs.push_back(next_func); } printf("about to call setup request encode\n"); - - generate_e2apv1_setup_request_parameterized(pdu_setup, all_funcs); + encoding::generate_e2apv2_config_update(pdu_setup); + // generate_e2apv1_setup_request_parameterized(pdu_setup, all_funcs); printf("After generating e2setup req\n"); @@ -160,8 +174,8 @@ int E2Sim::run_loop(int argc, char* argv[]){ sctp_buffer_t data; - char *error_buf = (char*)calloc(300, sizeof(char)); - size_t errlen; + char error_buf[300] = {0, }; + size_t errlen = 0; asn_check_constraints(&asn_DEF_E2AP_PDU, pdu_setup, error_buf, &errlen); printf("error length %d\n", errlen);