From 80ab4c60668ac63ea52fbe5d65a212df934570f5 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 31 Dec 2010 13:40:19 +0100 Subject: mtp: Implement the subsystem test and respond with a SSP/SSA The SCMG handling should be moved to a different file. Right now the list of supported SSNs is not configurable but it should. --- contrib/TestSender.st | 5 +++++ include/mtp_level3.h | 1 + src/mtp_layer3.c | 15 ++++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/contrib/TestSender.st b/contrib/TestSender.st index 4913416..124a0fe 100644 --- a/contrib/TestSender.st +++ b/contrib/TestSender.st @@ -34,4 +34,9 @@ Eval [ msg := #(2 0 0 1 0 0 0 0 0 0 0 6 192 232 197 7 0 23) asByteArray. datagram data: msg. socket nextPut: datagram. + + "SST" + msg := #(2 0 0 1 0 0 0 0 0 0 0 24 195 233 197 7 224 9 0 3 5 9 2 66 1 4 67 31 0 1 5 3 7 233 5 0 ) asByteArray. + datagram data: msg. + socket nextPut: datagram. ] diff --git a/include/mtp_level3.h b/include/mtp_level3.h index 8a8b42e..4b46c08 100644 --- a/include/mtp_level3.h +++ b/include/mtp_level3.h @@ -56,6 +56,7 @@ #define SCCP_SST 0x03 +#define SCCP_SSP 0x02 #define SCCP_SSA 0x01 #define MTP_LINK_MASK 0x0F diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c index d71e504..b788208 100644 --- a/src/mtp_layer3.c +++ b/src/mtp_layer3.c @@ -136,7 +136,8 @@ static struct msgb *mtp_tra_alloc(struct mtp_link *link) return out; } -static struct msgb *mtp_sccp_alloc_ssa(struct mtp_link *link, int sls) +static struct msgb *mtp_sccp_alloc_scmg(struct mtp_link *link, + int type, int assn, int sls) { struct sccp_data_unitdata *udt; struct sccp_con_ctrl_prt_mgt *prt; @@ -178,8 +179,8 @@ static struct msgb *mtp_sccp_alloc_ssa(struct mtp_link *link, int sls) data[0] = sizeof(*prt); prt = (struct sccp_con_ctrl_prt_mgt *) msgb_put(out, sizeof(*prt)); - prt->sst = SCCP_SSA; - prt->assn = 254; + prt->sst = type; + prt->assn = assn; prt->apoc = MTP_MAKE_APOC(link->opc); prt->mul_ind = 0; @@ -409,6 +410,7 @@ static int mtp_link_sccp_data(struct mtp_link *link, struct mtp_level_3_hdr *hdr struct msgb *out; struct sccp_con_ctrl_prt_mgt *prt; struct sccp_parse_result sccp; + int type; msg->l2h = &hdr->data[0]; if (msgb_l2len(msg) != l3_len) { @@ -441,10 +443,13 @@ static int mtp_link_sccp_data(struct mtp_link *link, struct mtp_level_3_hdr *hdr if (prt->assn != 254 || prt->apoc != MTP_MAKE_APOC(link->opc)) { LOGP(DINP, LOGL_ERROR, "Unknown SSN/APOC assn: %u, apoc: %u/%u\n", prt->assn, ntohs(prt->apoc), prt->apoc); - return -1; + type = SCCP_SSP; + } else { + type = SCCP_SSA; } - out = mtp_sccp_alloc_ssa(link, MTP_LINK_SLS(hdr->addr)); + out = mtp_sccp_alloc_scmg(link, type, prt->assn, + MTP_LINK_SLS(hdr->addr)); if (!out) return -1; -- cgit v1.2.3