aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-05-04 11:59:52 +0200
committerMax <msuraev@sysmocom.de>2017-05-09 09:10:20 +0000
commit584f4b69d6d8bc0990c923ee5a144a7e3426b69a (patch)
tree8ac704517376979343f4e74d36f5e07da495ccd5
parent33c7ba693416bca679c60e15b31cf425bda75a2f (diff)
gprs: add value strings for NS PDU type
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
-rw-r--r--include/osmocom/gprs/protocol/gsm_08_16.h2
-rw-r--r--src/gb/gprs_ns.c28
-rw-r--r--src/gb/libosmogb.map1
3 files changed, 29 insertions, 2 deletions
diff --git a/include/osmocom/gprs/protocol/gsm_08_16.h b/include/osmocom/gprs/protocol/gsm_08_16.h
index 8b2ac564..56ed5947 100644
--- a/include/osmocom/gprs/protocol/gsm_08_16.h
+++ b/include/osmocom/gprs/protocol/gsm_08_16.h
@@ -18,6 +18,8 @@ struct gprs_ns_hdr {
uint8_t data[0]; /*!< variable-length payload */
} __attribute__((packed));
+extern const struct value_string gprs_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 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;