9
0
Fork 0

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.
This commit is contained in:
Holger Hans Peter Freyther 2010-12-31 13:40:19 +01:00
parent eefd72cd74
commit 80ab4c6066
3 changed files with 16 additions and 5 deletions

View File

@ -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.
]

View File

@ -56,6 +56,7 @@
#define SCCP_SST 0x03
#define SCCP_SSP 0x02
#define SCCP_SSA 0x01
#define MTP_LINK_MASK 0x0F

View File

@ -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;