aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-14 11:54:29 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-14 17:53:32 +0100
commite1d5396a55b1b11c7e951667266ec347216fc207 (patch)
tree1594c13d33d6b384eb51b342b61745c0584e077b
parentbab4b7dc75dfb80ba3a05168ed3f6eb81d11004d (diff)
edge: Add is_recevied and invalidate_bsn to gprs_rlc_ul_window
These methods will be needed for EGPRS decoding. Sponsored-by: On-Waves ehf
-rw-r--r--src/rlc.cpp7
-rw-r--r--src/rlc.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 5dc448b5..afd96d96 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -224,7 +224,14 @@ void gprs_rlc_ul_window::receive_bsn(const uint16_t bsn)
{
m_v_n.mark_received(bsn);
raise_v_r(bsn);
+}
+
+bool gprs_rlc_ul_window::invalidate_bsn(const uint16_t bsn)
+{
+ bool was_valid = m_v_n.is_received(bsn);
+ m_v_n.mark_missing(bsn);
+ return was_valid;
}
int gprs_rlc_parse_ul_data_header(struct gprs_rlc_ul_header_egprs *rlc,
diff --git a/src/rlc.h b/src/rlc.h
index 573546f4..051fa99d 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -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 */
@@ -413,6 +415,11 @@ 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
+{
+ return is_in_window(bsn) && m_v_n.is_received(bsn);
+}
+
inline const uint16_t gprs_rlc_ul_window::sns() const
{
return RLC_MAX_SNS;