aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_api.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-09-16 00:47:32 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-09-16 02:16:01 +0800
commita2aedad00541a020b2083fb31ba14d8670a5c26f (patch)
treebcdb275a353537cf5854d3d5829489a54e7c0fd8 /openbsc/src/bsc_api.c
parent1502ddefac7b2b1611693f167528aceb34fb8983 (diff)
bsc: Move the subscriber_con code into the bsc_api
Diffstat (limited to 'openbsc/src/bsc_api.c')
-rw-r--r--openbsc/src/bsc_api.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c
index 44ec42092..6c2a467e4 100644
--- a/openbsc/src/bsc_api.c
+++ b/openbsc/src/bsc_api.c
@@ -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;