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/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 7c2e828..f8b1c1f 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -305,7 +305,7 @@
  *  \param[out] trx_no_ TRX number on which TFI was found
  *  \returns negative error code or 0 on success
  */
-static int tfi_find_free(const BTS *bts, const gprs_rlcmac_trx *trx, const GprsMs *ms,
+static int tfi_find_free(const struct gprs_rlcmac_bts *bts, const gprs_rlcmac_trx *trx, const GprsMs *ms,
 			 enum gprs_rlcmac_tbf_direction dir, int8_t use_trx, uint8_t *trx_no_)
 {
 	int tfi;
@@ -323,7 +323,7 @@
 	if (use_trx == -1 && ms_current_trx(ms))
 		use_trx = ms_current_trx(ms)->trx_no;
 
-	tfi = bts->tfi_find_free(dir, &trx_no, use_trx);
+	tfi = bts_tfi_find_free(bts, dir, &trx_no, use_trx);
 	if (tfi < 0)
 		return -EBUSY;
 
@@ -423,7 +423,7 @@
 	ms_set_reserved_slots(ms_, trx, 1 << ts, 1 << ts);
 
 	tbf_->upgrade_to_multislot = 0;
-	bts->bts->do_rate_ctr_inc(CTR_TBF_ALLOC_ALGO_A);
+	bts_do_rate_ctr_inc(bts, CTR_TBF_ALLOC_ALGO_A);
 	return 0;
 }
 
@@ -888,7 +888,7 @@
 	trx = ms_current_trx(ms);
 
 	/* Step 2a: Find usable TRX and TFI */
-	tfi = tfi_find_free(bts->bts, trx, ms, tbf->direction, use_trx, &trx_no);
+	tfi = tfi_find_free(bts, trx, ms, tbf->direction, use_trx, &trx_no);
 	if (tfi < 0) {
 		LOGPAL(tbf, "B", single, use_trx, LOGL_NOTICE, "failed to allocate a TFI\n");
 		return tfi;
@@ -966,7 +966,7 @@
 	else
 		assign_ul_tbf_slots(as_ul_tbf(tbf_), trx, ul_slots, tfi, usf);
 
-	bts->bts->do_rate_ctr_inc(CTR_TBF_ALLOC_ALGO_B);
+	bts_do_rate_ctr_inc(bts, CTR_TBF_ALLOC_ALGO_B);
 
 	return 0;
 }