Starting to prepare MME UE context release request.

master
Pedro Alvarez 7 years ago
parent 094a7d272f
commit 2e90ce370b

@ -264,9 +264,11 @@ s1ap_ctx_mngmt_proc::handle_initial_context_setup_response(LIBLTE_S1AP_MESSAGE_I
}
bool
s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT *ue_rel, struct sctp_sndrcvinfo *enb_sri, srslte::byte_buffer_t *reply_buffer, bool *reply_flag)
s1ap_ctx_mngmt_proc::handle_ue_context_release_request(uint32_t mme_ue_s1ap_id, srslte::byte_buffer_t *reply_buffer)
{
LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT ue_rel_req;
uint32_t mme_ue_s1ap_id = ue_rel->MME_UE_S1AP_ID.MME_UE_S1AP_ID;
m_s1ap_log->info("Received UE Context Release Request. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id);
m_s1ap_log->console("Received UE Context Release Request. MME-UE S1AP Id %d\n", mme_ue_s1ap_id);
@ -306,4 +308,30 @@ s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECON
return true;
}
bool
s1ap_ctx_mngmt_proc::pack_ue_context_release_request(uint32_t mme_ue_s1ap_id, srslte::byte_buffer_t *reply_buffer)
{
//Prepare reply PDU
LIBLTE_S1AP_S1AP_PDU_STRUCT pdu;
bzero(&pdu, sizeof(LIBLTE_S1AP_S1AP_PDU_STRUCT));
pdu.choice_type = LIBLTE_S1AP_S1AP_PDU_CHOICE_INITIATINGMESSAGE;
LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *init = &pdu.choice.initiatingMessage;
init->procedureCode = LIBLTE_S1AP_PROC_ID_UECONTEXTRELEASEREQUEST;
init->choice_type = LIBLTE_S1AP_INITIATINGMESSAGE_CHOICE_INITIALCONTEXTRELEASEREQUEST;
LIBLTE_S1AP_MESSAGE_UECONTEXTRELEASEREQUEST_STRUCT *ctx_rel_req = &init->choice.UEContextReleaseRequest;
LIBLTE_ERROR_ENUM err = liblte_s1ap_pack_s1ap_pdu(&pdu, (LIBLTE_BYTE_MSG_STRUCT*)reply_buffer);
if(err != LIBLTE_SUCCESS)
{
m_s1ap_log->error("Could not pack Initial Context Setup Request Message\n");
return false;
}
return true;
}
} //namespace srsepc

@ -590,13 +590,26 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi,
ue_emm_ctx->security_ctxt.ul_nas_count++;
mac_valid = short_integrity_check(ue_emm_ctx,nas_msg);
if(mac_valid)
m_s1ap_log->console("Banzai!!!\n");
/*
typedef struct{
LIBLTE_MME_KSI_AND_SEQUENCE_NUMBER_STRUCT ksi_and_seq_num;
uint16 short_mac;
}LIBLTE_MME_SERVICE_REQUEST_MSG_STRUCT;
*/
{
m_s1ap_log->console("Service Request -- Short MAC valid\n");
m_s1ap_log->info("Service Request -- Short MAC valid\n");
ue_ecm_ctx_t ecm_ctx = m_s1ap->find_ue_ecm_ctx_from_mme_ue_s1ap_id(ue_emm_ctx.mme_ue_s1ap_id);
if(ecm_ctx !=NULL)
{
//Service request to Connected UE.
//Delete ECM context and connect.
m_mme_gtpc->send_delete_session_request(ue_ecm_ctx);
pack_context_release_request();
}
else
{
//UE not connect. Connect normally.
}
else
{
m_s1ap_log->console("Service Request -- Short MAC invalid. Re-starting authentication procedure \n");
m_s1ap_log->console("Service Request -- Short MAC invalid. Re-starting authentication procedure \n");
}
return true;
}
bool
@ -866,7 +879,110 @@ s1ap_nas_transport::handle_tracking_area_update_request(srslte::byte_buffer_t *n
m_s1ap_log->console("Tracking area accept to MME-UE S1AP Id %d\n", ue_ecm_ctx->mme_ue_s1ap_id);
LIBLTE_MME_TRACKING_AREA_UPDATE_ACCEPT_MSG_STRUCT tau_acc;
bool t3412_present;
bool guti_present;
bool tai_list_present;
bool eps_bearer_context_status_present;
bool lai_present;
bool ms_id_present;
bool emm_cause_present;
bool t3402_present;
bool t3423_present;
bool equivalent_plmns_present;
bool emerg_num_list_present;
bool eps_network_feature_support_present;
bool additional_update_result_present;
bool t3412_ext_present;
//Get decimal MCC and MNC
uint32_t mcc = 0;
mcc += 0x000F & m_s1ap->m_s1ap_args.mcc;
mcc += 10*( (0x00F0 & m_s1ap->m_s1ap_args.mcc) >> 4);
mcc += 100*( (0x0F00 & m_s1ap->m_s1ap_args.mcc) >> 8);
uint32_t mnc = 0;
if( 0xFF00 == (m_s1ap->m_s1ap_args.mnc & 0xFF00 ))
{
//Two digit MNC
mnc += 0x000F & m_s1ap->m_s1ap_args.mnc;
mnc += 10*((0x00F0 & m_s1ap->m_s1ap_args.mnc) >> 4);
}
else
{
//Three digit MNC
mnc += 0x000F & m_s1ap->m_s1ap_args.mnc;
mnc += 10*((0x00F0 & m_s1ap->m_s1ap_args.mnc) >> 4);
mnc += 100*((0x0F00 & m_s1ap->m_s1ap_args.mnc) >> 8);
}
//T3412 Timer
tau_acc.t3412_present = true;
tau_acc.t3412.unit = LIBLTE_MME_GPRS_TIMER_UNIT_1_MINUTE; // GPRS 1 minute unit
tau_acc.t3412.value = 30; // 30 minute periodic timer
//GUTI
tau_acc.guti_present=true;
tau_acc.guti.type_of_id = 6; //110 -> GUTI
tau_acc.guti.guti.mcc = mcc;
tau_acc.guti.guti.mnc = mnc;
tau_acc.guti.guti.mme_group_id = m_s1ap->m_s1ap_args.mme_group;
tau_acc.guti.guti.mme_code = m_s1ap->m_s1ap_args.mme_code;
tau_acc.guti.guti.m_tmsi = 0xF000;
m_s1ap_log->debug("Allocated GUTI: MCC %d, MNC %d, MME Group Id %d, MME Code 0x%x, M-TMSI 0x%x\n",
tau_acc.guti.guti.mcc,
tau_acc.guti.guti.mnc,
tau_acc.guti.guti.mme_group_id,
tau_acc.guti.guti.mme_code,
tau_acc.guti.guti.m_tmsi);
//Unused Options
tau_acc.t3402_present = false;
tau_acc.t3423_present = false;
tau_acc.equivalent_plmns_present = false;
tau_acc.emerg_num_list_present = false;
tau_acc.eps_network_feature_support_present = false;
tau_acc.additional_update_result_present = false;
tau_acc.t3412_ext_present = false;
//eps_update_result = LIBLTE_MME_TR
/*
typedef struct{
LIBLTE_MME_GPRS_TIMER_STRUCT t3412;
LIBLTE_MME_EPS_MOBILE_ID_STRUCT guti;
LIBLTE_MME_TRACKING_AREA_IDENTITY_LIST_STRUCT tai_list;
LIBLTE_MME_EPS_BEARER_CONTEXT_STATUS_STRUCT eps_bearer_context_status;
LIBLTE_MME_LOCATION_AREA_ID_STRUCT lai;
LIBLTE_MME_MOBILE_ID_STRUCT ms_id;
LIBLTE_MME_GPRS_TIMER_STRUCT t3402;
LIBLTE_MME_GPRS_TIMER_STRUCT t3423;
LIBLTE_MME_PLMN_LIST_STRUCT equivalent_plmns;
LIBLTE_MME_EMERGENCY_NUMBER_LIST_STRUCT emerg_num_list;
LIBLTE_MME_EPS_NETWORK_FEATURE_SUPPORT_STRUCT eps_network_feature_support;
LIBLTE_MME_GPRS_TIMER_3_STRUCT t3412_ext;
LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_ENUM additional_update_result;
uint8 eps_update_result;
uint8 emm_cause;
bool t3412_present;
bool guti_present;
bool tai_list_present;
bool eps_bearer_context_status_present;
bool lai_present;
bool ms_id_present;
bool emm_cause_present;
bool t3402_present;
bool t3423_present;
bool equivalent_plmns_present;
bool emerg_num_list_present;
bool eps_network_feature_support_present;
bool additional_update_result_present;
bool t3412_ext_present;v
}LIBLTE_MME_TRACKING_AREA_UPDATE_ACCEPT_MSG_STRUCT;
*/
//Send reply to eNB
//*reply_flag = true;

Loading…
Cancel
Save