ms: Add support for slot reservation

In contrast to the slots currently used by existing TBFs, the
reserved slots refer to the time slots that can be used for newly
allocated TBFs without causing conflicts (given that the first common
TS does not change). They correspond to the potential use of the
PDCHs and can be used to achieve a more uniform slot allocation.

This commit adds bit set based methods to GprsMs and gprs_rlcmac_trx
and a counter to gprs_rlcmac_pdch. The current TRX will also be
stored in the MS object.

Sponsored-by: On-Waves ehf
diff --git a/src/bts.h b/src/bts.h
index f6cc88f..093a8e3 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -71,6 +71,10 @@
 	void detach_tbf(gprs_rlcmac_tbf *tbf);
 
 	unsigned num_tbfs(enum gprs_rlcmac_tbf_direction dir) const;
+
+	void reserve(enum gprs_rlcmac_tbf_direction dir);
+	void unreserve(enum gprs_rlcmac_tbf_direction dir);
+	unsigned num_reserved(enum gprs_rlcmac_tbf_direction dir) const;
 #endif
 
 	uint8_t m_is_enabled; /* TS is enabled */
@@ -100,6 +104,7 @@
 #endif
 
 	uint8_t m_num_tbfs[2];
+	uint8_t m_num_reserved[2];
 };
 
 struct gprs_rlcmac_trx {
@@ -112,6 +117,11 @@
 	/* back pointers */
 	struct BTS *bts;
 	uint8_t trx_no;
+
+#ifdef __cplusplus
+	void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
+	void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots);
+#endif
 };
 
 /**
@@ -311,6 +321,12 @@
 	return m_num_tbfs[dir];
 }
 
+inline unsigned gprs_rlcmac_pdch::num_reserved(
+	enum gprs_rlcmac_tbf_direction dir) const
+{
+	return gprs_rlcmac_pdch::m_num_reserved[dir];
+}
+
 inline struct rate_ctr_group *BTS::rate_counters() const
 {
 	return m_ratectrs;