7 #include "encode_kpm.hpp"
11 void encode_kpm_function_description(E2SM_KPM_RANfunction_Description_t* ranfunc_desc) {
15 uint8_t *buf = (uint8_t*)"ORAN-E2SM-KPM";
16 uint8_t *buf2 = (uint8_t*)"KPM monitor";
17 uint8_t *buf3 = (uint8_t*)"OID123";
19 OCTET_STRING_t *sname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
20 sname->buf = (uint8_t*)calloc(1,13);
22 memcpy(sname->buf, buf, 13);
23 sname->size = strlen((char*)buf);
24 ranfunc_desc->ranFunction_Name.ranFunction_ShortName = *sname;
28 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
30 // ranfunc_desc->ranFunction_Name.ranFunction_Description = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
31 ranfunc_desc->ranFunction_Name.ranFunction_Description.buf = (uint8_t*)calloc(1,strlen((char*)buf2));
32 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_Description.buf, buf2, strlen((char*)buf2));
33 ranfunc_desc->ranFunction_Name.ranFunction_Description.size = strlen((char*)buf2);
34 ranfunc_desc->ranFunction_Name.ranFunction_Instance = &inst;
38 // ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
39 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf = (uint8_t*)calloc(1,strlen((char*)buf3));
40 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf, buf3, strlen((char*)buf3));
41 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.size = strlen((char*)buf3);
46 RIC_EventTriggerStyle_List_t *trigger_style =
47 (RIC_EventTriggerStyle_List_t*)calloc(1, sizeof(RIC_EventTriggerStyle_List_t));
48 trigger_style->ric_EventTriggerStyle_Type = 1;
49 uint8_t *buf4 = (uint8_t*)"Periodic report";
50 // trigger_style->ric_EventTriggerStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
51 trigger_style->ric_EventTriggerStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf4));
52 memcpy(trigger_style->ric_EventTriggerStyle_Name.buf, buf4, strlen((char*)buf4));
53 trigger_style->ric_EventTriggerStyle_Name.size = strlen((char*)buf4);
54 trigger_style->ric_EventTriggerFormat_Type = 5;
58 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List =
59 (E2SM_KPM_RANfunction_Description::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_EventTriggerStyle_List*)calloc(1,sizeof(E2SM_KPM_RANfunction_Description::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_EventTriggerStyle_List));
61 int ret = ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List->list , trigger_style);
62 printf("ret is %d\n", ret);
64 RIC_ReportStyle_List_t *report_style1 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
65 report_style1->ric_ReportStyle_Type = 1;
67 uint8_t *buf5 = (uint8_t*)"O-DU Measurement Container for the 5GC connected deployment";
71 // report_style1->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
72 report_style1->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf5));
73 memcpy(report_style1->ric_ReportStyle_Name.buf, buf5, strlen((char*)buf5));
74 report_style1->ric_ReportStyle_Name.size = strlen((char*)buf5);
75 report_style1->ric_IndicationHeaderFormat_Type = 1;
76 report_style1->ric_IndicationMessageFormat_Type = 1;
80 RIC_ReportStyle_List_t *report_style2 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
81 report_style2->ric_ReportStyle_Type = 2;
83 uint8_t *buf6 = (uint8_t*)"O-DU Measurement Container for the EPC connected deployment";
85 // report_style2->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
88 report_style2->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf6));
89 memcpy(report_style2->ric_ReportStyle_Name.buf, buf6, strlen((char*)buf6));
90 report_style2->ric_ReportStyle_Name.size = strlen((char*)buf6);
91 report_style2->ric_IndicationHeaderFormat_Type = 1;
92 report_style2->ric_IndicationMessageFormat_Type = 1;
96 RIC_ReportStyle_List_t *report_style3 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
97 report_style3->ric_ReportStyle_Type = 3;
99 uint8_t *buf7 = (uint8_t*)"O-CU-CP Measurement Container for the 5GC connected deployment";
101 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
102 report_style3->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf7));
103 memcpy(report_style3->ric_ReportStyle_Name.buf, buf7, strlen((char*)buf7));
104 report_style3->ric_ReportStyle_Name.size = strlen((char*)buf7);
105 report_style3->ric_IndicationHeaderFormat_Type = 1;
106 report_style3->ric_IndicationMessageFormat_Type = 1;
108 RIC_ReportStyle_List_t *report_style4 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
109 report_style4->ric_ReportStyle_Type = 4;
111 uint8_t *buf8 = (uint8_t*)"O-CU-CP Measurement Container for the EPC connected deployment";
113 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
114 report_style4->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf8));
115 memcpy(report_style4->ric_ReportStyle_Name.buf, buf8, strlen((char*)buf8));
116 report_style4->ric_ReportStyle_Name.size = strlen((char*)buf8);
117 report_style4->ric_IndicationHeaderFormat_Type = 1;
118 report_style4->ric_IndicationMessageFormat_Type = 1;
120 RIC_ReportStyle_List_t *report_style5 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
121 report_style5->ric_ReportStyle_Type = 5;
123 uint8_t *buf9 = (uint8_t*)"O-CU-UP Measurement Container for the 5GC connected deployment";
125 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
126 report_style5->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf9));
127 memcpy(report_style5->ric_ReportStyle_Name.buf, buf9, strlen((char*)buf9));
128 report_style5->ric_ReportStyle_Name.size = strlen((char*)buf9);
129 report_style5->ric_IndicationHeaderFormat_Type = 1;
130 report_style5->ric_IndicationMessageFormat_Type = 1;
133 RIC_ReportStyle_List_t *report_style6 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
134 report_style6->ric_ReportStyle_Type = 6;
136 uint8_t *buf10 = (uint8_t*)"O-CU-UP Measurement Container for the EPC connected deployment";
138 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
139 report_style6->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf10));
140 memcpy(report_style6->ric_ReportStyle_Name.buf, buf10, strlen((char*)buf10));
141 report_style6->ric_ReportStyle_Name.size = strlen((char*)buf10);
142 report_style6->ric_IndicationHeaderFormat_Type = 1;
143 report_style6->ric_IndicationMessageFormat_Type = 1;
146 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List =
147 (E2SM_KPM_RANfunction_Description::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_ReportStyle_List*)calloc(1,sizeof(E2SM_KPM_RANfunction_Description::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item::E2SM_KPM_RANfunction_Description__e2SM_KPM_RANfunction_Item__ric_ReportStyle_List));
149 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style1);
150 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style2);
151 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style3);
152 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style4);
153 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style5);
154 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style6);
156 xer_fprint(stderr, &asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
159 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco) {
161 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
162 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
163 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
164 ts->size = strlen((char*)buf);
165 memcpy(ts->buf,buf,ts->size);
169 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
170 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
172 uint8_t *buf2 = (uint8_t*)"747";
174 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
175 plmnidstr->buf = (uint8_t*)calloc(3,1);
177 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
181 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
182 uint8_t* buf3 = (uint8_t*)"12340";
183 nrcellid->buf = (uint8_t*)calloc(1,5);
184 memcpy(nrcellid->buf, buf3, 5);
186 nrcellid->bits_unused = 4;
188 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
189 nrcgi->pLMN_Identity = *plmnidstr;
190 nrcgi->nRCellIdentity = *nrcellid;
194 report_item->nRCGI = *nrcgi;
196 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
197 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
201 uint8_t* crnti_str = (uint8_t*)"1111";
202 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
203 crnti->buf = (uint8_t*)calloc(1,4);
207 crnti->size = strlen((char*)crnti_str);
210 memcpy(crnti->buf, crnti_str, crnti->size);
214 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
217 bytesdl->buf = (uint8_t*)calloc(1,1);
218 memcpy(bytesdl->buf, buffer,1);
221 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
224 bytesul->buf = (uint8_t*)calloc(1,1);
225 memcpy(bytesul->buf, buffer1, 1);
229 ue_report_item->c_RNTI = *crnti;
230 ue_report_item->pDCPBytesDL = bytesdl;
231 ue_report_item->pDCPBytesUL = bytesul;
234 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
236 ranco->timestamp = *ts;
237 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
238 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
240 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
244 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
246 uint8_t *nrcellid_buf,
248 const uint8_t *serving_buf,
249 const uint8_t *neighbor_buf) {
250 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
251 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
252 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
253 ts->size = strlen((char*)buf);
254 memcpy(ts->buf,buf,ts->size);
258 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
259 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
261 int plmnid_size = strlen((char*)plmnid_buf);
262 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
263 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
264 plmnidstr->size = plmnid_size;
265 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
269 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
271 int nrcellid_size = strlen((char*)nrcellid_buf);
272 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
273 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
275 nrcellid->bits_unused = 4;
277 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
278 nrcgi->pLMN_Identity = *plmnidstr;
279 nrcgi->nRCellIdentity = *nrcellid;
283 report_item->nRCGI = *nrcgi;
285 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
286 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
291 int crnti_size = strlen((char*)crnti_buf);
292 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
293 crnti->buf = (uint8_t*)calloc(1, crnti_size);
297 crnti->size = strlen((char*)crnti_buf);
300 memcpy(crnti->buf, crnti_buf, crnti->size);
302 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
304 int serving_buf_len = strlen((char*)serving_buf);
305 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
306 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
307 servingstr->size = serving_buf_len;
308 memcpy(servingstr->buf, serving_buf, servingstr->size);
311 int neighbor_buf_len = strlen((char*)neighbor_buf);
312 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
313 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
314 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
315 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
316 neighborstr->size = neighbor_buf_len;
317 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
319 ue_report_item->c_RNTI = *crnti;
320 ue_report_item->serving_Cell_RF_Type = servingstr;
321 ue_report_item->neighbor_Cell_RF = neighborstr;
324 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
326 ranco->timestamp = *ts;
327 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
328 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
330 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
335 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
337 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
338 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
339 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
340 ts->size = strlen((char*)buf);
341 memcpy(ts->buf,buf,ts->size);
345 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
346 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
348 uint8_t *buf2 = (uint8_t*)"747";
350 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
351 plmnidstr->buf = (uint8_t*)calloc(3,1);
353 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
357 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
358 uint8_t* buf3 = (uint8_t*)"12340";
359 nrcellid->buf = (uint8_t*)calloc(1,5);
360 memcpy(nrcellid->buf, buf3, 5);
362 nrcellid->bits_unused = 4;
364 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
365 nrcgi->pLMN_Identity = *plmnidstr;
366 nrcgi->nRCellIdentity = *nrcellid;
370 report_item->nRCGI = *nrcgi;
372 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
373 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
377 uint8_t* crnti_str = (uint8_t*)"1111";
378 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
379 crnti->buf = (uint8_t*)calloc(1,4);
383 crnti->size = strlen((char*)crnti_str);
386 memcpy(crnti->buf, crnti_str, crnti->size);
388 uint8_t *buf_serving = (uint8_t*)"RSRP10";
389 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
390 servingstr->buf = (uint8_t*)calloc(6,1);
391 servingstr->size = 6;
392 memcpy(servingstr->buf, buf_serving, servingstr->size);
394 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
395 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
396 neighborstr->buf = (uint8_t*)calloc(7,1);
397 neighborstr->size = 7;
398 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
400 ue_report_item->c_RNTI = *crnti;
401 ue_report_item->serving_Cell_RF_Type = servingstr;
402 ue_report_item->neighbor_Cell_RF = neighborstr;
405 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
407 ranco->timestamp = *ts;
408 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
409 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
411 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
416 void encode_kpm_odu_user_level(RAN_Container_t *ranco) {
418 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
419 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
420 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
421 ts->size = strlen((char*)buf);
422 memcpy(ts->buf,buf,ts->size);
426 DU_Usage_Report_CellResourceReportItem_t *report_item =
427 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
429 uint8_t *buf2 = (uint8_t*)"747";
431 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
432 plmnidstr->buf = (uint8_t*)calloc(3,1);
434 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
438 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
439 uint8_t* buf3 = (uint8_t*)"12340";
440 nrcellid->buf = (uint8_t*)calloc(1,5);
441 memcpy(nrcellid->buf, buf3, 5);
443 nrcellid->bits_unused = 4;
445 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
446 nrcgi->pLMN_Identity = *plmnidstr;
447 nrcgi->nRCellIdentity = *nrcellid;
451 report_item->nRCGI = *nrcgi;
455 DU_Usage_Report_UeResourceReportItem *ue_report_item =
456 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
460 uint8_t* crnti_str = (uint8_t*)"1111";
461 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
462 crnti->buf = (uint8_t*)calloc(1,4);
466 crnti->size = strlen((char*)crnti_str);
469 memcpy(crnti->buf, crnti_str, crnti->size);
476 ue_report_item->c_RNTI = *crnti;
477 ue_report_item->dl_PRBUsage = &lval1;
481 ue_report_item->ul_PRBUsage = &lval2;
485 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
488 ranco->timestamp = *ts;
489 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
490 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
492 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
497 void encode_kpm_report_rancontainer_du(E2SM_KPM_IndicationMessage_t* indicationmessage) {
499 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
500 encode_kpm_odu_user_level(ranco);
502 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
503 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
504 containers_list->theRANContainer = ranco;
506 E2SM_KPM_IndicationMessage_Format1_t *format =
507 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
508 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
510 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
512 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
514 indicationmessage->indicationMessage.present = pres;
516 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
518 char *error_buf = (char*)calloc(300, sizeof(char));
521 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
522 printf("error length %d\n", errlen);
523 printf("error buf %s\n", error_buf);
525 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
527 asn_codec_ctx_t *opt_cod;
529 uint8_t e2smbuffer[8192];
530 size_t e2smbuffer_size = 8192;
532 uint8_t e2smbuffer2[8192];
533 size_t e2smbuffer_size2 = 8192;
536 asn_encode_to_buffer(opt_cod,
537 ATS_ALIGNED_BASIC_PER,
538 &asn_DEF_E2SM_KPM_IndicationMessage,
539 indicationmessage, e2smbuffer, e2smbuffer_size);
541 fprintf(stderr, "er encded is %d\n", er.encoded);
542 fprintf(stderr, "after encoding message\n");
547 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
549 uint8_t *nrcellid_buf,
551 const uint8_t *serving_buf,
552 const uint8_t *neighbor_buf) {
554 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
555 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
556 nrcellid_buf, crnti_buf,
557 serving_buf, neighbor_buf);
559 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
560 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
561 containers_list->theRANContainer = ranco;
563 E2SM_KPM_IndicationMessage_Format1_t *format =
564 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
565 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
567 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
569 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
571 indicationmessage->indicationMessage.present = pres;
573 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
575 char *error_buf = (char*)calloc(300, sizeof(char));
578 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
579 printf("error length %d\n", errlen);
580 printf("error buf %s\n", error_buf);
582 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
584 asn_codec_ctx_t *opt_cod;
586 uint8_t e2smbuffer[8192];
587 size_t e2smbuffer_size = 8192;
589 uint8_t e2smbuffer2[8192];
590 size_t e2smbuffer_size2 = 8192;
593 asn_encode_to_buffer(opt_cod,
594 ATS_ALIGNED_BASIC_PER,
595 &asn_DEF_E2SM_KPM_IndicationMessage,
596 indicationmessage, e2smbuffer, e2smbuffer_size);
598 fprintf(stderr, "er encded is %d\n", er.encoded);
599 fprintf(stderr, "after encoding message\n");
604 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
606 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
607 encode_kpm_ocucp_user_level(ranco);
609 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
610 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
611 containers_list->theRANContainer = ranco;
613 E2SM_KPM_IndicationMessage_Format1_t *format =
614 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
615 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
617 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
619 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
621 indicationmessage->indicationMessage.present = pres;
623 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
625 char *error_buf = (char*)calloc(300, sizeof(char));
628 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
629 printf("error length %d\n", errlen);
630 printf("error buf %s\n", error_buf);
632 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
634 asn_codec_ctx_t *opt_cod;
636 uint8_t e2smbuffer[8192];
637 size_t e2smbuffer_size = 8192;
639 uint8_t e2smbuffer2[8192];
640 size_t e2smbuffer_size2 = 8192;
643 asn_encode_to_buffer(opt_cod,
644 ATS_ALIGNED_BASIC_PER,
645 &asn_DEF_E2SM_KPM_IndicationMessage,
646 indicationmessage, e2smbuffer, e2smbuffer_size);
648 fprintf(stderr, "er encded is %d\n", er.encoded);
649 fprintf(stderr, "after encoding message\n");
654 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
656 uint8_t *nrcellid_buf,
664 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
666 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
667 //encode_kpm_ocuup_user_level(ranco);
670 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
671 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
672 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
673 ts->size = strlen((char*)buf);
674 memcpy(ts->buf,buf,ts->size);
678 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
679 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
681 uint8_t *buf2 = (uint8_t*)"747";
683 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
684 plmnidstr->buf = (uint8_t*)calloc(3,1);
686 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
690 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
691 uint8_t* buf3 = (uint8_t*)"12340";
692 nrcellid->buf = (uint8_t*)calloc(1,5);
693 memcpy(nrcellid->buf, buf3, 5);
695 nrcellid->bits_unused = 4;
697 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
698 nrcgi->pLMN_Identity = *plmnidstr;
699 nrcgi->nRCellIdentity = *nrcellid;
703 report_item->nRCGI = *nrcgi;
705 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
706 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
710 uint8_t* crnti_str = (uint8_t*)"1111";
711 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
712 crnti->buf = (uint8_t*)calloc(1,4);
716 crnti->size = strlen((char*)crnti_str);
719 memcpy(crnti->buf, crnti_str, crnti->size);
721 uint8_t *buf_serving = (uint8_t*)"RSRP10";
722 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
723 servingstr->buf = (uint8_t*)calloc(6,1);
724 servingstr->size = 6;
725 memcpy(servingstr->buf, buf_serving, servingstr->size);
727 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
728 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
729 neighborstr->buf = (uint8_t*)calloc(7,1);
730 neighborstr->size = 7;
731 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
733 ue_report_item->c_RNTI = *crnti;
734 ue_report_item->serving_Cell_RF_Type = servingstr;
735 ue_report_item->neighbor_Cell_RF = neighborstr;
738 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
740 ranco->timestamp = *ts;
741 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
742 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
744 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
747 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
748 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
749 containers_list->theRANContainer = ranco;
751 E2SM_KPM_IndicationMessage_Format1_t *format =
752 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
753 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
755 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
757 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
759 indicationmessage->indicationMessage.present = pres;
761 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
763 char *error_buf = (char*)calloc(300, sizeof(char));
766 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
767 printf("error length %d\n", errlen);
768 printf("error buf %s\n", error_buf);
770 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
772 asn_codec_ctx_t *opt_cod;
774 uint8_t e2smbuffer[8192];
775 size_t e2smbuffer_size = 8192;
777 uint8_t e2smbuffer2[8192];
778 size_t e2smbuffer_size2 = 8192;
781 asn_encode_to_buffer(opt_cod,
782 ATS_ALIGNED_BASIC_PER,
783 &asn_DEF_E2SM_KPM_IndicationMessage,
784 indicationmessage, e2smbuffer, e2smbuffer_size);
786 fprintf(stderr, "er encded is %d\n", er.encoded);
787 fprintf(stderr, "after encoding message\n");
792 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
799 uint8_t* nrcellid_buf,
804 asn_codec_ctx_t *opt_cod;
806 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
807 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
808 fqi_item->fiveQI = fiveqi;
809 fqi_item->dl_PRBUsage = &dl_prb_usage;
810 fqi_item->ul_PRBUsage = &ul_prb_usage;
812 uint8_t *buf1 = (uint8_t*)"4";
813 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
815 sst->buf = (uint8_t*)calloc(1,6);
816 memcpy(sst->buf,buf1,sst->size);
818 // std::string sd = "SD1";
819 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
820 // uint8_t *bufz = &sdvec[0];
821 uint8_t *bufz = (uint8_t*)"SD1";
822 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
824 sds->buf = (uint8_t*)calloc(1,3);
825 memcpy(sds->buf, bufz, sds->size);
828 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
829 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
830 snssai->sST.buf = (uint8_t*)calloc(1,1);
831 snssai->sST.size = 1;
832 memcpy(snssai->sST.buf, sst_buf, 1);
833 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
834 snssai->sD->buf = (uint8_t*)calloc(1,3);
835 snssai->sD->size = 3;
836 memcpy(snssai->sD->buf, sd_buf, 3);
839 SlicePerPlmnPerCellListItem_t *sliceitem =
840 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
841 sliceitem->sliceID = *snssai;
842 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
844 uint8_t *buf2 = (uint8_t*)"747";
846 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
847 plmnid->buf = (uint8_t*)calloc(3,1);
849 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
851 ServedPlmnPerCellListItem_t *percellitem1 =
852 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
853 percellitem1->pLMN_Identity = *plmnid;
854 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
855 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
857 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
858 plmnidstr->buf = (uint8_t*)calloc(3,1);
860 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
864 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
865 uint8_t* buf3 = (uint8_t*)"12340";
866 nrcellid->buf = (uint8_t*)calloc(1,5);
867 memcpy(nrcellid->buf, nrcellid_buf, 5);
869 nrcellid->bits_unused = 4;
871 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
872 nrcgi->pLMN_Identity = *plmnidstr;
873 nrcgi->nRCellIdentity = *nrcellid;
876 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
877 listitem1->nRCGI = *nrcgi;
878 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
879 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
880 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
883 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
884 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
885 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
887 PF_Container_PR pres1 = PF_Container_PR_oDU;
889 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
890 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
891 pfcontainer->present = pres1;
892 pfcontainer->choice.oDU = *ducont;
894 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
895 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
896 containers_list->performanceContainer = pfcontainer;
898 E2SM_KPM_IndicationMessage_Format1_t *format =
899 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
900 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
902 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
904 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
906 indicationmessage->indicationMessage.present = pres;
908 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
910 char *error_buf = (char*)calloc(300, sizeof(char));
913 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
914 printf("error length %d\n", errlen);
915 printf("error buf %s\n", error_buf);
917 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
920 uint8_t e2smbuffer[8192];
921 size_t e2smbuffer_size = 8192;
923 uint8_t e2smbuffer2[8192];
924 size_t e2smbuffer_size2 = 8192;
927 asn_encode_to_buffer(opt_cod,
928 ATS_ALIGNED_BASIC_PER,
929 &asn_DEF_E2SM_KPM_IndicationMessage,
930 indicationmessage, e2smbuffer, e2smbuffer_size);
932 fprintf(stderr, "er encded is %d\n", er.encoded);
933 fprintf(stderr, "after encoding message\n");
939 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
942 long dl_prb_usage = 50;
943 long ul_prb_usage = 70;
945 asn_codec_ctx_t *opt_cod;
947 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
948 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
949 fqi_item->fiveQI = fiveqi;
950 fqi_item->dl_PRBUsage = &dl_prb_usage;
951 fqi_item->ul_PRBUsage = &ul_prb_usage;
953 uint8_t *buf1 = (uint8_t*)"4";
954 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
956 sst->buf = (uint8_t*)calloc(1,6);
957 memcpy(sst->buf,buf1,sst->size);
959 // std::string sd = "SD1";
960 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
961 // uint8_t *bufz = &sdvec[0];
962 uint8_t *bufz = (uint8_t*)"SD1";
963 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
965 sds->buf = (uint8_t*)calloc(1,3);
966 memcpy(sds->buf, bufz, sds->size);
969 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
970 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
971 snssai->sST.buf = (uint8_t*)calloc(1,1);
972 snssai->sST.size = 1;
973 memcpy(snssai->sST.buf, buf1, 1);
974 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
975 snssai->sD->buf = (uint8_t*)calloc(1,3);
976 snssai->sD->size = 3;
977 memcpy(snssai->sD->buf, bufz, 3);
980 SlicePerPlmnPerCellListItem_t *sliceitem =
981 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
982 sliceitem->sliceID = *snssai;
983 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
985 uint8_t *buf2 = (uint8_t*)"747";
987 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
988 plmnid->buf = (uint8_t*)calloc(3,1);
990 memcpy(plmnid->buf, buf2, plmnid->size);
992 ServedPlmnPerCellListItem_t *percellitem1 =
993 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
994 percellitem1->pLMN_Identity = *plmnid;
995 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
996 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
998 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
999 plmnidstr->buf = (uint8_t*)calloc(3,1);
1000 plmnidstr->size = 3;
1001 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1005 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1006 uint8_t* buf3 = (uint8_t*)"12340";
1007 nrcellid->buf = (uint8_t*)calloc(1,5);
1008 memcpy(nrcellid->buf, buf3, 5);
1010 nrcellid->bits_unused = 4;
1012 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1013 nrcgi->pLMN_Identity = *plmnidstr;
1014 nrcgi->nRCellIdentity = *nrcellid;
1016 long dl_prbs = (long)100;
1017 long ul_prbs = (long)120;
1019 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1020 listitem1->nRCGI = *nrcgi;
1021 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1022 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1023 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1026 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1027 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1028 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1030 PF_Container_PR pres1 = PF_Container_PR_oDU;
1032 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1033 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1034 pfcontainer->present = pres1;
1035 pfcontainer->choice.oDU = *ducont;
1037 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1038 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1039 containers_list->performanceContainer = pfcontainer;
1041 E2SM_KPM_IndicationMessage_Format1_t *format =
1042 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1043 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1045 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1047 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1049 indicationmessage->indicationMessage.present = pres;
1051 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1053 char *error_buf = (char*)calloc(300, sizeof(char));
1056 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1057 printf("error length %d\n", errlen);
1058 printf("error buf %s\n", error_buf);
1060 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1063 uint8_t e2smbuffer[8192];
1064 size_t e2smbuffer_size = 8192;
1066 uint8_t e2smbuffer2[8192];
1067 size_t e2smbuffer_size2 = 8192;
1070 asn_encode_to_buffer(opt_cod,
1071 ATS_ALIGNED_BASIC_PER,
1072 &asn_DEF_E2SM_KPM_IndicationMessage,
1073 indicationmessage, e2smbuffer, e2smbuffer_size);
1075 fprintf(stderr, "er encded is %d\n", er.encoded);
1076 fprintf(stderr, "after encoding message\n");
1081 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1082 uint8_t *gnbcuupname_buf,
1087 uint8_t *plmnid_buf) {
1089 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1092 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1093 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1094 gnbcuupname->size = 8;
1095 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1096 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1099 //We need to convert bytes_dl into array of uint8_t
1103 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1105 if (bytes_dl <= 64) {
1108 uint8_t buffer[array_size_dl];
1109 buffer[0] = bytes_dl & 0xFF;
1110 bytesdl->buf = (uint8_t*)calloc(1,1);
1111 memcpy(bytesdl->buf,buffer,1);
1114 } else if (bytes_dl <= 16384) {
1117 uint8_t buffer[array_size_dl];
1118 buffer[0] = (bytes_dl >> 8) & 0xFF;
1119 buffer[1] = bytes_dl & 0xFF;
1120 bytesdl->buf = (uint8_t*)calloc(2,1);
1121 memcpy(bytesdl->buf,buffer,2);
1124 } else if (bytes_dl <= 4194304) {
1127 uint8_t buffer[array_size_dl];
1128 buffer[0] = (bytes_dl >> 16) & 0xFF;
1129 buffer[1] = (bytes_dl >> 8) & 0xFF;
1130 buffer[2] = bytes_dl & 0xFF;
1131 bytesdl->buf = (uint8_t*)calloc(3,1);
1132 memcpy(bytesdl->buf,buffer,3);
1135 } else if (bytes_dl <= 1073741824) {
1137 uint8_t buffer[array_size_dl];
1138 buffer[0] = (bytes_dl >> 24) & 0xFF;
1139 buffer[1] = (bytes_dl >> 16) & 0xFF;
1140 buffer[2] = (bytes_dl >> 8) & 0xFF;
1141 buffer[3] = bytes_dl & 0xFF;
1142 bytesdl->buf = (uint8_t*)calloc(4,1);
1143 memcpy(bytesdl->buf,buffer,4);
1148 //We need to convert bytes_ul into array of uint8_t
1149 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1153 if (bytes_ul <= 64) {
1156 uint8_t buffer[array_size_ul];
1157 buffer[0] = bytes_ul & 0xFF;
1158 bytesul->buf = (uint8_t*)calloc(1,1);
1159 memcpy(bytesul->buf,buffer,1);
1162 } else if (bytes_ul <= 16384) {
1165 uint8_t buffer[array_size_ul];
1166 buffer[0] = (bytes_ul >> 8) & 0xFF;
1167 buffer[1] = bytes_ul & 0xFF;
1168 bytesul->buf = (uint8_t*)calloc(2,1);
1169 memcpy(bytesul->buf,buffer,2);
1172 } else if (bytes_ul <= 4194304) {
1175 uint8_t buffer[array_size_ul];
1176 buffer[0] = (bytes_ul >> 16) & 0xFF;
1177 buffer[1] = (bytes_ul >> 8) & 0xFF;
1178 buffer[2] = bytes_ul & 0xFF;
1179 bytesul->buf = (uint8_t*)calloc(3,1);
1180 memcpy(bytesul->buf,buffer,3);
1183 } else if (bytes_ul <= 1073741824) {
1185 uint8_t buffer[array_size_ul];
1186 buffer[0] = (bytes_ul >> 24) & 0xFF;
1187 buffer[1] = (bytes_ul >> 16) & 0xFF;
1188 buffer[2] = (bytes_ul >> 8) & 0xFF;
1189 buffer[3] = bytes_ul & 0xFF;
1190 bytesul->buf = (uint8_t*)calloc(4,1);
1191 memcpy(bytesul->buf,buffer,4);
1196 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1197 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1198 fqilistitem->fiveQI = 9;
1199 fqilistitem->pDCPBytesDL = bytesdl;
1200 fqilistitem->pDCPBytesUL = bytesul;
1203 uint8_t *buf1 = (uint8_t*)"4";
1204 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1206 sst->buf = (uint8_t*)calloc(1,6);
1207 memcpy(sst->buf,sst_buf,sst->size);
1210 uint8_t *bufz = (uint8_t*)"SD1";
1211 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1213 sds->buf = (uint8_t*)calloc(1,3);
1214 memcpy(sds->buf, sd_buf, sds->size);
1217 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1218 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1219 snssai->sST.buf = (uint8_t*)calloc(1,1);
1220 snssai->sST.size = 1;
1221 memcpy(snssai->sST.buf, sst_buf, 1);
1222 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1223 snssai->sD->buf = (uint8_t*)calloc(1,3);
1224 snssai->sD->size = 3;
1225 memcpy(snssai->sD->buf, sd_buf, 3);
1229 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1230 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1231 slicelistitem->sliceID = *snssai;
1232 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1234 asn_codec_ctx_t *opt_cod;
1237 uint8_t e2smbuffera[8192];
1238 size_t e2smbuffer_sizea = 8192;
1242 asn_enc_rval_t era =
1243 asn_encode_to_buffer(opt_cod,
1244 ATS_ALIGNED_BASIC_PER,
1245 &asn_DEF_SliceToReportListItem,
1246 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1247 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1248 fprintf(stderr, "after encoding message\n");
1252 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1253 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1254 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1256 uint8_t *buf2 = (uint8_t*)"747";
1257 // std::string pl = "PLMNID7";
1258 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1259 // uint8_t *buf2 = &plvec[0];
1261 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1262 plmnid->buf = (uint8_t*)calloc(3,1);
1264 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1267 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1268 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1269 plmnidlist->pLMN_Identity = *plmnid;
1270 plmnidlist->cu_UP_PM_5GC = pm_format;
1272 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1273 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1274 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1279 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1280 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1281 listitem1->interface_type = 2;
1282 listitem1->o_CU_UP_PM_Container = *meas_cont;
1284 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1285 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1286 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1287 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1289 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1291 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1292 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1293 pfcontainer->present = pres1;
1294 pfcontainer->choice.oCU_UP = *cuupcont;
1296 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1297 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1298 containers_list->performanceContainer = pfcontainer;
1300 E2SM_KPM_IndicationMessage_Format1_t *format =
1301 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1302 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1304 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1306 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1308 indicationmessage->indicationMessage.present = pres;
1310 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1312 char *error_buf = (char*)calloc(300, sizeof(char));
1315 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1316 printf("error length %d\n", errlen);
1317 printf("error buf %s\n", error_buf);
1319 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1322 uint8_t e2smbuffer[8192];
1323 size_t e2smbuffer_size = 8192;
1325 uint8_t e2smbuffer2[8192];
1326 size_t e2smbuffer_size2 = 8192;
1329 asn_encode_to_buffer(opt_cod,
1330 ATS_ALIGNED_BASIC_PER,
1331 &asn_DEF_E2SM_KPM_IndicationMessage,
1332 indicationmessage, e2smbuffer, e2smbuffer_size);
1334 fprintf(stderr, "er encded is %d\n", er.encoded);
1335 fprintf(stderr, "after encoding message\n");
1340 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1342 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1345 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1346 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1347 gnbcuupname->size = 8;
1348 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1349 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1352 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1355 bytesdl->buf = (uint8_t*)calloc(1,1);
1356 memcpy(bytesdl->buf, buffer,1);
1359 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1362 bytesul->buf = (uint8_t*)calloc(1,1);
1363 memcpy(bytesul->buf, buffer1, 1);
1366 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1367 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1368 fqilistitem->fiveQI = 9;
1369 fqilistitem->pDCPBytesDL = bytesdl;
1370 fqilistitem->pDCPBytesUL = bytesul;
1373 uint8_t *buf1 = (uint8_t*)"4";
1374 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1376 sst->buf = (uint8_t*)calloc(1,6);
1377 memcpy(sst->buf,buf1,sst->size);
1380 uint8_t *bufz = (uint8_t*)"SD1";
1381 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1383 sds->buf = (uint8_t*)calloc(1,3);
1384 memcpy(sds->buf, bufz, sds->size);
1387 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1388 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1389 snssai->sST.buf = (uint8_t*)calloc(1,1);
1390 snssai->sST.size = 1;
1391 memcpy(snssai->sST.buf, buf1, 1);
1392 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1393 snssai->sD->buf = (uint8_t*)calloc(1,3);
1394 snssai->sD->size = 3;
1395 memcpy(snssai->sD->buf, bufz, 3);
1399 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1400 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1401 slicelistitem->sliceID = *snssai;
1402 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1404 asn_codec_ctx_t *opt_cod;
1407 uint8_t e2smbuffera[8192];
1408 size_t e2smbuffer_sizea = 8192;
1412 asn_enc_rval_t era =
1413 asn_encode_to_buffer(opt_cod,
1414 ATS_ALIGNED_BASIC_PER,
1415 &asn_DEF_SliceToReportListItem,
1416 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1417 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1418 fprintf(stderr, "after encoding message\n");
1422 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1423 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1424 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1426 uint8_t *buf2 = (uint8_t*)"747";
1427 // std::string pl = "PLMNID7";
1428 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1429 // uint8_t *buf2 = &plvec[0];
1431 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1432 plmnid->buf = (uint8_t*)calloc(3,1);
1434 memcpy(plmnid->buf, buf2, plmnid->size);
1437 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1438 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1439 plmnidlist->pLMN_Identity = *plmnid;
1440 plmnidlist->cu_UP_PM_5GC = pm_format;
1442 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1443 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1444 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1449 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1450 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1451 listitem1->interface_type = 2;
1452 listitem1->o_CU_UP_PM_Container = *meas_cont;
1454 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1455 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1456 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1457 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1459 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1461 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1462 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1463 pfcontainer->present = pres1;
1464 pfcontainer->choice.oCU_UP = *cuupcont;
1466 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1467 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1468 containers_list->performanceContainer = pfcontainer;
1470 E2SM_KPM_IndicationMessage_Format1_t *format =
1471 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1472 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1474 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1476 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1478 indicationmessage->indicationMessage.present = pres;
1480 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1482 char *error_buf = (char*)calloc(300, sizeof(char));
1485 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1486 printf("error length %d\n", errlen);
1487 printf("error buf %s\n", error_buf);
1489 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1492 uint8_t e2smbuffer[8192];
1493 size_t e2smbuffer_size = 8192;
1495 uint8_t e2smbuffer2[8192];
1496 size_t e2smbuffer_size2 = 8192;
1499 asn_encode_to_buffer(opt_cod,
1500 ATS_ALIGNED_BASIC_PER,
1501 &asn_DEF_E2SM_KPM_IndicationMessage,
1502 indicationmessage, e2smbuffer, e2smbuffer_size);
1504 fprintf(stderr, "er encded is %d\n", er.encoded);
1505 fprintf(stderr, "after encoding message\n");
1510 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1513 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1514 //std::string gn = "GNBCUUP5";
1515 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1516 //uint8_t *buf = &gnvec[0];
1517 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1518 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1519 gnbcuupname->size = 8;
1520 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1521 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1524 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1527 bytesdl->buf = (uint8_t*)calloc(1,1);
1528 memcpy(bytesdl->buf, buffer,1);
1531 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1534 bytesul->buf = (uint8_t*)calloc(1,1);
1535 memcpy(bytesul->buf, buffer1, 1);
1538 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1539 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1540 fqilistitem->fiveQI = 9;
1541 fqilistitem->pDCPBytesDL = bytesdl;
1542 fqilistitem->pDCPBytesUL = bytesul;
1546 // std::string sl = "SLICE4";
1547 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1548 // uint8_t *buf1 = &slvec[0];
1549 uint8_t *buf1 = (uint8_t*)"4";
1550 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1552 sst->buf = (uint8_t*)calloc(1,6);
1553 memcpy(sst->buf,buf1,sst->size);
1555 // std::string sd = "SD1";
1556 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1557 // uint8_t *bufz = &sdvec[0];
1558 uint8_t *bufz = (uint8_t*)"SD1";
1559 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1561 sds->buf = (uint8_t*)calloc(1,3);
1562 memcpy(sds->buf, bufz, sds->size);
1565 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1566 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1567 snssai->sST.buf = (uint8_t*)calloc(1,1);
1568 snssai->sST.size = 1;
1569 memcpy(snssai->sST.buf, buf1, 1);
1570 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1571 snssai->sD->buf = (uint8_t*)calloc(1,3);
1572 snssai->sD->size = 3;
1573 memcpy(snssai->sD->buf, bufz, 3);
1577 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1578 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1579 slicelistitem->sliceID = *snssai;
1580 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1582 asn_codec_ctx_t *opt_cod;
1585 uint8_t e2smbuffera[8192];
1586 size_t e2smbuffer_sizea = 8192;
1590 asn_enc_rval_t era =
1591 asn_encode_to_buffer(opt_cod,
1592 ATS_ALIGNED_BASIC_PER,
1593 &asn_DEF_SliceToReportListItem,
1594 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1595 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1596 fprintf(stderr, "after encoding message\n");
1600 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1601 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1602 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1604 uint8_t *buf2 = (uint8_t*)"747";
1605 // std::string pl = "PLMNID7";
1606 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1607 // uint8_t *buf2 = &plvec[0];
1609 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1610 plmnid->buf = (uint8_t*)calloc(3,1);
1612 memcpy(plmnid->buf, buf2, plmnid->size);
1615 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1616 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1617 plmnidlist->pLMN_Identity = *plmnid;
1618 plmnidlist->cu_UP_PM_5GC = pm_format;
1620 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1621 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1622 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1627 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1628 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1629 listitem1->interface_type = 2;
1630 listitem1->o_CU_UP_PM_Container = *meas_cont;
1632 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1633 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1634 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1635 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1637 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1639 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1640 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1641 pfcontainer->present = pres1;
1642 pfcontainer->choice.oCU_UP = *cuupcont;
1644 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1645 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1646 containers_list->performanceContainer = pfcontainer;
1648 E2SM_KPM_IndicationMessage_Format1_t *format =
1649 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1650 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1652 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1654 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1656 indicationmessage->present = pres;
1658 indicationmessage->choice.indicationMessage_Format1 = *format;
1660 char *error_buf = (char*)calloc(300, sizeof(char));
1663 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1664 printf("error length %d\n", errlen);
1665 printf("error buf %s\n", error_buf);
1667 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1670 uint8_t e2smbuffer[8192];
1671 size_t e2smbuffer_size = 8192;
1673 uint8_t e2smbuffer2[8192];
1674 size_t e2smbuffer_size2 = 8192;
1677 asn_encode_to_buffer(opt_cod,
1678 ATS_ALIGNED_BASIC_PER,
1679 &asn_DEF_E2SM_KPM_IndicationMessage,
1680 indicationmessage, e2smbuffer, e2smbuffer_size);
1682 fprintf(stderr, "er encded is %d\n", er.encoded);
1683 fprintf(stderr, "after encoding message\n");
1689 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1690 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1691 std::string gn = "GNBCUUP5";
1692 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1693 uint8_t *buf = &gnvec[0];
1694 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1695 gnbcuupname->size = 8;
1696 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1697 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1700 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1703 bytesdl->buf = (uint8_t*)calloc(1,1);
1704 memcpy(bytesdl->buf, buffer,1);
1707 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1710 bytesul->buf = (uint8_t*)calloc(1,1);
1711 memcpy(bytesul->buf, buffer1, 1);
1714 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1715 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1716 fqilistitem->fiveQI = 9;
1717 fqilistitem->pDCPBytesDL = bytesdl;
1718 fqilistitem->pDCPBytesUL = bytesul;
1722 std::string sl = "SLICE4";
1723 std::vector<uint8_t> slvec(sl.begin(), sl.end());
1724 // uint8_t *buf1 = &slvec[0];
1725 uint8_t *buf1 = (uint8_t*)"SLICE4";
1726 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1728 sst->buf = (uint8_t*)calloc(1,6);
1729 memcpy(sst->buf,buf1,sst->size);
1731 std::string sd = "SD1";
1732 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1733 // uint8_t *bufz = &sdvec[0];
1734 uint8_t *bufz = (uint8_t*)"SD1";
1735 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1737 sds->buf = (uint8_t*)calloc(1,3);
1738 memcpy(sds->buf, bufz, sds->size);
1741 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1742 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1743 snssai->sST.buf = (uint8_t*)calloc(6,1);
1744 snssai->sST.size = 6;
1745 memcpy(snssai->sST.buf, buf1, 6);
1746 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1747 snssai->sD->buf = (uint8_t*)calloc(1,3);
1748 snssai->sD->size = 3;
1749 memcpy(snssai->sD->buf, bufz, 3);
1753 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1754 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1755 slicelistitem->sliceID = *snssai;
1756 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1758 uint8_t e2smbuffera[8192];
1759 size_t e2smbuffer_sizea = 8192;
1762 asn_encode_to_buffer(nullptr,
1763 ATS_ALIGNED_BASIC_PER,
1764 &asn_DEF_SliceToReportListItem,
1765 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1766 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1767 fprintf(stderr, "after encoding message\n");
1769 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1770 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1771 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1773 std::string pl = "PLMNID7";
1774 std::vector<uint8_t> plvec(pl.begin(), pl.end());
1775 uint8_t *buf2 = &plvec[0];
1777 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1778 plmnid->buf = (uint8_t*)calloc(1,7);
1780 memcpy(plmnid->buf, buf2, plmnid->size);
1783 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1784 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1785 plmnidlist->pLMN_Identity = *plmnid;
1786 plmnidlist->cu_UP_PM_5GC = pm_format;
1788 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1789 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1790 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1795 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1796 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1797 listitem1->interface_type = 2;
1798 listitem1->o_CU_UP_PM_Container = *meas_cont;
1800 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1801 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1802 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1803 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1805 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1807 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1808 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1809 pfcontainer->present = pres1;
1810 pfcontainer->choice.oCU_UP = *cuupcont;
1812 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1813 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1814 containers_list->performanceContainer = pfcontainer;
1816 E2SM_KPM_IndicationMessage_Format1_t *format =
1817 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1818 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1820 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1822 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1824 indicationmessage->present = pres;
1826 indicationmessage->choice.indicationMessage_Format1 = *format;
1828 char *error_buf = (char*)calloc(300, sizeof(char));
1831 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1832 printf("error length %d\n", errlen);
1833 printf("error buf %s\n", error_buf);
1836 uint8_t e2smbuffer[8192];
1837 size_t e2smbuffer_size = 8192;
1839 uint8_t e2smbuffer2[8192];
1840 size_t e2smbuffer_size2 = 8192;
1843 asn_encode_to_buffer(nullptr,
1844 ATS_ALIGNED_BASIC_PER,
1845 &asn_DEF_E2SM_KPM_IndicationMessage,
1846 indicationmessage, e2smbuffer, e2smbuffer_size);
1848 fprintf(stderr, "er encded is %d\n", er.encoded);
1849 fprintf(stderr, "after encoding message\n");