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";
38 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
40 ranfunc_desc->ranFunction_Name.ranFunction_ShortName.size = strlen((char*)buf);
41 ranfunc_desc->ranFunction_Name.ranFunction_ShortName.buf = (uint8_t*)calloc(strlen((char*)buf), sizeof(uint8_t));
42 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_ShortName.buf, buf, ranfunc_desc->ranFunction_Name.ranFunction_ShortName.size);
44 // ranfunc_desc->ranFunction_Name.ranFunction_Description = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
45 ranfunc_desc->ranFunction_Name.ranFunction_Description.buf = (uint8_t*)calloc(1,strlen((char*)buf2));
46 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_Description.buf, buf2, strlen((char*)buf2));
47 ranfunc_desc->ranFunction_Name.ranFunction_Description.size = strlen((char*)buf2);
48 ranfunc_desc->ranFunction_Name.ranFunction_Instance = &inst;
52 // ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
53 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf = (uint8_t*)calloc(1,strlen((char*)buf3));
54 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf, buf3, strlen((char*)buf3));
55 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.size = strlen((char*)buf3);
60 RIC_EventTriggerStyle_List_t *trigger_style =
61 (RIC_EventTriggerStyle_List_t*)calloc(1, sizeof(RIC_EventTriggerStyle_List_t));
62 trigger_style->ric_EventTriggerStyle_Type = 1;
63 uint8_t *buf4 = (uint8_t*)"Periodic report";
64 // trigger_style->ric_EventTriggerStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
65 trigger_style->ric_EventTriggerStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf4));
66 memcpy(trigger_style->ric_EventTriggerStyle_Name.buf, buf4, strlen((char*)buf4));
67 trigger_style->ric_EventTriggerStyle_Name.size = strlen((char*)buf4);
68 trigger_style->ric_EventTriggerFormat_Type = 5;
72 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List =
73 (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));
75 int ret = ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List->list , trigger_style);
76 printf("ret is %d\n", ret);
78 RIC_ReportStyle_List_t *report_style1 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
79 report_style1->ric_ReportStyle_Type = 1;
81 uint8_t *buf5 = (uint8_t*)"O-DU Measurement Container for the 5GC connected deployment";
85 // report_style1->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
86 report_style1->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf5));
87 memcpy(report_style1->ric_ReportStyle_Name.buf, buf5, strlen((char*)buf5));
88 report_style1->ric_ReportStyle_Name.size = strlen((char*)buf5);
89 report_style1->ric_IndicationHeaderFormat_Type = 1;
90 report_style1->ric_IndicationMessageFormat_Type = 1;
94 RIC_ReportStyle_List_t *report_style2 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
95 report_style2->ric_ReportStyle_Type = 2;
97 uint8_t *buf6 = (uint8_t*)"O-DU Measurement Container for the EPC connected deployment";
99 // report_style2->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
102 report_style2->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf6));
103 memcpy(report_style2->ric_ReportStyle_Name.buf, buf6, strlen((char*)buf6));
104 report_style2->ric_ReportStyle_Name.size = strlen((char*)buf6);
105 report_style2->ric_IndicationHeaderFormat_Type = 1;
106 report_style2->ric_IndicationMessageFormat_Type = 1;
110 RIC_ReportStyle_List_t *report_style3 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
111 report_style3->ric_ReportStyle_Type = 3;
113 uint8_t *buf7 = (uint8_t*)"O-CU-CP Measurement Container for the 5GC connected deployment";
115 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
116 report_style3->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf7));
117 memcpy(report_style3->ric_ReportStyle_Name.buf, buf7, strlen((char*)buf7));
118 report_style3->ric_ReportStyle_Name.size = strlen((char*)buf7);
119 report_style3->ric_IndicationHeaderFormat_Type = 1;
120 report_style3->ric_IndicationMessageFormat_Type = 1;
122 RIC_ReportStyle_List_t *report_style4 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
123 report_style4->ric_ReportStyle_Type = 4;
125 uint8_t *buf8 = (uint8_t*)"O-CU-CP Measurement Container for the EPC connected deployment";
127 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
128 report_style4->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf8));
129 memcpy(report_style4->ric_ReportStyle_Name.buf, buf8, strlen((char*)buf8));
130 report_style4->ric_ReportStyle_Name.size = strlen((char*)buf8);
131 report_style4->ric_IndicationHeaderFormat_Type = 1;
132 report_style4->ric_IndicationMessageFormat_Type = 1;
134 RIC_ReportStyle_List_t *report_style5 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
135 report_style5->ric_ReportStyle_Type = 5;
137 uint8_t *buf9 = (uint8_t*)"O-CU-UP Measurement Container for the 5GC connected deployment";
139 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
140 report_style5->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf9));
141 memcpy(report_style5->ric_ReportStyle_Name.buf, buf9, strlen((char*)buf9));
142 report_style5->ric_ReportStyle_Name.size = strlen((char*)buf9);
143 report_style5->ric_IndicationHeaderFormat_Type = 1;
144 report_style5->ric_IndicationMessageFormat_Type = 1;
147 RIC_ReportStyle_List_t *report_style6 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
148 report_style6->ric_ReportStyle_Type = 6;
150 uint8_t *buf10 = (uint8_t*)"O-CU-UP Measurement Container for the EPC connected deployment";
152 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
153 report_style6->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf10));
154 memcpy(report_style6->ric_ReportStyle_Name.buf, buf10, strlen((char*)buf10));
155 report_style6->ric_ReportStyle_Name.size = strlen((char*)buf10);
156 report_style6->ric_IndicationHeaderFormat_Type = 1;
157 report_style6->ric_IndicationMessageFormat_Type = 1;
160 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List =
161 (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));
163 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style1);
164 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style2);
165 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style3);
166 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style4);
167 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style5);
168 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style6);
170 xer_fprint(stderr, &asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
174 void encode_e2sm_kpm_indication_header(E2SM_KPM_IndicationHeader_t *ihead, uint8_t *plmnid_buf, uint8_t *sst_buf, uint8_t *sd_buf,
175 long fqival, long qcival, uint8_t *nrcellid_buf, uint8_t *gnbid_buf, int gnbid_unused,
176 uint8_t *cuupid_buf, uint8_t *duid_buf, uint8_t *cuupname_buf) {
179 //uint8_t *plmnid_buf = (uint8_t*)"747";
180 //uint8_t *sst_buf = (uint8_t*)"1";
181 //uint8_t *sd_buf = (uint8_t*)"100";
183 E2SM_KPM_IndicationHeader_Format1_t* ind_header =
184 (E2SM_KPM_IndicationHeader_Format1_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_Format1_t));
186 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
187 plmnid->buf = (uint8_t*)calloc(3,1);
189 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
194 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
195 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
196 snssai->sST.buf = (uint8_t*)calloc(1,1);
197 snssai->sST.size = 1;
198 memcpy(snssai->sST.buf, sst_buf, 1);
199 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
200 snssai->sD->buf = (uint8_t*)calloc(1,3);
201 snssai->sD->size = 3;
202 memcpy(snssai->sD->buf, sd_buf, 3);
204 BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
205 nrcellid->buf = (uint8_t*)calloc(1,5);
207 memcpy(nrcellid->buf, nrcellid_buf, 5);
209 nrcellid->buf[0] = 0x22;
210 nrcellid->buf[1] = 0x5B;
211 nrcellid->buf[2] = 0xD6;
212 nrcellid->buf[3] = 0x00;
213 nrcellid->buf[4] = 0x70;
215 nrcellid->bits_unused = 4;
217 BIT_STRING_t *gnb_bstring = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
218 gnb_bstring->buf = (uint8_t*)calloc(1,4);
219 gnb_bstring->size = 4;
220 memcpy(gnb_bstring->buf, gnbid_buf, 4);
222 gnb_bstring->buf[0] = 0xB5;
223 gnb_bstring->buf[1] = 0xC6;
224 gnb_bstring->buf[2] = 0x77;
225 gnb_bstring->buf[3] = 0x88;
228 gnb_bstring->bits_unused = gnbid_unused;
230 INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
231 // uint8_t buffer[1];
232 // buffer[0] = 20000;
233 cuup_id->buf = (uint8_t*)calloc(1,1);
234 memcpy(cuup_id->buf, cuupid_buf, 1);
237 INTEGER_t *du_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
238 // uint8_t buffer_duid[1];
239 // buffer_duid[0] = 20000;
240 du_id->buf = (uint8_t*)calloc(1,1);
241 memcpy(du_id->buf, duid_buf, 1);
245 // uint8_t *buf5 = (uint8_t*)"GNBCUUP5";
246 OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
248 cuupname->buf = (uint8_t*)calloc(1,8);
249 memcpy(cuupname->buf, cuupname_buf, cuupname->size);
252 ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID));
253 ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB;
254 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
255 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring;
256 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid;
257 ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id;
261 ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI));
262 ind_header->nRCGI->pLMN_Identity = *plmnid;
263 ind_header->nRCGI->nRCellIdentity = *nrcellid;
264 if (nrcellid) free(nrcellid);
266 ind_header->pLMN_Identity = plmnid;
267 // memcpy(ind_header->fiveQI, &fqival, 4);
269 ind_header->sliceID = snssai;
270 // memcpy(ind_header->qci, &qcival, 4);
273 ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name));
274 ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name;
275 ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname;
276 if (cuupname) free(cuupname);
279 ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID));
280 ind_header->global_GNB_ID->plmn_id = *plmnid;
281 ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
282 ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring;
285 // long msg_type = 2;
286 // ind_header->message_Type = &msg_type;
287 ind_header->gNB_DU_ID = du_id;
290 ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1;
291 ihead->choice.indicationHeader_Format1 = *ind_header;
292 if (ind_header) free(ind_header);
294 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ihead);
300 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco,
302 uint8_t *nrcellid_buf,
307 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
308 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
309 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
310 ts->size = strlen((char*)buf);
311 memcpy(ts->buf,buf,ts->size);
315 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
316 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
318 // uint8_t *buf2 = (uint8_t*)"747";
320 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
321 plmnidstr->buf = (uint8_t*)calloc(3,1);
323 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
327 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
328 // uint8_t* buf3 = (uint8_t*)"12340";
329 nrcellid->buf = (uint8_t*)calloc(1,5);
330 memcpy(nrcellid->buf, nrcellid_buf, 5);
332 nrcellid->bits_unused = 4;
334 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
335 nrcgi->pLMN_Identity = *plmnidstr;
336 nrcgi->nRCellIdentity = *nrcellid;
337 if (plmnidstr) free(plmnidstr);
338 if (nrcellid) free(nrcellid);
342 report_item->nRCGI = *nrcgi;
343 if (nrcgi) free(nrcgi);
345 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
346 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
350 // uint8_t* crnti_str = (uint8_t*)"1111";
351 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
352 crnti->buf = (uint8_t*)calloc(1,4);
356 crnti->size = strlen((char*)crnti_buf);
359 memcpy(crnti->buf, crnti_buf, crnti->size);
363 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
366 if (bytes_dl <= 64) {
369 uint8_t buffer[array_size_dl];
370 buffer[0] = bytes_dl & 0xFF;
371 bytesdl->buf = (uint8_t*)calloc(1,1);
372 memcpy(bytesdl->buf,buffer,1);
375 } else if (bytes_dl <= 16384) {
378 uint8_t buffer[array_size_dl];
379 buffer[0] = (bytes_dl >> 8) & 0xFF;
380 buffer[1] = bytes_dl & 0xFF;
381 bytesdl->buf = (uint8_t*)calloc(2,1);
382 memcpy(bytesdl->buf,buffer,2);
385 } else if (bytes_dl <= 4194304) {
388 uint8_t buffer[array_size_dl];
389 buffer[0] = (bytes_dl >> 16) & 0xFF;
390 buffer[1] = (bytes_dl >> 8) & 0xFF;
391 buffer[2] = bytes_dl & 0xFF;
392 bytesdl->buf = (uint8_t*)calloc(3,1);
393 memcpy(bytesdl->buf,buffer,3);
396 } else if (bytes_dl <= 1073741824) {
398 uint8_t buffer[array_size_dl];
399 buffer[0] = (bytes_dl >> 24) & 0xFF;
400 buffer[1] = (bytes_dl >> 16) & 0xFF;
401 buffer[2] = (bytes_dl >> 8) & 0xFF;
402 buffer[3] = bytes_dl & 0xFF;
403 bytesdl->buf = (uint8_t*)calloc(4,1);
404 memcpy(bytesdl->buf,buffer,4);
409 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
413 if (bytes_ul <= 64) {
416 uint8_t buffer[array_size_ul];
417 buffer[0] = bytes_ul & 0xFF;
418 bytesul->buf = (uint8_t*)calloc(1,1);
419 memcpy(bytesul->buf,buffer,1);
422 } else if (bytes_ul <= 16384) {
425 uint8_t buffer[array_size_ul];
426 buffer[0] = (bytes_ul >> 8) & 0xFF;
427 buffer[1] = bytes_ul & 0xFF;
428 bytesul->buf = (uint8_t*)calloc(2,1);
429 memcpy(bytesul->buf,buffer,2);
432 } else if (bytes_ul <= 4194304) {
435 uint8_t buffer[array_size_ul];
436 buffer[0] = (bytes_ul >> 16) & 0xFF;
437 buffer[1] = (bytes_ul >> 8) & 0xFF;
438 buffer[2] = bytes_ul & 0xFF;
439 bytesul->buf = (uint8_t*)calloc(3,1);
440 memcpy(bytesul->buf,buffer,3);
443 } else if (bytes_ul <= 1073741824) {
445 uint8_t buffer[array_size_ul];
446 buffer[0] = (bytes_ul >> 24) & 0xFF;
447 buffer[1] = (bytes_ul >> 16) & 0xFF;
448 buffer[2] = (bytes_ul >> 8) & 0xFF;
449 buffer[3] = bytes_ul & 0xFF;
450 bytesul->buf = (uint8_t*)calloc(4,1);
451 memcpy(bytesul->buf,buffer,4);
457 ue_report_item->c_RNTI = *crnti;
458 ue_report_item->pDCPBytesDL = bytesdl;
459 ue_report_item->pDCPBytesUL = bytesul;
460 if (crnti) free(crnti);
463 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
465 ranco->timestamp = *ts;
466 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
467 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 int nrcellid_size = 5;
503 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
504 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
506 nrcellid->bits_unused = 4;
508 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
509 nrcgi->pLMN_Identity = *plmnidstr;
510 nrcgi->nRCellIdentity = *nrcellid;
511 if (plmnidstr) free(plmnidstr);
512 if (nrcellid) free(nrcellid);
516 report_item->nRCGI = *nrcgi;
517 if (nrcgi) free(nrcgi);
519 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
520 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
525 int crnti_size = strlen((char*)crnti_buf);
526 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
527 crnti->buf = (uint8_t*)calloc(1, crnti_size);
531 crnti->size = strlen((char*)crnti_buf);
534 memcpy(crnti->buf, crnti_buf, crnti->size);
536 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
538 int serving_buf_len = strlen((char*)serving_buf);
539 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
540 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
541 servingstr->size = serving_buf_len;
542 memcpy(servingstr->buf, serving_buf, servingstr->size);
545 int neighbor_buf_len = strlen((char*)neighbor_buf);
546 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
547 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
548 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
549 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
550 neighborstr->size = neighbor_buf_len;
551 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
553 ue_report_item->c_RNTI = *crnti;
554 ue_report_item->serving_Cell_RF_Type = servingstr;
555 ue_report_item->neighbor_Cell_RF = neighborstr;
556 if (crnti) free(crnti);
559 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
561 ranco->timestamp = *ts;
562 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
563 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
564 if (ts->buf) free(ts->buf);
567 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
572 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
574 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
575 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
576 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
577 ts->size = strlen((char*)buf);
578 memcpy(ts->buf,buf,ts->size);
582 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
583 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
585 uint8_t *buf2 = (uint8_t*)"747";
587 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
588 plmnidstr->buf = (uint8_t*)calloc(3,1);
590 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
594 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
595 uint8_t* buf3 = (uint8_t*)"12340";
596 nrcellid->buf = (uint8_t*)calloc(1,5);
597 memcpy(nrcellid->buf, buf3, 5);
599 nrcellid->bits_unused = 4;
601 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
602 nrcgi->pLMN_Identity = *plmnidstr;
603 nrcgi->nRCellIdentity = *nrcellid;
607 report_item->nRCGI = *nrcgi;
608 if (nrcgi) free(nrcgi);
610 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
611 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
615 uint8_t* crnti_str = (uint8_t*)"1111";
616 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
617 crnti->buf = (uint8_t*)calloc(1,4);
621 crnti->size = strlen((char*)crnti_str);
624 memcpy(crnti->buf, crnti_str, crnti->size);
626 uint8_t *buf_serving = (uint8_t*)"RSRP10";
627 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
628 servingstr->buf = (uint8_t*)calloc(6,1);
629 servingstr->size = 6;
630 memcpy(servingstr->buf, buf_serving, servingstr->size);
632 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
633 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
634 neighborstr->buf = (uint8_t*)calloc(7,1);
635 neighborstr->size = 7;
636 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
638 ue_report_item->c_RNTI = *crnti;
639 ue_report_item->serving_Cell_RF_Type = servingstr;
640 ue_report_item->neighbor_Cell_RF = neighborstr;
643 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
645 ranco->timestamp = *ts;
646 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
647 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
649 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
654 void encode_kpm_odu_user_level(RAN_Container_t *ranco,
656 uint8_t *nrcellid_buf,
661 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
662 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
663 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
664 ts->size = strlen((char*)buf);
665 memcpy(ts->buf,buf,ts->size);
669 DU_Usage_Report_CellResourceReportItem_t *report_item =
670 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
672 // uint8_t *buf2 = (uint8_t*)"747";
674 int plmnid_size = strlen((char*)plmnid_buf);
675 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
676 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
677 plmnidstr->size = plmnid_size;
678 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
682 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
684 // int nrcellid_size = strlen((char*)nrcellid_buf);
685 int nrcellid_size = 5;
686 nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size);
687 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
688 nrcellid->size = nrcellid_size;
689 nrcellid->bits_unused = 4;
691 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
692 nrcgi->pLMN_Identity = *plmnidstr;
693 nrcgi->nRCellIdentity = *nrcellid;
694 if (plmnidstr) free(plmnidstr);
695 if (nrcellid) free(nrcellid);
699 report_item->nRCGI = *nrcgi;
700 if (nrcgi) free(nrcgi);
704 DU_Usage_Report_UeResourceReportItem *ue_report_item =
705 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
709 int crnti_size = strlen((char*)crnti_buf);
711 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
712 crnti->buf = (uint8_t*)calloc(1,crnti_size);
716 crnti->size = strlen((char*)crnti_buf);
719 memcpy(crnti->buf, crnti_buf, crnti->size);
723 long *p_prb_usage_dl = (long*)calloc(1, sizeof(long));
724 long *p_prb_usage_ul = (long*)calloc(1, sizeof(long));
725 *p_prb_usage_dl = (long)prb_usage_dl;
726 *p_prb_usage_ul = (long)prb_usage_ul;
728 ue_report_item->c_RNTI = *crnti;
729 ue_report_item->dl_PRBUsage = p_prb_usage_dl;
730 if (crnti) free(crnti);
734 ue_report_item->ul_PRBUsage = p_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] = {0, };
793 size_t e2smbuffer_size = 8192;
795 uint8_t e2smbuffer2[8192] = {0, };
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] = {0, };
855 size_t e2smbuffer_size = 8192;
857 uint8_t e2smbuffer2[8192] = {0, };
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] = {0, };
906 size_t e2smbuffer_size = 8192;
908 uint8_t e2smbuffer2[8192] = {0, };
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] = {0, };
965 size_t e2smbuffer_size = 8192;
967 uint8_t e2smbuffer2[8192] = {0, };
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] = {0, };
1099 size_t e2smbuffer_size = 8192;
1101 uint8_t e2smbuffer2[8192] = {0, };
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));
1133 long *p_dl_prb_usage = (long*)calloc(1, sizeof(long));
1134 long *p_ul_prb_usage = (long*)calloc(1, sizeof(long));
1135 *p_dl_prb_usage = (long)dl_prb_usage;
1136 *p_ul_prb_usage = (long)ul_prb_usage;
1138 fqi_item->fiveQI = fiveqi;
1139 fqi_item->dl_PRBUsage = p_dl_prb_usage;
1140 fqi_item->ul_PRBUsage = p_ul_prb_usage;
1142 uint8_t *buf1 = (uint8_t*)"4";
1144 // std::string sd = "SD1";
1145 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1146 // uint8_t *bufz = &sdvec[0];
1147 uint8_t *bufz = (uint8_t*)"SD1";
1149 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1150 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1151 snssai->sST.buf = (uint8_t*)calloc(1,1);
1152 snssai->sST.size = 1;
1153 memcpy(snssai->sST.buf, sst_buf, 1);
1154 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1155 snssai->sD->buf = (uint8_t*)calloc(1,3);
1156 snssai->sD->size = 3;
1157 memcpy(snssai->sD->buf, sd_buf, 3);
1160 SlicePerPlmnPerCellListItem_t *sliceitem =
1161 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1162 sliceitem->sliceID = *snssai;
1163 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1164 if (snssai) free(snssai);
1166 uint8_t *buf2 = (uint8_t*)"747";
1168 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1169 plmnid->buf = (uint8_t*)calloc(3,1);
1171 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1173 ServedPlmnPerCellListItem_t *percellitem1 =
1174 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1175 percellitem1->pLMN_Identity = *plmnid;
1176 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1177 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1178 if (plmnid) free(plmnid);
1180 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1181 plmnidstr->buf = (uint8_t*)calloc(3,1);
1182 plmnidstr->size = 3;
1183 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
1187 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1188 uint8_t* buf3 = (uint8_t*)"12340";
1189 nrcellid->buf = (uint8_t*)calloc(1,5);
1190 memcpy(nrcellid->buf, nrcellid_buf, 5);
1192 nrcellid->bits_unused = 4;
1194 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1195 nrcgi->pLMN_Identity = *plmnidstr;
1196 nrcgi->nRCellIdentity = *nrcellid;
1197 if (plmnidstr) free(plmnidstr);
1198 if (nrcellid) free(nrcellid);
1201 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1202 listitem1->nRCGI = *nrcgi;
1203 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
1204 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
1205 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1206 if (nrcgi) free(nrcgi);
1209 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1210 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1211 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1213 PF_Container_PR pres1 = PF_Container_PR_oDU;
1215 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1216 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1217 pfcontainer->present = pres1;
1218 pfcontainer->choice.oDU = *ducont;
1219 if (ducont) free(ducont);
1221 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1222 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1223 containers_list->performanceContainer = pfcontainer;
1225 E2SM_KPM_IndicationMessage_Format1_t *format =
1226 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1227 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1229 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1231 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1233 indicationmessage->indicationMessage.present = pres;
1235 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1236 if (format) free(format);
1238 char error_buf[300] = {0, };
1241 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1242 printf("error length %d\n", errlen);
1243 printf("error buf %s\n", error_buf);
1245 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1248 uint8_t e2smbuffer[8192] = {0, };
1249 size_t e2smbuffer_size = 8192;
1251 uint8_t e2smbuffer2[8192] = {0, };
1252 size_t e2smbuffer_size2 = 8192;
1255 asn_encode_to_buffer(opt_cod,
1256 ATS_ALIGNED_BASIC_PER,
1257 &asn_DEF_E2SM_KPM_IndicationMessage,
1258 indicationmessage, e2smbuffer, e2smbuffer_size);
1260 fprintf(stderr, "er encded is %d\n", er.encoded);
1261 fprintf(stderr, "after encoding message\n");
1267 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1270 long dl_prb_usage = 50;
1271 long ul_prb_usage = 70;
1273 asn_codec_ctx_t *opt_cod;
1275 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1276 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1277 fqi_item->fiveQI = fiveqi;
1278 fqi_item->dl_PRBUsage = &dl_prb_usage;
1279 fqi_item->ul_PRBUsage = &ul_prb_usage;
1281 uint8_t *buf1 = (uint8_t*)"4";
1282 // std::string sd = "SD1";
1283 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1284 // uint8_t *bufz = &sdvec[0];
1285 uint8_t *bufz = (uint8_t*)"SD1";
1287 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1288 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1289 snssai->sST.buf = (uint8_t*)calloc(1,1);
1290 snssai->sST.size = 1;
1291 memcpy(snssai->sST.buf, buf1, 1);
1292 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1293 snssai->sD->buf = (uint8_t*)calloc(1,3);
1294 snssai->sD->size = 3;
1295 memcpy(snssai->sD->buf, bufz, 3);
1298 SlicePerPlmnPerCellListItem_t *sliceitem =
1299 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1300 sliceitem->sliceID = *snssai;
1301 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1302 if (snssai) free(snssai);
1304 uint8_t *buf2 = (uint8_t*)"747";
1306 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1307 plmnid->buf = (uint8_t*)calloc(3,1);
1309 memcpy(plmnid->buf, buf2, plmnid->size);
1311 ServedPlmnPerCellListItem_t *percellitem1 =
1312 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1313 percellitem1->pLMN_Identity = *plmnid;
1314 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1315 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1317 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1318 plmnidstr->buf = (uint8_t*)calloc(3,1);
1319 plmnidstr->size = 3;
1320 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1324 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1325 uint8_t* buf3 = (uint8_t*)"12340";
1326 nrcellid->buf = (uint8_t*)calloc(1,5);
1327 memcpy(nrcellid->buf, buf3, 5);
1329 nrcellid->bits_unused = 4;
1331 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1332 nrcgi->pLMN_Identity = *plmnidstr;
1333 nrcgi->nRCellIdentity = *nrcellid;
1334 if (plmnidstr) free(plmnidstr);
1335 if (nrcellid) free(nrcellid);
1337 long dl_prbs = (long)100;
1338 long ul_prbs = (long)120;
1340 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1341 listitem1->nRCGI = *nrcgi;
1342 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1343 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1344 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1345 if (nrcgi) free(nrcgi);
1348 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1349 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1350 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1352 PF_Container_PR pres1 = PF_Container_PR_oDU;
1354 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1355 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1356 pfcontainer->present = pres1;
1357 pfcontainer->choice.oDU = *ducont;
1358 if (ducont) free(ducont);
1360 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1361 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1362 containers_list->performanceContainer = pfcontainer;
1364 E2SM_KPM_IndicationMessage_Format1_t *format =
1365 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1366 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1368 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1370 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1372 indicationmessage->indicationMessage.present = pres;
1374 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1375 if (format) free(format);
1377 char error_buf[300] = {0, };
1380 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1381 printf("error length %d\n", errlen);
1382 printf("error buf %s\n", error_buf);
1384 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1387 uint8_t e2smbuffer[8192] = {0, };
1388 size_t e2smbuffer_size = 8192;
1390 uint8_t e2smbuffer2[8192] = {0, };
1391 size_t e2smbuffer_size2 = 8192;
1394 asn_encode_to_buffer(opt_cod,
1395 ATS_ALIGNED_BASIC_PER,
1396 &asn_DEF_E2SM_KPM_IndicationMessage,
1397 indicationmessage, e2smbuffer, e2smbuffer_size);
1399 fprintf(stderr, "er encded is %d\n", er.encoded);
1400 fprintf(stderr, "after encoding message\n");
1405 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1406 uint8_t *gnbcuupname_buf,
1411 uint8_t *plmnid_buf) {
1413 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1416 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1417 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1418 gnbcuupname->size = 8;
1419 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1420 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1423 //We need to convert bytes_dl into array of uint8_t
1427 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1429 if (bytes_dl <= 64) {
1432 uint8_t buffer[array_size_dl];
1433 buffer[0] = bytes_dl & 0xFF;
1434 bytesdl->buf = (uint8_t*)calloc(1,1);
1435 memcpy(bytesdl->buf,buffer,1);
1438 } else if (bytes_dl <= 16384) {
1441 uint8_t buffer[array_size_dl];
1442 buffer[0] = (bytes_dl >> 8) & 0xFF;
1443 buffer[1] = bytes_dl & 0xFF;
1444 bytesdl->buf = (uint8_t*)calloc(2,1);
1445 memcpy(bytesdl->buf,buffer,2);
1448 } else if (bytes_dl <= 4194304) {
1451 uint8_t buffer[array_size_dl];
1452 buffer[0] = (bytes_dl >> 16) & 0xFF;
1453 buffer[1] = (bytes_dl >> 8) & 0xFF;
1454 buffer[2] = bytes_dl & 0xFF;
1455 bytesdl->buf = (uint8_t*)calloc(3,1);
1456 memcpy(bytesdl->buf,buffer,3);
1459 } else if (bytes_dl <= 1073741824) {
1461 uint8_t buffer[array_size_dl];
1462 buffer[0] = (bytes_dl >> 24) & 0xFF;
1463 buffer[1] = (bytes_dl >> 16) & 0xFF;
1464 buffer[2] = (bytes_dl >> 8) & 0xFF;
1465 buffer[3] = bytes_dl & 0xFF;
1466 bytesdl->buf = (uint8_t*)calloc(4,1);
1467 memcpy(bytesdl->buf,buffer,4);
1472 //We need to convert bytes_ul into array of uint8_t
1473 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1477 if (bytes_ul <= 64) {
1480 uint8_t buffer[array_size_ul];
1481 buffer[0] = bytes_ul & 0xFF;
1482 bytesul->buf = (uint8_t*)calloc(1,1);
1483 memcpy(bytesul->buf,buffer,1);
1486 } else if (bytes_ul <= 16384) {
1489 uint8_t buffer[array_size_ul];
1490 buffer[0] = (bytes_ul >> 8) & 0xFF;
1491 buffer[1] = bytes_ul & 0xFF;
1492 bytesul->buf = (uint8_t*)calloc(2,1);
1493 memcpy(bytesul->buf,buffer,2);
1496 } else if (bytes_ul <= 4194304) {
1499 uint8_t buffer[array_size_ul];
1500 buffer[0] = (bytes_ul >> 16) & 0xFF;
1501 buffer[1] = (bytes_ul >> 8) & 0xFF;
1502 buffer[2] = bytes_ul & 0xFF;
1503 bytesul->buf = (uint8_t*)calloc(3,1);
1504 memcpy(bytesul->buf,buffer,3);
1507 } else if (bytes_ul <= 1073741824) {
1509 uint8_t buffer[array_size_ul];
1510 buffer[0] = (bytes_ul >> 24) & 0xFF;
1511 buffer[1] = (bytes_ul >> 16) & 0xFF;
1512 buffer[2] = (bytes_ul >> 8) & 0xFF;
1513 buffer[3] = bytes_ul & 0xFF;
1514 bytesul->buf = (uint8_t*)calloc(4,1);
1515 memcpy(bytesul->buf,buffer,4);
1520 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1521 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1522 fqilistitem->fiveQI = fqi;
1523 fqilistitem->pDCPBytesDL = bytesdl;
1524 fqilistitem->pDCPBytesUL = bytesul;
1527 uint8_t *buf1 = (uint8_t*)"4";
1528 uint8_t *bufz = (uint8_t*)"SD1";
1530 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1531 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1532 snssai->sST.buf = (uint8_t*)calloc(1,1);
1533 snssai->sST.size = 1;
1534 memcpy(snssai->sST.buf, sst_buf, 1);
1535 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1536 snssai->sD->buf = (uint8_t*)calloc(1,3);
1537 snssai->sD->size = 3;
1538 memcpy(snssai->sD->buf, sd_buf, 3);
1542 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1543 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1544 slicelistitem->sliceID = *snssai;
1545 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1546 if (snssai) free(snssai);
1548 asn_codec_ctx_t *opt_cod;
1551 uint8_t e2smbuffera[8192] = {0, };
1552 size_t e2smbuffer_sizea = 8192;
1556 asn_enc_rval_t era =
1557 asn_encode_to_buffer(opt_cod,
1558 ATS_ALIGNED_BASIC_PER,
1559 &asn_DEF_SliceToReportListItem,
1560 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1561 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1562 fprintf(stderr, "after encoding message\n");
1566 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1567 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1568 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1570 uint8_t *buf2 = (uint8_t*)"747";
1571 // std::string pl = "PLMNID7";
1572 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1573 // uint8_t *buf2 = &plvec[0];
1575 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1576 plmnid->buf = (uint8_t*)calloc(3,1);
1578 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1581 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1582 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1583 plmnidlist->pLMN_Identity = *plmnid;
1584 plmnidlist->cu_UP_PM_5GC = pm_format;
1585 if (plmnid) free(plmnid);
1587 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1588 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1589 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1594 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1595 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1596 listitem1->interface_type = 2;
1597 listitem1->o_CU_UP_PM_Container = *meas_cont;
1598 if (meas_cont) free(meas_cont);
1600 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1601 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1602 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1603 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1605 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1607 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1608 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1609 pfcontainer->present = pres1;
1610 pfcontainer->choice.oCU_UP = *cuupcont;
1611 if (cuupcont) free(cuupcont);
1613 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1614 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1615 containers_list->performanceContainer = pfcontainer;
1617 E2SM_KPM_IndicationMessage_Format1_t *format =
1618 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1619 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1621 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1623 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1625 indicationmessage->indicationMessage.present = pres;
1627 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1628 if (format) free(format);
1630 char error_buf[300] = {0, };
1633 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1634 printf("error length %d\n", errlen);
1635 printf("error buf %s\n", error_buf);
1637 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1640 uint8_t e2smbuffer[8192] = {0, };
1641 size_t e2smbuffer_size = 8192;
1643 uint8_t e2smbuffer2[8192] = {0, };
1644 size_t e2smbuffer_size2 = 8192;
1647 asn_encode_to_buffer(opt_cod,
1648 ATS_ALIGNED_BASIC_PER,
1649 &asn_DEF_E2SM_KPM_IndicationMessage,
1650 indicationmessage, e2smbuffer, e2smbuffer_size);
1652 fprintf(stderr, "er encded is %d\n", er.encoded);
1653 fprintf(stderr, "after encoding message\n");
1658 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1660 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1663 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1664 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1665 gnbcuupname->size = 8;
1666 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1667 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1670 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1673 bytesdl->buf = (uint8_t*)calloc(1,1);
1674 memcpy(bytesdl->buf, buffer,1);
1677 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1680 bytesul->buf = (uint8_t*)calloc(1,1);
1681 memcpy(bytesul->buf, buffer1, 1);
1684 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1685 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1686 fqilistitem->fiveQI = 9;
1687 fqilistitem->pDCPBytesDL = bytesdl;
1688 fqilistitem->pDCPBytesUL = bytesul;
1691 uint8_t *buf1 = (uint8_t*)"4";
1692 uint8_t *bufz = (uint8_t*)"SD1";
1694 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1695 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1696 snssai->sST.buf = (uint8_t*)calloc(1,1);
1697 snssai->sST.size = 1;
1698 memcpy(snssai->sST.buf, buf1, 1);
1699 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1700 snssai->sD->buf = (uint8_t*)calloc(1,3);
1701 snssai->sD->size = 3;
1702 memcpy(snssai->sD->buf, bufz, 3);
1706 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1707 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1708 slicelistitem->sliceID = *snssai;
1709 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1710 if (snssai) free(snssai);
1712 asn_codec_ctx_t *opt_cod;
1715 uint8_t e2smbuffera[8192] = {0, };
1716 size_t e2smbuffer_sizea = 8192;
1720 asn_enc_rval_t era =
1721 asn_encode_to_buffer(opt_cod,
1722 ATS_ALIGNED_BASIC_PER,
1723 &asn_DEF_SliceToReportListItem,
1724 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1725 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1726 fprintf(stderr, "after encoding message\n");
1730 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1731 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1732 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1734 uint8_t *buf2 = (uint8_t*)"747";
1735 // std::string pl = "PLMNID7";
1736 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1737 // uint8_t *buf2 = &plvec[0];
1739 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1740 plmnid->buf = (uint8_t*)calloc(3,1);
1742 memcpy(plmnid->buf, buf2, plmnid->size);
1745 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1746 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1747 plmnidlist->pLMN_Identity = *plmnid;
1748 plmnidlist->cu_UP_PM_5GC = pm_format;
1750 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1751 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1752 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1757 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1758 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1759 listitem1->interface_type = 2;
1760 listitem1->o_CU_UP_PM_Container = *meas_cont;
1761 if (meas_cont) free(meas_cont);
1763 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1764 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1765 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1766 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1768 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1770 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1771 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1772 pfcontainer->present = pres1;
1773 pfcontainer->choice.oCU_UP = *cuupcont;
1774 if (cuupcont) free(cuupcont);
1776 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1777 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1778 containers_list->performanceContainer = pfcontainer;
1780 E2SM_KPM_IndicationMessage_Format1_t *format =
1781 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1782 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1784 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1786 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1788 indicationmessage->indicationMessage.present = pres;
1790 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1791 if (format) free(format);
1793 char error_buf[300] = {0, };
1796 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1797 printf("error length %d\n", errlen);
1798 printf("error buf %s\n", error_buf);
1800 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1803 uint8_t e2smbuffer[8192] = {0, };
1804 size_t e2smbuffer_size = 8192;
1806 uint8_t e2smbuffer2[8192] = {0, };
1807 size_t e2smbuffer_size2 = 8192;
1810 asn_encode_to_buffer(opt_cod,
1811 ATS_ALIGNED_BASIC_PER,
1812 &asn_DEF_E2SM_KPM_IndicationMessage,
1813 indicationmessage, e2smbuffer, e2smbuffer_size);
1815 fprintf(stderr, "er encded is %d\n", er.encoded);
1816 fprintf(stderr, "after encoding message\n");
1821 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1824 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1825 //std::string gn = "GNBCUUP5";
1826 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1827 //uint8_t *buf = &gnvec[0];
1828 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1829 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1830 gnbcuupname->size = 8;
1831 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1832 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1835 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1838 bytesdl->buf = (uint8_t*)calloc(1,1);
1839 memcpy(bytesdl->buf, buffer,1);
1842 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1845 bytesul->buf = (uint8_t*)calloc(1,1);
1846 memcpy(bytesul->buf, buffer1, 1);
1849 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1850 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1851 fqilistitem->fiveQI = 9;
1852 fqilistitem->pDCPBytesDL = bytesdl;
1853 fqilistitem->pDCPBytesUL = bytesul;
1857 // std::string sl = "SLICE4";
1858 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1859 // uint8_t *buf1 = &slvec[0];
1860 uint8_t *buf1 = (uint8_t*)"4";
1861 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1863 sst->buf = (uint8_t*)calloc(1,6);
1864 memcpy(sst->buf,buf1,sst->size);
1866 // std::string sd = "SD1";
1867 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1868 // uint8_t *bufz = &sdvec[0];
1869 uint8_t *bufz = (uint8_t*)"SD1";
1870 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1872 sds->buf = (uint8_t*)calloc(1,3);
1873 memcpy(sds->buf, bufz, sds->size);
1876 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1877 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1878 snssai->sST.buf = (uint8_t*)calloc(1,1);
1879 snssai->sST.size = 1;
1880 memcpy(snssai->sST.buf, buf1, 1);
1881 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1882 snssai->sD->buf = (uint8_t*)calloc(1,3);
1883 snssai->sD->size = 3;
1884 memcpy(snssai->sD->buf, bufz, 3);
1888 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1889 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1890 slicelistitem->sliceID = *snssai;
1891 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1893 asn_codec_ctx_t *opt_cod;
1896 uint8_t e2smbuffera[8192];
1897 size_t e2smbuffer_sizea = 8192;
1901 asn_enc_rval_t era =
1902 asn_encode_to_buffer(opt_cod,
1903 ATS_ALIGNED_BASIC_PER,
1904 &asn_DEF_SliceToReportListItem,
1905 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1906 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1907 fprintf(stderr, "after encoding message\n");
1911 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1912 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1913 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1915 uint8_t *buf2 = (uint8_t*)"747";
1916 // std::string pl = "PLMNID7";
1917 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1918 // uint8_t *buf2 = &plvec[0];
1920 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1921 plmnid->buf = (uint8_t*)calloc(3,1);
1923 memcpy(plmnid->buf, buf2, plmnid->size);
1926 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1927 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1928 plmnidlist->pLMN_Identity = *plmnid;
1929 plmnidlist->cu_UP_PM_5GC = pm_format;
1931 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1932 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1933 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1938 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1939 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1940 listitem1->interface_type = 2;
1941 listitem1->o_CU_UP_PM_Container = *meas_cont;
1943 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1944 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1945 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1946 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1948 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1950 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1951 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1952 pfcontainer->present = pres1;
1953 pfcontainer->choice.oCU_UP = *cuupcont;
1955 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1956 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1957 containers_list->performanceContainer = pfcontainer;
1959 E2SM_KPM_IndicationMessage_Format1_t *format =
1960 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1961 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1963 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1965 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1967 indicationmessage->present = pres;
1969 indicationmessage->choice.indicationMessage_Format1 = *format;
1971 char *error_buf = (char*)calloc(300, sizeof(char));
1974 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1975 printf("error length %d\n", errlen);
1976 printf("error buf %s\n", error_buf);
1978 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1981 uint8_t e2smbuffer[8192];
1982 size_t e2smbuffer_size = 8192;
1984 uint8_t e2smbuffer2[8192];
1985 size_t e2smbuffer_size2 = 8192;
1988 asn_encode_to_buffer(opt_cod,
1989 ATS_ALIGNED_BASIC_PER,
1990 &asn_DEF_E2SM_KPM_IndicationMessage,
1991 indicationmessage, e2smbuffer, e2smbuffer_size);
1993 fprintf(stderr, "er encded is %d\n", er.encoded);
1994 fprintf(stderr, "after encoding message\n");
2000 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
2001 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
2002 std::string gn = "GNBCUUP5";
2003 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
2004 uint8_t *buf = &gnvec[0];
2005 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2006 gnbcuupname->size = 8;
2007 gnbcuupname->buf = (uint8_t*)calloc(1,8);
2008 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
2011 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2014 bytesdl->buf = (uint8_t*)calloc(1,1);
2015 memcpy(bytesdl->buf, buffer,1);
2018 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2021 bytesul->buf = (uint8_t*)calloc(1,1);
2022 memcpy(bytesul->buf, buffer1, 1);
2025 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
2026 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
2027 fqilistitem->fiveQI = 9;
2028 fqilistitem->pDCPBytesDL = bytesdl;
2029 fqilistitem->pDCPBytesUL = bytesul;
2033 std::string sl = "SLICE4";
2034 std::vector<uint8_t> slvec(sl.begin(), sl.end());
2035 // uint8_t *buf1 = &slvec[0];
2036 uint8_t *buf1 = (uint8_t*)"SLICE4";
2037 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2039 sst->buf = (uint8_t*)calloc(1,6);
2040 memcpy(sst->buf,buf1,sst->size);
2042 std::string sd = "SD1";
2043 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
2044 // uint8_t *bufz = &sdvec[0];
2045 uint8_t *bufz = (uint8_t*)"SD1";
2046 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2048 sds->buf = (uint8_t*)calloc(1,3);
2049 memcpy(sds->buf, bufz, sds->size);
2052 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
2053 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
2054 snssai->sST.buf = (uint8_t*)calloc(6,1);
2055 snssai->sST.size = 6;
2056 memcpy(snssai->sST.buf, buf1, 6);
2057 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2058 snssai->sD->buf = (uint8_t*)calloc(1,3);
2059 snssai->sD->size = 3;
2060 memcpy(snssai->sD->buf, bufz, 3);
2064 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
2065 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
2066 slicelistitem->sliceID = *snssai;
2067 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
2069 uint8_t e2smbuffera[8192];
2070 size_t e2smbuffer_sizea = 8192;
2073 asn_encode_to_buffer(nullptr,
2074 ATS_ALIGNED_BASIC_PER,
2075 &asn_DEF_SliceToReportListItem,
2076 slicelistitem, e2smbuffera, e2smbuffer_sizea);
2077 fprintf(stderr, "inner er encded is %d\n", era.encoded);
2078 fprintf(stderr, "after encoding message\n");
2080 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
2081 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
2082 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
2084 std::string pl = "PLMNID7";
2085 std::vector<uint8_t> plvec(pl.begin(), pl.end());
2086 uint8_t *buf2 = &plvec[0];
2088 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
2089 plmnid->buf = (uint8_t*)calloc(1,7);
2091 memcpy(plmnid->buf, buf2, plmnid->size);
2094 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
2095 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
2096 plmnidlist->pLMN_Identity = *plmnid;
2097 plmnidlist->cu_UP_PM_5GC = pm_format;
2099 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
2100 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
2101 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
2106 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
2107 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
2108 listitem1->interface_type = 2;
2109 listitem1->o_CU_UP_PM_Container = *meas_cont;
2111 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
2112 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
2113 cuupcont->gNB_CU_UP_Name = gnbcuupname;
2114 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
2116 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
2118 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
2119 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
2120 pfcontainer->present = pres1;
2121 pfcontainer->choice.oCU_UP = *cuupcont;
2123 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
2124 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
2125 containers_list->performanceContainer = pfcontainer;
2127 E2SM_KPM_IndicationMessage_Format1_t *format =
2128 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
2129 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
2131 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
2133 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
2135 indicationmessage->present = pres;
2137 indicationmessage->choice.indicationMessage_Format1 = *format;
2139 char *error_buf = (char*)calloc(300, sizeof(char));
2142 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
2143 printf("error length %d\n", errlen);
2144 printf("error buf %s\n", error_buf);
2147 uint8_t e2smbuffer[8192];
2148 size_t e2smbuffer_size = 8192;
2150 uint8_t e2smbuffer2[8192];
2151 size_t e2smbuffer_size2 = 8192;
2154 asn_encode_to_buffer(nullptr,
2155 ATS_ALIGNED_BASIC_PER,
2156 &asn_DEF_E2SM_KPM_IndicationMessage,
2157 indicationmessage, e2smbuffer, e2smbuffer_size);
2159 fprintf(stderr, "er encded is %d\n", er.encoded);
2160 fprintf(stderr, "after encoding message\n");