1 /*****************************************************************************
3 # Copyright 2020 AT&T Intellectual Property *
5 # Licensed under the Apache License, Version 2.0 (the "License"); *
6 # you may not use this file except in compliance with the License. *
7 # You may obtain a copy of the License at *
9 # http://www.apache.org/licenses/LICENSE-2.0 *
11 # Unless required by applicable law or agreed to in writing, software *
12 # distributed under the License is distributed on an "AS IS" BASIS, *
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 # See the License for the specific language governing permissions and *
15 # limitations under the License. *
17 ******************************************************************************/
25 #include "encode_kpm.hpp"
29 void encode_kpm_function_description(E2SM_KPM_RANfunction_Description_t* ranfunc_desc) {
33 uint8_t *buf = (uint8_t*)"ORAN-E2SM-KPM";
34 uint8_t *buf2 = (uint8_t*)"KPM monitor";
35 uint8_t *buf3 = (uint8_t*)"OID123";
37 OCTET_STRING_t *sname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
38 sname->buf = (uint8_t*)calloc(1,13);
40 memcpy(sname->buf, buf, 13);
41 sname->size = strlen((char*)buf);
42 ranfunc_desc->ranFunction_Name.ranFunction_ShortName = *sname;
46 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
48 // ranfunc_desc->ranFunction_Name.ranFunction_Description = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
49 ranfunc_desc->ranFunction_Name.ranFunction_Description.buf = (uint8_t*)calloc(1,strlen((char*)buf2));
50 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_Description.buf, buf2, strlen((char*)buf2));
51 ranfunc_desc->ranFunction_Name.ranFunction_Description.size = strlen((char*)buf2);
52 ranfunc_desc->ranFunction_Name.ranFunction_Instance = &inst;
56 // ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
57 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf = (uint8_t*)calloc(1,strlen((char*)buf3));
58 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf, buf3, strlen((char*)buf3));
59 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.size = strlen((char*)buf3);
64 RIC_EventTriggerStyle_List_t *trigger_style =
65 (RIC_EventTriggerStyle_List_t*)calloc(1, sizeof(RIC_EventTriggerStyle_List_t));
66 trigger_style->ric_EventTriggerStyle_Type = 1;
67 uint8_t *buf4 = (uint8_t*)"Periodic report";
68 // trigger_style->ric_EventTriggerStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
69 trigger_style->ric_EventTriggerStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf4));
70 memcpy(trigger_style->ric_EventTriggerStyle_Name.buf, buf4, strlen((char*)buf4));
71 trigger_style->ric_EventTriggerStyle_Name.size = strlen((char*)buf4);
72 trigger_style->ric_EventTriggerFormat_Type = 5;
76 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List =
77 (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));
79 int ret = ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List->list , trigger_style);
80 printf("ret is %d\n", ret);
82 RIC_ReportStyle_List_t *report_style1 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
83 report_style1->ric_ReportStyle_Type = 1;
85 uint8_t *buf5 = (uint8_t*)"O-DU Measurement Container for the 5GC connected deployment";
89 // report_style1->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
90 report_style1->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf5));
91 memcpy(report_style1->ric_ReportStyle_Name.buf, buf5, strlen((char*)buf5));
92 report_style1->ric_ReportStyle_Name.size = strlen((char*)buf5);
93 report_style1->ric_IndicationHeaderFormat_Type = 1;
94 report_style1->ric_IndicationMessageFormat_Type = 1;
98 RIC_ReportStyle_List_t *report_style2 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
99 report_style2->ric_ReportStyle_Type = 2;
101 uint8_t *buf6 = (uint8_t*)"O-DU Measurement Container for the EPC connected deployment";
103 // report_style2->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
106 report_style2->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf6));
107 memcpy(report_style2->ric_ReportStyle_Name.buf, buf6, strlen((char*)buf6));
108 report_style2->ric_ReportStyle_Name.size = strlen((char*)buf6);
109 report_style2->ric_IndicationHeaderFormat_Type = 1;
110 report_style2->ric_IndicationMessageFormat_Type = 1;
114 RIC_ReportStyle_List_t *report_style3 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
115 report_style3->ric_ReportStyle_Type = 3;
117 uint8_t *buf7 = (uint8_t*)"O-CU-CP Measurement Container for the 5GC connected deployment";
119 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
120 report_style3->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf7));
121 memcpy(report_style3->ric_ReportStyle_Name.buf, buf7, strlen((char*)buf7));
122 report_style3->ric_ReportStyle_Name.size = strlen((char*)buf7);
123 report_style3->ric_IndicationHeaderFormat_Type = 1;
124 report_style3->ric_IndicationMessageFormat_Type = 1;
126 RIC_ReportStyle_List_t *report_style4 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
127 report_style4->ric_ReportStyle_Type = 4;
129 uint8_t *buf8 = (uint8_t*)"O-CU-CP Measurement Container for the EPC connected deployment";
131 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
132 report_style4->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf8));
133 memcpy(report_style4->ric_ReportStyle_Name.buf, buf8, strlen((char*)buf8));
134 report_style4->ric_ReportStyle_Name.size = strlen((char*)buf8);
135 report_style4->ric_IndicationHeaderFormat_Type = 1;
136 report_style4->ric_IndicationMessageFormat_Type = 1;
138 RIC_ReportStyle_List_t *report_style5 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
139 report_style5->ric_ReportStyle_Type = 5;
141 uint8_t *buf9 = (uint8_t*)"O-CU-UP Measurement Container for the 5GC connected deployment";
143 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
144 report_style5->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf9));
145 memcpy(report_style5->ric_ReportStyle_Name.buf, buf9, strlen((char*)buf9));
146 report_style5->ric_ReportStyle_Name.size = strlen((char*)buf9);
147 report_style5->ric_IndicationHeaderFormat_Type = 1;
148 report_style5->ric_IndicationMessageFormat_Type = 1;
151 RIC_ReportStyle_List_t *report_style6 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
152 report_style6->ric_ReportStyle_Type = 6;
154 uint8_t *buf10 = (uint8_t*)"O-CU-UP Measurement Container for the EPC connected deployment";
156 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
157 report_style6->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf10));
158 memcpy(report_style6->ric_ReportStyle_Name.buf, buf10, strlen((char*)buf10));
159 report_style6->ric_ReportStyle_Name.size = strlen((char*)buf10);
160 report_style6->ric_IndicationHeaderFormat_Type = 1;
161 report_style6->ric_IndicationMessageFormat_Type = 1;
164 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List =
165 (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));
167 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style1);
168 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style2);
169 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style3);
170 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style4);
171 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style5);
172 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style6);
174 xer_fprint(stderr, &asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
177 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco) {
179 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
180 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
181 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
182 ts->size = strlen((char*)buf);
183 memcpy(ts->buf,buf,ts->size);
187 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
188 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
190 uint8_t *buf2 = (uint8_t*)"747";
192 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
193 plmnidstr->buf = (uint8_t*)calloc(3,1);
195 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
199 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
200 uint8_t* buf3 = (uint8_t*)"12340";
201 nrcellid->buf = (uint8_t*)calloc(1,5);
202 memcpy(nrcellid->buf, buf3, 5);
204 nrcellid->bits_unused = 4;
206 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
207 nrcgi->pLMN_Identity = *plmnidstr;
208 nrcgi->nRCellIdentity = *nrcellid;
212 report_item->nRCGI = *nrcgi;
214 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
215 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
219 uint8_t* crnti_str = (uint8_t*)"1111";
220 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
221 crnti->buf = (uint8_t*)calloc(1,4);
225 crnti->size = strlen((char*)crnti_str);
228 memcpy(crnti->buf, crnti_str, crnti->size);
232 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
235 bytesdl->buf = (uint8_t*)calloc(1,1);
236 memcpy(bytesdl->buf, buffer,1);
239 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
242 bytesul->buf = (uint8_t*)calloc(1,1);
243 memcpy(bytesul->buf, buffer1, 1);
247 ue_report_item->c_RNTI = *crnti;
248 ue_report_item->pDCPBytesDL = bytesdl;
249 ue_report_item->pDCPBytesUL = bytesul;
252 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
254 ranco->timestamp = *ts;
255 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
256 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
258 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
262 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
264 uint8_t *nrcellid_buf,
266 const uint8_t *serving_buf,
267 const uint8_t *neighbor_buf) {
268 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
269 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
270 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
271 ts->size = strlen((char*)buf);
272 memcpy(ts->buf,buf,ts->size);
276 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
277 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
279 int plmnid_size = strlen((char*)plmnid_buf);
280 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
281 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
282 plmnidstr->size = plmnid_size;
283 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
287 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
289 int nrcellid_size = strlen((char*)nrcellid_buf);
290 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
291 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
293 nrcellid->bits_unused = 4;
295 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
296 nrcgi->pLMN_Identity = *plmnidstr;
297 nrcgi->nRCellIdentity = *nrcellid;
301 report_item->nRCGI = *nrcgi;
303 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
304 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
309 int crnti_size = strlen((char*)crnti_buf);
310 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
311 crnti->buf = (uint8_t*)calloc(1, crnti_size);
315 crnti->size = strlen((char*)crnti_buf);
318 memcpy(crnti->buf, crnti_buf, crnti->size);
320 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
322 int serving_buf_len = strlen((char*)serving_buf);
323 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
324 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
325 servingstr->size = serving_buf_len;
326 memcpy(servingstr->buf, serving_buf, servingstr->size);
329 int neighbor_buf_len = strlen((char*)neighbor_buf);
330 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
331 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
332 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
333 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
334 neighborstr->size = neighbor_buf_len;
335 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
337 ue_report_item->c_RNTI = *crnti;
338 ue_report_item->serving_Cell_RF_Type = servingstr;
339 ue_report_item->neighbor_Cell_RF = neighborstr;
342 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
344 ranco->timestamp = *ts;
345 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
346 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
348 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
353 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
355 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
356 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
357 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
358 ts->size = strlen((char*)buf);
359 memcpy(ts->buf,buf,ts->size);
363 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
364 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
366 uint8_t *buf2 = (uint8_t*)"747";
368 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
369 plmnidstr->buf = (uint8_t*)calloc(3,1);
371 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
375 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
376 uint8_t* buf3 = (uint8_t*)"12340";
377 nrcellid->buf = (uint8_t*)calloc(1,5);
378 memcpy(nrcellid->buf, buf3, 5);
380 nrcellid->bits_unused = 4;
382 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
383 nrcgi->pLMN_Identity = *plmnidstr;
384 nrcgi->nRCellIdentity = *nrcellid;
388 report_item->nRCGI = *nrcgi;
390 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
391 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
395 uint8_t* crnti_str = (uint8_t*)"1111";
396 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
397 crnti->buf = (uint8_t*)calloc(1,4);
401 crnti->size = strlen((char*)crnti_str);
404 memcpy(crnti->buf, crnti_str, crnti->size);
406 uint8_t *buf_serving = (uint8_t*)"RSRP10";
407 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
408 servingstr->buf = (uint8_t*)calloc(6,1);
409 servingstr->size = 6;
410 memcpy(servingstr->buf, buf_serving, servingstr->size);
412 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
413 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
414 neighborstr->buf = (uint8_t*)calloc(7,1);
415 neighborstr->size = 7;
416 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
418 ue_report_item->c_RNTI = *crnti;
419 ue_report_item->serving_Cell_RF_Type = servingstr;
420 ue_report_item->neighbor_Cell_RF = neighborstr;
423 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
425 ranco->timestamp = *ts;
426 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
427 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
429 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
434 void encode_kpm_odu_user_level(RAN_Container_t *ranco) {
436 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
437 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
438 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
439 ts->size = strlen((char*)buf);
440 memcpy(ts->buf,buf,ts->size);
444 DU_Usage_Report_CellResourceReportItem_t *report_item =
445 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
447 uint8_t *buf2 = (uint8_t*)"747";
449 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
450 plmnidstr->buf = (uint8_t*)calloc(3,1);
452 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
456 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
457 uint8_t* buf3 = (uint8_t*)"12340";
458 nrcellid->buf = (uint8_t*)calloc(1,5);
459 memcpy(nrcellid->buf, buf3, 5);
461 nrcellid->bits_unused = 4;
463 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
464 nrcgi->pLMN_Identity = *plmnidstr;
465 nrcgi->nRCellIdentity = *nrcellid;
469 report_item->nRCGI = *nrcgi;
473 DU_Usage_Report_UeResourceReportItem *ue_report_item =
474 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
478 uint8_t* crnti_str = (uint8_t*)"1111";
479 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
480 crnti->buf = (uint8_t*)calloc(1,4);
484 crnti->size = strlen((char*)crnti_str);
487 memcpy(crnti->buf, crnti_str, crnti->size);
494 ue_report_item->c_RNTI = *crnti;
495 ue_report_item->dl_PRBUsage = &lval1;
499 ue_report_item->ul_PRBUsage = &lval2;
503 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
506 ranco->timestamp = *ts;
507 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
508 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
510 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
515 void encode_kpm_report_rancontainer_du(E2SM_KPM_IndicationMessage_t* indicationmessage) {
517 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
518 encode_kpm_odu_user_level(ranco);
520 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
521 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
522 containers_list->theRANContainer = ranco;
524 E2SM_KPM_IndicationMessage_Format1_t *format =
525 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
526 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
528 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
530 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
532 indicationmessage->indicationMessage.present = pres;
534 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
536 char *error_buf = (char*)calloc(300, sizeof(char));
539 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
540 printf("error length %d\n", errlen);
541 printf("error buf %s\n", error_buf);
543 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
545 asn_codec_ctx_t *opt_cod;
547 uint8_t e2smbuffer[8192];
548 size_t e2smbuffer_size = 8192;
550 uint8_t e2smbuffer2[8192];
551 size_t e2smbuffer_size2 = 8192;
554 asn_encode_to_buffer(opt_cod,
555 ATS_ALIGNED_BASIC_PER,
556 &asn_DEF_E2SM_KPM_IndicationMessage,
557 indicationmessage, e2smbuffer, e2smbuffer_size);
559 fprintf(stderr, "er encded is %d\n", er.encoded);
560 fprintf(stderr, "after encoding message\n");
565 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
567 uint8_t *nrcellid_buf,
569 const uint8_t *serving_buf,
570 const uint8_t *neighbor_buf) {
572 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
573 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
574 nrcellid_buf, crnti_buf,
575 serving_buf, neighbor_buf);
577 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
578 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
579 containers_list->theRANContainer = ranco;
581 E2SM_KPM_IndicationMessage_Format1_t *format =
582 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
583 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
585 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
587 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
589 indicationmessage->indicationMessage.present = pres;
591 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
593 char *error_buf = (char*)calloc(300, sizeof(char));
596 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
597 printf("error length %d\n", errlen);
598 printf("error buf %s\n", error_buf);
600 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
602 asn_codec_ctx_t *opt_cod;
604 uint8_t e2smbuffer[8192];
605 size_t e2smbuffer_size = 8192;
607 uint8_t e2smbuffer2[8192];
608 size_t e2smbuffer_size2 = 8192;
611 asn_encode_to_buffer(opt_cod,
612 ATS_ALIGNED_BASIC_PER,
613 &asn_DEF_E2SM_KPM_IndicationMessage,
614 indicationmessage, e2smbuffer, e2smbuffer_size);
616 fprintf(stderr, "er encded is %d\n", er.encoded);
617 fprintf(stderr, "after encoding message\n");
622 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
624 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
625 encode_kpm_ocucp_user_level(ranco);
627 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
628 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
629 containers_list->theRANContainer = ranco;
631 E2SM_KPM_IndicationMessage_Format1_t *format =
632 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
633 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
635 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
637 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
639 indicationmessage->indicationMessage.present = pres;
641 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
643 char *error_buf = (char*)calloc(300, sizeof(char));
646 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
647 printf("error length %d\n", errlen);
648 printf("error buf %s\n", error_buf);
650 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
652 asn_codec_ctx_t *opt_cod;
654 uint8_t e2smbuffer[8192];
655 size_t e2smbuffer_size = 8192;
657 uint8_t e2smbuffer2[8192];
658 size_t e2smbuffer_size2 = 8192;
661 asn_encode_to_buffer(opt_cod,
662 ATS_ALIGNED_BASIC_PER,
663 &asn_DEF_E2SM_KPM_IndicationMessage,
664 indicationmessage, e2smbuffer, e2smbuffer_size);
666 fprintf(stderr, "er encded is %d\n", er.encoded);
667 fprintf(stderr, "after encoding message\n");
672 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
674 uint8_t *nrcellid_buf,
682 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
684 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
685 //encode_kpm_ocuup_user_level(ranco);
688 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
689 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
690 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
691 ts->size = strlen((char*)buf);
692 memcpy(ts->buf,buf,ts->size);
696 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
697 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
699 uint8_t *buf2 = (uint8_t*)"747";
701 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
702 plmnidstr->buf = (uint8_t*)calloc(3,1);
704 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
708 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
709 uint8_t* buf3 = (uint8_t*)"12340";
710 nrcellid->buf = (uint8_t*)calloc(1,5);
711 memcpy(nrcellid->buf, buf3, 5);
713 nrcellid->bits_unused = 4;
715 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
716 nrcgi->pLMN_Identity = *plmnidstr;
717 nrcgi->nRCellIdentity = *nrcellid;
721 report_item->nRCGI = *nrcgi;
723 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
724 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
728 uint8_t* crnti_str = (uint8_t*)"1111";
729 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
730 crnti->buf = (uint8_t*)calloc(1,4);
734 crnti->size = strlen((char*)crnti_str);
737 memcpy(crnti->buf, crnti_str, crnti->size);
739 uint8_t *buf_serving = (uint8_t*)"RSRP10";
740 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
741 servingstr->buf = (uint8_t*)calloc(6,1);
742 servingstr->size = 6;
743 memcpy(servingstr->buf, buf_serving, servingstr->size);
745 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
746 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
747 neighborstr->buf = (uint8_t*)calloc(7,1);
748 neighborstr->size = 7;
749 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
751 ue_report_item->c_RNTI = *crnti;
752 ue_report_item->serving_Cell_RF_Type = servingstr;
753 ue_report_item->neighbor_Cell_RF = neighborstr;
756 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
758 ranco->timestamp = *ts;
759 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
760 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
762 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
765 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
766 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
767 containers_list->theRANContainer = ranco;
769 E2SM_KPM_IndicationMessage_Format1_t *format =
770 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
771 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
773 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
775 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
777 indicationmessage->indicationMessage.present = pres;
779 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
781 char *error_buf = (char*)calloc(300, sizeof(char));
784 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
785 printf("error length %d\n", errlen);
786 printf("error buf %s\n", error_buf);
788 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
790 asn_codec_ctx_t *opt_cod;
792 uint8_t e2smbuffer[8192];
793 size_t e2smbuffer_size = 8192;
795 uint8_t e2smbuffer2[8192];
796 size_t e2smbuffer_size2 = 8192;
799 asn_encode_to_buffer(opt_cod,
800 ATS_ALIGNED_BASIC_PER,
801 &asn_DEF_E2SM_KPM_IndicationMessage,
802 indicationmessage, e2smbuffer, e2smbuffer_size);
804 fprintf(stderr, "er encded is %d\n", er.encoded);
805 fprintf(stderr, "after encoding message\n");
810 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
817 uint8_t* nrcellid_buf,
822 asn_codec_ctx_t *opt_cod;
824 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
825 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
826 fqi_item->fiveQI = fiveqi;
827 fqi_item->dl_PRBUsage = &dl_prb_usage;
828 fqi_item->ul_PRBUsage = &ul_prb_usage;
830 uint8_t *buf1 = (uint8_t*)"4";
831 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
833 sst->buf = (uint8_t*)calloc(1,6);
834 memcpy(sst->buf,buf1,sst->size);
836 // std::string sd = "SD1";
837 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
838 // uint8_t *bufz = &sdvec[0];
839 uint8_t *bufz = (uint8_t*)"SD1";
840 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
842 sds->buf = (uint8_t*)calloc(1,3);
843 memcpy(sds->buf, bufz, sds->size);
846 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
847 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
848 snssai->sST.buf = (uint8_t*)calloc(1,1);
849 snssai->sST.size = 1;
850 memcpy(snssai->sST.buf, sst_buf, 1);
851 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
852 snssai->sD->buf = (uint8_t*)calloc(1,3);
853 snssai->sD->size = 3;
854 memcpy(snssai->sD->buf, sd_buf, 3);
857 SlicePerPlmnPerCellListItem_t *sliceitem =
858 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
859 sliceitem->sliceID = *snssai;
860 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
862 uint8_t *buf2 = (uint8_t*)"747";
864 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
865 plmnid->buf = (uint8_t*)calloc(3,1);
867 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
869 ServedPlmnPerCellListItem_t *percellitem1 =
870 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
871 percellitem1->pLMN_Identity = *plmnid;
872 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
873 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
875 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
876 plmnidstr->buf = (uint8_t*)calloc(3,1);
878 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
882 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
883 uint8_t* buf3 = (uint8_t*)"12340";
884 nrcellid->buf = (uint8_t*)calloc(1,5);
885 memcpy(nrcellid->buf, nrcellid_buf, 5);
887 nrcellid->bits_unused = 4;
889 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
890 nrcgi->pLMN_Identity = *plmnidstr;
891 nrcgi->nRCellIdentity = *nrcellid;
894 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
895 listitem1->nRCGI = *nrcgi;
896 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
897 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
898 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
901 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
902 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
903 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
905 PF_Container_PR pres1 = PF_Container_PR_oDU;
907 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
908 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
909 pfcontainer->present = pres1;
910 pfcontainer->choice.oDU = *ducont;
912 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
913 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
914 containers_list->performanceContainer = pfcontainer;
916 E2SM_KPM_IndicationMessage_Format1_t *format =
917 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
918 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
920 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
922 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
924 indicationmessage->indicationMessage.present = pres;
926 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
928 char *error_buf = (char*)calloc(300, sizeof(char));
931 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
932 printf("error length %d\n", errlen);
933 printf("error buf %s\n", error_buf);
935 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
938 uint8_t e2smbuffer[8192];
939 size_t e2smbuffer_size = 8192;
941 uint8_t e2smbuffer2[8192];
942 size_t e2smbuffer_size2 = 8192;
945 asn_encode_to_buffer(opt_cod,
946 ATS_ALIGNED_BASIC_PER,
947 &asn_DEF_E2SM_KPM_IndicationMessage,
948 indicationmessage, e2smbuffer, e2smbuffer_size);
950 fprintf(stderr, "er encded is %d\n", er.encoded);
951 fprintf(stderr, "after encoding message\n");
957 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
960 long dl_prb_usage = 50;
961 long ul_prb_usage = 70;
963 asn_codec_ctx_t *opt_cod;
965 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
966 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
967 fqi_item->fiveQI = fiveqi;
968 fqi_item->dl_PRBUsage = &dl_prb_usage;
969 fqi_item->ul_PRBUsage = &ul_prb_usage;
971 uint8_t *buf1 = (uint8_t*)"4";
972 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
974 sst->buf = (uint8_t*)calloc(1,6);
975 memcpy(sst->buf,buf1,sst->size);
977 // std::string sd = "SD1";
978 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
979 // uint8_t *bufz = &sdvec[0];
980 uint8_t *bufz = (uint8_t*)"SD1";
981 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
983 sds->buf = (uint8_t*)calloc(1,3);
984 memcpy(sds->buf, bufz, sds->size);
987 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
988 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
989 snssai->sST.buf = (uint8_t*)calloc(1,1);
990 snssai->sST.size = 1;
991 memcpy(snssai->sST.buf, buf1, 1);
992 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
993 snssai->sD->buf = (uint8_t*)calloc(1,3);
994 snssai->sD->size = 3;
995 memcpy(snssai->sD->buf, bufz, 3);
998 SlicePerPlmnPerCellListItem_t *sliceitem =
999 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1000 sliceitem->sliceID = *snssai;
1001 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1003 uint8_t *buf2 = (uint8_t*)"747";
1005 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1006 plmnid->buf = (uint8_t*)calloc(3,1);
1008 memcpy(plmnid->buf, buf2, plmnid->size);
1010 ServedPlmnPerCellListItem_t *percellitem1 =
1011 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1012 percellitem1->pLMN_Identity = *plmnid;
1013 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1014 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1016 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1017 plmnidstr->buf = (uint8_t*)calloc(3,1);
1018 plmnidstr->size = 3;
1019 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1023 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1024 uint8_t* buf3 = (uint8_t*)"12340";
1025 nrcellid->buf = (uint8_t*)calloc(1,5);
1026 memcpy(nrcellid->buf, buf3, 5);
1028 nrcellid->bits_unused = 4;
1030 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1031 nrcgi->pLMN_Identity = *plmnidstr;
1032 nrcgi->nRCellIdentity = *nrcellid;
1034 long dl_prbs = (long)100;
1035 long ul_prbs = (long)120;
1037 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1038 listitem1->nRCGI = *nrcgi;
1039 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1040 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1041 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1044 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1045 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1046 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1048 PF_Container_PR pres1 = PF_Container_PR_oDU;
1050 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1051 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1052 pfcontainer->present = pres1;
1053 pfcontainer->choice.oDU = *ducont;
1055 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1056 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1057 containers_list->performanceContainer = pfcontainer;
1059 E2SM_KPM_IndicationMessage_Format1_t *format =
1060 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1061 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1063 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1065 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1067 indicationmessage->indicationMessage.present = pres;
1069 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1071 char *error_buf = (char*)calloc(300, sizeof(char));
1074 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1075 printf("error length %d\n", errlen);
1076 printf("error buf %s\n", error_buf);
1078 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1081 uint8_t e2smbuffer[8192];
1082 size_t e2smbuffer_size = 8192;
1084 uint8_t e2smbuffer2[8192];
1085 size_t e2smbuffer_size2 = 8192;
1088 asn_encode_to_buffer(opt_cod,
1089 ATS_ALIGNED_BASIC_PER,
1090 &asn_DEF_E2SM_KPM_IndicationMessage,
1091 indicationmessage, e2smbuffer, e2smbuffer_size);
1093 fprintf(stderr, "er encded is %d\n", er.encoded);
1094 fprintf(stderr, "after encoding message\n");
1099 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1100 uint8_t *gnbcuupname_buf,
1105 uint8_t *plmnid_buf) {
1107 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1110 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1111 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1112 gnbcuupname->size = 8;
1113 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1114 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1117 //We need to convert bytes_dl into array of uint8_t
1121 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1123 if (bytes_dl <= 64) {
1126 uint8_t buffer[array_size_dl];
1127 buffer[0] = bytes_dl & 0xFF;
1128 bytesdl->buf = (uint8_t*)calloc(1,1);
1129 memcpy(bytesdl->buf,buffer,1);
1132 } else if (bytes_dl <= 16384) {
1135 uint8_t buffer[array_size_dl];
1136 buffer[0] = (bytes_dl >> 8) & 0xFF;
1137 buffer[1] = bytes_dl & 0xFF;
1138 bytesdl->buf = (uint8_t*)calloc(2,1);
1139 memcpy(bytesdl->buf,buffer,2);
1142 } else if (bytes_dl <= 4194304) {
1145 uint8_t buffer[array_size_dl];
1146 buffer[0] = (bytes_dl >> 16) & 0xFF;
1147 buffer[1] = (bytes_dl >> 8) & 0xFF;
1148 buffer[2] = bytes_dl & 0xFF;
1149 bytesdl->buf = (uint8_t*)calloc(3,1);
1150 memcpy(bytesdl->buf,buffer,3);
1153 } else if (bytes_dl <= 1073741824) {
1155 uint8_t buffer[array_size_dl];
1156 buffer[0] = (bytes_dl >> 24) & 0xFF;
1157 buffer[1] = (bytes_dl >> 16) & 0xFF;
1158 buffer[2] = (bytes_dl >> 8) & 0xFF;
1159 buffer[3] = bytes_dl & 0xFF;
1160 bytesdl->buf = (uint8_t*)calloc(4,1);
1161 memcpy(bytesdl->buf,buffer,4);
1166 //We need to convert bytes_ul into array of uint8_t
1167 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1171 if (bytes_ul <= 64) {
1174 uint8_t buffer[array_size_ul];
1175 buffer[0] = bytes_ul & 0xFF;
1176 bytesul->buf = (uint8_t*)calloc(1,1);
1177 memcpy(bytesul->buf,buffer,1);
1180 } else if (bytes_ul <= 16384) {
1183 uint8_t buffer[array_size_ul];
1184 buffer[0] = (bytes_ul >> 8) & 0xFF;
1185 buffer[1] = bytes_ul & 0xFF;
1186 bytesul->buf = (uint8_t*)calloc(2,1);
1187 memcpy(bytesul->buf,buffer,2);
1190 } else if (bytes_ul <= 4194304) {
1193 uint8_t buffer[array_size_ul];
1194 buffer[0] = (bytes_ul >> 16) & 0xFF;
1195 buffer[1] = (bytes_ul >> 8) & 0xFF;
1196 buffer[2] = bytes_ul & 0xFF;
1197 bytesul->buf = (uint8_t*)calloc(3,1);
1198 memcpy(bytesul->buf,buffer,3);
1201 } else if (bytes_ul <= 1073741824) {
1203 uint8_t buffer[array_size_ul];
1204 buffer[0] = (bytes_ul >> 24) & 0xFF;
1205 buffer[1] = (bytes_ul >> 16) & 0xFF;
1206 buffer[2] = (bytes_ul >> 8) & 0xFF;
1207 buffer[3] = bytes_ul & 0xFF;
1208 bytesul->buf = (uint8_t*)calloc(4,1);
1209 memcpy(bytesul->buf,buffer,4);
1214 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1215 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1216 fqilistitem->fiveQI = fqi;
1217 fqilistitem->pDCPBytesDL = bytesdl;
1218 fqilistitem->pDCPBytesUL = bytesul;
1221 uint8_t *buf1 = (uint8_t*)"4";
1222 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1224 sst->buf = (uint8_t*)calloc(1,6);
1225 memcpy(sst->buf,sst_buf,sst->size);
1228 uint8_t *bufz = (uint8_t*)"SD1";
1229 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1231 sds->buf = (uint8_t*)calloc(1,3);
1232 memcpy(sds->buf, sd_buf, sds->size);
1235 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1236 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1237 snssai->sST.buf = (uint8_t*)calloc(1,1);
1238 snssai->sST.size = 1;
1239 memcpy(snssai->sST.buf, sst_buf, 1);
1240 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1241 snssai->sD->buf = (uint8_t*)calloc(1,3);
1242 snssai->sD->size = 3;
1243 memcpy(snssai->sD->buf, sd_buf, 3);
1247 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1248 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1249 slicelistitem->sliceID = *snssai;
1250 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1252 asn_codec_ctx_t *opt_cod;
1255 uint8_t e2smbuffera[8192];
1256 size_t e2smbuffer_sizea = 8192;
1260 asn_enc_rval_t era =
1261 asn_encode_to_buffer(opt_cod,
1262 ATS_ALIGNED_BASIC_PER,
1263 &asn_DEF_SliceToReportListItem,
1264 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1265 //fprintf(stderr, "inner er encded is %d\n", era.encoded);
1266 //fprintf(stderr, "after encoding message\n");
1270 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1271 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1272 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1274 uint8_t *buf2 = (uint8_t*)"747";
1275 // std::string pl = "PLMNID7";
1276 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1277 // uint8_t *buf2 = &plvec[0];
1279 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1280 plmnid->buf = (uint8_t*)calloc(3,1);
1282 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1285 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1286 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1287 plmnidlist->pLMN_Identity = *plmnid;
1288 plmnidlist->cu_UP_PM_5GC = pm_format;
1290 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1291 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1292 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1297 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1298 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1299 listitem1->interface_type = 2;
1300 listitem1->o_CU_UP_PM_Container = *meas_cont;
1302 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1303 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1304 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1305 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1307 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1309 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1310 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1311 pfcontainer->present = pres1;
1312 pfcontainer->choice.oCU_UP = *cuupcont;
1314 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1315 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1316 containers_list->performanceContainer = pfcontainer;
1318 E2SM_KPM_IndicationMessage_Format1_t *format =
1319 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1320 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1322 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1324 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1326 indicationmessage->indicationMessage.present = pres;
1328 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1330 char *error_buf = (char*)calloc(300, sizeof(char));
1333 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1334 //printf("error length %d\n", errlen);
1335 //printf("error buf %s\n", error_buf);
1337 //xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1340 uint8_t e2smbuffer[8192];
1341 size_t e2smbuffer_size = 8192;
1343 uint8_t e2smbuffer2[8192];
1344 size_t e2smbuffer_size2 = 8192;
1347 asn_encode_to_buffer(opt_cod,
1348 ATS_ALIGNED_BASIC_PER,
1349 &asn_DEF_E2SM_KPM_IndicationMessage,
1350 indicationmessage, e2smbuffer, e2smbuffer_size);
1352 //fprintf(stderr, "er encded is %d\n", er.encoded);
1353 //fprintf(stderr, "after encoding message\n");
1358 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1360 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1363 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1364 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1365 gnbcuupname->size = 8;
1366 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1367 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1370 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1373 bytesdl->buf = (uint8_t*)calloc(1,1);
1374 memcpy(bytesdl->buf, buffer,1);
1377 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1380 bytesul->buf = (uint8_t*)calloc(1,1);
1381 memcpy(bytesul->buf, buffer1, 1);
1384 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1385 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1386 fqilistitem->fiveQI = 9;
1387 fqilistitem->pDCPBytesDL = bytesdl;
1388 fqilistitem->pDCPBytesUL = bytesul;
1391 uint8_t *buf1 = (uint8_t*)"4";
1392 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1394 sst->buf = (uint8_t*)calloc(1,6);
1395 memcpy(sst->buf,buf1,sst->size);
1398 uint8_t *bufz = (uint8_t*)"SD1";
1399 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1401 sds->buf = (uint8_t*)calloc(1,3);
1402 memcpy(sds->buf, bufz, sds->size);
1405 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1406 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1407 snssai->sST.buf = (uint8_t*)calloc(1,1);
1408 snssai->sST.size = 1;
1409 memcpy(snssai->sST.buf, buf1, 1);
1410 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1411 snssai->sD->buf = (uint8_t*)calloc(1,3);
1412 snssai->sD->size = 3;
1413 memcpy(snssai->sD->buf, bufz, 3);
1417 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1418 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1419 slicelistitem->sliceID = *snssai;
1420 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1422 asn_codec_ctx_t *opt_cod;
1425 uint8_t e2smbuffera[8192];
1426 size_t e2smbuffer_sizea = 8192;
1430 asn_enc_rval_t era =
1431 asn_encode_to_buffer(opt_cod,
1432 ATS_ALIGNED_BASIC_PER,
1433 &asn_DEF_SliceToReportListItem,
1434 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1435 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1436 fprintf(stderr, "after encoding message\n");
1440 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1441 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1442 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1444 uint8_t *buf2 = (uint8_t*)"747";
1445 // std::string pl = "PLMNID7";
1446 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1447 // uint8_t *buf2 = &plvec[0];
1449 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1450 plmnid->buf = (uint8_t*)calloc(3,1);
1452 memcpy(plmnid->buf, buf2, plmnid->size);
1455 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1456 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1457 plmnidlist->pLMN_Identity = *plmnid;
1458 plmnidlist->cu_UP_PM_5GC = pm_format;
1460 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1461 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1462 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1467 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1468 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1469 listitem1->interface_type = 2;
1470 listitem1->o_CU_UP_PM_Container = *meas_cont;
1472 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1473 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1474 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1475 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1477 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1479 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1480 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1481 pfcontainer->present = pres1;
1482 pfcontainer->choice.oCU_UP = *cuupcont;
1484 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1485 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1486 containers_list->performanceContainer = pfcontainer;
1488 E2SM_KPM_IndicationMessage_Format1_t *format =
1489 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1490 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1492 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1494 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1496 indicationmessage->indicationMessage.present = pres;
1498 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1500 char *error_buf = (char*)calloc(300, sizeof(char));
1503 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1504 printf("error length %d\n", errlen);
1505 printf("error buf %s\n", error_buf);
1507 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1510 uint8_t e2smbuffer[8192];
1511 size_t e2smbuffer_size = 8192;
1513 uint8_t e2smbuffer2[8192];
1514 size_t e2smbuffer_size2 = 8192;
1517 asn_encode_to_buffer(opt_cod,
1518 ATS_ALIGNED_BASIC_PER,
1519 &asn_DEF_E2SM_KPM_IndicationMessage,
1520 indicationmessage, e2smbuffer, e2smbuffer_size);
1522 fprintf(stderr, "er encded is %d\n", er.encoded);
1523 fprintf(stderr, "after encoding message\n");
1528 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1531 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1532 //std::string gn = "GNBCUUP5";
1533 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1534 //uint8_t *buf = &gnvec[0];
1535 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1536 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1537 gnbcuupname->size = 8;
1538 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1539 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1542 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1545 bytesdl->buf = (uint8_t*)calloc(1,1);
1546 memcpy(bytesdl->buf, buffer,1);
1549 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1552 bytesul->buf = (uint8_t*)calloc(1,1);
1553 memcpy(bytesul->buf, buffer1, 1);
1556 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1557 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1558 fqilistitem->fiveQI = 9;
1559 fqilistitem->pDCPBytesDL = bytesdl;
1560 fqilistitem->pDCPBytesUL = bytesul;
1564 // std::string sl = "SLICE4";
1565 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1566 // uint8_t *buf1 = &slvec[0];
1567 uint8_t *buf1 = (uint8_t*)"4";
1568 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1570 sst->buf = (uint8_t*)calloc(1,6);
1571 memcpy(sst->buf,buf1,sst->size);
1573 // std::string sd = "SD1";
1574 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1575 // uint8_t *bufz = &sdvec[0];
1576 uint8_t *bufz = (uint8_t*)"SD1";
1577 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1579 sds->buf = (uint8_t*)calloc(1,3);
1580 memcpy(sds->buf, bufz, sds->size);
1583 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1584 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1585 snssai->sST.buf = (uint8_t*)calloc(1,1);
1586 snssai->sST.size = 1;
1587 memcpy(snssai->sST.buf, buf1, 1);
1588 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1589 snssai->sD->buf = (uint8_t*)calloc(1,3);
1590 snssai->sD->size = 3;
1591 memcpy(snssai->sD->buf, bufz, 3);
1595 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1596 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1597 slicelistitem->sliceID = *snssai;
1598 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1600 asn_codec_ctx_t *opt_cod;
1603 uint8_t e2smbuffera[8192];
1604 size_t e2smbuffer_sizea = 8192;
1608 asn_enc_rval_t era =
1609 asn_encode_to_buffer(opt_cod,
1610 ATS_ALIGNED_BASIC_PER,
1611 &asn_DEF_SliceToReportListItem,
1612 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1613 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1614 fprintf(stderr, "after encoding message\n");
1618 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1619 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1620 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1622 uint8_t *buf2 = (uint8_t*)"747";
1623 // std::string pl = "PLMNID7";
1624 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1625 // uint8_t *buf2 = &plvec[0];
1627 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1628 plmnid->buf = (uint8_t*)calloc(3,1);
1630 memcpy(plmnid->buf, buf2, plmnid->size);
1633 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1634 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1635 plmnidlist->pLMN_Identity = *plmnid;
1636 plmnidlist->cu_UP_PM_5GC = pm_format;
1638 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1639 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1640 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1645 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1646 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1647 listitem1->interface_type = 2;
1648 listitem1->o_CU_UP_PM_Container = *meas_cont;
1650 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1651 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1652 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1653 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1655 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1657 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1658 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1659 pfcontainer->present = pres1;
1660 pfcontainer->choice.oCU_UP = *cuupcont;
1662 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1663 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1664 containers_list->performanceContainer = pfcontainer;
1666 E2SM_KPM_IndicationMessage_Format1_t *format =
1667 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1668 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1670 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1672 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1674 indicationmessage->present = pres;
1676 indicationmessage->choice.indicationMessage_Format1 = *format;
1678 char *error_buf = (char*)calloc(300, sizeof(char));
1681 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1682 printf("error length %d\n", errlen);
1683 printf("error buf %s\n", error_buf);
1685 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1688 uint8_t e2smbuffer[8192];
1689 size_t e2smbuffer_size = 8192;
1691 uint8_t e2smbuffer2[8192];
1692 size_t e2smbuffer_size2 = 8192;
1695 asn_encode_to_buffer(opt_cod,
1696 ATS_ALIGNED_BASIC_PER,
1697 &asn_DEF_E2SM_KPM_IndicationMessage,
1698 indicationmessage, e2smbuffer, e2smbuffer_size);
1700 fprintf(stderr, "er encded is %d\n", er.encoded);
1701 fprintf(stderr, "after encoding message\n");
1707 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1708 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1709 std::string gn = "GNBCUUP5";
1710 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1711 uint8_t *buf = &gnvec[0];
1712 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1713 gnbcuupname->size = 8;
1714 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1715 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1718 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1721 bytesdl->buf = (uint8_t*)calloc(1,1);
1722 memcpy(bytesdl->buf, buffer,1);
1725 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1728 bytesul->buf = (uint8_t*)calloc(1,1);
1729 memcpy(bytesul->buf, buffer1, 1);
1732 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1733 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1734 fqilistitem->fiveQI = 9;
1735 fqilistitem->pDCPBytesDL = bytesdl;
1736 fqilistitem->pDCPBytesUL = bytesul;
1740 std::string sl = "SLICE4";
1741 std::vector<uint8_t> slvec(sl.begin(), sl.end());
1742 // uint8_t *buf1 = &slvec[0];
1743 uint8_t *buf1 = (uint8_t*)"SLICE4";
1744 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1746 sst->buf = (uint8_t*)calloc(1,6);
1747 memcpy(sst->buf,buf1,sst->size);
1749 std::string sd = "SD1";
1750 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1751 // uint8_t *bufz = &sdvec[0];
1752 uint8_t *bufz = (uint8_t*)"SD1";
1753 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1755 sds->buf = (uint8_t*)calloc(1,3);
1756 memcpy(sds->buf, bufz, sds->size);
1759 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1760 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1761 snssai->sST.buf = (uint8_t*)calloc(6,1);
1762 snssai->sST.size = 6;
1763 memcpy(snssai->sST.buf, buf1, 6);
1764 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1765 snssai->sD->buf = (uint8_t*)calloc(1,3);
1766 snssai->sD->size = 3;
1767 memcpy(snssai->sD->buf, bufz, 3);
1771 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1772 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1773 slicelistitem->sliceID = *snssai;
1774 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1776 uint8_t e2smbuffera[8192];
1777 size_t e2smbuffer_sizea = 8192;
1780 asn_encode_to_buffer(nullptr,
1781 ATS_ALIGNED_BASIC_PER,
1782 &asn_DEF_SliceToReportListItem,
1783 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1784 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1785 fprintf(stderr, "after encoding message\n");
1787 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1788 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1789 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1791 std::string pl = "PLMNID7";
1792 std::vector<uint8_t> plvec(pl.begin(), pl.end());
1793 uint8_t *buf2 = &plvec[0];
1795 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1796 plmnid->buf = (uint8_t*)calloc(1,7);
1798 memcpy(plmnid->buf, buf2, plmnid->size);
1801 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1802 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1803 plmnidlist->pLMN_Identity = *plmnid;
1804 plmnidlist->cu_UP_PM_5GC = pm_format;
1806 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1807 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1808 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1813 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1814 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1815 listitem1->interface_type = 2;
1816 listitem1->o_CU_UP_PM_Container = *meas_cont;
1818 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1819 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1820 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1821 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1823 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1825 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1826 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1827 pfcontainer->present = pres1;
1828 pfcontainer->choice.oCU_UP = *cuupcont;
1830 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1831 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1832 containers_list->performanceContainer = pfcontainer;
1834 E2SM_KPM_IndicationMessage_Format1_t *format =
1835 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1836 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1838 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1840 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1842 indicationmessage->present = pres;
1844 indicationmessage->choice.indicationMessage_Format1 = *format;
1846 char *error_buf = (char*)calloc(300, sizeof(char));
1849 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1850 printf("error length %d\n", errlen);
1851 printf("error buf %s\n", error_buf);
1854 uint8_t e2smbuffer[8192];
1855 size_t e2smbuffer_size = 8192;
1857 uint8_t e2smbuffer2[8192];
1858 size_t e2smbuffer_size2 = 8192;
1861 asn_encode_to_buffer(nullptr,
1862 ATS_ALIGNED_BASIC_PER,
1863 &asn_DEF_E2SM_KPM_IndicationMessage,
1864 indicationmessage, e2smbuffer, e2smbuffer_size);
1866 fprintf(stderr, "er encded is %d\n", er.encoded);
1867 fprintf(stderr, "after encoding message\n");