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 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
199 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
200 snssai->sST.buf = (uint8_t*)calloc(1,1);
201 snssai->sST.size = 1;
202 memcpy(snssai->sST.buf, sst_buf, 1);
203 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
204 snssai->sD->buf = (uint8_t*)calloc(1,3);
205 snssai->sD->size = 3;
206 memcpy(snssai->sD->buf, sd_buf, 3);
208 BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
209 nrcellid->buf = (uint8_t*)calloc(1,5);
211 memcpy(nrcellid->buf, nrcellid_buf, 5);
213 nrcellid->buf[0] = 0x22;
214 nrcellid->buf[1] = 0x5B;
215 nrcellid->buf[2] = 0xD6;
216 nrcellid->buf[3] = 0x00;
217 nrcellid->buf[4] = 0x70;
219 nrcellid->bits_unused = 4;
221 BIT_STRING_t *gnb_bstring = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
222 gnb_bstring->buf = (uint8_t*)calloc(1,4);
223 gnb_bstring->size = 4;
224 memcpy(gnb_bstring->buf, gnbid_buf, 4);
226 gnb_bstring->buf[0] = 0xB5;
227 gnb_bstring->buf[1] = 0xC6;
228 gnb_bstring->buf[2] = 0x77;
229 gnb_bstring->buf[3] = 0x88;
232 gnb_bstring->bits_unused = gnbid_unused;
234 INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
235 // uint8_t buffer[1];
236 // buffer[0] = 20000;
237 cuup_id->buf = (uint8_t*)calloc(1,1);
238 memcpy(cuup_id->buf, cuupid_buf, 1);
241 INTEGER_t *du_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
242 // uint8_t buffer_duid[1];
243 // buffer_duid[0] = 20000;
244 du_id->buf = (uint8_t*)calloc(1,1);
245 memcpy(du_id->buf, duid_buf, 1);
249 // uint8_t *buf5 = (uint8_t*)"GNBCUUP5";
250 OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
252 cuupname->buf = (uint8_t*)calloc(1,8);
253 memcpy(cuupname->buf, cuupname_buf, cuupname->size);
256 ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID));
257 ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB;
258 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
259 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring;
260 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid;
261 ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id;
265 ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI));
266 ind_header->nRCGI->pLMN_Identity = *plmnid;
267 ind_header->nRCGI->nRCellIdentity = *nrcellid;
268 if (nrcellid) free(nrcellid);
270 ind_header->pLMN_Identity = plmnid;
271 // memcpy(ind_header->fiveQI, &fqival, 4);
273 ind_header->sliceID = snssai;
274 // memcpy(ind_header->qci, &qcival, 4);
277 ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name));
278 ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name;
279 ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname;
280 if (cuupname) free(cuupname);
283 ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID));
284 ind_header->global_GNB_ID->plmn_id = *plmnid;
285 ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
286 ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring;
289 // long msg_type = 2;
290 // ind_header->message_Type = &msg_type;
291 ind_header->gNB_DU_ID = du_id;
294 ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1;
295 ihead->choice.indicationHeader_Format1 = *ind_header;
296 if (ind_header) free(ind_header);
298 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ihead);
304 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco,
306 uint8_t *nrcellid_buf,
311 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
312 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
313 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
314 ts->size = strlen((char*)buf);
315 memcpy(ts->buf,buf,ts->size);
319 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
320 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
322 // uint8_t *buf2 = (uint8_t*)"747";
324 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
325 plmnidstr->buf = (uint8_t*)calloc(3,1);
327 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
331 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
332 // uint8_t* buf3 = (uint8_t*)"12340";
333 nrcellid->buf = (uint8_t*)calloc(1,5);
334 memcpy(nrcellid->buf, nrcellid_buf, 5);
336 nrcellid->bits_unused = 4;
338 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
339 nrcgi->pLMN_Identity = *plmnidstr;
340 nrcgi->nRCellIdentity = *nrcellid;
341 if (plmnidstr) free(plmnidstr);
342 if (nrcellid) free(nrcellid);
346 report_item->nRCGI = *nrcgi;
347 if (nrcgi) free(nrcgi);
349 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
350 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
354 // uint8_t* crnti_str = (uint8_t*)"1111";
355 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
356 crnti->buf = (uint8_t*)calloc(1,4);
360 crnti->size = strlen((char*)crnti_buf);
363 memcpy(crnti->buf, crnti_buf, crnti->size);
367 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
370 if (bytes_dl <= 64) {
373 uint8_t buffer[array_size_dl];
374 buffer[0] = bytes_dl & 0xFF;
375 bytesdl->buf = (uint8_t*)calloc(1,1);
376 memcpy(bytesdl->buf,buffer,1);
379 } else if (bytes_dl <= 16384) {
382 uint8_t buffer[array_size_dl];
383 buffer[0] = (bytes_dl >> 8) & 0xFF;
384 buffer[1] = bytes_dl & 0xFF;
385 bytesdl->buf = (uint8_t*)calloc(2,1);
386 memcpy(bytesdl->buf,buffer,2);
389 } else if (bytes_dl <= 4194304) {
392 uint8_t buffer[array_size_dl];
393 buffer[0] = (bytes_dl >> 16) & 0xFF;
394 buffer[1] = (bytes_dl >> 8) & 0xFF;
395 buffer[2] = bytes_dl & 0xFF;
396 bytesdl->buf = (uint8_t*)calloc(3,1);
397 memcpy(bytesdl->buf,buffer,3);
400 } else if (bytes_dl <= 1073741824) {
402 uint8_t buffer[array_size_dl];
403 buffer[0] = (bytes_dl >> 24) & 0xFF;
404 buffer[1] = (bytes_dl >> 16) & 0xFF;
405 buffer[2] = (bytes_dl >> 8) & 0xFF;
406 buffer[3] = bytes_dl & 0xFF;
407 bytesdl->buf = (uint8_t*)calloc(4,1);
408 memcpy(bytesdl->buf,buffer,4);
413 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
417 if (bytes_ul <= 64) {
420 uint8_t buffer[array_size_ul];
421 buffer[0] = bytes_ul & 0xFF;
422 bytesul->buf = (uint8_t*)calloc(1,1);
423 memcpy(bytesul->buf,buffer,1);
426 } else if (bytes_ul <= 16384) {
429 uint8_t buffer[array_size_ul];
430 buffer[0] = (bytes_ul >> 8) & 0xFF;
431 buffer[1] = bytes_ul & 0xFF;
432 bytesul->buf = (uint8_t*)calloc(2,1);
433 memcpy(bytesul->buf,buffer,2);
436 } else if (bytes_ul <= 4194304) {
439 uint8_t buffer[array_size_ul];
440 buffer[0] = (bytes_ul >> 16) & 0xFF;
441 buffer[1] = (bytes_ul >> 8) & 0xFF;
442 buffer[2] = bytes_ul & 0xFF;
443 bytesul->buf = (uint8_t*)calloc(3,1);
444 memcpy(bytesul->buf,buffer,3);
447 } else if (bytes_ul <= 1073741824) {
449 uint8_t buffer[array_size_ul];
450 buffer[0] = (bytes_ul >> 24) & 0xFF;
451 buffer[1] = (bytes_ul >> 16) & 0xFF;
452 buffer[2] = (bytes_ul >> 8) & 0xFF;
453 buffer[3] = bytes_ul & 0xFF;
454 bytesul->buf = (uint8_t*)calloc(4,1);
455 memcpy(bytesul->buf,buffer,4);
461 ue_report_item->c_RNTI = *crnti;
462 ue_report_item->pDCPBytesDL = bytesdl;
463 ue_report_item->pDCPBytesUL = bytesul;
464 if (crnti) free(crnti);
467 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
469 ranco->timestamp = *ts;
470 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
471 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
474 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
478 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
480 uint8_t *nrcellid_buf,
482 const uint8_t *serving_buf,
483 const uint8_t *neighbor_buf) {
484 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
485 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
486 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
487 ts->size = strlen((char*)buf);
488 memcpy(ts->buf,buf,ts->size);
492 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
493 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
495 int plmnid_size = strlen((char*)plmnid_buf);
496 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
497 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
498 plmnidstr->size = plmnid_size;
499 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
503 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
505 // int nrcellid_size = strlen((char*)nrcellid_buf);
506 int nrcellid_size = 5;
507 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
508 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
510 nrcellid->bits_unused = 4;
512 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
513 nrcgi->pLMN_Identity = *plmnidstr;
514 nrcgi->nRCellIdentity = *nrcellid;
515 if (plmnidstr) free(plmnidstr);
516 if (nrcellid) free(nrcellid);
520 report_item->nRCGI = *nrcgi;
521 if (nrcgi) free(nrcgi);
523 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
524 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
529 int crnti_size = strlen((char*)crnti_buf);
530 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
531 crnti->buf = (uint8_t*)calloc(1, crnti_size);
535 crnti->size = strlen((char*)crnti_buf);
538 memcpy(crnti->buf, crnti_buf, crnti->size);
540 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
542 int serving_buf_len = strlen((char*)serving_buf);
543 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
544 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
545 servingstr->size = serving_buf_len;
546 memcpy(servingstr->buf, serving_buf, servingstr->size);
549 int neighbor_buf_len = strlen((char*)neighbor_buf);
550 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
551 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
552 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
553 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
554 neighborstr->size = neighbor_buf_len;
555 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
557 ue_report_item->c_RNTI = *crnti;
558 ue_report_item->serving_Cell_RF_Type = servingstr;
559 ue_report_item->neighbor_Cell_RF = neighborstr;
560 if (crnti) free(crnti);
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);
568 if (ts->buf) free(ts->buf);
571 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
576 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
578 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
579 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
580 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
581 ts->size = strlen((char*)buf);
582 memcpy(ts->buf,buf,ts->size);
586 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
587 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
589 uint8_t *buf2 = (uint8_t*)"747";
591 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
592 plmnidstr->buf = (uint8_t*)calloc(3,1);
594 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
598 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
599 uint8_t* buf3 = (uint8_t*)"12340";
600 nrcellid->buf = (uint8_t*)calloc(1,5);
601 memcpy(nrcellid->buf, buf3, 5);
603 nrcellid->bits_unused = 4;
605 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
606 nrcgi->pLMN_Identity = *plmnidstr;
607 nrcgi->nRCellIdentity = *nrcellid;
611 report_item->nRCGI = *nrcgi;
612 if (nrcgi) free(nrcgi);
614 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
615 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
619 uint8_t* crnti_str = (uint8_t*)"1111";
620 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
621 crnti->buf = (uint8_t*)calloc(1,4);
625 crnti->size = strlen((char*)crnti_str);
628 memcpy(crnti->buf, crnti_str, crnti->size);
630 uint8_t *buf_serving = (uint8_t*)"RSRP10";
631 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
632 servingstr->buf = (uint8_t*)calloc(6,1);
633 servingstr->size = 6;
634 memcpy(servingstr->buf, buf_serving, servingstr->size);
636 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
637 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
638 neighborstr->buf = (uint8_t*)calloc(7,1);
639 neighborstr->size = 7;
640 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
642 ue_report_item->c_RNTI = *crnti;
643 ue_report_item->serving_Cell_RF_Type = servingstr;
644 ue_report_item->neighbor_Cell_RF = neighborstr;
647 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
649 ranco->timestamp = *ts;
650 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
651 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
653 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
658 void encode_kpm_odu_user_level(RAN_Container_t *ranco,
660 uint8_t *nrcellid_buf,
665 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
666 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
667 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
668 ts->size = strlen((char*)buf);
669 memcpy(ts->buf,buf,ts->size);
673 DU_Usage_Report_CellResourceReportItem_t *report_item =
674 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
676 // uint8_t *buf2 = (uint8_t*)"747";
678 int plmnid_size = strlen((char*)plmnid_buf);
679 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
680 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
681 plmnidstr->size = plmnid_size;
682 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
686 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
688 // int nrcellid_size = strlen((char*)nrcellid_buf);
689 int nrcellid_size = 5;
690 nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size);
691 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
692 nrcellid->size = nrcellid_size;
693 nrcellid->bits_unused = 4;
695 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
696 nrcgi->pLMN_Identity = *plmnidstr;
697 nrcgi->nRCellIdentity = *nrcellid;
698 if (plmnidstr) free(plmnidstr);
699 if (nrcellid) free(nrcellid);
703 report_item->nRCGI = *nrcgi;
704 if (nrcgi) free(nrcgi);
708 DU_Usage_Report_UeResourceReportItem *ue_report_item =
709 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
713 int crnti_size = strlen((char*)crnti_buf);
715 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
716 crnti->buf = (uint8_t*)calloc(1,crnti_size);
720 crnti->size = strlen((char*)crnti_buf);
723 memcpy(crnti->buf, crnti_buf, crnti->size);
728 ue_report_item->c_RNTI = *crnti;
729 ue_report_item->dl_PRBUsage = &prb_usage_dl;
730 if (crnti) free(crnti);
734 ue_report_item->ul_PRBUsage = &prb_usage_ul;
738 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
741 ranco->timestamp = *ts;
742 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
743 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
746 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
751 void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
753 uint8_t *nrcellid_buf,
758 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
759 encode_kpm_odu_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,prb_usage_dl,prb_usage_ul);
761 printf("After creating RAN container, xer printing it\n");
762 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
764 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
765 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
766 containers_list->theRANContainer = ranco;
768 E2SM_KPM_IndicationMessage_Format1_t *format =
769 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
770 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
772 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
774 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
776 indicationmessage->indicationMessage.present = pres;
778 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
779 if (format) free(format);
781 char error_buf[300] = {0, };
784 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
785 printf("error length %d\n", errlen);
786 printf("error buf %s\n", error_buf);
788 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
790 asn_codec_ctx_t *opt_cod;
792 uint8_t e2smbuffer[8192];
793 size_t e2smbuffer_size = 8192;
795 uint8_t e2smbuffer2[8192];
796 size_t e2smbuffer_size2 = 8192;
799 asn_encode_to_buffer(opt_cod,
800 ATS_ALIGNED_BASIC_PER,
801 &asn_DEF_E2SM_KPM_IndicationMessage,
802 indicationmessage, e2smbuffer, e2smbuffer_size);
804 fprintf(stderr, "er encded is %d\n", er.encoded);
805 fprintf(stderr, "after encoding message\n");
810 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
812 uint8_t *nrcellid_buf,
814 const uint8_t *serving_buf,
815 const uint8_t *neighbor_buf) {
817 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
818 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
819 nrcellid_buf, crnti_buf,
820 serving_buf, neighbor_buf);
822 printf("After creating RAN container, xer printing it\n");
823 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
826 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
827 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
828 containers_list->theRANContainer = ranco;
830 E2SM_KPM_IndicationMessage_Format1_t *format =
831 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
832 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
834 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
836 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
838 indicationmessage->indicationMessage.present = pres;
840 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
841 if (format) free(format);
843 char error_buf[300] = {0, };
846 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
847 printf("error length %d\n", errlen);
848 printf("error buf %s\n", error_buf);
850 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
852 asn_codec_ctx_t *opt_cod;
854 uint8_t e2smbuffer[8192];
855 size_t e2smbuffer_size = 8192;
857 uint8_t e2smbuffer2[8192];
858 size_t e2smbuffer_size2 = 8192;
861 asn_encode_to_buffer(opt_cod,
862 ATS_ALIGNED_BASIC_PER,
863 &asn_DEF_E2SM_KPM_IndicationMessage,
864 indicationmessage, e2smbuffer, e2smbuffer_size);
866 fprintf(stderr, "er encded is %d\n", er.encoded);
867 fprintf(stderr, "after encoding message\n");
872 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
874 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
875 encode_kpm_ocucp_user_level(ranco);
877 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
878 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
879 containers_list->theRANContainer = ranco;
881 E2SM_KPM_IndicationMessage_Format1_t *format =
882 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
883 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
885 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
887 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
889 indicationmessage->indicationMessage.present = pres;
891 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
892 if (format) free(format);
894 char error_buf[300] = {0, };
897 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
898 printf("error length %d\n", errlen);
899 printf("error buf %s\n", error_buf);
901 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
903 asn_codec_ctx_t *opt_cod;
905 uint8_t e2smbuffer[8192];
906 size_t e2smbuffer_size = 8192;
908 uint8_t e2smbuffer2[8192];
909 size_t e2smbuffer_size2 = 8192;
912 asn_encode_to_buffer(opt_cod,
913 ATS_ALIGNED_BASIC_PER,
914 &asn_DEF_E2SM_KPM_IndicationMessage,
915 indicationmessage, e2smbuffer, e2smbuffer_size);
917 fprintf(stderr, "er encded is %d\n", er.encoded);
918 fprintf(stderr, "after encoding message\n");
923 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
925 uint8_t *nrcellid_buf,
930 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
931 encode_kpm_ocuup_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,pdcp_bytesdl,pdcp_bytesul);
933 fprintf(stderr, "After creating RAN container, xer printing it\n");
934 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
936 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
937 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
938 containers_list->theRANContainer = ranco;
940 E2SM_KPM_IndicationMessage_Format1_t *format =
941 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
942 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
944 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
946 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
948 indicationmessage->indicationMessage.present = pres;
950 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
951 if (format) free(format);
953 char error_buf[300] = {0, };
956 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
957 printf("error length %d\n", errlen);
958 printf("error buf %s\n", error_buf);
960 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
962 asn_codec_ctx_t *opt_cod;
964 uint8_t e2smbuffer[8192];
965 size_t e2smbuffer_size = 8192;
967 uint8_t e2smbuffer2[8192];
968 size_t e2smbuffer_size2 = 8192;
970 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
973 asn_encode_to_buffer(opt_cod,
974 ATS_ALIGNED_BASIC_PER,
975 &asn_DEF_E2SM_KPM_IndicationMessage,
976 indicationmessage, e2smbuffer, e2smbuffer_size);
978 fprintf(stderr, "er encded is %d\n", er.encoded);
979 fprintf(stderr, "after encoding message\n");
984 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
986 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
987 //encode_kpm_ocuup_user_level(ranco);
990 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
991 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
992 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
993 ts->size = strlen((char*)buf);
994 memcpy(ts->buf,buf,ts->size);
998 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
999 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
1001 uint8_t *buf2 = (uint8_t*)"747";
1003 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1004 plmnidstr->buf = (uint8_t*)calloc(3,1);
1005 plmnidstr->size = 3;
1006 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1010 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1011 uint8_t* buf3 = (uint8_t*)"12340";
1012 nrcellid->buf = (uint8_t*)calloc(1,5);
1013 memcpy(nrcellid->buf, buf3, 5);
1015 nrcellid->bits_unused = 4;
1017 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1018 nrcgi->pLMN_Identity = *plmnidstr;
1019 nrcgi->nRCellIdentity = *nrcellid;
1020 if (plmnidstr) free(plmnidstr);
1021 if (nrcellid) free(nrcellid);
1025 report_item->nRCGI = *nrcgi;
1026 if (nrcgi) free(nrcgi);
1028 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
1029 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
1033 uint8_t* crnti_str = (uint8_t*)"1111";
1034 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
1035 crnti->buf = (uint8_t*)calloc(1,4);
1039 crnti->size = strlen((char*)crnti_str);
1042 memcpy(crnti->buf, crnti_str, crnti->size);
1044 uint8_t *buf_serving = (uint8_t*)"RSRP10";
1045 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1046 servingstr->buf = (uint8_t*)calloc(6,1);
1047 servingstr->size = 6;
1048 memcpy(servingstr->buf, buf_serving, servingstr->size);
1050 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
1051 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1052 neighborstr->buf = (uint8_t*)calloc(7,1);
1053 neighborstr->size = 7;
1054 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
1056 ue_report_item->c_RNTI = *crnti;
1057 ue_report_item->serving_Cell_RF_Type = servingstr;
1058 ue_report_item->neighbor_Cell_RF = neighborstr;
1061 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
1063 ranco->timestamp = *ts;
1064 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
1065 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
1067 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
1070 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1071 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1072 containers_list->theRANContainer = ranco;
1074 E2SM_KPM_IndicationMessage_Format1_t *format =
1075 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1076 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1078 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1080 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1082 indicationmessage->indicationMessage.present = pres;
1084 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1085 if (format) free(format);
1087 char error_buf[300] = {0, };
1090 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1091 printf("error length %d\n", errlen);
1092 printf("error buf %s\n", error_buf);
1094 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1096 asn_codec_ctx_t *opt_cod;
1098 uint8_t e2smbuffer[8192];
1099 size_t e2smbuffer_size = 8192;
1101 uint8_t e2smbuffer2[8192];
1102 size_t e2smbuffer_size2 = 8192;
1105 asn_encode_to_buffer(opt_cod,
1106 ATS_ALIGNED_BASIC_PER,
1107 &asn_DEF_E2SM_KPM_IndicationMessage,
1108 indicationmessage, e2smbuffer, e2smbuffer_size);
1110 fprintf(stderr, "er encded is %d\n", er.encoded);
1111 fprintf(stderr, "after encoding message\n");
1116 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1122 uint8_t* plmnid_buf,
1123 uint8_t* nrcellid_buf,
1128 asn_codec_ctx_t *opt_cod;
1130 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1131 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1132 fqi_item->fiveQI = fiveqi;
1133 fqi_item->dl_PRBUsage = &dl_prb_usage;
1134 fqi_item->ul_PRBUsage = &ul_prb_usage;
1136 uint8_t *buf1 = (uint8_t*)"4";
1138 // std::string sd = "SD1";
1139 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1140 // uint8_t *bufz = &sdvec[0];
1141 uint8_t *bufz = (uint8_t*)"SD1";
1143 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1144 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1145 snssai->sST.buf = (uint8_t*)calloc(1,1);
1146 snssai->sST.size = 1;
1147 memcpy(snssai->sST.buf, sst_buf, 1);
1148 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1149 snssai->sD->buf = (uint8_t*)calloc(1,3);
1150 snssai->sD->size = 3;
1151 memcpy(snssai->sD->buf, sd_buf, 3);
1154 SlicePerPlmnPerCellListItem_t *sliceitem =
1155 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1156 sliceitem->sliceID = *snssai;
1157 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1158 if (snssai) free(snssai);
1160 uint8_t *buf2 = (uint8_t*)"747";
1162 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1163 plmnid->buf = (uint8_t*)calloc(3,1);
1165 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1167 ServedPlmnPerCellListItem_t *percellitem1 =
1168 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1169 percellitem1->pLMN_Identity = *plmnid;
1170 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1171 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1172 if (plmnid) free(plmnid);
1174 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1175 plmnidstr->buf = (uint8_t*)calloc(3,1);
1176 plmnidstr->size = 3;
1177 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
1181 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1182 uint8_t* buf3 = (uint8_t*)"12340";
1183 nrcellid->buf = (uint8_t*)calloc(1,5);
1184 memcpy(nrcellid->buf, nrcellid_buf, 5);
1186 nrcellid->bits_unused = 4;
1188 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1189 nrcgi->pLMN_Identity = *plmnidstr;
1190 nrcgi->nRCellIdentity = *nrcellid;
1191 if (plmnidstr) free(plmnidstr);
1192 if (nrcellid) free(nrcellid);
1195 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1196 listitem1->nRCGI = *nrcgi;
1197 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
1198 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
1199 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1200 if (nrcgi) free(nrcgi);
1203 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1204 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1205 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1207 PF_Container_PR pres1 = PF_Container_PR_oDU;
1209 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1210 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1211 pfcontainer->present = pres1;
1212 pfcontainer->choice.oDU = *ducont;
1213 if (ducont) free(ducont);
1215 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1216 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1217 containers_list->performanceContainer = pfcontainer;
1219 E2SM_KPM_IndicationMessage_Format1_t *format =
1220 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1221 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1223 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1225 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1227 indicationmessage->indicationMessage.present = pres;
1229 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1230 if (format) free(format);
1232 char error_buf[300] = {0, };
1235 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1236 printf("error length %d\n", errlen);
1237 printf("error buf %s\n", error_buf);
1239 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1242 uint8_t e2smbuffer[8192];
1243 size_t e2smbuffer_size = 8192;
1245 uint8_t e2smbuffer2[8192];
1246 size_t e2smbuffer_size2 = 8192;
1249 asn_encode_to_buffer(opt_cod,
1250 ATS_ALIGNED_BASIC_PER,
1251 &asn_DEF_E2SM_KPM_IndicationMessage,
1252 indicationmessage, e2smbuffer, e2smbuffer_size);
1254 fprintf(stderr, "er encded is %d\n", er.encoded);
1255 fprintf(stderr, "after encoding message\n");
1261 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1264 long dl_prb_usage = 50;
1265 long ul_prb_usage = 70;
1267 asn_codec_ctx_t *opt_cod;
1269 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1270 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1271 fqi_item->fiveQI = fiveqi;
1272 fqi_item->dl_PRBUsage = &dl_prb_usage;
1273 fqi_item->ul_PRBUsage = &ul_prb_usage;
1275 uint8_t *buf1 = (uint8_t*)"4";
1276 // std::string sd = "SD1";
1277 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1278 // uint8_t *bufz = &sdvec[0];
1279 uint8_t *bufz = (uint8_t*)"SD1";
1281 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1282 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1283 snssai->sST.buf = (uint8_t*)calloc(1,1);
1284 snssai->sST.size = 1;
1285 memcpy(snssai->sST.buf, buf1, 1);
1286 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1287 snssai->sD->buf = (uint8_t*)calloc(1,3);
1288 snssai->sD->size = 3;
1289 memcpy(snssai->sD->buf, bufz, 3);
1292 SlicePerPlmnPerCellListItem_t *sliceitem =
1293 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1294 sliceitem->sliceID = *snssai;
1295 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1296 if (snssai) free(snssai);
1298 uint8_t *buf2 = (uint8_t*)"747";
1300 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1301 plmnid->buf = (uint8_t*)calloc(3,1);
1303 memcpy(plmnid->buf, buf2, plmnid->size);
1305 ServedPlmnPerCellListItem_t *percellitem1 =
1306 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1307 percellitem1->pLMN_Identity = *plmnid;
1308 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1309 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1311 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1312 plmnidstr->buf = (uint8_t*)calloc(3,1);
1313 plmnidstr->size = 3;
1314 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1318 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1319 uint8_t* buf3 = (uint8_t*)"12340";
1320 nrcellid->buf = (uint8_t*)calloc(1,5);
1321 memcpy(nrcellid->buf, buf3, 5);
1323 nrcellid->bits_unused = 4;
1325 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1326 nrcgi->pLMN_Identity = *plmnidstr;
1327 nrcgi->nRCellIdentity = *nrcellid;
1328 if (plmnidstr) free(plmnidstr);
1329 if (nrcellid) free(nrcellid);
1331 long dl_prbs = (long)100;
1332 long ul_prbs = (long)120;
1334 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1335 listitem1->nRCGI = *nrcgi;
1336 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1337 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1338 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1339 if (nrcgi) free(nrcgi);
1342 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1343 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1344 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1346 PF_Container_PR pres1 = PF_Container_PR_oDU;
1348 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1349 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1350 pfcontainer->present = pres1;
1351 pfcontainer->choice.oDU = *ducont;
1352 if (ducont) free(ducont);
1354 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1355 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1356 containers_list->performanceContainer = pfcontainer;
1358 E2SM_KPM_IndicationMessage_Format1_t *format =
1359 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1360 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1362 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1364 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1366 indicationmessage->indicationMessage.present = pres;
1368 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1369 if (format) free(format);
1371 char error_buf[300] = {0, };
1374 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1375 printf("error length %d\n", errlen);
1376 printf("error buf %s\n", error_buf);
1378 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1381 uint8_t e2smbuffer[8192];
1382 size_t e2smbuffer_size = 8192;
1384 uint8_t e2smbuffer2[8192];
1385 size_t e2smbuffer_size2 = 8192;
1388 asn_encode_to_buffer(opt_cod,
1389 ATS_ALIGNED_BASIC_PER,
1390 &asn_DEF_E2SM_KPM_IndicationMessage,
1391 indicationmessage, e2smbuffer, e2smbuffer_size);
1393 fprintf(stderr, "er encded is %d\n", er.encoded);
1394 fprintf(stderr, "after encoding message\n");
1399 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1400 uint8_t *gnbcuupname_buf,
1405 uint8_t *plmnid_buf) {
1407 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1410 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1411 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1412 gnbcuupname->size = 8;
1413 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1414 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1417 //We need to convert bytes_dl into array of uint8_t
1421 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1423 if (bytes_dl <= 64) {
1426 uint8_t buffer[array_size_dl];
1427 buffer[0] = bytes_dl & 0xFF;
1428 bytesdl->buf = (uint8_t*)calloc(1,1);
1429 memcpy(bytesdl->buf,buffer,1);
1432 } else if (bytes_dl <= 16384) {
1435 uint8_t buffer[array_size_dl];
1436 buffer[0] = (bytes_dl >> 8) & 0xFF;
1437 buffer[1] = bytes_dl & 0xFF;
1438 bytesdl->buf = (uint8_t*)calloc(2,1);
1439 memcpy(bytesdl->buf,buffer,2);
1442 } else if (bytes_dl <= 4194304) {
1445 uint8_t buffer[array_size_dl];
1446 buffer[0] = (bytes_dl >> 16) & 0xFF;
1447 buffer[1] = (bytes_dl >> 8) & 0xFF;
1448 buffer[2] = bytes_dl & 0xFF;
1449 bytesdl->buf = (uint8_t*)calloc(3,1);
1450 memcpy(bytesdl->buf,buffer,3);
1453 } else if (bytes_dl <= 1073741824) {
1455 uint8_t buffer[array_size_dl];
1456 buffer[0] = (bytes_dl >> 24) & 0xFF;
1457 buffer[1] = (bytes_dl >> 16) & 0xFF;
1458 buffer[2] = (bytes_dl >> 8) & 0xFF;
1459 buffer[3] = bytes_dl & 0xFF;
1460 bytesdl->buf = (uint8_t*)calloc(4,1);
1461 memcpy(bytesdl->buf,buffer,4);
1466 //We need to convert bytes_ul into array of uint8_t
1467 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1471 if (bytes_ul <= 64) {
1474 uint8_t buffer[array_size_ul];
1475 buffer[0] = bytes_ul & 0xFF;
1476 bytesul->buf = (uint8_t*)calloc(1,1);
1477 memcpy(bytesul->buf,buffer,1);
1480 } else if (bytes_ul <= 16384) {
1483 uint8_t buffer[array_size_ul];
1484 buffer[0] = (bytes_ul >> 8) & 0xFF;
1485 buffer[1] = bytes_ul & 0xFF;
1486 bytesul->buf = (uint8_t*)calloc(2,1);
1487 memcpy(bytesul->buf,buffer,2);
1490 } else if (bytes_ul <= 4194304) {
1493 uint8_t buffer[array_size_ul];
1494 buffer[0] = (bytes_ul >> 16) & 0xFF;
1495 buffer[1] = (bytes_ul >> 8) & 0xFF;
1496 buffer[2] = bytes_ul & 0xFF;
1497 bytesul->buf = (uint8_t*)calloc(3,1);
1498 memcpy(bytesul->buf,buffer,3);
1501 } else if (bytes_ul <= 1073741824) {
1503 uint8_t buffer[array_size_ul];
1504 buffer[0] = (bytes_ul >> 24) & 0xFF;
1505 buffer[1] = (bytes_ul >> 16) & 0xFF;
1506 buffer[2] = (bytes_ul >> 8) & 0xFF;
1507 buffer[3] = bytes_ul & 0xFF;
1508 bytesul->buf = (uint8_t*)calloc(4,1);
1509 memcpy(bytesul->buf,buffer,4);
1514 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1515 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1516 fqilistitem->fiveQI = fqi;
1517 fqilistitem->pDCPBytesDL = bytesdl;
1518 fqilistitem->pDCPBytesUL = bytesul;
1521 uint8_t *buf1 = (uint8_t*)"4";
1522 uint8_t *bufz = (uint8_t*)"SD1";
1524 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1525 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1526 snssai->sST.buf = (uint8_t*)calloc(1,1);
1527 snssai->sST.size = 1;
1528 memcpy(snssai->sST.buf, sst_buf, 1);
1529 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1530 snssai->sD->buf = (uint8_t*)calloc(1,3);
1531 snssai->sD->size = 3;
1532 memcpy(snssai->sD->buf, sd_buf, 3);
1536 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1537 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1538 slicelistitem->sliceID = *snssai;
1539 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1540 if (snssai) free(snssai);
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;
1579 if (plmnid) free(plmnid);
1581 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1582 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1583 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1588 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1589 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1590 listitem1->interface_type = 2;
1591 listitem1->o_CU_UP_PM_Container = *meas_cont;
1592 if (meas_cont) free(meas_cont);
1594 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1595 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1596 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1597 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1599 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1601 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1602 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1603 pfcontainer->present = pres1;
1604 pfcontainer->choice.oCU_UP = *cuupcont;
1605 if (cuupcont) free(cuupcont);
1607 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1608 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1609 containers_list->performanceContainer = pfcontainer;
1611 E2SM_KPM_IndicationMessage_Format1_t *format =
1612 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1613 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1615 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1617 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1619 indicationmessage->indicationMessage.present = pres;
1621 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1622 if (format) free(format);
1624 char error_buf[300] = {0, };
1627 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1628 printf("error length %d\n", errlen);
1629 printf("error buf %s\n", error_buf);
1631 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1634 uint8_t e2smbuffer[8192];
1635 size_t e2smbuffer_size = 8192;
1637 uint8_t e2smbuffer2[8192];
1638 size_t e2smbuffer_size2 = 8192;
1641 asn_encode_to_buffer(opt_cod,
1642 ATS_ALIGNED_BASIC_PER,
1643 &asn_DEF_E2SM_KPM_IndicationMessage,
1644 indicationmessage, e2smbuffer, e2smbuffer_size);
1646 fprintf(stderr, "er encded is %d\n", er.encoded);
1647 fprintf(stderr, "after encoding message\n");
1652 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1654 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1657 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1658 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1659 gnbcuupname->size = 8;
1660 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1661 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1664 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1667 bytesdl->buf = (uint8_t*)calloc(1,1);
1668 memcpy(bytesdl->buf, buffer,1);
1671 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1674 bytesul->buf = (uint8_t*)calloc(1,1);
1675 memcpy(bytesul->buf, buffer1, 1);
1678 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1679 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1680 fqilistitem->fiveQI = 9;
1681 fqilistitem->pDCPBytesDL = bytesdl;
1682 fqilistitem->pDCPBytesUL = bytesul;
1685 uint8_t *buf1 = (uint8_t*)"4";
1686 uint8_t *bufz = (uint8_t*)"SD1";
1688 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1689 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1690 snssai->sST.buf = (uint8_t*)calloc(1,1);
1691 snssai->sST.size = 1;
1692 memcpy(snssai->sST.buf, buf1, 1);
1693 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1694 snssai->sD->buf = (uint8_t*)calloc(1,3);
1695 snssai->sD->size = 3;
1696 memcpy(snssai->sD->buf, bufz, 3);
1700 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1701 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1702 slicelistitem->sliceID = *snssai;
1703 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1704 if (snssai) free(snssai);
1706 asn_codec_ctx_t *opt_cod;
1709 uint8_t e2smbuffera[8192];
1710 size_t e2smbuffer_sizea = 8192;
1714 asn_enc_rval_t era =
1715 asn_encode_to_buffer(opt_cod,
1716 ATS_ALIGNED_BASIC_PER,
1717 &asn_DEF_SliceToReportListItem,
1718 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1719 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1720 fprintf(stderr, "after encoding message\n");
1724 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1725 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1726 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1728 uint8_t *buf2 = (uint8_t*)"747";
1729 // std::string pl = "PLMNID7";
1730 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1731 // uint8_t *buf2 = &plvec[0];
1733 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1734 plmnid->buf = (uint8_t*)calloc(3,1);
1736 memcpy(plmnid->buf, buf2, plmnid->size);
1739 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1740 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1741 plmnidlist->pLMN_Identity = *plmnid;
1742 plmnidlist->cu_UP_PM_5GC = pm_format;
1744 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1745 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1746 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1751 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1752 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1753 listitem1->interface_type = 2;
1754 listitem1->o_CU_UP_PM_Container = *meas_cont;
1755 if (meas_cont) free(meas_cont);
1757 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1758 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1759 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1760 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1762 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1764 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1765 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1766 pfcontainer->present = pres1;
1767 pfcontainer->choice.oCU_UP = *cuupcont;
1768 if (cuupcont) free(cuupcont);
1770 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1771 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1772 containers_list->performanceContainer = pfcontainer;
1774 E2SM_KPM_IndicationMessage_Format1_t *format =
1775 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1776 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1778 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1780 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1782 indicationmessage->indicationMessage.present = pres;
1784 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1785 if (format) free(format);
1787 char error_buf[300] = {0, };
1790 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1791 printf("error length %d\n", errlen);
1792 printf("error buf %s\n", error_buf);
1794 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1797 uint8_t e2smbuffer[8192];
1798 size_t e2smbuffer_size = 8192;
1800 uint8_t e2smbuffer2[8192];
1801 size_t e2smbuffer_size2 = 8192;
1804 asn_encode_to_buffer(opt_cod,
1805 ATS_ALIGNED_BASIC_PER,
1806 &asn_DEF_E2SM_KPM_IndicationMessage,
1807 indicationmessage, e2smbuffer, e2smbuffer_size);
1809 fprintf(stderr, "er encded is %d\n", er.encoded);
1810 fprintf(stderr, "after encoding message\n");
1815 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1818 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1819 //std::string gn = "GNBCUUP5";
1820 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1821 //uint8_t *buf = &gnvec[0];
1822 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1823 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1824 gnbcuupname->size = 8;
1825 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1826 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1829 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1832 bytesdl->buf = (uint8_t*)calloc(1,1);
1833 memcpy(bytesdl->buf, buffer,1);
1836 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1839 bytesul->buf = (uint8_t*)calloc(1,1);
1840 memcpy(bytesul->buf, buffer1, 1);
1843 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1844 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1845 fqilistitem->fiveQI = 9;
1846 fqilistitem->pDCPBytesDL = bytesdl;
1847 fqilistitem->pDCPBytesUL = bytesul;
1851 // std::string sl = "SLICE4";
1852 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1853 // uint8_t *buf1 = &slvec[0];
1854 uint8_t *buf1 = (uint8_t*)"4";
1855 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1857 sst->buf = (uint8_t*)calloc(1,6);
1858 memcpy(sst->buf,buf1,sst->size);
1860 // std::string sd = "SD1";
1861 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1862 // uint8_t *bufz = &sdvec[0];
1863 uint8_t *bufz = (uint8_t*)"SD1";
1864 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1866 sds->buf = (uint8_t*)calloc(1,3);
1867 memcpy(sds->buf, bufz, sds->size);
1870 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1871 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1872 snssai->sST.buf = (uint8_t*)calloc(1,1);
1873 snssai->sST.size = 1;
1874 memcpy(snssai->sST.buf, buf1, 1);
1875 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1876 snssai->sD->buf = (uint8_t*)calloc(1,3);
1877 snssai->sD->size = 3;
1878 memcpy(snssai->sD->buf, bufz, 3);
1882 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1883 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1884 slicelistitem->sliceID = *snssai;
1885 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1887 asn_codec_ctx_t *opt_cod;
1890 uint8_t e2smbuffera[8192];
1891 size_t e2smbuffer_sizea = 8192;
1895 asn_enc_rval_t era =
1896 asn_encode_to_buffer(opt_cod,
1897 ATS_ALIGNED_BASIC_PER,
1898 &asn_DEF_SliceToReportListItem,
1899 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1900 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1901 fprintf(stderr, "after encoding message\n");
1905 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1906 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1907 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1909 uint8_t *buf2 = (uint8_t*)"747";
1910 // std::string pl = "PLMNID7";
1911 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1912 // uint8_t *buf2 = &plvec[0];
1914 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1915 plmnid->buf = (uint8_t*)calloc(3,1);
1917 memcpy(plmnid->buf, buf2, plmnid->size);
1920 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1921 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1922 plmnidlist->pLMN_Identity = *plmnid;
1923 plmnidlist->cu_UP_PM_5GC = pm_format;
1925 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1926 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1927 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1932 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1933 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1934 listitem1->interface_type = 2;
1935 listitem1->o_CU_UP_PM_Container = *meas_cont;
1937 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1938 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1939 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1940 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1942 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1944 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1945 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1946 pfcontainer->present = pres1;
1947 pfcontainer->choice.oCU_UP = *cuupcont;
1949 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1950 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1951 containers_list->performanceContainer = pfcontainer;
1953 E2SM_KPM_IndicationMessage_Format1_t *format =
1954 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1955 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1957 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1959 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1961 indicationmessage->present = pres;
1963 indicationmessage->choice.indicationMessage_Format1 = *format;
1965 char *error_buf = (char*)calloc(300, sizeof(char));
1968 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1969 printf("error length %d\n", errlen);
1970 printf("error buf %s\n", error_buf);
1972 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1975 uint8_t e2smbuffer[8192];
1976 size_t e2smbuffer_size = 8192;
1978 uint8_t e2smbuffer2[8192];
1979 size_t e2smbuffer_size2 = 8192;
1982 asn_encode_to_buffer(opt_cod,
1983 ATS_ALIGNED_BASIC_PER,
1984 &asn_DEF_E2SM_KPM_IndicationMessage,
1985 indicationmessage, e2smbuffer, e2smbuffer_size);
1987 fprintf(stderr, "er encded is %d\n", er.encoded);
1988 fprintf(stderr, "after encoding message\n");
1994 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1995 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1996 std::string gn = "GNBCUUP5";
1997 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1998 uint8_t *buf = &gnvec[0];
1999 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2000 gnbcuupname->size = 8;
2001 gnbcuupname->buf = (uint8_t*)calloc(1,8);
2002 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
2005 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2008 bytesdl->buf = (uint8_t*)calloc(1,1);
2009 memcpy(bytesdl->buf, buffer,1);
2012 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2015 bytesul->buf = (uint8_t*)calloc(1,1);
2016 memcpy(bytesul->buf, buffer1, 1);
2019 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
2020 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
2021 fqilistitem->fiveQI = 9;
2022 fqilistitem->pDCPBytesDL = bytesdl;
2023 fqilistitem->pDCPBytesUL = bytesul;
2027 std::string sl = "SLICE4";
2028 std::vector<uint8_t> slvec(sl.begin(), sl.end());
2029 // uint8_t *buf1 = &slvec[0];
2030 uint8_t *buf1 = (uint8_t*)"SLICE4";
2031 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2033 sst->buf = (uint8_t*)calloc(1,6);
2034 memcpy(sst->buf,buf1,sst->size);
2036 std::string sd = "SD1";
2037 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
2038 // uint8_t *bufz = &sdvec[0];
2039 uint8_t *bufz = (uint8_t*)"SD1";
2040 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2042 sds->buf = (uint8_t*)calloc(1,3);
2043 memcpy(sds->buf, bufz, sds->size);
2046 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
2047 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
2048 snssai->sST.buf = (uint8_t*)calloc(6,1);
2049 snssai->sST.size = 6;
2050 memcpy(snssai->sST.buf, buf1, 6);
2051 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2052 snssai->sD->buf = (uint8_t*)calloc(1,3);
2053 snssai->sD->size = 3;
2054 memcpy(snssai->sD->buf, bufz, 3);
2058 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
2059 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
2060 slicelistitem->sliceID = *snssai;
2061 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
2063 uint8_t e2smbuffera[8192];
2064 size_t e2smbuffer_sizea = 8192;
2067 asn_encode_to_buffer(nullptr,
2068 ATS_ALIGNED_BASIC_PER,
2069 &asn_DEF_SliceToReportListItem,
2070 slicelistitem, e2smbuffera, e2smbuffer_sizea);
2071 fprintf(stderr, "inner er encded is %d\n", era.encoded);
2072 fprintf(stderr, "after encoding message\n");
2074 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
2075 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
2076 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
2078 std::string pl = "PLMNID7";
2079 std::vector<uint8_t> plvec(pl.begin(), pl.end());
2080 uint8_t *buf2 = &plvec[0];
2082 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
2083 plmnid->buf = (uint8_t*)calloc(1,7);
2085 memcpy(plmnid->buf, buf2, plmnid->size);
2088 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
2089 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
2090 plmnidlist->pLMN_Identity = *plmnid;
2091 plmnidlist->cu_UP_PM_5GC = pm_format;
2093 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
2094 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
2095 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
2100 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
2101 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
2102 listitem1->interface_type = 2;
2103 listitem1->o_CU_UP_PM_Container = *meas_cont;
2105 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
2106 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
2107 cuupcont->gNB_CU_UP_Name = gnbcuupname;
2108 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
2110 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
2112 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
2113 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
2114 pfcontainer->present = pres1;
2115 pfcontainer->choice.oCU_UP = *cuupcont;
2117 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
2118 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
2119 containers_list->performanceContainer = pfcontainer;
2121 E2SM_KPM_IndicationMessage_Format1_t *format =
2122 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
2123 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
2125 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
2127 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
2129 indicationmessage->present = pres;
2131 indicationmessage->choice.indicationMessage_Format1 = *format;
2133 char *error_buf = (char*)calloc(300, sizeof(char));
2136 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
2137 printf("error length %d\n", errlen);
2138 printf("error buf %s\n", error_buf);
2141 uint8_t e2smbuffer[8192];
2142 size_t e2smbuffer_size = 8192;
2144 uint8_t e2smbuffer2[8192];
2145 size_t e2smbuffer_size2 = 8192;
2148 asn_encode_to_buffer(nullptr,
2149 ATS_ALIGNED_BASIC_PER,
2150 &asn_DEF_E2SM_KPM_IndicationMessage,
2151 indicationmessage, e2smbuffer, e2smbuffer_size);
2153 fprintf(stderr, "er encded is %d\n", er.encoded);
2154 fprintf(stderr, "after encoding message\n");