summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sccp/sccp.h7
-rw-r--r--src/sccp/sccp.c33
2 files changed, 29 insertions, 11 deletions
diff --git a/include/sccp/sccp.h b/include/sccp/sccp.h
index b25e21f..7c75b0c 100644
--- a/include/sccp/sccp.h
+++ b/include/sccp/sccp.h
@@ -51,6 +51,13 @@ struct sockaddr_sccp {
/* TODO fill in address indicator... if that is ever needed */
+ /* optional gti information */
+ uint8_t *gti;
+ int gti_len;
+
+ /* any of SCCP_TITLE_IND_* */
+ uint8_t gti_ind;
+
/* not sure about these */
/* uint8_t sccp_class; */
};
diff --git a/src/sccp/sccp.c b/src/sccp/sccp.c
index e054df5..5d48642 100644
--- a/src/sccp/sccp.c
+++ b/src/sccp/sccp.c
@@ -512,6 +512,24 @@ static int _sccp_parse_err(struct msgb *msgb, struct sccp_parse_result *result)
return 0;
}
+static void create_sccp_addr(struct msgb *msg, const struct sockaddr_sccp *sock)
+{
+ uint8_t *data;
+
+ data = msgb_put(msg, 1 + 2 + sock->gti_len);
+ data[0] = 2;
+
+ if (sock->gti)
+ data[1] = 0 << 6 | (sock->gti_ind & 0x0f) << 2;
+ else
+ data[1] = 1 << 6 | 1 << 1;
+
+ data[2] = sock->sccp_ssn;
+
+ /* copy the gti if it is present */
+ memcpy(&data[3], sock->gti, sock->gti_len);
+}
+
/*
* Send UDT. Currently we have a fixed address...
*/
@@ -534,19 +552,12 @@ static int _sccp_send_data(int class, const struct sockaddr_sccp *in,
udt->type = SCCP_MSG_TYPE_UDT;
udt->proto_class = class;
udt->variable_called = 3;
- udt->variable_calling = 5;
- udt->variable_data = 7;
+ udt->variable_calling = 5 + out->gti_len;
+ udt->variable_data = 7 + out->gti_len + in->gti_len;
/* for variable data we start with a size and the data */
- data = msgb_put(msg, 1 + 2);
- data[0] = 2;
- data[1] = 0x42;
- data[2] = out->sccp_ssn;
-
- data = msgb_put(msg, 1 + 2);
- data[0] = 2;
- data[1] = 0x42;
- data[2] = in->sccp_ssn;
+ create_sccp_addr(msg, out);
+ create_sccp_addr(msg, in);
/* copy the payload */
data = msgb_put(msg, 1 + msgb_l3len(payload));