aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bsc_data.h8
-rw-r--r--include/mtp_data.h10
-rw-r--r--src/isup.c6
-rw-r--r--src/links.c4
-rw-r--r--src/linkset.c13
-rw-r--r--src/mtp_layer3.c3
-rw-r--r--src/ss7_application.c14
7 files changed, 44 insertions, 14 deletions
diff --git a/include/bsc_data.h b/include/bsc_data.h
index 803b7ad..f429c8a 100644
--- a/include/bsc_data.h
+++ b/include/bsc_data.h
@@ -1,7 +1,7 @@
/* Everything related to the BSC connection */
/*
- * (C) 2010-2012 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010-2012 by On-Waves
+ * (C) 2010-2013 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2010-2013 by On-Waves
* All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
@@ -121,6 +121,10 @@ int link_set_shutdown_links(struct mtp_link_set *);
int link_set_reset_links(struct mtp_link_set *);
int link_set_clear_links(struct mtp_link_set *);
+/* called by the link */
+int link_set_down(struct mtp_link_set *);
+int link_set_up(struct mtp_link_set *);
+
/* pcap */
enum {
NET_IN,
diff --git a/include/mtp_data.h b/include/mtp_data.h
index 69db8f7..5c91cbc 100644
--- a/include/mtp_data.h
+++ b/include/mtp_data.h
@@ -51,6 +51,14 @@ struct mtp_link_set {
int nr;
char *name;
+ /*
+ * Callbacks for the SS7 application
+ */
+ void (*on_down) (struct mtp_link_set *set);
+ void (*on_up) (struct mtp_link_set *set);
+ void (*on_sccp) (struct mtp_link_set *set, struct msgb *msg, int sls);
+ void (*on_isup) (struct mtp_link_set *set, struct msgb *msg, int sls);
+
/**
* Routing is very limited. We can only forward to one
@@ -166,8 +174,6 @@ void mtp_link_unblock(struct mtp_link *link);
/* to be implemented for MSU sending */
void mtp_link_submit(struct mtp_link *link, struct msgb *msg);
-void mtp_link_set_forward_sccp(struct mtp_link_set *set, struct msgb *msg, int sls);
-void mtp_link_set_forward_isup(struct mtp_link_set *set, struct msgb *msg, int sls);
void mtp_link_restart(struct mtp_link *link);
int mtp_link_set_send(struct mtp_link_set *set, struct msgb *msg);
diff --git a/src/isup.c b/src/isup.c
index 2827f21..f9ea0ae 100644
--- a/src/isup.c
+++ b/src/isup.c
@@ -229,7 +229,8 @@ int mtp_link_set_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
}
if (set->pass_all_isup) {
- mtp_link_set_forward_isup(set, msg, sls);
+ if (set->on_isup)
+ set->on_isup(set, msg, sls);
return 0;
}
@@ -256,7 +257,8 @@ int mtp_link_set_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
rc = handle_simple_resp(set, sls, hdr->cic, ISUP_MSG_RLC);
break;
default:
- mtp_link_set_forward_isup(set, msg, sls);
+ if (set->on_isup)
+ set->on_isup(set, msg, sls);
rc = 0;
break;
}
diff --git a/src/links.c b/src/links.c
index 59b45c8..3a3fd3f 100644
--- a/src/links.c
+++ b/src/links.c
@@ -51,7 +51,7 @@ void mtp_link_down(struct mtp_link *link)
/* our linkset is now unsuable */
if (was_up && !one_up)
- mtp_linkset_down(link->set);
+ link_set_down(link->set);
link->clear_queue(link);
mtp_link_stop_link_test(link);
mtp_link_set_init_slc(link->set);
@@ -74,7 +74,7 @@ void mtp_link_up(struct mtp_link *link)
mtp_link_set_init_slc(link->set);
if (!one_up)
- mtp_linkset_up(link->set);
+ link_set_up(link->set);
else
mtp_link_start_link_test(link);
}
diff --git a/src/linkset.c b/src/linkset.c
index 6ed91c1..5f8d74c 100644
--- a/src/linkset.c
+++ b/src/linkset.c
@@ -111,3 +111,16 @@ int link_set_clear_links(struct mtp_link_set *set)
return 0;
}
+int link_set_down(struct mtp_link_set *set)
+{
+ if (set->on_down)
+ set->on_down(set);
+ return 0;
+}
+
+int link_set_up(struct mtp_link_set *set)
+{
+ if (set->on_up)
+ set->on_up(set);
+ return 0;
+}
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index 92e8f41..1b6ca0e 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -461,7 +461,8 @@ static int mtp_link_sccp_data(struct mtp_link_set *set, struct mtp_level_3_hdr *
}
rate_ctr_inc(&set->ctrg->ctr[MTP_LSET_SCCP_IN_MSG]);
- mtp_link_set_forward_sccp(set, msg, MTP_LINK_SLS(hdr->addr));
+ if (set->on_sccp)
+ set->on_sccp(set, msg, MTP_LINK_SLS(hdr->addr));
return 0;
}
diff --git a/src/ss7_application.c b/src/ss7_application.c
index cedc2d0..49f005d 100644
--- a/src/ss7_application.c
+++ b/src/ss7_application.c
@@ -50,7 +50,7 @@ static void forward_isup_stp(struct mtp_link_set *set, struct msgb *msg, int sls
mtp_link_set_submit_isup_data(other, sls, msg->l3h, msgb_l3len(msg));
}
-void mtp_link_set_forward_sccp(struct mtp_link_set *set, struct msgb *_msg, int sls)
+static void on_link_set_sccp(struct mtp_link_set *set, struct msgb *_msg, int sls)
{
if (!set->app) {
LOGP(DINP, LOGL_ERROR, "Linkset %d/%s has no application.\n",
@@ -69,7 +69,7 @@ void mtp_link_set_forward_sccp(struct mtp_link_set *set, struct msgb *_msg, int
}
}
-void mtp_link_set_forward_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
+static void on_link_set_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
{
if (!set->app) {
LOGP(DINP, LOGL_ERROR, "Linkset %d/%s has no application.\n",
@@ -89,7 +89,7 @@ void mtp_link_set_forward_isup(struct mtp_link_set *set, struct msgb *msg, int s
}
}
-void mtp_linkset_down(struct mtp_link_set *set)
+static void on_link_set_down(struct mtp_link_set *set)
{
set->available = 0;
mtp_link_set_stop(set);
@@ -111,7 +111,7 @@ void mtp_linkset_down(struct mtp_link_set *set)
}
}
-void mtp_linkset_up(struct mtp_link_set *set)
+static void on_link_set_up(struct mtp_link_set *set)
{
set->available = 1;
@@ -132,7 +132,6 @@ void mtp_linkset_up(struct mtp_link_set *set)
mtp_link_set_reset(set);
}
-
struct ss7_application *ss7_application_alloc(struct bsc_data *bsc)
{
struct ss7_application *app;
@@ -349,6 +348,11 @@ static void start_set(struct ss7_application *app, struct mtp_link_set *set)
if (!set)
return;
+ set->on_down = on_link_set_down;
+ set->on_up = on_link_set_up;
+ set->on_sccp = on_link_set_sccp;
+ set->on_isup = on_link_set_isup;
+
set->isup_opc = set->isup_opc >= 0 ? set->isup_opc : set->opc;
set->sccp_opc = set->sccp_opc >= 0 ? set->sccp_opc : set->opc;
set->pass_all_isup = app->isup_pass;