4 ssize_t e2sm_encode_ric_event_trigger_definition(void *buffer, size_t buf_size, size_t event_trigger_count, long *RT_periods) {
5 E2SM_KPM_EventTriggerDefinition_t *eventTriggerDef = (E2SM_KPM_EventTriggerDefinition_t *)calloc(1, sizeof(E2SM_KPM_EventTriggerDefinition_t));
7 fprintf(stderr, "alloc EventTriggerDefinition failed\n");
11 E2SM_KPM_EventTriggerDefinition_Format1_t *innerDef = (E2SM_KPM_EventTriggerDefinition_Format1_t *)calloc(1, sizeof(E2SM_KPM_EventTriggerDefinition_Format1_t));
13 fprintf(stderr, "alloc EventTriggerDefinition Format1 failed\n");
14 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_EventTriggerDefinition, eventTriggerDef);
18 eventTriggerDef->present = E2SM_KPM_EventTriggerDefinition_PR_eventDefinition_Format1;
19 eventTriggerDef->choice.eventDefinition_Format1 = innerDef;
21 struct E2SM_KPM_EventTriggerDefinition_Format1__policyTest_List *policyTestList = (struct E2SM_KPM_EventTriggerDefinition_Format1__policyTest_List *)calloc(1, sizeof(struct E2SM_KPM_EventTriggerDefinition_Format1__policyTest_List));
22 innerDef->policyTest_List = policyTestList;
25 while(index < event_trigger_count) {
26 Trigger_ConditionIE_Item_t *triggerCondition = (Trigger_ConditionIE_Item_t *)calloc(1, sizeof(Trigger_ConditionIE_Item_t));
27 assert(triggerCondition != 0);
28 triggerCondition->report_Period_IE = RT_periods[index];
30 ASN_SEQUENCE_ADD(&policyTestList->list, triggerCondition);
34 asn_enc_rval_t encode_result;
35 encode_result = aper_encode_to_buffer(&asn_DEF_E2SM_KPM_EventTriggerDefinition, NULL, eventTriggerDef, buffer, buf_size);
36 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_EventTriggerDefinition, eventTriggerDef);
37 if(encode_result.encoded == -1) {
38 fprintf(stderr, "Cannot encode %s: %s\n", encode_result.failed_type->name, strerror(errno));
41 return encode_result.encoded;
45 ssize_t e2sm_encode_ric_action_definition(void *buffer, size_t buf_size, long ric_style_type) {
46 E2SM_KPM_ActionDefinition_t *actionDef = (E2SM_KPM_ActionDefinition_t *)calloc(1, sizeof(E2SM_KPM_ActionDefinition_t));
48 fprintf(stderr, "alloc RIC ActionDefinition failed\n");
52 actionDef->ric_Style_Type = ric_style_type;
54 asn_enc_rval_t encode_result;
55 encode_result = aper_encode_to_buffer(&asn_DEF_E2SM_KPM_ActionDefinition, NULL, actionDef, buffer, buf_size);
56 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_ActionDefinition, actionDef);
57 if(encode_result.encoded == -1) {
58 fprintf(stderr, "Cannot encode %s: %s\n", encode_result.failed_type->name, strerror(errno));
61 return encode_result.encoded;
65 E2SM_KPM_IndicationHeader_t* e2sm_decode_ric_indication_header(void *buffer, size_t buf_size) {
66 asn_dec_rval_t decode_result;
67 E2SM_KPM_IndicationHeader_t *indHdr = 0;
68 decode_result = aper_decode_complete(NULL, &asn_DEF_E2SM_KPM_IndicationHeader, (void **)&indHdr, buffer, buf_size);
69 if(decode_result.code == RC_OK) {
73 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationHeader, indHdr);
78 void e2sm_free_ric_indication_header(E2SM_KPM_IndicationHeader_t* indHdr) {
79 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationHeader, indHdr);
82 E2SM_KPM_IndicationMessage_t* e2sm_decode_ric_indication_message(void *buffer, size_t buf_size) {
83 asn_dec_rval_t decode_result;
84 E2SM_KPM_IndicationMessage_t *indMsg = 0;
85 decode_result = aper_decode_complete(NULL, &asn_DEF_E2SM_KPM_IndicationMessage, (void **)&indMsg, buffer, buf_size);
86 if(decode_result.code == RC_OK) {
90 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationMessage, indMsg);
95 void e2sm_free_ric_indication_message(E2SM_KPM_IndicationMessage_t* indMsg) {
96 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationMessage, indMsg);