hnbap: Print error messages in error cases

This commit is contained in:
Harald Welte 2015-09-11 17:03:16 +02:00
parent 10dfc5a97d
commit 3af1db87ed
3 changed files with 104 additions and 0 deletions

View File

@ -6,6 +6,86 @@
#include "hnbap_common.h"
#include "hnbgw.h"
static const struct value_string hnbap_cause_radio_vals[] = {
{ CauseRadioNetwork_overload, "overload" },
{ CauseRadioNetwork_unauthorised_Location, "unauthorized location" },
{ CauseRadioNetwork_unauthorised_HNB, "unauthorized HNB" },
{ CauseRadioNetwork_hNB_parameter_mismatch, "HNB parameter mismatch" },
{ CauseRadioNetwork_invalid_UE_identity, "invalid UE identity" },
{ CauseRadioNetwork_uE_not_allowed_on_this_HNB,
"UE not allowed on this HNB" },
{ CauseRadioNetwork_uE_unauthorised, "unauthorised UE" },
{ CauseRadioNetwork_connection_with_UE_lost, "connection with UE lost" },
{ CauseRadioNetwork_ue_RRC_release, "UE RRC release" },
{ CauseRadioNetwork_hNB_not_registered, "HNB not registered" },
{ CauseRadioNetwork_unspecified, "unspecified" },
{ CauseRadioNetwork_normal, "normal" },
{ CauseRadioNetwork_uE_relocated, "UE relocated" },
{ CauseRadioNetwork_ue_registered_in_another_HNB,
"UE registered in another HNB" },
{ 0, NULL }
};
static const struct value_string hnbap_cause_transp_vals[] = {
{ CauseTransport_transport_resource_unavailable,
"transport resource unavailable" },
{ CauseTransport_unspecified, "unspecified" },
{ 0, NULL }
};
static const struct value_string hnbap_cause_prot_vals[] = {
{ CauseProtocol_transfer_syntax_error, "syntax error" },
{ CauseProtocol_abstract_syntax_error_reject,
"abstract syntax error; reject" },
{ CauseProtocol_abstract_syntax_error_ignore_and_notify,
"abstract syntax error; ignore and notify" },
{ CauseProtocol_message_not_compatible_with_receiver_state,
"message not compatible with receiver state" },
{ CauseProtocol_semantic_error, "semantic error" },
{ CauseProtocol_unspecified, "unspecified" },
{ CauseProtocol_abstract_syntax_error_falsely_constructed_message,
"falsely constructed message" },
{ 0, NULL }
};
static const struct value_string hnbap_cause_misc_vals[] = {
{ CauseMisc_processing_overload, "processing overload" },
{ CauseMisc_hardware_failure, "hardware failure" },
{ CauseMisc_o_and_m_intervention, "OAM intervention" },
{ CauseMisc_unspecified, "unspecified" },
{ 0, NULL }
};
char *hnbap_cause_str(Cause_t *cause)
{
static char buf[32];
switch (cause->present) {
case Cause_PR_radioNetwork:
snprintf(buf, sizeof(buf), "radio(%s)",
get_value_string(hnbap_cause_radio_vals,
cause->choice.radioNetwork));
break;
case Cause_PR_transport:
snprintf(buf, sizeof(buf), "transport(%s)",
get_value_string(hnbap_cause_transp_vals,
cause->choice.transport));
break;
case Cause_PR_protocol:
snprintf(buf, sizeof(buf), "protocol(%s)",
get_value_string(hnbap_cause_prot_vals,
cause->choice.protocol));
break;
case Cause_PR_misc:
snprintf(buf, sizeof(buf), "misc(%s)",
get_value_string(hnbap_cause_misc_vals,
cause->choice.misc));
break;
}
return buf;
}
int asn_debug = 0;
int asn1_xer_print = 0;

View File

@ -144,3 +144,4 @@ struct msgb *hnbap_generate_successful_outcome(
IE_t *hnbap_new_ie(ProtocolIE_ID_t id, Criticality_t criticality,
asn_TYPE_descriptor_t *type, void *sptr);
char *hnbap_cause_str(Cause_t *cause);

View File

@ -192,6 +192,21 @@ static int hnbgw_rx_ue_register_req(struct hnb_context *ctx, ANY_t *in)
return hnbgw_tx_ue_register_acc(ue);
}
static int hnbgw_rx_err_ind(struct hnb_context *hnb, ANY_t *in)
{
ErrorIndicationIEs_t ies;
int rc;
rc = hnbap_decode_hnbregisterrequesties(&ies, in);
if (rc < 0)
return rc;
LOGP(DMAIN, LOGL_NOTICE, "HNBAP ERROR.ind, cause: %s\n",
hnbap_cause_str(&ies.cause));
return 0;
}
static int hnbgw_rx_initiating_msg(struct hnb_context *hnb, InitiatingMessage_t *imsg)
{
int rc;
@ -208,13 +223,19 @@ static int hnbgw_rx_initiating_msg(struct hnb_context *hnb, InitiatingMessage_t
case ProcedureCode_id_UEDe_Register: /* 8.5 */
break;
case ProcedureCode_id_ErrorIndication: /* 8.6 */
rc = hnbgw_rx_err_ind(hnb, &imsg->value);
break;
case ProcedureCode_id_TNLUpdate: /* 8.9 */
case ProcedureCode_id_HNBConfigTransfer: /* 8.10 */
case ProcedureCode_id_RelocationComplete: /* 8.11 */
case ProcedureCode_id_U_RNTIQuery: /* 8.12 */
case ProcedureCode_id_privateMessage:
LOGP(DMAIN, LOGL_NOTICE, "Unimplemented HNBAP Procedure %u\n",
imsg->procedureCode);
break;
default:
LOGP(DMAIN, LOGL_NOTICE, "Unknown HNBAP Procedure %u\n",
imsg->procedureCode);
break;
}
}
@ -247,6 +268,8 @@ static int _hnbgw_hnbap_rx(struct hnb_context *hnb, HNBAP_PDU_t *pdu)
rc = hnbgw_rx_unsuccessful_outcome_msg(hnb, &pdu->choice.unsuccessfulOutcome);
break;
default:
LOGP(DMAIN, LOGL_NOTICE, "Unknown HNBAP Presence %u\n",
pdu->present);
return -1;
}
}