bsc: Move the subscriber_con code into the bsc_api

This commit is contained in:
Holger Hans Peter Freyther 2010-09-16 00:47:32 +08:00
parent 1502ddefac
commit a2aedad005
2 changed files with 41 additions and 40 deletions

View File

@ -36,6 +36,47 @@
static void rll_ind_cb(struct gsm_lchan *, uint8_t, void *, enum bsc_rllr_ind);
static void send_sapi_reject(struct gsm_subscriber_connection *conn, int link_id);
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan)
{
struct gsm_subscriber_connection *conn;
conn = talloc_zero(lchan->ts->trx->bts->network, struct gsm_subscriber_connection);
if (!conn)
return NULL;
/* Configure the time and start it so it will be closed */
conn->lchan = lchan;
conn->bts = lchan->ts->trx->bts;
lchan->conn = conn;
return conn;
}
/* TODO: move subscriber put here... */
void subscr_con_free(struct gsm_subscriber_connection *conn)
{
struct gsm_lchan *lchan;
if (!conn)
return;
if (conn->subscr) {
subscr_put(conn->subscr);
conn->subscr = NULL;
}
if (conn->ho_lchan)
LOGP(DNM, LOGL_ERROR, "The ho_lchan should have been cleared.\n");
lchan = conn->lchan;
talloc_free(conn);
if (lchan)
lchan->conn = NULL;
}
int bsc_api_init(struct gsm_network *network, struct bsc_api *api)
{
network->bsc_api = api;

View File

@ -509,43 +509,3 @@ void network_chan_load(struct pchan_load *pl, struct gsm_network *net)
bts_chan_load(pl, bts);
}
struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan)
{
struct gsm_subscriber_connection *conn;
conn = talloc_zero(lchan->ts->trx->bts->network, struct gsm_subscriber_connection);
if (!conn)
return NULL;
/* Configure the time and start it so it will be closed */
conn->lchan = lchan;
conn->bts = lchan->ts->trx->bts;
lchan->conn = conn;
return conn;
}
/* TODO: move subscriber put here... */
void subscr_con_free(struct gsm_subscriber_connection *conn)
{
struct gsm_lchan *lchan;
if (!conn)
return;
if (conn->subscr) {
subscr_put(conn->subscr);
conn->subscr = NULL;
}
if (conn->ho_lchan)
LOGP(DNM, LOGL_ERROR, "The ho_lchan should have been cleared.\n");
lchan = conn->lchan;
talloc_free(conn);
if (lchan)
lchan->conn = NULL;
}