aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-21 15:38:16 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-21 15:46:38 +0800
commitc3a6a1dbe5432e792103916291fd837ea96e0937 (patch)
treee22d37c625ab8220ff1d96b5401f8ec93f7a5094 /openbsc/src
parentf4f090ee36246a2bc027aea790663670276f5e48 (diff)
[sccp] Parse the error message and add a unit test for it.
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/sccp/sccp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/openbsc/src/sccp/sccp.c b/openbsc/src/sccp/sccp.c
index e0fd02e0e..d869bfaeb 100644
--- a/openbsc/src/sccp/sccp.c
+++ b/openbsc/src/sccp/sccp.c
@@ -490,6 +490,23 @@ static int _sccp_parse_it(struct msgb *msgb, struct sccp_parse_result *result)
return 0;
}
+static int _sccp_parse_err(struct msgb *msgb, struct sccp_parse_result *result)
+{
+ static const u_int32_t header_size = sizeof(struct sccp_proto_err);
+
+ struct sccp_proto_err *err;
+
+ if (msgb_l2len(msgb) < header_size) {
+ LOGP(DSCCP, LOGL_ERROR, "msgb < header_size %u %u\n",
+ msgb_l2len(msgb), header_size);
+ return -1;
+ }
+
+ err = (struct sccp_proto_err *) msgb->l2h;
+ result->data_len = 0;
+ result->destination_local_reference = &err->destination_local_reference;
+ return 0;
+}
/*
* Send UDT. Currently we have a fixed address...
@@ -1318,6 +1335,9 @@ int sccp_parse_header(struct msgb *msg, struct sccp_parse_result *result)
case SCCP_MSG_TYPE_IT:
return _sccp_parse_it(msg, result);
break;
+ case SCCP_MSG_TYPE_ERR:
+ return _sccp_parse_err(msg, result);
+ break;
};
LOGP(DSCCP, LOGL_ERROR, "Unimplemented MSG Type: 0x%x\n", type);