aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-06 20:23:58 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 20:06:49 +0100
commitc97d9b4df1f782a86adc5cad15373b6dc4c7ebd6 (patch)
tree6eea707acf2e44aab9d2d8b8d2df6fd116b376f4 /openbsc/src/bsc
parent7e9010892d3b9977d076d0429193f265b6612477 (diff)
bsc: Implement a CC timeout and the IT timeout, prepare the timers
Diffstat (limited to 'openbsc/src/bsc')
-rw-r--r--openbsc/src/bsc/osmo_bsc_sccp.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/openbsc/src/bsc/osmo_bsc_sccp.c b/openbsc/src/bsc/osmo_bsc_sccp.c
index b1d128b40..f7f30e10d 100644
--- a/openbsc/src/bsc/osmo_bsc_sccp.c
+++ b/openbsc/src/bsc/osmo_bsc_sccp.c
@@ -32,6 +32,9 @@
#include <osmocom/sccp/sccp.h>
+/* SCCP helper */
+#define SCCP_IT_TIMER 60
+
static LLIST_HEAD(active_connections);
static void msc_outgoing_sccp_data(struct sccp_connection *conn,
@@ -43,6 +46,34 @@ static void msc_outgoing_sccp_state(struct sccp_connection *conn, int old_state)
{
}
+static void sccp_it_timeout(void *_data)
+{
+ struct osmo_bsc_sccp_con *data =
+ (struct osmo_bsc_sccp_con *) _data;
+
+ sccp_connection_send_it(data->sccp);
+ bsc_schedule_timer(&data->sccp_it_timeout, SCCP_IT_TIMER, 0);
+}
+
+static void sccp_cc_timeout(void *_data)
+{
+ struct osmo_bsc_sccp_con *data =
+ (struct osmo_bsc_sccp_con *) _data;
+
+ if (data->sccp->connection_state >= SCCP_CONNECTION_STATE_ESTABLISHED)
+ return;
+
+ LOGP(DMSC, LOGL_ERROR, "The connection was never established.\n");
+
+
+ if (data->conn) {
+ gsm0808_clear(data->conn);
+ subscr_con_free(data->conn);
+ data->conn = NULL;
+ }
+ bsc_delete_connection(data);
+}
+
static void msc_sccp_write_ipa(struct sccp_connection *conn, struct msgb *msg, void *data)
{
LOGP(DMSC, LOGL_ERROR, "Writing is not implemented.\n");
@@ -124,6 +155,12 @@ int bsc_create_new_connection(struct gsm_subscriber_connection *conn)
sccp->data_cb = msc_outgoing_sccp_data;
sccp->data_ctx = bsc_con;
+ /* prepare the timers */
+ bsc_con->sccp_it_timeout.cb = sccp_it_timeout;
+ bsc_con->sccp_it_timeout.data = bsc_con;
+ bsc_con->sccp_cc_timeout.cb = sccp_cc_timeout;
+ bsc_con->sccp_cc_timeout.data = bsc_con;
+
bsc_con->sccp = sccp;
bsc_con->msc_con = net->msc_data->msc_con;
bsc_con->conn = conn;