Commit 70ec9483 authored by gauthier's avatar gauthier

Changed macro macro_enb to CGI cell id.


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7677 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d5bd3f47
...@@ -67,6 +67,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -67,6 +67,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
struct s1ap_message_s *message_p); struct s1ap_message_s *message_p);
static
int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
static static
int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
...@@ -94,7 +99,7 @@ s1ap_message_decoded_callback messages_callback[][3] = { ...@@ -94,7 +99,7 @@ s1ap_message_decoded_callback messages_callback[][3] = {
{ 0, 0, 0 }, /* initialUEMessage */ { 0, 0, 0 }, /* initialUEMessage */
{ 0, 0, 0 }, /* uplinkNASTransport */ { 0, 0, 0 }, /* uplinkNASTransport */
{ 0, 0, 0 }, /* Reset */ { 0, 0, 0 }, /* Reset */
{ 0, 0, 0 }, /* ErrorIndication */ { s1ap_eNB_handle_error_indication, 0, 0 }, /* ErrorIndication */
{ 0, 0, 0 }, /* NASNonDeliveryIndication */ { 0, 0, 0 }, /* NASNonDeliveryIndication */
{ 0, s1ap_eNB_handle_s1_setup_response, s1ap_eNB_handle_s1_setup_failure }, /* S1Setup */ { 0, s1ap_eNB_handle_s1_setup_response, s1ap_eNB_handle_s1_setup_failure }, /* S1Setup */
{ 0, 0, 0 }, /* UEContextReleaseRequest */ { 0, 0, 0 }, /* UEContextReleaseRequest */
...@@ -418,6 +423,264 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, ...@@ -418,6 +423,264 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
return 0; return 0;
} }
static
int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
{
S1ap_ErrorIndicationIEs_t *s1_error_indication_p;
s1ap_eNB_mme_data_t *mme_desc_p;
DevAssert(message_p != NULL);
s1_error_indication_p = &message_p->msg.s1ap_ErrorIndicationIEs;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */
if (stream != 0) {
S1AP_WARN("[SCTP %d] Received s1 Error indication on stream != 0 (%d)\n",
assoc_id, stream);
}
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
S1AP_ERROR("[SCTP %d] Received S1 Error indication for non existing "
"MME context\n", assoc_id);
return -1;
}
if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_MME_UE_S1AP_ID_PRESENT) {
S1AP_WARN("Received S1 Error indication MME UE S1AP ID 0x%x\n", s1_error_indication_p->mme_ue_s1ap_id);
}
if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_ENB_UE_S1AP_ID_PRESENT) {
S1AP_WARN("Received S1 Error indication eNB UE S1AP ID 0x%x\n", s1_error_indication_p->eNB_UE_S1AP_ID);
}
if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_CAUSE_PRESENT) {
switch(s1_error_indication_p->cause.present) {
case S1ap_Cause_PR_NOTHING:
S1AP_WARN("Received S1 Error indication cause NOTHING\n");
break;
case S1ap_Cause_PR_radioNetwork:
switch (s1_error_indication_p->cause.choice.radioNetwork) {
case S1ap_CauseRadioNetwork_unspecified:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unspecified\n");
break;
case S1ap_CauseRadioNetwork_tx2relocoverall_expiry:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tx2relocoverall_expiry\n");
break;
case S1ap_CauseRadioNetwork_successful_handover:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_successful_handover\n");
break;
case S1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason\n");
break;
case S1ap_CauseRadioNetwork_handover_cancelled:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_handover_cancelled\n");
break;
case S1ap_CauseRadioNetwork_partial_handover:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_partial_handover\n");
break;
case S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n");
break;
case S1ap_CauseRadioNetwork_ho_target_not_allowed:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ho_target_not_allowed\n");
break;
case S1ap_CauseRadioNetwork_tS1relocoverall_expiry:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tS1relocoverall_expiry\n");
break;
case S1ap_CauseRadioNetwork_tS1relocprep_expiry:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tS1relocprep_expiry\n");
break;
case S1ap_CauseRadioNetwork_cell_not_available:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_cell_not_available\n");
break;
case S1ap_CauseRadioNetwork_unknown_targetID:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_targetID\n");
break;
case S1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n");
break;
case S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id\n");
break;
case S1ap_CauseRadioNetwork_unknown_enb_ue_s1ap_id:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_enb_ue_s1ap_id\n");
break;
case S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id\n");
break;
case S1ap_CauseRadioNetwork_handover_desirable_for_radio_reason:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_handover_desirable_for_radio_reason\n");
break;
case S1ap_CauseRadioNetwork_time_critical_handover:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_time_critical_handover\n");
break;
case S1ap_CauseRadioNetwork_resource_optimisation_handover:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_resource_optimisation_handover\n");
break;
case S1ap_CauseRadioNetwork_reduce_load_in_serving_cell:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_reduce_load_in_serving_cell\n");
break;
case S1ap_CauseRadioNetwork_user_inactivity:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_user_inactivity\n");
break;
case S1ap_CauseRadioNetwork_radio_connection_with_ue_lost:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_radio_connection_with_ue_lost\n");
break;
case S1ap_CauseRadioNetwork_load_balancing_tau_required:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_load_balancing_tau_required\n");
break;
case S1ap_CauseRadioNetwork_cs_fallback_triggered:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_cs_fallback_triggered\n");
break;
case S1ap_CauseRadioNetwork_ue_not_available_for_ps_service:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ue_not_available_for_ps_service\n");
break;
case S1ap_CauseRadioNetwork_radio_resources_not_available:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_radio_resources_not_available\n");
break;
case S1ap_CauseRadioNetwork_failure_in_radio_interface_procedure:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_failure_in_radio_interface_procedure\n");
break;
case S1ap_CauseRadioNetwork_invals1ap_id_qos_combination:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_invals1ap_id_qos_combination\n");
break;
case S1ap_CauseRadioNetwork_interrat_redirection:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_interrat_redirection\n");
break;
case S1ap_CauseRadioNetwork_interaction_with_other_procedure:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_interaction_with_other_procedure\n");
break;
case S1ap_CauseRadioNetwork_unknown_E_RAB_ID:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_E_RAB_ID\n");
break;
case S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances\n");
break;
case S1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n");
break;
case S1ap_CauseRadioNetwork_s1_intra_system_handover_triggered:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_s1_intra_system_handover_triggered\n");
break;
case S1ap_CauseRadioNetwork_s1_inter_system_handover_triggered:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_s1_inter_system_handover_triggered\n");
break;
case S1ap_CauseRadioNetwork_x2_handover_triggered:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_x2_handover_triggered\n");
break;
case S1ap_CauseRadioNetwork_redirection_towards_1xRTT:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_redirection_towards_1xRTT\n");
break;
case S1ap_CauseRadioNetwork_not_supported_QCI_value:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_not_supported_QCI_value\n");
break;
case S1ap_CauseRadioNetwork_invals1ap_id_CSG_Id:
S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_invals1ap_id_CSG_Id\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause radio network case not handled\n");
}
break;
case S1ap_Cause_PR_transport:
switch (s1_error_indication_p->cause.choice.transport) {
case S1ap_CauseTransport_transport_resource_unavailable:
S1AP_WARN("Received S1 Error indication S1ap_CauseTransport_transport_resource_unavailable\n");
break;
case S1ap_CauseTransport_unspecified:
S1AP_WARN("Received S1 Error indication S1ap_CauseTransport_unspecified\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause transport case not handled\n");
}
break;
case S1ap_Cause_PR_nas:
switch (s1_error_indication_p->cause.choice.nas) {
case S1ap_CauseNas_normal_release:
S1AP_WARN("Received S1 Error indication S1ap_CauseNas_normal_release\n");
break;
case S1ap_CauseNas_authentication_failure:
S1AP_WARN("Received S1 Error indication S1ap_CauseNas_authentication_failure\n");
break;
case S1ap_CauseNas_detach:
S1AP_WARN("Received S1 Error indication S1ap_CauseNas_detach\n");
break;
case S1ap_CauseNas_unspecified:
S1AP_WARN("Received S1 Error indication S1ap_CauseNas_unspecified\n");
break;
case S1ap_CauseNas_csg_subscription_expiry:
S1AP_WARN("Received S1 Error indication S1ap_CauseNas_csg_subscription_expiry\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause nas case not handled\n");
}
break;
case S1ap_Cause_PR_protocol:
switch (s1_error_indication_p->cause.choice.protocol) {
case S1ap_CauseProtocol_transfer_syntax_error:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_transfer_syntax_error\n");
break;
case S1ap_CauseProtocol_abstract_syntax_error_reject:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_reject\n");
break;
case S1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify\n");
break;
case S1ap_CauseProtocol_message_not_compatible_with_receiver_state:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_message_not_compatible_with_receiver_state\n");
break;
case S1ap_CauseProtocol_semantic_error:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_semantic_error\n");
break;
case S1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n");
break;
case S1ap_CauseProtocol_unspecified:
S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_unspecified\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause protocol case not handled\n");
}
break;
case S1ap_Cause_PR_misc:
switch (s1_error_indication_p->cause.choice.protocol) {
case S1ap_CauseMisc_control_processing_overload:
S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_control_processing_overload\n");
break;
case S1ap_CauseMisc_not_enough_user_plane_processing_resources:
S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_not_enough_user_plane_processing_resources\n");
break;
case S1ap_CauseMisc_hardware_failure:
S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_hardware_failure\n");
break;
case S1ap_CauseMisc_om_intervention:
S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_om_intervention\n");
break;
case S1ap_CauseMisc_unspecified:
S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_unspecified\n");
break;
case S1ap_CauseMisc_unknown_PLMN:
S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_unknown_PLMN\n");
break;
default:
S1AP_WARN("Received S1 Error indication cause misc case not handled\n");
}
break;
}
}
if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) {
// TODO continue
}
// TODO continue
return 0;
}
static static
int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
......
...@@ -155,7 +155,7 @@ int s1ap_eNB_handle_nas_first_req( ...@@ -155,7 +155,7 @@ int s1ap_eNB_handle_nas_first_req(
initial_ue_message_p->rrC_Establishment_Cause = s1ap_nas_first_req_p->establishment_cause; initial_ue_message_p->rrC_Establishment_Cause = s1ap_nas_first_req_p->establishment_cause;
if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) { if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) {
S1AP_DEBUG("S_TMSI_PRESENT"); S1AP_DEBUG("S_TMSI_PRESENT\n");
initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_S_TMSI_PRESENT; initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_S_TMSI_PRESENT;
MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code, MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code,
...@@ -165,7 +165,7 @@ int s1ap_eNB_handle_nas_first_req( ...@@ -165,7 +165,7 @@ int s1ap_eNB_handle_nas_first_req(
} }
if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) { if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) {
S1AP_DEBUG("GUMMEI_ID_PRESENT"); S1AP_DEBUG("GUMMEI_ID_PRESENT\n");
initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_GUMMEI_ID_PRESENT; initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_GUMMEI_ID_PRESENT;
MCC_MNC_TO_PLMNID( MCC_MNC_TO_PLMNID(
...@@ -191,7 +191,9 @@ int s1ap_eNB_handle_nas_first_req( ...@@ -191,7 +191,9 @@ int s1ap_eNB_handle_nas_first_req(
* The cell identity is defined on 28 bits but as we use macro enb id, * The cell identity is defined on 28 bits but as we use macro enb id,
* we have to pad. * we have to pad.
*/ */
#warning "TODO get cell id from RRC"
MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id, MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id,
0, // Cell ID
&initial_ue_message_p->eutran_cgi.cell_ID); &initial_ue_message_p->eutran_cgi.cell_ID);
MCC_MNC_TO_TBCD(instance_p->mcc, MCC_MNC_TO_TBCD(instance_p->mcc,
instance_p->mnc, instance_p->mnc,
...@@ -389,7 +391,9 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ ...@@ -389,7 +391,9 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_
s1ap_eNB_instance_p->mnc_digit_length, s1ap_eNB_instance_p->mnc_digit_length,
&uplink_NAS_transport_p->eutran_cgi.pLMNidentity); &uplink_NAS_transport_p->eutran_cgi.pLMNidentity);
#warning "TODO get cell id from RRC"
MACRO_ENB_ID_TO_CELL_IDENTITY(s1ap_eNB_instance_p->eNB_id, MACRO_ENB_ID_TO_CELL_IDENTITY(s1ap_eNB_instance_p->eNB_id,
0,
&uplink_NAS_transport_p->eutran_cgi.cell_ID); &uplink_NAS_transport_p->eutran_cgi.cell_ID);
/* MCC/MNC should be repeated in TAI and EUTRAN CGI */ /* MCC/MNC should be repeated in TAI and EUTRAN CGI */
......
...@@ -259,6 +259,13 @@ do { \ ...@@ -259,6 +259,13 @@ do { \
+ pLMN.MNCdigit2 * 10 + pLMN.MNCdigit1; \ + pLMN.MNCdigit2 * 10 + pLMN.MNCdigit1; \
} while(0) } while(0)
/* TS 36.413 v10.9.0 section 9.2.1.37:
* Macro eNB ID:
* Equal to the 20 leftmost bits of the Cell
* Identity IE contained in the E-UTRAN CGI
* IE (see subclause 9.2.1.38) of each cell
* served by the eNB.
*/
#define MACRO_ENB_ID_TO_BIT_STRING(mACRO, bITsTRING) \ #define MACRO_ENB_ID_TO_BIT_STRING(mACRO, bITsTRING) \
do { \ do { \
(bITsTRING)->buf = calloc(3, sizeof(uint8_t)); \ (bITsTRING)->buf = calloc(3, sizeof(uint8_t)); \
...@@ -268,14 +275,20 @@ do { \ ...@@ -268,14 +275,20 @@ do { \
(bITsTRING)->size = 3; \ (bITsTRING)->size = 3; \
(bITsTRING)->bits_unused = 4; \ (bITsTRING)->bits_unused = 4; \
} while(0) } while(0)
/*
#define MACRO_ENB_ID_TO_CELL_IDENTITY(mACRO, bITsTRING) \ /* TS 36.413 v10.9.0 section 9.2.1.38:
* E-UTRAN CGI/Cell Identity
* The leftmost bits of the Cell
* Identity correspond to the eNB
* ID (defined in subclause 9.2.1.37).
*/
#define MACRO_ENB_ID_TO_CELL_IDENTITY(mACRO, cELL_iD, bITsTRING) \
do { \ do { \
(bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \ (bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = 0; \ (bITsTRING)->buf[0] = ((mACRO) >> 12); \
(bITsTRING)->buf[1] = ((mACRO) >> 12); \ (bITsTRING)->buf[1] = (mACRO) >> 4; \
(bITsTRING)->buf[2] = (mACRO) >> 4; \ (bITsTRING)->buf[2] = (((mACRO) & 0x0f) << 4) | ((cELL_iD) >> 4); \
(bITsTRING)->buf[3] = ((mACRO) & 0x0f) << 4; \ (bITsTRING)->buf[3] = ((cELL_iD) & 0x0f) << 4; \
(bITsTRING)->size = 4; \ (bITsTRING)->size = 4; \
(bITsTRING)->bits_unused = 4; \ (bITsTRING)->bits_unused = 4; \
} while(0) } while(0)
......
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