aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2014-08-15 18:11:57 +0200
committerDaniel Willmann <daniel@totalueberwachung.de>2014-08-15 18:28:45 +0200
commit08e57c836699d3e509ad2c9539ac3b70f9df09e4 (patch)
tree7807c40017aef37d6266a787bdda6df85d7e0429
parent341689d6c51d8db73d8691e947c49ede792b6652 (diff)
tbf: Include TBF state in tbf_name output
Sponsored-by: On-Waves ehf
-rw-r--r--src/tbf.cpp8
-rw-r--r--src/tbf.h6
-rw-r--r--tests/tbf/TbfTest.err6
3 files changed, 14 insertions, 6 deletions
diff --git a/src/tbf.cpp b/src/tbf.cpp
index fd25e8df..ccf73627 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -791,10 +791,12 @@ int gprs_rlcmac_tbf::extract_tlli(const uint8_t *data, const size_t len)
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 71721635..c0f976d4 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -115,6 +115,7 @@ struct gprs_rlcmac_tbf {
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 @@ inline bool gprs_rlcmac_tbf::state_is_not(enum gprs_rlcmac_tbf_state rhs) const
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 3e52da4a..d9757439 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -5,7 +5,7 @@ Slot Allocation (Algorithm A) for class 0
- 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 @@ Slot Allocation (Algorithm A) for class 0
- 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