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 ******************************************************************************/
26 #include "encode_kpm.hpp"
30 void encode_kpm_function_description(E2SM_KPM_RANfunction_Description_t* ranfunc_desc) {
34 uint8_t *buf = (uint8_t*)"ORAN-E2SM-KPM";
35 uint8_t *buf2 = (uint8_t*)"KPM monitor";
36 uint8_t *buf3 = (uint8_t*)"OID123";
38 OCTET_STRING_t *sname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
39 sname->buf = (uint8_t*)calloc(1,13);
41 memcpy(sname->buf, buf, 13);
42 sname->size = strlen((char*)buf);
43 ranfunc_desc->ranFunction_Name.ranFunction_ShortName = *sname;
47 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
49 // ranfunc_desc->ranFunction_Name.ranFunction_Description = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
50 ranfunc_desc->ranFunction_Name.ranFunction_Description.buf = (uint8_t*)calloc(1,strlen((char*)buf2));
51 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_Description.buf, buf2, strlen((char*)buf2));
52 ranfunc_desc->ranFunction_Name.ranFunction_Description.size = strlen((char*)buf2);
53 ranfunc_desc->ranFunction_Name.ranFunction_Instance = &inst;
57 // ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
58 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf = (uint8_t*)calloc(1,strlen((char*)buf3));
59 memcpy(ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.buf, buf3, strlen((char*)buf3));
60 ranfunc_desc->ranFunction_Name.ranFunction_E2SM_OID.size = strlen((char*)buf3);
65 RIC_EventTriggerStyle_List_t *trigger_style =
66 (RIC_EventTriggerStyle_List_t*)calloc(1, sizeof(RIC_EventTriggerStyle_List_t));
67 trigger_style->ric_EventTriggerStyle_Type = 1;
68 uint8_t *buf4 = (uint8_t*)"Periodic report";
69 // trigger_style->ric_EventTriggerStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
70 trigger_style->ric_EventTriggerStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf4));
71 memcpy(trigger_style->ric_EventTriggerStyle_Name.buf, buf4, strlen((char*)buf4));
72 trigger_style->ric_EventTriggerStyle_Name.size = strlen((char*)buf4);
73 trigger_style->ric_EventTriggerFormat_Type = 5;
77 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List =
78 (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));
80 int ret = ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_EventTriggerStyle_List->list , trigger_style);
81 printf("ret is %d\n", ret);
83 RIC_ReportStyle_List_t *report_style1 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
84 report_style1->ric_ReportStyle_Type = 1;
86 uint8_t *buf5 = (uint8_t*)"O-DU Measurement Container for the 5GC connected deployment";
90 // report_style1->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
91 report_style1->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf5));
92 memcpy(report_style1->ric_ReportStyle_Name.buf, buf5, strlen((char*)buf5));
93 report_style1->ric_ReportStyle_Name.size = strlen((char*)buf5);
94 report_style1->ric_IndicationHeaderFormat_Type = 1;
95 report_style1->ric_IndicationMessageFormat_Type = 1;
99 RIC_ReportStyle_List_t *report_style2 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
100 report_style2->ric_ReportStyle_Type = 2;
102 uint8_t *buf6 = (uint8_t*)"O-DU Measurement Container for the EPC connected deployment";
104 // report_style2->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
107 report_style2->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf6));
108 memcpy(report_style2->ric_ReportStyle_Name.buf, buf6, strlen((char*)buf6));
109 report_style2->ric_ReportStyle_Name.size = strlen((char*)buf6);
110 report_style2->ric_IndicationHeaderFormat_Type = 1;
111 report_style2->ric_IndicationMessageFormat_Type = 1;
115 RIC_ReportStyle_List_t *report_style3 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
116 report_style3->ric_ReportStyle_Type = 3;
118 uint8_t *buf7 = (uint8_t*)"O-CU-CP Measurement Container for the 5GC connected deployment";
120 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
121 report_style3->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf7));
122 memcpy(report_style3->ric_ReportStyle_Name.buf, buf7, strlen((char*)buf7));
123 report_style3->ric_ReportStyle_Name.size = strlen((char*)buf7);
124 report_style3->ric_IndicationHeaderFormat_Type = 1;
125 report_style3->ric_IndicationMessageFormat_Type = 1;
127 RIC_ReportStyle_List_t *report_style4 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
128 report_style4->ric_ReportStyle_Type = 4;
130 uint8_t *buf8 = (uint8_t*)"O-CU-CP Measurement Container for the EPC connected deployment";
132 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
133 report_style4->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf8));
134 memcpy(report_style4->ric_ReportStyle_Name.buf, buf8, strlen((char*)buf8));
135 report_style4->ric_ReportStyle_Name.size = strlen((char*)buf8);
136 report_style4->ric_IndicationHeaderFormat_Type = 1;
137 report_style4->ric_IndicationMessageFormat_Type = 1;
139 RIC_ReportStyle_List_t *report_style5 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
140 report_style5->ric_ReportStyle_Type = 5;
142 uint8_t *buf9 = (uint8_t*)"O-CU-UP Measurement Container for the 5GC connected deployment";
144 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
145 report_style5->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf9));
146 memcpy(report_style5->ric_ReportStyle_Name.buf, buf9, strlen((char*)buf9));
147 report_style5->ric_ReportStyle_Name.size = strlen((char*)buf9);
148 report_style5->ric_IndicationHeaderFormat_Type = 1;
149 report_style5->ric_IndicationMessageFormat_Type = 1;
152 RIC_ReportStyle_List_t *report_style6 = (RIC_ReportStyle_List_t*)calloc(1, sizeof(RIC_ReportStyle_List_t));
153 report_style6->ric_ReportStyle_Type = 6;
155 uint8_t *buf10 = (uint8_t*)"O-CU-UP Measurement Container for the EPC connected deployment";
157 // report_style3->ric_ReportStyle_Name = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
158 report_style6->ric_ReportStyle_Name.buf = (uint8_t*)calloc(1,strlen((char*)buf10));
159 memcpy(report_style6->ric_ReportStyle_Name.buf, buf10, strlen((char*)buf10));
160 report_style6->ric_ReportStyle_Name.size = strlen((char*)buf10);
161 report_style6->ric_IndicationHeaderFormat_Type = 1;
162 report_style6->ric_IndicationMessageFormat_Type = 1;
165 ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List =
166 (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));
168 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style1);
169 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style2);
170 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style3);
171 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style4);
172 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style5);
173 ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style6);
175 xer_fprint(stderr, &asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc);
178 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco) {
180 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
181 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
182 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
183 ts->size = strlen((char*)buf);
184 memcpy(ts->buf,buf,ts->size);
188 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
189 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
191 uint8_t *buf2 = (uint8_t*)"747";
193 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
194 plmnidstr->buf = (uint8_t*)calloc(3,1);
196 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
200 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
201 uint8_t* buf3 = (uint8_t*)"12340";
202 nrcellid->buf = (uint8_t*)calloc(1,5);
203 memcpy(nrcellid->buf, buf3, 5);
205 nrcellid->bits_unused = 4;
207 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
208 nrcgi->pLMN_Identity = *plmnidstr;
209 nrcgi->nRCellIdentity = *nrcellid;
213 report_item->nRCGI = *nrcgi;
215 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
216 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
220 uint8_t* crnti_str = (uint8_t*)"1111";
221 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
222 crnti->buf = (uint8_t*)calloc(1,4);
226 crnti->size = strlen((char*)crnti_str);
229 memcpy(crnti->buf, crnti_str, crnti->size);
233 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
236 bytesdl->buf = (uint8_t*)calloc(1,1);
237 memcpy(bytesdl->buf, buffer,1);
240 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
243 bytesul->buf = (uint8_t*)calloc(1,1);
244 memcpy(bytesul->buf, buffer1, 1);
248 ue_report_item->c_RNTI = *crnti;
249 ue_report_item->pDCPBytesDL = bytesdl;
250 ue_report_item->pDCPBytesUL = bytesul;
253 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
255 ranco->timestamp = *ts;
256 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
257 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
259 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
263 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
265 uint8_t *nrcellid_buf,
267 const uint8_t *serving_buf,
268 const uint8_t *neighbor_buf) {
269 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
270 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
271 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
272 ts->size = strlen((char*)buf);
273 memcpy(ts->buf,buf,ts->size);
277 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
278 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
280 int plmnid_size = strlen((char*)plmnid_buf);
281 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
282 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
283 plmnidstr->size = plmnid_size;
284 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
288 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
290 int nrcellid_size = strlen((char*)nrcellid_buf);
291 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
292 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
294 nrcellid->bits_unused = 4;
296 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
297 nrcgi->pLMN_Identity = *plmnidstr;
298 nrcgi->nRCellIdentity = *nrcellid;
302 report_item->nRCGI = *nrcgi;
304 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
305 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
310 int crnti_size = strlen((char*)crnti_buf);
311 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
312 crnti->buf = (uint8_t*)calloc(1, crnti_size);
316 crnti->size = strlen((char*)crnti_buf);
319 memcpy(crnti->buf, crnti_buf, crnti->size);
321 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
323 int serving_buf_len = strlen((char*)serving_buf);
324 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
325 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
326 servingstr->size = serving_buf_len;
327 memcpy(servingstr->buf, serving_buf, servingstr->size);
330 int neighbor_buf_len = strlen((char*)neighbor_buf);
331 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
332 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
333 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
334 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
335 neighborstr->size = neighbor_buf_len;
336 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
338 ue_report_item->c_RNTI = *crnti;
339 ue_report_item->serving_Cell_RF_Type = servingstr;
340 ue_report_item->neighbor_Cell_RF = neighborstr;
343 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
345 ranco->timestamp = *ts;
346 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
347 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
349 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
354 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
356 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
357 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
358 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
359 ts->size = strlen((char*)buf);
360 memcpy(ts->buf,buf,ts->size);
364 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
365 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
367 uint8_t *buf2 = (uint8_t*)"747";
369 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
370 plmnidstr->buf = (uint8_t*)calloc(3,1);
372 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
376 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
377 uint8_t* buf3 = (uint8_t*)"12340";
378 nrcellid->buf = (uint8_t*)calloc(1,5);
379 memcpy(nrcellid->buf, buf3, 5);
381 nrcellid->bits_unused = 4;
383 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
384 nrcgi->pLMN_Identity = *plmnidstr;
385 nrcgi->nRCellIdentity = *nrcellid;
389 report_item->nRCGI = *nrcgi;
391 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
392 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
396 uint8_t* crnti_str = (uint8_t*)"1111";
397 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
398 crnti->buf = (uint8_t*)calloc(1,4);
402 crnti->size = strlen((char*)crnti_str);
405 memcpy(crnti->buf, crnti_str, crnti->size);
407 uint8_t *buf_serving = (uint8_t*)"RSRP10";
408 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
409 servingstr->buf = (uint8_t*)calloc(6,1);
410 servingstr->size = 6;
411 memcpy(servingstr->buf, buf_serving, servingstr->size);
413 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
414 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
415 neighborstr->buf = (uint8_t*)calloc(7,1);
416 neighborstr->size = 7;
417 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
419 ue_report_item->c_RNTI = *crnti;
420 ue_report_item->serving_Cell_RF_Type = servingstr;
421 ue_report_item->neighbor_Cell_RF = neighborstr;
424 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
426 ranco->timestamp = *ts;
427 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
428 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
430 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
435 void encode_kpm_odu_user_level(RAN_Container_t *ranco) {
437 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
438 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
439 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
440 ts->size = strlen((char*)buf);
441 memcpy(ts->buf,buf,ts->size);
445 DU_Usage_Report_CellResourceReportItem_t *report_item =
446 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
448 uint8_t *buf2 = (uint8_t*)"747";
450 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
451 plmnidstr->buf = (uint8_t*)calloc(3,1);
453 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
457 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
458 uint8_t* buf3 = (uint8_t*)"12340";
459 nrcellid->buf = (uint8_t*)calloc(1,5);
460 memcpy(nrcellid->buf, buf3, 5);
462 nrcellid->bits_unused = 4;
464 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
465 nrcgi->pLMN_Identity = *plmnidstr;
466 nrcgi->nRCellIdentity = *nrcellid;
470 report_item->nRCGI = *nrcgi;
474 DU_Usage_Report_UeResourceReportItem *ue_report_item =
475 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
479 uint8_t* crnti_str = (uint8_t*)"1111";
480 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
481 crnti->buf = (uint8_t*)calloc(1,4);
485 crnti->size = strlen((char*)crnti_str);
488 memcpy(crnti->buf, crnti_str, crnti->size);
495 ue_report_item->c_RNTI = *crnti;
496 ue_report_item->dl_PRBUsage = &lval1;
500 ue_report_item->ul_PRBUsage = &lval2;
504 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
507 ranco->timestamp = *ts;
508 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
509 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
511 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
516 void encode_kpm_report_rancontainer_du(E2SM_KPM_IndicationMessage_t* indicationmessage) {
518 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
519 encode_kpm_odu_user_level(ranco);
521 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
522 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
523 containers_list->theRANContainer = ranco;
525 E2SM_KPM_IndicationMessage_Format1_t *format =
526 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
527 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
529 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
531 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
533 indicationmessage->indicationMessage.present = pres;
535 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
537 char *error_buf = (char*)calloc(300, sizeof(char));
540 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
541 printf("error length %d\n", errlen);
542 printf("error buf %s\n", error_buf);
544 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
546 asn_codec_ctx_t *opt_cod;
548 uint8_t e2smbuffer[8192];
549 size_t e2smbuffer_size = 8192;
551 uint8_t e2smbuffer2[8192];
552 size_t e2smbuffer_size2 = 8192;
555 asn_encode_to_buffer(opt_cod,
556 ATS_ALIGNED_BASIC_PER,
557 &asn_DEF_E2SM_KPM_IndicationMessage,
558 indicationmessage, e2smbuffer, e2smbuffer_size);
560 fprintf(stderr, "er encded is %d\n", er.encoded);
561 fprintf(stderr, "after encoding message\n");
566 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
568 uint8_t *nrcellid_buf,
570 const uint8_t *serving_buf,
571 const uint8_t *neighbor_buf) {
573 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
574 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
575 nrcellid_buf, crnti_buf,
576 serving_buf, neighbor_buf);
578 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
579 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
580 containers_list->theRANContainer = ranco;
582 E2SM_KPM_IndicationMessage_Format1_t *format =
583 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
584 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
586 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
588 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
590 indicationmessage->indicationMessage.present = pres;
592 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
594 char *error_buf = (char*)calloc(300, sizeof(char));
597 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
598 printf("error length %d\n", errlen);
599 printf("error buf %s\n", error_buf);
601 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
603 asn_codec_ctx_t *opt_cod;
605 uint8_t e2smbuffer[8192];
606 size_t e2smbuffer_size = 8192;
608 uint8_t e2smbuffer2[8192];
609 size_t e2smbuffer_size2 = 8192;
612 asn_encode_to_buffer(opt_cod,
613 ATS_ALIGNED_BASIC_PER,
614 &asn_DEF_E2SM_KPM_IndicationMessage,
615 indicationmessage, e2smbuffer, e2smbuffer_size);
617 fprintf(stderr, "er encded is %d\n", er.encoded);
618 fprintf(stderr, "after encoding message\n");
623 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
625 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
626 encode_kpm_ocucp_user_level(ranco);
628 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
629 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
630 containers_list->theRANContainer = ranco;
632 E2SM_KPM_IndicationMessage_Format1_t *format =
633 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
634 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
636 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
638 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
640 indicationmessage->indicationMessage.present = pres;
642 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
644 char *error_buf = (char*)calloc(300, sizeof(char));
647 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
648 printf("error length %d\n", errlen);
649 printf("error buf %s\n", error_buf);
651 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
653 asn_codec_ctx_t *opt_cod;
655 uint8_t e2smbuffer[8192];
656 size_t e2smbuffer_size = 8192;
658 uint8_t e2smbuffer2[8192];
659 size_t e2smbuffer_size2 = 8192;
662 asn_encode_to_buffer(opt_cod,
663 ATS_ALIGNED_BASIC_PER,
664 &asn_DEF_E2SM_KPM_IndicationMessage,
665 indicationmessage, e2smbuffer, e2smbuffer_size);
667 fprintf(stderr, "er encded is %d\n", er.encoded);
668 fprintf(stderr, "after encoding message\n");
673 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
675 uint8_t *nrcellid_buf,
683 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
685 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
686 //encode_kpm_ocuup_user_level(ranco);
689 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
690 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
691 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
692 ts->size = strlen((char*)buf);
693 memcpy(ts->buf,buf,ts->size);
697 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
698 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
700 uint8_t *buf2 = (uint8_t*)"747";
702 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
703 plmnidstr->buf = (uint8_t*)calloc(3,1);
705 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
709 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
710 uint8_t* buf3 = (uint8_t*)"12340";
711 nrcellid->buf = (uint8_t*)calloc(1,5);
712 memcpy(nrcellid->buf, buf3, 5);
714 nrcellid->bits_unused = 4;
716 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
717 nrcgi->pLMN_Identity = *plmnidstr;
718 nrcgi->nRCellIdentity = *nrcellid;
722 report_item->nRCGI = *nrcgi;
724 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
725 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
729 uint8_t* crnti_str = (uint8_t*)"1111";
730 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
731 crnti->buf = (uint8_t*)calloc(1,4);
735 crnti->size = strlen((char*)crnti_str);
738 memcpy(crnti->buf, crnti_str, crnti->size);
740 uint8_t *buf_serving = (uint8_t*)"RSRP10";
741 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
742 servingstr->buf = (uint8_t*)calloc(6,1);
743 servingstr->size = 6;
744 memcpy(servingstr->buf, buf_serving, servingstr->size);
746 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
747 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
748 neighborstr->buf = (uint8_t*)calloc(7,1);
749 neighborstr->size = 7;
750 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
752 ue_report_item->c_RNTI = *crnti;
753 ue_report_item->serving_Cell_RF_Type = servingstr;
754 ue_report_item->neighbor_Cell_RF = neighborstr;
757 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
759 ranco->timestamp = *ts;
760 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
761 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
763 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
766 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
767 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
768 containers_list->theRANContainer = ranco;
770 E2SM_KPM_IndicationMessage_Format1_t *format =
771 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
772 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
774 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
776 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
778 indicationmessage->indicationMessage.present = pres;
780 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
782 char *error_buf = (char*)calloc(300, sizeof(char));
785 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
786 printf("error length %d\n", errlen);
787 printf("error buf %s\n", error_buf);
789 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
791 asn_codec_ctx_t *opt_cod;
793 uint8_t e2smbuffer[8192];
794 size_t e2smbuffer_size = 8192;
796 uint8_t e2smbuffer2[8192];
797 size_t e2smbuffer_size2 = 8192;
800 asn_encode_to_buffer(opt_cod,
801 ATS_ALIGNED_BASIC_PER,
802 &asn_DEF_E2SM_KPM_IndicationMessage,
803 indicationmessage, e2smbuffer, e2smbuffer_size);
805 fprintf(stderr, "er encded is %d\n", er.encoded);
806 fprintf(stderr, "after encoding message\n");
811 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
818 uint8_t* nrcellid_buf,
823 asn_codec_ctx_t *opt_cod;
825 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
826 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
827 fqi_item->fiveQI = fiveqi;
828 fqi_item->dl_PRBUsage = &dl_prb_usage;
829 fqi_item->ul_PRBUsage = &ul_prb_usage;
831 uint8_t *buf1 = (uint8_t*)"4";
832 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
834 sst->buf = (uint8_t*)calloc(1,6);
835 memcpy(sst->buf,buf1,sst->size);
837 // std::string sd = "SD1";
838 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
839 // uint8_t *bufz = &sdvec[0];
840 uint8_t *bufz = (uint8_t*)"SD1";
841 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
843 sds->buf = (uint8_t*)calloc(1,3);
844 memcpy(sds->buf, bufz, sds->size);
847 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
848 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
849 snssai->sST.buf = (uint8_t*)calloc(1,1);
850 snssai->sST.size = 1;
851 memcpy(snssai->sST.buf, sst_buf, 1);
852 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
853 snssai->sD->buf = (uint8_t*)calloc(1,3);
854 snssai->sD->size = 3;
855 memcpy(snssai->sD->buf, sd_buf, 3);
858 SlicePerPlmnPerCellListItem_t *sliceitem =
859 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
860 sliceitem->sliceID = *snssai;
861 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
863 uint8_t *buf2 = (uint8_t*)"747";
865 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
866 plmnid->buf = (uint8_t*)calloc(3,1);
868 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
870 ServedPlmnPerCellListItem_t *percellitem1 =
871 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
872 percellitem1->pLMN_Identity = *plmnid;
873 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
874 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
876 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
877 plmnidstr->buf = (uint8_t*)calloc(3,1);
879 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
883 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
884 uint8_t* buf3 = (uint8_t*)"12340";
885 nrcellid->buf = (uint8_t*)calloc(1,5);
886 memcpy(nrcellid->buf, nrcellid_buf, 5);
888 nrcellid->bits_unused = 4;
890 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
891 nrcgi->pLMN_Identity = *plmnidstr;
892 nrcgi->nRCellIdentity = *nrcellid;
895 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
896 listitem1->nRCGI = *nrcgi;
897 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
898 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
899 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
902 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
903 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
904 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
906 PF_Container_PR pres1 = PF_Container_PR_oDU;
908 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
909 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
910 pfcontainer->present = pres1;
911 pfcontainer->choice.oDU = *ducont;
913 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
914 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
915 containers_list->performanceContainer = pfcontainer;
917 E2SM_KPM_IndicationMessage_Format1_t *format =
918 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
919 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
921 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
923 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
925 indicationmessage->indicationMessage.present = pres;
927 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
929 char *error_buf = (char*)calloc(300, sizeof(char));
932 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
933 printf("error length %d\n", errlen);
934 printf("error buf %s\n", error_buf);
936 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
939 uint8_t e2smbuffer[8192];
940 size_t e2smbuffer_size = 8192;
942 uint8_t e2smbuffer2[8192];
943 size_t e2smbuffer_size2 = 8192;
946 asn_encode_to_buffer(opt_cod,
947 ATS_ALIGNED_BASIC_PER,
948 &asn_DEF_E2SM_KPM_IndicationMessage,
949 indicationmessage, e2smbuffer, e2smbuffer_size);
951 fprintf(stderr, "er encded is %d\n", er.encoded);
952 fprintf(stderr, "after encoding message\n");
958 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
961 long dl_prb_usage = 50;
962 long ul_prb_usage = 70;
964 asn_codec_ctx_t *opt_cod;
966 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
967 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
968 fqi_item->fiveQI = fiveqi;
969 fqi_item->dl_PRBUsage = &dl_prb_usage;
970 fqi_item->ul_PRBUsage = &ul_prb_usage;
972 uint8_t *buf1 = (uint8_t*)"4";
973 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
975 sst->buf = (uint8_t*)calloc(1,6);
976 memcpy(sst->buf,buf1,sst->size);
978 // std::string sd = "SD1";
979 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
980 // uint8_t *bufz = &sdvec[0];
981 uint8_t *bufz = (uint8_t*)"SD1";
982 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
984 sds->buf = (uint8_t*)calloc(1,3);
985 memcpy(sds->buf, bufz, sds->size);
988 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
989 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
990 snssai->sST.buf = (uint8_t*)calloc(1,1);
991 snssai->sST.size = 1;
992 memcpy(snssai->sST.buf, buf1, 1);
993 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
994 snssai->sD->buf = (uint8_t*)calloc(1,3);
995 snssai->sD->size = 3;
996 memcpy(snssai->sD->buf, bufz, 3);
999 SlicePerPlmnPerCellListItem_t *sliceitem =
1000 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1001 sliceitem->sliceID = *snssai;
1002 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1004 uint8_t *buf2 = (uint8_t*)"747";
1006 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1007 plmnid->buf = (uint8_t*)calloc(3,1);
1009 memcpy(plmnid->buf, buf2, plmnid->size);
1011 ServedPlmnPerCellListItem_t *percellitem1 =
1012 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1013 percellitem1->pLMN_Identity = *plmnid;
1014 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1015 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1017 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1018 plmnidstr->buf = (uint8_t*)calloc(3,1);
1019 plmnidstr->size = 3;
1020 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1024 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1025 uint8_t* buf3 = (uint8_t*)"12340";
1026 nrcellid->buf = (uint8_t*)calloc(1,5);
1027 memcpy(nrcellid->buf, buf3, 5);
1029 nrcellid->bits_unused = 4;
1031 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1032 nrcgi->pLMN_Identity = *plmnidstr;
1033 nrcgi->nRCellIdentity = *nrcellid;
1035 long dl_prbs = (long)100;
1036 long ul_prbs = (long)120;
1038 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1039 listitem1->nRCGI = *nrcgi;
1040 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1041 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1042 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1045 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1046 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1047 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1049 PF_Container_PR pres1 = PF_Container_PR_oDU;
1051 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1052 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1053 pfcontainer->present = pres1;
1054 pfcontainer->choice.oDU = *ducont;
1056 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1057 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1058 containers_list->performanceContainer = pfcontainer;
1060 E2SM_KPM_IndicationMessage_Format1_t *format =
1061 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1062 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1064 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1066 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1068 indicationmessage->indicationMessage.present = pres;
1070 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1072 char *error_buf = (char*)calloc(300, sizeof(char));
1075 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1076 printf("error length %d\n", errlen);
1077 printf("error buf %s\n", error_buf);
1079 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1082 uint8_t e2smbuffer[8192];
1083 size_t e2smbuffer_size = 8192;
1085 uint8_t e2smbuffer2[8192];
1086 size_t e2smbuffer_size2 = 8192;
1089 asn_encode_to_buffer(opt_cod,
1090 ATS_ALIGNED_BASIC_PER,
1091 &asn_DEF_E2SM_KPM_IndicationMessage,
1092 indicationmessage, e2smbuffer, e2smbuffer_size);
1094 fprintf(stderr, "er encded is %d\n", er.encoded);
1095 fprintf(stderr, "after encoding message\n");
1100 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1101 uint8_t *gnbcuupname_buf,
1106 uint8_t *plmnid_buf) {
1108 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1111 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1112 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1113 gnbcuupname->size = 8;
1114 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1115 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1118 //We need to convert bytes_dl into array of uint8_t
1122 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1124 if (bytes_dl <= 64) {
1127 uint8_t buffer[array_size_dl];
1128 buffer[0] = bytes_dl & 0xFF;
1129 bytesdl->buf = (uint8_t*)calloc(1,1);
1130 memcpy(bytesdl->buf,buffer,1);
1133 } else if (bytes_dl <= 16384) {
1136 uint8_t buffer[array_size_dl];
1137 buffer[0] = (bytes_dl >> 8) & 0xFF;
1138 buffer[1] = bytes_dl & 0xFF;
1139 bytesdl->buf = (uint8_t*)calloc(2,1);
1140 memcpy(bytesdl->buf,buffer,2);
1143 } else if (bytes_dl <= 4194304) {
1146 uint8_t buffer[array_size_dl];
1147 buffer[0] = (bytes_dl >> 16) & 0xFF;
1148 buffer[1] = (bytes_dl >> 8) & 0xFF;
1149 buffer[2] = bytes_dl & 0xFF;
1150 bytesdl->buf = (uint8_t*)calloc(3,1);
1151 memcpy(bytesdl->buf,buffer,3);
1154 } else if (bytes_dl <= 1073741824) {
1156 uint8_t buffer[array_size_dl];
1157 buffer[0] = (bytes_dl >> 24) & 0xFF;
1158 buffer[1] = (bytes_dl >> 16) & 0xFF;
1159 buffer[2] = (bytes_dl >> 8) & 0xFF;
1160 buffer[3] = bytes_dl & 0xFF;
1161 bytesdl->buf = (uint8_t*)calloc(4,1);
1162 memcpy(bytesdl->buf,buffer,4);
1167 //We need to convert bytes_ul into array of uint8_t
1168 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1172 if (bytes_ul <= 64) {
1175 uint8_t buffer[array_size_ul];
1176 buffer[0] = bytes_ul & 0xFF;
1177 bytesul->buf = (uint8_t*)calloc(1,1);
1178 memcpy(bytesul->buf,buffer,1);
1181 } else if (bytes_ul <= 16384) {
1184 uint8_t buffer[array_size_ul];
1185 buffer[0] = (bytes_ul >> 8) & 0xFF;
1186 buffer[1] = bytes_ul & 0xFF;
1187 bytesul->buf = (uint8_t*)calloc(2,1);
1188 memcpy(bytesul->buf,buffer,2);
1191 } else if (bytes_ul <= 4194304) {
1194 uint8_t buffer[array_size_ul];
1195 buffer[0] = (bytes_ul >> 16) & 0xFF;
1196 buffer[1] = (bytes_ul >> 8) & 0xFF;
1197 buffer[2] = bytes_ul & 0xFF;
1198 bytesul->buf = (uint8_t*)calloc(3,1);
1199 memcpy(bytesul->buf,buffer,3);
1202 } else if (bytes_ul <= 1073741824) {
1204 uint8_t buffer[array_size_ul];
1205 buffer[0] = (bytes_ul >> 24) & 0xFF;
1206 buffer[1] = (bytes_ul >> 16) & 0xFF;
1207 buffer[2] = (bytes_ul >> 8) & 0xFF;
1208 buffer[3] = bytes_ul & 0xFF;
1209 bytesul->buf = (uint8_t*)calloc(4,1);
1210 memcpy(bytesul->buf,buffer,4);
1215 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1216 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1217 fqilistitem->fiveQI = 9;
1218 fqilistitem->pDCPBytesDL = bytesdl;
1219 fqilistitem->pDCPBytesUL = bytesul;
1222 uint8_t *buf1 = (uint8_t*)"4";
1223 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1225 sst->buf = (uint8_t*)calloc(1,6);
1226 memcpy(sst->buf,sst_buf,sst->size);
1229 uint8_t *bufz = (uint8_t*)"SD1";
1230 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1232 sds->buf = (uint8_t*)calloc(1,3);
1233 memcpy(sds->buf, sd_buf, sds->size);
1236 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1237 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1238 snssai->sST.buf = (uint8_t*)calloc(1,1);
1239 snssai->sST.size = 1;
1240 memcpy(snssai->sST.buf, sst_buf, 1);
1241 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1242 snssai->sD->buf = (uint8_t*)calloc(1,3);
1243 snssai->sD->size = 3;
1244 memcpy(snssai->sD->buf, sd_buf, 3);
1248 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1249 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1250 slicelistitem->sliceID = *snssai;
1251 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1253 asn_codec_ctx_t *opt_cod;
1256 uint8_t e2smbuffera[8192];
1257 size_t e2smbuffer_sizea = 8192;
1261 asn_enc_rval_t era =
1262 asn_encode_to_buffer(opt_cod,
1263 ATS_ALIGNED_BASIC_PER,
1264 &asn_DEF_SliceToReportListItem,
1265 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1266 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1267 fprintf(stderr, "after encoding message\n");
1271 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1272 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1273 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1275 uint8_t *buf2 = (uint8_t*)"747";
1276 // std::string pl = "PLMNID7";
1277 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1278 // uint8_t *buf2 = &plvec[0];
1280 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1281 plmnid->buf = (uint8_t*)calloc(3,1);
1283 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1286 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1287 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1288 plmnidlist->pLMN_Identity = *plmnid;
1289 plmnidlist->cu_UP_PM_5GC = pm_format;
1291 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1292 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1293 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1298 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1299 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1300 listitem1->interface_type = 2;
1301 listitem1->o_CU_UP_PM_Container = *meas_cont;
1303 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1304 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1305 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1306 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1308 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1310 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1311 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1312 pfcontainer->present = pres1;
1313 pfcontainer->choice.oCU_UP = *cuupcont;
1315 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1316 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1317 containers_list->performanceContainer = pfcontainer;
1319 E2SM_KPM_IndicationMessage_Format1_t *format =
1320 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1321 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1323 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1325 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1327 indicationmessage->indicationMessage.present = pres;
1329 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1331 char *error_buf = (char*)calloc(300, sizeof(char));
1334 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1335 printf("error length %d\n", errlen);
1336 printf("error buf %s\n", error_buf);
1338 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1341 uint8_t e2smbuffer[8192];
1342 size_t e2smbuffer_size = 8192;
1344 uint8_t e2smbuffer2[8192];
1345 size_t e2smbuffer_size2 = 8192;
1348 asn_encode_to_buffer(opt_cod,
1349 ATS_ALIGNED_BASIC_PER,
1350 &asn_DEF_E2SM_KPM_IndicationMessage,
1351 indicationmessage, e2smbuffer, e2smbuffer_size);
1353 fprintf(stderr, "er encded is %d\n", er.encoded);
1354 fprintf(stderr, "after encoding message\n");
1359 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1361 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1364 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1365 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1366 gnbcuupname->size = 8;
1367 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1368 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1371 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1374 bytesdl->buf = (uint8_t*)calloc(1,1);
1375 memcpy(bytesdl->buf, buffer,1);
1378 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1381 bytesul->buf = (uint8_t*)calloc(1,1);
1382 memcpy(bytesul->buf, buffer1, 1);
1385 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1386 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1387 fqilistitem->fiveQI = 9;
1388 fqilistitem->pDCPBytesDL = bytesdl;
1389 fqilistitem->pDCPBytesUL = bytesul;
1392 uint8_t *buf1 = (uint8_t*)"4";
1393 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1395 sst->buf = (uint8_t*)calloc(1,6);
1396 memcpy(sst->buf,buf1,sst->size);
1399 uint8_t *bufz = (uint8_t*)"SD1";
1400 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1402 sds->buf = (uint8_t*)calloc(1,3);
1403 memcpy(sds->buf, bufz, sds->size);
1406 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1407 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1408 snssai->sST.buf = (uint8_t*)calloc(1,1);
1409 snssai->sST.size = 1;
1410 memcpy(snssai->sST.buf, buf1, 1);
1411 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1412 snssai->sD->buf = (uint8_t*)calloc(1,3);
1413 snssai->sD->size = 3;
1414 memcpy(snssai->sD->buf, bufz, 3);
1418 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1419 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1420 slicelistitem->sliceID = *snssai;
1421 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1423 asn_codec_ctx_t *opt_cod;
1426 uint8_t e2smbuffera[8192];
1427 size_t e2smbuffer_sizea = 8192;
1431 asn_enc_rval_t era =
1432 asn_encode_to_buffer(opt_cod,
1433 ATS_ALIGNED_BASIC_PER,
1434 &asn_DEF_SliceToReportListItem,
1435 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1436 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1437 fprintf(stderr, "after encoding message\n");
1441 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1442 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1443 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1445 uint8_t *buf2 = (uint8_t*)"747";
1446 // std::string pl = "PLMNID7";
1447 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1448 // uint8_t *buf2 = &plvec[0];
1450 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1451 plmnid->buf = (uint8_t*)calloc(3,1);
1453 memcpy(plmnid->buf, buf2, plmnid->size);
1456 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1457 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1458 plmnidlist->pLMN_Identity = *plmnid;
1459 plmnidlist->cu_UP_PM_5GC = pm_format;
1461 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1462 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1463 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1468 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1469 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1470 listitem1->interface_type = 2;
1471 listitem1->o_CU_UP_PM_Container = *meas_cont;
1473 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1474 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1475 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1476 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1478 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1480 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1481 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1482 pfcontainer->present = pres1;
1483 pfcontainer->choice.oCU_UP = *cuupcont;
1485 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1486 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1487 containers_list->performanceContainer = pfcontainer;
1489 E2SM_KPM_IndicationMessage_Format1_t *format =
1490 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1491 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1493 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1495 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1497 indicationmessage->indicationMessage.present = pres;
1499 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1501 char *error_buf = (char*)calloc(300, sizeof(char));
1504 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1505 printf("error length %d\n", errlen);
1506 printf("error buf %s\n", error_buf);
1508 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1511 uint8_t e2smbuffer[8192];
1512 size_t e2smbuffer_size = 8192;
1514 uint8_t e2smbuffer2[8192];
1515 size_t e2smbuffer_size2 = 8192;
1518 asn_encode_to_buffer(opt_cod,
1519 ATS_ALIGNED_BASIC_PER,
1520 &asn_DEF_E2SM_KPM_IndicationMessage,
1521 indicationmessage, e2smbuffer, e2smbuffer_size);
1523 fprintf(stderr, "er encded is %d\n", er.encoded);
1524 fprintf(stderr, "after encoding message\n");
1529 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1532 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1533 //std::string gn = "GNBCUUP5";
1534 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1535 //uint8_t *buf = &gnvec[0];
1536 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1537 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1538 gnbcuupname->size = 8;
1539 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1540 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1543 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1546 bytesdl->buf = (uint8_t*)calloc(1,1);
1547 memcpy(bytesdl->buf, buffer,1);
1550 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1553 bytesul->buf = (uint8_t*)calloc(1,1);
1554 memcpy(bytesul->buf, buffer1, 1);
1557 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1558 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1559 fqilistitem->fiveQI = 9;
1560 fqilistitem->pDCPBytesDL = bytesdl;
1561 fqilistitem->pDCPBytesUL = bytesul;
1565 // std::string sl = "SLICE4";
1566 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1567 // uint8_t *buf1 = &slvec[0];
1568 uint8_t *buf1 = (uint8_t*)"4";
1569 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1571 sst->buf = (uint8_t*)calloc(1,6);
1572 memcpy(sst->buf,buf1,sst->size);
1574 // std::string sd = "SD1";
1575 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1576 // uint8_t *bufz = &sdvec[0];
1577 uint8_t *bufz = (uint8_t*)"SD1";
1578 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1580 sds->buf = (uint8_t*)calloc(1,3);
1581 memcpy(sds->buf, bufz, sds->size);
1584 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1585 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1586 snssai->sST.buf = (uint8_t*)calloc(1,1);
1587 snssai->sST.size = 1;
1588 memcpy(snssai->sST.buf, buf1, 1);
1589 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1590 snssai->sD->buf = (uint8_t*)calloc(1,3);
1591 snssai->sD->size = 3;
1592 memcpy(snssai->sD->buf, bufz, 3);
1596 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1597 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1598 slicelistitem->sliceID = *snssai;
1599 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1601 asn_codec_ctx_t *opt_cod;
1604 uint8_t e2smbuffera[8192];
1605 size_t e2smbuffer_sizea = 8192;
1609 asn_enc_rval_t era =
1610 asn_encode_to_buffer(opt_cod,
1611 ATS_ALIGNED_BASIC_PER,
1612 &asn_DEF_SliceToReportListItem,
1613 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1614 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1615 fprintf(stderr, "after encoding message\n");
1619 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1620 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1621 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1623 uint8_t *buf2 = (uint8_t*)"747";
1624 // std::string pl = "PLMNID7";
1625 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1626 // uint8_t *buf2 = &plvec[0];
1628 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1629 plmnid->buf = (uint8_t*)calloc(3,1);
1631 memcpy(plmnid->buf, buf2, plmnid->size);
1634 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1635 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1636 plmnidlist->pLMN_Identity = *plmnid;
1637 plmnidlist->cu_UP_PM_5GC = pm_format;
1639 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1640 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1641 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1646 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1647 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1648 listitem1->interface_type = 2;
1649 listitem1->o_CU_UP_PM_Container = *meas_cont;
1651 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1652 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1653 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1654 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1656 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1658 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1659 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1660 pfcontainer->present = pres1;
1661 pfcontainer->choice.oCU_UP = *cuupcont;
1663 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1664 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1665 containers_list->performanceContainer = pfcontainer;
1667 E2SM_KPM_IndicationMessage_Format1_t *format =
1668 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1669 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1671 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1673 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1675 indicationmessage->present = pres;
1677 indicationmessage->choice.indicationMessage_Format1 = *format;
1679 char *error_buf = (char*)calloc(300, sizeof(char));
1682 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1683 printf("error length %d\n", errlen);
1684 printf("error buf %s\n", error_buf);
1686 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1689 uint8_t e2smbuffer[8192];
1690 size_t e2smbuffer_size = 8192;
1692 uint8_t e2smbuffer2[8192];
1693 size_t e2smbuffer_size2 = 8192;
1696 asn_encode_to_buffer(opt_cod,
1697 ATS_ALIGNED_BASIC_PER,
1698 &asn_DEF_E2SM_KPM_IndicationMessage,
1699 indicationmessage, e2smbuffer, e2smbuffer_size);
1701 fprintf(stderr, "er encded is %d\n", er.encoded);
1702 fprintf(stderr, "after encoding message\n");
1708 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1709 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1710 std::string gn = "GNBCUUP5";
1711 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1712 uint8_t *buf = &gnvec[0];
1713 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1714 gnbcuupname->size = 8;
1715 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1716 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1719 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1722 bytesdl->buf = (uint8_t*)calloc(1,1);
1723 memcpy(bytesdl->buf, buffer,1);
1726 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1729 bytesul->buf = (uint8_t*)calloc(1,1);
1730 memcpy(bytesul->buf, buffer1, 1);
1733 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1734 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1735 fqilistitem->fiveQI = 9;
1736 fqilistitem->pDCPBytesDL = bytesdl;
1737 fqilistitem->pDCPBytesUL = bytesul;
1741 std::string sl = "SLICE4";
1742 std::vector<uint8_t> slvec(sl.begin(), sl.end());
1743 // uint8_t *buf1 = &slvec[0];
1744 uint8_t *buf1 = (uint8_t*)"SLICE4";
1745 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1747 sst->buf = (uint8_t*)calloc(1,6);
1748 memcpy(sst->buf,buf1,sst->size);
1750 std::string sd = "SD1";
1751 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1752 // uint8_t *bufz = &sdvec[0];
1753 uint8_t *bufz = (uint8_t*)"SD1";
1754 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1756 sds->buf = (uint8_t*)calloc(1,3);
1757 memcpy(sds->buf, bufz, sds->size);
1760 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1761 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1762 snssai->sST.buf = (uint8_t*)calloc(6,1);
1763 snssai->sST.size = 6;
1764 memcpy(snssai->sST.buf, buf1, 6);
1765 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1766 snssai->sD->buf = (uint8_t*)calloc(1,3);
1767 snssai->sD->size = 3;
1768 memcpy(snssai->sD->buf, bufz, 3);
1772 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1773 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1774 slicelistitem->sliceID = *snssai;
1775 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1777 uint8_t e2smbuffera[8192];
1778 size_t e2smbuffer_sizea = 8192;
1781 asn_encode_to_buffer(nullptr,
1782 ATS_ALIGNED_BASIC_PER,
1783 &asn_DEF_SliceToReportListItem,
1784 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1785 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1786 fprintf(stderr, "after encoding message\n");
1788 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1789 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1790 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1792 std::string pl = "PLMNID7";
1793 std::vector<uint8_t> plvec(pl.begin(), pl.end());
1794 uint8_t *buf2 = &plvec[0];
1796 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1797 plmnid->buf = (uint8_t*)calloc(1,7);
1799 memcpy(plmnid->buf, buf2, plmnid->size);
1802 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1803 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1804 plmnidlist->pLMN_Identity = *plmnid;
1805 plmnidlist->cu_UP_PM_5GC = pm_format;
1807 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1808 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1809 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1814 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1815 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1816 listitem1->interface_type = 2;
1817 listitem1->o_CU_UP_PM_Container = *meas_cont;
1819 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1820 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1821 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1822 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1824 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1826 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1827 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1828 pfcontainer->present = pres1;
1829 pfcontainer->choice.oCU_UP = *cuupcont;
1831 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1832 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1833 containers_list->performanceContainer = pfcontainer;
1835 E2SM_KPM_IndicationMessage_Format1_t *format =
1836 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1837 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1839 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1841 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1843 indicationmessage->present = pres;
1845 indicationmessage->choice.indicationMessage_Format1 = *format;
1847 char *error_buf = (char*)calloc(300, sizeof(char));
1850 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1851 printf("error length %d\n", errlen);
1852 printf("error buf %s\n", error_buf);
1855 uint8_t e2smbuffer[8192];
1856 size_t e2smbuffer_size = 8192;
1858 uint8_t e2smbuffer2[8192];
1859 size_t e2smbuffer_size2 = 8192;
1862 asn_encode_to_buffer(nullptr,
1863 ATS_ALIGNED_BASIC_PER,
1864 &asn_DEF_E2SM_KPM_IndicationMessage,
1865 indicationmessage, e2smbuffer, e2smbuffer_size);
1867 fprintf(stderr, "er encded is %d\n", er.encoded);
1868 fprintf(stderr, "after encoding message\n");