aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/bsc_msc_ip.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2009-10-07 09:50:21 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2009-11-20 17:35:45 +0100
commit2281d1835f1fc95bb7a235ec04ff28d9b93781b8 (patch)
tree4f52e8713649eb26f28287e3aaf96afc695bfeab /openbsc/src/bsc_msc_ip.c
parentfb4433a129ca7b0757baee834a1e5a6ba4c5bd85 (diff)
[bssap] Start to queue messages to the BTS and to the MSC
For the MSC we need to queue GSM04.08 messages until the SCCP connection is confirmed to be open and then can send the stored messages. The queue is limited to 10 messages at which point new ones will be dropped. Currently the only messages we get are measurement indication messages but it is better to be safe than sorry. The SCCP messages are sent as soon as the connection is considered established and then no queueing happens any more. While replacing sccp_connection_write calls various memory leaks has been fixed. For the MS we might have received a DTAP and need to do an operation that requires a roundtrip and want to send wait until this has happened. The two scenerios are sending a SMS to the phone that requires to do something special for the different SAPI. Currently it is assumed that only one SAPI=0 -> SAPI=3 change happen during the connection. For the first SAPI != 0 we will send the rll_ request and then wait for the timeout or confirmation. In case of timeout a SAPI "n" reject is sent and in case of success the queue is getting emptied.
Diffstat (limited to 'openbsc/src/bsc_msc_ip.c')
-rw-r--r--openbsc/src/bsc_msc_ip.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index 9b726f89d..f3c85904e 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -59,13 +59,23 @@ extern int bsc_shutdown_net(struct gsm_network *net);
struct bss_sccp_connection_data *bss_sccp_create_data()
{
- return _talloc_zero(tall_bsc_ctx,
+ struct bss_sccp_connection_data *data;
+
+ data = _talloc_zero(tall_bsc_ctx,
sizeof(struct bss_sccp_connection_data),
"bsc<->msc");
+ if (!data)
+ return NULL;
+
+ INIT_LLIST_HEAD(&data->sccp_queue);
+ INIT_LLIST_HEAD(&data->gsm_queue);
+ return data;
}
void bss_sccp_free_data(struct bss_sccp_connection_data *data)
{
+ bsc_free_queued(data->sccp);
+ bts_free_queued(data);
talloc_free(data);
}
@@ -138,6 +148,8 @@ void msc_outgoing_sccp_state(struct sccp_connection *conn, int old_state)
bss_sccp_free_data((struct bss_sccp_connection_data *)conn->data_ctx);
sccp_connection_free(conn);
return;
+ } else if (conn->connection_state == SCCP_CONNECTION_STATE_ESTABLISHED) {
+ bsc_send_queued(conn);
}
}
@@ -204,7 +216,7 @@ static int send_dtap_or_open_connection(struct msgb *msg)
return -1;
}
- sccp_connection_write(lchan_get_sccp(msg->lchan), dtap);
+ bsc_queue_connection_write(lchan_get_sccp(msg->lchan), dtap);
return 1;
} else {
return open_sccp_connection(msg);
@@ -251,8 +263,7 @@ static int handle_cipher_m_complete(struct msgb *msg)
/* handled this message */
- sccp_connection_write(lchan_get_sccp(msg->lchan), resp);
- msgb_free(resp);
+ bsc_queue_connection_write(lchan_get_sccp(msg->lchan), resp);
return 1;
}
@@ -328,7 +339,7 @@ int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id)
return -1;
}
- sccp_connection_write(lchan_get_sccp(msg->lchan), dtap);
+ bsc_queue_connection_write(lchan_get_sccp(msg->lchan), dtap);
}
return rc;