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, uint8_t *plmnid_buf, uint8_t *sst_buf, uint8_t *sd_buf,
179 long fqival, long qcival, uint8_t *nrcellid_buf, uint8_t *gnbid_buf, int gnbid_unused,
180 uint8_t *cuupid_buf, uint8_t *duid_buf, uint8_t *cuupname_buf) {
183 //uint8_t *plmnid_buf = (uint8_t*)"747";
184 //uint8_t *sst_buf = (uint8_t*)"1";
185 //uint8_t *sd_buf = (uint8_t*)"100";
187 E2SM_KPM_IndicationHeader_Format1_t* ind_header =
188 (E2SM_KPM_IndicationHeader_Format1_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_Format1_t));
190 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
191 plmnid->buf = (uint8_t*)calloc(3,1);
193 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
198 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
200 sst->buf = (uint8_t*)calloc(1,6);
201 memcpy(sst->buf,sst_buf,sst->size);
204 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
206 sds->buf = (uint8_t*)calloc(1,3);
207 memcpy(sds->buf, sd_buf, sds->size);
210 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
211 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
212 snssai->sST.buf = (uint8_t*)calloc(1,1);
213 snssai->sST.size = 1;
214 memcpy(snssai->sST.buf, sst_buf, 1);
215 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
216 snssai->sD->buf = (uint8_t*)calloc(1,3);
217 snssai->sD->size = 3;
218 memcpy(snssai->sD->buf, sd_buf, 3);
220 BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
221 nrcellid->buf = (uint8_t*)calloc(1,5);
223 memcpy(nrcellid->buf, nrcellid_buf, 5);
225 nrcellid->buf[0] = 0x22;
226 nrcellid->buf[1] = 0x5B;
227 nrcellid->buf[2] = 0xD6;
228 nrcellid->buf[3] = 0x00;
229 nrcellid->buf[4] = 0x70;
231 nrcellid->bits_unused = 4;
233 BIT_STRING_t *gnb_bstring = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
234 gnb_bstring->buf = (uint8_t*)calloc(1,4);
235 gnb_bstring->size = 4;
236 memcpy(gnb_bstring->buf, gnbid_buf, 4);
238 gnb_bstring->buf[0] = 0xB5;
239 gnb_bstring->buf[1] = 0xC6;
240 gnb_bstring->buf[2] = 0x77;
241 gnb_bstring->buf[3] = 0x88;
244 gnb_bstring->bits_unused = gnbid_unused;
246 INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
247 // uint8_t buffer[1];
248 // buffer[0] = 20000;
249 cuup_id->buf = (uint8_t*)calloc(1,1);
250 memcpy(cuup_id->buf, cuupid_buf, 1);
253 INTEGER_t *du_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
254 // uint8_t buffer_duid[1];
255 // buffer_duid[0] = 20000;
256 du_id->buf = (uint8_t*)calloc(1,1);
257 memcpy(du_id->buf, duid_buf, 1);
261 // uint8_t *buf5 = (uint8_t*)"GNBCUUP5";
262 OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
264 cuupname->buf = (uint8_t*)calloc(1,8);
265 memcpy(cuupname->buf, cuupname_buf, cuupname->size);
268 ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID));
269 ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB;
270 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
271 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring;
272 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid;
273 ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id;
277 ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI));
278 ind_header->nRCGI->pLMN_Identity = *plmnid;
279 ind_header->nRCGI->nRCellIdentity = *nrcellid;
281 ind_header->pLMN_Identity = plmnid;
282 // memcpy(ind_header->fiveQI, &fqival, 4);
284 ind_header->sliceID = snssai;
285 // memcpy(ind_header->qci, &qcival, 4);
288 ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name));
289 ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name;
290 ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname;
293 ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID));
294 ind_header->global_GNB_ID->plmn_id = *plmnid;
295 ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
296 ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring;
299 // long msg_type = 2;
300 // ind_header->message_Type = &msg_type;
301 ind_header->gNB_DU_ID = du_id;
304 ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1;
305 ihead->choice.indicationHeader_Format1 = *ind_header;
307 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ihead);
313 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco,
315 uint8_t *nrcellid_buf,
320 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
321 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
322 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
323 ts->size = strlen((char*)buf);
324 memcpy(ts->buf,buf,ts->size);
328 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
329 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
331 // uint8_t *buf2 = (uint8_t*)"747";
333 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
334 plmnidstr->buf = (uint8_t*)calloc(3,1);
336 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
340 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
341 // uint8_t* buf3 = (uint8_t*)"12340";
342 nrcellid->buf = (uint8_t*)calloc(1,5);
343 memcpy(nrcellid->buf, nrcellid_buf, 5);
345 nrcellid->bits_unused = 4;
347 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
348 nrcgi->pLMN_Identity = *plmnidstr;
349 nrcgi->nRCellIdentity = *nrcellid;
353 report_item->nRCGI = *nrcgi;
355 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
356 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
360 // uint8_t* crnti_str = (uint8_t*)"1111";
361 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
362 crnti->buf = (uint8_t*)calloc(1,4);
366 crnti->size = strlen((char*)crnti_buf);
369 memcpy(crnti->buf, crnti_buf, crnti->size);
373 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
376 if (bytes_dl <= 64) {
379 uint8_t buffer[array_size_dl];
380 buffer[0] = bytes_dl & 0xFF;
381 bytesdl->buf = (uint8_t*)calloc(1,1);
382 memcpy(bytesdl->buf,buffer,1);
385 } else if (bytes_dl <= 16384) {
388 uint8_t buffer[array_size_dl];
389 buffer[0] = (bytes_dl >> 8) & 0xFF;
390 buffer[1] = bytes_dl & 0xFF;
391 bytesdl->buf = (uint8_t*)calloc(2,1);
392 memcpy(bytesdl->buf,buffer,2);
395 } else if (bytes_dl <= 4194304) {
398 uint8_t buffer[array_size_dl];
399 buffer[0] = (bytes_dl >> 16) & 0xFF;
400 buffer[1] = (bytes_dl >> 8) & 0xFF;
401 buffer[2] = bytes_dl & 0xFF;
402 bytesdl->buf = (uint8_t*)calloc(3,1);
403 memcpy(bytesdl->buf,buffer,3);
406 } else if (bytes_dl <= 1073741824) {
408 uint8_t buffer[array_size_dl];
409 buffer[0] = (bytes_dl >> 24) & 0xFF;
410 buffer[1] = (bytes_dl >> 16) & 0xFF;
411 buffer[2] = (bytes_dl >> 8) & 0xFF;
412 buffer[3] = bytes_dl & 0xFF;
413 bytesdl->buf = (uint8_t*)calloc(4,1);
414 memcpy(bytesdl->buf,buffer,4);
419 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
423 if (bytes_ul <= 64) {
426 uint8_t buffer[array_size_ul];
427 buffer[0] = bytes_ul & 0xFF;
428 bytesul->buf = (uint8_t*)calloc(1,1);
429 memcpy(bytesul->buf,buffer,1);
432 } else if (bytes_ul <= 16384) {
435 uint8_t buffer[array_size_ul];
436 buffer[0] = (bytes_ul >> 8) & 0xFF;
437 buffer[1] = bytes_ul & 0xFF;
438 bytesul->buf = (uint8_t*)calloc(2,1);
439 memcpy(bytesul->buf,buffer,2);
442 } else if (bytes_ul <= 4194304) {
445 uint8_t buffer[array_size_ul];
446 buffer[0] = (bytes_ul >> 16) & 0xFF;
447 buffer[1] = (bytes_ul >> 8) & 0xFF;
448 buffer[2] = bytes_ul & 0xFF;
449 bytesul->buf = (uint8_t*)calloc(3,1);
450 memcpy(bytesul->buf,buffer,3);
453 } else if (bytes_ul <= 1073741824) {
455 uint8_t buffer[array_size_ul];
456 buffer[0] = (bytes_ul >> 24) & 0xFF;
457 buffer[1] = (bytes_ul >> 16) & 0xFF;
458 buffer[2] = (bytes_ul >> 8) & 0xFF;
459 buffer[3] = bytes_ul & 0xFF;
460 bytesul->buf = (uint8_t*)calloc(4,1);
461 memcpy(bytesul->buf,buffer,4);
467 ue_report_item->c_RNTI = *crnti;
468 ue_report_item->pDCPBytesDL = bytesdl;
469 ue_report_item->pDCPBytesUL = bytesul;
472 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
474 ranco->timestamp = *ts;
475 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
476 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
478 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
482 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
484 uint8_t *nrcellid_buf,
486 const uint8_t *serving_buf,
487 const uint8_t *neighbor_buf) {
488 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
489 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
490 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
491 ts->size = strlen((char*)buf);
492 memcpy(ts->buf,buf,ts->size);
496 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
497 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
499 int plmnid_size = strlen((char*)plmnid_buf);
500 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
501 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
502 plmnidstr->size = plmnid_size;
503 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
507 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
509 // int nrcellid_size = strlen((char*)nrcellid_buf);
510 int nrcellid_size = 5;
511 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
512 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
514 nrcellid->bits_unused = 4;
516 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
517 nrcgi->pLMN_Identity = *plmnidstr;
518 nrcgi->nRCellIdentity = *nrcellid;
522 report_item->nRCGI = *nrcgi;
524 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
525 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
530 int crnti_size = strlen((char*)crnti_buf);
531 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
532 crnti->buf = (uint8_t*)calloc(1, crnti_size);
536 crnti->size = strlen((char*)crnti_buf);
539 memcpy(crnti->buf, crnti_buf, crnti->size);
541 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
543 int serving_buf_len = strlen((char*)serving_buf);
544 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
545 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
546 servingstr->size = serving_buf_len;
547 memcpy(servingstr->buf, serving_buf, servingstr->size);
550 int neighbor_buf_len = strlen((char*)neighbor_buf);
551 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
552 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
553 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
554 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
555 neighborstr->size = neighbor_buf_len;
556 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
558 ue_report_item->c_RNTI = *crnti;
559 ue_report_item->serving_Cell_RF_Type = servingstr;
560 ue_report_item->neighbor_Cell_RF = neighborstr;
563 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
565 ranco->timestamp = *ts;
566 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
567 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
569 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
574 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
576 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
577 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
578 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
579 ts->size = strlen((char*)buf);
580 memcpy(ts->buf,buf,ts->size);
584 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
585 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
587 uint8_t *buf2 = (uint8_t*)"747";
589 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
590 plmnidstr->buf = (uint8_t*)calloc(3,1);
592 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
596 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
597 uint8_t* buf3 = (uint8_t*)"12340";
598 nrcellid->buf = (uint8_t*)calloc(1,5);
599 memcpy(nrcellid->buf, buf3, 5);
601 nrcellid->bits_unused = 4;
603 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
604 nrcgi->pLMN_Identity = *plmnidstr;
605 nrcgi->nRCellIdentity = *nrcellid;
609 report_item->nRCGI = *nrcgi;
611 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
612 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
616 uint8_t* crnti_str = (uint8_t*)"1111";
617 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
618 crnti->buf = (uint8_t*)calloc(1,4);
622 crnti->size = strlen((char*)crnti_str);
625 memcpy(crnti->buf, crnti_str, crnti->size);
627 uint8_t *buf_serving = (uint8_t*)"RSRP10";
628 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
629 servingstr->buf = (uint8_t*)calloc(6,1);
630 servingstr->size = 6;
631 memcpy(servingstr->buf, buf_serving, servingstr->size);
633 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
634 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
635 neighborstr->buf = (uint8_t*)calloc(7,1);
636 neighborstr->size = 7;
637 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
639 ue_report_item->c_RNTI = *crnti;
640 ue_report_item->serving_Cell_RF_Type = servingstr;
641 ue_report_item->neighbor_Cell_RF = neighborstr;
644 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
646 ranco->timestamp = *ts;
647 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
648 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
650 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
655 void encode_kpm_odu_user_level(RAN_Container_t *ranco,
657 uint8_t *nrcellid_buf,
662 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
663 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
664 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
665 ts->size = strlen((char*)buf);
666 memcpy(ts->buf,buf,ts->size);
670 DU_Usage_Report_CellResourceReportItem_t *report_item =
671 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
673 // uint8_t *buf2 = (uint8_t*)"747";
675 int plmnid_size = strlen((char*)plmnid_buf);
676 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
677 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
678 plmnidstr->size = plmnid_size;
679 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
683 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
685 // int nrcellid_size = strlen((char*)nrcellid_buf);
686 int nrcellid_size = 5;
687 nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size);
688 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
689 nrcellid->size = nrcellid_size;
690 nrcellid->bits_unused = 4;
692 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
693 nrcgi->pLMN_Identity = *plmnidstr;
694 nrcgi->nRCellIdentity = *nrcellid;
698 report_item->nRCGI = *nrcgi;
702 DU_Usage_Report_UeResourceReportItem *ue_report_item =
703 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
707 int crnti_size = strlen((char*)crnti_buf);
709 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
710 crnti->buf = (uint8_t*)calloc(1,crnti_size);
714 crnti->size = strlen((char*)crnti_buf);
717 memcpy(crnti->buf, crnti_buf, crnti->size);
722 ue_report_item->c_RNTI = *crnti;
723 ue_report_item->dl_PRBUsage = &prb_usage_dl;
727 ue_report_item->ul_PRBUsage = &prb_usage_ul;
731 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
734 ranco->timestamp = *ts;
735 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
736 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
738 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
743 void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
745 uint8_t *nrcellid_buf,
750 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
751 encode_kpm_odu_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,prb_usage_dl,prb_usage_ul);
753 printf("After creating RAN container, xer printing it\n");
754 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
756 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
757 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
758 containers_list->theRANContainer = ranco;
760 E2SM_KPM_IndicationMessage_Format1_t *format =
761 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
762 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
764 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
766 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
768 indicationmessage->indicationMessage.present = pres;
770 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
772 char *error_buf = (char*)calloc(300, sizeof(char));
775 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
776 printf("error length %d\n", errlen);
777 printf("error buf %s\n", error_buf);
779 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
781 asn_codec_ctx_t *opt_cod;
783 uint8_t e2smbuffer[8192];
784 size_t e2smbuffer_size = 8192;
786 uint8_t e2smbuffer2[8192];
787 size_t e2smbuffer_size2 = 8192;
790 asn_encode_to_buffer(opt_cod,
791 ATS_ALIGNED_BASIC_PER,
792 &asn_DEF_E2SM_KPM_IndicationMessage,
793 indicationmessage, e2smbuffer, e2smbuffer_size);
795 fprintf(stderr, "er encded is %d\n", er.encoded);
796 fprintf(stderr, "after encoding message\n");
801 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
803 uint8_t *nrcellid_buf,
805 const uint8_t *serving_buf,
806 const uint8_t *neighbor_buf) {
808 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
809 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
810 nrcellid_buf, crnti_buf,
811 serving_buf, neighbor_buf);
813 printf("After creating RAN container, xer printing it\n");
814 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
817 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
818 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
819 containers_list->theRANContainer = ranco;
821 E2SM_KPM_IndicationMessage_Format1_t *format =
822 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
823 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
825 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
827 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
829 indicationmessage->indicationMessage.present = pres;
831 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
833 char *error_buf = (char*)calloc(300, sizeof(char));
836 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
837 printf("error length %d\n", errlen);
838 printf("error buf %s\n", error_buf);
840 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
842 asn_codec_ctx_t *opt_cod;
844 uint8_t e2smbuffer[8192];
845 size_t e2smbuffer_size = 8192;
847 uint8_t e2smbuffer2[8192];
848 size_t e2smbuffer_size2 = 8192;
851 asn_encode_to_buffer(opt_cod,
852 ATS_ALIGNED_BASIC_PER,
853 &asn_DEF_E2SM_KPM_IndicationMessage,
854 indicationmessage, e2smbuffer, e2smbuffer_size);
856 fprintf(stderr, "er encded is %d\n", er.encoded);
857 fprintf(stderr, "after encoding message\n");
862 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
864 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
865 encode_kpm_ocucp_user_level(ranco);
867 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
868 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
869 containers_list->theRANContainer = ranco;
871 E2SM_KPM_IndicationMessage_Format1_t *format =
872 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
873 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
875 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
877 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
879 indicationmessage->indicationMessage.present = pres;
881 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
883 char *error_buf = (char*)calloc(300, sizeof(char));
886 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
887 printf("error length %d\n", errlen);
888 printf("error buf %s\n", error_buf);
890 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
892 asn_codec_ctx_t *opt_cod;
894 uint8_t e2smbuffer[8192];
895 size_t e2smbuffer_size = 8192;
897 uint8_t e2smbuffer2[8192];
898 size_t e2smbuffer_size2 = 8192;
901 asn_encode_to_buffer(opt_cod,
902 ATS_ALIGNED_BASIC_PER,
903 &asn_DEF_E2SM_KPM_IndicationMessage,
904 indicationmessage, e2smbuffer, e2smbuffer_size);
906 fprintf(stderr, "er encded is %d\n", er.encoded);
907 fprintf(stderr, "after encoding message\n");
912 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
914 uint8_t *nrcellid_buf,
919 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
920 encode_kpm_ocuup_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,pdcp_bytesdl,pdcp_bytesul);
922 fprintf(stderr, "After creating RAN container, xer printing it\n");
923 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
925 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
926 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
927 containers_list->theRANContainer = ranco;
929 E2SM_KPM_IndicationMessage_Format1_t *format =
930 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
931 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
933 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
935 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
937 indicationmessage->indicationMessage.present = pres;
939 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
941 char *error_buf = (char*)calloc(300, sizeof(char));
944 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
945 printf("error length %d\n", errlen);
946 printf("error buf %s\n", error_buf);
948 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
950 asn_codec_ctx_t *opt_cod;
952 uint8_t e2smbuffer[8192];
953 size_t e2smbuffer_size = 8192;
955 uint8_t e2smbuffer2[8192];
956 size_t e2smbuffer_size2 = 8192;
958 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
961 asn_encode_to_buffer(opt_cod,
962 ATS_ALIGNED_BASIC_PER,
963 &asn_DEF_E2SM_KPM_IndicationMessage,
964 indicationmessage, e2smbuffer, e2smbuffer_size);
966 fprintf(stderr, "er encded is %d\n", er.encoded);
967 fprintf(stderr, "after encoding message\n");
972 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
974 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
975 //encode_kpm_ocuup_user_level(ranco);
978 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
979 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
980 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
981 ts->size = strlen((char*)buf);
982 memcpy(ts->buf,buf,ts->size);
986 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
987 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
989 uint8_t *buf2 = (uint8_t*)"747";
991 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
992 plmnidstr->buf = (uint8_t*)calloc(3,1);
994 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
998 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
999 uint8_t* buf3 = (uint8_t*)"12340";
1000 nrcellid->buf = (uint8_t*)calloc(1,5);
1001 memcpy(nrcellid->buf, buf3, 5);
1003 nrcellid->bits_unused = 4;
1005 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1006 nrcgi->pLMN_Identity = *plmnidstr;
1007 nrcgi->nRCellIdentity = *nrcellid;
1011 report_item->nRCGI = *nrcgi;
1013 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
1014 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
1018 uint8_t* crnti_str = (uint8_t*)"1111";
1019 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
1020 crnti->buf = (uint8_t*)calloc(1,4);
1024 crnti->size = strlen((char*)crnti_str);
1027 memcpy(crnti->buf, crnti_str, crnti->size);
1029 uint8_t *buf_serving = (uint8_t*)"RSRP10";
1030 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1031 servingstr->buf = (uint8_t*)calloc(6,1);
1032 servingstr->size = 6;
1033 memcpy(servingstr->buf, buf_serving, servingstr->size);
1035 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
1036 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1037 neighborstr->buf = (uint8_t*)calloc(7,1);
1038 neighborstr->size = 7;
1039 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
1041 ue_report_item->c_RNTI = *crnti;
1042 ue_report_item->serving_Cell_RF_Type = servingstr;
1043 ue_report_item->neighbor_Cell_RF = neighborstr;
1046 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
1048 ranco->timestamp = *ts;
1049 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
1050 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
1052 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
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->theRANContainer = ranco;
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 int 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);
1080 asn_codec_ctx_t *opt_cod;
1082 uint8_t e2smbuffer[8192];
1083 size_t e2smbuffer_size = 8192;
1085 uint8_t e2smbuffer2[8192];
1086 size_t e2smbuffer_size2 = 8192;
1089 asn_encode_to_buffer(opt_cod,
1090 ATS_ALIGNED_BASIC_PER,
1091 &asn_DEF_E2SM_KPM_IndicationMessage,
1092 indicationmessage, e2smbuffer, e2smbuffer_size);
1094 fprintf(stderr, "er encded is %d\n", er.encoded);
1095 fprintf(stderr, "after encoding message\n");
1100 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1106 uint8_t* plmnid_buf,
1107 uint8_t* nrcellid_buf,
1112 asn_codec_ctx_t *opt_cod;
1114 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1115 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1116 fqi_item->fiveQI = fiveqi;
1117 fqi_item->dl_PRBUsage = &dl_prb_usage;
1118 fqi_item->ul_PRBUsage = &ul_prb_usage;
1120 uint8_t *buf1 = (uint8_t*)"4";
1121 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1123 sst->buf = (uint8_t*)calloc(1,6);
1124 memcpy(sst->buf,buf1,sst->size);
1126 // std::string sd = "SD1";
1127 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1128 // uint8_t *bufz = &sdvec[0];
1129 uint8_t *bufz = (uint8_t*)"SD1";
1130 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1132 sds->buf = (uint8_t*)calloc(1,3);
1133 memcpy(sds->buf, bufz, sds->size);
1136 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1137 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1138 snssai->sST.buf = (uint8_t*)calloc(1,1);
1139 snssai->sST.size = 1;
1140 memcpy(snssai->sST.buf, sst_buf, 1);
1141 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1142 snssai->sD->buf = (uint8_t*)calloc(1,3);
1143 snssai->sD->size = 3;
1144 memcpy(snssai->sD->buf, sd_buf, 3);
1147 SlicePerPlmnPerCellListItem_t *sliceitem =
1148 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1149 sliceitem->sliceID = *snssai;
1150 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1152 uint8_t *buf2 = (uint8_t*)"747";
1154 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1155 plmnid->buf = (uint8_t*)calloc(3,1);
1157 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1159 ServedPlmnPerCellListItem_t *percellitem1 =
1160 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1161 percellitem1->pLMN_Identity = *plmnid;
1162 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1163 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1165 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1166 plmnidstr->buf = (uint8_t*)calloc(3,1);
1167 plmnidstr->size = 3;
1168 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
1172 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1173 uint8_t* buf3 = (uint8_t*)"12340";
1174 nrcellid->buf = (uint8_t*)calloc(1,5);
1175 memcpy(nrcellid->buf, nrcellid_buf, 5);
1177 nrcellid->bits_unused = 4;
1179 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1180 nrcgi->pLMN_Identity = *plmnidstr;
1181 nrcgi->nRCellIdentity = *nrcellid;
1184 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1185 listitem1->nRCGI = *nrcgi;
1186 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
1187 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
1188 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1191 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1192 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1193 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1195 PF_Container_PR pres1 = PF_Container_PR_oDU;
1197 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1198 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1199 pfcontainer->present = pres1;
1200 pfcontainer->choice.oDU = *ducont;
1202 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1203 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1204 containers_list->performanceContainer = pfcontainer;
1206 E2SM_KPM_IndicationMessage_Format1_t *format =
1207 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1208 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1210 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1212 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1214 indicationmessage->indicationMessage.present = pres;
1216 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1218 char *error_buf = (char*)calloc(300, sizeof(char));
1221 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1222 printf("error length %d\n", errlen);
1223 printf("error buf %s\n", error_buf);
1225 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1228 uint8_t e2smbuffer[8192];
1229 size_t e2smbuffer_size = 8192;
1231 uint8_t e2smbuffer2[8192];
1232 size_t e2smbuffer_size2 = 8192;
1235 asn_encode_to_buffer(opt_cod,
1236 ATS_ALIGNED_BASIC_PER,
1237 &asn_DEF_E2SM_KPM_IndicationMessage,
1238 indicationmessage, e2smbuffer, e2smbuffer_size);
1240 fprintf(stderr, "er encded is %d\n", er.encoded);
1241 fprintf(stderr, "after encoding message\n");
1247 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1250 long dl_prb_usage = 50;
1251 long ul_prb_usage = 70;
1253 asn_codec_ctx_t *opt_cod;
1255 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1256 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1257 fqi_item->fiveQI = fiveqi;
1258 fqi_item->dl_PRBUsage = &dl_prb_usage;
1259 fqi_item->ul_PRBUsage = &ul_prb_usage;
1261 uint8_t *buf1 = (uint8_t*)"4";
1262 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1264 sst->buf = (uint8_t*)calloc(1,6);
1265 memcpy(sst->buf,buf1,sst->size);
1267 // std::string sd = "SD1";
1268 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1269 // uint8_t *bufz = &sdvec[0];
1270 uint8_t *bufz = (uint8_t*)"SD1";
1271 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1273 sds->buf = (uint8_t*)calloc(1,3);
1274 memcpy(sds->buf, bufz, sds->size);
1277 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1278 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1279 snssai->sST.buf = (uint8_t*)calloc(1,1);
1280 snssai->sST.size = 1;
1281 memcpy(snssai->sST.buf, buf1, 1);
1282 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1283 snssai->sD->buf = (uint8_t*)calloc(1,3);
1284 snssai->sD->size = 3;
1285 memcpy(snssai->sD->buf, bufz, 3);
1288 SlicePerPlmnPerCellListItem_t *sliceitem =
1289 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1290 sliceitem->sliceID = *snssai;
1291 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1293 uint8_t *buf2 = (uint8_t*)"747";
1295 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1296 plmnid->buf = (uint8_t*)calloc(3,1);
1298 memcpy(plmnid->buf, buf2, plmnid->size);
1300 ServedPlmnPerCellListItem_t *percellitem1 =
1301 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1302 percellitem1->pLMN_Identity = *plmnid;
1303 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1304 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1306 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1307 plmnidstr->buf = (uint8_t*)calloc(3,1);
1308 plmnidstr->size = 3;
1309 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1313 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1314 uint8_t* buf3 = (uint8_t*)"12340";
1315 nrcellid->buf = (uint8_t*)calloc(1,5);
1316 memcpy(nrcellid->buf, buf3, 5);
1318 nrcellid->bits_unused = 4;
1320 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1321 nrcgi->pLMN_Identity = *plmnidstr;
1322 nrcgi->nRCellIdentity = *nrcellid;
1324 long dl_prbs = (long)100;
1325 long ul_prbs = (long)120;
1327 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1328 listitem1->nRCGI = *nrcgi;
1329 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1330 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1331 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1334 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1335 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1336 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1338 PF_Container_PR pres1 = PF_Container_PR_oDU;
1340 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1341 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1342 pfcontainer->present = pres1;
1343 pfcontainer->choice.oDU = *ducont;
1345 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1346 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1347 containers_list->performanceContainer = pfcontainer;
1349 E2SM_KPM_IndicationMessage_Format1_t *format =
1350 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1351 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1353 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1355 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1357 indicationmessage->indicationMessage.present = pres;
1359 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1361 char *error_buf = (char*)calloc(300, sizeof(char));
1364 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1365 printf("error length %d\n", errlen);
1366 printf("error buf %s\n", error_buf);
1368 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1371 uint8_t e2smbuffer[8192];
1372 size_t e2smbuffer_size = 8192;
1374 uint8_t e2smbuffer2[8192];
1375 size_t e2smbuffer_size2 = 8192;
1378 asn_encode_to_buffer(opt_cod,
1379 ATS_ALIGNED_BASIC_PER,
1380 &asn_DEF_E2SM_KPM_IndicationMessage,
1381 indicationmessage, e2smbuffer, e2smbuffer_size);
1383 fprintf(stderr, "er encded is %d\n", er.encoded);
1384 fprintf(stderr, "after encoding message\n");
1389 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1390 uint8_t *gnbcuupname_buf,
1395 uint8_t *plmnid_buf) {
1397 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1400 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1401 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1402 gnbcuupname->size = 8;
1403 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1404 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1407 //We need to convert bytes_dl into array of uint8_t
1411 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1413 if (bytes_dl <= 64) {
1416 uint8_t buffer[array_size_dl];
1417 buffer[0] = bytes_dl & 0xFF;
1418 bytesdl->buf = (uint8_t*)calloc(1,1);
1419 memcpy(bytesdl->buf,buffer,1);
1422 } else if (bytes_dl <= 16384) {
1425 uint8_t buffer[array_size_dl];
1426 buffer[0] = (bytes_dl >> 8) & 0xFF;
1427 buffer[1] = bytes_dl & 0xFF;
1428 bytesdl->buf = (uint8_t*)calloc(2,1);
1429 memcpy(bytesdl->buf,buffer,2);
1432 } else if (bytes_dl <= 4194304) {
1435 uint8_t buffer[array_size_dl];
1436 buffer[0] = (bytes_dl >> 16) & 0xFF;
1437 buffer[1] = (bytes_dl >> 8) & 0xFF;
1438 buffer[2] = bytes_dl & 0xFF;
1439 bytesdl->buf = (uint8_t*)calloc(3,1);
1440 memcpy(bytesdl->buf,buffer,3);
1443 } else if (bytes_dl <= 1073741824) {
1445 uint8_t buffer[array_size_dl];
1446 buffer[0] = (bytes_dl >> 24) & 0xFF;
1447 buffer[1] = (bytes_dl >> 16) & 0xFF;
1448 buffer[2] = (bytes_dl >> 8) & 0xFF;
1449 buffer[3] = bytes_dl & 0xFF;
1450 bytesdl->buf = (uint8_t*)calloc(4,1);
1451 memcpy(bytesdl->buf,buffer,4);
1456 //We need to convert bytes_ul into array of uint8_t
1457 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1461 if (bytes_ul <= 64) {
1464 uint8_t buffer[array_size_ul];
1465 buffer[0] = bytes_ul & 0xFF;
1466 bytesul->buf = (uint8_t*)calloc(1,1);
1467 memcpy(bytesul->buf,buffer,1);
1470 } else if (bytes_ul <= 16384) {
1473 uint8_t buffer[array_size_ul];
1474 buffer[0] = (bytes_ul >> 8) & 0xFF;
1475 buffer[1] = bytes_ul & 0xFF;
1476 bytesul->buf = (uint8_t*)calloc(2,1);
1477 memcpy(bytesul->buf,buffer,2);
1480 } else if (bytes_ul <= 4194304) {
1483 uint8_t buffer[array_size_ul];
1484 buffer[0] = (bytes_ul >> 16) & 0xFF;
1485 buffer[1] = (bytes_ul >> 8) & 0xFF;
1486 buffer[2] = bytes_ul & 0xFF;
1487 bytesul->buf = (uint8_t*)calloc(3,1);
1488 memcpy(bytesul->buf,buffer,3);
1491 } else if (bytes_ul <= 1073741824) {
1493 uint8_t buffer[array_size_ul];
1494 buffer[0] = (bytes_ul >> 24) & 0xFF;
1495 buffer[1] = (bytes_ul >> 16) & 0xFF;
1496 buffer[2] = (bytes_ul >> 8) & 0xFF;
1497 buffer[3] = bytes_ul & 0xFF;
1498 bytesul->buf = (uint8_t*)calloc(4,1);
1499 memcpy(bytesul->buf,buffer,4);
1504 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1505 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1506 fqilistitem->fiveQI = fqi;
1507 fqilistitem->pDCPBytesDL = bytesdl;
1508 fqilistitem->pDCPBytesUL = bytesul;
1511 uint8_t *buf1 = (uint8_t*)"4";
1512 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1514 sst->buf = (uint8_t*)calloc(1,6);
1515 memcpy(sst->buf,sst_buf,sst->size);
1518 uint8_t *bufz = (uint8_t*)"SD1";
1519 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1521 sds->buf = (uint8_t*)calloc(1,3);
1522 memcpy(sds->buf, sd_buf, sds->size);
1525 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1526 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1527 snssai->sST.buf = (uint8_t*)calloc(1,1);
1528 snssai->sST.size = 1;
1529 memcpy(snssai->sST.buf, sst_buf, 1);
1530 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1531 snssai->sD->buf = (uint8_t*)calloc(1,3);
1532 snssai->sD->size = 3;
1533 memcpy(snssai->sD->buf, sd_buf, 3);
1537 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1538 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1539 slicelistitem->sliceID = *snssai;
1540 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1542 asn_codec_ctx_t *opt_cod;
1545 uint8_t e2smbuffera[8192];
1546 size_t e2smbuffer_sizea = 8192;
1550 asn_enc_rval_t era =
1551 asn_encode_to_buffer(opt_cod,
1552 ATS_ALIGNED_BASIC_PER,
1553 &asn_DEF_SliceToReportListItem,
1554 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1555 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1556 fprintf(stderr, "after encoding message\n");
1560 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1561 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1562 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1564 uint8_t *buf2 = (uint8_t*)"747";
1565 // std::string pl = "PLMNID7";
1566 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1567 // uint8_t *buf2 = &plvec[0];
1569 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1570 plmnid->buf = (uint8_t*)calloc(3,1);
1572 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1575 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1576 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1577 plmnidlist->pLMN_Identity = *plmnid;
1578 plmnidlist->cu_UP_PM_5GC = pm_format;
1580 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1581 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1582 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1587 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1588 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1589 listitem1->interface_type = 2;
1590 listitem1->o_CU_UP_PM_Container = *meas_cont;
1592 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1593 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1594 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1595 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1597 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1599 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1600 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1601 pfcontainer->present = pres1;
1602 pfcontainer->choice.oCU_UP = *cuupcont;
1604 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1605 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1606 containers_list->performanceContainer = pfcontainer;
1608 E2SM_KPM_IndicationMessage_Format1_t *format =
1609 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1610 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1612 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1614 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1616 indicationmessage->indicationMessage.present = pres;
1618 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1620 char *error_buf = (char*)calloc(300, sizeof(char));
1623 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1624 printf("error length %d\n", errlen);
1625 printf("error buf %s\n", error_buf);
1627 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1630 uint8_t e2smbuffer[8192];
1631 size_t e2smbuffer_size = 8192;
1633 uint8_t e2smbuffer2[8192];
1634 size_t e2smbuffer_size2 = 8192;
1637 asn_encode_to_buffer(opt_cod,
1638 ATS_ALIGNED_BASIC_PER,
1639 &asn_DEF_E2SM_KPM_IndicationMessage,
1640 indicationmessage, e2smbuffer, e2smbuffer_size);
1642 fprintf(stderr, "er encded is %d\n", er.encoded);
1643 fprintf(stderr, "after encoding message\n");
1648 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1650 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1653 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1654 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1655 gnbcuupname->size = 8;
1656 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1657 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1660 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1663 bytesdl->buf = (uint8_t*)calloc(1,1);
1664 memcpy(bytesdl->buf, buffer,1);
1667 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1670 bytesul->buf = (uint8_t*)calloc(1,1);
1671 memcpy(bytesul->buf, buffer1, 1);
1674 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1675 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1676 fqilistitem->fiveQI = 9;
1677 fqilistitem->pDCPBytesDL = bytesdl;
1678 fqilistitem->pDCPBytesUL = bytesul;
1681 uint8_t *buf1 = (uint8_t*)"4";
1682 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1684 sst->buf = (uint8_t*)calloc(1,6);
1685 memcpy(sst->buf,buf1,sst->size);
1688 uint8_t *bufz = (uint8_t*)"SD1";
1689 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1691 sds->buf = (uint8_t*)calloc(1,3);
1692 memcpy(sds->buf, bufz, sds->size);
1695 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1696 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1697 snssai->sST.buf = (uint8_t*)calloc(1,1);
1698 snssai->sST.size = 1;
1699 memcpy(snssai->sST.buf, buf1, 1);
1700 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1701 snssai->sD->buf = (uint8_t*)calloc(1,3);
1702 snssai->sD->size = 3;
1703 memcpy(snssai->sD->buf, bufz, 3);
1707 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1708 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1709 slicelistitem->sliceID = *snssai;
1710 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1712 asn_codec_ctx_t *opt_cod;
1715 uint8_t e2smbuffera[8192];
1716 size_t e2smbuffer_sizea = 8192;
1720 asn_enc_rval_t era =
1721 asn_encode_to_buffer(opt_cod,
1722 ATS_ALIGNED_BASIC_PER,
1723 &asn_DEF_SliceToReportListItem,
1724 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1725 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1726 fprintf(stderr, "after encoding message\n");
1730 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1731 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1732 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1734 uint8_t *buf2 = (uint8_t*)"747";
1735 // std::string pl = "PLMNID7";
1736 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1737 // uint8_t *buf2 = &plvec[0];
1739 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1740 plmnid->buf = (uint8_t*)calloc(3,1);
1742 memcpy(plmnid->buf, buf2, plmnid->size);
1745 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1746 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1747 plmnidlist->pLMN_Identity = *plmnid;
1748 plmnidlist->cu_UP_PM_5GC = pm_format;
1750 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1751 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1752 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1757 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1758 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1759 listitem1->interface_type = 2;
1760 listitem1->o_CU_UP_PM_Container = *meas_cont;
1762 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1763 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1764 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1765 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1767 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1769 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1770 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1771 pfcontainer->present = pres1;
1772 pfcontainer->choice.oCU_UP = *cuupcont;
1774 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1775 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1776 containers_list->performanceContainer = pfcontainer;
1778 E2SM_KPM_IndicationMessage_Format1_t *format =
1779 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1780 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1782 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1784 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1786 indicationmessage->indicationMessage.present = pres;
1788 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1790 char *error_buf = (char*)calloc(300, sizeof(char));
1793 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1794 printf("error length %d\n", errlen);
1795 printf("error buf %s\n", error_buf);
1797 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1800 uint8_t e2smbuffer[8192];
1801 size_t e2smbuffer_size = 8192;
1803 uint8_t e2smbuffer2[8192];
1804 size_t e2smbuffer_size2 = 8192;
1807 asn_encode_to_buffer(opt_cod,
1808 ATS_ALIGNED_BASIC_PER,
1809 &asn_DEF_E2SM_KPM_IndicationMessage,
1810 indicationmessage, e2smbuffer, e2smbuffer_size);
1812 fprintf(stderr, "er encded is %d\n", er.encoded);
1813 fprintf(stderr, "after encoding message\n");
1818 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1821 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1822 //std::string gn = "GNBCUUP5";
1823 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1824 //uint8_t *buf = &gnvec[0];
1825 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1826 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1827 gnbcuupname->size = 8;
1828 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1829 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1832 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1835 bytesdl->buf = (uint8_t*)calloc(1,1);
1836 memcpy(bytesdl->buf, buffer,1);
1839 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1842 bytesul->buf = (uint8_t*)calloc(1,1);
1843 memcpy(bytesul->buf, buffer1, 1);
1846 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1847 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1848 fqilistitem->fiveQI = 9;
1849 fqilistitem->pDCPBytesDL = bytesdl;
1850 fqilistitem->pDCPBytesUL = bytesul;
1854 // std::string sl = "SLICE4";
1855 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1856 // uint8_t *buf1 = &slvec[0];
1857 uint8_t *buf1 = (uint8_t*)"4";
1858 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1860 sst->buf = (uint8_t*)calloc(1,6);
1861 memcpy(sst->buf,buf1,sst->size);
1863 // std::string sd = "SD1";
1864 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1865 // uint8_t *bufz = &sdvec[0];
1866 uint8_t *bufz = (uint8_t*)"SD1";
1867 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1869 sds->buf = (uint8_t*)calloc(1,3);
1870 memcpy(sds->buf, bufz, sds->size);
1873 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1874 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1875 snssai->sST.buf = (uint8_t*)calloc(1,1);
1876 snssai->sST.size = 1;
1877 memcpy(snssai->sST.buf, buf1, 1);
1878 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1879 snssai->sD->buf = (uint8_t*)calloc(1,3);
1880 snssai->sD->size = 3;
1881 memcpy(snssai->sD->buf, bufz, 3);
1885 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1886 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1887 slicelistitem->sliceID = *snssai;
1888 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1890 asn_codec_ctx_t *opt_cod;
1893 uint8_t e2smbuffera[8192];
1894 size_t e2smbuffer_sizea = 8192;
1898 asn_enc_rval_t era =
1899 asn_encode_to_buffer(opt_cod,
1900 ATS_ALIGNED_BASIC_PER,
1901 &asn_DEF_SliceToReportListItem,
1902 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1903 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1904 fprintf(stderr, "after encoding message\n");
1908 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1909 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1910 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1912 uint8_t *buf2 = (uint8_t*)"747";
1913 // std::string pl = "PLMNID7";
1914 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1915 // uint8_t *buf2 = &plvec[0];
1917 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1918 plmnid->buf = (uint8_t*)calloc(3,1);
1920 memcpy(plmnid->buf, buf2, plmnid->size);
1923 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1924 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1925 plmnidlist->pLMN_Identity = *plmnid;
1926 plmnidlist->cu_UP_PM_5GC = pm_format;
1928 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1929 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1930 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1935 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1936 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1937 listitem1->interface_type = 2;
1938 listitem1->o_CU_UP_PM_Container = *meas_cont;
1940 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1941 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1942 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1943 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1945 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1947 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1948 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1949 pfcontainer->present = pres1;
1950 pfcontainer->choice.oCU_UP = *cuupcont;
1952 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1953 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1954 containers_list->performanceContainer = pfcontainer;
1956 E2SM_KPM_IndicationMessage_Format1_t *format =
1957 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1958 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1960 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1962 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1964 indicationmessage->present = pres;
1966 indicationmessage->choice.indicationMessage_Format1 = *format;
1968 char *error_buf = (char*)calloc(300, sizeof(char));
1971 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1972 printf("error length %d\n", errlen);
1973 printf("error buf %s\n", error_buf);
1975 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1978 uint8_t e2smbuffer[8192];
1979 size_t e2smbuffer_size = 8192;
1981 uint8_t e2smbuffer2[8192];
1982 size_t e2smbuffer_size2 = 8192;
1985 asn_encode_to_buffer(opt_cod,
1986 ATS_ALIGNED_BASIC_PER,
1987 &asn_DEF_E2SM_KPM_IndicationMessage,
1988 indicationmessage, e2smbuffer, e2smbuffer_size);
1990 fprintf(stderr, "er encded is %d\n", er.encoded);
1991 fprintf(stderr, "after encoding message\n");
1997 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1998 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1999 std::string gn = "GNBCUUP5";
2000 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
2001 uint8_t *buf = &gnvec[0];
2002 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2003 gnbcuupname->size = 8;
2004 gnbcuupname->buf = (uint8_t*)calloc(1,8);
2005 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
2008 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2011 bytesdl->buf = (uint8_t*)calloc(1,1);
2012 memcpy(bytesdl->buf, buffer,1);
2015 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2018 bytesul->buf = (uint8_t*)calloc(1,1);
2019 memcpy(bytesul->buf, buffer1, 1);
2022 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
2023 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
2024 fqilistitem->fiveQI = 9;
2025 fqilistitem->pDCPBytesDL = bytesdl;
2026 fqilistitem->pDCPBytesUL = bytesul;
2030 std::string sl = "SLICE4";
2031 std::vector<uint8_t> slvec(sl.begin(), sl.end());
2032 // uint8_t *buf1 = &slvec[0];
2033 uint8_t *buf1 = (uint8_t*)"SLICE4";
2034 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2036 sst->buf = (uint8_t*)calloc(1,6);
2037 memcpy(sst->buf,buf1,sst->size);
2039 std::string sd = "SD1";
2040 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
2041 // uint8_t *bufz = &sdvec[0];
2042 uint8_t *bufz = (uint8_t*)"SD1";
2043 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2045 sds->buf = (uint8_t*)calloc(1,3);
2046 memcpy(sds->buf, bufz, sds->size);
2049 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
2050 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
2051 snssai->sST.buf = (uint8_t*)calloc(6,1);
2052 snssai->sST.size = 6;
2053 memcpy(snssai->sST.buf, buf1, 6);
2054 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2055 snssai->sD->buf = (uint8_t*)calloc(1,3);
2056 snssai->sD->size = 3;
2057 memcpy(snssai->sD->buf, bufz, 3);
2061 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
2062 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
2063 slicelistitem->sliceID = *snssai;
2064 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
2066 uint8_t e2smbuffera[8192];
2067 size_t e2smbuffer_sizea = 8192;
2070 asn_encode_to_buffer(nullptr,
2071 ATS_ALIGNED_BASIC_PER,
2072 &asn_DEF_SliceToReportListItem,
2073 slicelistitem, e2smbuffera, e2smbuffer_sizea);
2074 fprintf(stderr, "inner er encded is %d\n", era.encoded);
2075 fprintf(stderr, "after encoding message\n");
2077 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
2078 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
2079 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
2081 std::string pl = "PLMNID7";
2082 std::vector<uint8_t> plvec(pl.begin(), pl.end());
2083 uint8_t *buf2 = &plvec[0];
2085 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
2086 plmnid->buf = (uint8_t*)calloc(1,7);
2088 memcpy(plmnid->buf, buf2, plmnid->size);
2091 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
2092 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
2093 plmnidlist->pLMN_Identity = *plmnid;
2094 plmnidlist->cu_UP_PM_5GC = pm_format;
2096 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
2097 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
2098 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
2103 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
2104 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
2105 listitem1->interface_type = 2;
2106 listitem1->o_CU_UP_PM_Container = *meas_cont;
2108 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
2109 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
2110 cuupcont->gNB_CU_UP_Name = gnbcuupname;
2111 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
2113 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
2115 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
2116 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
2117 pfcontainer->present = pres1;
2118 pfcontainer->choice.oCU_UP = *cuupcont;
2120 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
2121 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
2122 containers_list->performanceContainer = pfcontainer;
2124 E2SM_KPM_IndicationMessage_Format1_t *format =
2125 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
2126 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
2128 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
2130 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
2132 indicationmessage->present = pres;
2134 indicationmessage->choice.indicationMessage_Format1 = *format;
2136 char *error_buf = (char*)calloc(300, sizeof(char));
2139 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
2140 printf("error length %d\n", errlen);
2141 printf("error buf %s\n", error_buf);
2144 uint8_t e2smbuffer[8192];
2145 size_t e2smbuffer_size = 8192;
2147 uint8_t e2smbuffer2[8192];
2148 size_t e2smbuffer_size2 = 8192;
2151 asn_encode_to_buffer(nullptr,
2152 ATS_ALIGNED_BASIC_PER,
2153 &asn_DEF_E2SM_KPM_IndicationMessage,
2154 indicationmessage, e2smbuffer, e2smbuffer_size);
2156 fprintf(stderr, "er encded is %d\n", er.encoded);
2157 fprintf(stderr, "after encoding message\n");