ms: Add tbf() method to get the TBF based on the direction
To avoid the need for a switch or conditional statement when needing
a TBF from an MS object in direction independant code, this method
contains that case distinction. For additional flexibility, a
reverse() function is added to get the opposite direction.
Sponsored-by: On-Waves ehf
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 1014ea3..4c0ecfd 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -529,3 +529,12 @@
return -1;
}
+gprs_rlcmac_tbf *GprsMs::tbf(enum gprs_rlcmac_tbf_direction dir) const
+{
+ switch (dir) {
+ case GPRS_RLCMAC_DL_TBF: return m_dl_tbf;
+ case GPRS_RLCMAC_UL_TBF: return m_ul_tbf;
+ }
+
+ return NULL;
+}