aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf.h
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-16 18:33:18 +0200
committerIvan Kluchnikov <kluchnikovi@gmail.com>2013-10-28 12:54:09 +0400
commit1c344e26689fc84ceb1fda1ab9e061462af2678b (patch)
tree9ee7193af477dd73b615ddaec512ecf8d22a123b /src/tbf.h
parent7380babdba39faa090e5dff442e2afbeec202c16 (diff)
tbf: Prepare to make thing things private in the tbf, start with the state
There really shouldn't be too many callers of state. Instead the tbf should dispatch depending on the internal state. For now introduce state_is and state_is_not accessor functions so we can start to see who is using the internal state.
Diffstat (limited to 'src/tbf.h')
-rw-r--r--src/tbf.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/tbf.h b/src/tbf.h
index d2aead2..84d558e 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -91,10 +91,13 @@ struct gprs_rlcmac_tbf {
static void free_all(struct gprs_rlcmac_trx *trx);
static void free_all(struct gprs_rlcmac_pdch *pdch);
+ 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);
+
int rlcmac_diag();
struct llist_head list;
- enum gprs_rlcmac_tbf_state state;
uint32_t state_flags;
enum gprs_rlcmac_tbf_direction direction;
uint8_t tfi;
@@ -187,6 +190,10 @@ struct gprs_rlcmac_tbf {
int diag; /* number where TBF is presented in diagram */
int diag_new; /* used to format output of new TBF */
#endif
+
+ /* these should become protected but only after gprs_rlcmac_data.c
+ * stops to iterate over all tbf in its current form */
+ enum gprs_rlcmac_tbf_state state;
};
@@ -232,3 +239,18 @@ void tbf_timer_stop(struct gprs_rlcmac_tbf *tbf);
void tbf_timer_cb(void *_tbf);
+
+inline bool gprs_rlcmac_tbf::state_is(enum gprs_rlcmac_tbf_state rhs) const
+{
+ return state == rhs;
+}
+
+inline bool gprs_rlcmac_tbf::state_is_not(enum gprs_rlcmac_tbf_state rhs) const
+{
+ return state != rhs;
+}
+
+inline void gprs_rlcmac_tbf::set_state(enum gprs_rlcmac_tbf_state new_state)
+{
+ state = new_state;
+}