aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-11-10 09:34:47 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-11-15 20:06:49 +0100
commitf1f57a84c1b24f5eb03838424410856dac17b41c (patch)
tree05bb0991187fed94481a63100d11f4dd8706d344
parent863a55d44d3c38df6a46abc07e037ef1f92787b1 (diff)
bsc: Parse the CLEAR COMMAND and close the lchan and ack that
-rw-r--r--openbsc/src/bsc/osmo_bsc_bssap.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/openbsc/src/bsc/osmo_bsc_bssap.c b/openbsc/src/bsc/osmo_bsc_bssap.c
index 6ca535bd0..703d93905 100644
--- a/openbsc/src/bsc/osmo_bsc_bssap.c
+++ b/openbsc/src/bsc/osmo_bsc_bssap.c
@@ -111,6 +111,35 @@ static int bssmap_handle_paging(struct gsm_network *net,
return -1;
}
+/*
+ * GSM 08.08 ยง 3.1.9.1 and 3.2.1.21...
+ * release our gsm_subscriber_connection and send message
+ */
+static int bssmap_handle_clear_command(struct osmo_bsc_sccp_con *conn,
+ struct msgb *msg, unsigned int payload_length)
+{
+ struct msgb *resp;
+
+ /* TODO: handle the cause of this package */
+
+ if (conn->conn) {
+ LOGP(DMSC, LOGL_DEBUG, "Releasing all transactions on %p\n", conn);
+ gsm0808_clear(conn->conn);
+ subscr_con_free(conn->conn);
+ conn->conn = NULL;
+ }
+
+ /* send the clear complete message */
+ resp = gsm0808_create_clear_complete();
+ if (!resp) {
+ LOGP(DMSC, LOGL_ERROR, "Sending clear complete failed.\n");
+ return -1;
+ }
+
+ bsc_queue_for_msc(conn, resp);
+ return 0;
+}
+
static int bssmap_rcvmsg_udt(struct gsm_network *net,
struct msgb *msg, unsigned int length)
{
@@ -137,7 +166,23 @@ static int bssmap_rcvmsg_udt(struct gsm_network *net,
static int bssmap_rcvmsg_dt1(struct osmo_bsc_sccp_con *conn,
struct msgb *msg, unsigned int length)
{
- return -1;
+ int ret = 0;
+
+ if (length < 1) {
+ LOGP(DMSC, LOGL_ERROR, "Not enough room: %d\n", length);
+ return -1;
+ }
+
+ switch (msg->l4h[0]) {
+ case BSS_MAP_MSG_CLEAR_CMD:
+ ret = bssmap_handle_clear_command(conn, msg, length);
+ break;
+ default:
+ LOGP(DMSC, LOGL_DEBUG, "Unimplemented msg type: %d\n", msg->l4h[0]);
+ break;
+ }
+
+ return ret;
}
static int dtap_rcvmsg(struct osmo_bsc_sccp_con *conn,