ss7: Move the linkset up/down into the ss7_app, move some code around
This commit is contained in:
parent
ab7c601118
commit
c5200fcb35
|
@ -70,4 +70,7 @@ struct active_sccp_con *find_con_by_src_dest_ref(struct ss7_application *, struc
|
||||||
struct sccp_source_reference *dst_ref);
|
struct sccp_source_reference *dst_ref);
|
||||||
unsigned int sls_for_src_ref(struct ss7_application *, struct sccp_source_reference *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
|
#endif
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num);
|
||||||
int msc_connection_start(struct msc_connection *msc);
|
int msc_connection_start(struct msc_connection *msc);
|
||||||
|
|
||||||
/* MGCP */
|
/* 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 */
|
/* Called by the MSC Connection */
|
||||||
void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg);
|
void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg);
|
||||||
|
|
|
@ -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));
|
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()
|
static void print_usage()
|
||||||
{
|
{
|
||||||
printf("Usage: osmo-stp\n");
|
printf("Usage: osmo-stp\n");
|
||||||
|
@ -426,3 +414,17 @@ struct msc_connection *msc_connection_num(struct bsc_data *bsc, int num)
|
||||||
{
|
{
|
||||||
return NULL;
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
static void msc_send_id_response(struct msc_connection *bsc);
|
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_send(struct msc_connection *bsc, struct msgb *msg, int proto);
|
||||||
static void msc_schedule_reconnect(struct msc_connection *bsc);
|
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)
|
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
|
* 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)
|
static int mgcp_do_write(struct bsc_fd *fd, struct msgb *msg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -375,7 +386,7 @@ static int mgcp_do_read(struct bsc_fd *fd)
|
||||||
return 0;
|
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;
|
struct msgb *mgcp;
|
||||||
|
|
||||||
|
|
|
@ -47,22 +47,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static void send_reset_ack(struct mtp_link_set *link, int sls);
|
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 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 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);
|
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
|
* 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);
|
rc = bss_patch_filter_msg(_msg, &result);
|
||||||
if (rc == BSS_FILTER_RESET) {
|
if (rc == BSS_FILTER_RESET) {
|
||||||
LOGP(DMSC, LOGL_NOTICE, "Filtering BSS Reset from the BSC\n");
|
LOGP(DMSC, LOGL_NOTICE, "Filtering BSS Reset from the BSC\n");
|
||||||
mgcp_reset(fw);
|
msc_mgcp_reset(fw);
|
||||||
send_reset_ack(link, sls);
|
send_reset_ack(link, sls);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +192,7 @@ static void handle_local_sccp(struct mtp_link_set *link, struct msgb *inpt, stru
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void app_clear_connections(struct ss7_application *app)
|
void app_clear_connections(struct ss7_application *app)
|
||||||
{
|
{
|
||||||
struct active_sccp_con *tmp, *con;
|
struct active_sccp_con *tmp, *con;
|
||||||
|
|
||||||
|
@ -288,7 +276,7 @@ void release_bsc_resources(struct msc_connection *fw)
|
||||||
bsc_del_timer(&app->reset_timeout);
|
bsc_del_timer(&app->reset_timeout);
|
||||||
|
|
||||||
/* 2. clear the MGCP endpoints */
|
/* 2. clear the MGCP endpoints */
|
||||||
mgcp_reset(fw);
|
msc_mgcp_reset(fw);
|
||||||
|
|
||||||
/* 1. send BSSMAP Cleanup.. if we have any connection */
|
/* 1. send BSSMAP Cleanup.. if we have any connection */
|
||||||
llist_for_each_entry_safe(con, tmp, &app->sccp_connections, entry) {
|
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
|
* update the connection state and helpers below
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,12 +22,44 @@
|
||||||
|
|
||||||
#include <ss7_application.h>
|
#include <ss7_application.h>
|
||||||
#include <bsc_data.h>
|
#include <bsc_data.h>
|
||||||
|
#include <bsc_sccp.h>
|
||||||
#include <cellmgr_debug.h>
|
#include <cellmgr_debug.h>
|
||||||
#include <msc_connection.h>
|
#include <msc_connection.h>
|
||||||
#include <sctp_m2ua.h>
|
#include <sctp_m2ua.h>
|
||||||
|
|
||||||
#include <osmocore/talloc.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 *ss7_application_alloc(struct bsc_data *bsc)
|
||||||
{
|
{
|
||||||
struct ss7_application *app;
|
struct ss7_application *app;
|
||||||
|
|
Reference in New Issue