Review at https://gerrit.osmocom.org/2473
gprs: add value strings for NS PDU type Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Related: SYS#3610 --- M include/osmocom/gprs/protocol/gsm_08_16.h M src/gb/gprs_ns.c M src/gb/libosmogb.map 3 files changed, 28 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/2473/1 diff --git a/include/osmocom/gprs/protocol/gsm_08_16.h b/include/osmocom/gprs/protocol/gsm_08_16.h index 8b2ac56..59d29ab 100644 --- a/include/osmocom/gprs/protocol/gsm_08_16.h +++ b/include/osmocom/gprs/protocol/gsm_08_16.h @@ -18,6 +18,8 @@ uint8_t data[0]; /*!< variable-length payload */ } __attribute__((packed)); +extern const struct value_string ns_pdu_strings[]; + /*! \brief NS PDU Type (TS 08.16, Section 10.3.7, Table 14) */ enum ns_pdu_type { NS_PDUT_UNITDATA = 0x00, diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 0649899..3350f33 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -296,6 +296,28 @@ osmo_signal_dispatch(SS_L_NS, S_NS_REPLACED, &nssd); } +const struct value_string ns_pdu_strings[] = { + OSMO_VALUE_STRING(NS_PDUT_UNITDATA), + OSMO_VALUE_STRING(NS_PDUT_RESET), + OSMO_VALUE_STRING(NS_PDUT_RESET_ACK), + OSMO_VALUE_STRING(NS_PDUT_BLOCK), + OSMO_VALUE_STRING(NS_PDUT_BLOCK_ACK), + OSMO_VALUE_STRING(NS_PDUT_UNBLOCK), + OSMO_VALUE_STRING(NS_PDUT_UNBLOCK_ACK), + OSMO_VALUE_STRING(NS_PDUT_STATUS), + OSMO_VALUE_STRING(NS_PDUT_ALIVE), + OSMO_VALUE_STRING(NS_PDUT_ALIVE_ACK), + OSMO_VALUE_STRING(SNS_PDUT_ACK), + OSMO_VALUE_STRING(SNS_PDUT_ADD), + OSMO_VALUE_STRING(SNS_PDUT_CHANGE_WEIGHT), + OSMO_VALUE_STRING(SNS_PDUT_CONFIG), + OSMO_VALUE_STRING(SNS_PDUT_CONFIG_ACK), + OSMO_VALUE_STRING(SNS_PDUT_DELETE), + OSMO_VALUE_STRING(SNS_PDUT_SIZE), + OSMO_VALUE_STRING(SNS_PDUT_SIZE_ACK), + { 0, NULL } +}; + /* Section 10.3.2, Table 13 */ static const struct value_string ns_cause_str[] = { { NS_CAUSE_TRANSIT_FAIL, "Transit network failure" }, @@ -1216,9 +1238,9 @@ if (nsh->pdu_type != NS_PDUT_RESET) { /* Since we have no NSVC, we have to use a fake */ log_set_context(LOG_CTX_GB_NSVC, fallback_nsvc); - LOGP(DNS, LOGL_INFO, "Rejecting NS PDU type 0x%0x " + LOGP(DNS, LOGL_INFO, "Rejecting NS PDU type %s " "from %s for non-existing NS-VC\n", - nsh->pdu_type, gprs_ns_ll_str(fallback_nsvc)); + get_value_string(ns_pdu_strings, nsh->pdu_type), gprs_ns_ll_str(fallback_nsvc)); fallback_nsvc->nsvci = fallback_nsvc->nsei = 0xfffe; fallback_nsvc->nsvci_is_valid = 0; fallback_nsvc->state = NSE_S_ALIVE; diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map index 9aec280..d682077 100644 --- a/src/gb/libosmogb.map +++ b/src/gb/libosmogb.map @@ -38,6 +38,8 @@ bssgp_vty_init; bssgp_nsi; +ns_pdu_strings; + gprs_ns_cause_str; gprs_ns_destroy; gprs_ns_close; -- To view, visit https://gerrit.osmocom.org/2473 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de>