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);
217 BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
218 nrcellid->buf = (uint8_t*)calloc(1,5);
220 nrcellid->buf[0] = 0x22;
221 nrcellid->buf[1] = 0x5B;
222 nrcellid->buf[2] = 0xD6;
223 nrcellid->buf[3] = 0x00;
224 nrcellid->buf[4] = 0x70;
226 nrcellid->bits_unused = 4;
228 BIT_STRING_t *gnb_bstring = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
229 gnb_bstring->buf = (uint8_t*)calloc(1,4);
230 gnb_bstring->size = 4;
231 gnb_bstring->buf[0] = 0xB5;
232 gnb_bstring->buf[1] = 0xC6;
233 gnb_bstring->buf[2] = 0x77;
234 gnb_bstring->buf[3] = 0x88;
236 gnb_bstring->bits_unused = 3;
238 INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
241 cuup_id->buf = (uint8_t*)calloc(1,1);
242 memcpy(cuup_id->buf, buffer, 1);
245 INTEGER_t *du_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
246 uint8_t buffer_duid[1];
247 buffer_duid[0] = 20000;
248 du_id->buf = (uint8_t*)calloc(1,1);
249 memcpy(du_id->buf, buffer_duid, 1);
253 uint8_t *buf5 = (uint8_t*)"GNBCUUP5";
254 OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
256 cuupname->buf = (uint8_t*)calloc(1,8);
257 memcpy(cuupname->buf, buf5, cuupname->size);
260 ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID));
261 ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB;
262 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
263 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring;
264 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid;
265 ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id;
269 ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI));
270 ind_header->nRCGI->pLMN_Identity = *plmnid;
271 ind_header->nRCGI->nRCellIdentity = *nrcellid;
273 ind_header->pLMN_Identity = plmnid;
274 // memcpy(ind_header->fiveQI, &fqival, 4);
276 ind_header->sliceID = snssai;
277 // memcpy(ind_header->qci, &qcival, 4);
280 ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name));
281 ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name;
282 ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname;
285 ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID));
286 ind_header->global_GNB_ID->plmn_id = *plmnid;
287 ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
288 ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring;
291 // long msg_type = 2;
292 // ind_header->message_Type = &msg_type;
293 ind_header->gNB_DU_ID = du_id;
296 ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1;
297 ihead->choice.indicationHeader_Format1 = *ind_header;
299 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ihead);
305 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco,
307 uint8_t *nrcellid_buf,
312 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
313 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
314 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
315 ts->size = strlen((char*)buf);
316 memcpy(ts->buf,buf,ts->size);
320 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
321 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
323 // uint8_t *buf2 = (uint8_t*)"747";
325 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
326 plmnidstr->buf = (uint8_t*)calloc(3,1);
328 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
332 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
333 // uint8_t* buf3 = (uint8_t*)"12340";
334 nrcellid->buf = (uint8_t*)calloc(1,5);
335 memcpy(nrcellid->buf, nrcellid_buf, 5);
337 nrcellid->bits_unused = 4;
339 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
340 nrcgi->pLMN_Identity = *plmnidstr;
341 nrcgi->nRCellIdentity = *nrcellid;
345 report_item->nRCGI = *nrcgi;
347 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
348 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
352 // uint8_t* crnti_str = (uint8_t*)"1111";
353 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
354 crnti->buf = (uint8_t*)calloc(1,4);
358 crnti->size = strlen((char*)crnti_buf);
361 memcpy(crnti->buf, crnti_buf, crnti->size);
365 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
368 if (bytes_dl <= 64) {
371 uint8_t buffer[array_size_dl];
372 buffer[0] = bytes_dl & 0xFF;
373 bytesdl->buf = (uint8_t*)calloc(1,1);
374 memcpy(bytesdl->buf,buffer,1);
377 } else if (bytes_dl <= 16384) {
380 uint8_t buffer[array_size_dl];
381 buffer[0] = (bytes_dl >> 8) & 0xFF;
382 buffer[1] = bytes_dl & 0xFF;
383 bytesdl->buf = (uint8_t*)calloc(2,1);
384 memcpy(bytesdl->buf,buffer,2);
387 } else if (bytes_dl <= 4194304) {
390 uint8_t buffer[array_size_dl];
391 buffer[0] = (bytes_dl >> 16) & 0xFF;
392 buffer[1] = (bytes_dl >> 8) & 0xFF;
393 buffer[2] = bytes_dl & 0xFF;
394 bytesdl->buf = (uint8_t*)calloc(3,1);
395 memcpy(bytesdl->buf,buffer,3);
398 } else if (bytes_dl <= 1073741824) {
400 uint8_t buffer[array_size_dl];
401 buffer[0] = (bytes_dl >> 24) & 0xFF;
402 buffer[1] = (bytes_dl >> 16) & 0xFF;
403 buffer[2] = (bytes_dl >> 8) & 0xFF;
404 buffer[3] = bytes_dl & 0xFF;
405 bytesdl->buf = (uint8_t*)calloc(4,1);
406 memcpy(bytesdl->buf,buffer,4);
411 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
415 if (bytes_ul <= 64) {
418 uint8_t buffer[array_size_ul];
419 buffer[0] = bytes_ul & 0xFF;
420 bytesul->buf = (uint8_t*)calloc(1,1);
421 memcpy(bytesul->buf,buffer,1);
424 } else if (bytes_ul <= 16384) {
427 uint8_t buffer[array_size_ul];
428 buffer[0] = (bytes_ul >> 8) & 0xFF;
429 buffer[1] = bytes_ul & 0xFF;
430 bytesul->buf = (uint8_t*)calloc(2,1);
431 memcpy(bytesul->buf,buffer,2);
434 } else if (bytes_ul <= 4194304) {
437 uint8_t buffer[array_size_ul];
438 buffer[0] = (bytes_ul >> 16) & 0xFF;
439 buffer[1] = (bytes_ul >> 8) & 0xFF;
440 buffer[2] = bytes_ul & 0xFF;
441 bytesul->buf = (uint8_t*)calloc(3,1);
442 memcpy(bytesul->buf,buffer,3);
445 } else if (bytes_ul <= 1073741824) {
447 uint8_t buffer[array_size_ul];
448 buffer[0] = (bytes_ul >> 24) & 0xFF;
449 buffer[1] = (bytes_ul >> 16) & 0xFF;
450 buffer[2] = (bytes_ul >> 8) & 0xFF;
451 buffer[3] = bytes_ul & 0xFF;
452 bytesul->buf = (uint8_t*)calloc(4,1);
453 memcpy(bytesul->buf,buffer,4);
459 ue_report_item->c_RNTI = *crnti;
460 ue_report_item->pDCPBytesDL = bytesdl;
461 ue_report_item->pDCPBytesUL = bytesul;
464 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
466 ranco->timestamp = *ts;
467 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
468 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
470 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
474 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
476 uint8_t *nrcellid_buf,
478 const uint8_t *serving_buf,
479 const uint8_t *neighbor_buf) {
480 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
481 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
482 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
483 ts->size = strlen((char*)buf);
484 memcpy(ts->buf,buf,ts->size);
488 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
489 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
491 int plmnid_size = strlen((char*)plmnid_buf);
492 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
493 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
494 plmnidstr->size = plmnid_size;
495 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
499 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
501 int nrcellid_size = strlen((char*)nrcellid_buf);
502 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
503 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
505 nrcellid->bits_unused = 4;
507 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
508 nrcgi->pLMN_Identity = *plmnidstr;
509 nrcgi->nRCellIdentity = *nrcellid;
513 report_item->nRCGI = *nrcgi;
515 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
516 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
521 int crnti_size = strlen((char*)crnti_buf);
522 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
523 crnti->buf = (uint8_t*)calloc(1, crnti_size);
527 crnti->size = strlen((char*)crnti_buf);
530 memcpy(crnti->buf, crnti_buf, crnti->size);
532 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
534 int serving_buf_len = strlen((char*)serving_buf);
535 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
536 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
537 servingstr->size = serving_buf_len;
538 memcpy(servingstr->buf, serving_buf, servingstr->size);
541 int neighbor_buf_len = strlen((char*)neighbor_buf);
542 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
543 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
544 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
545 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
546 neighborstr->size = neighbor_buf_len;
547 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
549 ue_report_item->c_RNTI = *crnti;
550 ue_report_item->serving_Cell_RF_Type = servingstr;
551 ue_report_item->neighbor_Cell_RF = neighborstr;
554 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
556 ranco->timestamp = *ts;
557 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
558 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
560 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
565 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
567 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
568 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
569 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
570 ts->size = strlen((char*)buf);
571 memcpy(ts->buf,buf,ts->size);
575 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
576 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
578 uint8_t *buf2 = (uint8_t*)"747";
580 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
581 plmnidstr->buf = (uint8_t*)calloc(3,1);
583 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
587 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
588 uint8_t* buf3 = (uint8_t*)"12340";
589 nrcellid->buf = (uint8_t*)calloc(1,5);
590 memcpy(nrcellid->buf, buf3, 5);
592 nrcellid->bits_unused = 4;
594 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
595 nrcgi->pLMN_Identity = *plmnidstr;
596 nrcgi->nRCellIdentity = *nrcellid;
600 report_item->nRCGI = *nrcgi;
602 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
603 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
607 uint8_t* crnti_str = (uint8_t*)"1111";
608 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
609 crnti->buf = (uint8_t*)calloc(1,4);
613 crnti->size = strlen((char*)crnti_str);
616 memcpy(crnti->buf, crnti_str, crnti->size);
618 uint8_t *buf_serving = (uint8_t*)"RSRP10";
619 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
620 servingstr->buf = (uint8_t*)calloc(6,1);
621 servingstr->size = 6;
622 memcpy(servingstr->buf, buf_serving, servingstr->size);
624 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
625 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
626 neighborstr->buf = (uint8_t*)calloc(7,1);
627 neighborstr->size = 7;
628 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
630 ue_report_item->c_RNTI = *crnti;
631 ue_report_item->serving_Cell_RF_Type = servingstr;
632 ue_report_item->neighbor_Cell_RF = neighborstr;
635 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
637 ranco->timestamp = *ts;
638 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
639 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
641 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
646 void encode_kpm_odu_user_level(RAN_Container_t *ranco,
648 uint8_t *nrcellid_buf,
653 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
654 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
655 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
656 ts->size = strlen((char*)buf);
657 memcpy(ts->buf,buf,ts->size);
661 DU_Usage_Report_CellResourceReportItem_t *report_item =
662 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
664 // uint8_t *buf2 = (uint8_t*)"747";
666 int plmnid_size = strlen((char*)plmnid_buf);
667 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
668 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
669 plmnidstr->size = plmnid_size;
670 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
674 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
676 int nrcellid_size = strlen((char*)nrcellid_buf);
677 nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size);
678 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
679 nrcellid->size = nrcellid_size;
680 nrcellid->bits_unused = 4;
682 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
683 nrcgi->pLMN_Identity = *plmnidstr;
684 nrcgi->nRCellIdentity = *nrcellid;
688 report_item->nRCGI = *nrcgi;
692 DU_Usage_Report_UeResourceReportItem *ue_report_item =
693 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
697 int crnti_size = strlen((char*)crnti_buf);
699 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
700 crnti->buf = (uint8_t*)calloc(1,crnti_size);
704 crnti->size = strlen((char*)crnti_buf);
707 memcpy(crnti->buf, crnti_buf, crnti->size);
712 ue_report_item->c_RNTI = *crnti;
713 ue_report_item->dl_PRBUsage = &prb_usage_dl;
717 ue_report_item->ul_PRBUsage = &prb_usage_ul;
721 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
724 ranco->timestamp = *ts;
725 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
726 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
728 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
733 void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
735 uint8_t *nrcellid_buf,
740 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
741 encode_kpm_odu_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,prb_usage_dl,prb_usage_ul);
743 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
744 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
745 containers_list->theRANContainer = ranco;
747 E2SM_KPM_IndicationMessage_Format1_t *format =
748 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
749 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
751 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
753 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
755 indicationmessage->indicationMessage.present = pres;
757 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
759 char *error_buf = (char*)calloc(300, sizeof(char));
762 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
763 printf("error length %d\n", errlen);
764 printf("error buf %s\n", error_buf);
766 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
768 asn_codec_ctx_t *opt_cod;
770 uint8_t e2smbuffer[8192];
771 size_t e2smbuffer_size = 8192;
773 uint8_t e2smbuffer2[8192];
774 size_t e2smbuffer_size2 = 8192;
777 asn_encode_to_buffer(opt_cod,
778 ATS_ALIGNED_BASIC_PER,
779 &asn_DEF_E2SM_KPM_IndicationMessage,
780 indicationmessage, e2smbuffer, e2smbuffer_size);
782 fprintf(stderr, "er encded is %d\n", er.encoded);
783 fprintf(stderr, "after encoding message\n");
788 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
790 uint8_t *nrcellid_buf,
792 const uint8_t *serving_buf,
793 const uint8_t *neighbor_buf) {
795 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
796 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
797 nrcellid_buf, crnti_buf,
798 serving_buf, neighbor_buf);
800 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
801 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
802 containers_list->theRANContainer = ranco;
804 E2SM_KPM_IndicationMessage_Format1_t *format =
805 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
806 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
808 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
810 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
812 indicationmessage->indicationMessage.present = pres;
814 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
816 char *error_buf = (char*)calloc(300, sizeof(char));
819 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
820 printf("error length %d\n", errlen);
821 printf("error buf %s\n", error_buf);
823 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
825 asn_codec_ctx_t *opt_cod;
827 uint8_t e2smbuffer[8192];
828 size_t e2smbuffer_size = 8192;
830 uint8_t e2smbuffer2[8192];
831 size_t e2smbuffer_size2 = 8192;
834 asn_encode_to_buffer(opt_cod,
835 ATS_ALIGNED_BASIC_PER,
836 &asn_DEF_E2SM_KPM_IndicationMessage,
837 indicationmessage, e2smbuffer, e2smbuffer_size);
839 fprintf(stderr, "er encded is %d\n", er.encoded);
840 fprintf(stderr, "after encoding message\n");
845 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
847 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
848 encode_kpm_ocucp_user_level(ranco);
850 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
851 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
852 containers_list->theRANContainer = ranco;
854 E2SM_KPM_IndicationMessage_Format1_t *format =
855 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
856 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
858 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
860 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
862 indicationmessage->indicationMessage.present = pres;
864 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
866 char *error_buf = (char*)calloc(300, sizeof(char));
869 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
870 printf("error length %d\n", errlen);
871 printf("error buf %s\n", error_buf);
873 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
875 asn_codec_ctx_t *opt_cod;
877 uint8_t e2smbuffer[8192];
878 size_t e2smbuffer_size = 8192;
880 uint8_t e2smbuffer2[8192];
881 size_t e2smbuffer_size2 = 8192;
884 asn_encode_to_buffer(opt_cod,
885 ATS_ALIGNED_BASIC_PER,
886 &asn_DEF_E2SM_KPM_IndicationMessage,
887 indicationmessage, e2smbuffer, e2smbuffer_size);
889 fprintf(stderr, "er encded is %d\n", er.encoded);
890 fprintf(stderr, "after encoding message\n");
895 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
897 uint8_t *nrcellid_buf,
902 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
903 encode_kpm_ocuup_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,pdcp_bytesdl,pdcp_bytesul);
905 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
906 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
907 containers_list->theRANContainer = ranco;
909 E2SM_KPM_IndicationMessage_Format1_t *format =
910 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
911 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
913 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
915 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
917 indicationmessage->indicationMessage.present = pres;
919 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
921 char *error_buf = (char*)calloc(300, sizeof(char));
924 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
925 printf("error length %d\n", errlen);
926 printf("error buf %s\n", error_buf);
928 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
930 asn_codec_ctx_t *opt_cod;
932 uint8_t e2smbuffer[8192];
933 size_t e2smbuffer_size = 8192;
935 uint8_t e2smbuffer2[8192];
936 size_t e2smbuffer_size2 = 8192;
938 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
941 asn_encode_to_buffer(opt_cod,
942 ATS_ALIGNED_BASIC_PER,
943 &asn_DEF_E2SM_KPM_IndicationMessage,
944 indicationmessage, e2smbuffer, e2smbuffer_size);
946 fprintf(stderr, "er encded is %d\n", er.encoded);
947 fprintf(stderr, "after encoding message\n");
952 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
954 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
955 //encode_kpm_ocuup_user_level(ranco);
958 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
959 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
960 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
961 ts->size = strlen((char*)buf);
962 memcpy(ts->buf,buf,ts->size);
966 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
967 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
969 uint8_t *buf2 = (uint8_t*)"747";
971 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
972 plmnidstr->buf = (uint8_t*)calloc(3,1);
974 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
978 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
979 uint8_t* buf3 = (uint8_t*)"12340";
980 nrcellid->buf = (uint8_t*)calloc(1,5);
981 memcpy(nrcellid->buf, buf3, 5);
983 nrcellid->bits_unused = 4;
985 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
986 nrcgi->pLMN_Identity = *plmnidstr;
987 nrcgi->nRCellIdentity = *nrcellid;
991 report_item->nRCGI = *nrcgi;
993 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
994 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
998 uint8_t* crnti_str = (uint8_t*)"1111";
999 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
1000 crnti->buf = (uint8_t*)calloc(1,4);
1004 crnti->size = strlen((char*)crnti_str);
1007 memcpy(crnti->buf, crnti_str, crnti->size);
1009 uint8_t *buf_serving = (uint8_t*)"RSRP10";
1010 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1011 servingstr->buf = (uint8_t*)calloc(6,1);
1012 servingstr->size = 6;
1013 memcpy(servingstr->buf, buf_serving, servingstr->size);
1015 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
1016 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1017 neighborstr->buf = (uint8_t*)calloc(7,1);
1018 neighborstr->size = 7;
1019 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
1021 ue_report_item->c_RNTI = *crnti;
1022 ue_report_item->serving_Cell_RF_Type = servingstr;
1023 ue_report_item->neighbor_Cell_RF = neighborstr;
1026 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
1028 ranco->timestamp = *ts;
1029 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
1030 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
1032 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
1035 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1036 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1037 containers_list->theRANContainer = ranco;
1039 E2SM_KPM_IndicationMessage_Format1_t *format =
1040 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1041 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1043 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1045 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1047 indicationmessage->indicationMessage.present = pres;
1049 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1051 char *error_buf = (char*)calloc(300, sizeof(char));
1054 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1055 printf("error length %d\n", errlen);
1056 printf("error buf %s\n", error_buf);
1058 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1060 asn_codec_ctx_t *opt_cod;
1062 uint8_t e2smbuffer[8192];
1063 size_t e2smbuffer_size = 8192;
1065 uint8_t e2smbuffer2[8192];
1066 size_t e2smbuffer_size2 = 8192;
1069 asn_encode_to_buffer(opt_cod,
1070 ATS_ALIGNED_BASIC_PER,
1071 &asn_DEF_E2SM_KPM_IndicationMessage,
1072 indicationmessage, e2smbuffer, e2smbuffer_size);
1074 fprintf(stderr, "er encded is %d\n", er.encoded);
1075 fprintf(stderr, "after encoding message\n");
1080 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1086 uint8_t* plmnid_buf,
1087 uint8_t* nrcellid_buf,
1092 asn_codec_ctx_t *opt_cod;
1094 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1095 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1096 fqi_item->fiveQI = fiveqi;
1097 fqi_item->dl_PRBUsage = &dl_prb_usage;
1098 fqi_item->ul_PRBUsage = &ul_prb_usage;
1100 uint8_t *buf1 = (uint8_t*)"4";
1101 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1103 sst->buf = (uint8_t*)calloc(1,6);
1104 memcpy(sst->buf,buf1,sst->size);
1106 // std::string sd = "SD1";
1107 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1108 // uint8_t *bufz = &sdvec[0];
1109 uint8_t *bufz = (uint8_t*)"SD1";
1110 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1112 sds->buf = (uint8_t*)calloc(1,3);
1113 memcpy(sds->buf, bufz, sds->size);
1116 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1117 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1118 snssai->sST.buf = (uint8_t*)calloc(1,1);
1119 snssai->sST.size = 1;
1120 memcpy(snssai->sST.buf, sst_buf, 1);
1121 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1122 snssai->sD->buf = (uint8_t*)calloc(1,3);
1123 snssai->sD->size = 3;
1124 memcpy(snssai->sD->buf, sd_buf, 3);
1127 SlicePerPlmnPerCellListItem_t *sliceitem =
1128 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1129 sliceitem->sliceID = *snssai;
1130 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1132 uint8_t *buf2 = (uint8_t*)"747";
1134 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1135 plmnid->buf = (uint8_t*)calloc(3,1);
1137 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1139 ServedPlmnPerCellListItem_t *percellitem1 =
1140 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1141 percellitem1->pLMN_Identity = *plmnid;
1142 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1143 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1145 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1146 plmnidstr->buf = (uint8_t*)calloc(3,1);
1147 plmnidstr->size = 3;
1148 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
1152 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1153 uint8_t* buf3 = (uint8_t*)"12340";
1154 nrcellid->buf = (uint8_t*)calloc(1,5);
1155 memcpy(nrcellid->buf, nrcellid_buf, 5);
1157 nrcellid->bits_unused = 4;
1159 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1160 nrcgi->pLMN_Identity = *plmnidstr;
1161 nrcgi->nRCellIdentity = *nrcellid;
1164 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1165 listitem1->nRCGI = *nrcgi;
1166 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
1167 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
1168 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1171 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1172 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1173 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1175 PF_Container_PR pres1 = PF_Container_PR_oDU;
1177 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1178 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1179 pfcontainer->present = pres1;
1180 pfcontainer->choice.oDU = *ducont;
1182 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1183 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1184 containers_list->performanceContainer = pfcontainer;
1186 E2SM_KPM_IndicationMessage_Format1_t *format =
1187 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1188 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1190 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1192 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1194 indicationmessage->indicationMessage.present = pres;
1196 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1198 char *error_buf = (char*)calloc(300, sizeof(char));
1201 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1202 printf("error length %d\n", errlen);
1203 printf("error buf %s\n", error_buf);
1205 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1208 uint8_t e2smbuffer[8192];
1209 size_t e2smbuffer_size = 8192;
1211 uint8_t e2smbuffer2[8192];
1212 size_t e2smbuffer_size2 = 8192;
1215 asn_encode_to_buffer(opt_cod,
1216 ATS_ALIGNED_BASIC_PER,
1217 &asn_DEF_E2SM_KPM_IndicationMessage,
1218 indicationmessage, e2smbuffer, e2smbuffer_size);
1220 fprintf(stderr, "er encded is %d\n", er.encoded);
1221 fprintf(stderr, "after encoding message\n");
1227 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1230 long dl_prb_usage = 50;
1231 long ul_prb_usage = 70;
1233 asn_codec_ctx_t *opt_cod;
1235 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1236 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1237 fqi_item->fiveQI = fiveqi;
1238 fqi_item->dl_PRBUsage = &dl_prb_usage;
1239 fqi_item->ul_PRBUsage = &ul_prb_usage;
1241 uint8_t *buf1 = (uint8_t*)"4";
1242 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1244 sst->buf = (uint8_t*)calloc(1,6);
1245 memcpy(sst->buf,buf1,sst->size);
1247 // std::string sd = "SD1";
1248 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1249 // uint8_t *bufz = &sdvec[0];
1250 uint8_t *bufz = (uint8_t*)"SD1";
1251 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1253 sds->buf = (uint8_t*)calloc(1,3);
1254 memcpy(sds->buf, bufz, sds->size);
1257 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1258 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1259 snssai->sST.buf = (uint8_t*)calloc(1,1);
1260 snssai->sST.size = 1;
1261 memcpy(snssai->sST.buf, buf1, 1);
1262 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1263 snssai->sD->buf = (uint8_t*)calloc(1,3);
1264 snssai->sD->size = 3;
1265 memcpy(snssai->sD->buf, bufz, 3);
1268 SlicePerPlmnPerCellListItem_t *sliceitem =
1269 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1270 sliceitem->sliceID = *snssai;
1271 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1273 uint8_t *buf2 = (uint8_t*)"747";
1275 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1276 plmnid->buf = (uint8_t*)calloc(3,1);
1278 memcpy(plmnid->buf, buf2, plmnid->size);
1280 ServedPlmnPerCellListItem_t *percellitem1 =
1281 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1282 percellitem1->pLMN_Identity = *plmnid;
1283 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1284 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1286 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1287 plmnidstr->buf = (uint8_t*)calloc(3,1);
1288 plmnidstr->size = 3;
1289 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1293 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1294 uint8_t* buf3 = (uint8_t*)"12340";
1295 nrcellid->buf = (uint8_t*)calloc(1,5);
1296 memcpy(nrcellid->buf, buf3, 5);
1298 nrcellid->bits_unused = 4;
1300 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1301 nrcgi->pLMN_Identity = *plmnidstr;
1302 nrcgi->nRCellIdentity = *nrcellid;
1304 long dl_prbs = (long)100;
1305 long ul_prbs = (long)120;
1307 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1308 listitem1->nRCGI = *nrcgi;
1309 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1310 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1311 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1314 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1315 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1316 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1318 PF_Container_PR pres1 = PF_Container_PR_oDU;
1320 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1321 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1322 pfcontainer->present = pres1;
1323 pfcontainer->choice.oDU = *ducont;
1325 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1326 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1327 containers_list->performanceContainer = pfcontainer;
1329 E2SM_KPM_IndicationMessage_Format1_t *format =
1330 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1331 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1333 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1335 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1337 indicationmessage->indicationMessage.present = pres;
1339 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1341 char *error_buf = (char*)calloc(300, sizeof(char));
1344 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1345 printf("error length %d\n", errlen);
1346 printf("error buf %s\n", error_buf);
1348 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1351 uint8_t e2smbuffer[8192];
1352 size_t e2smbuffer_size = 8192;
1354 uint8_t e2smbuffer2[8192];
1355 size_t e2smbuffer_size2 = 8192;
1358 asn_encode_to_buffer(opt_cod,
1359 ATS_ALIGNED_BASIC_PER,
1360 &asn_DEF_E2SM_KPM_IndicationMessage,
1361 indicationmessage, e2smbuffer, e2smbuffer_size);
1363 fprintf(stderr, "er encded is %d\n", er.encoded);
1364 fprintf(stderr, "after encoding message\n");
1369 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1370 uint8_t *gnbcuupname_buf,
1375 uint8_t *plmnid_buf) {
1377 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1380 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1381 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1382 gnbcuupname->size = 8;
1383 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1384 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1387 //We need to convert bytes_dl into array of uint8_t
1391 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1393 if (bytes_dl <= 64) {
1396 uint8_t buffer[array_size_dl];
1397 buffer[0] = bytes_dl & 0xFF;
1398 bytesdl->buf = (uint8_t*)calloc(1,1);
1399 memcpy(bytesdl->buf,buffer,1);
1402 } else if (bytes_dl <= 16384) {
1405 uint8_t buffer[array_size_dl];
1406 buffer[0] = (bytes_dl >> 8) & 0xFF;
1407 buffer[1] = bytes_dl & 0xFF;
1408 bytesdl->buf = (uint8_t*)calloc(2,1);
1409 memcpy(bytesdl->buf,buffer,2);
1412 } else if (bytes_dl <= 4194304) {
1415 uint8_t buffer[array_size_dl];
1416 buffer[0] = (bytes_dl >> 16) & 0xFF;
1417 buffer[1] = (bytes_dl >> 8) & 0xFF;
1418 buffer[2] = bytes_dl & 0xFF;
1419 bytesdl->buf = (uint8_t*)calloc(3,1);
1420 memcpy(bytesdl->buf,buffer,3);
1423 } else if (bytes_dl <= 1073741824) {
1425 uint8_t buffer[array_size_dl];
1426 buffer[0] = (bytes_dl >> 24) & 0xFF;
1427 buffer[1] = (bytes_dl >> 16) & 0xFF;
1428 buffer[2] = (bytes_dl >> 8) & 0xFF;
1429 buffer[3] = bytes_dl & 0xFF;
1430 bytesdl->buf = (uint8_t*)calloc(4,1);
1431 memcpy(bytesdl->buf,buffer,4);
1436 //We need to convert bytes_ul into array of uint8_t
1437 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1441 if (bytes_ul <= 64) {
1444 uint8_t buffer[array_size_ul];
1445 buffer[0] = bytes_ul & 0xFF;
1446 bytesul->buf = (uint8_t*)calloc(1,1);
1447 memcpy(bytesul->buf,buffer,1);
1450 } else if (bytes_ul <= 16384) {
1453 uint8_t buffer[array_size_ul];
1454 buffer[0] = (bytes_ul >> 8) & 0xFF;
1455 buffer[1] = bytes_ul & 0xFF;
1456 bytesul->buf = (uint8_t*)calloc(2,1);
1457 memcpy(bytesul->buf,buffer,2);
1460 } else if (bytes_ul <= 4194304) {
1463 uint8_t buffer[array_size_ul];
1464 buffer[0] = (bytes_ul >> 16) & 0xFF;
1465 buffer[1] = (bytes_ul >> 8) & 0xFF;
1466 buffer[2] = bytes_ul & 0xFF;
1467 bytesul->buf = (uint8_t*)calloc(3,1);
1468 memcpy(bytesul->buf,buffer,3);
1471 } else if (bytes_ul <= 1073741824) {
1473 uint8_t buffer[array_size_ul];
1474 buffer[0] = (bytes_ul >> 24) & 0xFF;
1475 buffer[1] = (bytes_ul >> 16) & 0xFF;
1476 buffer[2] = (bytes_ul >> 8) & 0xFF;
1477 buffer[3] = bytes_ul & 0xFF;
1478 bytesul->buf = (uint8_t*)calloc(4,1);
1479 memcpy(bytesul->buf,buffer,4);
1484 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1485 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1486 fqilistitem->fiveQI = fqi;
1487 fqilistitem->pDCPBytesDL = bytesdl;
1488 fqilistitem->pDCPBytesUL = bytesul;
1491 uint8_t *buf1 = (uint8_t*)"4";
1492 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1494 sst->buf = (uint8_t*)calloc(1,6);
1495 memcpy(sst->buf,sst_buf,sst->size);
1498 uint8_t *bufz = (uint8_t*)"SD1";
1499 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1501 sds->buf = (uint8_t*)calloc(1,3);
1502 memcpy(sds->buf, sd_buf, sds->size);
1505 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1506 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1507 snssai->sST.buf = (uint8_t*)calloc(1,1);
1508 snssai->sST.size = 1;
1509 memcpy(snssai->sST.buf, sst_buf, 1);
1510 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1511 snssai->sD->buf = (uint8_t*)calloc(1,3);
1512 snssai->sD->size = 3;
1513 memcpy(snssai->sD->buf, sd_buf, 3);
1517 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1518 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1519 slicelistitem->sliceID = *snssai;
1520 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1522 asn_codec_ctx_t *opt_cod;
1525 uint8_t e2smbuffera[8192];
1526 size_t e2smbuffer_sizea = 8192;
1530 asn_enc_rval_t era =
1531 asn_encode_to_buffer(opt_cod,
1532 ATS_ALIGNED_BASIC_PER,
1533 &asn_DEF_SliceToReportListItem,
1534 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1535 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1536 fprintf(stderr, "after encoding message\n");
1540 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1541 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1542 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1544 uint8_t *buf2 = (uint8_t*)"747";
1545 // std::string pl = "PLMNID7";
1546 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1547 // uint8_t *buf2 = &plvec[0];
1549 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1550 plmnid->buf = (uint8_t*)calloc(3,1);
1552 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1555 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1556 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1557 plmnidlist->pLMN_Identity = *plmnid;
1558 plmnidlist->cu_UP_PM_5GC = pm_format;
1560 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1561 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1562 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1567 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1568 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1569 listitem1->interface_type = 2;
1570 listitem1->o_CU_UP_PM_Container = *meas_cont;
1572 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1573 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1574 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1575 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1577 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1579 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1580 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1581 pfcontainer->present = pres1;
1582 pfcontainer->choice.oCU_UP = *cuupcont;
1584 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1585 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1586 containers_list->performanceContainer = pfcontainer;
1588 E2SM_KPM_IndicationMessage_Format1_t *format =
1589 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1590 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1592 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1594 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1596 indicationmessage->indicationMessage.present = pres;
1598 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1600 char *error_buf = (char*)calloc(300, sizeof(char));
1603 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1604 printf("error length %d\n", errlen);
1605 printf("error buf %s\n", error_buf);
1607 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1610 uint8_t e2smbuffer[8192];
1611 size_t e2smbuffer_size = 8192;
1613 uint8_t e2smbuffer2[8192];
1614 size_t e2smbuffer_size2 = 8192;
1617 asn_encode_to_buffer(opt_cod,
1618 ATS_ALIGNED_BASIC_PER,
1619 &asn_DEF_E2SM_KPM_IndicationMessage,
1620 indicationmessage, e2smbuffer, e2smbuffer_size);
1622 fprintf(stderr, "er encded is %d\n", er.encoded);
1623 fprintf(stderr, "after encoding message\n");
1628 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1630 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1633 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1634 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1635 gnbcuupname->size = 8;
1636 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1637 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1640 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1643 bytesdl->buf = (uint8_t*)calloc(1,1);
1644 memcpy(bytesdl->buf, buffer,1);
1647 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1650 bytesul->buf = (uint8_t*)calloc(1,1);
1651 memcpy(bytesul->buf, buffer1, 1);
1654 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1655 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1656 fqilistitem->fiveQI = 9;
1657 fqilistitem->pDCPBytesDL = bytesdl;
1658 fqilistitem->pDCPBytesUL = bytesul;
1661 uint8_t *buf1 = (uint8_t*)"4";
1662 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1664 sst->buf = (uint8_t*)calloc(1,6);
1665 memcpy(sst->buf,buf1,sst->size);
1668 uint8_t *bufz = (uint8_t*)"SD1";
1669 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1671 sds->buf = (uint8_t*)calloc(1,3);
1672 memcpy(sds->buf, bufz, sds->size);
1675 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1676 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1677 snssai->sST.buf = (uint8_t*)calloc(1,1);
1678 snssai->sST.size = 1;
1679 memcpy(snssai->sST.buf, buf1, 1);
1680 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1681 snssai->sD->buf = (uint8_t*)calloc(1,3);
1682 snssai->sD->size = 3;
1683 memcpy(snssai->sD->buf, bufz, 3);
1687 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1688 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1689 slicelistitem->sliceID = *snssai;
1690 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1692 asn_codec_ctx_t *opt_cod;
1695 uint8_t e2smbuffera[8192];
1696 size_t e2smbuffer_sizea = 8192;
1700 asn_enc_rval_t era =
1701 asn_encode_to_buffer(opt_cod,
1702 ATS_ALIGNED_BASIC_PER,
1703 &asn_DEF_SliceToReportListItem,
1704 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1705 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1706 fprintf(stderr, "after encoding message\n");
1710 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1711 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1712 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1714 uint8_t *buf2 = (uint8_t*)"747";
1715 // std::string pl = "PLMNID7";
1716 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1717 // uint8_t *buf2 = &plvec[0];
1719 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1720 plmnid->buf = (uint8_t*)calloc(3,1);
1722 memcpy(plmnid->buf, buf2, plmnid->size);
1725 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1726 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1727 plmnidlist->pLMN_Identity = *plmnid;
1728 plmnidlist->cu_UP_PM_5GC = pm_format;
1730 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1731 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1732 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1737 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1738 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1739 listitem1->interface_type = 2;
1740 listitem1->o_CU_UP_PM_Container = *meas_cont;
1742 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1743 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1744 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1745 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1747 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1749 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1750 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1751 pfcontainer->present = pres1;
1752 pfcontainer->choice.oCU_UP = *cuupcont;
1754 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1755 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1756 containers_list->performanceContainer = pfcontainer;
1758 E2SM_KPM_IndicationMessage_Format1_t *format =
1759 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1760 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1762 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1764 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1766 indicationmessage->indicationMessage.present = pres;
1768 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1770 char *error_buf = (char*)calloc(300, sizeof(char));
1773 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1774 printf("error length %d\n", errlen);
1775 printf("error buf %s\n", error_buf);
1777 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1780 uint8_t e2smbuffer[8192];
1781 size_t e2smbuffer_size = 8192;
1783 uint8_t e2smbuffer2[8192];
1784 size_t e2smbuffer_size2 = 8192;
1787 asn_encode_to_buffer(opt_cod,
1788 ATS_ALIGNED_BASIC_PER,
1789 &asn_DEF_E2SM_KPM_IndicationMessage,
1790 indicationmessage, e2smbuffer, e2smbuffer_size);
1792 fprintf(stderr, "er encded is %d\n", er.encoded);
1793 fprintf(stderr, "after encoding message\n");
1798 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1801 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1802 //std::string gn = "GNBCUUP5";
1803 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1804 //uint8_t *buf = &gnvec[0];
1805 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1806 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1807 gnbcuupname->size = 8;
1808 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1809 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1812 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1815 bytesdl->buf = (uint8_t*)calloc(1,1);
1816 memcpy(bytesdl->buf, buffer,1);
1819 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1822 bytesul->buf = (uint8_t*)calloc(1,1);
1823 memcpy(bytesul->buf, buffer1, 1);
1826 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1827 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1828 fqilistitem->fiveQI = 9;
1829 fqilistitem->pDCPBytesDL = bytesdl;
1830 fqilistitem->pDCPBytesUL = bytesul;
1834 // std::string sl = "SLICE4";
1835 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1836 // uint8_t *buf1 = &slvec[0];
1837 uint8_t *buf1 = (uint8_t*)"4";
1838 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1840 sst->buf = (uint8_t*)calloc(1,6);
1841 memcpy(sst->buf,buf1,sst->size);
1843 // std::string sd = "SD1";
1844 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1845 // uint8_t *bufz = &sdvec[0];
1846 uint8_t *bufz = (uint8_t*)"SD1";
1847 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1849 sds->buf = (uint8_t*)calloc(1,3);
1850 memcpy(sds->buf, bufz, sds->size);
1853 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1854 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1855 snssai->sST.buf = (uint8_t*)calloc(1,1);
1856 snssai->sST.size = 1;
1857 memcpy(snssai->sST.buf, buf1, 1);
1858 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1859 snssai->sD->buf = (uint8_t*)calloc(1,3);
1860 snssai->sD->size = 3;
1861 memcpy(snssai->sD->buf, bufz, 3);
1865 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1866 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1867 slicelistitem->sliceID = *snssai;
1868 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1870 asn_codec_ctx_t *opt_cod;
1873 uint8_t e2smbuffera[8192];
1874 size_t e2smbuffer_sizea = 8192;
1878 asn_enc_rval_t era =
1879 asn_encode_to_buffer(opt_cod,
1880 ATS_ALIGNED_BASIC_PER,
1881 &asn_DEF_SliceToReportListItem,
1882 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1883 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1884 fprintf(stderr, "after encoding message\n");
1888 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1889 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1890 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1892 uint8_t *buf2 = (uint8_t*)"747";
1893 // std::string pl = "PLMNID7";
1894 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1895 // uint8_t *buf2 = &plvec[0];
1897 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1898 plmnid->buf = (uint8_t*)calloc(3,1);
1900 memcpy(plmnid->buf, buf2, plmnid->size);
1903 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1904 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1905 plmnidlist->pLMN_Identity = *plmnid;
1906 plmnidlist->cu_UP_PM_5GC = pm_format;
1908 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1909 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1910 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1915 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1916 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1917 listitem1->interface_type = 2;
1918 listitem1->o_CU_UP_PM_Container = *meas_cont;
1920 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1921 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1922 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1923 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1925 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1927 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1928 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1929 pfcontainer->present = pres1;
1930 pfcontainer->choice.oCU_UP = *cuupcont;
1932 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1933 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1934 containers_list->performanceContainer = pfcontainer;
1936 E2SM_KPM_IndicationMessage_Format1_t *format =
1937 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1938 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1940 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1942 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1944 indicationmessage->present = pres;
1946 indicationmessage->choice.indicationMessage_Format1 = *format;
1948 char *error_buf = (char*)calloc(300, sizeof(char));
1951 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1952 printf("error length %d\n", errlen);
1953 printf("error buf %s\n", error_buf);
1955 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1958 uint8_t e2smbuffer[8192];
1959 size_t e2smbuffer_size = 8192;
1961 uint8_t e2smbuffer2[8192];
1962 size_t e2smbuffer_size2 = 8192;
1965 asn_encode_to_buffer(opt_cod,
1966 ATS_ALIGNED_BASIC_PER,
1967 &asn_DEF_E2SM_KPM_IndicationMessage,
1968 indicationmessage, e2smbuffer, e2smbuffer_size);
1970 fprintf(stderr, "er encded is %d\n", er.encoded);
1971 fprintf(stderr, "after encoding message\n");
1977 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1978 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1979 std::string gn = "GNBCUUP5";
1980 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1981 uint8_t *buf = &gnvec[0];
1982 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1983 gnbcuupname->size = 8;
1984 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1985 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1988 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1991 bytesdl->buf = (uint8_t*)calloc(1,1);
1992 memcpy(bytesdl->buf, buffer,1);
1995 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1998 bytesul->buf = (uint8_t*)calloc(1,1);
1999 memcpy(bytesul->buf, buffer1, 1);
2002 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
2003 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
2004 fqilistitem->fiveQI = 9;
2005 fqilistitem->pDCPBytesDL = bytesdl;
2006 fqilistitem->pDCPBytesUL = bytesul;
2010 std::string sl = "SLICE4";
2011 std::vector<uint8_t> slvec(sl.begin(), sl.end());
2012 // uint8_t *buf1 = &slvec[0];
2013 uint8_t *buf1 = (uint8_t*)"SLICE4";
2014 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2016 sst->buf = (uint8_t*)calloc(1,6);
2017 memcpy(sst->buf,buf1,sst->size);
2019 std::string sd = "SD1";
2020 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
2021 // uint8_t *bufz = &sdvec[0];
2022 uint8_t *bufz = (uint8_t*)"SD1";
2023 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2025 sds->buf = (uint8_t*)calloc(1,3);
2026 memcpy(sds->buf, bufz, sds->size);
2029 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
2030 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
2031 snssai->sST.buf = (uint8_t*)calloc(6,1);
2032 snssai->sST.size = 6;
2033 memcpy(snssai->sST.buf, buf1, 6);
2034 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2035 snssai->sD->buf = (uint8_t*)calloc(1,3);
2036 snssai->sD->size = 3;
2037 memcpy(snssai->sD->buf, bufz, 3);
2041 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
2042 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
2043 slicelistitem->sliceID = *snssai;
2044 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
2046 uint8_t e2smbuffera[8192];
2047 size_t e2smbuffer_sizea = 8192;
2050 asn_encode_to_buffer(nullptr,
2051 ATS_ALIGNED_BASIC_PER,
2052 &asn_DEF_SliceToReportListItem,
2053 slicelistitem, e2smbuffera, e2smbuffer_sizea);
2054 fprintf(stderr, "inner er encded is %d\n", era.encoded);
2055 fprintf(stderr, "after encoding message\n");
2057 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
2058 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
2059 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
2061 std::string pl = "PLMNID7";
2062 std::vector<uint8_t> plvec(pl.begin(), pl.end());
2063 uint8_t *buf2 = &plvec[0];
2065 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
2066 plmnid->buf = (uint8_t*)calloc(1,7);
2068 memcpy(plmnid->buf, buf2, plmnid->size);
2071 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
2072 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
2073 plmnidlist->pLMN_Identity = *plmnid;
2074 plmnidlist->cu_UP_PM_5GC = pm_format;
2076 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
2077 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
2078 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
2083 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
2084 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
2085 listitem1->interface_type = 2;
2086 listitem1->o_CU_UP_PM_Container = *meas_cont;
2088 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
2089 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
2090 cuupcont->gNB_CU_UP_Name = gnbcuupname;
2091 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
2093 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
2095 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
2096 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
2097 pfcontainer->present = pres1;
2098 pfcontainer->choice.oCU_UP = *cuupcont;
2100 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
2101 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
2102 containers_list->performanceContainer = pfcontainer;
2104 E2SM_KPM_IndicationMessage_Format1_t *format =
2105 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
2106 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
2108 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
2110 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
2112 indicationmessage->present = pres;
2114 indicationmessage->choice.indicationMessage_Format1 = *format;
2116 char *error_buf = (char*)calloc(300, sizeof(char));
2119 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
2120 printf("error length %d\n", errlen);
2121 printf("error buf %s\n", error_buf);
2124 uint8_t e2smbuffer[8192];
2125 size_t e2smbuffer_size = 8192;
2127 uint8_t e2smbuffer2[8192];
2128 size_t e2smbuffer_size2 = 8192;
2131 asn_encode_to_buffer(nullptr,
2132 ATS_ALIGNED_BASIC_PER,
2133 &asn_DEF_E2SM_KPM_IndicationMessage,
2134 indicationmessage, e2smbuffer, e2smbuffer_size);
2136 fprintf(stderr, "er encded is %d\n", er.encoded);
2137 fprintf(stderr, "after encoding message\n");