Unify BTS into a C usable structure

Previous work on BTS class started to get stuff out of the C++ struct
 into a C struct (BTS -> struct gprs_glcmac_bts) so that some parts of
it were accessible from C code. Doing so, however, ended up being messy
too, since all code needs to be switching from one object to another,
which actually refer to the same logical component.

Let's instead rejoin the structures and make sure the struct is
accessible and usable from both C and C++ code by rewriting all methods
to be C compatible and converting 3 allocated suboject as pointers.
This way BTS can internally still use those C++ objects while providing
a clean APi to both C and C++ code.

Change-Id: I7d12c896c5ded659ca9d3bff4cf3a3fc857db9dd
diff --git a/src/sba.cpp b/src/sba.cpp
index cc58405..53eb847 100644
--- a/src/sba.cpp
+++ b/src/sba.cpp
@@ -40,7 +40,7 @@
  * This offset must be a multiple of 13. */
 #define AGCH_START_OFFSET 52
 
-SBAController::SBAController(BTS &bts)
+SBAController::SBAController(struct gprs_rlcmac_bts &bts)
 	: m_bts(bts)
 {
 	INIT_LLIST_HEAD(&m_sbas);
@@ -64,7 +64,7 @@
 
 	for (trx = 0; trx < 8; trx++) {
 		for (ts = 7; ts >= 0; ts--) {
-			pdch = &m_bts.bts_data()->trx[trx].pdch[ts];
+			pdch = &m_bts.trx[trx].pdch[ts];
 			if (!pdch->is_enabled())
 				continue;
 			break;
@@ -86,7 +86,7 @@
 	sba->ta = ta;
 
 	llist_add(&sba->list, &m_sbas);
-	m_bts.do_rate_ctr_inc(CTR_SBA_ALLOCATED);
+	bts_do_rate_ctr_inc(&m_bts, CTR_SBA_ALLOCATED);
 
 	*_trx = trx;
 	*_ts = ts;
@@ -132,14 +132,14 @@
 	LOGP(DRLCMAC, LOGL_NOTICE,
 	     "Poll timeout for SBA (TRX=%u, TS=%u, FN=%u, TA=%u)\n", sba->trx_no,
 	     sba->ts_no, sba->fn, sba->ta);
-	m_bts.do_rate_ctr_inc(CTR_SBA_TIMEDOUT);
+	bts_do_rate_ctr_inc(&m_bts, CTR_SBA_TIMEDOUT);
 	free_sba(sba);
 	return 0;
 }
 
 void SBAController::free_sba(gprs_rlcmac_sba *sba)
 {
-	m_bts.do_rate_ctr_inc(CTR_SBA_FREED);
+	bts_do_rate_ctr_inc(&m_bts, CTR_SBA_FREED);
 	llist_del(&sba->list);
 	talloc_free(sba);
 }