From 5643f35fb4d09b160c4cd14c8e0ef6f2b7dce07e Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Fri, 27 Nov 2015 16:17:40 +0100 Subject: edge: Add m_egprs_enabled and related methods to TBF Add the following methods to gprs_rlcmac_tbf: - is_egprs_enabled - enable_egprs - disable_egprs Also show the value of the flag in name() by displaying "EGPRS" if it is set. Sponsored-by: On-Waves ehf --- src/tbf.cpp | 8 +++++--- src/tbf.h | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tbf.cpp b/src/tbf.cpp index 0eb99830..0fc6edfe 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -74,7 +74,8 @@ gprs_rlcmac_tbf::gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir) : m_ms(NULL), m_ta(0), m_ms_class(0), - m_ms_list(this) + m_ms_list(this), + m_egprs_enabled(false) { /* The classes of these members do not have proper constructors yet. * Just set them to 0 like talloc_zero did */ @@ -1060,10 +1061,11 @@ const char *gprs_rlcmac_tbf::name() const return "(no TBF)"; snprintf(m_name_buf, sizeof(m_name_buf) - 1, - "TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s)", + "TBF(TFI=%d TLLI=0x%08x DIR=%s STATE=%s%s)", m_tfi, tlli(), direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL", - state_name() + state_name(), + is_egprs_enabled() ? " EGPRS" : "" ); m_name_buf[sizeof(m_name_buf) - 1] = '\0'; return m_name_buf; diff --git a/src/tbf.h b/src/tbf.h index 5b83bed1..43da206d 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -164,6 +164,11 @@ struct gprs_rlcmac_tbf { uint8_t dl_slots() const; uint8_t ul_slots() const; + /* EGPRS */ + bool is_egprs_enabled() const; + void enable_egprs(); + void disable_egprs(); + /* attempt to make things a bit more fair */ void rotate_in_list(); @@ -246,6 +251,7 @@ protected: private: LListHead m_ms_list; + bool m_egprs_enabled; mutable char m_name_buf[60]; }; @@ -315,6 +321,21 @@ inline time_t gprs_rlcmac_tbf::created_ts() const return m_created_ts; } +inline bool gprs_rlcmac_tbf::is_egprs_enabled() const +{ + return m_egprs_enabled; +} + +inline void gprs_rlcmac_tbf::enable_egprs() +{ + m_egprs_enabled = true; +} + +inline void gprs_rlcmac_tbf::disable_egprs() +{ + m_egprs_enabled = false; +} + struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf { gprs_rlcmac_dl_tbf(BTS *bts); @@ -339,6 +360,7 @@ struct gprs_rlcmac_dl_tbf : public gprs_rlcmac_tbf { int frames_since_last_drain(unsigned fn) const; bool keep_open(unsigned fn) const; int release(); + void enable_egprs(); bool is_control_ts(uint8_t ts) const { return ts == control_ts; -- cgit v1.2.3