aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/sccp
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-25 23:04:38 +0800
commit2cdda72b3c79458e91e0ce96995ad0e546c8a79b (patch)
tree9740fdded667044e0a2f5a29656339593a6d768d /openbsc/src/sccp
parentb71517f07ec46558bc6032bdaa27650f8bef634d (diff)
[sccp] Parse the error message and add a unit test for it.
Diffstat (limited to 'openbsc/src/sccp')
-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);