rlc: Add constructor to window classes
Currently the gprs_rlc_dl_window and gprs_rlc_ul_window do not have
constructors, but need to get initialized explicitly.
This commit adds constructors to both classes and removes explicit
external initialization code.
Sponsored-by: On-Waves ehf
diff --git a/src/rlc.h b/src/rlc.h
index f16a910..0247a45 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -168,6 +168,8 @@
uint16_t m_v_a; /* ack state */
gprs_rlc_v_b m_v_b;
+
+ gprs_rlc_dl_window();
};
struct gprs_rlc_v_n {
@@ -213,6 +215,8 @@
uint16_t m_v_q; /* receive window state */
gprs_rlc_v_n m_v_n;
+
+ gprs_rlc_ul_window();
};
extern "C" {
@@ -340,6 +344,12 @@
return mark(bsn, GPRS_RLC_DL_BSN_INVALID);
}
+inline gprs_rlc_dl_window::gprs_rlc_dl_window()
+ : m_v_s(0)
+ , m_v_a(0)
+{
+}
+
inline const uint16_t gprs_rlc_dl_window::sns() const
{
return RLC_MAX_SNS;
@@ -400,6 +410,12 @@
return (m_v_s - m_v_a) & mod_sns();
}
+inline gprs_rlc_ul_window::gprs_rlc_ul_window()
+ : m_v_r(0)
+ , m_v_q(0)
+{
+}
+
inline bool gprs_rlc_ul_window::is_in_window(uint16_t bsn) const
{
uint16_t offset_v_q;