tbf/rlc: Move the v_n handling into a dedicated object
diff --git a/src/encoding.cpp b/src/encoding.cpp
index b45657a..27c3ecd 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -385,7 +385,7 @@
 	// RECEIVE_BLOCK_BITMAP
 	for (i = 0, bbn = (tbf->dir.ul.window.v_r() - 64) & mod_sns_half; i < 64;
 	     i++, bbn = (bbn + 1) & mod_sns_half) {
-	     	bit = tbf->dir.ul.v_n[bbn];
+		bit = tbf->dir.ul.v_n.state(bbn);
 		if (bit == 0)
 			bit = ' ';
 		show_v_n[i] = bit;
diff --git a/src/rlc.h b/src/rlc.h
index e08a5d7..d9e0e6c 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -129,6 +129,16 @@
 	char m_v_b[RLC_MAX_SNS/2]; /* acknowledge state array */
 };
 
+struct gprs_rlc_v_n {
+	void mark_received(int index);
+	void mark_missing(int index);
+
+	bool is_received(int index) const;
+
+	char state(int index) const;
+private:
+	char m_v_n[RLC_MAX_SNS/2]; /* receive state array */
+};
 
 extern "C" {
 /* TS 04.60  10.2.2 */
@@ -329,3 +339,23 @@
 {
 	m_v_q = (m_v_q + incr) & mod_sns();
 }
+
+inline void gprs_rlc_v_n::mark_received(int index)
+{
+	m_v_n[index] = 'R';
+}
+
+inline void gprs_rlc_v_n::mark_missing(int index)
+{
+	m_v_n[index] = 'N';
+}
+
+inline bool gprs_rlc_v_n::is_received(int index) const
+{
+	return m_v_n[index] == 'R';
+}
+
+inline char gprs_rlc_v_n::state(int index) const
+{
+	return m_v_n[index];
+}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index eca7229..694a41c 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1616,7 +1616,7 @@
 	index = rh->bsn & mod_sns_half; /* memory index of block */
 	memcpy(m_rlc.blocks[index].block, data, len); /* Copy block. */
 	m_rlc.blocks[index].len = len;
-	this->dir.ul.v_n[index] = 'R'; /* Mark received block. */
+	dir.ul.v_n.mark_received(index);
 	LOGP(DRLCMACUL, LOGL_DEBUG, "- BSN %d storing in window (%d..%d)\n",
 		rh->bsn, dir.ul.window.v_q(),
 		(dir.ul.window.v_q() + ws - 1) & mod_sns);
@@ -1625,8 +1625,7 @@
 	if (offset_v_r < (sns() >> 1)) { /* Positive offset, so raise. */
 		while (offset_v_r--) {
 			if (offset_v_r) /* all except the received block */
-				dir.ul.v_n[dir.ul.window.v_r() & mod_sns_half]
-					= 'N'; /* Mark block as not received */
+				dir.ul.v_n.mark_missing(dir.ul.window.v_r() & mod_sns_half);
 			this->dir.ul.window.raise(1);
 				/* Inc V(R). */
 		}
@@ -1638,8 +1637,8 @@
 	/* Raise V(Q) if possible, and retrieve LLC frames from blocks.
 	 * This is looped until there is a gap (non received block) or
 	 * the window is empty.*/
-	while (this->dir.ul.window.v_q() != this->dir.ul.window.v_r() && this->dir.ul.v_n[
-			(index = this->dir.ul.window.v_q() & mod_sns_half)] == 'R') {
+	while (this->dir.ul.window.v_q() != this->dir.ul.window.v_r() && this->dir.ul.v_n.
+			is_received(index = this->dir.ul.window.v_q() & mod_sns_half)) {
 		LOGP(DRLCMACUL, LOGL_DEBUG, "- Taking block %d out, raising "
 			"V(Q) to %d\n", this->dir.ul.window.v_q(),
 			(this->dir.ul.window.v_q() + 1) & mod_sns);
diff --git a/src/tbf.h b/src/tbf.h
index 9560e3c..4718707 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -171,7 +171,7 @@
 		} dl;
 		struct {
 			gprs_rlc_ul_window window;
-			char v_n[RLC_MAX_SNS/2]; /* receive state array */
+			gprs_rlc_v_n v_n;
 			int32_t rx_counter; /* count all received blocks */
 			uint8_t n3103;	/* N3103 counter */
 			uint8_t usf[8];	/* list USFs per PDCH (timeslot) */