aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-01-29 04:19:56 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-01-29 04:36:29 +0100
commit18c5cadc4680280dd6ce55a2922d2bd71a69734f (patch)
treec9f062659adbb4bad2b9be9186e52d9ad8dd2e60 /openbsc
parentca1d1d1493dbb107e31697752770e24e40ce4567 (diff)
[sccp] Split Connection Release Complete into two parts
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/sccp/sccp.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c
index 2a5ec4e81..ae08b5db2 100644
--- a/openbsc/src/sccp/sccp.c
+++ b/openbsc/src/sccp/sccp.c
@@ -357,9 +357,24 @@ int _sccp_parse_connection_confirm(struct msgb *msgb, struct sccp_parse_result *
return 0;
}
-int _sccp_parse_connection_release_complete(struct msgb *msg, struct sccp_parse_result *result)
+int _sccp_parse_connection_release_complete(struct msgb *msgb, struct sccp_parse_result *result)
{
- return -1;
+ static int header_size = sizeof(struct sccp_connection_release_complete);
+
+ struct sccp_connection_release_complete *cmpl;
+
+ /* header check */
+ if (msgb_l2len(msgb) < header_size) {
+ DEBUGP(DSCCP, "msgb < header_size %u %u\n",
+ msgb_l2len(msgb), header_size);
+ return -1;
+ }
+
+ cmpl = (struct sccp_connection_release_complete *) msgb->l2h;
+ result->source_local_reference = &cmpl->source_local_reference;
+ result->destination_local_reference = &cmpl->destination_local_reference;
+
+ return 0;
}
int _sccp_parse_connection_dt1(struct msgb *msg, struct sccp_parse_result *result)
@@ -848,30 +863,22 @@ static int _sccp_handle_connection_request(struct msgb *msgb)
}
/* Handle the release confirmed */
-static int _sccp_handle_connection_release_complete(struct msgb *data)
+static int _sccp_handle_connection_release_complete(struct msgb *msgb)
{
- static int header_size = sizeof(struct sccp_connection_release_complete);
-
- struct sccp_connection_release_complete *cmpl;
+ struct sccp_parse_result result;
struct sccp_connection *conn;
- /* header check */
- if (msgb_l2len(data) < header_size) {
- DEBUGP(DSCCP, "msgb < header_size %u %u\n",
- msgb_l2len(data), header_size);
+ if (_sccp_parse_connection_release_complete(msgb, &result) != 0)
return -1;
- }
-
- cmpl = (struct sccp_connection_release_complete *) data->l2h;
/* find the connection */
llist_for_each_entry(conn, &sccp_connections, list) {
if (conn->data_cb
&& memcmp(&conn->source_local_reference,
- &cmpl->destination_local_reference,
+ result.destination_local_reference,
sizeof(conn->source_local_reference)) == 0
&& memcmp(&conn->destination_local_reference,
- &cmpl->source_local_reference,
+ result.source_local_reference,
sizeof(conn->destination_local_reference)) == 0) {
goto found;
}