sba: Create a SBAController that will manage the sbas for a BTS

The PollController is a friend of the SBAController and is allowed
to access the internal list. The list is hidden from everyone else.

This is done because the calculation of timeout should belong into
the PollController and not into the SBAController.
This commit is contained in:
Holger Hans Peter Freyther
2013-10-19 20:47:12 +02:00
parent 621dc2fd01
commit cedf890928
11 changed files with 117 additions and 51 deletions

View File

@@ -64,6 +64,7 @@ struct gprs_rlcmac_bts *bts_main_data()
BTS::BTS()
: m_cur_fn(0)
, m_pollController(*this)
, m_sba(*this)
{
memset(&m_bts, 0, sizeof(m_bts));
m_bts.bts = this;
@@ -165,10 +166,10 @@ void gprs_rlcmac_pdch::disable()
m_is_enabled = 0;
}
void gprs_rlcmac_pdch::free_resources(uint8_t trx, uint8_t ts)
/* TODO: kill the parameter and make a pdch belong to a trx.. to a bts.. */
void gprs_rlcmac_pdch::free_resources(BTS *bts, uint8_t trx, uint8_t ts)
{
struct gprs_rlcmac_paging *pag;
struct gprs_rlcmac_sba *sba, *sba2;
/* we are not enabled. there should be no resources */
if (!is_enabled())
@@ -181,12 +182,7 @@ void gprs_rlcmac_pdch::free_resources(uint8_t trx, uint8_t ts)
while ((pag = dequeue_paging()))
talloc_free(pag);
llist_for_each_entry_safe(sba, sba2, &gprs_rlcmac_sbas, list) {
if (sba->trx == trx && sba->ts == ts) {
llist_del(&sba->list);
talloc_free(sba);
}
}
bts->sba()->free_resources(trx, ts);
}
struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging()