From 584f4b69d6d8bc0990c923ee5a144a7e3426b69a Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 4 May 2017 11:59:52 +0200 Subject: gprs: add value strings for NS PDU type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add value strings for Service Control PDUs according to 3GPP TS 48.016 §9 and use them for logging. Change-Id: I0ea3a45f35d68619d4cfa9735ef77abd9f9f0d58 Related: SYS#3610 --- src/gb/gprs_ns.c | 28 ++++++++++++++++++++++++++-- src/gb/libosmogb.map | 1 + 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/gb') diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 06498990..7b497c2e 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -296,6 +296,30 @@ static void ns_osmo_signal_dispatch_replaced(struct gprs_nsvc *nsvc, struct gprs osmo_signal_dispatch(SS_L_NS, S_NS_REPLACED, &nssd); } +const struct value_string gprs_ns_pdu_strings[] = { + /* 3GPP TS 48.016 §9.2 Network Service Control PDUs */ + { NS_PDUT_UNITDATA, "NS-UNITDATA" }, /* §9.2.1 */ + { NS_PDUT_RESET, "NS-RESET" }, /* §9.2.5 */ + { NS_PDUT_RESET_ACK, "NS-RESET-ACK" }, /* §9.2.6 */ + { NS_PDUT_BLOCK, "NS-BLOCK" }, /* §9.2.3 */ + { NS_PDUT_BLOCK_ACK, "NS-BLOCK-ACK" }, /* §9.2.4 */ + { NS_PDUT_UNBLOCK, "NS-UNBLOCK" }, /* §9.2.8 */ + { NS_PDUT_UNBLOCK_ACK, "NS-UNBLOCK-ACK" }, /* §9.2.9 */ + { NS_PDUT_STATUS, "NS-STATUS" }, /* §9.2.7 */ + { NS_PDUT_ALIVE, "NS-ALIVE" }, /* §9.2.1 */ + { NS_PDUT_ALIVE_ACK, "NS-ALIVE-ACK" }, /* §9.2.2 */ + /* 3GPP TS 48.016 §9.3 Sub-Network Service Control PDUs */ + { SNS_PDUT_ACK, "SNS-ACK" }, /* §9.3.1 */ + { SNS_PDUT_ADD, "SNS-ADD" }, /* §9.3.2 */ + { SNS_PDUT_CHANGE_WEIGHT, "SNS-CHANGEWEIGHT" }, /* §9.3.3 */ + { SNS_PDUT_CONFIG, "SNS-CONFIG" }, /* §9.3.4 */ + { SNS_PDUT_CONFIG_ACK, "SNS-CONFIG-ACK" }, /* §9.3.5 */ + { SNS_PDUT_DELETE, "SNS-DELETE" }, /* §9.3.6 */ + { SNS_PDUT_SIZE, "SNS-SIZE" }, /* §9.3.7 */ + { SNS_PDUT_SIZE_ACK, "SNS-SIZE-ACK" }, /* §9.3.8 */ + { 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 +1240,9 @@ int gprs_ns_vc_create(struct gprs_ns_inst *nsi, struct msgb *msg, 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(gprs_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 9aec2805..3ec3ee5f 100644 --- a/src/gb/libosmogb.map +++ b/src/gb/libosmogb.map @@ -38,6 +38,7 @@ bssgp_tx_paging; bssgp_vty_init; bssgp_nsi; +gprs_ns_pdu_strings; gprs_ns_cause_str; gprs_ns_destroy; gprs_ns_close; -- cgit v1.2.3