diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-14 11:54:29 +0100 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-12-16 19:37:08 +0100 |
commit | 784a0bd0001e4e81167eda6e3bb4a2001d24d1f6 (patch) | |
tree | e6d706f5d17c8d3a96db89d8eddec13e953fc55d /src/rlc.h | |
parent | d87e1d6ab747423d3668c74d16201a5d967accf0 (diff) |
edge: Add is_received and invalidate_bsn to gprs_rlc_ul_window
These methods will be needed for EGPRS decoding.
The is_received method returns true iff a block with the given BSN
has already been received in the current window. A call to
invalidate_bsn marks the block as not received.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/rlc.h')
-rw-r--r-- | src/rlc.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -194,6 +194,7 @@ struct gprs_rlc_ul_window { const uint16_t ssn() const; bool is_in_window(uint8_t bsn) const; + bool is_received(uint8_t bsn) const; void update_rbb(char *rbb); void raise_v_r_to(int moves); @@ -203,6 +204,7 @@ struct gprs_rlc_ul_window { void raise_v_q(int); void receive_bsn(const uint16_t bsn); + bool invalidate_bsn(const uint16_t bsn); uint16_t m_v_r; /* receive state */ uint16_t m_v_q; /* receive window state */ @@ -401,6 +403,15 @@ inline bool gprs_rlc_ul_window::is_in_window(uint8_t bsn) const return offset_v_q < ws(); } +inline bool gprs_rlc_ul_window::is_received(uint8_t bsn) const +{ + uint16_t offset_v_r; + + /* Offset to the end of the received window */ + offset_v_r = (m_v_r - 1 - bsn) & mod_sns(); + return is_in_window(bsn) && m_v_n.is_received(bsn) && offset_v_r < ws(); +} + inline const uint16_t gprs_rlc_ul_window::sns() const { return RLC_MAX_SNS; |