tbf: Include TBF state in tbf_name output

Sponsored-by: On-Waves ehf
diff --git a/src/tbf.cpp b/src/tbf.cpp
index fd25e8d..ccf7362 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -791,10 +791,12 @@
 
 const char *tbf_name(gprs_rlcmac_tbf *tbf)
 {
-	static char buf[40];
-	snprintf(buf, sizeof(buf), "TBF(TFI=%d TLLI=0x%08x DIR=%s)",
+	static char buf[60];
+	snprintf(buf, sizeof(buf), "TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s)",
 			tbf->m_tfi, tbf->m_tlli,
-			tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL");
+			tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL",
+			tbf->state_name()
+			);
 	buf[sizeof(buf) - 1] = '\0';
 	return buf;
 }
diff --git a/src/tbf.h b/src/tbf.h
index 7172163..c0f976d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -115,6 +115,7 @@
 	bool state_is(enum gprs_rlcmac_tbf_state rhs) const;
 	bool state_is_not(enum gprs_rlcmac_tbf_state rhs) const;
 	void set_state(enum gprs_rlcmac_tbf_state new_state);
+	const char *state_name() const;
 
 	struct msgb *create_dl_ass(uint32_t fn);
 	struct msgb *create_ul_ass(uint32_t fn);
@@ -255,6 +256,11 @@
 
 const char *tbf_name(gprs_rlcmac_tbf *tbf);
 
+inline const char *gprs_rlcmac_tbf::state_name() const
+{
+	return tbf_state_name[state];
+}
+
 inline void gprs_rlcmac_tbf::set_state(enum gprs_rlcmac_tbf_state new_state)
 {
 	LOGP(DRLCMAC, LOGL_DEBUG, "%s changes state from %s to %s\n",
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 3e52da4..d975743 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -5,7 +5,7 @@
 - Skipping TS 1, because not enabled
 - Assign downlink TS=2
 - Setting Control TS 2
-TBF(TFI=0 TLLI=0x00000000 DIR=DL) changing tlli from TLLI=0x00000000 TLLI=0x00002342 ul_changed=0
+TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) changing tlli from TLLI=0x00000000 TLLI=0x00002342 ul_changed=0
 ********** TBF starts here **********
 Allocating UL TBF: TFI=0 TRX=0 MS_CLASS=0
 Slot Allocation (Algorithm A) for class 0
@@ -13,5 +13,5 @@
 - Skipping TS 1, because not enabled
 - Assign uplink TS=2 USF=0
 - Setting Control TS 2
-TBF(TFI=0 TLLI=0x00000000 DIR=UL) changing tlli from TLLI=0x00000000 TLLI=0x00002342 ul_changed=0
-TBF(TFI=0 TLLI=0x00002342 DIR=DL) changing tlli from TLLI=0x00002342 TLLI=0x00004232 ul_changed=1
+TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) changing tlli from TLLI=0x00000000 TLLI=0x00002342 ul_changed=0
+TBF(TFI=0 TLLI=0x00002342 DIR=DL STATE=NULL) changing tlli from TLLI=0x00002342 TLLI=0x00004232 ul_changed=1