aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 15:53:06 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-17 20:23:09 +0100
commit513dcd22a6e5000a30a7146ad1f36a6e0aba9bf9 (patch)
tree705386b8aaa4e046a59fcac02204d9f1e17ad2c9
parent1a8f0cfe505a2ea7521f2ea22c49c2a9f4fe72c0 (diff)
stp: Create a M2UA link by hand and connect the SCCP routines
This is a hacked version that will just forward SCCP from one linkset to another one. It is missing configuration and ISUP.
-rw-r--r--include/bsc_data.h1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/main_stp.c22
3 files changed, 24 insertions, 1 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 932b229..2cd0257 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -81,6 +81,7 @@ struct bsc_data {
int pcap_fd;
int udp_reset_timeout;
struct mtp_link_set *link_set;
+ struct mtp_link_set *m2ua_set;
const char *token;
diff --git a/src/Makefile.am b/src/Makefile.am
index dbed8fa..eb6ab11 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,6 @@ udt_relay_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(N
-lpthread -lnetsnmp -lcrypto -lm2ua -lsctp
osmo_stp_SOURCES = main_stp.c mtp_layer3.c thread.c pcap.c link_udp.c snmp_mtp.c \
- debug.c vty_interface.c links.c isup.c
+ debug.c vty_interface.c links.c isup.c sctp_m2ua.c
osmo_stp_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) $(NEXUSWARE_C7_LIBS) \
-lpthread -lnetsnmp -lcrypto -lm2ua -lsctp
diff --git a/src/main_stp.c b/src/main_stp.c
index 568a4a6..c038b2b 100644
--- a/src/main_stp.c
+++ b/src/main_stp.c
@@ -27,6 +27,7 @@
#include <bsc_data.h>
#include <snmp_mtp.h>
#include <cellmgr_debug.h>
+#include <sctp_m2ua.h>
#include <osmocore/talloc.h>
@@ -68,6 +69,10 @@ extern void cell_vty_init(void);
*/
void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *_msg, int sls)
{
+ struct mtp_link_set *target;
+
+ target = bsc.m2ua_set == link ? bsc.link_set : bsc.m2ua_set;
+ mtp_link_set_submit_sccp_data(target, sls, _msg->l2h, msgb_l2len(_msg));
}
void mtp_linkset_down(struct mtp_link_set *set)
@@ -167,6 +172,8 @@ static void handle_options(int argc, char **argv)
int main(int argc, char **argv)
{
int rc;
+ struct mtp_link *data;
+ struct mtp_m2ua_link *lnk;
INIT_LLIST_HEAD(&bsc.sccp_connections);
bsc.dpc = 1;
@@ -224,6 +231,21 @@ int main(int argc, char **argv)
if (link_init(&bsc) != 0)
return -1;
+ bsc.m2ua_set = mtp_link_set_alloc();
+ bsc.m2ua_set->dpc = 92;
+ bsc.m2ua_set->opc = 9;
+ bsc.m2ua_set->sccp_opc = 9;
+ bsc.m2ua_set->ni = 3;
+ bsc.m2ua_set->bsc = &bsc;
+
+ lnk = sctp_m2ua_transp_create("0.0.0.0", 2904);
+ lnk->base.pcap_fd = -1;
+ lnk->base.the_link = bsc.m2ua_set;
+ mtp_link_set_add_link(bsc.m2ua_set, (struct mtp_link *) lnk);
+
+ llist_for_each_entry(data, &bsc.m2ua_set->links, entry)
+ data->start(data);
+
while (1) {
bsc_select_main(0);
}