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));
189 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
190 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
191 snssai->sST.buf = (uint8_t*)calloc(1,1);
192 snssai->sST.size = 1;
193 memcpy(snssai->sST.buf, sst_buf, 1);
194 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
195 snssai->sD->buf = (uint8_t*)calloc(1,3);
196 snssai->sD->size = 3;
197 memcpy(snssai->sD->buf, sd_buf, 3);
199 BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
200 nrcellid->buf = (uint8_t*)calloc(1,5);
202 memcpy(nrcellid->buf, nrcellid_buf, 5);
204 nrcellid->buf[0] = 0x22;
205 nrcellid->buf[1] = 0x5B;
206 nrcellid->buf[2] = 0xD6;
207 nrcellid->buf[3] = 0x00;
208 nrcellid->buf[4] = 0x70;
210 nrcellid->bits_unused = 4;
213 INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
214 // uint8_t buffer[1];
215 // buffer[0] = 20000;
216 cuup_id->buf = (uint8_t*)calloc(1,1);
217 memcpy(cuup_id->buf, cuupid_buf, 1);
220 INTEGER_t *du_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
221 // uint8_t buffer_duid[1];
222 // buffer_duid[0] = 20000;
223 du_id->buf = (uint8_t*)calloc(1,1);
224 memcpy(du_id->buf, duid_buf, 1);
228 // uint8_t *buf5 = (uint8_t*)"GNBCUUP5";
229 OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
231 cuupname->buf = (uint8_t*)calloc(1,8);
232 memcpy(cuupname->buf, cuupname_buf, cuupname->size);
234 OCTET_STRING_t *plmnid_id_GlobalKPMnode_ID = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
235 plmnid_id_GlobalKPMnode_ID->size = strlen((char *)plmnid_buf);
236 plmnid_id_GlobalKPMnode_ID->buf = (uint8_t*)calloc(plmnid_id_GlobalKPMnode_ID->size, sizeof(uint8_t));
237 memcpy(plmnid_id_GlobalKPMnode_ID->buf, plmnid_buf, plmnid_id_GlobalKPMnode_ID->size);
239 BIT_STRING_t *gnb_bstring_id_GlobalKPMnode_ID = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));
240 gnb_bstring_id_GlobalKPMnode_ID->size = strlen((char *)gnbid_buf);
241 gnb_bstring_id_GlobalKPMnode_ID->buf = (uint8_t*)calloc(gnb_bstring_id_GlobalKPMnode_ID->size, sizeof(uint8_t));
242 memcpy(gnb_bstring_id_GlobalKPMnode_ID->buf, gnbid_buf, gnb_bstring_id_GlobalKPMnode_ID->size);
243 gnb_bstring_id_GlobalKPMnode_ID->bits_unused = gnbid_unused;
245 ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID));
246 ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB;
247 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
248 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring_id_GlobalKPMnode_ID;
249 ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid_id_GlobalKPMnode_ID;
250 ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id;
251 if (plmnid_id_GlobalKPMnode_ID) free(plmnid_id_GlobalKPMnode_ID);
252 if (gnb_bstring_id_GlobalKPMnode_ID) free(gnb_bstring_id_GlobalKPMnode_ID);
255 OCTET_STRING_t *plmnid_nRCGI = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
256 plmnid_nRCGI->buf = (uint8_t*)calloc(3,1);
257 plmnid_nRCGI->size = 3;
258 memcpy(plmnid_nRCGI->buf, plmnid_buf, plmnid_nRCGI->size);
260 ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI));
261 ind_header->nRCGI->pLMN_Identity = *plmnid_nRCGI;
262 ind_header->nRCGI->nRCellIdentity = *nrcellid;
263 if (plmnid_nRCGI) free(plmnid_nRCGI);
264 if (nrcellid) free(nrcellid);
267 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
268 plmnid->buf = (uint8_t*)calloc(3,1);
270 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
272 ind_header->pLMN_Identity = plmnid;
273 // memcpy(ind_header->fiveQI, &fqival, 4);
275 ind_header->sliceID = snssai;
276 // memcpy(ind_header->qci, &qcival, 4);
279 ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name));
280 ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name;
281 ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname;
282 if (cuupname) free(cuupname);
285 OCTET_STRING_t *plmnid_global_GNB_ID = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
286 plmnid_global_GNB_ID->buf = (uint8_t*)calloc(3,1);
287 plmnid_global_GNB_ID->size = 3;
288 memcpy(plmnid_global_GNB_ID->buf, plmnid_buf, plmnid_global_GNB_ID->size);
290 BIT_STRING_t *gnb_bstring_global_GNB_ID = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));;
291 gnb_bstring_global_GNB_ID->buf = (uint8_t*)calloc(1,4);
292 gnb_bstring_global_GNB_ID->size = 4;
293 memcpy(gnb_bstring_global_GNB_ID->buf, gnbid_buf, 4);
294 gnb_bstring_global_GNB_ID->bits_unused = gnbid_unused;
296 ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID));
297 ind_header->global_GNB_ID->plmn_id = *plmnid_global_GNB_ID;
298 ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID;
299 ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring_global_GNB_ID;
300 if (plmnid_global_GNB_ID) free(plmnid_global_GNB_ID);
301 if (gnb_bstring_global_GNB_ID) free(gnb_bstring_global_GNB_ID);
304 // long msg_type = 2;
305 // ind_header->message_Type = &msg_type;
306 ind_header->gNB_DU_ID = du_id;
309 ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1;
310 ihead->choice.indicationHeader_Format1 = *ind_header;
311 if (ind_header) free(ind_header);
313 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ihead);
319 void encode_kpm_ocuup_user_level(RAN_Container_t *ranco,
321 uint8_t *nrcellid_buf,
326 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
327 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
328 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
329 ts->size = strlen((char*)buf);
330 memcpy(ts->buf,buf,ts->size);
334 CU_UP_Usage_Report_CellResourceReportItem_t *report_item =
335 (CU_UP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_UP_Usage_Report_CellResourceReportItem_t));
337 // uint8_t *buf2 = (uint8_t*)"747";
339 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
340 plmnidstr->buf = (uint8_t*)calloc(3,1);
342 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
346 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
347 // uint8_t* buf3 = (uint8_t*)"12340";
348 nrcellid->buf = (uint8_t*)calloc(1,5);
349 memcpy(nrcellid->buf, nrcellid_buf, 5);
351 nrcellid->bits_unused = 4;
353 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
354 nrcgi->pLMN_Identity = *plmnidstr;
355 nrcgi->nRCellIdentity = *nrcellid;
356 if (plmnidstr) free(plmnidstr);
357 if (nrcellid) free(nrcellid);
361 report_item->nRCGI = *nrcgi;
362 if (nrcgi) free(nrcgi);
364 CU_UP_Usage_Report_UeResourceReportItem *ue_report_item =
365 (CU_UP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_UP_Usage_Report_UeResourceReportItem));
369 // uint8_t* crnti_str = (uint8_t*)"1111";
370 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
371 crnti->buf = (uint8_t*)calloc(1,4);
375 crnti->size = strlen((char*)crnti_buf);
378 memcpy(crnti->buf, crnti_buf, crnti->size);
382 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
385 if (bytes_dl <= 64) {
388 uint8_t buffer[array_size_dl];
389 buffer[0] = bytes_dl & 0xFF;
390 bytesdl->buf = (uint8_t*)calloc(1,1);
391 memcpy(bytesdl->buf,buffer,1);
394 } else if (bytes_dl <= 16384) {
397 uint8_t buffer[array_size_dl];
398 buffer[0] = (bytes_dl >> 8) & 0xFF;
399 buffer[1] = bytes_dl & 0xFF;
400 bytesdl->buf = (uint8_t*)calloc(2,1);
401 memcpy(bytesdl->buf,buffer,2);
404 } else if (bytes_dl <= 4194304) {
407 uint8_t buffer[array_size_dl];
408 buffer[0] = (bytes_dl >> 16) & 0xFF;
409 buffer[1] = (bytes_dl >> 8) & 0xFF;
410 buffer[2] = bytes_dl & 0xFF;
411 bytesdl->buf = (uint8_t*)calloc(3,1);
412 memcpy(bytesdl->buf,buffer,3);
415 } else if (bytes_dl <= 1073741824) {
417 uint8_t buffer[array_size_dl];
418 buffer[0] = (bytes_dl >> 24) & 0xFF;
419 buffer[1] = (bytes_dl >> 16) & 0xFF;
420 buffer[2] = (bytes_dl >> 8) & 0xFF;
421 buffer[3] = bytes_dl & 0xFF;
422 bytesdl->buf = (uint8_t*)calloc(4,1);
423 memcpy(bytesdl->buf,buffer,4);
428 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
432 if (bytes_ul <= 64) {
435 uint8_t buffer[array_size_ul];
436 buffer[0] = bytes_ul & 0xFF;
437 bytesul->buf = (uint8_t*)calloc(1,1);
438 memcpy(bytesul->buf,buffer,1);
441 } else if (bytes_ul <= 16384) {
444 uint8_t buffer[array_size_ul];
445 buffer[0] = (bytes_ul >> 8) & 0xFF;
446 buffer[1] = bytes_ul & 0xFF;
447 bytesul->buf = (uint8_t*)calloc(2,1);
448 memcpy(bytesul->buf,buffer,2);
451 } else if (bytes_ul <= 4194304) {
454 uint8_t buffer[array_size_ul];
455 buffer[0] = (bytes_ul >> 16) & 0xFF;
456 buffer[1] = (bytes_ul >> 8) & 0xFF;
457 buffer[2] = bytes_ul & 0xFF;
458 bytesul->buf = (uint8_t*)calloc(3,1);
459 memcpy(bytesul->buf,buffer,3);
462 } else if (bytes_ul <= 1073741824) {
464 uint8_t buffer[array_size_ul];
465 buffer[0] = (bytes_ul >> 24) & 0xFF;
466 buffer[1] = (bytes_ul >> 16) & 0xFF;
467 buffer[2] = (bytes_ul >> 8) & 0xFF;
468 buffer[3] = bytes_ul & 0xFF;
469 bytesul->buf = (uint8_t*)calloc(4,1);
470 memcpy(bytesul->buf,buffer,4);
476 ue_report_item->c_RNTI = *crnti;
477 ue_report_item->pDCPBytesDL = bytesdl;
478 ue_report_item->pDCPBytesUL = bytesul;
479 if (crnti) free(crnti);
482 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
484 ranco->timestamp = *ts;
485 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_UP_UE;
486 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_UP_UE.cellResourceReportList.list, report_item);
489 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
493 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco,
495 uint8_t *nrcellid_buf,
497 const uint8_t *serving_buf,
498 const uint8_t *neighbor_buf) {
499 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
500 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
501 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
502 ts->size = strlen((char*)buf);
503 memcpy(ts->buf,buf,ts->size);
507 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
508 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
510 int plmnid_size = strlen((char*)plmnid_buf);
511 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
512 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
513 plmnidstr->size = plmnid_size;
514 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
518 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
520 // int nrcellid_size = strlen((char*)nrcellid_buf);
521 int nrcellid_size = 5;
522 nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size);
523 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
525 nrcellid->bits_unused = 4;
527 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
528 nrcgi->pLMN_Identity = *plmnidstr;
529 nrcgi->nRCellIdentity = *nrcellid;
530 if (plmnidstr) free(plmnidstr);
531 if (nrcellid) free(nrcellid);
535 report_item->nRCGI = *nrcgi;
536 if (nrcgi) free(nrcgi);
538 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
539 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
544 int crnti_size = strlen((char*)crnti_buf);
545 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
546 crnti->buf = (uint8_t*)calloc(1, crnti_size);
550 crnti->size = strlen((char*)crnti_buf);
553 memcpy(crnti->buf, crnti_buf, crnti->size);
555 // uint8_t *buf_serving = (uint8_t*)"RSRP10";
557 int serving_buf_len = strlen((char*)serving_buf);
558 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
559 servingstr->buf = (uint8_t*)calloc(serving_buf_len,1);
560 servingstr->size = serving_buf_len;
561 memcpy(servingstr->buf, serving_buf, servingstr->size);
564 int neighbor_buf_len = strlen((char*)neighbor_buf);
565 // uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
566 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
567 ts->buf = (uint8_t*)calloc(neighbor_buf_len,1);
568 neighborstr->buf = (uint8_t*)calloc(neighbor_buf_len,1);
569 neighborstr->size = neighbor_buf_len;
570 memcpy(neighborstr->buf, neighbor_buf, neighborstr->size);
572 ue_report_item->c_RNTI = *crnti;
573 ue_report_item->serving_Cell_RF_Type = servingstr;
574 ue_report_item->neighbor_Cell_RF = neighborstr;
575 if (crnti) free(crnti);
578 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
580 ranco->timestamp = *ts;
581 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
582 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
583 if (ts->buf) free(ts->buf);
586 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
591 void encode_kpm_ocucp_user_level(RAN_Container_t *ranco) {
593 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
594 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
595 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
596 ts->size = strlen((char*)buf);
597 memcpy(ts->buf,buf,ts->size);
601 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
602 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
604 uint8_t *buf2 = (uint8_t*)"747";
606 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
607 plmnidstr->buf = (uint8_t*)calloc(3,1);
609 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
613 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
614 uint8_t* buf3 = (uint8_t*)"12340";
615 nrcellid->buf = (uint8_t*)calloc(1,5);
616 memcpy(nrcellid->buf, buf3, 5);
618 nrcellid->bits_unused = 4;
620 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
621 nrcgi->pLMN_Identity = *plmnidstr;
622 nrcgi->nRCellIdentity = *nrcellid;
626 report_item->nRCGI = *nrcgi;
627 if (nrcgi) free(nrcgi);
629 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
630 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
634 uint8_t* crnti_str = (uint8_t*)"1111";
635 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
636 crnti->buf = (uint8_t*)calloc(1,4);
640 crnti->size = strlen((char*)crnti_str);
643 memcpy(crnti->buf, crnti_str, crnti->size);
645 uint8_t *buf_serving = (uint8_t*)"RSRP10";
646 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
647 servingstr->buf = (uint8_t*)calloc(6,1);
648 servingstr->size = 6;
649 memcpy(servingstr->buf, buf_serving, servingstr->size);
651 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
652 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
653 neighborstr->buf = (uint8_t*)calloc(7,1);
654 neighborstr->size = 7;
655 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
657 ue_report_item->c_RNTI = *crnti;
658 ue_report_item->serving_Cell_RF_Type = servingstr;
659 ue_report_item->neighbor_Cell_RF = neighborstr;
662 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
664 ranco->timestamp = *ts;
665 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
666 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
668 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
673 void encode_kpm_odu_user_level(RAN_Container_t *ranco,
675 uint8_t *nrcellid_buf,
680 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
681 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
682 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
683 ts->size = strlen((char*)buf);
684 memcpy(ts->buf,buf,ts->size);
688 DU_Usage_Report_CellResourceReportItem_t *report_item =
689 (DU_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(DU_Usage_Report_CellResourceReportItem_t));
691 // uint8_t *buf2 = (uint8_t*)"747";
693 int plmnid_size = strlen((char*)plmnid_buf);
694 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
695 plmnidstr->buf = (uint8_t*)calloc(plmnid_size,1);
696 plmnidstr->size = plmnid_size;
697 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
701 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
703 // int nrcellid_size = strlen((char*)nrcellid_buf);
704 int nrcellid_size = 5;
705 nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size);
706 memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size);
707 nrcellid->size = nrcellid_size;
708 nrcellid->bits_unused = 4;
710 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
711 nrcgi->pLMN_Identity = *plmnidstr;
712 nrcgi->nRCellIdentity = *nrcellid;
713 if (plmnidstr) free(plmnidstr);
714 if (nrcellid) free(nrcellid);
718 report_item->nRCGI = *nrcgi;
719 if (nrcgi) free(nrcgi);
723 DU_Usage_Report_UeResourceReportItem *ue_report_item =
724 (DU_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(DU_Usage_Report_UeResourceReportItem));
728 int crnti_size = strlen((char*)crnti_buf);
730 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
731 crnti->buf = (uint8_t*)calloc(1,crnti_size);
735 crnti->size = strlen((char*)crnti_buf);
738 memcpy(crnti->buf, crnti_buf, crnti->size);
742 long *p_prb_usage_dl = (long*)calloc(1, sizeof(long));
743 long *p_prb_usage_ul = (long*)calloc(1, sizeof(long));
744 *p_prb_usage_dl = (long)prb_usage_dl;
745 *p_prb_usage_ul = (long)prb_usage_ul;
747 ue_report_item->c_RNTI = *crnti;
748 ue_report_item->dl_PRBUsage = p_prb_usage_dl;
749 if (crnti) free(crnti);
753 ue_report_item->ul_PRBUsage = p_prb_usage_ul;
757 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
760 ranco->timestamp = *ts;
761 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oDU_UE;
762 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oDU_UE.cellResourceReportList.list, report_item);
765 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
770 void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
772 uint8_t *nrcellid_buf,
777 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
778 encode_kpm_odu_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,prb_usage_dl,prb_usage_ul);
780 printf("After creating RAN container, xer printing it\n");
781 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
783 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
784 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
785 containers_list->theRANContainer = ranco;
787 E2SM_KPM_IndicationMessage_Format1_t *format =
788 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
789 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
791 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
793 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
795 indicationmessage->indicationMessage.present = pres;
797 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
798 if (format) free(format);
800 char error_buf[300] = {0, };
803 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
804 printf("error length %d\n", errlen);
805 printf("error buf %s\n", error_buf);
807 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
809 asn_codec_ctx_t *opt_cod;
811 uint8_t e2smbuffer[8192] = {0, };
812 size_t e2smbuffer_size = 8192;
814 uint8_t e2smbuffer2[8192] = {0, };
815 size_t e2smbuffer_size2 = 8192;
818 asn_encode_to_buffer(opt_cod,
819 ATS_ALIGNED_BASIC_PER,
820 &asn_DEF_E2SM_KPM_IndicationMessage,
821 indicationmessage, e2smbuffer, e2smbuffer_size);
823 fprintf(stderr, "er encded is %d\n", er.encoded);
824 fprintf(stderr, "after encoding message\n");
829 void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
831 uint8_t *nrcellid_buf,
833 const uint8_t *serving_buf,
834 const uint8_t *neighbor_buf) {
836 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
837 encode_kpm_ocucp_user_level(ranco, plmnid_buf,
838 nrcellid_buf, crnti_buf,
839 serving_buf, neighbor_buf);
841 printf("After creating RAN container, xer printing it\n");
842 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
845 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
846 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
847 containers_list->theRANContainer = ranco;
849 E2SM_KPM_IndicationMessage_Format1_t *format =
850 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
851 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
853 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
855 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
857 indicationmessage->indicationMessage.present = pres;
859 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
860 if (format) free(format);
862 char error_buf[300] = {0, };
865 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
866 printf("error length %d\n", errlen);
867 printf("error buf %s\n", error_buf);
869 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
871 asn_codec_ctx_t *opt_cod;
873 uint8_t e2smbuffer[8192] = {0, };
874 size_t e2smbuffer_size = 8192;
876 uint8_t e2smbuffer2[8192] = {0, };
877 size_t e2smbuffer_size2 = 8192;
880 asn_encode_to_buffer(opt_cod,
881 ATS_ALIGNED_BASIC_PER,
882 &asn_DEF_E2SM_KPM_IndicationMessage,
883 indicationmessage, e2smbuffer, e2smbuffer_size);
885 fprintf(stderr, "er encded is %d\n", er.encoded);
886 fprintf(stderr, "after encoding message\n");
891 void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicationmessage) {
893 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
894 encode_kpm_ocucp_user_level(ranco);
896 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
897 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
898 containers_list->theRANContainer = ranco;
900 E2SM_KPM_IndicationMessage_Format1_t *format =
901 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
902 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
904 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
906 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
908 indicationmessage->indicationMessage.present = pres;
910 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
911 if (format) free(format);
913 char error_buf[300] = {0, };
916 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
917 printf("error length %d\n", errlen);
918 printf("error buf %s\n", error_buf);
920 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
922 asn_codec_ctx_t *opt_cod;
924 uint8_t e2smbuffer[8192] = {0, };
925 size_t e2smbuffer_size = 8192;
927 uint8_t e2smbuffer2[8192] = {0, };
928 size_t e2smbuffer_size2 = 8192;
931 asn_encode_to_buffer(opt_cod,
932 ATS_ALIGNED_BASIC_PER,
933 &asn_DEF_E2SM_KPM_IndicationMessage,
934 indicationmessage, e2smbuffer, e2smbuffer_size);
936 fprintf(stderr, "er encded is %d\n", er.encoded);
937 fprintf(stderr, "after encoding message\n");
942 void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
944 uint8_t *nrcellid_buf,
949 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
950 encode_kpm_ocuup_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,pdcp_bytesdl,pdcp_bytesul);
952 fprintf(stderr, "After creating RAN container, xer printing it\n");
953 xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
955 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
956 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
957 containers_list->theRANContainer = ranco;
959 E2SM_KPM_IndicationMessage_Format1_t *format =
960 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
961 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
963 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
965 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
967 indicationmessage->indicationMessage.present = pres;
969 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
970 if (format) free(format);
972 char error_buf[300] = {0, };
975 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
976 printf("error length %d\n", errlen);
977 printf("error buf %s\n", error_buf);
979 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
981 asn_codec_ctx_t *opt_cod;
983 uint8_t e2smbuffer[8192] = {0, };
984 size_t e2smbuffer_size = 8192;
986 uint8_t e2smbuffer2[8192] = {0, };
987 size_t e2smbuffer_size2 = 8192;
989 // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
992 asn_encode_to_buffer(opt_cod,
993 ATS_ALIGNED_BASIC_PER,
994 &asn_DEF_E2SM_KPM_IndicationMessage,
995 indicationmessage, e2smbuffer, e2smbuffer_size);
997 fprintf(stderr, "er encded is %d\n", er.encoded);
998 fprintf(stderr, "after encoding message\n");
1003 void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1005 RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t));
1006 //encode_kpm_ocuup_user_level(ranco);
1009 uint8_t *buf = (uint8_t*)"2020.06.13 13:01:05.222";
1010 Timestamp_t *ts = (Timestamp_t*)calloc(1,sizeof(Timestamp_t));
1011 ts->buf = (uint8_t*)calloc(strlen((char*)buf),1);
1012 ts->size = strlen((char*)buf);
1013 memcpy(ts->buf,buf,ts->size);
1017 CU_CP_Usage_Report_CellResourceReportItem_t *report_item =
1018 (CU_CP_Usage_Report_CellResourceReportItem_t*)calloc(1,sizeof(CU_CP_Usage_Report_CellResourceReportItem_t));
1020 uint8_t *buf2 = (uint8_t*)"747";
1022 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1023 plmnidstr->buf = (uint8_t*)calloc(3,1);
1024 plmnidstr->size = 3;
1025 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1029 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1030 uint8_t* buf3 = (uint8_t*)"12340";
1031 nrcellid->buf = (uint8_t*)calloc(1,5);
1032 memcpy(nrcellid->buf, buf3, 5);
1034 nrcellid->bits_unused = 4;
1036 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1037 nrcgi->pLMN_Identity = *plmnidstr;
1038 nrcgi->nRCellIdentity = *nrcellid;
1039 if (plmnidstr) free(plmnidstr);
1040 if (nrcellid) free(nrcellid);
1044 report_item->nRCGI = *nrcgi;
1045 if (nrcgi) free(nrcgi);
1047 CU_CP_Usage_Report_UeResourceReportItem *ue_report_item =
1048 (CU_CP_Usage_Report_UeResourceReportItem*)calloc(1,sizeof(CU_CP_Usage_Report_UeResourceReportItem));
1052 uint8_t* crnti_str = (uint8_t*)"1111";
1053 OCTET_STRING *crnti = (OCTET_STRING*)calloc(1,sizeof(OCTET_STRING));
1054 crnti->buf = (uint8_t*)calloc(1,4);
1058 crnti->size = strlen((char*)crnti_str);
1061 memcpy(crnti->buf, crnti_str, crnti->size);
1063 uint8_t *buf_serving = (uint8_t*)"RSRP10";
1064 OCTET_STRING_t *servingstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1065 servingstr->buf = (uint8_t*)calloc(6,1);
1066 servingstr->size = 6;
1067 memcpy(servingstr->buf, buf_serving, servingstr->size);
1069 uint8_t *buf_neighbor = (uint8_t*)"-10,-15";
1070 OCTET_STRING_t *neighborstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1071 neighborstr->buf = (uint8_t*)calloc(7,1);
1072 neighborstr->size = 7;
1073 memcpy(neighborstr->buf, buf_neighbor, neighborstr->size);
1075 ue_report_item->c_RNTI = *crnti;
1076 ue_report_item->serving_Cell_RF_Type = servingstr;
1077 ue_report_item->neighbor_Cell_RF = neighborstr;
1080 ASN_SEQUENCE_ADD(&report_item->ueResourceReportList.list, ue_report_item);
1082 ranco->timestamp = *ts;
1083 ranco->reportContainer.present = RAN_Container__reportContainer_PR_oCU_CP_UE;
1084 ASN_SEQUENCE_ADD(&ranco->reportContainer.choice.oCU_CP_UE.cellResourceReportList.list, report_item);
1086 // xer_fprint(stderr, &asn_DEF_RAN_Container, ranco);
1089 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1090 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1091 containers_list->theRANContainer = ranco;
1093 E2SM_KPM_IndicationMessage_Format1_t *format =
1094 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1095 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1097 int ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1099 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1101 indicationmessage->indicationMessage.present = pres;
1103 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1104 if (format) free(format);
1106 char error_buf[300] = {0, };
1109 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1110 printf("error length %d\n", errlen);
1111 printf("error buf %s\n", error_buf);
1113 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1115 asn_codec_ctx_t *opt_cod;
1117 uint8_t e2smbuffer[8192] = {0, };
1118 size_t e2smbuffer_size = 8192;
1120 uint8_t e2smbuffer2[8192] = {0, };
1121 size_t e2smbuffer_size2 = 8192;
1124 asn_encode_to_buffer(opt_cod,
1125 ATS_ALIGNED_BASIC_PER,
1126 &asn_DEF_E2SM_KPM_IndicationMessage,
1127 indicationmessage, e2smbuffer, e2smbuffer_size);
1129 fprintf(stderr, "er encded is %d\n", er.encoded);
1130 fprintf(stderr, "after encoding message\n");
1135 void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1141 uint8_t* plmnid_buf,
1142 uint8_t* nrcellid_buf,
1147 asn_codec_ctx_t *opt_cod;
1149 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1150 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1152 long *p_dl_prb_usage = (long*)calloc(1, sizeof(long));
1153 long *p_ul_prb_usage = (long*)calloc(1, sizeof(long));
1154 *p_dl_prb_usage = (long)dl_prb_usage;
1155 *p_ul_prb_usage = (long)ul_prb_usage;
1157 fqi_item->fiveQI = fiveqi;
1158 fqi_item->dl_PRBUsage = p_dl_prb_usage;
1159 fqi_item->ul_PRBUsage = p_ul_prb_usage;
1161 uint8_t *buf1 = (uint8_t*)"4";
1163 // std::string sd = "SD1";
1164 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1165 // uint8_t *bufz = &sdvec[0];
1166 uint8_t *bufz = (uint8_t*)"SD1";
1168 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1169 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1170 snssai->sST.buf = (uint8_t*)calloc(1,1);
1171 snssai->sST.size = 1;
1172 memcpy(snssai->sST.buf, sst_buf, 1);
1173 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1174 snssai->sD->buf = (uint8_t*)calloc(1,3);
1175 snssai->sD->size = 3;
1176 memcpy(snssai->sD->buf, sd_buf, 3);
1179 SlicePerPlmnPerCellListItem_t *sliceitem =
1180 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1181 sliceitem->sliceID = *snssai;
1182 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1183 if (snssai) free(snssai);
1185 uint8_t *buf2 = (uint8_t*)"747";
1187 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1188 plmnid->buf = (uint8_t*)calloc(3,1);
1190 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1192 ServedPlmnPerCellListItem_t *percellitem1 =
1193 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1194 percellitem1->pLMN_Identity = *plmnid;
1195 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1196 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1197 if (plmnid) free(plmnid);
1199 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1200 plmnidstr->buf = (uint8_t*)calloc(3,1);
1201 plmnidstr->size = 3;
1202 memcpy(plmnidstr->buf, plmnid_buf, plmnidstr->size);
1206 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1207 uint8_t* buf3 = (uint8_t*)"12340";
1208 nrcellid->buf = (uint8_t*)calloc(1,5);
1209 memcpy(nrcellid->buf, nrcellid_buf, 5);
1211 nrcellid->bits_unused = 4;
1213 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1214 nrcgi->pLMN_Identity = *plmnidstr;
1215 nrcgi->nRCellIdentity = *nrcellid;
1216 if (plmnidstr) free(plmnidstr);
1217 if (nrcellid) free(nrcellid);
1220 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1221 listitem1->nRCGI = *nrcgi;
1222 listitem1->dl_TotalofAvailablePRBs = dl_prbs;
1223 listitem1->ul_TotalofAvailablePRBs = ul_prbs;
1224 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1225 if (nrcgi) free(nrcgi);
1228 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1229 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1230 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1232 PF_Container_PR pres1 = PF_Container_PR_oDU;
1234 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1235 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1236 pfcontainer->present = pres1;
1237 pfcontainer->choice.oDU = *ducont;
1238 if (ducont) free(ducont);
1240 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1241 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1242 containers_list->performanceContainer = pfcontainer;
1244 E2SM_KPM_IndicationMessage_Format1_t *format =
1245 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1246 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1248 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1250 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1252 indicationmessage->indicationMessage.present = pres;
1254 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1255 if (format) free(format);
1257 char error_buf[300] = {0, };
1260 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1261 printf("error length %d\n", errlen);
1262 printf("error buf %s\n", error_buf);
1264 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1267 uint8_t e2smbuffer[8192] = {0, };
1268 size_t e2smbuffer_size = 8192;
1270 uint8_t e2smbuffer2[8192] = {0, };
1271 size_t e2smbuffer_size2 = 8192;
1274 asn_encode_to_buffer(opt_cod,
1275 ATS_ALIGNED_BASIC_PER,
1276 &asn_DEF_E2SM_KPM_IndicationMessage,
1277 indicationmessage, e2smbuffer, e2smbuffer_size);
1279 fprintf(stderr, "er encded is %d\n", er.encoded);
1280 fprintf(stderr, "after encoding message\n");
1286 void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1289 long dl_prb_usage = 50;
1290 long ul_prb_usage = 70;
1292 asn_codec_ctx_t *opt_cod;
1294 FQIPERSlicesPerPlmnPerCellListItem_t *fqi_item =
1295 (FQIPERSlicesPerPlmnPerCellListItem_t*)calloc(1,sizeof(FQIPERSlicesPerPlmnPerCellListItem_t));
1296 fqi_item->fiveQI = fiveqi;
1297 fqi_item->dl_PRBUsage = &dl_prb_usage;
1298 fqi_item->ul_PRBUsage = &ul_prb_usage;
1300 uint8_t *buf1 = (uint8_t*)"4";
1301 // std::string sd = "SD1";
1302 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1303 // uint8_t *bufz = &sdvec[0];
1304 uint8_t *bufz = (uint8_t*)"SD1";
1306 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1307 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1308 snssai->sST.buf = (uint8_t*)calloc(1,1);
1309 snssai->sST.size = 1;
1310 memcpy(snssai->sST.buf, buf1, 1);
1311 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1312 snssai->sD->buf = (uint8_t*)calloc(1,3);
1313 snssai->sD->size = 3;
1314 memcpy(snssai->sD->buf, bufz, 3);
1317 SlicePerPlmnPerCellListItem_t *sliceitem =
1318 (SlicePerPlmnPerCellListItem_t*)calloc(1,sizeof(SlicePerPlmnPerCellListItem_t));
1319 sliceitem->sliceID = *snssai;
1320 ASN_SEQUENCE_ADD(&sliceitem->fQIPERSlicesPerPlmnPerCellList.list, fqi_item);
1321 if (snssai) free(snssai);
1323 uint8_t *buf2 = (uint8_t*)"747";
1325 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1326 plmnid->buf = (uint8_t*)calloc(3,1);
1328 memcpy(plmnid->buf, buf2, plmnid->size);
1330 ServedPlmnPerCellListItem_t *percellitem1 =
1331 (ServedPlmnPerCellListItem_t*)calloc(1,sizeof(ServedPlmnPerCellListItem_t));
1332 percellitem1->pLMN_Identity = *plmnid;
1333 percellitem1->du_PM_5GC = (FGC_DU_PM_Container*)calloc(1,sizeof(FGC_DU_PM_Container));
1334 ASN_SEQUENCE_ADD(&percellitem1->du_PM_5GC->slicePerPlmnPerCellList.list, sliceitem);
1336 OCTET_STRING_t *plmnidstr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1337 plmnidstr->buf = (uint8_t*)calloc(3,1);
1338 plmnidstr->size = 3;
1339 memcpy(plmnidstr->buf, buf2, plmnidstr->size);
1343 NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t));
1344 uint8_t* buf3 = (uint8_t*)"12340";
1345 nrcellid->buf = (uint8_t*)calloc(1,5);
1346 memcpy(nrcellid->buf, buf3, 5);
1348 nrcellid->bits_unused = 4;
1350 NRCGI *nrcgi = (NRCGI*)calloc(1,sizeof(NRCGI));
1351 nrcgi->pLMN_Identity = *plmnidstr;
1352 nrcgi->nRCellIdentity = *nrcellid;
1353 if (plmnidstr) free(plmnidstr);
1354 if (nrcellid) free(nrcellid);
1356 long dl_prbs = (long)100;
1357 long ul_prbs = (long)120;
1359 CellResourceReportListItem_t *listitem1 = (CellResourceReportListItem_t*)calloc(1,sizeof(CellResourceReportListItem_t));
1360 listitem1->nRCGI = *nrcgi;
1361 listitem1->dl_TotalofAvailablePRBs = &dl_prbs;
1362 listitem1->ul_TotalofAvailablePRBs = &ul_prbs;
1363 ASN_SEQUENCE_ADD(&listitem1->servedPlmnPerCellList.list, percellitem1);
1364 if (nrcgi) free(nrcgi);
1367 ODU_PF_Container_t *ducont = (ODU_PF_Container_t*)calloc(1,sizeof(ODU_PF_Container_t));
1368 ASN_STRUCT_RESET(asn_DEF_ODU_PF_Container, ducont);
1369 int ret = ASN_SEQUENCE_ADD(&ducont->cellResourceReportList.list, listitem1);
1371 PF_Container_PR pres1 = PF_Container_PR_oDU;
1373 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1374 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1375 pfcontainer->present = pres1;
1376 pfcontainer->choice.oDU = *ducont;
1377 if (ducont) free(ducont);
1379 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1380 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1381 containers_list->performanceContainer = pfcontainer;
1383 E2SM_KPM_IndicationMessage_Format1_t *format =
1384 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1385 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1387 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1389 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1391 indicationmessage->indicationMessage.present = pres;
1393 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1394 if (format) free(format);
1396 char error_buf[300] = {0, };
1399 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1400 printf("error length %d\n", errlen);
1401 printf("error buf %s\n", error_buf);
1403 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1406 uint8_t e2smbuffer[8192] = {0, };
1407 size_t e2smbuffer_size = 8192;
1409 uint8_t e2smbuffer2[8192] = {0, };
1410 size_t e2smbuffer_size2 = 8192;
1413 asn_encode_to_buffer(opt_cod,
1414 ATS_ALIGNED_BASIC_PER,
1415 &asn_DEF_E2SM_KPM_IndicationMessage,
1416 indicationmessage, e2smbuffer, e2smbuffer_size);
1418 fprintf(stderr, "er encded is %d\n", er.encoded);
1419 fprintf(stderr, "after encoding message\n");
1424 void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indicationmessage,
1425 uint8_t *gnbcuupname_buf,
1430 uint8_t *plmnid_buf) {
1432 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1435 // uint8_t *buf = (uint8_t*)"GNBCUUP5";
1436 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1437 gnbcuupname->size = 8;
1438 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1439 memcpy(gnbcuupname->buf, gnbcuupname_buf, gnbcuupname->size);
1442 //We need to convert bytes_dl into array of uint8_t
1446 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1448 if (bytes_dl <= 64) {
1451 uint8_t buffer[array_size_dl];
1452 buffer[0] = bytes_dl & 0xFF;
1453 bytesdl->buf = (uint8_t*)calloc(1,1);
1454 memcpy(bytesdl->buf,buffer,1);
1457 } else if (bytes_dl <= 16384) {
1460 uint8_t buffer[array_size_dl];
1461 buffer[0] = (bytes_dl >> 8) & 0xFF;
1462 buffer[1] = bytes_dl & 0xFF;
1463 bytesdl->buf = (uint8_t*)calloc(2,1);
1464 memcpy(bytesdl->buf,buffer,2);
1467 } else if (bytes_dl <= 4194304) {
1470 uint8_t buffer[array_size_dl];
1471 buffer[0] = (bytes_dl >> 16) & 0xFF;
1472 buffer[1] = (bytes_dl >> 8) & 0xFF;
1473 buffer[2] = bytes_dl & 0xFF;
1474 bytesdl->buf = (uint8_t*)calloc(3,1);
1475 memcpy(bytesdl->buf,buffer,3);
1478 } else if (bytes_dl <= 1073741824) {
1480 uint8_t buffer[array_size_dl];
1481 buffer[0] = (bytes_dl >> 24) & 0xFF;
1482 buffer[1] = (bytes_dl >> 16) & 0xFF;
1483 buffer[2] = (bytes_dl >> 8) & 0xFF;
1484 buffer[3] = bytes_dl & 0xFF;
1485 bytesdl->buf = (uint8_t*)calloc(4,1);
1486 memcpy(bytesdl->buf,buffer,4);
1491 //We need to convert bytes_ul into array of uint8_t
1492 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1496 if (bytes_ul <= 64) {
1499 uint8_t buffer[array_size_ul];
1500 buffer[0] = bytes_ul & 0xFF;
1501 bytesul->buf = (uint8_t*)calloc(1,1);
1502 memcpy(bytesul->buf,buffer,1);
1505 } else if (bytes_ul <= 16384) {
1508 uint8_t buffer[array_size_ul];
1509 buffer[0] = (bytes_ul >> 8) & 0xFF;
1510 buffer[1] = bytes_ul & 0xFF;
1511 bytesul->buf = (uint8_t*)calloc(2,1);
1512 memcpy(bytesul->buf,buffer,2);
1515 } else if (bytes_ul <= 4194304) {
1518 uint8_t buffer[array_size_ul];
1519 buffer[0] = (bytes_ul >> 16) & 0xFF;
1520 buffer[1] = (bytes_ul >> 8) & 0xFF;
1521 buffer[2] = bytes_ul & 0xFF;
1522 bytesul->buf = (uint8_t*)calloc(3,1);
1523 memcpy(bytesul->buf,buffer,3);
1526 } else if (bytes_ul <= 1073741824) {
1528 uint8_t buffer[array_size_ul];
1529 buffer[0] = (bytes_ul >> 24) & 0xFF;
1530 buffer[1] = (bytes_ul >> 16) & 0xFF;
1531 buffer[2] = (bytes_ul >> 8) & 0xFF;
1532 buffer[3] = bytes_ul & 0xFF;
1533 bytesul->buf = (uint8_t*)calloc(4,1);
1534 memcpy(bytesul->buf,buffer,4);
1539 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1540 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1541 fqilistitem->fiveQI = fqi;
1542 fqilistitem->pDCPBytesDL = bytesdl;
1543 fqilistitem->pDCPBytesUL = bytesul;
1546 uint8_t *buf1 = (uint8_t*)"4";
1547 uint8_t *bufz = (uint8_t*)"SD1";
1549 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1550 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1551 snssai->sST.buf = (uint8_t*)calloc(1,1);
1552 snssai->sST.size = 1;
1553 memcpy(snssai->sST.buf, sst_buf, 1);
1554 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1555 snssai->sD->buf = (uint8_t*)calloc(1,3);
1556 snssai->sD->size = 3;
1557 memcpy(snssai->sD->buf, sd_buf, 3);
1561 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1562 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1563 slicelistitem->sliceID = *snssai;
1564 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1565 if (snssai) free(snssai);
1567 asn_codec_ctx_t *opt_cod;
1570 uint8_t e2smbuffera[8192] = {0, };
1571 size_t e2smbuffer_sizea = 8192;
1575 asn_enc_rval_t era =
1576 asn_encode_to_buffer(opt_cod,
1577 ATS_ALIGNED_BASIC_PER,
1578 &asn_DEF_SliceToReportListItem,
1579 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1580 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1581 fprintf(stderr, "after encoding message\n");
1585 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1586 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1587 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1589 uint8_t *buf2 = (uint8_t*)"747";
1590 // std::string pl = "PLMNID7";
1591 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1592 // uint8_t *buf2 = &plvec[0];
1594 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1595 plmnid->buf = (uint8_t*)calloc(3,1);
1597 memcpy(plmnid->buf, plmnid_buf, plmnid->size);
1600 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1601 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1602 plmnidlist->pLMN_Identity = *plmnid;
1603 plmnidlist->cu_UP_PM_5GC = pm_format;
1604 if (plmnid) free(plmnid);
1606 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1607 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1608 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1613 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1614 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1615 listitem1->interface_type = 2;
1616 listitem1->o_CU_UP_PM_Container = *meas_cont;
1617 if (meas_cont) free(meas_cont);
1619 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1620 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1621 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1622 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1624 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1626 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1627 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1628 pfcontainer->present = pres1;
1629 pfcontainer->choice.oCU_UP = *cuupcont;
1630 if (cuupcont) free(cuupcont);
1632 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1633 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1634 containers_list->performanceContainer = pfcontainer;
1636 E2SM_KPM_IndicationMessage_Format1_t *format =
1637 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1638 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1640 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1642 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1644 indicationmessage->indicationMessage.present = pres;
1646 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1647 if (format) free(format);
1649 char error_buf[300] = {0, };
1652 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1653 printf("error length %d\n", errlen);
1654 printf("error buf %s\n", error_buf);
1656 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1659 uint8_t e2smbuffer[8192] = {0, };
1660 size_t e2smbuffer_size = 8192;
1662 uint8_t e2smbuffer2[8192] = {0, };
1663 size_t e2smbuffer_size2 = 8192;
1666 asn_encode_to_buffer(opt_cod,
1667 ATS_ALIGNED_BASIC_PER,
1668 &asn_DEF_E2SM_KPM_IndicationMessage,
1669 indicationmessage, e2smbuffer, e2smbuffer_size);
1671 fprintf(stderr, "er encded is %d\n", er.encoded);
1672 fprintf(stderr, "after encoding message\n");
1677 void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1679 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1682 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1683 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1684 gnbcuupname->size = 8;
1685 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1686 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1689 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1692 bytesdl->buf = (uint8_t*)calloc(1,1);
1693 memcpy(bytesdl->buf, buffer,1);
1696 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1699 bytesul->buf = (uint8_t*)calloc(1,1);
1700 memcpy(bytesul->buf, buffer1, 1);
1703 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1704 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1705 fqilistitem->fiveQI = 9;
1706 fqilistitem->pDCPBytesDL = bytesdl;
1707 fqilistitem->pDCPBytesUL = bytesul;
1710 uint8_t *buf1 = (uint8_t*)"4";
1711 uint8_t *bufz = (uint8_t*)"SD1";
1713 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1714 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1715 snssai->sST.buf = (uint8_t*)calloc(1,1);
1716 snssai->sST.size = 1;
1717 memcpy(snssai->sST.buf, buf1, 1);
1718 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1719 snssai->sD->buf = (uint8_t*)calloc(1,3);
1720 snssai->sD->size = 3;
1721 memcpy(snssai->sD->buf, bufz, 3);
1725 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1726 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1727 slicelistitem->sliceID = *snssai;
1728 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1729 if (snssai) free(snssai);
1731 asn_codec_ctx_t *opt_cod;
1734 uint8_t e2smbuffera[8192] = {0, };
1735 size_t e2smbuffer_sizea = 8192;
1739 asn_enc_rval_t era =
1740 asn_encode_to_buffer(opt_cod,
1741 ATS_ALIGNED_BASIC_PER,
1742 &asn_DEF_SliceToReportListItem,
1743 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1744 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1745 fprintf(stderr, "after encoding message\n");
1749 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1750 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1751 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1753 uint8_t *buf2 = (uint8_t*)"747";
1754 // std::string pl = "PLMNID7";
1755 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1756 // uint8_t *buf2 = &plvec[0];
1758 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1759 plmnid->buf = (uint8_t*)calloc(3,1);
1761 memcpy(plmnid->buf, buf2, plmnid->size);
1764 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1765 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1766 plmnidlist->pLMN_Identity = *plmnid;
1767 plmnidlist->cu_UP_PM_5GC = pm_format;
1769 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1770 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1771 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1776 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1777 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1778 listitem1->interface_type = 2;
1779 listitem1->o_CU_UP_PM_Container = *meas_cont;
1780 if (meas_cont) free(meas_cont);
1782 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1783 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1784 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1785 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1787 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1789 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1790 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1791 pfcontainer->present = pres1;
1792 pfcontainer->choice.oCU_UP = *cuupcont;
1793 if (cuupcont) free(cuupcont);
1795 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1796 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1797 containers_list->performanceContainer = pfcontainer;
1799 E2SM_KPM_IndicationMessage_Format1_t *format =
1800 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1801 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1803 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1805 E2SM_KPM_IndicationMessage__indicationMessage_PR pres = E2SM_KPM_IndicationMessage__indicationMessage_PR_indicationMessage_Format1;
1807 indicationmessage->indicationMessage.present = pres;
1809 indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format;
1810 if (format) free(format);
1812 char error_buf[300] = {0, };
1815 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1816 printf("error length %d\n", errlen);
1817 printf("error buf %s\n", error_buf);
1819 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1822 uint8_t e2smbuffer[8192] = {0, };
1823 size_t e2smbuffer_size = 8192;
1825 uint8_t e2smbuffer2[8192] = {0, };
1826 size_t e2smbuffer_size2 = 8192;
1829 asn_encode_to_buffer(opt_cod,
1830 ATS_ALIGNED_BASIC_PER,
1831 &asn_DEF_E2SM_KPM_IndicationMessage,
1832 indicationmessage, e2smbuffer, e2smbuffer_size);
1834 fprintf(stderr, "er encded is %d\n", er.encoded);
1835 fprintf(stderr, "after encoding message\n");
1840 void encode_kpm(E2SM_KPM_IndicationMessage_t* indicationmessage) {
1843 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
1844 //std::string gn = "GNBCUUP5";
1845 //std::vector<uint8_t> gnvec(gn.begin(), gn.end());
1846 //uint8_t *buf = &gnvec[0];
1847 uint8_t *buf = (uint8_t*)"GNBCUUP5";
1848 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1849 gnbcuupname->size = 8;
1850 gnbcuupname->buf = (uint8_t*)calloc(1,8);
1851 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
1854 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1857 bytesdl->buf = (uint8_t*)calloc(1,1);
1858 memcpy(bytesdl->buf, buffer,1);
1861 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
1864 bytesul->buf = (uint8_t*)calloc(1,1);
1865 memcpy(bytesul->buf, buffer1, 1);
1868 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
1869 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
1870 fqilistitem->fiveQI = 9;
1871 fqilistitem->pDCPBytesDL = bytesdl;
1872 fqilistitem->pDCPBytesUL = bytesul;
1876 // std::string sl = "SLICE4";
1877 // std::vector<uint8_t> slvec(sl.begin(), sl.end());
1878 // uint8_t *buf1 = &slvec[0];
1879 uint8_t *buf1 = (uint8_t*)"4";
1880 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1882 sst->buf = (uint8_t*)calloc(1,6);
1883 memcpy(sst->buf,buf1,sst->size);
1885 // std::string sd = "SD1";
1886 // std::vector<uint8_t> sdvec(sd.begin(), sd.end());
1887 // uint8_t *bufz = &sdvec[0];
1888 uint8_t *bufz = (uint8_t*)"SD1";
1889 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1891 sds->buf = (uint8_t*)calloc(1,3);
1892 memcpy(sds->buf, bufz, sds->size);
1895 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
1896 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
1897 snssai->sST.buf = (uint8_t*)calloc(1,1);
1898 snssai->sST.size = 1;
1899 memcpy(snssai->sST.buf, buf1, 1);
1900 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
1901 snssai->sD->buf = (uint8_t*)calloc(1,3);
1902 snssai->sD->size = 3;
1903 memcpy(snssai->sD->buf, bufz, 3);
1907 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
1908 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
1909 slicelistitem->sliceID = *snssai;
1910 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
1912 asn_codec_ctx_t *opt_cod;
1915 uint8_t e2smbuffera[8192];
1916 size_t e2smbuffer_sizea = 8192;
1920 asn_enc_rval_t era =
1921 asn_encode_to_buffer(opt_cod,
1922 ATS_ALIGNED_BASIC_PER,
1923 &asn_DEF_SliceToReportListItem,
1924 slicelistitem, e2smbuffera, e2smbuffer_sizea);
1925 fprintf(stderr, "inner er encded is %d\n", era.encoded);
1926 fprintf(stderr, "after encoding message\n");
1930 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
1931 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
1932 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
1934 uint8_t *buf2 = (uint8_t*)"747";
1935 // std::string pl = "PLMNID7";
1936 // std::vector<uint8_t> plvec(pl.begin(), pl.end());
1937 // uint8_t *buf2 = &plvec[0];
1939 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
1940 plmnid->buf = (uint8_t*)calloc(3,1);
1942 memcpy(plmnid->buf, buf2, plmnid->size);
1945 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
1946 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
1947 plmnidlist->pLMN_Identity = *plmnid;
1948 plmnidlist->cu_UP_PM_5GC = pm_format;
1950 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
1951 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
1952 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
1957 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
1958 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
1959 listitem1->interface_type = 2;
1960 listitem1->o_CU_UP_PM_Container = *meas_cont;
1962 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
1963 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
1964 cuupcont->gNB_CU_UP_Name = gnbcuupname;
1965 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
1967 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
1969 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
1970 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
1971 pfcontainer->present = pres1;
1972 pfcontainer->choice.oCU_UP = *cuupcont;
1974 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
1975 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
1976 containers_list->performanceContainer = pfcontainer;
1978 E2SM_KPM_IndicationMessage_Format1_t *format =
1979 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
1980 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
1982 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
1984 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
1986 indicationmessage->present = pres;
1988 indicationmessage->choice.indicationMessage_Format1 = *format;
1990 char *error_buf = (char*)calloc(300, sizeof(char));
1993 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
1994 printf("error length %d\n", errlen);
1995 printf("error buf %s\n", error_buf);
1997 xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
2000 uint8_t e2smbuffer[8192];
2001 size_t e2smbuffer_size = 8192;
2003 uint8_t e2smbuffer2[8192];
2004 size_t e2smbuffer_size2 = 8192;
2007 asn_encode_to_buffer(opt_cod,
2008 ATS_ALIGNED_BASIC_PER,
2009 &asn_DEF_E2SM_KPM_IndicationMessage,
2010 indicationmessage, e2smbuffer, e2smbuffer_size);
2012 fprintf(stderr, "er encded is %d\n", er.encoded);
2013 fprintf(stderr, "after encoding message\n");
2019 void encode_kpm_bak(E2SM_KPM_IndicationMessage_t* indicationmessage) {
2020 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage);
2021 std::string gn = "GNBCUUP5";
2022 std::vector<uint8_t> gnvec(gn.begin(), gn.end());
2023 uint8_t *buf = &gnvec[0];
2024 OCTET_STRING_t *gnbcuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2025 gnbcuupname->size = 8;
2026 gnbcuupname->buf = (uint8_t*)calloc(1,8);
2027 memcpy(gnbcuupname->buf, buf, gnbcuupname->size);
2030 INTEGER_t *bytesdl = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2033 bytesdl->buf = (uint8_t*)calloc(1,1);
2034 memcpy(bytesdl->buf, buffer,1);
2037 INTEGER_t *bytesul = (INTEGER_t*)calloc(1, sizeof(INTEGER_t));
2040 bytesul->buf = (uint8_t*)calloc(1,1);
2041 memcpy(bytesul->buf, buffer1, 1);
2044 FQIPERSlicesPerPlmnListItem_t *fqilistitem = (FQIPERSlicesPerPlmnListItem_t*)calloc(1, sizeof(FQIPERSlicesPerPlmnListItem_t));
2045 ASN_STRUCT_RESET(asn_DEF_FQIPERSlicesPerPlmnListItem, fqilistitem);
2046 fqilistitem->fiveQI = 9;
2047 fqilistitem->pDCPBytesDL = bytesdl;
2048 fqilistitem->pDCPBytesUL = bytesul;
2052 std::string sl = "SLICE4";
2053 std::vector<uint8_t> slvec(sl.begin(), sl.end());
2054 // uint8_t *buf1 = &slvec[0];
2055 uint8_t *buf1 = (uint8_t*)"SLICE4";
2056 OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2058 sst->buf = (uint8_t*)calloc(1,6);
2059 memcpy(sst->buf,buf1,sst->size);
2061 std::string sd = "SD1";
2062 std::vector<uint8_t> sdvec(sd.begin(), sd.end());
2063 // uint8_t *bufz = &sdvec[0];
2064 uint8_t *bufz = (uint8_t*)"SD1";
2065 OCTET_STRING_t *sds = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2067 sds->buf = (uint8_t*)calloc(1,3);
2068 memcpy(sds->buf, bufz, sds->size);
2071 SNSSAI_t *snssai = (SNSSAI_t*)calloc(1, sizeof(SNSSAI_t));
2072 ASN_STRUCT_RESET(asn_DEF_SNSSAI,snssai);
2073 snssai->sST.buf = (uint8_t*)calloc(6,1);
2074 snssai->sST.size = 6;
2075 memcpy(snssai->sST.buf, buf1, 6);
2076 snssai->sD = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t));
2077 snssai->sD->buf = (uint8_t*)calloc(1,3);
2078 snssai->sD->size = 3;
2079 memcpy(snssai->sD->buf, bufz, 3);
2083 SliceToReportListItem_t *slicelistitem = (SliceToReportListItem_t*)calloc(1,sizeof(SliceToReportListItem_t));
2084 ASN_STRUCT_RESET(asn_DEF_SliceToReportListItem, slicelistitem);
2085 slicelistitem->sliceID = *snssai;
2086 int ret = ASN_SEQUENCE_ADD(&slicelistitem->fQIPERSlicesPerPlmnList.list, fqilistitem);
2088 uint8_t e2smbuffera[8192];
2089 size_t e2smbuffer_sizea = 8192;
2092 asn_encode_to_buffer(nullptr,
2093 ATS_ALIGNED_BASIC_PER,
2094 &asn_DEF_SliceToReportListItem,
2095 slicelistitem, e2smbuffera, e2smbuffer_sizea);
2096 fprintf(stderr, "inner er encded is %d\n", era.encoded);
2097 fprintf(stderr, "after encoding message\n");
2099 FGC_CUUP_PM_Format_t *pm_format = (FGC_CUUP_PM_Format_t*)calloc(1,sizeof(FGC_CUUP_PM_Format_t));
2100 ASN_STRUCT_RESET(asn_DEF_FGC_CUUP_PM_Format, pm_format);
2101 ret = ASN_SEQUENCE_ADD(&pm_format->sliceToReportList.list, slicelistitem);
2103 std::string pl = "PLMNID7";
2104 std::vector<uint8_t> plvec(pl.begin(), pl.end());
2105 uint8_t *buf2 = &plvec[0];
2107 OCTET_STRING_t *plmnid = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
2108 plmnid->buf = (uint8_t*)calloc(1,7);
2110 memcpy(plmnid->buf, buf2, plmnid->size);
2113 PlmnID_List_t *plmnidlist = (PlmnID_List_t*)calloc(1,sizeof(PlmnID_List_t));
2114 ASN_STRUCT_RESET(asn_DEF_PlmnID_List, plmnidlist);
2115 plmnidlist->pLMN_Identity = *plmnid;
2116 plmnidlist->cu_UP_PM_5GC = pm_format;
2118 CUUPMeasurement_Container_t *meas_cont = (CUUPMeasurement_Container_t*)calloc(1, sizeof(CUUPMeasurement_Container_t));
2119 ASN_STRUCT_RESET(asn_DEF_CUUPMeasurement_Container, meas_cont);
2120 ret = ASN_SEQUENCE_ADD(&meas_cont->plmnList.list, plmnidlist);
2125 PF_ContainerListItem_t *listitem1 = (PF_ContainerListItem_t*)calloc(1, sizeof(PF_ContainerListItem_t));
2126 ASN_STRUCT_RESET(asn_DEF_PF_ContainerListItem, listitem1);
2127 listitem1->interface_type = 2;
2128 listitem1->o_CU_UP_PM_Container = *meas_cont;
2130 OCUUP_PF_Container_t *cuupcont = (OCUUP_PF_Container_t*)calloc(1,sizeof(OCUUP_PF_Container_t));
2131 ASN_STRUCT_RESET(asn_DEF_OCUUP_PF_Container, cuupcont);
2132 cuupcont->gNB_CU_UP_Name = gnbcuupname;
2133 ret = ASN_SEQUENCE_ADD(&cuupcont->pf_ContainerList.list, listitem1);
2135 PF_Container_PR pres1 = PF_Container_PR_oCU_UP;
2137 PF_Container_t *pfcontainer = (PF_Container_t*)calloc(1, sizeof(PF_Container_t));
2138 ASN_STRUCT_RESET(asn_DEF_PF_Container, pfcontainer);
2139 pfcontainer->present = pres1;
2140 pfcontainer->choice.oCU_UP = *cuupcont;
2142 PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t));
2143 ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list);
2144 containers_list->performanceContainer = pfcontainer;
2146 E2SM_KPM_IndicationMessage_Format1_t *format =
2147 (E2SM_KPM_IndicationMessage_Format1_t*)calloc(1, sizeof(E2SM_KPM_IndicationMessage_Format1_t));
2148 ASN_STRUCT_RESET(asn_DEF_E2SM_KPM_IndicationMessage_Format1, format);
2150 ret = ASN_SEQUENCE_ADD(&format->pm_Containers.list, containers_list);
2152 E2SM_KPM_IndicationMessage_PR pres = E2SM_KPM_IndicationMessage_PR_indicationMessage_Format1;
2154 indicationmessage->present = pres;
2156 indicationmessage->choice.indicationMessage_Format1 = *format;
2158 char *error_buf = (char*)calloc(300, sizeof(char));
2161 asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);
2162 printf("error length %d\n", errlen);
2163 printf("error buf %s\n", error_buf);
2166 uint8_t e2smbuffer[8192];
2167 size_t e2smbuffer_size = 8192;
2169 uint8_t e2smbuffer2[8192];
2170 size_t e2smbuffer_size2 = 8192;
2173 asn_encode_to_buffer(nullptr,
2174 ATS_ALIGNED_BASIC_PER,
2175 &asn_DEF_E2SM_KPM_IndicationMessage,
2176 indicationmessage, e2smbuffer, e2smbuffer_size);
2178 fprintf(stderr, "er encded is %d\n", er.encoded);
2179 fprintf(stderr, "after encoding message\n");