+
+E2setupRequest_t* smaller_e2ap_xml_to_pdu(char const* xml_message)
+{
+ // E2AP_PDU_t *pdu = new E2AP_PDU_t();
+ E2AP_PDU_t *pdu = calloc(1, sizeof(E2AP_PDU_t));
+
+ // GlobalE2node_ID_t *globale2nodeid = (GlobalE2node_ID_t*)calloc(1, sizeof(GlobalE2node_ID_t));
+ GlobalE2node_ID_t *globale2nodeid = (GlobalE2node_ID_t*)calloc(1, sizeof(GlobalE2node_ID_t));
+ E2setupRequest_t *e2setuprequest = (E2setupRequest_t*)calloc(1,sizeof(E2setupRequest_t));
+
+ printf("xmlpdu1\n");
+
+ uint8_t buf[MAX_XML_BUFFER];
+ asn_dec_rval_t rval;
+ size_t size;
+ FILE *f;
+
+ char XML_path[300];
+ char *work_dir = getenv(WORKDIR_ENV);
+
+ printf("xmlpdu2\n");
+
+ strcpy(XML_path, work_dir);
+ strcat(XML_path, E2AP_XML_DIR);
+ strcat(XML_path, xml_message);
+
+ printf("xmlpdu4\n");
+
+ LOG_D("Generate E2AP PDU from XML file: %s\n", XML_path);
+ memset(buf, 0, sizeof(buf));
+
+ printf("xmlpdu3\n");
+
+ f = fopen(XML_path, "r");
+ if(!f){
+ LOG_E("Unable to open %s. Make sure you have set the Environment Variable E2SIM_DIR, see README", XML_path)
+ }
+
+ printf("xmlpdu5\n");
+
+ assert(f);
+
+ printf("xmlpdu6\n");
+
+ size = fread(buf, 1, sizeof(buf), f);
+ if(size == 0 || size == sizeof(buf))
+ {
+ LOG_E("Input too long: %s", XML_path);
+ exit(1);
+ }
+
+ fclose(f);
+
+ printf("xmlpdu7\n");
+
+ rval = xer_decode(0, &asn_DEF_E2setupRequest, (void **)&e2setuprequest, buf, size);
+
+ printf("xmlpdu8\n");
+
+ assert(rval.code == RC_OK);
+
+ return e2setuprequest;
+}
+
+