summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-01-28 05:10:57 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-28 11:59:51 +0100
commit0094f84f305bcdbe29478170109639de9737f088 (patch)
tree2901d924efc68a122433b7a536f3f76a0c5d7430 /openbsc
parent86069143ff7b4ae0c4eabc80aff3a56db14a32a4 (diff)
[bssap] Use switch/case for the signal handler
Use switch/case, switch/case for the subsys and signal to prepare to handle more signals in the future.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/bssap.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/openbsc/src/bssap.c b/openbsc/src/bssap.c
index c5ad80fb1..a6a111e01 100644
--- a/openbsc/src/bssap.c
+++ b/openbsc/src/bssap.c
@@ -940,41 +940,45 @@ static int bssap_handle_lchan_signal(unsigned int subsys, unsigned int signal,
struct gsm_lchan *lchan;
struct sccp_connection *conn;
- if (subsys != SS_LCHAN || signal != S_LCHAN_UNEXPECTED_RELEASE)
- return 0;
-
/*
* If we have a SCCP Connection we need to inform the MSC about
* the resource error and then drop the lchan<->sccp association.
*/
- lchan = (struct gsm_lchan *)signal_data;
+ switch (subsys) {
+ case SS_LCHAN:
+ lchan = (struct gsm_lchan *)signal_data;
+
+ if (!lchan || !lchan->msc_data)
+ return 0;
+ switch (signal) {
+ case S_LCHAN_UNEXPECTED_RELEASE:
+ bsc_del_timer(&lchan->msc_data->T10);
+ conn = lchan->msc_data->sccp;
+ lchan->msc_data->lchan = NULL;
+ lchan->msc_data = NULL;
+
+ msg = msgb_alloc(30, "sccp: clear request");
+ if (!msg) {
+ DEBUGP(DMSC, "Failed to allocate clear request.\n");
+ return 0;
+ }
- if (!lchan || !lchan->msc_data)
- return 0;
+ msg->l3h = msgb_put(msg, 2 + 4);
+ msg->l3h[0] = BSSAP_MSG_BSS_MANAGEMENT;
+ msg->l3h[1] = 4;
- bsc_del_timer(&lchan->msc_data->T10);
- conn = lchan->msc_data->sccp;
- lchan->msc_data->lchan = NULL;
- lchan->msc_data = NULL;
+ msg->l3h[2] = BSS_MAP_MSG_CLEAR_RQST;
+ msg->l3h[3] = GSM0808_IE_CAUSE;
+ msg->l3h[4] = 1;
+ msg->l3h[5] = GSM0808_CAUSE_RADIO_INTERFACE_FAILURE;
- msg = msgb_alloc(30, "sccp: clear request");
- if (!msg) {
- DEBUGP(DMSC, "Failed to allocate clear request.\n");
- return 0;
+ DEBUGP(DMSC, "Sending clear request on unexpected channel release.\n");
+ bsc_queue_connection_write(conn, msg);
+ break;
+ }
+ break;
}
- msg->l3h = msgb_put(msg, 2 + 4);
- msg->l3h[0] = BSSAP_MSG_BSS_MANAGEMENT;
- msg->l3h[1] = 4;
-
- msg->l3h[2] = BSS_MAP_MSG_CLEAR_RQST;
- msg->l3h[3] = GSM0808_IE_CAUSE;
- msg->l3h[4] = 1;
- msg->l3h[5] = GSM0808_CAUSE_RADIO_INTERFACE_FAILURE;
-
- DEBUGP(DMSC, "Sending clear request on unexpected channel release.\n");
- bsc_queue_connection_write(conn, msg);
-
return 0;
}