X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fsrc%2Fencoding%2Fencode_e2apv1.cpp;h=1416e5e1ceb040d3a74df416e029f860295b99f0;hb=3dacb077c9e7d0c998bb9a76804c95aced032b80;hp=d1c2c06a8bb92758f490ea1b958325d24b527b93;hpb=50c32c08fb607bb7b1ac098f90c4b3a21eac169c;p=sim%2Fe2-interface.git diff --git a/e2sim/src/encoding/encode_e2apv1.cpp b/e2sim/src/encoding/encode_e2apv1.cpp old mode 100644 new mode 100755 index d1c2c06..1416e5e --- a/e2sim/src/encoding/encode_e2apv1.cpp +++ b/e2sim/src/encoding/encode_e2apv1.cpp @@ -3,6 +3,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. * @@ -59,7 +60,6 @@ long encoding::get_function_id_from_subscription(E2AP_PDU_t *e2ap_pdu) { RICsubscriptionRequest_t orig_req = e2ap_pdu->choice.initiatingMessage->value.choice.RICsubscriptionRequest; - RICsubscriptionResponse_IEs_t *ricreqid = (RICsubscriptionResponse_IEs_t*)calloc(1, sizeof(RICsubscriptionResponse_IEs_t)); @@ -95,6 +95,66 @@ long encoding::get_function_id_from_subscription(E2AP_PDU_t *e2ap_pdu) { } +void encoding::generate_e2apv1_service_update(E2AP_PDU_t *e2ap_pdu, std::vector all_funcs) { + char* ran_function_op_type = getenv("RAN_FUNCTION_OP_TYPE"); + LOG_D("Ran funciton : %s", ran_function_op_type); + ProtocolIE_ID_t prID; + if (ran_function_op_type != NULL) + { + if (strcmp(ran_function_op_type, "ADD") == 0) + { + prID = ProtocolIE_ID_id_RANfunctionsAdded; + } + else if (strcmp(ran_function_op_type, "DELETE")) + { + prID = ProtocolIE_ID_id_RANfunctionsDeleted; + } + } + else + { + prID = ProtocolIE_ID_id_RANfunctionsModified; + } + + + RICserviceUpdate_IEs_t *e2serviceUpdateList = (RICserviceUpdate_IEs_t *)calloc(1, sizeof(RICserviceUpdate_IEs_t)); + e2serviceUpdateList->id = prID; + e2serviceUpdateList->criticality = Criticality_reject; + e2serviceUpdateList->value.present = RICserviceUpdate_IEs__value_PR_RANfunctions_List; + + + for (int i=0; iid = ProtocolIE_ID_id_RANfunction_Item; + itemIes->criticality = Criticality_reject; + itemIes->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item; + itemIes->value.choice.RANfunction_Item.ranFunctionID = 1; + + itemIes->value.choice.RANfunction_Item.ranFunctionDefinition = *nextRanFuncDesc; + itemIes->value.choice.RANfunction_Item.ranFunctionRevision = nextRanFuncRev + 1; + + ASN_SEQUENCE_ADD(&e2serviceUpdateList->value.choice.RANfunctions_List.list, itemIes); + } + + RICserviceUpdate_t *ricServiceUpdate = (RICserviceUpdate_t *)calloc(1, sizeof(RICserviceUpdate_t)); + ASN_SEQUENCE_ADD(&ricServiceUpdate->protocolIEs.list, e2serviceUpdateList); + + InitiatingMessage_t *initiatingMessage = (InitiatingMessage_t *)calloc(1, sizeof(InitiatingMessage_t)); + initiatingMessage->criticality = Criticality_reject; + initiatingMessage->procedureCode = ProcedureCode_id_RICserviceUpdate; + initiatingMessage->value.present = InitiatingMessage__value_PR_RICserviceUpdate; + initiatingMessage->value.choice.RICserviceUpdate = *ricServiceUpdate; + + E2AP_PDU_PR pres6 = E2AP_PDU_PR_initiatingMessage; + e2ap_pdu->present = pres6; + e2ap_pdu->choice.initiatingMessage = initiatingMessage; +} + void encoding::generate_e2apv1_setup_request_parameterized(E2AP_PDU_t *e2ap_pdu, std::vector all_funcs) { // long ranFunctionId, uint8_t *ranFuncDescEncoded, int ranFuncLength) { @@ -349,7 +409,7 @@ void encoding::generate_e2apv1_subscription_request(E2AP_PDU *e2ap_pdu) { e2ap_pdu->present = pres5; e2ap_pdu->choice.initiatingMessage = initmsg; - char *error_buf = (char*)calloc(300, sizeof(char));; + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen); @@ -460,7 +520,7 @@ void encoding::generate_e2apv1_subscription_response_success(E2AP_PDU *e2ap_pdu, e2ap_pdu->present = pres5; e2ap_pdu->choice.successfulOutcome = successoutcome; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen); @@ -615,7 +675,7 @@ void encoding::generate_e2apv1_subscription_response(E2AP_PDU *e2ap_pdu, E2AP_PD e2ap_pdu->present = pres5; e2ap_pdu->choice.successfulOutcome = successoutcome; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen); @@ -790,8 +850,7 @@ void encoding::generate_e2apv1_indication_request_parameterized(E2AP_PDU *e2ap_p e2ap_pdu->present = pres5; e2ap_pdu->choice.initiatingMessage = initmsg; - - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2AP_PDU, e2ap_pdu, error_buf, &errlen);