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);
178 void encode_e2sm_kpm_indication_header(E2SM_KPM_IndicationHeader_t *ihead) {
180 uint8_t *plmnid_buf = (uint8_t*)"747";
181 uint8_t *sst_buf = (uint8_t*)"1";
182 uint8_t *sd_buf = (uint8_t*)"100";
184 E2SM_KPM_IndicationHeader_Format1_t* ind_header =
185 (E2SM_KPM_IndicationHeader_Format1_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_Format1_t));
187 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
188 plmnid->buf = (uint8_t*)calloc(3,1);
190 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
195 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
197 sst->buf = (uint8_t*)calloc(1,6);
198 memcpy(sst->buf,sst_buf,sst->size);
201 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
203 sds->buf = (uint8_t*)calloc(1,3);
204 memcpy(sds->buf, sd_buf, sds->size);
207 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
208 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
209 snssai->sST.buf = (uint8_t*)calloc(1,1);
210 snssai->sST.size = 1;
211 memcpy(snssai->sST.buf, sst_buf, 1);
212 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
213 snssai->sD->buf = (uint8_t*)calloc(1,3);
214 snssai->sD->size = 3;
215 memcpy(snssai->sD->buf, sd_buf, 3);
218 ind_header->pLMN_Identity = plmnid;
219 ind_header->fiveQI = &fqival;
221 BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
222 nrcellid->buf = (uint8_t*)calloc(1,5);
224 nrcellid->buf[0] = 0x22;
225 nrcellid->buf[1] = 0x5B;
226 nrcellid->buf[2] = 0xD6;
227 nrcellid->buf[3] = 0x00;
228 nrcellid->buf[4] = 0x70;
230 nrcellid->bits_unused = 4;
232 BIT_STRING_t *gnb_bstring = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
233 gnb_bstring->buf = (uint8_t*)calloc(1,4);
234 gnb_bstring->size = 4;
235 gnb_bstring->buf[0] = 0xB5;
236 gnb_bstring->buf[1] = 0xC6;
237 gnb_bstring->buf[2] = 0x77;
238 gnb_bstring->buf[3] = 0x88;
240 gnb_bstring->bits_unused = 3;
242 INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
245 cuup_id->buf = (uint8_t*)calloc(1,1);
246 memcpy(cuup_id->buf, buffer, 1);
249 ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID));
250 ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB;
251 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
252 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring;
253 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid;
254 ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id;
256 ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI));
257 ind_header->nRCGI->pLMN_Identity = *plmnid;
258 ind_header->nRCGI->nRCellIdentity = *nrcellid;
260 ind_header->sliceID = snssai;
261 ind_header->qci = &qcival;
262 // ind_header->message_Type = ;
263 // ind_header->gNB_DU_ID = ;
266 uint8_t *buf5 = (uint8_t*)"GNBCUUP5";
267 OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
269 cuupname->buf = (uint8_t*)calloc(1,8);
270 memcpy(cuupname->buf, buf5, cuupname->size);
273 ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name));
274 ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name;
275 ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname;
278 // ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID));
279 // ind_header->global_GNB_ID->plmn_id = *plmnid;
280 // ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
281 // ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring;
284 ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1;
285 ihead->choice.indicationHeader_Format1 = *ind_header;
287 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ihead);
293 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco,
295 uint8_t *nrcellid_buf,
300 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
301 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
302 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
303 ts->size = strlen((char*)buf);
304 memcpy(ts->buf,buf,ts->size);
308 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
309 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
311 // uint8_t *buf2 = (uint8_t*)"747";
313 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
314 plmnidstr->buf = (uint8_t*)calloc(3,1);
316 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
320 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
321 // uint8_t* buf3 = (uint8_t*)"12340";
322 nrcellid->buf = (uint8_t*)calloc(1,5);
323 memcpy(nrcellid->buf, nrcellid_buf, 5);
325 nrcellid->bits_unused = 4;
327 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
328 nrcgi->pLMN_Identity = *plmnidstr;
329 nrcgi->nRCellIdentity = *nrcellid;
333 report_item->nRCGI = *nrcgi;
335 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
336 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
340 // uint8_t* crnti_str = (uint8_t*)"1111";
341 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
342 crnti->buf = (uint8_t*)calloc(1,4);
346 crnti->size = strlen((char*)crnti_buf);
349 memcpy(crnti->buf, crnti_buf, crnti->size);
353 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
356 if (bytes_dl <= 64) {
359 uint8_t buffer[array_size_dl];
360 buffer[0] = bytes_dl & 0xFF;
361 bytesdl->buf = (uint8_t*)calloc(1,1);
362 memcpy(bytesdl->buf,buffer,1);
365 } else if (bytes_dl <= 16384) {
368 uint8_t buffer[array_size_dl];
369 buffer[0] = (bytes_dl >> 8) & 0xFF;
370 buffer[1] = bytes_dl & 0xFF;
371 bytesdl->buf = (uint8_t*)calloc(2,1);
372 memcpy(bytesdl->buf,buffer,2);
375 } else if (bytes_dl <= 4194304) {
378 uint8_t buffer[array_size_dl];
379 buffer[0] = (bytes_dl >> 16) & 0xFF;
380 buffer[1] = (bytes_dl >> 8) & 0xFF;
381 buffer[2] = bytes_dl & 0xFF;
382 bytesdl->buf = (uint8_t*)calloc(3,1);
383 memcpy(bytesdl->buf,buffer,3);
386 } else if (bytes_dl <= 1073741824) {
388 uint8_t buffer[array_size_dl];
389 buffer[0] = (bytes_dl >> 24) & 0xFF;
390 buffer[1] = (bytes_dl >> 16) & 0xFF;
391 buffer[2] = (bytes_dl >> 8) & 0xFF;
392 buffer[3] = bytes_dl & 0xFF;
393 bytesdl->buf = (uint8_t*)calloc(4,1);
394 memcpy(bytesdl->buf,buffer,4);
399 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
403 if (bytes_ul <= 64) {
406 uint8_t buffer[array_size_ul];
407 buffer[0] = bytes_ul & 0xFF;
408 bytesul->buf = (uint8_t*)calloc(1,1);
409 memcpy(bytesul->buf,buffer,1);
412 } else if (bytes_ul <= 16384) {
415 uint8_t buffer[array_size_ul];
416 buffer[0] = (bytes_ul >> 8) & 0xFF;
417 buffer[1] = bytes_ul & 0xFF;
418 bytesul->buf = (uint8_t*)calloc(2,1);
419 memcpy(bytesul->buf,buffer,2);
422 } else if (bytes_ul <= 4194304) {
425 uint8_t buffer[array_size_ul];
426 buffer[0] = (bytes_ul >> 16) & 0xFF;
427 buffer[1] = (bytes_ul >> 8) & 0xFF;
428 buffer[2] = bytes_ul & 0xFF;
429 bytesul->buf = (uint8_t*)calloc(3,1);
430 memcpy(bytesul->buf,buffer,3);
433 } else if (bytes_ul <= 1073741824) {
435 uint8_t buffer[array_size_ul];
436 buffer[0] = (bytes_ul >> 24) & 0xFF;
437 buffer[1] = (bytes_ul >> 16) & 0xFF;
438 buffer[2] = (bytes_ul >> 8) & 0xFF;
439 buffer[3] = bytes_ul & 0xFF;
440 bytesul->buf = (uint8_t*)calloc(4,1);
441 memcpy(bytesul->buf,buffer,4);
447 ue_report_item->c_RNTI = *crnti;
448 ue_report_item->pDCPBytesDL = bytesdl;
449 ue_report_item->pDCPBytesUL = bytesul;
452 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
454 ranco->timestamp = *ts;
455 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
456 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
458 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
462 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
464 uint8_t *nrcellid_buf,
466 const uint8_t *serving_buf,
467 const uint8_t *neighbor_buf) {
468 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
469 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
470 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
471 ts->size = strlen((char*)buf);
472 memcpy(ts->buf,buf,ts->size);
476 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
477 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
479 int plmnid_size = strlen((char*)plmnid_buf);
480 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
481 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
482 plmnidstr->size = plmnid_size;
483 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
487 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
489 int nrcellid_size = strlen((char*)nrcellid_buf);
490 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
491 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
493 nrcellid->bits_unused = 4;
495 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
496 nrcgi->pLMN_Identity = *plmnidstr;
497 nrcgi->nRCellIdentity = *nrcellid;
501 report_item->nRCGI = *nrcgi;
503 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
504 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
509 int crnti_size = strlen((char*)crnti_buf);
510 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
511 crnti->buf = (uint8_t*)calloc(1, crnti_size);
515 crnti->size = strlen((char*)crnti_buf);
518 memcpy(crnti->buf, crnti_buf, crnti->size);
520 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
522 int serving_buf_len = strlen((char*)serving_buf);
523 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
524 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
525 servingstr->size = serving_buf_len;
526 memcpy(servingstr->buf, serving_buf, servingstr->size);
529 int neighbor_buf_len = strlen((char*)neighbor_buf);
530 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
531 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
532 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
533 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
534 neighborstr->size = neighbor_buf_len;
535 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
537 ue_report_item->c_RNTI = *crnti;
538 ue_report_item->serving_Cell_RF_Type = servingstr;
539 ue_report_item->neighbor_Cell_RF = neighborstr;
542 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
544 ranco->timestamp = *ts;
545 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
546 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
548 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
553 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
555 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
556 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
557 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
558 ts->size = strlen((char*)buf);
559 memcpy(ts->buf,buf,ts->size);
563 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
564 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
566 uint8_t *buf2 = (uint8_t*)"747";
568 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
569 plmnidstr->buf = (uint8_t*)calloc(3,1);
571 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
575 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
576 uint8_t* buf3 = (uint8_t*)"12340";
577 nrcellid->buf = (uint8_t*)calloc(1,5);
578 memcpy(nrcellid->buf, buf3, 5);
580 nrcellid->bits_unused = 4;
582 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
583 nrcgi->pLMN_Identity = *plmnidstr;
584 nrcgi->nRCellIdentity = *nrcellid;
588 report_item->nRCGI = *nrcgi;
590 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
591 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
595 uint8_t* crnti_str = (uint8_t*)"1111";
596 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
597 crnti->buf = (uint8_t*)calloc(1,4);
601 crnti->size = strlen((char*)crnti_str);
604 memcpy(crnti->buf, crnti_str, crnti->size);
606 uint8_t *buf_serving = (uint8_t*)"RSRP10";
607 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
608 servingstr->buf = (uint8_t*)calloc(6,1);
609 servingstr->size = 6;
610 memcpy(servingstr->buf, buf_serving, servingstr->size);
612 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
613 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
614 neighborstr->buf = (uint8_t*)calloc(7,1);
615 neighborstr->size = 7;
616 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
618 ue_report_item->c_RNTI = *crnti;
619 ue_report_item->serving_Cell_RF_Type = servingstr;
620 ue_report_item->neighbor_Cell_RF = neighborstr;
623 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
625 ranco->timestamp = *ts;
626 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
627 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
629 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
634 void encode_kpm_odu_user_level(RAN_Container_t *ranco,
636 uint8_t *nrcellid_buf,
641 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
642 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
643 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
644 ts->size = strlen((char*)buf);
645 memcpy(ts->buf,buf,ts->size);
649 DU_Usage_Report_CellResourceReportItem_t *report_item =
650 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
652 // uint8_t *buf2 = (uint8_t*)"747";
654 int plmnid_size = strlen((char*)plmnid_buf);
655 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
656 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
657 plmnidstr->size = plmnid_size;
658 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
662 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
664 int nrcellid_size = strlen((char*)nrcellid_buf);
665 nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size);
666 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
667 nrcellid->size = nrcellid_size;
668 nrcellid->bits_unused = 4;
670 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
671 nrcgi->pLMN_Identity = *plmnidstr;
672 nrcgi->nRCellIdentity = *nrcellid;
676 report_item->nRCGI = *nrcgi;
680 DU_Usage_Report_UeResourceReportItem *ue_report_item =
681 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
685 int crnti_size = strlen((char*)crnti_buf);
687 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
688 crnti->buf = (uint8_t*)calloc(1,crnti_size);
692 crnti->size = strlen((char*)crnti_buf);
695 memcpy(crnti->buf, crnti_buf, crnti->size);
700 ue_report_item->c_RNTI = *crnti;
701 ue_report_item->dl_PRBUsage = &prb_usage_dl;
705 ue_report_item->ul_PRBUsage = &prb_usage_ul;
709 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
712 ranco->timestamp = *ts;
713 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
714 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
716 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
721 void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
723 uint8_t *nrcellid_buf,
728 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
729 encode_kpm_odu_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,prb_usage_dl,prb_usage_ul);
731 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
732 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
733 containers_list->theRANContainer = ranco;
735 E2SM_KPM_IndicationMessage_Format1_t *format =
736 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
737 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
739 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
741 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
743 indicationmessage->indicationMessage.present = pres;
745 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
747 char *error_buf = (char*)calloc(300, sizeof(char));
750 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
751 printf("error length %d\n", errlen);
752 printf("error buf %s\n", error_buf);
754 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
756 asn_codec_ctx_t *opt_cod;
758 uint8_t e2smbuffer[8192];
759 size_t e2smbuffer_size = 8192;
761 uint8_t e2smbuffer2[8192];
762 size_t e2smbuffer_size2 = 8192;
765 asn_encode_to_buffer(opt_cod,
766 ATS_ALIGNED_BASIC_PER,
767 &asn_DEF_E2SM_KPM_IndicationMessage,
768 indicationmessage, e2smbuffer, e2smbuffer_size);
770 fprintf(stderr, "er encded is %d\n", er.encoded);
771 fprintf(stderr, "after encoding message\n");
776 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
778 uint8_t *nrcellid_buf,
780 const uint8_t *serving_buf,
781 const uint8_t *neighbor_buf) {
783 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
784 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
785 nrcellid_buf, crnti_buf,
786 serving_buf, neighbor_buf);
788 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
789 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
790 containers_list->theRANContainer = ranco;
792 E2SM_KPM_IndicationMessage_Format1_t *format =
793 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
794 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
796 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
798 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
800 indicationmessage->indicationMessage.present = pres;
802 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
804 char *error_buf = (char*)calloc(300, sizeof(char));
807 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
808 printf("error length %d\n", errlen);
809 printf("error buf %s\n", error_buf);
811 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
813 asn_codec_ctx_t *opt_cod;
815 uint8_t e2smbuffer[8192];
816 size_t e2smbuffer_size = 8192;
818 uint8_t e2smbuffer2[8192];
819 size_t e2smbuffer_size2 = 8192;
822 asn_encode_to_buffer(opt_cod,
823 ATS_ALIGNED_BASIC_PER,
824 &asn_DEF_E2SM_KPM_IndicationMessage,
825 indicationmessage, e2smbuffer, e2smbuffer_size);
827 fprintf(stderr, "er encded is %d\n", er.encoded);
828 fprintf(stderr, "after encoding message\n");
833 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
835 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
836 encode_kpm_ocucp_user_level(ranco);
838 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
839 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
840 containers_list->theRANContainer = ranco;
842 E2SM_KPM_IndicationMessage_Format1_t *format =
843 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
844 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
846 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
848 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
850 indicationmessage->indicationMessage.present = pres;
852 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
854 char *error_buf = (char*)calloc(300, sizeof(char));
857 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
858 printf("error length %d\n", errlen);
859 printf("error buf %s\n", error_buf);
861 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
863 asn_codec_ctx_t *opt_cod;
865 uint8_t e2smbuffer[8192];
866 size_t e2smbuffer_size = 8192;
868 uint8_t e2smbuffer2[8192];
869 size_t e2smbuffer_size2 = 8192;
872 asn_encode_to_buffer(opt_cod,
873 ATS_ALIGNED_BASIC_PER,
874 &asn_DEF_E2SM_KPM_IndicationMessage,
875 indicationmessage, e2smbuffer, e2smbuffer_size);
877 fprintf(stderr, "er encded is %d\n", er.encoded);
878 fprintf(stderr, "after encoding message\n");
883 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
885 uint8_t *nrcellid_buf,
890 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
891 encode_kpm_ocuup_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,pdcp_bytesdl,pdcp_bytesul);
893 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
894 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
895 containers_list->theRANContainer = ranco;
897 E2SM_KPM_IndicationMessage_Format1_t *format =
898 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
899 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
901 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
903 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
905 indicationmessage->indicationMessage.present = pres;
907 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
909 char *error_buf = (char*)calloc(300, sizeof(char));
912 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
913 printf("error length %d\n", errlen);
914 printf("error buf %s\n", error_buf);
916 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
918 asn_codec_ctx_t *opt_cod;
920 uint8_t e2smbuffer[8192];
921 size_t e2smbuffer_size = 8192;
923 uint8_t e2smbuffer2[8192];
924 size_t e2smbuffer_size2 = 8192;
926 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
929 asn_encode_to_buffer(opt_cod,
930 ATS_ALIGNED_BASIC_PER,
931 &asn_DEF_E2SM_KPM_IndicationMessage,
932 indicationmessage, e2smbuffer, e2smbuffer_size);
934 fprintf(stderr, "er encded is %d\n", er.encoded);
935 fprintf(stderr, "after encoding message\n");
940 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
942 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
943 //encode_kpm_ocuup_user_level(ranco);
946 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
947 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
948 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
949 ts->size = strlen((char*)buf);
950 memcpy(ts->buf,buf,ts->size);
954 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
955 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
957 uint8_t *buf2 = (uint8_t*)"747";
959 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
960 plmnidstr->buf = (uint8_t*)calloc(3,1);
962 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
966 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
967 uint8_t* buf3 = (uint8_t*)"12340";
968 nrcellid->buf = (uint8_t*)calloc(1,5);
969 memcpy(nrcellid->buf, buf3, 5);
971 nrcellid->bits_unused = 4;
973 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
974 nrcgi->pLMN_Identity = *plmnidstr;
975 nrcgi->nRCellIdentity = *nrcellid;
979 report_item->nRCGI = *nrcgi;
981 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
982 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
986 uint8_t* crnti_str = (uint8_t*)"1111";
987 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
988 crnti->buf = (uint8_t*)calloc(1,4);
992 crnti->size = strlen((char*)crnti_str);
995 memcpy(crnti->buf, crnti_str, crnti->size);
997 uint8_t *buf_serving = (uint8_t*)"RSRP10";
998 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
999 servingstr->buf = (uint8_t*)calloc(6,1);
1000 servingstr->size = 6;
1001 memcpy(servingstr->buf, buf_serving, servingstr->size);
1003 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
1004 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1005 neighborstr->buf = (uint8_t*)calloc(7,1);
1006 neighborstr->size = 7;
1007 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
1009 ue_report_item->c_RNTI = *crnti;
1010 ue_report_item->serving_Cell_RF_Type = servingstr;
1011 ue_report_item->neighbor_Cell_RF = neighborstr;
1014 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
1016 ranco->timestamp = *ts;
1017 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
1018 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
1020 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
1023 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1024 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1025 containers_list->theRANContainer = ranco;
1027 E2SM_KPM_IndicationMessage_Format1_t *format =
1028 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1029 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1031 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1033 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1035 indicationmessage->indicationMessage.present = pres;
1037 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1039 char *error_buf = (char*)calloc(300, sizeof(char));
1042 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1043 printf("error length %d\n", errlen);
1044 printf("error buf %s\n", error_buf);
1046 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1048 asn_codec_ctx_t *opt_cod;
1050 uint8_t e2smbuffer[8192];
1051 size_t e2smbuffer_size = 8192;
1053 uint8_t e2smbuffer2[8192];
1054 size_t e2smbuffer_size2 = 8192;
1057 asn_encode_to_buffer(opt_cod,
1058 ATS_ALIGNED_BASIC_PER,
1059 &asn_DEF_E2SM_KPM_IndicationMessage,
1060 indicationmessage, e2smbuffer, e2smbuffer_size);
1062 fprintf(stderr, "er encded is %d\n", er.encoded);
1063 fprintf(stderr, "after encoding message\n");
1068 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1074 uint8_t* plmnid_buf,
1075 uint8_t* nrcellid_buf,
1080 asn_codec_ctx_t *opt_cod;
1082 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1083 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1084 fqi_item->fiveQI = fiveqi;
1085 fqi_item->dl_PRBUsage = &dl_prb_usage;
1086 fqi_item->ul_PRBUsage = &ul_prb_usage;
1088 uint8_t *buf1 = (uint8_t*)"4";
1089 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1091 sst->buf = (uint8_t*)calloc(1,6);
1092 memcpy(sst->buf,buf1,sst->size);
1094 // std::string sd = "SD1";
1095 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1096 // uint8_t *bufz = &sdvec[0];
1097 uint8_t *bufz = (uint8_t*)"SD1";
1098 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1100 sds->buf = (uint8_t*)calloc(1,3);
1101 memcpy(sds->buf, bufz, sds->size);
1104 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1105 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1106 snssai->sST.buf = (uint8_t*)calloc(1,1);
1107 snssai->sST.size = 1;
1108 memcpy(snssai->sST.buf, sst_buf, 1);
1109 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1110 snssai->sD->buf = (uint8_t*)calloc(1,3);
1111 snssai->sD->size = 3;
1112 memcpy(snssai->sD->buf, sd_buf, 3);
1115 SlicePerPlmnPerCellListItem_t *sliceitem =
1116 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1117 sliceitem->sliceID = *snssai;
1118 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1120 uint8_t *buf2 = (uint8_t*)"747";
1122 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1123 plmnid->buf = (uint8_t*)calloc(3,1);
1125 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1127 ServedPlmnPerCellListItem_t *percellitem1 =
1128 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1129 percellitem1->pLMN_Identity = *plmnid;
1130 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1131 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1133 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1134 plmnidstr->buf = (uint8_t*)calloc(3,1);
1135 plmnidstr->size = 3;
1136 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
1140 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1141 uint8_t* buf3 = (uint8_t*)"12340";
1142 nrcellid->buf = (uint8_t*)calloc(1,5);
1143 memcpy(nrcellid->buf, nrcellid_buf, 5);
1145 nrcellid->bits_unused = 4;
1147 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1148 nrcgi->pLMN_Identity = *plmnidstr;
1149 nrcgi->nRCellIdentity = *nrcellid;
1152 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1153 listitem1->nRCGI = *nrcgi;
1154 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
1155 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
1156 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1159 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1160 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1161 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1163 PF_Container_PR pres1 = PF_Container_PR_oDU;
1165 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1166 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1167 pfcontainer->present = pres1;
1168 pfcontainer->choice.oDU = *ducont;
1170 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1171 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1172 containers_list->performanceContainer = pfcontainer;
1174 E2SM_KPM_IndicationMessage_Format1_t *format =
1175 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1176 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1178 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1180 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1182 indicationmessage->indicationMessage.present = pres;
1184 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1186 char *error_buf = (char*)calloc(300, sizeof(char));
1189 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1190 printf("error length %d\n", errlen);
1191 printf("error buf %s\n", error_buf);
1193 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1196 uint8_t e2smbuffer[8192];
1197 size_t e2smbuffer_size = 8192;
1199 uint8_t e2smbuffer2[8192];
1200 size_t e2smbuffer_size2 = 8192;
1203 asn_encode_to_buffer(opt_cod,
1204 ATS_ALIGNED_BASIC_PER,
1205 &asn_DEF_E2SM_KPM_IndicationMessage,
1206 indicationmessage, e2smbuffer, e2smbuffer_size);
1208 fprintf(stderr, "er encded is %d\n", er.encoded);
1209 fprintf(stderr, "after encoding message\n");
1215 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1218 long dl_prb_usage = 50;
1219 long ul_prb_usage = 70;
1221 asn_codec_ctx_t *opt_cod;
1223 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1224 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1225 fqi_item->fiveQI = fiveqi;
1226 fqi_item->dl_PRBUsage = &dl_prb_usage;
1227 fqi_item->ul_PRBUsage = &ul_prb_usage;
1229 uint8_t *buf1 = (uint8_t*)"4";
1230 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1232 sst->buf = (uint8_t*)calloc(1,6);
1233 memcpy(sst->buf,buf1,sst->size);
1235 // std::string sd = "SD1";
1236 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1237 // uint8_t *bufz = &sdvec[0];
1238 uint8_t *bufz = (uint8_t*)"SD1";
1239 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1241 sds->buf = (uint8_t*)calloc(1,3);
1242 memcpy(sds->buf, bufz, sds->size);
1245 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1246 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1247 snssai->sST.buf = (uint8_t*)calloc(1,1);
1248 snssai->sST.size = 1;
1249 memcpy(snssai->sST.buf, buf1, 1);
1250 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1251 snssai->sD->buf = (uint8_t*)calloc(1,3);
1252 snssai->sD->size = 3;
1253 memcpy(snssai->sD->buf, bufz, 3);
1256 SlicePerPlmnPerCellListItem_t *sliceitem =
1257 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1258 sliceitem->sliceID = *snssai;
1259 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1261 uint8_t *buf2 = (uint8_t*)"747";
1263 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1264 plmnid->buf = (uint8_t*)calloc(3,1);
1266 memcpy(plmnid->buf, buf2, plmnid->size);
1268 ServedPlmnPerCellListItem_t *percellitem1 =
1269 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1270 percellitem1->pLMN_Identity = *plmnid;
1271 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1272 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1274 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1275 plmnidstr->buf = (uint8_t*)calloc(3,1);
1276 plmnidstr->size = 3;
1277 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1281 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1282 uint8_t* buf3 = (uint8_t*)"12340";
1283 nrcellid->buf = (uint8_t*)calloc(1,5);
1284 memcpy(nrcellid->buf, buf3, 5);
1286 nrcellid->bits_unused = 4;
1288 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1289 nrcgi->pLMN_Identity = *plmnidstr;
1290 nrcgi->nRCellIdentity = *nrcellid;
1292 long dl_prbs = (long)100;
1293 long ul_prbs = (long)120;
1295 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1296 listitem1->nRCGI = *nrcgi;
1297 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1298 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1299 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1302 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1303 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1304 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1306 PF_Container_PR pres1 = PF_Container_PR_oDU;
1308 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1309 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1310 pfcontainer->present = pres1;
1311 pfcontainer->choice.oDU = *ducont;
1313 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1314 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1315 containers_list->performanceContainer = pfcontainer;
1317 E2SM_KPM_IndicationMessage_Format1_t *format =
1318 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1319 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1321 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1323 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1325 indicationmessage->indicationMessage.present = pres;
1327 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1329 char *error_buf = (char*)calloc(300, sizeof(char));
1332 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1333 printf("error length %d\n", errlen);
1334 printf("error buf %s\n", error_buf);
1336 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1339 uint8_t e2smbuffer[8192];
1340 size_t e2smbuffer_size = 8192;
1342 uint8_t e2smbuffer2[8192];
1343 size_t e2smbuffer_size2 = 8192;
1346 asn_encode_to_buffer(opt_cod,
1347 ATS_ALIGNED_BASIC_PER,
1348 &asn_DEF_E2SM_KPM_IndicationMessage,
1349 indicationmessage, e2smbuffer, e2smbuffer_size);
1351 fprintf(stderr, "er encded is %d\n", er.encoded);
1352 fprintf(stderr, "after encoding message\n");
1357 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1358 uint8_t *gnbcuupname_buf,
1363 uint8_t *plmnid_buf) {
1365 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1368 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1369 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1370 gnbcuupname->size = 8;
1371 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1372 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1375 //We need to convert bytes_dl into array of uint8_t
1379 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1381 if (bytes_dl <= 64) {
1384 uint8_t buffer[array_size_dl];
1385 buffer[0] = bytes_dl & 0xFF;
1386 bytesdl->buf = (uint8_t*)calloc(1,1);
1387 memcpy(bytesdl->buf,buffer,1);
1390 } else if (bytes_dl <= 16384) {
1393 uint8_t buffer[array_size_dl];
1394 buffer[0] = (bytes_dl >> 8) & 0xFF;
1395 buffer[1] = bytes_dl & 0xFF;
1396 bytesdl->buf = (uint8_t*)calloc(2,1);
1397 memcpy(bytesdl->buf,buffer,2);
1400 } else if (bytes_dl <= 4194304) {
1403 uint8_t buffer[array_size_dl];
1404 buffer[0] = (bytes_dl >> 16) & 0xFF;
1405 buffer[1] = (bytes_dl >> 8) & 0xFF;
1406 buffer[2] = bytes_dl & 0xFF;
1407 bytesdl->buf = (uint8_t*)calloc(3,1);
1408 memcpy(bytesdl->buf,buffer,3);
1411 } else if (bytes_dl <= 1073741824) {
1413 uint8_t buffer[array_size_dl];
1414 buffer[0] = (bytes_dl >> 24) & 0xFF;
1415 buffer[1] = (bytes_dl >> 16) & 0xFF;
1416 buffer[2] = (bytes_dl >> 8) & 0xFF;
1417 buffer[3] = bytes_dl & 0xFF;
1418 bytesdl->buf = (uint8_t*)calloc(4,1);
1419 memcpy(bytesdl->buf,buffer,4);
1424 //We need to convert bytes_ul into array of uint8_t
1425 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1429 if (bytes_ul <= 64) {
1432 uint8_t buffer[array_size_ul];
1433 buffer[0] = bytes_ul & 0xFF;
1434 bytesul->buf = (uint8_t*)calloc(1,1);
1435 memcpy(bytesul->buf,buffer,1);
1438 } else if (bytes_ul <= 16384) {
1441 uint8_t buffer[array_size_ul];
1442 buffer[0] = (bytes_ul >> 8) & 0xFF;
1443 buffer[1] = bytes_ul & 0xFF;
1444 bytesul->buf = (uint8_t*)calloc(2,1);
1445 memcpy(bytesul->buf,buffer,2);
1448 } else if (bytes_ul <= 4194304) {
1451 uint8_t buffer[array_size_ul];
1452 buffer[0] = (bytes_ul >> 16) & 0xFF;
1453 buffer[1] = (bytes_ul >> 8) & 0xFF;
1454 buffer[2] = bytes_ul & 0xFF;
1455 bytesul->buf = (uint8_t*)calloc(3,1);
1456 memcpy(bytesul->buf,buffer,3);
1459 } else if (bytes_ul <= 1073741824) {
1461 uint8_t buffer[array_size_ul];
1462 buffer[0] = (bytes_ul >> 24) & 0xFF;
1463 buffer[1] = (bytes_ul >> 16) & 0xFF;
1464 buffer[2] = (bytes_ul >> 8) & 0xFF;
1465 buffer[3] = bytes_ul & 0xFF;
1466 bytesul->buf = (uint8_t*)calloc(4,1);
1467 memcpy(bytesul->buf,buffer,4);
1472 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1473 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1474 fqilistitem->fiveQI = fqi;
1475 fqilistitem->pDCPBytesDL = bytesdl;
1476 fqilistitem->pDCPBytesUL = bytesul;
1479 uint8_t *buf1 = (uint8_t*)"4";
1480 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1482 sst->buf = (uint8_t*)calloc(1,6);
1483 memcpy(sst->buf,sst_buf,sst->size);
1486 uint8_t *bufz = (uint8_t*)"SD1";
1487 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1489 sds->buf = (uint8_t*)calloc(1,3);
1490 memcpy(sds->buf, sd_buf, sds->size);
1493 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1494 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1495 snssai->sST.buf = (uint8_t*)calloc(1,1);
1496 snssai->sST.size = 1;
1497 memcpy(snssai->sST.buf, sst_buf, 1);
1498 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1499 snssai->sD->buf = (uint8_t*)calloc(1,3);
1500 snssai->sD->size = 3;
1501 memcpy(snssai->sD->buf, sd_buf, 3);
1505 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1506 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1507 slicelistitem->sliceID = *snssai;
1508 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1510 asn_codec_ctx_t *opt_cod;
1513 uint8_t e2smbuffera[8192];
1514 size_t e2smbuffer_sizea = 8192;
1518 asn_enc_rval_t era =
1519 asn_encode_to_buffer(opt_cod,
1520 ATS_ALIGNED_BASIC_PER,
1521 &asn_DEF_SliceToReportListItem,
1522 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1523 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1524 fprintf(stderr, "after encoding message\n");
1528 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1529 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1530 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1532 uint8_t *buf2 = (uint8_t*)"747";
1533 // std::string pl = "PLMNID7";
1534 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1535 // uint8_t *buf2 = &plvec[0];
1537 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1538 plmnid->buf = (uint8_t*)calloc(3,1);
1540 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1543 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1544 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1545 plmnidlist->pLMN_Identity = *plmnid;
1546 plmnidlist->cu_UP_PM_5GC = pm_format;
1548 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1549 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1550 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1555 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1556 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1557 listitem1->interface_type = 2;
1558 listitem1->o_CU_UP_PM_Container = *meas_cont;
1560 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1561 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1562 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1563 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1565 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1567 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1568 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1569 pfcontainer->present = pres1;
1570 pfcontainer->choice.oCU_UP = *cuupcont;
1572 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1573 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1574 containers_list->performanceContainer = pfcontainer;
1576 E2SM_KPM_IndicationMessage_Format1_t *format =
1577 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1578 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1580 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1582 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1584 indicationmessage->indicationMessage.present = pres;
1586 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1588 char *error_buf = (char*)calloc(300, sizeof(char));
1591 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1592 printf("error length %d\n", errlen);
1593 printf("error buf %s\n", error_buf);
1595 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1598 uint8_t e2smbuffer[8192];
1599 size_t e2smbuffer_size = 8192;
1601 uint8_t e2smbuffer2[8192];
1602 size_t e2smbuffer_size2 = 8192;
1605 asn_encode_to_buffer(opt_cod,
1606 ATS_ALIGNED_BASIC_PER,
1607 &asn_DEF_E2SM_KPM_IndicationMessage,
1608 indicationmessage, e2smbuffer, e2smbuffer_size);
1610 fprintf(stderr, "er encded is %d\n", er.encoded);
1611 fprintf(stderr, "after encoding message\n");
1616 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1618 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1621 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1622 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1623 gnbcuupname->size = 8;
1624 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1625 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1628 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1631 bytesdl->buf = (uint8_t*)calloc(1,1);
1632 memcpy(bytesdl->buf, buffer,1);
1635 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1638 bytesul->buf = (uint8_t*)calloc(1,1);
1639 memcpy(bytesul->buf, buffer1, 1);
1642 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1643 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1644 fqilistitem->fiveQI = 9;
1645 fqilistitem->pDCPBytesDL = bytesdl;
1646 fqilistitem->pDCPBytesUL = bytesul;
1649 uint8_t *buf1 = (uint8_t*)"4";
1650 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1652 sst->buf = (uint8_t*)calloc(1,6);
1653 memcpy(sst->buf,buf1,sst->size);
1656 uint8_t *bufz = (uint8_t*)"SD1";
1657 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1659 sds->buf = (uint8_t*)calloc(1,3);
1660 memcpy(sds->buf, bufz, sds->size);
1663 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1664 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1665 snssai->sST.buf = (uint8_t*)calloc(1,1);
1666 snssai->sST.size = 1;
1667 memcpy(snssai->sST.buf, buf1, 1);
1668 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1669 snssai->sD->buf = (uint8_t*)calloc(1,3);
1670 snssai->sD->size = 3;
1671 memcpy(snssai->sD->buf, bufz, 3);
1675 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1676 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1677 slicelistitem->sliceID = *snssai;
1678 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1680 asn_codec_ctx_t *opt_cod;
1683 uint8_t e2smbuffera[8192];
1684 size_t e2smbuffer_sizea = 8192;
1688 asn_enc_rval_t era =
1689 asn_encode_to_buffer(opt_cod,
1690 ATS_ALIGNED_BASIC_PER,
1691 &asn_DEF_SliceToReportListItem,
1692 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1693 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1694 fprintf(stderr, "after encoding message\n");
1698 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1699 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1700 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1702 uint8_t *buf2 = (uint8_t*)"747";
1703 // std::string pl = "PLMNID7";
1704 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1705 // uint8_t *buf2 = &plvec[0];
1707 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1708 plmnid->buf = (uint8_t*)calloc(3,1);
1710 memcpy(plmnid->buf, buf2, plmnid->size);
1713 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1714 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1715 plmnidlist->pLMN_Identity = *plmnid;
1716 plmnidlist->cu_UP_PM_5GC = pm_format;
1718 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1719 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1720 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1725 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1726 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1727 listitem1->interface_type = 2;
1728 listitem1->o_CU_UP_PM_Container = *meas_cont;
1730 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1731 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1732 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1733 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1735 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1737 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1738 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1739 pfcontainer->present = pres1;
1740 pfcontainer->choice.oCU_UP = *cuupcont;
1742 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1743 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1744 containers_list->performanceContainer = pfcontainer;
1746 E2SM_KPM_IndicationMessage_Format1_t *format =
1747 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1748 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1750 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1752 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1754 indicationmessage->indicationMessage.present = pres;
1756 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1758 char *error_buf = (char*)calloc(300, sizeof(char));
1761 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1762 printf("error length %d\n", errlen);
1763 printf("error buf %s\n", error_buf);
1765 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1768 uint8_t e2smbuffer[8192];
1769 size_t e2smbuffer_size = 8192;
1771 uint8_t e2smbuffer2[8192];
1772 size_t e2smbuffer_size2 = 8192;
1775 asn_encode_to_buffer(opt_cod,
1776 ATS_ALIGNED_BASIC_PER,
1777 &asn_DEF_E2SM_KPM_IndicationMessage,
1778 indicationmessage, e2smbuffer, e2smbuffer_size);
1780 fprintf(stderr, "er encded is %d\n", er.encoded);
1781 fprintf(stderr, "after encoding message\n");
1786 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1789 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1790 //std::string gn = "GNBCUUP5";
1791 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1792 //uint8_t *buf = &gnvec[0];
1793 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1794 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1795 gnbcuupname->size = 8;
1796 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1797 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1800 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1803 bytesdl->buf = (uint8_t*)calloc(1,1);
1804 memcpy(bytesdl->buf, buffer,1);
1807 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1810 bytesul->buf = (uint8_t*)calloc(1,1);
1811 memcpy(bytesul->buf, buffer1, 1);
1814 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1815 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1816 fqilistitem->fiveQI = 9;
1817 fqilistitem->pDCPBytesDL = bytesdl;
1818 fqilistitem->pDCPBytesUL = bytesul;
1822 // std::string sl = "SLICE4";
1823 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1824 // uint8_t *buf1 = &slvec[0];
1825 uint8_t *buf1 = (uint8_t*)"4";
1826 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1828 sst->buf = (uint8_t*)calloc(1,6);
1829 memcpy(sst->buf,buf1,sst->size);
1831 // std::string sd = "SD1";
1832 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1833 // uint8_t *bufz = &sdvec[0];
1834 uint8_t *bufz = (uint8_t*)"SD1";
1835 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1837 sds->buf = (uint8_t*)calloc(1,3);
1838 memcpy(sds->buf, bufz, sds->size);
1841 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1842 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1843 snssai->sST.buf = (uint8_t*)calloc(1,1);
1844 snssai->sST.size = 1;
1845 memcpy(snssai->sST.buf, buf1, 1);
1846 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1847 snssai->sD->buf = (uint8_t*)calloc(1,3);
1848 snssai->sD->size = 3;
1849 memcpy(snssai->sD->buf, bufz, 3);
1853 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1854 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1855 slicelistitem->sliceID = *snssai;
1856 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1858 asn_codec_ctx_t *opt_cod;
1861 uint8_t e2smbuffera[8192];
1862 size_t e2smbuffer_sizea = 8192;
1866 asn_enc_rval_t era =
1867 asn_encode_to_buffer(opt_cod,
1868 ATS_ALIGNED_BASIC_PER,
1869 &asn_DEF_SliceToReportListItem,
1870 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1871 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1872 fprintf(stderr, "after encoding message\n");
1876 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1877 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1878 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1880 uint8_t *buf2 = (uint8_t*)"747";
1881 // std::string pl = "PLMNID7";
1882 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1883 // uint8_t *buf2 = &plvec[0];
1885 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1886 plmnid->buf = (uint8_t*)calloc(3,1);
1888 memcpy(plmnid->buf, buf2, plmnid->size);
1891 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1892 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1893 plmnidlist->pLMN_Identity = *plmnid;
1894 plmnidlist->cu_UP_PM_5GC = pm_format;
1896 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1897 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1898 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1903 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1904 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1905 listitem1->interface_type = 2;
1906 listitem1->o_CU_UP_PM_Container = *meas_cont;
1908 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1909 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1910 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1911 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1913 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1915 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1916 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1917 pfcontainer->present = pres1;
1918 pfcontainer->choice.oCU_UP = *cuupcont;
1920 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1921 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1922 containers_list->performanceContainer = pfcontainer;
1924 E2SM_KPM_IndicationMessage_Format1_t *format =
1925 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1926 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1928 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1930 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1932 indicationmessage->present = pres;
1934 indicationmessage->choice.indicationMessage_Format1 = *format;
1936 char *error_buf = (char*)calloc(300, sizeof(char));
1939 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1940 printf("error length %d\n", errlen);
1941 printf("error buf %s\n", error_buf);
1943 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1946 uint8_t e2smbuffer[8192];
1947 size_t e2smbuffer_size = 8192;
1949 uint8_t e2smbuffer2[8192];
1950 size_t e2smbuffer_size2 = 8192;
1953 asn_encode_to_buffer(opt_cod,
1954 ATS_ALIGNED_BASIC_PER,
1955 &asn_DEF_E2SM_KPM_IndicationMessage,
1956 indicationmessage, e2smbuffer, e2smbuffer_size);
1958 fprintf(stderr, "er encded is %d\n", er.encoded);
1959 fprintf(stderr, "after encoding message\n");
1965 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1966 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1967 std::string gn = "GNBCUUP5";
1968 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1969 uint8_t *buf = &gnvec[0];
1970 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1971 gnbcuupname->size = 8;
1972 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1973 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1976 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1979 bytesdl->buf = (uint8_t*)calloc(1,1);
1980 memcpy(bytesdl->buf, buffer,1);
1983 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1986 bytesul->buf = (uint8_t*)calloc(1,1);
1987 memcpy(bytesul->buf, buffer1, 1);
1990 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1991 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1992 fqilistitem->fiveQI = 9;
1993 fqilistitem->pDCPBytesDL = bytesdl;
1994 fqilistitem->pDCPBytesUL = bytesul;
1998 std::string sl = "SLICE4";
1999 std::vector<uint8_t> slvec(sl.begin(), sl.end());
2000 // uint8_t *buf1 = &slvec[0];
2001 uint8_t *buf1 = (uint8_t*)"SLICE4";
2002 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2004 sst->buf = (uint8_t*)calloc(1,6);
2005 memcpy(sst->buf,buf1,sst->size);
2007 std::string sd = "SD1";
2008 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
2009 // uint8_t *bufz = &sdvec[0];
2010 uint8_t *bufz = (uint8_t*)"SD1";
2011 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2013 sds->buf = (uint8_t*)calloc(1,3);
2014 memcpy(sds->buf, bufz, sds->size);
2017 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
2018 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
2019 snssai->sST.buf = (uint8_t*)calloc(6,1);
2020 snssai->sST.size = 6;
2021 memcpy(snssai->sST.buf, buf1, 6);
2022 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2023 snssai->sD->buf = (uint8_t*)calloc(1,3);
2024 snssai->sD->size = 3;
2025 memcpy(snssai->sD->buf, bufz, 3);
2029 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
2030 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
2031 slicelistitem->sliceID = *snssai;
2032 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
2034 uint8_t e2smbuffera[8192];
2035 size_t e2smbuffer_sizea = 8192;
2038 asn_encode_to_buffer(nullptr,
2039 ATS_ALIGNED_BASIC_PER,
2040 &asn_DEF_SliceToReportListItem,
2041 slicelistitem, e2smbuffera, e2smbuffer_sizea);
2042 fprintf(stderr, "inner er encded is %d\n", era.encoded);
2043 fprintf(stderr, "after encoding message\n");
2045 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
2046 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
2047 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
2049 std::string pl = "PLMNID7";
2050 std::vector<uint8_t> plvec(pl.begin(), pl.end());
2051 uint8_t *buf2 = &plvec[0];
2053 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
2054 plmnid->buf = (uint8_t*)calloc(1,7);
2056 memcpy(plmnid->buf, buf2, plmnid->size);
2059 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
2060 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
2061 plmnidlist->pLMN_Identity = *plmnid;
2062 plmnidlist->cu_UP_PM_5GC = pm_format;
2064 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
2065 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
2066 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
2071 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
2072 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
2073 listitem1->interface_type = 2;
2074 listitem1->o_CU_UP_PM_Container = *meas_cont;
2076 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
2077 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
2078 cuupcont->gNB_CU_UP_Name = gnbcuupname;
2079 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
2081 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
2083 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
2084 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
2085 pfcontainer->present = pres1;
2086 pfcontainer->choice.oCU_UP = *cuupcont;
2088 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
2089 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
2090 containers_list->performanceContainer = pfcontainer;
2092 E2SM_KPM_IndicationMessage_Format1_t *format =
2093 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
2094 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
2096 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
2098 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
2100 indicationmessage->present = pres;
2102 indicationmessage->choice.indicationMessage_Format1 = *format;
2104 char *error_buf = (char*)calloc(300, sizeof(char));
2107 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
2108 printf("error length %d\n", errlen);
2109 printf("error buf %s\n", error_buf);
2112 uint8_t e2smbuffer[8192];
2113 size_t e2smbuffer_size = 8192;
2115 uint8_t e2smbuffer2[8192];
2116 size_t e2smbuffer_size2 = 8192;
2119 asn_encode_to_buffer(nullptr,
2120 ATS_ALIGNED_BASIC_PER,
2121 &asn_DEF_E2SM_KPM_IndicationMessage,
2122 indicationmessage, e2smbuffer, e2smbuffer_size);
2124 fprintf(stderr, "er encded is %d\n", er.encoded);
2125 fprintf(stderr, "after encoding message\n");