X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fprevious%2Fe2apv1sim%2Fricsim%2Fsrc%2FX2AP%2Fx2ap_generate_messages.c;fp=e2sim%2Fprevious%2Fe2apv1sim%2Fricsim%2Fsrc%2FX2AP%2Fx2ap_generate_messages.c;h=0000000000000000000000000000000000000000;hp=db12a3e10b87a3e0924eb1ec7a08c2f1b95befe0;hb=f86662b5b6481f27e18313a36355871f3a947193;hpb=a9f02a2b5886990fd81e64f7c218c5d4844f18a3 diff --git a/e2sim/previous/e2apv1sim/ricsim/src/X2AP/x2ap_generate_messages.c b/e2sim/previous/e2apv1sim/ricsim/src/X2AP/x2ap_generate_messages.c deleted file mode 100644 index db12a3e..0000000 --- a/e2sim/previous/e2apv1sim/ricsim/src/X2AP/x2ap_generate_messages.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * - * Copyright 2019 AT&T Intellectual Property - * Copyright 2019 Nokia - * - * 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. - * - */ - -#include -#include -#include -#include -#include -#include "x2ap_generate_messages.h" -#include "x2ap_asn_codec.h" -#include "e2sim_defs.h" - -int asn1_xer_print = 0; -int MAX_XML_BUFFER = 10000; - -void x2ap_fetch_pdu_from_XML(X2AP_PDU_t **pdu, char *filename) -{ - - uint8_t buf[MAX_XML_BUFFER]; - - asn_dec_rval_t rval; - size_t size; - FILE *f; - - char XML_path[200]; - char *work_dir = getenv(WORKDIR_ENV); - - strcpy(XML_path, work_dir); - strcat(XML_path, "/src/X2AP/MESSAGES/XML/"); - strcat(XML_path, filename); - - //printf("Generate X2AP PDU from XML file: %s\n", XML_path); - - f = fopen(XML_path, "r"); - assert(f); - size = fread(buf, 1, sizeof(buf), f); - if(size == 0 || size == sizeof(buf)) - { - fprintf(stderr, "%s: Too large input\n", XML_path); - exit(1); - } - - fclose(f); - - //printf("Decode the XER buffer\n"); - rval = xer_decode(NULL, &asn_DEF_X2AP_PDU, (void **)pdu, buf, size); - assert(rval.code == RC_OK); - -} - -uint32_t x2ap_generate_x2_setup_request(uint8_t **buffer) -{ - X2AP_PDU_t *pdu; - pdu = (X2AP_PDU_t *)calloc(1, sizeof(X2AP_PDU_t)); - - uint32_t len; - - char *XML_file = "sample_x2_setup_request.xml"; - - x2ap_fetch_pdu_from_XML(&pdu, XML_file); - - if(asn1_xer_print) - xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)pdu); - - if(X2AP_ASN_encode(pdu, buffer, &len) < 0) - { - fprintf(stderr, "Failed to APER encode X2 Setup Request\n"); - return -1; - } - - return len; - -} - -uint32_t x2ap_generate_x2_setup_response(uint8_t **buffer) -{ - X2AP_PDU_t *pdu; - pdu = (X2AP_PDU_t *)calloc(1, sizeof(X2AP_PDU_t)); - - uint32_t len; - - char *XML_file = "sample_x2_setup_response.xml"; - - x2ap_fetch_pdu_from_XML(&pdu, XML_file); - - if(asn1_xer_print) - xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)pdu); - - if(X2AP_ASN_encode(pdu, buffer, &len) < 0) - { - fprintf(stderr, "Failed to APER encode X2 Setup Request\n"); - return -1; - } - - return len; - -}