aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2019-05-02 00:12:16 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2019-05-02 09:20:13 +0100
commit131535c310b83f8ca21851a7897d24246895450c (patch)
tree499a78318329922a8da159083d80527721ec75ce
parent27aafe7105d5d66fd3db909cff952fefb2ff4b20 (diff)
udts/xudts: Attempt to implement unitdata service parsing
Use the new offset based parsing to extract GT and data from the UDTS/XUDTS message as well. Test vectors are missing right now. Change-Id: Id0a3a291d8bad3f8c9621e6c97d4ea0b8bbe6035
-rw-r--r--src/sccp.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/sccp.c b/src/sccp.c
index 53062e5..c07c1af 100644
--- a/src/sccp.c
+++ b/src/sccp.c
@@ -467,6 +467,18 @@ int _sccp_parse_udt(struct msgb *msgb, struct sccp_parse_result *result)
return _sccp_parse_unitdata(msgb, result, &offsets);
}
+int _sccp_parse_udts(struct msgb *msgb, struct sccp_parse_result *result)
+{
+ static const struct udt_offsets offsets = {
+ .header_size = sizeof(struct sccp_data_unitdata_service),
+ .called_offset = offsetof(struct sccp_data_unitdata_service, variable_called),
+ .calling_offset = offsetof(struct sccp_data_unitdata_service, variable_calling),
+ .data_offset = offsetof(struct sccp_data_unitdata_service, variable_data),
+ };
+
+ return _sccp_parse_unitdata(msgb, result, &offsets);
+}
+
static int _sccp_parse_xudt(struct msgb *msgb, struct sccp_parse_result *result)
{
static const struct udt_offsets offsets = {
@@ -479,6 +491,18 @@ static int _sccp_parse_xudt(struct msgb *msgb, struct sccp_parse_result *result)
return _sccp_parse_unitdata(msgb, result, &offsets);
}
+static int _sccp_parse_xudts(struct msgb *msgb, struct sccp_parse_result *result)
+{
+ static const struct udt_offsets offsets = {
+ .header_size = sizeof(struct sccp_data_ext_unitdata_service),
+ .called_offset = offsetof(struct sccp_data_ext_unitdata_service, variable_called),
+ .calling_offset = offsetof(struct sccp_data_ext_unitdata_service, variable_calling),
+ .data_offset = offsetof(struct sccp_data_ext_unitdata_service, variable_data),
+ };
+
+ return _sccp_parse_unitdata(msgb, result, &offsets);
+}
+
static int _sccp_parse_it(struct msgb *msgb, struct sccp_parse_result *result)
{
static const uint32_t header_size = sizeof(struct sccp_data_it);
@@ -1474,9 +1498,15 @@ int sccp_parse_header(struct msgb *msg, struct sccp_parse_result *result)
case SCCP_MSG_TYPE_UDT:
return _sccp_parse_udt(msg, result);
break;
+ case SCCP_MSG_TYPE_UDTS:
+ return _sccp_parse_udts(msg, result);
+ break;
case SCCP_MSG_TYPE_XUDT:
return _sccp_parse_xudt(msg, result);
break;
+ case SCCP_MSG_TYPE_XUDTS:
+ return _sccp_parse_xudts(msg, result);
+ break;
case SCCP_MSG_TYPE_IT:
return _sccp_parse_it(msg, result);
break;