ss7: Move all mtp linksets callbacks into the app layer
This commit is contained in:
parent
c5200fcb35
commit
64b7d56dc0
|
@ -72,5 +72,6 @@ unsigned int sls_for_src_ref(struct ss7_application *, struct sccp_source_refere
|
|||
|
||||
void app_resources_released(struct ss7_application *ss7);
|
||||
void app_clear_connections(struct ss7_application *ss7);
|
||||
void app_forward_sccp(struct ss7_application *ss7, struct msgb *_msg, int sls);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,34 +70,6 @@ extern void cell_vty_init(void);
|
|||
/*
|
||||
* methods called from the MTP Level3 part
|
||||
*/
|
||||
void mtp_link_set_forward_sccp(struct mtp_link_set *set, struct msgb *_msg, int sls)
|
||||
{
|
||||
struct mtp_link_set *other;
|
||||
if (!set->app) {
|
||||
LOGP(DINP, LOGL_ERROR, "Linkset %d/%s does not have an app.\n",
|
||||
set->no, set->name);
|
||||
return;
|
||||
}
|
||||
|
||||
other = set->app->route_src.set == set ?
|
||||
set->app->route_dst.set : set->app->route_src.set;
|
||||
mtp_link_set_submit_sccp_data(other, sls, _msg->l2h, msgb_l2len(_msg));
|
||||
}
|
||||
|
||||
void mtp_link_set_forward_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
|
||||
{
|
||||
struct mtp_link_set *other;
|
||||
if (!set->app) {
|
||||
LOGP(DINP, LOGL_ERROR, "Linkset %d/%s does not have an app.\n",
|
||||
set->no, set->name);
|
||||
return;
|
||||
}
|
||||
|
||||
other = set->app->route_src.set == set ?
|
||||
set->app->route_dst.set : set->app->route_src.set;
|
||||
mtp_link_set_submit_isup_data(other, sls, msg->l3h, msgb_l3len(msg));
|
||||
}
|
||||
|
||||
static void print_usage()
|
||||
{
|
||||
printf("Usage: osmo-stp\n");
|
||||
|
@ -428,3 +400,6 @@ void app_resources_released(struct ss7_application *ss7)
|
|||
void app_clear_connections(struct ss7_application *ss7)
|
||||
{
|
||||
}
|
||||
void app_forward_sccp(struct ss7_application *ss7, struct msgb *_msg, int sls)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -54,46 +54,37 @@ static void update_con_state(struct ss7_application *ss7, int rc, struct sccp_pa
|
|||
/*
|
||||
* methods called from the MTP Level3 part
|
||||
*/
|
||||
void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *_msg, int sls)
|
||||
void app_forward_sccp(struct ss7_application *app, struct msgb *_msg, int sls)
|
||||
{
|
||||
int rc;
|
||||
struct sccp_parse_result result;
|
||||
struct msc_connection *fw;
|
||||
struct msc_connection *msc;
|
||||
struct mtp_link_set *set;
|
||||
|
||||
struct msgb *msg;
|
||||
|
||||
if (!link->app) {
|
||||
LOGP(DINP, LOGL_ERROR, "The linkset %d/%s has no application.\n",
|
||||
link->no, link->name);
|
||||
return;
|
||||
}
|
||||
set = app->route_src.set;
|
||||
msc = app->route_dst.msc;
|
||||
|
||||
fw = link->app->route_dst.msc;
|
||||
if (!fw) {
|
||||
LOGP(DINP, LOGL_ERROR, "The application %d/%s has no MSC.\n",
|
||||
link->app->nr, link->app->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (link->app->forward_only) {
|
||||
msc_send_direct(fw, _msg);
|
||||
if (app->forward_only) {
|
||||
msc_send_direct(msc, _msg);
|
||||
return;
|
||||
}
|
||||
|
||||
rc = bss_patch_filter_msg(_msg, &result);
|
||||
if (rc == BSS_FILTER_RESET) {
|
||||
LOGP(DMSC, LOGL_NOTICE, "Filtering BSS Reset from the BSC\n");
|
||||
msc_mgcp_reset(fw);
|
||||
send_reset_ack(link, sls);
|
||||
msc_mgcp_reset(msc);
|
||||
send_reset_ack(set, sls);
|
||||
return;
|
||||
}
|
||||
|
||||
/* special responder */
|
||||
if (fw->msc_link_down) {
|
||||
if (rc == BSS_FILTER_RESET_ACK && link->app->reset_count > 0) {
|
||||
if (msc->msc_link_down) {
|
||||
if (rc == BSS_FILTER_RESET_ACK && app->reset_count > 0) {
|
||||
LOGP(DMSC, LOGL_ERROR, "Received reset ack for closing.\n");
|
||||
app_clear_connections(link->app);
|
||||
app_resources_released(link->app);
|
||||
app_clear_connections(app);
|
||||
app_resources_released(app);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -102,21 +93,21 @@ void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *_msg, int
|
|||
return;
|
||||
}
|
||||
|
||||
return handle_local_sccp(link, _msg, &result, sls);
|
||||
return handle_local_sccp(set, _msg, &result, sls);
|
||||
}
|
||||
|
||||
/* update the connection state */
|
||||
update_con_state(link->app, rc, &result, _msg, 0, sls);
|
||||
update_con_state(app, rc, &result, _msg, 0, sls);
|
||||
|
||||
if (rc == BSS_FILTER_CLEAR_COMPL) {
|
||||
send_local_rlsd(link, &result);
|
||||
send_local_rlsd(set, &result);
|
||||
} else if (rc == BSS_FILTER_RLC || rc == BSS_FILTER_RLSD) {
|
||||
LOGP(DMSC, LOGL_DEBUG, "Not forwarding RLC/RLSD to the MSC.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* now send it out */
|
||||
bsc_ussd_handle_out_msg(fw, &result, _msg);
|
||||
bsc_ussd_handle_out_msg(msc, &result, _msg);
|
||||
|
||||
msg = msgb_alloc_headroom(4096, 128, "SCCP to MSC");
|
||||
if (!msg) {
|
||||
|
@ -125,12 +116,7 @@ void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *_msg, int
|
|||
}
|
||||
|
||||
bss_rewrite_header_for_msc(rc, msg, _msg, &result);
|
||||
msc_send_direct(fw, msg);
|
||||
}
|
||||
|
||||
void mtp_link_set_forward_isup(struct mtp_link_set *set, struct msgb *msg, int sls)
|
||||
{
|
||||
LOGP(DINP, LOGL_ERROR, "ISUP is not handled.\n");
|
||||
msc_send_direct(msc, msg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -31,6 +31,61 @@
|
|||
|
||||
|
||||
/* the SS7 dispatch... maybe as function pointers in the future */
|
||||
void forward_sccp_stp(struct mtp_link_set *set, struct msgb *_msg, int sls)
|
||||
{
|
||||
struct mtp_link_set *other;
|
||||
other = set->app->route_src.set == set ?
|
||||
set->app->route_dst.set : set->app->route_src.set;
|
||||
mtp_link_set_submit_sccp_data(other, sls, _msg->l2h, msgb_l2len(_msg));
|
||||
}
|
||||
|
||||
void forward_isup_stp(struct mtp_link_set *set, struct msgb *msg, int sls)
|
||||
{
|
||||
struct mtp_link_set *other;
|
||||
other = set->app->route_src.set == set ?
|
||||
set->app->route_dst.set : set->app->route_src.set;
|
||||
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)
|
||||
{
|
||||
if (!set->app) {
|
||||
LOGP(DINP, LOGL_ERROR, "Linkset %d/%s has no application.\n",
|
||||
set->no, set->name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (set->app->type) {
|
||||
case APP_STP:
|
||||
forward_sccp_stp(set, _msg, sls);
|
||||
break;
|
||||
case APP_CELLMGR:
|
||||
case APP_RELAY:
|
||||
app_forward_sccp(set->app, _msg, sls);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void mtp_link_set_forward_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",
|
||||
set->no, set->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (set->app->type) {
|
||||
case APP_STP:
|
||||
forward_isup_stp(set, msg, sls);
|
||||
break;
|
||||
case APP_CELLMGR:
|
||||
case APP_RELAY:
|
||||
LOGP(DINP, LOGL_ERROR, "ISUP is not handled.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void mtp_linkset_down(struct mtp_link_set *set)
|
||||
{
|
||||
set->available = 0;
|
||||
|
|
Reference in New Issue