aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bsc_sccp.h3
-rw-r--r--include/msc_connection.h2
-rw-r--r--src/main_stp.c26
-rw-r--r--src/msc_conn.c13
-rw-r--r--src/sccp_state.c45
-rw-r--r--src/ss7_application.c32
6 files changed, 65 insertions, 56 deletions
diff --git a/include/bsc_sccp.h b/include/bsc_sccp.h
index f7489bb..82ba3ed 100644
--- a/include/bsc_sccp.h
+++ b/include/bsc_sccp.h
@@ -70,4 +70,7 @@ struct active_sccp_con *find_con_by_src_dest_ref(struct ss7_application *, struc
struct sccp_source_reference *dst_ref);
unsigned int sls_for_src_ref(struct ss7_application *, struct sccp_source_reference *ref);
+void app_resources_released(struct ss7_application *ss7);
+void app_clear_connections(struct ss7_application *ss7);
+
#endif
diff --git a/include/msc_connection.h b/include/msc_connection.h
index c7957ec..7d3d354 100644
--- a/include/msc_connection.h
+++ b/include/msc_connection.h
@@ -74,7 +74,7 @@ struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num);
int msc_connection_start(struct msc_connection *msc);
/* MGCP */
-void mgcp_forward(struct msc_connection *msc, const uint8_t *data, unsigned int length);
+void msc_mgcp_reset(struct msc_connection *msc);
/* Called by the MSC Connection */
void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg);
diff --git a/src/main_stp.c b/src/main_stp.c
index 594e2b0..11c9ecc 100644
--- a/src/main_stp.c
+++ b/src/main_stp.c
@@ -98,18 +98,6 @@ void mtp_link_set_forward_isup(struct mtp_link_set *set, struct msgb *msg, int s
mtp_link_set_submit_isup_data(other, sls, msg->l3h, msgb_l3len(msg));
}
-void mtp_linkset_down(struct mtp_link_set *set)
-{
- set->available = 0;
- mtp_link_set_stop(set);
-}
-
-void mtp_linkset_up(struct mtp_link_set *set)
-{
- set->available = 1;
- mtp_link_set_reset(set);
-}
-
static void print_usage()
{
printf("Usage: osmo-stp\n");
@@ -426,3 +414,17 @@ struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num)
{
return NULL;
}
+
+
+void msc_mgcp_reset(struct msc_connection *msc)
+{
+}
+void msc_send_reset(struct msc_connection *bsc)
+{
+}
+void app_resources_released(struct ss7_application *ss7)
+{
+}
+void app_clear_connections(struct ss7_application *ss7)
+{
+}
diff --git a/src/msc_conn.c b/src/msc_conn.c
index 06d0d88..e5023c6 100644
--- a/src/msc_conn.c
+++ b/src/msc_conn.c
@@ -46,6 +46,7 @@
static void msc_send_id_response(struct msc_connection *bsc);
static void msc_send(struct msc_connection *bsc, struct msgb *msg, int proto);
static void msc_schedule_reconnect(struct msc_connection *bsc);
+static void mgcp_forward(struct msc_connection *fw, const uint8_t *data, unsigned int length);
int send_or_queue_bsc_msg(struct mtp_link_set *link, int sls, struct msgb *msg)
{
@@ -335,6 +336,16 @@ static void msc_schedule_reconnect(struct msc_connection *fw)
/*
* mgcp forwarding is below
*/
+/* send a RSIP to the MGCP GW */
+void msc_mgcp_reset(struct msc_connection *msc)
+{
+ static const char mgcp_reset[] = {
+ "RSIP 1 13@mgw MGCP 1.0\r\n"
+ };
+
+ mgcp_forward(msc, (const uint8_t *) mgcp_reset, strlen(mgcp_reset));
+}
+
static int mgcp_do_write(struct bsc_fd *fd, struct msgb *msg)
{
int ret;
@@ -375,7 +386,7 @@ static int mgcp_do_read(struct bsc_fd *fd)
return 0;
}
-void mgcp_forward(struct msc_connection *fw, const uint8_t *data, unsigned int length)
+static void mgcp_forward(struct msc_connection *fw, const uint8_t *data, unsigned int length)
{
struct msgb *mgcp;
diff --git a/src/sccp_state.c b/src/sccp_state.c
index 37cba46..fd52a6e 100644
--- a/src/sccp_state.c
+++ b/src/sccp_state.c
@@ -47,22 +47,10 @@
#include <unistd.h>
static void send_reset_ack(struct mtp_link_set *link, int sls);
-static void app_resources_released(struct ss7_application *ss7);
-static void app_clear_connections(struct ss7_application *ss7);
static void handle_local_sccp(struct mtp_link_set *link, struct msgb *inp, struct sccp_parse_result *res, int sls);
static void send_local_rlsd(struct mtp_link_set *link, struct sccp_parse_result *res);
static void update_con_state(struct ss7_application *ss7, int rc, struct sccp_parse_result *result, struct msgb *msg, int from_msc, int sls);
-/* send a RSIP to the MGCP GW */
-static void mgcp_reset(struct msc_connection *fw)
-{
- static const char mgcp_reset[] = {
- "RSIP 1 13@mgw MGCP 1.0\r\n"
- };
-
- mgcp_forward(fw, (const uint8_t *) mgcp_reset, strlen(mgcp_reset));
-}
-
/*
* methods called from the MTP Level3 part
*/
@@ -95,7 +83,7 @@ void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *_msg, int
rc = bss_patch_filter_msg(_msg, &result);
if (rc == BSS_FILTER_RESET) {
LOGP(DMSC, LOGL_NOTICE, "Filtering BSS Reset from the BSC\n");
- mgcp_reset(fw);
+ msc_mgcp_reset(fw);
send_reset_ack(link, sls);
return;
}
@@ -204,7 +192,7 @@ static void handle_local_sccp(struct mtp_link_set *link, struct msgb *inpt, stru
return;
}
-static void app_clear_connections(struct ss7_application *app)
+void app_clear_connections(struct ss7_application *app)
{
struct active_sccp_con *tmp, *con;
@@ -288,7 +276,7 @@ void release_bsc_resources(struct msc_connection *fw)
bsc_del_timer(&app->reset_timeout);
/* 2. clear the MGCP endpoints */
- mgcp_reset(fw);
+ msc_mgcp_reset(fw);
/* 1. send BSSMAP Cleanup.. if we have any connection */
llist_for_each_entry_safe(con, tmp, &app->sccp_connections, entry) {
@@ -317,33 +305,6 @@ void release_bsc_resources(struct msc_connection *fw)
}
}
-void mtp_linkset_down(struct mtp_link_set *set)
-{
- set->available = 0;
- mtp_link_set_stop(set);
-
- if (set->app) {
- app_clear_connections(set->app);
-
- /* If we have an A link send a reset to the MSC */
- mgcp_reset(set->app->route_dst.msc);
- msc_send_reset(set->app->route_dst.msc);
- }
-}
-
-void mtp_linkset_up(struct mtp_link_set *set)
-{
- set->available = 1;
-
- /* we have not gone through link down */
- if (set->app && set->app->route_dst.msc->msc_link_down) {
- app_clear_connections(set->app);
- app_resources_released(set->app);
- }
-
- mtp_link_set_reset(set);
-}
-
/**
* update the connection state and helpers below
*/
diff --git a/src/ss7_application.c b/src/ss7_application.c
index 1eb7ec9..06e666e 100644
--- a/src/ss7_application.c
+++ b/src/ss7_application.c
@@ -22,12 +22,44 @@
#include <ss7_application.h>
#include <bsc_data.h>
+#include <bsc_sccp.h>
#include <cellmgr_debug.h>
#include <msc_connection.h>
#include <sctp_m2ua.h>
#include <osmocore/talloc.h>
+
+/* the SS7 dispatch... maybe as function pointers in the future */
+void mtp_linkset_down(struct mtp_link_set *set)
+{
+ set->available = 0;
+ mtp_link_set_stop(set);
+
+ if (set->app && set->app->type != APP_STP) {
+ app_clear_connections(set->app);
+
+ /* If we have an A link send a reset to the MSC */
+ msc_mgcp_reset(set->app->route_dst.msc);
+ msc_send_reset(set->app->route_dst.msc);
+ }
+}
+
+void mtp_linkset_up(struct mtp_link_set *set)
+{
+ set->available = 1;
+
+ /* we have not gone through link down */
+ if (set->app && set->app->type != APP_STP &&
+ set->app->route_dst.msc->msc_link_down) {
+ app_clear_connections(set->app);
+ app_resources_released(set->app);
+ }
+
+ mtp_link_set_reset(set);
+}
+
+
struct ss7_application *ss7_application_alloc(struct bsc_data *bsc)
{
struct ss7_application *app;