aboutsummaryrefslogtreecommitdiffstats
path: root/src/mtp_layer3.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-03 13:35:42 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-10 20:09:08 +0100
commit0452f22a21d71094b3c740485e54e210f94f0465 (patch)
treec198623876656b33c681a9199baed6d2033e4359 /src/mtp_layer3.c
parent6b71fd6192e937f26ffed0e0846e63b54c4824af (diff)
stp: Add code that allows to inject messages on any linkset
This can be useful to test out certain messages without having any of the linksets be fully connected. It is not possible to get the result. In the future this code should reply with an M2UA error message if something went wrong.
Diffstat (limited to 'src/mtp_layer3.c')
-rw-r--r--src/mtp_layer3.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index 69374aa..71db16d 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -1,7 +1,7 @@
/* MTP layer3 main handling code */
/*
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
+ * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-2011 by On-Waves
* All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
@@ -524,6 +524,23 @@ int mtp_link_set_submit_isup_data(struct mtp_link_set *link, int sls,
return mtp_int_submit(link, link->isup_opc, sls, MTP_SI_MNT_ISUP, data, length);
}
+int mtp_link_set_send(struct mtp_link_set *set, struct msgb *msg)
+{
+ int sls;
+ struct mtp_level_3_hdr *hdr;
+
+ if (msgb_l2len(msg) < sizeof(*hdr))
+ return -1;
+
+ hdr = (struct mtp_level_3_hdr *) msg->l2h;
+ sls = MTP_LINK_SLS(hdr->addr);
+ if (!set->slc[sls])
+ return -2;
+
+ mtp_link_submit(set->slc[sls], msg);
+ return 0;
+}
+
static int mtp_int_submit(struct mtp_link_set *link, int pc, int sls, int type,
const uint8_t *data, unsigned int length)
{