Commit 5f29a4e5 authored by Javier Morgade's avatar Javier Morgade

Code cleanup

	-Removing unused files

	ACKNOWLEDGEMENT:
 	1. This commit was developed at Vicomtech (https://www.vicomtech.org) under UE project CDN-X-ALL: "CDN edge-cloud computing for efficient cache and reliable streaming aCROSS Aggregated unicast-multicast LinkS"
 	2. Project funded by Fed4FIRE+ OC5 (https://www.fed4fire.eu)
Signed-off-by: default avatarJavier Morgade <javier.morgade@ieee.org>
parent cad6e8a2
......@@ -568,19 +568,6 @@ int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*uint32_t assoc_i
ASN_SET_ADD(&ie->value.choice.MBSFN_Area_Configuration_List,m2ap_mbsfn_area_configuration_list);
//-------------
// ASN_SEQUENCE_ADD(&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item_ie);
//-------------
//-------------
// ASN_SEQUENCE_ADD(&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item_ie+1);
//-------------
/* xer_fprint(stdout,&asn_DEF_M2AP_MBSFN_Area_Configuration_Item,mbsfn_area_configuration_item_ie);
xer_fprint(stdout,&asn_DEF_M2AP_MBSFN_Area_Configuration_Item,mbsfn_area_configuration_item_ie_1);
......@@ -593,324 +580,15 @@ ASN_SET_ADD(&ie->value.choice.MBSFN_Area_Configuration_List,m2ap_mbsfn_area_conf
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
// LOG_D(M2AP,"%p\n",&pdu);
// LOG_D(M2AP,"%p\n",out);
// LOG_D(M2AP,"%p\n",ie);
// LOG_D(M2AP,"%p\n",mbsfn_area_configuration_item_ie);
// LOG_D(M2AP,"%p\n",&mbsfn_area_configuration_item_ie->value.choice);
// {
// /* PMCH_Configuration_List */
//
// M2AP_PMCH_Configuration_ItemIEs_t * pmch_configuration_item_ies;
// pmch_configuration_item_ies = (M2AP_PMCH_Configuration_ItemIEs_t*)calloc(1,sizeof(M2AP_PMCH_Configuration_ItemIEs_t));
// {
// pmch_configuration_item_ies->id = M2AP_ProtocolIE_ID_id_PMCH_Configuration_Item;
// pmch_configuration_item_ies->criticality = M2AP_Criticality_reject;
// pmch_configuration_item_ies->value.present = M2AP_PMCH_Configuration_ItemIEs__value_PR_PMCH_Configuration_Item;
// M2AP_PMCH_Configuration_Item_t * pmch_configuration_item;
// pmch_configuration_item = &pmch_configuration_item_ies->value.choice.PMCH_Configuration_Item;
// {
// //pmch_configuration_item->allocatedSubframesEnd;
// pmch_configuration_item->pmch_Configuration.dataMCS=13;
// //pmch_configuration_item->mchSchedulingPeriod;
// MBMSsessionListPerPMCH_Item__Member *member;
// member = (MBMSsessionListPerPMCH_Item__Member*)calloc(1,sizeof(MBMSsessionListPerPMCH_Item__Member));
// LOG_D(M2AP,"%p,%p,%p\n",pmch_configuration_item,&pmch_configuration_item->mbms_Session_List.list,member);
// ASN_SEQUENCE_ADD(&pmch_configuration_item->mbms_Session_List.list,member);
// }
// ////
// // //ASN_SEQUENCE_ADD(mbsfn_area_configuration_item_ie,pmch_configuration_item_ies);
//
// }
//
// M2AP_PMCH_Configuration_List_t * pmch_list = &mbsfn_area_configuration_item_ie->value.choice.PMCH_Configuration_List;
//
// ASN_SEQUENCE_ADD(&pmch_list->list,pmch_configuration_item_ies);
// LOG_D(M2AP,"%p,%p\n",&mbsfn_area_configuration_item_ie->value.choice.PMCH_Configuration_List.list,pmch_configuration_item_ies);
// //ASN_SEQUENCE_ADD(&mbsfn_area_configuration_item_ie->value.choice.PMCH_Configuration_List.list,pmch_configuration_item_ies);
// //ASN_SET_ADD(&mbsfn_area_configuration_item_ie->value.choice.PMCH_Configuration_List.list,pmch_configuration_item_ies);
// //ASN_SEQUENCE_ADD(mbsfn_area_configuration_item_ie,pmch_configuration_item_ies);
// /* MBSFN_Subframe_ConfigurationList */
// M2AP_MBSFN_Subframe_ConfigurationItem_t * mbsfn_subframe_configurationitem;
// mbsfn_subframe_configurationitem =(M2AP_MBSFN_Subframe_ConfigurationItem_t*)calloc(1,sizeof(M2AP_MBSFN_Subframe_ConfigurationItem_t));
// {
// mbsfn_subframe_configurationitem->id = M2AP_ProtocolIE_ID_id_MBSFN_Subframe_Configuration_Item;
// mbsfn_subframe_configurationitem->criticality = M2AP_Criticality_reject;
// mbsfn_subframe_configurationitem->value.present=M2AP_MBSFN_Subframe_ConfigurationItem__value_PR_MBSFN_Subframe_Configuration;
// }
//
// //ASN_SEQUENCE_ADD(&mbsfn_area_configuration_item_ie->value.choice.MBSFN_Subframe_ConfigurationList.list,mbsfn_subframe_configurationitem);
// LOG_D(M2AP,"%p,%p\n",&mbsfn_area_configuration_item_ie->value.choice.PMCH_Configuration_List.list,mbsfn_subframe_configurationitem);
// //ASN_SEQUENCE_ADD(&mbsfn_area_configuration_item_ie->value.choice.MBSFN_Subframe_ConfigurationList.list,mbsfn_subframe_configurationitem);
////
//// M2AP_Common_Subframe_Allocation_Period_t * common_subframe_allocation_period;
//// M2AP_MBSFN_Area_ID_t * mbsfn_area_id;
// }
// LOG_D(M2AP,"%p,%p\n",&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item_ie);
// //ASN_SET_ADD(&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item_ie);
// ASN_SET_ADD(&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item_ie);
// M2AP_MBSFN_Area_Configuration_Item_t *mbsfn_area_configuration_item_ie_2;
// mbsfn_area_configuration_item_ie_2 =(M2AP_MBSFN_Area_Configuration_Item_t*)calloc(1,sizeof(M2AP_MBSFN_Area_Configuration_Item_t));
// {
// // mbsfn_area_configuration_item_ie->value.present = M2AP_MBSFN_Area_Configuration_Item__value_PR_PMCH_Configuration_List;
// /* PMCH_Configuration_List */
// // M2AP_PMCH_Configuration_ItemIEs_t * pmch_configuration_item_ies;
// // pmch_configuration_item_ies = (M2AP_PMCH_Configuration_ItemIEs_t*)calloc(1,sizeof(M2AP_PMCH_Configuration_ItemIEs_t));
// // pmch_configuration_item_ies->id = M2AP_ProtocolIE_ID_id_PMCH_Configuration_Item;
// // pmch_configuration_item_ies->criticality = M2AP_Criticality_reject;
// // pmch_configuration_item_ies->value.present = M2AP_PMCH_Configuration_ItemIEs__value_PR_PMCH_Configuration_Item;
// // M2AP_PMCH_Configuration_Item_t * pmch_configuration_item;
// // pmch_configuration_item = &pmch_configuration_item_ies->value.choice.PMCH_Configuration_Item;
// ////
// // ASN_SEQUENCE_ADD(mbsfn_area_configuration_item_ie,pmch_configuration_item_ies);
// /* MBSFN_Subframe_ConfigurationList */
// M2AP_MBSFN_Subframe_ConfigurationItem_t * mbsfn_subframe_configurationitem;
// mbsfn_subframe_configurationitem =(M2AP_MBSFN_Subframe_ConfigurationItem_t*)calloc(1,sizeof(M2AP_MBSFN_Subframe_ConfigurationItem_t));
// {
// mbsfn_subframe_configurationitem->id = M2AP_ProtocolIE_ID_id_MBSFN_Subframe_Configuration_Item;
// mbsfn_subframe_configurationitem->criticality = M2AP_Criticality_reject;
// mbsfn_subframe_configurationitem->value.present=M2AP_MBSFN_Subframe_ConfigurationItem__value_PR_MBSFN_Subframe_Configuration;
// //M2AP_MBSFN_Subframe_Configuration_t * mbsfn_subframe_configuration;
// //mbsfn_subframe_configuration = (M2AP_MBSFN_Subframe_Configuration_t*)calloc(1,sizeof(M2AP_MBSFN_Subframe_Configuration_t));
// //ASN_SEQUENCE_ADD(mbsfn_subframe_configurationitem,mbsfn_subframe_configuration);
// M2AP_MBSFN_Subframe_Configuration_t * mbsfn_subframe_configuration;
// mbsfn_subframe_configuration = &mbsfn_subframe_configurationitem->value.choice.MBSFN_Subframe_Configuration;
// }
//
// ASN_SEQUENCE_ADD(mbsfn_area_configuration_item_ie_2,mbsfn_subframe_configurationitem);
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item_ie_2);
// M2AP_MBSFN_Area_Configuration_List_t * m2ap_mbsfn_area_configuration_list;
// m2ap_mbsfn_area_configuration_list = &ie->value.choice.MBSFN_Area_Configuration_List;
// {
// M2AP_PMCH_Configuration_ItemIEs_t * pmch_configuration_item_ies;
// pmch_configuration_item_ies = (M2AP_PMCH_Configuration_ItemIEs_t*)calloc(1,sizeof(M2AP_PMCH_Configuration_ItemIEs_t));
// pmch_configuration_item_ies->id = M2AP_ProtocolIE_ID_id_PMCH_Configuration_Item;
// pmch_configuration_item_ies->criticality = M2AP_Criticality_reject;
// pmch_configuration_item_ies->value.present = M2AP_PMCH_Configuration_ItemIEs__value_PR_PMCH_Configuration_Item;
// M2AP_PMCH_Configuration_Item_t * pmch_configuration_item;
// pmch_configuration_item = &pmch_configuration_item_ies->value.choice.PMCH_Configuration_Item;
//
// ASN_SEQUENCE_ADD(&m2ap_mbsfn_area_configuration_list->PMCH_Configuration_List.list,pmch_configuration_item_ies);
// }
//
// int num_mbsfn_available =0; // ?
// LOG_I(M2AP, "num_mbsfn_available = %d \n", num_mbsfn_available);
// for (i=0;
// i<num_mbsfn_available;
// i++) {
//
// //M2AP_MBSFN_Area_Configuration_Item_t *mbms_mbsfn_area_configuration_item_ies;
// //mbms_mbsfn_area_configuration_item_ies = ( M2AP_MBSFN_Area_Configuration_Item_t *)calloc(1, sizeof(M2AP_MBSFN_Area_Configuration_Item_t ));
// //mbms_configuration_data_item_ies->id = M2AP_ProtocolIE_ID_id_MBSFN_Area_Configuration_Item;
// //mbms_configuration_data_item_ies>criticality = M2AP_Criticality_reject;
// //mbms_mbsfn_area_configuration_item_ies->value.present = M2AP_MBSFN_Area_Configuration_Item__value_PR_M2AP_MBSFN_Area_Configuration_Item;
//
// M2AP_MBSFN_Area_Configuration_Item_t * mbsfn_area_configuration_item;
// mbsfn_area_configuration_item = (M2AP_MBSFN_Area_Configuration_Item_t*)calloc(1,sizeof(M2AP_MBSFN_Area_Configuration_Item_t));
// //mbsfn_area_configuration_item = &mbms_mbsfn_area_configuration_item_ies->value.choice.M2AP_MBSFN_Area_Configuration_Item;
// mbsfn_area_configuration_item->value.present = M2AP_MBSFN_Area_Configuration_Item__value_PR_PMCH_Configuration_List;
//
// M2AP_PMCH_Configuration_ItemIEs_t * pmch_configuration_item_ies;
// pmch_configuration_item_ies = (M2AP_PMCH_Configuration_ItemIEs_t*)calloc(1,sizeof(M2AP_PMCH_Configuration_ItemIEs_t));
// pmch_configuration_item_ies->id = M2AP_ProtocolIE_ID_id_PMCH_Configuration_Item;
// pmch_configuration_item_ies->criticality = M2AP_Criticality_reject;
// pmch_configuration_item_ies->value.present = M2AP_PMCH_Configuration_ItemIEs__value_PR_PMCH_Configuration_Item;
// M2AP_PMCH_Configuration_Item_t * pmch_configuration_item;
// pmch_configuration_item = &pmch_configuration_item_ies->value.choice.PMCH_Configuration_Item;
// //memset((void*)&pmch_configuration_item,0,sizeof(M2AP_PMCH_Configuration_Item_t));
//
// ASN_SEQUENCE_ADD(&mbsfn_area_configuration_item->value.choice.PMCH_Configuration_List.list,pmch_configuration_item_ies);
//// if(0)
//// {
//// /* PMCH_Configuration_List */
//// LOG_I(M2AP, "num_pmch_available = %d \n", num_mbsfn_available);
//// int num_pmch_available =0; // ?
//// for (j=0;
//// j<num_pmch_available;
//// j++) {
//// M2AP_PMCH_Configuration_ItemIEs_t * pmch_configuration_item_ies;
//// pmch_configuration_item_ies->id = (M2AP_PMCH_Configuration_ItemIEs_t*)calloc(1,sizeof(M2AP_PMCH_Configuration_ItemIEs_t));
//// pmch_configuration_item_ies->criticality = M2AP_Criticality_reject;
//// pmch_configuration_item_ies->value.present = M2AP_PMCH_Configuration_ItemIEs__value_PR_PMCH_Configuration_Item;
////
//// M2AP_PMCH_Configuration_Item_t * pmch_configuration_item;
//// //pmch_configuration_item = (M2AP_PMCH_Configuration_Item_t*)calloc(1,sizeof(M2AP_PMCH_Configuration_Item_t));
//// pmch_configuration_item = &pmch_configuration_item_ies->value.choice.PMCH_Configuration_Item;
//// {
//// /* PMCH_Configuration */
//// /* allocateSubframesEnd */
//// //pmch_configuration_item.pmch_Configuration.allocatedSubframesEnd=;
//// /* dataMCS */
//// //pmch_configuration_item.pmch_Configuration.dataMCS=;
//// /* MCH_Scheduling_Period*/
//// //pmch_configuration_item.pmch_Configuration.mchSchedulingPeriod=;
////
//// /* MBMSsessionListPerPMCH */
//// LOG_I(M2AP, "num_mbms_session_available = %d \n", num_mbsfn_available);
//// int num_mbms_session_available =1; // ?
//// for(k=0;
//// k<num_mbms_session_available;
//// k++){
//// M2AP_MBMSsessionListPerPMCH_Item_t * session_list_per_pmch_item;
//// session_list_per_pmch_item=(M2AP_MBMSsessionListPerPMCH_Item_t*)calloc(1,sizeof(M2AP_MBMSsessionListPerPMCH_Item_t));
////
//// //session_list_per_pmch_item->tmgi=;
//// //session_list_per_pmch_item->lcid=;
//// //ASN_SEQUENCE_ADD(&pmch_configuration_item->mbms_Session_List.list,mbsfn_area_configuration_item);
//// }
////
//// }
//// ASN_SEQUENCE_ADD(&mbsfn_area_configuration_item->value.choice.PMCH_Configuration_List.list,pmch_configuration_item_ies);
//// }
////
//// /* MBSFN_Subframe_ConfigurationList */
//// int num_mbsfn_subframe_available=0;
//// for(j=0;
//// j<num_mbsfn_subframe_available;
//// j++){
//// M2AP_MBSFN_Subframe_ConfigurationItem_t * mbsfn_subframe_configuration_item;
//// mbsfn_subframe_configuration_item = (M2AP_MBSFN_Subframe_ConfigurationItem_t*)calloc(1,sizeof(M2AP_MBSFN_Subframe_ConfigurationItem_t));
//// //mbsfn_subframe_configuration_item->MBSFN_Subframe_Configuration.radioframeAllocationPeriod=;
//// //mbsfn_subframe_configuration_item->MBSFN_Subframe_Configuration.radioframeAllocationOffset=;
//// //mbsfn_subframe_configuration_item->MBSFN_Subframe_Configuration.subframeAllocation.oneFrame=;
//// //mbsfn_subframe_configuration_item->MBSFN_Subframe_Configuration.subframeAllocation.fourFrames=;
////
//// ASN_SEQUENCE_ADD(&mbsfn_area_configuration_item->value.choice.MBSFN_Subframe_ConfigurationList.list,mbsfn_subframe_configuration_item);
////
//// }
//// /* Common_subframe_Allocation_Period */
//// mbsfn_area_configuration_item->value.choice.Common_Subframe_Allocation_Period=0;
//// /* MBSFN_Area_ID */
//// mbsfn_area_configuration_item->value.choice.MBSFN_Area_ID=0;
//// /*MBMS_Suspension_Notification_List*/
//// //TODO
//// }
// //ASN_SEQUENCE_ADD(&ie->value.choice.MBSFN_Area_Configuration_List.list,mbsfn_area_configuration_item);
// ASN_SEQUENCE_ADD(&m2ap_mbsfn_area_configuration_list->list,mbsfn_area_configuration_item);
//
// }
/* encode */
if (m2ap_encode_pdu(&pdu,&buffer,&len) < 0){
return -1;
}
/*if (m2ap_encode_pdu(&pdu,&buffer,&len) < 0){
return -1;
}*/
/*buffer = &m2ap_message[0];
len = 62;
for(int i=0; i < len; i++ )
printf("%02X",buffer[i]);
printf("\n");*/
//printf("m2ap_mce_data_from_enb %p %p %d\n",m2ap_mce_data_from_enb, buffer, len);
m2ap_MCE_itti_send_sctp_data_req(instance,m2ap_mce_data_from_enb->assoc_id,buffer,len,0);
return 0;
// buffer2 = &m2ap_message[0];
// len2 = 62;
// for(int i=0; i < len2; i++ )
// printf("%02X",buffer2[i]);
// printf("\n");
//
// M2AP_M2AP_PDU_t pdu2;
// memset(&pdu2, 0, sizeof(pdu2));
// if (m2ap_decode_pdu(&pdu2, buffer2, len2) < 0) {
// LOG_E(M2AP, "SCHEDULING Failed to decode PDU\n");
// //return -1;
// }else{
// LOG_D(M2AP, "SCHEDULING OK to decode PDU\n");
// }
//
//
// M2AP_MbmsSchedulingInformation_t *container2;
// M2AP_MbmsSchedulingInformation_Ies_t *ie2;
// int i2 = 0;
// container2 = &pdu2.choice.initiatingMessage.value.choice.MbmsSchedulingInformation;
// M2AP_FIND_PROTOCOLIE_BY_ID(M2AP_MbmsSchedulingInformation_Ies_t, ie2, container2,M2AP_ProtocolIE_ID_id_MCCH_Update_Time ,true);
// LOG_D(M2AP, "SCHEDULING id %d\n",ie2->id);
// M2AP_FIND_PROTOCOLIE_BY_ID(M2AP_MbmsSchedulingInformation_Ies_t, ie2, container2,M2AP_ProtocolIE_ID_id_MBSFN_Area_Configuration_List ,true);
// LOG_D(M2AP, "SCHEDULING id %d\n",ie2->id);
//
//
//
// //M2AP_MBSFN_Area_Configuration_Item_t * kk = &ie->value.choice.MBSFN_Area_Configuration_List.list.array[0];
// //printf("M2AP_MBSFN_Area_Configuration_Item %d\n",kk->id);
//
// const asn_anonymous_sequence_ *list = _A_CSEQUENCE_FROM_VOID((void*)&ie2->value.choice.MBSFN_Area_Configuration_List);
// void * memb_ptr = list->array[0];
// const asn_anonymous_sequence_ *list2 = _A_CSEQUENCE_FROM_VOID((void*)memb_ptr);
//
//
// void * memb_ptr1 = list2->array[0];
// M2AP_MBSFN_Area_Configuration_Item_t * m2ap_mbsfn_area_configuration_item1 = (M2AP_MBSFN_Area_Configuration_Item_t*)memb_ptr1;
// M2AP_PMCH_Configuration_Item_t * m2ap_pmchconfiguration_item =&(((M2AP_PMCH_Configuration_ItemIEs_t*)m2ap_mbsfn_area_configuration_item1->value.choice.PMCH_Configuration_List.list.array[0])->value.choice.PMCH_Configuration_Item);
// printf("dataMCS %d\n",m2ap_pmchconfiguration_item->pmch_Configuration.dataMCS);
// m2ap_pmchconfiguration_item->pmch_Configuration.dataMCS=4;
// printf("allocatedSubframesEnd %d\n",m2ap_pmchconfiguration_item->pmch_Configuration.allocatedSubframesEnd);
// M2AP_PMCH_Configuration_t * m2ap_pmchconfiguration = &m2ap_pmchconfiguration_item->pmch_Configuration;
// printf("M2AP_PMCH_Configuration_t dataMCS %d\n",m2ap_pmchconfiguration->dataMCS);
// printf("M2AP_PMCH_Configuration_t allocatedSubframesEnd %d\n",m2ap_pmchconfiguration->allocatedSubframesEnd);
// M2AP_MBMSsessionListPerPMCH_Item_t * m2ap_mbsfnsessionlistperPMCH = &m2ap_pmchconfiguration_item->mbms_Session_List;
// M2AP_TMGI_t * tmgi = &m2ap_mbsfnsessionlistperPMCH->list.array[0]->tmgi;
// M2AP_PLMN_Identity_t * pLMNidentity = &tmgi->pLMNidentity;
// MCC_MNC_TO_PLMNID(0,1,3/*instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,*/
// ,pLMNidentity);
//
//
// OCTET_STRING_t * serviceID = &tmgi->serviceID;
// M2AP_LCID_t * lcid = &m2ap_mbsfnsessionlistperPMCH->list.array[0]->lcid; //long
//
//
// void * memb_ptr2 = list2->array[1];
// M2AP_MBSFN_Area_Configuration_Item_t * m2ap_mbsfn_area_configuration_item2 = (M2AP_MBSFN_Area_Configuration_Item_t*)memb_ptr2;
// M2AP_MBSFN_Subframe_Configuration_t * m2ap_mbsfn_subframe_configuration_item =&(((M2AP_MBSFN_Subframe_ConfigurationItem_t*)m2ap_mbsfn_area_configuration_item2->value.choice.MBSFN_Subframe_ConfigurationList.list.array[0])->value.choice.MBSFN_Subframe_Configuration);
// //M2AP_MBSFN_Subframe_Configuration_t * m2ap_mbsfn_subframe_configuration = &m2ap_mbsfn_subframe_configuration_item->value.choice.MBSFN_Subframe_Configuration;
// printf("oneframe ? %d\n",(m2ap_mbsfn_subframe_configuration_item->subframeAllocation.present == M2AP_MBSFN_Subframe_Configuration__subframeAllocation_PR_oneFrame));
//
//
// void * memb_ptr3 = list2->array[2];
// M2AP_MBSFN_Area_Configuration_Item_t * m2ap_mbsfn_area_configuration_item3 = (M2AP_MBSFN_Area_Configuration_Item_t*)memb_ptr3;
// M2AP_Common_Subframe_Allocation_Period_t * m2ap_mbsfn_common_subframe_allocation_period = (M2AP_Common_Subframe_Allocation_Period_t*)m2ap_mbsfn_area_configuration_item3->value.choice.Common_Subframe_Allocation_Period;
//
// void * memb_ptr4 = list2->array[3];
// M2AP_MBSFN_Area_Configuration_Item_t * m2ap_mbsfn_area_configuration_item4 = (M2AP_MBSFN_Area_Configuration_Item_t*)memb_ptr4;
// M2AP_MBSFN_Area_ID_t * m2ap_mbsfn_area_id = (M2AP_MBSFN_Area_ID_t*)m2ap_mbsfn_area_configuration_item4->value.choice.MBSFN_Area_ID;
//
//
//
// //ASN_SEQUENCE_ADD(&ie->value.choice.MBSFN_Area_Configuration_List,list);
// ASN_SEQUENCE_ADD(&ie->value.choice.MBSFN_Area_Configuration_List,m2ap_mbsfn_area_configuration_list);
//
// LOG_D(M2AP,"Morgade\n");
// xer_fprint(stdout,&asn_DEF_M2AP_MBSFN_Area_Configuration_List, &ie->value.choice.MBSFN_Area_Configuration_List);
//
// /* encode */
// if (m2ap_encode_pdu(&pdu2,&buffer,&len) < 0){
// return -1;
// }
//
// //MCE_m2ap_itti_send_sctp_data_req(instance, m2ap_mce_data_from_mce->assoid,buffer,len,0);
// m2ap_MCE_itti_send_sctp_data_req(instance,assoc_id,buffer,len,0);
// return 0;
//
//
}
int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance,
......@@ -1291,88 +969,8 @@ int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*uint32_t assoc_id,*/
}
//config_per_mbsfn_area_item->cellInformationList = ;//(M2AP_Cell_Information_List*)calloc(1,sizeof(M2AP_Cell_Information_List));
//config_per_mbsfn_area_item->subframeAllocationInfo.bits_unused = 4;
//ASN_SEQUENCE_ADD(&ie->value.choice.MCCHrelatedBCCH_ConfigPerMBSFNArea.list,config_per_mbsfn_area_item);
//config_per_mbsfn_area_item = &ie->value.choice.MCCHrelatedBCCH_ConfigPerMBSFNArea;
//{
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* M2AP_MCCHrelatedBCCH_ConfigPerMBSFNArea_t */
//...
// int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate;
// LOG_D(M2AP, "num_cells_to_activate = %d \n", num_cells_to_activate);
// for (i=0;
// i<num_cells_to_activate;
// i++) {
//
// M2AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
// cells_to_be_activated_list_item_ies = (M2AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(M2AP_Cells_to_be_Activated_List_ItemIEs_t));
// cells_to_be_activated_list_item_ies->id = M2AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
// cells_to_be_activated_list_item_ies->criticality = M2AP_Criticality_reject;
// cells_to_be_activated_list_item_ies->value.present = M2AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
//
// /* 3.1 cells to be Activated list item */
// M2AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
// memset((void *)&cells_to_be_activated_list_item, 0, sizeof(M2AP_Cells_to_be_Activated_List_Item_t));
//
// /* - nRCGI */
// M2AP_NRCGI_t nRCGI;
// MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i],
// &nRCGI.pLMN_Identity);
// NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->nr_cellid[i], &nRCGI.nRCellIdentity);
// cells_to_be_activated_list_item.nRCGI = nRCGI;
//
// /* optional */
// /* - nRPCI */
// if (1) {
// cells_to_be_activated_list_item.nRPCI = (M2AP_NRPCI_t *)calloc(1, sizeof(M2AP_NRPCI_t));
// *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->nrpci[i]; // int 0..1007
// }
//
// /* optional */
// /* - gNB-MCE System Information */
// if (1) {
// /* 3.1.2 gNB-MCESystem Information */
// M2AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs;
// cells_to_be_activated_list_itemExtIEs = (M2AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(M2AP_Cells_to_be_Activated_List_ItemExtIEs_t));
// cells_to_be_activated_list_itemExtIEs->id = M2AP_ProtocolIE_ID_id_gNB_MCESystemInformation;
// cells_to_be_activated_list_itemExtIEs->criticality = M2AP_Criticality_reject;
// cells_to_be_activated_list_itemExtIEs->extensionValue.present = M2AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_MCESystemInformation;
//
// M2AP_GNB_MCESystemInformation_t *gNB_MCESystemInformation = (M2AP_GNB_MCESystemInformation_t *)calloc(1, sizeof(M2AP_GNB_MCESystemInformation_t));
// //LOG_I(M2AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]);
// //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++)
// // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]);
// //printf("\n");
// OCTET_STRING_fromBuf(&gNB_MCESystemInformation->sImessage,
// (const char*)f1ap_setup_resp->SI_container[i][0],
// f1ap_setup_resp->SI_container_length[i][0]);
//
// LOG_D(M2AP, "f1ap_setup_resp->SI_container_length = %d \n", f1ap_setup_resp->SI_container_length[0][0]);
// cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_MCESystemInformation = *gNB_MCESystemInformation;
//
//
// M2AP_ProtocolExtensionContainer_160P9_t p_160P9_t;
// memset((void *)&p_160P9_t, 0, sizeof(M2AP_ProtocolExtensionContainer_160P9_t));
//
// ASN_SEQUENCE_ADD(&p_160P9_t.list,
// cells_to_be_activated_list_itemExtIEs);
// cells_to_be_activated_list_item.iE_Extensions = (struct M2AP_ProtocolExtensionContainer*)&p_160P9_t;
//
// }
// /* ADD */
// cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
// ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list,
// cells_to_be_activated_list_item_ies);
// }
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* encode */
if (m2ap_encode_pdu(&pdu, &buffer, &len) < 0) {
......@@ -1380,10 +978,6 @@ int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*uint32_t assoc_id,*/
return -1;
}
//MCE_m2ap_itti_send_sctp_data_req(instance, m2ap_mce_data_from_du->assoc_id, buffer, len, 0);
//printf(",m2ap_mce_data_from_enb->assoc_id %d\n",m2ap_mce_data_from_enb->assoc_id);
m2ap_MCE_itti_send_sctp_data_req(instance,m2ap_mce_data_from_enb->assoc_id,buffer,len,0);
return 0;
......@@ -1561,88 +1155,8 @@ int MCE_send_MCE_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_id
ASN_SEQUENCE_ADD(&ie->value.choice.MCCHrelatedBCCH_ConfigPerMBSFNArea.list,mcch_related_bcch_config_per_mbsfn_area_item_ies);
}
//config_per_mbsfn_area_item->cellInformationList = ;//(M2AP_Cell_Information_List*)calloc(1,sizeof(M2AP_Cell_Information_List));
//config_per_mbsfn_area_item->subframeAllocationInfo.bits_unused = 4;
//ASN_SEQUENCE_ADD(&ie->value.choice.MCCHrelatedBCCH_ConfigPerMBSFNArea.list,config_per_mbsfn_area_item);
//config_per_mbsfn_area_item = &ie->value.choice.MCCHrelatedBCCH_ConfigPerMBSFNArea;
//{
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* M2AP_MCCHrelatedBCCH_ConfigPerMBSFNArea_t */
//...
// int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate;
// LOG_D(M2AP, "num_cells_to_activate = %d \n", num_cells_to_activate);
// for (i=0;
// i<num_cells_to_activate;
// i++) {
//
// M2AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies;
// cells_to_be_activated_list_item_ies = (M2AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(M2AP_Cells_to_be_Activated_List_ItemIEs_t));
// cells_to_be_activated_list_item_ies->id = M2AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item;
// cells_to_be_activated_list_item_ies->criticality = M2AP_Criticality_reject;
// cells_to_be_activated_list_item_ies->value.present = M2AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item;
//
// /* 3.1 cells to be Activated list item */
// M2AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item;
// memset((void *)&cells_to_be_activated_list_item, 0, sizeof(M2AP_Cells_to_be_Activated_List_Item_t));
//
// /* - nRCGI */
// M2AP_NRCGI_t nRCGI;
// MCC_MNC_TO_PLMNID(f1ap_setup_resp->mcc[i], f1ap_setup_resp->mnc[i], f1ap_setup_resp->mnc_digit_length[i],
// &nRCGI.pLMN_Identity);
// NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->nr_cellid[i], &nRCGI.nRCellIdentity);
// cells_to_be_activated_list_item.nRCGI = nRCGI;
//
// /* optional */
// /* - nRPCI */
// if (1) {
// cells_to_be_activated_list_item.nRPCI = (M2AP_NRPCI_t *)calloc(1, sizeof(M2AP_NRPCI_t));
// *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->nrpci[i]; // int 0..1007
// }
//
// /* optional */
// /* - gNB-MCE System Information */
// if (1) {
// /* 3.1.2 gNB-MCESystem Information */
// M2AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs;
// cells_to_be_activated_list_itemExtIEs = (M2AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(M2AP_Cells_to_be_Activated_List_ItemExtIEs_t));
// cells_to_be_activated_list_itemExtIEs->id = M2AP_ProtocolIE_ID_id_gNB_MCESystemInformation;
// cells_to_be_activated_list_itemExtIEs->criticality = M2AP_Criticality_reject;
// cells_to_be_activated_list_itemExtIEs->extensionValue.present = M2AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_MCESystemInformation;
//
// M2AP_GNB_MCESystemInformation_t *gNB_MCESystemInformation = (M2AP_GNB_MCESystemInformation_t *)calloc(1, sizeof(M2AP_GNB_MCESystemInformation_t));
// //LOG_I(M2AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]);
// //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++)
// // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]);
// //printf("\n");
// OCTET_STRING_fromBuf(&gNB_MCESystemInformation->sImessage,
// (const char*)f1ap_setup_resp->SI_container[i][0],
// f1ap_setup_resp->SI_container_length[i][0]);
//
// LOG_D(M2AP, "f1ap_setup_resp->SI_container_length = %d \n", f1ap_setup_resp->SI_container_length[0][0]);
// cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_MCESystemInformation = *gNB_MCESystemInformation;
//
//
// M2AP_ProtocolExtensionContainer_160P9_t p_160P9_t;
// memset((void *)&p_160P9_t, 0, sizeof(M2AP_ProtocolExtensionContainer_160P9_t));
//
// ASN_SEQUENCE_ADD(&p_160P9_t.list,
// cells_to_be_activated_list_itemExtIEs);
// cells_to_be_activated_list_item.iE_Extensions = (struct M2AP_ProtocolExtensionContainer*)&p_160P9_t;
//
// }
// /* ADD */
// cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item;
// ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list,
// cells_to_be_activated_list_item_ies);
// }
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* encode */
if (m2ap_encode_pdu(&pdu, &buffer, &len) < 0) {
......
......@@ -193,74 +193,8 @@ int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance,
//xer_fprint(stdout, &asn_DEF_M2AP_MBSFN_Area_Configuration_List, &ie->value.choice.MBSFN_Area_Configuration_List);
}
//asn_DEF_M2AP_MBSFN_Area_Configuration_List
// void * sptr = (void*)&ie->value.choice.MBSFN_Area_Configuration_List;
// asn_TYPE_descriptor_t * td = &asn_DEF_M2AP_MBSFN_Area_Configuration_List;
// asn_enc_rval_t er;
// const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
// const asn_TYPE_member_t *elm = td->elements;
// const asn_anonymous_sequence_ *list = _A_CSEQUENCE_FROM_VOID(sptr);
// const char *mname = specs->as_XMLValueList
// ? 0
// : ((*elm->name) ? elm->name : elm->type->xml_tag);
// size_t mlen = mname ? strlen(mname) : 0;
// //int xcan = (flags & XER_F_CANONICAL);
// //int i;
// if(!sptr) ASN__ENCODE_FAILED;
// er.encoded = 0;
// for(i = 0; i < list->count; i++) {
// asn_enc_rval_t tmper;
// void *memb_ptr = list->array[i];
// if(!memb_ptr) continue;
// if(mname) {
// //if(!xcan) ASN__TEXT_INDENT(1, ilevel);
// //ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
// }
// tmper = elm->type->op->xer_encoder(elm->type, memb_ptr, ilevel + 1,
// flags, cb, app_key);
// if(tmper.encoded == -1) return tmper;
// er.encoded += tmper.encoded;
// if(tmper.encoded == 0 && specs->as_XMLValueList) {
// const char *name = elm->type->xml_tag;
// size_t len = strlen(name);
// //if(!xcan) ASN__TEXT_INDENT(1, ilevel + 1);
// //ASN__CALLBACK3("<", 1, name, len, "/>", 2);
// }
// if(mname) {
// ASN__CALLBACK3("</", 2, mname, mlen, ">", 1);
// }
// }
//M2AP_FIND_PROTOCOLIE_BY_ID(M2AP_MBSFN_Area_Configuration_Item_t, &ie->value.choice.MBSFN_Area_Configuration_List.list, container2,M2AP_ProtocolIE_ID_id_PMCH_Configuration_List ,true);
//printf("count %d\n",((M2AP_MBSFN_Area_Configuration_Item_t*)ie->value.choice.MBSFN_Area_Configuration_List.list.array[0])->value.choice.PMCH_Configuration_List.list.count);
// M2AP_FIND_PROTOCOLIE_BY_ID(M2AP_M2SetupRequest_Ies_t, ie, container,
// M2AP_ProtocolIE_ID_id_GlobalEND_ID, true);
//itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p2);
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p);
// if(1){
// printf("m2ap_enb_data_g->assoc_id %d %d\n",m2ap_enb_data_g->assoc_id,assoc_id);
// eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance,NULL);
// }else
// //eNB_send_MBMS_SESSION_START_FAILURE(instance,assoc_id);
return 0;
}
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_decoder.c
* \brief m3ap decoder procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#include <stdio.h>
#include "assertions.h"
#include "intertask_interface.h"
#include "m3ap_common.h"
#include "m3ap_eNB_decoder.h"
static int m3ap_eNB_decode_initiating_message(M3AP_M3AP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
switch(pdu->choice.initiatingMessage.procedureCode) {
case M3AP_ProcedureCode_id_m3Setup:
//asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
M3AP_INFO("m3ap_eNB_decode_initiating_message!\n");
break;
// case M3AP_ProcedureCode_id_handoverPreparation:
// //asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
// M3AP_INFO("m3ap_eNB_decode_initiating_message!\n");
// break;
//
// case M3AP_ProcedureCode_id_uEContextRelease:
// //asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
// M3AP_INFO("m3ap_eNB_decode_initiating_message!\n");
// break;
//
// case M3AP_ProcedureCode_id_handoverCancel:
// //asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
// M3AP_INFO("m3ap_eNB_decode_initiating_message!\n");
// break;
//
default:
M3AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
return -1;
}
return 0;
}
static int m3ap_eNB_decode_successful_outcome(M3AP_M3AP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
switch(pdu->choice.successfulOutcome.procedureCode) {
case M3AP_ProcedureCode_id_m3Setup:
//asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
M3AP_INFO("m3ap_eNB_decode_successfuloutcome_message!\n");
break;
// case M3AP_ProcedureCode_id_handoverPreparation:
// //asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
// M3AP_INFO("m3ap_eNB_decode_successfuloutcome_message!\n");
// break;
//
default:
M3AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome.procedureCode);
return -1;
}
return 0;
}
static int m3ap_eNB_decode_unsuccessful_outcome(M3AP_M3AP_PDU_t *pdu)
{
DevAssert(pdu != NULL);
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
case M3AP_ProcedureCode_id_m3Setup:
//asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_M3AP_M3AP_PDU, pdu);
M3AP_INFO("m3ap_eNB_decode_unsuccessfuloutcome_message!\n");
break;
default:
M3AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.unsuccessfulOutcome.procedureCode);
return -1;
}
return 0;
}
int m3ap_eNB_decode_pdu(M3AP_M3AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(buffer != NULL);
dec_ret = aper_decode(NULL,
&asn_DEF_M3AP_M3AP_PDU,
(void **)&pdu,
buffer,
length,
0,
0);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_M3AP_M3AP_PDU, pdu);
}
if (dec_ret.code != RC_OK) {
M3AP_ERROR("Failed to decode pdu\n");
return -1;
}
switch(pdu->present) {
case M3AP_M3AP_PDU_PR_initiatingMessage:
return m3ap_eNB_decode_initiating_message(pdu);
case M3AP_M3AP_PDU_PR_successfulOutcome:
return m3ap_eNB_decode_successful_outcome(pdu);
case M3AP_M3AP_PDU_PR_unsuccessfulOutcome:
return m3ap_eNB_decode_unsuccessful_outcome(pdu);
default:
M3AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_decoder.h
* \brief m3ap decoder procedures for eNB
* \author Konstantinos Alexandris <Konstantinos.Alexandris@eurecom.fr>, Cedric Roux <Cedric.Roux@eurecom.fr>, Navid Nikaein <Navid.Nikaein@eurecom.fr>
* \date 2018
* \version 1.0
*/
#ifndef M3AP_ENB_DECODER_H_
#define M3AP_ENB_DECODER_H_
int m3ap_eNB_decode_pdu(M3AP_M3AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length)
__attribute__ ((warn_unused_result));
#endif /* M3AP_ENB_DECODER_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_encoder.c
* \brief m3ap encoder procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "assertions.h"
#include "conversions.h"
#include "intertask_interface.h"
#include "m3ap_common.h"
#include "m3ap_eNB_encoder.h"
int m3ap_eNB_encode_pdu(M3AP_M3AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
ssize_t encoded;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(len != NULL);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_M3AP_M3AP_PDU, (void *)pdu);
}
encoded = aper_encode_to_new_buffer(&asn_DEF_M3AP_M3AP_PDU, 0, pdu, (void **)buffer);
if (encoded < 0) {
return -1;
}
*len = encoded;
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, pdu);
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_encoder.h
* \brief m3ap encoder procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#ifndef M3AP_ENB_ENCODER_H_
#define M3AP_ENB_ENCODER_H_
int m3ap_eNB_encode_pdu(M3AP_M3AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result));
#endif /* M3AP_ENB_ENCODER_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_generate_messages.c
* \brief m3ap procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#include "intertask_interface.h"
//#include "M3AP_LastVisitedCell-Item.h"
#include "m3ap_common.h"
#include "m3ap_eNB.h"
#include "m3ap_eNB_generate_messages.h"
#include "m3ap_eNB_encoder.h"
#include "m3ap_eNB_decoder.h"
#include "m3ap_ids.h"
#include "m3ap_eNB_itti_messaging.h"
#include "msc.h"
#include "assertions.h"
#include "conversions.h"
int m3ap_eNB_generate_m3_setup_request(
m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p)
{
M3AP_M3AP_PDU_t pdu;
M3AP_M3SetupRequest_t *out;
M3AP_M3SetupRequestIEs_t *ie;
//M3AP_PLMN_Identity_t *plmn;
//ServedCells__Member *servedCellMember;
//M3AP_GU_Group_ID_t *gu;
uint8_t *buffer;
uint32_t len;
int ret = 0;
DevAssert(instance_p != NULL);
DevAssert(m3ap_eNB_data_p != NULL);
m3ap_eNB_data_p->state = M3AP_ENB_STATE_WAITING;
/* Prepare the M3AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = M3AP_M3AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = M3AP_ProcedureCode_id_m3Setup;
pdu.choice.initiatingMessage.criticality = M3AP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = M3AP_InitiatingMessage__value_PR_M3SetupRequest;
out = &pdu.choice.initiatingMessage.value.choice.M3SetupRequest;
/* mandatory */
ie = (M3AP_M3SetupRequestIEs_t *)calloc(1, sizeof(M3AP_M3SetupRequestIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_GlobalENB_ID;
//ie->criticality = M3AP_Criticality_reject;
//ie->value.present = M3AP_M2SetupRequest_IEs__value_PR_GlobalENB_ID;
//MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &ie->value.choice.GlobalENB_ID.pLMN_Identity);
//ie->value.choice.GlobalENB_ID.eNB_ID.present = M3AP_ENB_ID_PR_macro_eNB_ID;
//MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
// &ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID);
//M3AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id,
// ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf[0],
// ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf[1],
// ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf[2]);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (M3AP_M3SetupRequestIEs_t *)calloc(1, sizeof(M3AP_M3SetupRequestIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_ServedCells;
//ie->criticality = M3AP_Criticality_reject;
//ie->value.present = M3AP_M2SetupRequest_IEs__value_PR_ServedCells;
//{
// for (int i = 0; i<instance_p->num_cc; i++){
// servedCellMember = (ServedCells__Member *)calloc(1,sizeof(ServedCells__Member));
// {
// servedCellMember->servedCellInfo.pCI = instance_p->Nid_cell[i];
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &servedCellMember->servedCellInfo.cellId.pLMN_Identity);
// MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id,0,
// &servedCellMember->servedCellInfo.cellId.eUTRANcellIdentifier);
// INT16_TO_OCTET_STRING(instance_p->tac, &servedCellMember->servedCellInfo.tAC);
// plmn = (M3AP_PLMN_Identity_t *)calloc(1,sizeof(M3AP_PLMN_Identity_t));
// {
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, plmn);
// ASN_SEQUENCE_ADD(&servedCellMember->servedCellInfo.broadcastPLMNs.list, plmn);
// }
// if (instance_p->frame_type[i] == FDD) {
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.present = M3AP_EUTRA_Mode_Info_PR_fDD;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_EARFCN = instance_p->fdd_earfcn_DL[i];
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_EARFCN = instance_p->fdd_earfcn_UL[i];
// switch (instance_p->N_RB_DL[i]) {
// case 6:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw6;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw6;
// break;
// case 15:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw15;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw15;
// break;
// case 25:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw25;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw25;
// break;
// case 50:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw50;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw50;
// break;
// case 75:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw75;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw75;
// break;
// case 100:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw100;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw100;
// break;
// default:
// AssertFatal(0,"Failed: Check value for N_RB_DL/N_RB_UL");
// break;
// }
// }
// else {
// AssertFatal(0,"M2Setuprequest not supported for TDD!");
// }
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.ServedCells.list, servedCellMember);
// }
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (M3AP_M3SetupRequestIEs_t *)calloc(1, sizeof(M3AP_M3SetupRequestIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_GUGroupIDList;
//ie->criticality = M3AP_Criticality_reject;
//ie->value.present = M3AP_M2SetupRequest_IEs__value_PR_GUGroupIDList;
//{
// gu = (M3AP_GU_Group_ID_t *)calloc(1, sizeof(M3AP_GU_Group_ID_t));
// {
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &gu->pLMN_Identity);
// //@TODO: consider to update this value
// INT16_TO_OCTET_STRING(0, &gu->mME_Group_ID);
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.GUGroupIDList.list, gu);
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
M3AP_ERROR("Failed to encode M3 setup request\n");
return -1;
}
//MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB, MSC_M3AP_TARGET_ENB, NULL, 0, "0 M3Setup/initiatingMessage assoc_id %u", m3ap_eNB_data_p->assoc_id);
m3ap_eNB_itti_send_sctp_data_req(instance_p->instance, m3ap_eNB_data_p->assoc_id, buffer, len, 0);
return ret;
}
int m3ap_eNB_generate_m3_setup_response(m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p)
{
M3AP_M3AP_PDU_t pdu;
M3AP_M3SetupResponse_t *out;
M3AP_M3SetupResponseIEs_t *ie;
//M3AP_PLMN_Identity_t *plmn;
//ServedCells__Member *servedCellMember;
//M3AP_GU_Group_ID_t *gu;
uint8_t *buffer;
uint32_t len;
int ret = 0;
DevAssert(instance_p != NULL);
DevAssert(m3ap_eNB_data_p != NULL);
/* Prepare the M3AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = M3AP_M3AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = M3AP_ProcedureCode_id_m3Setup;
pdu.choice.successfulOutcome.criticality = M3AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = M3AP_SuccessfulOutcome__value_PR_M3SetupResponse;
out = &pdu.choice.successfulOutcome.value.choice.M3SetupResponse;
/* mandatory */
ie = (M3AP_M3SetupResponseIEs_t *)calloc(1, sizeof(M3AP_M3SetupResponseIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_GlobalENB_ID;
//ie->criticality = M3AP_Criticality_reject;
//ie->value.present = M3AP_M3SetupResponse_IEs__value_PR_GlobalENB_ID;
//MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &ie->value.choice.GlobalENB_ID.pLMN_Identity);
//ie->value.choice.GlobalENB_ID.eNB_ID.present = M3AP_ENB_ID_PR_macro_eNB_ID;
//MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
// &ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID);
//M3AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id,
// ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf[0],
// ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf[1],
// ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf[2]);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (M3AP_M3SetupResponseIEs_t *)calloc(1, sizeof(M3AP_M3SetupResponseIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_ServedCells;
//ie->criticality = M3AP_Criticality_reject;
//ie->value.present = M3AP_M3SetupResponse_IEs__value_PR_ServedCells;
//{
// for (int i = 0; i<instance_p->num_cc; i++){
// servedCellMember = (ServedCells__Member *)calloc(1,sizeof(ServedCells__Member));
// {
// servedCellMember->servedCellInfo.pCI = instance_p->Nid_cell[i];
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &servedCellMember->servedCellInfo.cellId.pLMN_Identity);
// MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id,0,
// &servedCellMember->servedCellInfo.cellId.eUTRANcellIdentifier);
// INT16_TO_OCTET_STRING(instance_p->tac, &servedCellMember->servedCellInfo.tAC);
// plmn = (M3AP_PLMN_Identity_t *)calloc(1,sizeof(M3AP_PLMN_Identity_t));
// {
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, plmn);
// ASN_SEQUENCE_ADD(&servedCellMember->servedCellInfo.broadcastPLMNs.list, plmn);
// }
// if (instance_p->frame_type[i] == FDD) {
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.present = M3AP_EUTRA_Mode_Info_PR_fDD;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_EARFCN = instance_p->fdd_earfcn_DL[i];
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_EARFCN = instance_p->fdd_earfcn_UL[i];
// switch (instance_p->N_RB_DL[i]) {
// case 6:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw6;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw6;
// break;
// case 15:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw15;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw15;
// break;
// case 25:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw25;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw25;
// break;
// case 50:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw50;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw50;
// break;
// case 75:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw75;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw75;
// break;
// case 100:
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw100;
// servedCellMember->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = M3AP_Transmission_Bandwidth_bw100;
// break;
// default:
// AssertFatal(0,"Failed: Check value for N_RB_DL/N_RB_UL");
// break;
// }
// }
// else {
// AssertFatal(0,"M3Setupresponse not supported for TDD!");
// }
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.ServedCells.list, servedCellMember);
// }
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (M3AP_M3SetupResponseIEs_t *)calloc(1, sizeof(M3AP_M3SetupResponseIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_GUGroupIDList;
//ie->criticality = M3AP_Criticality_reject;
//ie->value.present = M3AP_M3SetupResponse_IEs__value_PR_GUGroupIDList;
//{
// gu = (M3AP_GU_Group_ID_t *)calloc(1, sizeof(M3AP_GU_Group_ID_t));
// {
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &gu->pLMN_Identity);
// //@TODO: consider to update this value
// INT16_TO_OCTET_STRING(0, &gu->mME_Group_ID);
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.GUGroupIDList.list, gu);
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
M3AP_ERROR("Failed to encode M3 setup response\n");
return -1;
}
m3ap_eNB_data_p->state = M3AP_ENB_STATE_READY;
//MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB, MSC_M3AP_TARGET_ENB, NULL, 0, "0 M3Setup/successfulOutcome assoc_id %u", m3ap_eNB_data_p->assoc_id);
m3ap_eNB_itti_send_sctp_data_req(instance_p->instance, m3ap_eNB_data_p->assoc_id, buffer, len, 0);
return ret;
}
int m3ap_eNB_generate_m3_setup_failure(instance_t instance,
uint32_t assoc_id,
M3AP_Cause_PR cause_type,
long cause_value,
long time_to_wait)
{
M3AP_M3AP_PDU_t pdu;
M3AP_M3SetupFailure_t *out;
M3AP_M3SetupFailureIEs_t *ie;
uint8_t *buffer;
uint32_t len;
int ret = 0;
/* Prepare the M3AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = M3AP_M3AP_PDU_PR_unsuccessfulOutcome;
pdu.choice.unsuccessfulOutcome.procedureCode = M3AP_ProcedureCode_id_m3Setup;
pdu.choice.unsuccessfulOutcome.criticality = M3AP_Criticality_reject;
pdu.choice.unsuccessfulOutcome.value.present = M3AP_UnsuccessfulOutcome__value_PR_M3SetupFailure;
out = &pdu.choice.unsuccessfulOutcome.value.choice.M3SetupFailure;
/* mandatory */
ie = (M3AP_M3SetupFailureIEs_t *)calloc(1, sizeof(M3AP_M3SetupFailureIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_Cause;
//ie->criticality = M3AP_Criticality_ignore;
//ie->value.present = M3AP_M3SetupFailure_IEs__value_PR_Cause;
//m3ap_eNB_set_cause (&ie->value.choice.Cause, cause_type, cause_value);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional: consider to handle this later */
ie = (M3AP_M3SetupFailureIEs_t *)calloc(1, sizeof(M3AP_M3SetupFailureIEs_t));
//ie->id = M3AP_ProtocolIE_ID_id_TimeToWait;
//ie->criticality = M3AP_Criticality_ignore;
//ie->value.present = M3AP_M3SetupFailure_IEs__value_PR_TimeToWait;
//if (time_to_wait > -1) {
// ie->value.choice.TimeToWait = time_to_wait;
//}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
M3AP_ERROR("Failed to encode M3 setup failure\n");
return -1;
}
//MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB,
// MSC_M3AP_TARGET_ENB, NULL, 0,
// "0 M3Setup/unsuccessfulOutcome assoc_id %u cause %u value %u",
// assoc_id, cause_type, cause_value);
m3ap_eNB_itti_send_sctp_data_req(instance, assoc_id, buffer, len, 0);
return ret;
}
int m3ap_eNB_set_cause (M3AP_Cause_t * cause_p,
M3AP_Cause_PR cause_type,
long cause_value)
{
DevAssert (cause_p != NULL);
cause_p->present = cause_type;
switch (cause_type) {
case M3AP_Cause_PR_radioNetwork:
cause_p->choice.misc = cause_value;
break;
case M3AP_Cause_PR_transport:
cause_p->choice.misc = cause_value;
break;
case M3AP_Cause_PR_protocol:
cause_p->choice.misc = cause_value;
break;
case M3AP_Cause_PR_misc:
cause_p->choice.misc = cause_value;
break;
default:
return -1;
}
return 0;
}
//int m3ap_eNB_generate_m2_handover_request (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// m3ap_handover_req_t *m3ap_handover_req, int ue_id)
//{
//
// M3AP_M3AP_PDU_t pdu;
// M3AP_HandoverRequest_t *out;
// M3AP_HandoverRequest_IEs_t *ie;
// M3AP_E_RABs_ToBeSetup_ItemIEs_t *e_RABS_ToBeSetup_ItemIEs;
// M3AP_E_RABs_ToBeSetup_Item_t *e_RABs_ToBeSetup_Item;
// M3AP_LastVisitedCell_Item_t *lastVisitedCell_Item;
//
// uint8_t *buffer;
// uint32_t len;
// int ret = 0;
//
// DevAssert(instance_p != NULL);
// DevAssert(m3ap_eNB_data_p != NULL);
//
// /* Prepare the M3AP handover message to encode */
// memset(&pdu, 0, sizeof(pdu));
// pdu.present = M3AP_M3AP_PDU_PR_initiatingMessage;
// pdu.choice.initiatingMessage.procedureCode = M3AP_ProcedureCode_id_handoverPreparation;
// pdu.choice.initiatingMessage.criticality = M3AP_Criticality_reject;
// pdu.choice.initiatingMessage.value.present = M3AP_InitiatingMessage__value_PR_HandoverRequest;
// out = &pdu.choice.initiatingMessage.value.choice.HandoverRequest;
//
// /* mandatory */
// ie = (M3AP_HandoverRequest_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequest_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_HandoverRequest_IEs__value_PR_UE_M3AP_ID;
// ie->value.choice.UE_M3AP_ID = m3ap_id_get_id_source(&instance_p->id_manager, ue_id);
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequest_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequest_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_Cause;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverRequest_IEs__value_PR_Cause;
// ie->value.choice.Cause.present = M3AP_Cause_PR_radioNetwork;
// ie->value.choice.Cause.choice.radioNetwork = M3AP_CauseRadioNetwork_handover_desirable_for_radio_reasons;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequest_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequest_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_TargetCell_ID;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_HandoverRequest_IEs__value_PR_ECGI;
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &ie->value.choice.ECGI.pLMN_Identity);
// MACRO_ENB_ID_TO_CELL_IDENTITY(m3ap_eNB_data_p->eNB_id, 0, &ie->value.choice.ECGI.eUTRANcellIdentifier);
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequest_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequest_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_GUMMEI_ID;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_HandoverRequest_IEs__value_PR_GUMMEI;
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &ie->value.choice.GUMMEI.gU_Group_ID.pLMN_Identity);
// //@TODO: consider to update these values
// INT16_TO_OCTET_STRING(m3ap_handover_req->ue_gummei.mme_group_id, &ie->value.choice.GUMMEI.gU_Group_ID.mME_Group_ID);
// MME_CODE_TO_OCTET_STRING(m3ap_handover_req->ue_gummei.mme_code, &ie->value.choice.GUMMEI.mME_Code);
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequest_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequest_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_UE_ContextInformation;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_HandoverRequest_IEs__value_PR_UE_ContextInformation;
// //@TODO: consider to update this value
// ie->value.choice.UE_ContextInformation.mME_UE_S1AP_ID = m3ap_handover_req->mme_ue_s1ap_id;
//
// KENB_STAR_TO_BIT_STRING(m3ap_handover_req->kenb,&ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star);
//
// if (m3ap_handover_req->kenb_ncc >=0) { // Check this condition
// ie->value.choice.UE_ContextInformation.aS_SecurityInformation.nextHopChainingCount = m3ap_handover_req->kenb_ncc;
// }
// else {
// ie->value.choice.UE_ContextInformation.aS_SecurityInformation.nextHopChainingCount = 1;
// }
//
// ENCRALG_TO_BIT_STRING(m3ap_handover_req->security_capabilities.encryption_algorithms,
// &ie->value.choice.UE_ContextInformation.uESecurityCapabilities.encryptionAlgorithms);
//
// INTPROTALG_TO_BIT_STRING(m3ap_handover_req->security_capabilities.integrity_algorithms,
// &ie->value.choice.UE_ContextInformation.uESecurityCapabilities.integrityProtectionAlgorithms);
//
// //@TODO: update with proper UEAMPR
// UEAGMAXBITRTD_TO_ASN_PRIMITIVES(3L,&ie->value.choice.UE_ContextInformation.uEaggregateMaximumBitRate.uEaggregateMaximumBitRateDownlink);
// UEAGMAXBITRTU_TO_ASN_PRIMITIVES(6L,&ie->value.choice.UE_ContextInformation.uEaggregateMaximumBitRate.uEaggregateMaximumBitRateUplink);
// {
// for (int i=0;i<m3ap_handover_req->nb_e_rabs_tobesetup;i++) {
// e_RABS_ToBeSetup_ItemIEs = (M3AP_E_RABs_ToBeSetup_ItemIEs_t *)calloc(1,sizeof(M3AP_E_RABs_ToBeSetup_ItemIEs_t));
// e_RABS_ToBeSetup_ItemIEs->id = M3AP_ProtocolIE_ID_id_E_RABs_ToBeSetup_Item;
// e_RABS_ToBeSetup_ItemIEs->criticality = M3AP_Criticality_ignore;
// e_RABS_ToBeSetup_ItemIEs->value.present = M3AP_E_RABs_ToBeSetup_ItemIEs__value_PR_E_RABs_ToBeSetup_Item;
// e_RABs_ToBeSetup_Item = &e_RABS_ToBeSetup_ItemIEs->value.choice.E_RABs_ToBeSetup_Item;
// {
// e_RABs_ToBeSetup_Item->e_RAB_ID = m3ap_handover_req->e_rabs_tobesetup[i].e_rab_id;
// e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.qCI = m3ap_handover_req->e_rab_param[i].qos.qci;
// e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel = m3ap_handover_req->e_rab_param[i].qos.allocation_retention_priority.priority_level;
// e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability = m3ap_handover_req->e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability;
// e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability = m3ap_handover_req->e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability;
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size = (uint8_t)(m3ap_handover_req->e_rabs_tobesetup[i].eNB_addr.length/8);
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.bits_unused = m3ap_handover_req->e_rabs_tobesetup[i].eNB_addr.length%8;
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.buf =
// calloc(1,e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size);
//
// memcpy (e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.buf,
// m3ap_handover_req->e_rabs_tobesetup[i].eNB_addr.buffer,
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size);
//
// INT32_TO_OCTET_STRING(m3ap_handover_req->e_rabs_tobesetup[i].gtp_teid,&e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.gTP_TEID);
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list, e_RABS_ToBeSetup_ItemIEs);
// }
// }
//
// OCTET_STRING_fromBuf(&ie->value.choice.UE_ContextInformation.rRC_Context, (char*) m3ap_handover_req->rrc_buffer, m3ap_handover_req->rrc_buffer_size);
//
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequest_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequest_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_UE_HistoryInformation;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverRequest_IEs__value_PR_UE_HistoryInformation;
// //@TODO: consider to update this value
// {
// lastVisitedCell_Item = (M3AP_LastVisitedCell_Item_t *)calloc(1, sizeof(M3AP_LastVisitedCell_Item_t));
// lastVisitedCell_Item->present = M3AP_LastVisitedCell_Item_PR_e_UTRAN_Cell;
// MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
// &lastVisitedCell_Item->choice.e_UTRAN_Cell.global_Cell_ID.pLMN_Identity);
// MACRO_ENB_ID_TO_CELL_IDENTITY(0, 0, &lastVisitedCell_Item->choice.e_UTRAN_Cell.global_Cell_ID.eUTRANcellIdentifier);
// lastVisitedCell_Item->choice.e_UTRAN_Cell.cellType.cell_Size = M3AP_Cell_Size_small;
// lastVisitedCell_Item->choice.e_UTRAN_Cell.time_UE_StayedInCell = 2;
// ASN_SEQUENCE_ADD(&ie->value.choice.UE_HistoryInformation.list, lastVisitedCell_Item);
// }
//
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
// M3AP_ERROR("Failed to encode X2 handover request\n");
// abort();
// return -1;
// }
//
// MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB, MSC_M3AP_TARGET_ENB, NULL, 0, "0 X2Handover/initiatingMessage assoc_id %u", m3ap_eNB_data_p->assoc_id);
//
// m3ap_eNB_itti_send_sctp_data_req(instance_p->instance, m3ap_eNB_data_p->assoc_id, buffer, len, 1);
//
// return ret;
//}
//
//int m3ap_eNB_generate_m2_handover_request_ack (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// m3ap_handover_req_ack_t *m3ap_handover_req_ack)
//{
//
// M3AP_M3AP_PDU_t pdu;
// M3AP_HandoverRequestAcknowledge_t *out;
// M3AP_HandoverRequestAcknowledge_IEs_t *ie;
// M3AP_E_RABs_Admitted_ItemIEs_t *e_RABS_Admitted_ItemIEs;
// M3AP_E_RABs_Admitted_Item_t *e_RABs_Admitted_Item;
// int ue_id;
// int id_source;
// int id_target;
//
// uint8_t *buffer;
// uint32_t len;
// int ret = 0;
//
// DevAssert(instance_p != NULL);
// DevAssert(m3ap_eNB_data_p != NULL);
//
// ue_id = m3ap_handover_req_ack->m2_id_target;
// id_source = m3ap_id_get_id_source(&instance_p->id_manager, ue_id);
// id_target = ue_id;
//
// /* Prepare the M3AP handover message to encode */
// memset(&pdu, 0, sizeof(pdu));
// pdu.present = M3AP_M3AP_PDU_PR_successfulOutcome;
// pdu.choice.successfulOutcome.procedureCode = M3AP_ProcedureCode_id_handoverPreparation;
// pdu.choice.successfulOutcome.criticality = M3AP_Criticality_reject;
// pdu.choice.successfulOutcome.value.present = M3AP_SuccessfulOutcome__value_PR_HandoverRequestAcknowledge;
// out = &pdu.choice.successfulOutcome.value.choice.HandoverRequestAcknowledge;
//
// /* mandatory */
// ie = (M3AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequestAcknowledge_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverRequestAcknowledge_IEs__value_PR_UE_M3AP_ID;
// ie->value.choice.UE_M3AP_ID = id_source;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequestAcknowledge_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_New_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverRequestAcknowledge_IEs__value_PR_UE_M3AP_ID_1;
// ie->value.choice.UE_M3AP_ID_1 = id_target;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequestAcknowledge_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_E_RABs_Admitted_List;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverRequestAcknowledge_IEs__value_PR_E_RABs_Admitted_List;
//
// {
// for (int i=0;i<m3ap_handover_req_ack->nb_e_rabs_tobesetup;i++) {
// e_RABS_Admitted_ItemIEs = (M3AP_E_RABs_Admitted_ItemIEs_t *)calloc(1,sizeof(M3AP_E_RABs_Admitted_ItemIEs_t));
// e_RABS_Admitted_ItemIEs->id = M3AP_ProtocolIE_ID_id_E_RABs_Admitted_Item;
// e_RABS_Admitted_ItemIEs->criticality = M3AP_Criticality_ignore;
// e_RABS_Admitted_ItemIEs->value.present = M3AP_E_RABs_Admitted_ItemIEs__value_PR_E_RABs_Admitted_Item;
// e_RABs_Admitted_Item = &e_RABS_Admitted_ItemIEs->value.choice.E_RABs_Admitted_Item;
// {
// e_RABs_Admitted_Item->e_RAB_ID = m3ap_handover_req_ack->e_rabs_tobesetup[i].e_rab_id;
// }
// ASN_SEQUENCE_ADD(&ie->value.choice.E_RABs_Admitted_List.list, e_RABS_Admitted_ItemIEs);
// }
// }
//
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(M3AP_HandoverRequestAcknowledge_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_TargeteNBtoSource_eNBTransparentContainer;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverRequestAcknowledge_IEs__value_PR_TargeteNBtoSource_eNBTransparentContainer;
//
// OCTET_STRING_fromBuf(&ie->value.choice.TargeteNBtoSource_eNBTransparentContainer, (char*) m3ap_handover_req_ack->rrc_buffer, m3ap_handover_req_ack->rrc_buffer_size);
//
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
// M3AP_ERROR("Failed to encode X2 handover response\n");
// abort();
// return -1;
// }
//
// MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB, MSC_M3AP_TARGET_ENB, NULL, 0, "0 X2Handover/successfulOutcome assoc_id %u", m3ap_eNB_data_p->assoc_id);
//
// m3ap_eNB_itti_send_sctp_data_req(instance_p->instance, m3ap_eNB_data_p->assoc_id, buffer, len, 1);
//
// return ret;
//}
//
//int m3ap_eNB_generate_m2_ue_context_release (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p, m3ap_ue_context_release_t *m3ap_ue_context_release)
//{
//
// M3AP_M3AP_PDU_t pdu;
// M3AP_UEContextRelease_t *out;
// M3AP_UEContextRelease_IEs_t *ie;
// int ue_id;
// int id_source;
// int id_target;
//
// uint8_t *buffer;
// uint32_t len;
// int ret = 0;
//
// DevAssert(instance_p != NULL);
// DevAssert(m3ap_eNB_data_p != NULL);
//
// ue_id = m3ap_find_id_from_rnti(&instance_p->id_manager, m3ap_ue_context_release->rnti);
// if (ue_id == -1) {
// M3AP_ERROR("could not find UE %x\n", m3ap_ue_context_release->rnti);
// exit(1);
// }
// id_source = m3ap_id_get_id_source(&instance_p->id_manager, ue_id);
// id_target = ue_id;
//
// /* Prepare the M3AP ue context relase message to encode */
// memset(&pdu, 0, sizeof(pdu));
// pdu.present = M3AP_M3AP_PDU_PR_initiatingMessage;
// pdu.choice.initiatingMessage.procedureCode = M3AP_ProcedureCode_id_uEContextRelease;
// pdu.choice.initiatingMessage.criticality = M3AP_Criticality_ignore;
// pdu.choice.initiatingMessage.value.present = M3AP_InitiatingMessage__value_PR_UEContextRelease;
// out = &pdu.choice.initiatingMessage.value.choice.UEContextRelease;
//
// /* mandatory */
// ie = (M3AP_UEContextRelease_IEs_t *)calloc(1, sizeof(M3AP_UEContextRelease_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_UEContextRelease_IEs__value_PR_UE_M3AP_ID;
// ie->value.choice.UE_M3AP_ID = id_source;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* mandatory */
// ie = (M3AP_UEContextRelease_IEs_t *)calloc(1, sizeof(M3AP_UEContextRelease_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_New_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_UEContextRelease_IEs__value_PR_UE_M3AP_ID_1;
// ie->value.choice.UE_M3AP_ID_1 = id_target;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
// M3AP_ERROR("Failed to encode X2 UE Context Release\n");
// abort();
// return -1;
// }
//
// MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB, MSC_M3AP_TARGET_ENB, NULL, 0, "0 X2UEContextRelease/initiatingMessage assoc_id %u", m3ap_eNB_data_p->assoc_id);
//
// m3ap_eNB_itti_send_sctp_data_req(instance_p->instance, m3ap_eNB_data_p->assoc_id, buffer, len, 1);
//
// return ret;
//}
//
//int m3ap_eNB_generate_m2_handover_cancel (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// int m2_ue_id,
// m3ap_handover_cancel_cause_t cause)
//{
// M3AP_M3AP_PDU_t pdu;
// M3AP_HandoverCancel_t *out;
// M3AP_HandoverCancel_IEs_t *ie;
// int ue_id;
// int id_source;
// int id_target;
//
// uint8_t *buffer;
// uint32_t len;
// int ret = 0;
//
// DevAssert(instance_p != NULL);
// DevAssert(m3ap_eNB_data_p != NULL);
//
// ue_id = m2_ue_id;
// id_source = ue_id;
// id_target = m3ap_id_get_id_target(&instance_p->id_manager, ue_id);
//
// /* Prepare the M3AP handover cancel message to encode */
// memset(&pdu, 0, sizeof(pdu));
// pdu.present = M3AP_M3AP_PDU_PR_initiatingMessage;
// pdu.choice.initiatingMessage.procedureCode = M3AP_ProcedureCode_id_handoverCancel;
// pdu.choice.initiatingMessage.criticality = M3AP_Criticality_ignore;
// pdu.choice.initiatingMessage.value.present = M3AP_InitiatingMessage__value_PR_HandoverCancel;
// out = &pdu.choice.initiatingMessage.value.choice.HandoverCancel;
//
// /* mandatory */
// ie = (M3AP_HandoverCancel_IEs_t *)calloc(1, sizeof(M3AP_HandoverCancel_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_reject;
// ie->value.present = M3AP_HandoverCancel_IEs__value_PR_UE_M3AP_ID;
// ie->value.choice.UE_M3AP_ID = id_source;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// /* optional */
// if (id_target != -1) {
// ie = (M3AP_HandoverCancel_IEs_t *)calloc(1, sizeof(M3AP_HandoverCancel_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_New_eNB_UE_M3AP_ID;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverCancel_IEs__value_PR_UE_M3AP_ID_1;
// ie->value.choice.UE_M3AP_ID_1 = id_target;
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
// }
//
// /* mandatory */
// ie = (M3AP_HandoverCancel_IEs_t *)calloc(1, sizeof(M3AP_HandoverCancel_IEs_t));
// ie->id = M3AP_ProtocolIE_ID_id_Cause;
// ie->criticality = M3AP_Criticality_ignore;
// ie->value.present = M3AP_HandoverCancel_IEs__value_PR_Cause;
// switch (cause) {
// case M3AP_T_RELOC_PREP_TIMEOUT:
// ie->value.choice.Cause.present = M3AP_Cause_PR_radioNetwork;
// ie->value.choice.Cause.choice.radioNetwork =
// M3AP_CauseRadioNetwork_trelocprep_expiry;
// break;
// case M3AP_TX2_RELOC_OVERALL_TIMEOUT:
// ie->value.choice.Cause.present = M3AP_Cause_PR_radioNetwork;
// ie->value.choice.Cause.choice.radioNetwork =
// M3AP_CauseRadioNetwork_tx2relocoverall_expiry;
// break;
// default:
// /* we can't come here */
// M3AP_ERROR("unhandled cancel cause\n");
// exit(1);
// }
// ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//
// if (m3ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
// M3AP_ERROR("Failed to encode X2 Handover Cancel\n");
// abort();
// return -1;
// }
//
// MSC_LOG_TX_MESSAGE (MSC_M3AP_SRC_ENB, MSC_M3AP_TARGET_ENB, NULL, 0, "0 X2HandoverCancel/initiatingMessage assoc_id %u", m3ap_eNB_data_p->assoc_id);
//
// m3ap_eNB_itti_send_sctp_data_req(instance_p->instance, m3ap_eNB_data_p->assoc_id, buffer, len, 1);
//
// return ret;
//}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_generate_messages.h
* \brief m3ap procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#ifndef M3AP_ENB_GENERATE_MESSAGES_H_
#define M3AP_ENB_GENERATE_MESSAGES_H_
#include "m3ap_eNB_defs.h"
#include "m3ap_common.h"
int m3ap_eNB_generate_m3_setup_request(m3ap_eNB_instance_t *instance_p,
m3ap_eNB_data_t *m3ap_eNB_data_p);
int m3ap_eNB_generate_m3_setup_response(m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p);
int m3ap_eNB_generate_m3_setup_failure(instance_t instance,
uint32_t assoc_id,
M3AP_Cause_PR cause_type,
long cause_value,
long time_to_wait);
int m3ap_eNB_set_cause (M3AP_Cause_t * cause_p,
M3AP_Cause_PR cause_type,
long cause_value);
//int m3ap_eNB_generate_m2_handover_request (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// m3ap_handover_req_t *m3ap_handover_req, int ue_id);
//
//int m3ap_eNB_generate_m2_handover_request_ack (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// m3ap_handover_req_ack_t *m3ap_handover_req_ack);
//
//int m3ap_eNB_generate_m2_ue_context_release (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// m3ap_ue_context_release_t *m3ap_ue_context_release);
//
//int m3ap_eNB_generate_m2_handover_cancel (m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *m3ap_eNB_data_p,
// int m2_ue_id,
// m3ap_handover_cancel_cause_t cause);
#endif /* M3AP_ENB_GENERATE_MESSAGES_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_handler.c
* \brief m3ap handler procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#include <stdint.h>
#include "intertask_interface.h"
#include "asn1_conversions.h"
#include "m3ap_common.h"
#include "m3ap_eNB_defs.h"
#include "m3ap_eNB_handler.h"
#include "m3ap_eNB_decoder.h"
#include "m3ap_ids.h"
#include "m3ap_eNB_management_procedures.h"
#include "m3ap_eNB_generate_messages.h"
#include "msc.h"
#include "assertions.h"
#include "conversions.h"
static
int m3ap_eNB_handle_m3_setup_request (instance_t instance,
uint32_t assoc_id,
uint32_t stream,
M3AP_M3AP_PDU_t *pdu);
static
int m3ap_eNB_handle_m3_setup_response (instance_t instance,
uint32_t assoc_id,
uint32_t stream,
M3AP_M3AP_PDU_t *pdu);
static
int m3ap_eNB_handle_m3_setup_failure (instance_t instance,
uint32_t assoc_id,
uint32_t stream,
M3AP_M3AP_PDU_t *pdu);
//
//static
//int m3ap_eNB_handle_handover_preparation (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu);
//static
//int m3ap_eNB_handle_handover_response (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu);
//
//static
//int m3ap_eNB_handle_ue_context_release (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu);
//
//static
//int m3ap_eNB_handle_handover_cancel (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu);
/* Handlers matrix. Only eNB related procedure present here */
m3ap_message_decoded_callback m3ap_messages_callback[][3] = {
{ 0, 0, 0 }, /* MBMSSessionStart */
{ 0, 0, 0 }, /* MBMSSessionStop */
{ 0, 0, 0 }, /* MBMSSessionUpdate */
{ 0, 0, 0 }, /* MBMSSchedulingInformation */
{ 0, 0, 0 }, /* reset */
{ m3ap_eNB_handle_m3_setup_request, m3ap_eNB_handle_m3_setup_response, m3ap_eNB_handle_m3_setup_failure }, /* M3 Setup */
{ 0, 0, 0 }, /* eNBConfigurationUpdate */
{ 0, 0, 0 }, /* MCEConfigurationUpdate */
{ 0, 0, 0 }, /* MBMSServiceCounting */
};
char *m3ap_direction2String(int m3ap_dir) {
static char *m3ap_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return(m3ap_direction_String[m3ap_dir]);
}
void m3ap_handle_m3_setup_message(m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *enb_desc_p, int sctp_shutdown)
{
if (sctp_shutdown) {
/* A previously connected eNB has been shutdown */
/* TODO check if it was used by some eNB and send a message to inform these eNB if there is no more associated eNB */
if (enb_desc_p->state == M3AP_ENB_STATE_CONNECTED) {
enb_desc_p->state = M3AP_ENB_STATE_DISCONNECTED;
if (instance_p-> m3_target_enb_associated_nb > 0) {
/* Decrease associated eNB number */
instance_p-> m3_target_enb_associated_nb --;
}
/* If there are no more associated eNB, inform eNB app */
if (instance_p->m3_target_enb_associated_nb == 0) {
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_M3AP, M3AP_DEREGISTERED_MCE_IND);
M3AP_DEREGISTERED_MCE_IND(message_p).nb_mme = 0;
itti_send_msg_to_task(TASK_ENB_APP, instance_p->instance, message_p);
}
}
} else {
/* Check that at least one setup message is pending */
DevCheck(instance_p->m3_target_enb_pending_nb > 0,
instance_p->instance,
instance_p->m3_target_enb_pending_nb, 0);
if (instance_p->m3_target_enb_pending_nb > 0) {
/* Decrease pending messages number */
instance_p->m3_target_enb_pending_nb --;
}
/* If there are no more pending messages, inform eNB app */
if (instance_p->m3_target_enb_pending_nb == 0) {
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_M3AP, M3AP_REGISTER_MCE_CNF);
M3AP_REGISTER_MCE_CNF(message_p).nb_mme = instance_p->m3_target_enb_associated_nb;
itti_send_msg_to_task(TASK_ENB_APP, instance_p->instance, message_p);
}
}
}
int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
const uint8_t *const data, const uint32_t data_length)
{
M3AP_M3AP_PDU_t pdu;
int ret = 0;
DevAssert(data != NULL);
memset(&pdu, 0, sizeof(pdu));
//printf("Data length received: %d\n", data_length);
if (m3ap_eNB_decode_pdu(&pdu, data, data_length) < 0) {
M3AP_ERROR("Failed to decode PDU\n");
return -1;
}
switch (pdu.present) {
case M3AP_M3AP_PDU_PR_initiatingMessage:
/* Checking procedure Code and direction of message */
if (pdu.choice.initiatingMessage.procedureCode > sizeof(m3ap_messages_callback) / (3 * sizeof(
m3ap_message_decoded_callback))) {
//|| (pdu.present > M3AP_M3AP_PDU_PR_unsuccessfulOutcome)) {
M3AP_ERROR("[SCTP %d] Either procedureCode %ld exceed expected\n",
assoc_id, pdu.choice.initiatingMessage.procedureCode);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for eNB (wrong direction).
*/
if (m3ap_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1] == NULL) {
M3AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.initiatingMessage.procedureCode,
m3ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* Calling the right handler */
ret = (*m3ap_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1])
(instance, assoc_id, stream, &pdu);
break;
case M3AP_M3AP_PDU_PR_successfulOutcome:
/* Checking procedure Code and direction of message */
if (pdu.choice.successfulOutcome.procedureCode > sizeof(m3ap_messages_callback) / (3 * sizeof(
m3ap_message_decoded_callback))) {
//|| (pdu.present > M3AP_M3AP_PDU_PR_unsuccessfulOutcome)) {
M3AP_ERROR("[SCTP %d] Either procedureCode %ld exceed expected\n",
assoc_id, pdu.choice.successfulOutcome.procedureCode);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for eNB (wrong direction).
*/
if (m3ap_messages_callback[pdu.choice.successfulOutcome.procedureCode][pdu.present - 1] == NULL) {
M3AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.successfulOutcome.procedureCode,
m3ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* Calling the right handler */
ret = (*m3ap_messages_callback[pdu.choice.successfulOutcome.procedureCode][pdu.present - 1])
(instance, assoc_id, stream, &pdu);
break;
case M3AP_M3AP_PDU_PR_unsuccessfulOutcome:
/* Checking procedure Code and direction of message */
if (pdu.choice.unsuccessfulOutcome.procedureCode > sizeof(m3ap_messages_callback) / (3 * sizeof(
m3ap_message_decoded_callback))) {
//|| (pdu.present > M3AP_M3AP_PDU_PR_unsuccessfulOutcome)) {
M3AP_ERROR("[SCTP %d] Either procedureCode %ld exceed expected\n",
assoc_id, pdu.choice.unsuccessfulOutcome.procedureCode);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* No handler present.
* This can mean not implemented or no procedure for eNB (wrong direction).
*/
if (m3ap_messages_callback[pdu.choice.unsuccessfulOutcome.procedureCode][pdu.present - 1] == NULL) {
M3AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.unsuccessfulOutcome.procedureCode,
m3ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return -1;
}
/* Calling the right handler */
ret = (*m3ap_messages_callback[pdu.choice.unsuccessfulOutcome.procedureCode][pdu.present - 1])
(instance, assoc_id, stream, &pdu);
break;
default:
M3AP_ERROR("[SCTP %d] Direction %d exceed expected\n",
assoc_id, pdu.present);
break;
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu);
return ret;
}
int
m3ap_eNB_handle_m3_setup_request(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
M3AP_M3AP_PDU_t *pdu)
{
M3AP_M3SetupRequest_t *m3SetupRequest;
//M3AP_M3SetupRequestIEs_t *ie;
//ServedCells__Member *servedCellMember;
m3ap_eNB_instance_t *instance_p;
m3ap_eNB_data_t *m3ap_eNB_data;
uint32_t eNB_id = 0;
DevAssert (pdu != NULL);
m3SetupRequest = &pdu->choice.initiatingMessage.value.choice.M3SetupRequest;
/*
* We received a new valid M3 Setup Request on a stream != 0.
* * * * This should not happen -> reject eNB m3 setup request.
*/
if (stream != 0) {
M3AP_ERROR("Received new m3 setup request on stream != 0\n");
/*
* Send a m3 setup failure with protocol cause unspecified
*/
return m3ap_eNB_generate_m3_setup_failure (instance,
assoc_id,
M3AP_Cause_PR_protocol,
M3AP_CauseProtocol_unspecified,
-1);
}
M3AP_DEBUG("Received a new M3 setup request\n");
//M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_M3SetupRequestIEs_t, ie, m3SetupRequest,
// M3AP_ProtocolIE_ID_id_GlobalENB_ID, true);
//if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
//} else {
// if (ie->value.choice.GlobalENB_ID.eNB_ID.present == M3AP_ENB_ID_PR_macro_eNB_ID) {
// // Home eNB ID = 28 bits
// uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
// if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 28) {
// //TODO: handle case were size != 28 -> notify ? reject ?
// }
// eNB_id = (eNB_id_buf[0] << 20) + (eNB_id_buf[1] << 12) + (eNB_id_buf[2] << 4) + ((eNB_id_buf[3] & 0xf0) >> 4);
// M3AP_DEBUG("Home eNB id: %07x\n", eNB_id);
// } else {
// // Macro eNB = 20 bits
// uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
// if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 20) {
// //TODO: handle case were size != 20 -> notify ? reject ?
// }
// eNB_id = (eNB_id_buf[0] << 12) + (eNB_id_buf[1] << 4) + ((eNB_id_buf[2] & 0xf0) >> 4);
// M3AP_DEBUG("macro eNB id: %05x\n", eNB_id);
// }
//}
M3AP_DEBUG("Adding eNB to the list of associated eNBs\n");
if ((m3ap_eNB_data = m3ap_is_eNB_id_in_list (eNB_id)) == NULL) {
/*
* eNB has not been found in list of associated eNB,
* * * * Add it to the tail of list and initialize data
*/
if ((m3ap_eNB_data = m3ap_is_eNB_assoc_id_in_list (assoc_id)) == NULL) {
/*
* ??
*/
return -1;
} else {
m3ap_eNB_data->state = M3AP_ENB_STATE_RESETTING;
m3ap_eNB_data->eNB_id = eNB_id;
}
} else {
m3ap_eNB_data->state = M3AP_ENB_STATE_RESETTING;
/*
* eNB has been found in list, consider the m3 setup request as a reset connection,
* * * * reseting any previous UE state if sctp association is != than the previous one
*/
if (m3ap_eNB_data->assoc_id != assoc_id) {
/*
* ??: Send an overload cause...
*/
M3AP_ERROR("Rejecting m3 setup request as eNB id %d is already associated to an active sctp association" "Previous known: %d, new one: %d\n", eNB_id, m3ap_eNB_data->assoc_id, assoc_id);
m3ap_eNB_generate_m3_setup_failure (instance,
assoc_id,
M3AP_Cause_PR_protocol,
M3AP_CauseProtocol_unspecified,
-1);
return -1;
}
/*
* TODO: call the reset procedure
*/
}
/* Set proper pci */
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_M3SetupRequest_IEs_t, ie, m2SetupRequest,
// M3AP_ProtocolIE_ID_id_ServedCells, true);
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
// if (ie->value.choice.ServedCells.list.count > 0) {
// m3ap_eNB_data->num_cc = ie->value.choice.ServedCells.list.count;
// for (int i=0; i<ie->value.choice.ServedCells.list.count;i++) {
// servedCellMember = (ServedCells__Member *)ie->value.choice.ServedCells.list.array[i];
// m3ap_eNB_data->Nid_cell[i] = servedCellMember->servedCellInfo.pCI;
// }
// }
//
instance_p = m3ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
return m3ap_eNB_generate_m3_setup_response(instance_p, m3ap_eNB_data);
}
static
int m3ap_eNB_handle_m3_setup_response(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
M3AP_M3AP_PDU_t *pdu)
{
M3AP_M3SetupResponse_t *m3SetupResponse;
//M3AP_M3SetupResponseIEs_t *ie;
//ServedCells__Member *servedCellMember;
m3ap_eNB_instance_t *instance_p;
m3ap_eNB_data_t *m3ap_eNB_data;
//uint32_t eNB_id = 0;
DevAssert (pdu != NULL);
m3SetupResponse = &pdu->choice.successfulOutcome.value.choice.M3SetupResponse;
/*
* We received a new valid M3 Setup Response on a stream != 0.
* * * * This should not happen -> reject eNB m3 setup response.
*/
if (stream != 0) {
M3AP_ERROR("Received new m3 setup response on stream != 0\n");
}
if ((m3ap_eNB_data = m3ap_get_eNB(NULL, assoc_id, 0)) == NULL) {
M3AP_ERROR("[SCTP %d] Received M3 setup response for non existing "
"eNB context\n", assoc_id);
return -1;
}
M3AP_DEBUG("Received a new M3 setup response\n");
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_M3SetupResponseIEs_t, ie, m3SetupResponse,
// M3AP_ProtocolIE_ID_id_GlobalENB_ID, true);
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
// if (ie->value.choice.GlobalENB_ID.eNB_ID.present == M3AP_ENB_ID_PR_macro_eNB_ID) {
// // Home eNB ID = 28 bits
// uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
//
// if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 28) {
// //TODO: handle case were size != 28 -> notify ? reject ?
// }
//
// eNB_id = (eNB_id_buf[0] << 20) + (eNB_id_buf[1] << 12) + (eNB_id_buf[2] << 4) + ((eNB_id_buf[3] & 0xf0) >> 4);
// M3AP_DEBUG("Home eNB id: %07x\n", eNB_id);
// } else {
// // Macro eNB = 20 bits
// uint8_t *eNB_id_buf = ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
//
// if (ie->value.choice.GlobalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 20) {
// //TODO: handle case were size != 20 -> notify ? reject ?
// }
//
// eNB_id = (eNB_id_buf[0] << 12) + (eNB_id_buf[1] << 4) + ((eNB_id_buf[2] & 0xf0) >> 4);
// M3AP_DEBUG("macro eNB id: %05x\n", eNB_id);
// }
//
M3AP_DEBUG("Adding eNB to the list of associated eNBs\n");
// if ((m3ap_eNB_data = m3ap_is_eNB_id_in_list (eNB_id)) == NULL) {
// /*
// * eNB has not been found in list of associated eNB,
// * * * * Add it to the tail of list and initialize data
// */
// if ((m3ap_eNB_data = m3ap_is_eNB_assoc_id_in_list (assoc_id)) == NULL) {
// /*
// * ??: Send an overload cause...
// */
// return -1;
// } else {
// m3ap_eNB_data->state = M3AP_ENB_STATE_RESETTING;
// m3ap_eNB_data->eNB_id = eNB_id;
// }
// } else {
// m3ap_eNB_data->state = M3AP_ENB_STATE_RESETTING;
// /*
// * TODO: call the reset procedure
// */
// }
//
/* Set proper pci */
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_M3SetupResponse_IEs_t, ie, m2SetupResponse,
// M3AP_ProtocolIE_ID_id_ServedCells, true);
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// if (ie->value.choice.ServedCells.list.count > 0) {
// m3ap_eNB_data->num_cc = ie->value.choice.ServedCells.list.count;
// for (int i=0; i<ie->value.choice.ServedCells.list.count;i++) {
// servedCellMember = (ServedCells__Member *)ie->value.choice.ServedCells.list.array[i];
// m3ap_eNB_data->Nid_cell[i] = servedCellMember->servedCellInfo.pCI;
// }
// }
//
/* Optionaly set the target eNB name */
/* The association is now ready as source and target eNBs know parameters of each other.
* Mark the association as connected.
*/
m3ap_eNB_data->state = M3AP_ENB_STATE_READY;
instance_p = m3ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
instance_p->m3_target_enb_associated_nb ++;
m3ap_handle_m3_setup_message(instance_p, m3ap_eNB_data, 0);
return 0;
}
static
int m3ap_eNB_handle_m3_setup_failure(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
M3AP_M3AP_PDU_t *pdu)
{
M3AP_M3SetupFailure_t *m3SetupFailure;
M3AP_M3SetupFailureIEs_t *ie;
m3ap_eNB_instance_t *instance_p;
m3ap_eNB_data_t *m3ap_eNB_data;
DevAssert(pdu != NULL);
m3SetupFailure = &pdu->choice.unsuccessfulOutcome.value.choice.M3SetupFailure;
/*
* We received a new valid M3 Setup Failure on a stream != 0.
* * * * This should not happen -> reject eNB m3 setup failure.
*/
if (stream != 0) {
M3AP_WARN("[SCTP %d] Received m3 setup failure on stream != 0 (%d)\n",
assoc_id, stream);
}
if ((m3ap_eNB_data = m3ap_get_eNB (NULL, assoc_id, 0)) == NULL) {
M3AP_ERROR("[SCTP %d] Received M3 setup failure for non existing "
"eNB context\n", assoc_id);
return -1;
}
M3AP_DEBUG("Received a new M3 setup failure\n");
M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_M3SetupFailureIEs_t, ie, m3SetupFailure,
M3AP_ProtocolIE_ID_id_Cause, true);
if (ie == NULL ) {
M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
}
// need a FSM to handle all cases
if ((ie->value.choice.Cause.present == M3AP_Cause_PR_misc) &&
(ie->value.choice.Cause.choice.misc == M3AP_CauseMisc_unspecified)) {
M3AP_WARN("Received M3 setup failure for eNB ... eNB is not ready\n");
} else {
M3AP_ERROR("Received m3 setup failure for eNB... please check your parameters\n");
}
m3ap_eNB_data->state = M3AP_ENB_STATE_WAITING;
instance_p = m3ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
m3ap_handle_m3_setup_message(instance_p, m3ap_eNB_data, 0);
return 0;
}
//static
//int m3ap_eNB_handle_handover_preparation (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu)
//{
//
// M3AP_HandoverRequest_t *x2HandoverRequest;
// M3AP_HandoverRequest_IEs_t *ie;
//
// M3AP_E_RABs_ToBeSetup_ItemIEs_t *e_RABS_ToBeSetup_ItemIEs;
// M3AP_E_RABs_ToBeSetup_Item_t *e_RABs_ToBeSetup_Item;
//
// m3ap_eNB_instance_t *instance_p;
// m3ap_eNB_data_t *m3ap_eNB_data;
// MessageDef *msg;
// int ue_id;
//
// DevAssert (pdu != NULL);
// x2HandoverRequest = &pdu->choice.initiatingMessage.value.choice.HandoverRequest;
//
// if (stream == 0) {
// M3AP_ERROR ("Received new x2 handover request on stream == 0\n");
// /* TODO: send a x2 failure response */
// return 0;
// }
//
// M3AP_DEBUG ("Received a new X2 handover request\n");
//
// m3ap_eNB_data = m3ap_get_eNB(NULL, assoc_id, 0);
// DevAssert(m3ap_eNB_data != NULL);
//
// instance_p = m3ap_eNB_get_instance(instance);
// DevAssert(instance_p != NULL);
//
// msg = itti_alloc_new_message(TASK_M3AP, M3AP_HANDOVER_REQ);
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverRequest_IEs_t, ie, x2HandoverRequest,
// M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID, true);
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// /* allocate a new M3AP UE ID */
// ue_id = m3ap_allocate_new_id(&instance_p->id_manager);
// if (ue_id == -1) {
// M3AP_ERROR("could not allocate a new M3AP UE ID\n");
// /* TODO: cancel handover: send HO preparation failure to source eNB */
// exit(1);
// }
// /* rnti is unknown yet, must not be set to -1, 0 is fine */
// m3ap_set_ids(&instance_p->id_manager, ue_id, 0, ie->value.choice.UE_M3AP_ID, ue_id);
// m3ap_id_set_state(&instance_p->id_manager, ue_id, X2ID_STATE_TARGET);
//
// M3AP_HANDOVER_REQ(msg).m2_id = ue_id;
//
// //M3AP_HANDOVER_REQ(msg).target_physCellId = measResults2->measResultNeighCells->choice.
// //measResultListEUTRA.list.array[ncell_index]->physCellId;
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverRequest_IEs_t, ie, x2HandoverRequest,
// M3AP_ProtocolIE_ID_id_GUMMEI_ID, true);
//
// TBCD_TO_MCC_MNC(&ie->value.choice.ECGI.pLMN_Identity, M3AP_HANDOVER_REQ(msg).ue_gummei.mcc,
// M3AP_HANDOVER_REQ(msg).ue_gummei.mnc, M3AP_HANDOVER_REQ(msg).ue_gummei.mnc_len);
// OCTET_STRING_TO_INT8(&ie->value.choice.GUMMEI.mME_Code, M3AP_HANDOVER_REQ(msg).ue_gummei.mme_code);
// OCTET_STRING_TO_INT16(&ie->value.choice.GUMMEI.gU_Group_ID.mME_Group_ID, M3AP_HANDOVER_REQ(msg).ue_gummei.mme_group_id);
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverRequest_IEs_t, ie, x2HandoverRequest,
// M3AP_ProtocolIE_ID_id_UE_ContextInformation, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// M3AP_HANDOVER_REQ(msg).mme_ue_s1ap_id = ie->value.choice.UE_ContextInformation.mME_UE_S1AP_ID;
//
// /* TODO: properly store Target Cell ID */
//
// M3AP_HANDOVER_REQ(msg).target_assoc_id = assoc_id;
//
// M3AP_HANDOVER_REQ(msg).security_capabilities.encryption_algorithms =
// BIT_STRING_to_uint16(&ie->value.choice.UE_ContextInformation.uESecurityCapabilities.encryptionAlgorithms);
// M3AP_HANDOVER_REQ(msg).security_capabilities.integrity_algorithms =
// BIT_STRING_to_uint16(&ie->value.choice.UE_ContextInformation.uESecurityCapabilities.integrityProtectionAlgorithms);
//
// //M3AP_HANDOVER_REQ(msg).ue_ambr=ue_context_pP->ue_context.ue_ambr;
//
// if ((ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf) &&
// (ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.size == 32)) {
// memcpy(M3AP_HANDOVER_REQ(msg).kenb, ie->value.choice.UE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf, 32);
// M3AP_HANDOVER_REQ(msg).kenb_ncc = ie->value.choice.UE_ContextInformation.aS_SecurityInformation.nextHopChainingCount;
// } else {
// M3AP_WARN ("Size of eNB key star does not match the expected value\n");
// }
//
// if (ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.count > 0) {
//
// M3AP_HANDOVER_REQ(msg).nb_e_rabs_tobesetup = ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.count;
//
// for (int i=0;i<ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.count;i++) {
// e_RABS_ToBeSetup_ItemIEs = (M3AP_E_RABs_ToBeSetup_ItemIEs_t *) ie->value.choice.UE_ContextInformation.e_RABs_ToBeSetup_List.list.array[i];
// e_RABs_ToBeSetup_Item = &e_RABS_ToBeSetup_ItemIEs->value.choice.E_RABs_ToBeSetup_Item;
//
// M3AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].e_rab_id = e_RABs_ToBeSetup_Item->e_RAB_ID ;
//
// memcpy(M3AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].eNB_addr.buffer,
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.buf,
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size);
//
// M3AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].eNB_addr.length =
// e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.size * 8 - e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.transportLayerAddress.bits_unused;
//
// OCTET_STRING_TO_INT32(&e_RABs_ToBeSetup_Item->uL_GTPtunnelEndpoint.gTP_TEID,
// M3AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].gtp_teid);
//
// M3AP_HANDOVER_REQ(msg).e_rab_param[i].qos.qci = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.qCI;
// M3AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.priority_level = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.priorityLevel;
// M3AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionCapability;
// M3AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = e_RABs_ToBeSetup_Item->e_RAB_Level_QoS_Parameters.allocationAndRetentionPriority.pre_emptionVulnerability;
// }
//
// }
// else {
// M3AP_ERROR ("Can't decode the e_RABs_ToBeSetup_List \n");
// }
//
// M3AP_RRC_Context_t *c = &ie->value.choice.UE_ContextInformation.rRC_Context;
//
// if (c->size > 1024 /* TODO: this is the size of rrc_buffer in struct m3ap_handover_req_ack_s*/)
// { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); }
//
// memcpy(M3AP_HANDOVER_REQ(msg).rrc_buffer, c->buf, c->size);
// M3AP_HANDOVER_REQ(msg).rrc_buffer_size = c->size;
//
// itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
//
// return 0;
//}
//
//static
//int m3ap_eNB_handle_handover_response (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu)
//{
// M3AP_HandoverRequestAcknowledge_t *x2HandoverRequestAck;
// M3AP_HandoverRequestAcknowledge_IEs_t *ie;
//
// m3ap_eNB_instance_t *instance_p;
// m3ap_eNB_data_t *m3ap_eNB_data;
// MessageDef *msg;
// int ue_id;
// int id_source;
// int id_target;
// int rnti;
//
// DevAssert (pdu != NULL);
// x2HandoverRequestAck = &pdu->choice.successfulOutcome.value.choice.HandoverRequestAcknowledge;
//
// if (stream == 0) {
// M3AP_ERROR ("Received new x2 handover response on stream == 0\n");
// /* TODO: send a x2 failure response */
// return 0;
// }
//
// M3AP_DEBUG ("Received a new X2 handover response\n");
//
// m3ap_eNB_data = m3ap_get_eNB(NULL, assoc_id, 0);
// DevAssert(m3ap_eNB_data != NULL);
//
// instance_p = m3ap_eNB_get_instance(instance);
// DevAssert(instance_p != NULL);
//
// msg = itti_alloc_new_message(TASK_M3AP, M3AP_HANDOVER_REQ_ACK);
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck,
// M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// id_source = ie->value.choice.UE_M3AP_ID;
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck,
// M3AP_ProtocolIE_ID_id_New_eNB_UE_M3AP_ID, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// id_target = ie->value.choice.UE_M3AP_ID_1;
//
// ue_id = id_source;
//
// if (ue_id != m3ap_find_id_from_id_source(&instance_p->id_manager, id_source)) {
// M3AP_WARN("incorrect/unknown M3AP IDs for UE (old ID %d new ID %d), ignoring handover response\n",
// id_source, id_target);
// return 0;
// }
//
// rnti = m3ap_id_get_rnti(&instance_p->id_manager, ue_id);
//
// /* id_target is a new information, store it */
// m3ap_set_ids(&instance_p->id_manager, ue_id, rnti, id_source, id_target);
// m3ap_id_set_state(&instance_p->id_manager, ue_id, X2ID_STATE_SOURCE_OVERALL);
// m3ap_set_reloc_overall_timer(&instance_p->id_manager, ue_id,
// m3ap_timer_get_tti(&instance_p->timers));
//
// M3AP_HANDOVER_REQ_ACK(msg).rnti = rnti;
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck,
// M3AP_ProtocolIE_ID_id_TargeteNBtoSource_eNBTransparentContainer, true);
//
// M3AP_TargeteNBtoSource_eNBTransparentContainer_t *c = &ie->value.choice.TargeteNBtoSource_eNBTransparentContainer;
//
// if (c->size > 1024 /* TODO: this is the size of rrc_buffer in struct m3ap_handover_req_ack_s*/)
// { printf("%s:%d: fatal: buffer too big\n", __FILE__, __LINE__); abort(); }
//
// memcpy(M3AP_HANDOVER_REQ_ACK(msg).rrc_buffer, c->buf, c->size);
// M3AP_HANDOVER_REQ_ACK(msg).rrc_buffer_size = c->size;
//
// itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
// return 0;
//}
//
//
//static
//int m3ap_eNB_handle_ue_context_release (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu)
//{
// M3AP_UEContextRelease_t *x2UEContextRelease;
// M3AP_UEContextRelease_IEs_t *ie;
//
// m3ap_eNB_instance_t *instance_p;
// m3ap_eNB_data_t *m3ap_eNB_data;
// MessageDef *msg;
// int ue_id;
// int id_source;
// int id_target;
//
// DevAssert (pdu != NULL);
// x2UEContextRelease = &pdu->choice.initiatingMessage.value.choice.UEContextRelease;
//
// if (stream == 0) {
// M3AP_ERROR ("Received new x2 ue context release on stream == 0\n");
// /* TODO: send a x2 failure response */
// return 0;
// }
//
// M3AP_DEBUG ("Received a new X2 ue context release\n");
//
// m3ap_eNB_data = m3ap_get_eNB(NULL, assoc_id, 0);
// DevAssert(m3ap_eNB_data != NULL);
//
// instance_p = m3ap_eNB_get_instance(instance);
// DevAssert(instance_p != NULL);
//
// msg = itti_alloc_new_message(TASK_M3AP, M3AP_UE_CONTEXT_RELEASE);
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_UEContextRelease_IEs_t, ie, x2UEContextRelease,
// M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// id_source = ie->value.choice.UE_M3AP_ID;
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_UEContextRelease_IEs_t, ie, x2UEContextRelease,
// M3AP_ProtocolIE_ID_id_New_eNB_UE_M3AP_ID, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// id_target = ie->value.choice.UE_M3AP_ID_1;
//
// ue_id = id_source;
// if (ue_id != m3ap_find_id_from_id_source(&instance_p->id_manager, id_source)) {
// M3AP_WARN("incorrect/unknown M3AP IDs for UE (old ID %d new ID %d), ignoring UE context release\n",
// id_source, id_target);
// return 0;
// }
//
// if (id_target != m3ap_id_get_id_target(&instance_p->id_manager, ue_id)) {
// M3AP_ERROR("UE context release: bad id_target for UE %x (id_source %d) expected %d got %d, ignoring message\n",
// m3ap_id_get_rnti(&instance_p->id_manager, ue_id),
// id_source,
// m3ap_id_get_id_target(&instance_p->id_manager, ue_id),
// id_target);
// return 0;
// }
//
// M3AP_UE_CONTEXT_RELEASE(msg).rnti = m3ap_id_get_rnti(&instance_p->id_manager, ue_id);
//
// itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
//
// m3ap_release_id(&instance_p->id_manager, ue_id);
//
// return 0;
//}
//
//static
//int m3ap_eNB_handle_handover_cancel (instance_t instance,
// uint32_t assoc_id,
// uint32_t stream,
// M3AP_M3AP_PDU_t *pdu)
//{
// M3AP_HandoverCancel_t *x2HandoverCancel;
// M3AP_HandoverCancel_IEs_t *ie;
//
// m3ap_eNB_instance_t *instance_p;
// m3ap_eNB_data_t *m3ap_eNB_data;
// MessageDef *msg;
// int ue_id;
// int id_source;
// int id_target;
// m3ap_handover_cancel_cause_t cause;
//
// DevAssert (pdu != NULL);
// x2HandoverCancel = &pdu->choice.initiatingMessage.value.choice.HandoverCancel;
//
// if (stream == 0) {
// M3AP_ERROR ("Received new x2 handover cancel on stream == 0\n");
// return 0;
// }
//
// M3AP_DEBUG ("Received a new X2 handover cancel\n");
//
// m3ap_eNB_data = m3ap_get_eNB(NULL, assoc_id, 0);
// DevAssert(m3ap_eNB_data != NULL);
//
// instance_p = m3ap_eNB_get_instance(instance);
// DevAssert(instance_p != NULL);
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverCancel_IEs_t, ie, x2HandoverCancel,
// M3AP_ProtocolIE_ID_id_Old_eNB_UE_M3AP_ID, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// id_source = ie->value.choice.UE_M3AP_ID;
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverCancel_IEs_t, ie, x2HandoverCancel,
// M3AP_ProtocolIE_ID_id_New_eNB_UE_M3AP_ID, false);
//
// if (ie == NULL ) {
// M3AP_INFO("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// id_target = -1;
// } else
// id_target = ie->value.choice.UE_M3AP_ID_1;
//
// M3AP_FIND_PROTOCOLIE_BY_ID(M3AP_HandoverCancel_IEs_t, ie, x2HandoverCancel,
// M3AP_ProtocolIE_ID_id_Cause, true);
//
// if (ie == NULL ) {
// M3AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
// return -1;
// }
//
// if (ie->value.present != M3AP_HandoverCancel_IEs__value_PR_Cause ||
// ie->value.choice.Cause.present != M3AP_Cause_PR_radioNetwork ||
// !(ie->value.choice.Cause.choice.radioNetwork ==
// M3AP_CauseRadioNetwork_trelocprep_expiry ||
// ie->value.choice.Cause.choice.radioNetwork ==
// M3AP_CauseRadioNetwork_tx2relocoverall_expiry)) {
// M3AP_ERROR("%s %d: Cause not supported (only T_reloc_prep and TX2_reloc_overall handled)\n",__FILE__,__LINE__);
// return -1;
// }
//
// switch (ie->value.choice.Cause.choice.radioNetwork) {
// case M3AP_CauseRadioNetwork_trelocprep_expiry:
// cause = M3AP_T_RELOC_PREP_TIMEOUT;
// break;
// case M3AP_CauseRadioNetwork_tx2relocoverall_expiry:
// cause = M3AP_TX2_RELOC_OVERALL_TIMEOUT;
// break;
// default: /* can't come here */ exit(1);
// }
//
// ue_id = m3ap_find_id_from_id_source(&instance_p->id_manager, id_source);
// if (ue_id == -1) {
// M3AP_WARN("Handover cancel: UE not found (id_source = %d), ignoring message\n", id_source);
// return 0;
// }
//
// if (id_target != -1 &&
// id_target != m3ap_id_get_id_target(&instance_p->id_manager, ue_id)) {
// M3AP_ERROR("Handover cancel: bad id_target for UE %x (id_source %d) expected %d got %d\n",
// m3ap_id_get_rnti(&instance_p->id_manager, ue_id),
// id_source,
// m3ap_id_get_id_target(&instance_p->id_manager, ue_id),
// id_target);
// exit(1);
// }
//
// msg = itti_alloc_new_message(TASK_M3AP, M3AP_HANDOVER_CANCEL);
//
// M3AP_HANDOVER_CANCEL(msg).rnti = m3ap_id_get_rnti(&instance_p->id_manager, ue_id);
// M3AP_HANDOVER_CANCEL(msg).cause = cause;
//
// itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
//
// m3ap_release_id(&instance_p->id_manager, ue_id);
//
// return 0;
//}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_handler.h
* \brief m3ap handler procedures for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#ifndef M3AP_ENB_HANDLERS_H_
#define M3AP_ENB_HANDLERS_H_
#include "m3ap_eNB_defs.h"
void m3ap_handle_m3_setup_message(m3ap_eNB_instance_t *instance_p, m3ap_eNB_data_t *eNB_desc_p, int sctp_shutdown);
int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length);
#endif /* M3AP_ENB_HANDLERS_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_itti_messaging.c
* \brief m3ap tasks for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#include "intertask_interface.h"
#include "m3ap_eNB_itti_messaging.h"
void m3ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream)
{
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_M3AP, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void m3ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id)
{
MessageDef *message_p = NULL;
sctp_close_association_t *sctp_close_association_p = NULL;
message_p = itti_alloc_new_message(TASK_M3AP, SCTP_CLOSE_ASSOCIATION);
sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
sctp_close_association_p->assoc_id = assoc_id;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file m3ap_eNB_itti_messaging.h
* \brief m3ap tasks for eNB
* \author Javier Morgade <javier.morgade@ieee.org>
* \date 2019
* \version 0.1
*/
#ifndef M3AP_ENB_ITTI_MESSAGING_H_
#define M3AP_ENB_ITTI_MESSAGING_H_
void m3ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
void m3ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id);
#endif /* M3AP_ENB_ITTI_MESSAGING_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment