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
1100 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1103 bytesdl->buf = (uint8_t*)calloc(1,1);
1104 memcpy(bytesdl->buf, buffer,1);
1108 //We need to convert bytes_ul into array of uint8_t
1109 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1112 bytesul->buf = (uint8_t*)calloc(1,1);
1113 memcpy(bytesul->buf, buffer1, 1);
1116 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1117 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1118 fqilistitem->fiveQI = 9;
1119 fqilistitem->pDCPBytesDL = bytesdl;
1120 fqilistitem->pDCPBytesUL = bytesul;
1123 uint8_t *buf1 = (uint8_t*)"4";
1124 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1126 sst->buf = (uint8_t*)calloc(1,6);
1127 memcpy(sst->buf,sst_buf,sst->size);
1130 uint8_t *bufz = (uint8_t*)"SD1";
1131 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1133 sds->buf = (uint8_t*)calloc(1,3);
1134 memcpy(sds->buf, sd_buf, sds->size);
1137 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1138 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1139 snssai->sST.buf = (uint8_t*)calloc(1,1);
1140 snssai->sST.size = 1;
1141 memcpy(snssai->sST.buf, sst_buf, 1);
1142 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1143 snssai->sD->buf = (uint8_t*)calloc(1,3);
1144 snssai->sD->size = 3;
1145 memcpy(snssai->sD->buf, sd_buf, 3);
1149 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1150 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1151 slicelistitem->sliceID = *snssai;
1152 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1154 asn_codec_ctx_t *opt_cod;
1157 uint8_t e2smbuffera[8192];
1158 size_t e2smbuffer_sizea = 8192;
1162 asn_enc_rval_t era =
1163 asn_encode_to_buffer(opt_cod,
1164 ATS_ALIGNED_BASIC_PER,
1165 &asn_DEF_SliceToReportListItem,
1166 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1167 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1168 fprintf(stderr, "after encoding message\n");
1172 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1173 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1174 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1176 uint8_t *buf2 = (uint8_t*)"747";
1177 // std::string pl = "PLMNID7";
1178 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1179 // uint8_t *buf2 = &plvec[0];
1181 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1182 plmnid->buf = (uint8_t*)calloc(3,1);
1184 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1187 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1188 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1189 plmnidlist->pLMN_Identity = *plmnid;
1190 plmnidlist->cu_UP_PM_5GC = pm_format;
1192 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1193 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1194 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1199 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1200 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1201 listitem1->interface_type = 2;
1202 listitem1->o_CU_UP_PM_Container = *meas_cont;
1204 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1205 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1206 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1207 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1209 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1211 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1212 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1213 pfcontainer->present = pres1;
1214 pfcontainer->choice.oCU_UP = *cuupcont;
1216 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1217 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1218 containers_list->performanceContainer = pfcontainer;
1220 E2SM_KPM_IndicationMessage_Format1_t *format =
1221 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1222 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1224 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1226 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1228 indicationmessage->indicationMessage.present = pres;
1230 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1232 char *error_buf = (char*)calloc(300, sizeof(char));
1235 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1236 printf("error length %d\n", errlen);
1237 printf("error buf %s\n", error_buf);
1239 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1242 uint8_t e2smbuffer[8192];
1243 size_t e2smbuffer_size = 8192;
1245 uint8_t e2smbuffer2[8192];
1246 size_t e2smbuffer_size2 = 8192;
1249 asn_encode_to_buffer(opt_cod,
1250 ATS_ALIGNED_BASIC_PER,
1251 &asn_DEF_E2SM_KPM_IndicationMessage,
1252 indicationmessage, e2smbuffer, e2smbuffer_size);
1254 fprintf(stderr, "er encded is %d\n", er.encoded);
1255 fprintf(stderr, "after encoding message\n");
1260 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1262 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1265 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1266 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1267 gnbcuupname->size = 8;
1268 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1269 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1272 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1275 bytesdl->buf = (uint8_t*)calloc(1,1);
1276 memcpy(bytesdl->buf, buffer,1);
1279 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1282 bytesul->buf = (uint8_t*)calloc(1,1);
1283 memcpy(bytesul->buf, buffer1, 1);
1286 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1287 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1288 fqilistitem->fiveQI = 9;
1289 fqilistitem->pDCPBytesDL = bytesdl;
1290 fqilistitem->pDCPBytesUL = bytesul;
1293 uint8_t *buf1 = (uint8_t*)"4";
1294 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1296 sst->buf = (uint8_t*)calloc(1,6);
1297 memcpy(sst->buf,buf1,sst->size);
1300 uint8_t *bufz = (uint8_t*)"SD1";
1301 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1303 sds->buf = (uint8_t*)calloc(1,3);
1304 memcpy(sds->buf, bufz, sds->size);
1307 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1308 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1309 snssai->sST.buf = (uint8_t*)calloc(1,1);
1310 snssai->sST.size = 1;
1311 memcpy(snssai->sST.buf, buf1, 1);
1312 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1313 snssai->sD->buf = (uint8_t*)calloc(1,3);
1314 snssai->sD->size = 3;
1315 memcpy(snssai->sD->buf, bufz, 3);
1319 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1320 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1321 slicelistitem->sliceID = *snssai;
1322 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1324 asn_codec_ctx_t *opt_cod;
1327 uint8_t e2smbuffera[8192];
1328 size_t e2smbuffer_sizea = 8192;
1332 asn_enc_rval_t era =
1333 asn_encode_to_buffer(opt_cod,
1334 ATS_ALIGNED_BASIC_PER,
1335 &asn_DEF_SliceToReportListItem,
1336 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1337 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1338 fprintf(stderr, "after encoding message\n");
1342 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1343 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1344 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1346 uint8_t *buf2 = (uint8_t*)"747";
1347 // std::string pl = "PLMNID7";
1348 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1349 // uint8_t *buf2 = &plvec[0];
1351 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1352 plmnid->buf = (uint8_t*)calloc(3,1);
1354 memcpy(plmnid->buf, buf2, plmnid->size);
1357 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1358 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1359 plmnidlist->pLMN_Identity = *plmnid;
1360 plmnidlist->cu_UP_PM_5GC = pm_format;
1362 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1363 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1364 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1369 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1370 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1371 listitem1->interface_type = 2;
1372 listitem1->o_CU_UP_PM_Container = *meas_cont;
1374 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1375 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1376 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1377 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1379 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1381 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1382 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1383 pfcontainer->present = pres1;
1384 pfcontainer->choice.oCU_UP = *cuupcont;
1386 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1387 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1388 containers_list->performanceContainer = pfcontainer;
1390 E2SM_KPM_IndicationMessage_Format1_t *format =
1391 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1392 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1394 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1396 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1398 indicationmessage->indicationMessage.present = pres;
1400 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1402 char *error_buf = (char*)calloc(300, sizeof(char));
1405 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1406 printf("error length %d\n", errlen);
1407 printf("error buf %s\n", error_buf);
1409 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1412 uint8_t e2smbuffer[8192];
1413 size_t e2smbuffer_size = 8192;
1415 uint8_t e2smbuffer2[8192];
1416 size_t e2smbuffer_size2 = 8192;
1419 asn_encode_to_buffer(opt_cod,
1420 ATS_ALIGNED_BASIC_PER,
1421 &asn_DEF_E2SM_KPM_IndicationMessage,
1422 indicationmessage, e2smbuffer, e2smbuffer_size);
1424 fprintf(stderr, "er encded is %d\n", er.encoded);
1425 fprintf(stderr, "after encoding message\n");
1430 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1433 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1434 //std::string gn = "GNBCUUP5";
1435 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1436 //uint8_t *buf = &gnvec[0];
1437 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1438 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1439 gnbcuupname->size = 8;
1440 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1441 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1444 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1447 bytesdl->buf = (uint8_t*)calloc(1,1);
1448 memcpy(bytesdl->buf, buffer,1);
1451 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1454 bytesul->buf = (uint8_t*)calloc(1,1);
1455 memcpy(bytesul->buf, buffer1, 1);
1458 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1459 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1460 fqilistitem->fiveQI = 9;
1461 fqilistitem->pDCPBytesDL = bytesdl;
1462 fqilistitem->pDCPBytesUL = bytesul;
1466 // std::string sl = "SLICE4";
1467 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1468 // uint8_t *buf1 = &slvec[0];
1469 uint8_t *buf1 = (uint8_t*)"4";
1470 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1472 sst->buf = (uint8_t*)calloc(1,6);
1473 memcpy(sst->buf,buf1,sst->size);
1475 // std::string sd = "SD1";
1476 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1477 // uint8_t *bufz = &sdvec[0];
1478 uint8_t *bufz = (uint8_t*)"SD1";
1479 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1481 sds->buf = (uint8_t*)calloc(1,3);
1482 memcpy(sds->buf, bufz, sds->size);
1485 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1486 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1487 snssai->sST.buf = (uint8_t*)calloc(1,1);
1488 snssai->sST.size = 1;
1489 memcpy(snssai->sST.buf, buf1, 1);
1490 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1491 snssai->sD->buf = (uint8_t*)calloc(1,3);
1492 snssai->sD->size = 3;
1493 memcpy(snssai->sD->buf, bufz, 3);
1497 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1498 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1499 slicelistitem->sliceID = *snssai;
1500 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1502 asn_codec_ctx_t *opt_cod;
1505 uint8_t e2smbuffera[8192];
1506 size_t e2smbuffer_sizea = 8192;
1510 asn_enc_rval_t era =
1511 asn_encode_to_buffer(opt_cod,
1512 ATS_ALIGNED_BASIC_PER,
1513 &asn_DEF_SliceToReportListItem,
1514 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1515 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1516 fprintf(stderr, "after encoding message\n");
1520 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1521 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1522 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1524 uint8_t *buf2 = (uint8_t*)"747";
1525 // std::string pl = "PLMNID7";
1526 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1527 // uint8_t *buf2 = &plvec[0];
1529 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1530 plmnid->buf = (uint8_t*)calloc(3,1);
1532 memcpy(plmnid->buf, buf2, plmnid->size);
1535 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1536 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1537 plmnidlist->pLMN_Identity = *plmnid;
1538 plmnidlist->cu_UP_PM_5GC = pm_format;
1540 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1541 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1542 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1547 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1548 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1549 listitem1->interface_type = 2;
1550 listitem1->o_CU_UP_PM_Container = *meas_cont;
1552 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1553 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1554 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1555 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1557 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1559 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1560 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1561 pfcontainer->present = pres1;
1562 pfcontainer->choice.oCU_UP = *cuupcont;
1564 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1565 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1566 containers_list->performanceContainer = pfcontainer;
1568 E2SM_KPM_IndicationMessage_Format1_t *format =
1569 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1570 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1572 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1574 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1576 indicationmessage->present = pres;
1578 indicationmessage->choice.indicationMessage_Format1 = *format;
1580 char *error_buf = (char*)calloc(300, sizeof(char));
1583 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1584 printf("error length %d\n", errlen);
1585 printf("error buf %s\n", error_buf);
1587 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1590 uint8_t e2smbuffer[8192];
1591 size_t e2smbuffer_size = 8192;
1593 uint8_t e2smbuffer2[8192];
1594 size_t e2smbuffer_size2 = 8192;
1597 asn_encode_to_buffer(opt_cod,
1598 ATS_ALIGNED_BASIC_PER,
1599 &asn_DEF_E2SM_KPM_IndicationMessage,
1600 indicationmessage, e2smbuffer, e2smbuffer_size);
1602 fprintf(stderr, "er encded is %d\n", er.encoded);
1603 fprintf(stderr, "after encoding message\n");
1609 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1610 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1611 std::string gn = "GNBCUUP5";
1612 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1613 uint8_t *buf = &gnvec[0];
1614 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1615 gnbcuupname->size = 8;
1616 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1617 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1620 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1623 bytesdl->buf = (uint8_t*)calloc(1,1);
1624 memcpy(bytesdl->buf, buffer,1);
1627 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1630 bytesul->buf = (uint8_t*)calloc(1,1);
1631 memcpy(bytesul->buf, buffer1, 1);
1634 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1635 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1636 fqilistitem->fiveQI = 9;
1637 fqilistitem->pDCPBytesDL = bytesdl;
1638 fqilistitem->pDCPBytesUL = bytesul;
1642 std::string sl = "SLICE4";
1643 std::vector<uint8_t> slvec(sl.begin(), sl.end());
1644 // uint8_t *buf1 = &slvec[0];
1645 uint8_t *buf1 = (uint8_t*)"SLICE4";
1646 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1648 sst->buf = (uint8_t*)calloc(1,6);
1649 memcpy(sst->buf,buf1,sst->size);
1651 std::string sd = "SD1";
1652 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1653 // uint8_t *bufz = &sdvec[0];
1654 uint8_t *bufz = (uint8_t*)"SD1";
1655 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1657 sds->buf = (uint8_t*)calloc(1,3);
1658 memcpy(sds->buf, bufz, sds->size);
1661 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1662 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1663 snssai->sST.buf = (uint8_t*)calloc(6,1);
1664 snssai->sST.size = 6;
1665 memcpy(snssai->sST.buf, buf1, 6);
1666 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1667 snssai->sD->buf = (uint8_t*)calloc(1,3);
1668 snssai->sD->size = 3;
1669 memcpy(snssai->sD->buf, bufz, 3);
1673 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1674 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1675 slicelistitem->sliceID = *snssai;
1676 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1678 uint8_t e2smbuffera[8192];
1679 size_t e2smbuffer_sizea = 8192;
1682 asn_encode_to_buffer(nullptr,
1683 ATS_ALIGNED_BASIC_PER,
1684 &asn_DEF_SliceToReportListItem,
1685 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1686 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1687 fprintf(stderr, "after encoding message\n");
1689 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1690 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1691 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1693 std::string pl = "PLMNID7";
1694 std::vector<uint8_t> plvec(pl.begin(), pl.end());
1695 uint8_t *buf2 = &plvec[0];
1697 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1698 plmnid->buf = (uint8_t*)calloc(1,7);
1700 memcpy(plmnid->buf, buf2, plmnid->size);
1703 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1704 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1705 plmnidlist->pLMN_Identity = *plmnid;
1706 plmnidlist->cu_UP_PM_5GC = pm_format;
1708 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1709 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1710 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1715 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1716 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1717 listitem1->interface_type = 2;
1718 listitem1->o_CU_UP_PM_Container = *meas_cont;
1720 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1721 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1722 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1723 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1725 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1727 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1728 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1729 pfcontainer->present = pres1;
1730 pfcontainer->choice.oCU_UP = *cuupcont;
1732 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1733 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1734 containers_list->performanceContainer = pfcontainer;
1736 E2SM_KPM_IndicationMessage_Format1_t *format =
1737 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1738 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1740 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1742 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1744 indicationmessage->present = pres;
1746 indicationmessage->choice.indicationMessage_Format1 = *format;
1748 char *error_buf = (char*)calloc(300, sizeof(char));
1751 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1752 printf("error length %d\n", errlen);
1753 printf("error buf %s\n", error_buf);
1756 uint8_t e2smbuffer[8192];
1757 size_t e2smbuffer_size = 8192;
1759 uint8_t e2smbuffer2[8192];
1760 size_t e2smbuffer_size2 = 8192;
1763 asn_encode_to_buffer(nullptr,
1764 ATS_ALIGNED_BASIC_PER,
1765 &asn_DEF_E2SM_KPM_IndicationMessage,
1766 indicationmessage, e2smbuffer, e2smbuffer_size);
1768 fprintf(stderr, "er encded is %d\n", er.encoded);
1769 fprintf(stderr, "after encoding message\n");