aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linkset.h7
-rw-r--r--src/isup.c10
-rw-r--r--src/mtp_layer3.c7
-rw-r--r--src/sccp_state.c22
-rw-r--r--src/ss7_application.c4
5 files changed, 29 insertions, 21 deletions
diff --git a/include/linkset.h b/include/linkset.h
index 1385cf1..00dddf0 100644
--- a/include/linkset.h
+++ b/include/linkset.h
@@ -45,6 +45,11 @@ struct mtp_link_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);
+ /*
+ * Sending routines
+ */
+ int (*submit_sccp) (struct mtp_link_set *set, int sls, const uint8_t *data, unsigned int len);
+ int (*submit_isup) (struct mtp_link_set *set, int sls, const uint8_t *data, unsigned int len);
/**
* Routing is very limited. We can only forward to one
@@ -102,8 +107,6 @@ void mtp_link_set_stop(struct mtp_link_set *set);
void mtp_link_set_reset(struct mtp_link_set *set);
int mtp_link_set_data(struct mtp_link *link, struct msgb *msg);
int mtp_link_handle_data(struct mtp_link *link, struct msgb *msg);
-int mtp_link_set_submit_sccp_data(struct mtp_link_set *set, int sls, const uint8_t *data, unsigned int length);
-int mtp_link_set_submit_isup_data(struct mtp_link_set *set, int sls, const uint8_t *data, unsigned int length);
void mtp_link_set_init_slc(struct mtp_link_set *set);
diff --git a/src/isup.c b/src/isup.c
index f9ea0ae..614d7d4 100644
--- a/src/isup.c
+++ b/src/isup.c
@@ -133,7 +133,7 @@ static int handle_circuit_reset_grs(struct mtp_link_set *set, int sls, int cic,
if (!resp)
return -1;
- mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp));
+ set->submit_isup(set, sls, resp->l2h, msgb_l2len(resp));
msgb_free(resp);
return 0;
}
@@ -157,7 +157,7 @@ static int handle_circuit_reset_cgb(struct mtp_link_set *set, int sls, int cic,
if (!resp)
return -1;
- mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp));
+ set->submit_isup(set, sls, resp->l2h, msgb_l2len(resp));
msgb_free(resp);
return 0;
}
@@ -172,7 +172,7 @@ static int send_cgu(struct mtp_link_set *set, int sls, int cic, int range)
if (!resp)
return -1;
- mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp));
+ set->submit_isup(set, sls, resp->l2h, msgb_l2len(resp));
msgb_free(resp);
return 0;
}
@@ -200,7 +200,7 @@ static int handle_cgu(struct mtp_link_set *set, int sls, int cic,
out = msgb_put(resp, size);
memcpy(out, data, size);
- mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp));
+ set->submit_isup(set, sls, resp->l2h, msgb_l2len(resp));
msgb_free(resp);
return 0;
}
@@ -212,7 +212,7 @@ static int handle_simple_resp(struct mtp_link_set *set, int sls, int cic, int ms
resp = isup_simple_alloc(cic, msg_type);
if (!resp)
return -1;
- mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp));
+ set->submit_isup(set, sls, resp->l2h, msgb_l2len(resp));
msgb_free(resp);
return 0;
}
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index 1b6ca0e..263d156 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -511,7 +511,8 @@ int mtp_link_handle_data(struct mtp_link *link, struct msgb *msg)
return rc;
}
-int mtp_link_set_submit_sccp_data(struct mtp_link_set *set, int sls, const uint8_t *data, unsigned int length)
+static int mtp_link_set_submit_sccp_data(struct mtp_link_set *set, int sls,
+ const uint8_t *data, unsigned int length)
{
if (!set->sccp_up) {
@@ -668,6 +669,10 @@ struct mtp_link_set *mtp_link_set_alloc(struct bsc_data *bsc)
llist_add_tail(&set->entry, &bsc->linksets);
+ /* implemenentation pointers */
+ set->submit_sccp = mtp_link_set_submit_sccp_data;
+ set->submit_isup = mtp_link_set_submit_isup_data;
+
return set;
}
diff --git a/src/sccp_state.c b/src/sccp_state.c
index 616167f..c016385 100644
--- a/src/sccp_state.c
+++ b/src/sccp_state.c
@@ -133,7 +133,7 @@ static void handle_local_sccp(struct mtp_link_set *set, struct msgb *inpt, struc
cr = (struct sccp_connection_request *) inpt->l2h;
msg = create_sccp_refuse(&cr->source_local_reference);
if (msg) {
- mtp_link_set_submit_sccp_data(set, sls, msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, sls, msg->l2h, msgb_l2len(msg));
msgb_free(msg);
}
return;
@@ -153,7 +153,7 @@ static void handle_local_sccp(struct mtp_link_set *set, struct msgb *inpt, struc
LOGP(DINP, LOGL_DEBUG, "Sending a release request now.\n");
msg = create_sccp_rlsd(&con->dst_ref, &con->src_ref);
if (msg) {
- mtp_link_set_submit_sccp_data(set, con->sls, msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, con->sls, msg->l2h, msgb_l2len(msg));
msgb_free(msg);
}
return;
@@ -217,7 +217,7 @@ static void bsc_reset_timeout(void *_app)
}
++app->reset_count;
- mtp_link_set_submit_sccp_data(set, -1, msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, -1, msg->l2h, msgb_l2len(msg));
msgb_free(msg);
osmo_timer_schedule(&app->reset_timeout, 20, 0);
}
@@ -276,7 +276,7 @@ void release_bsc_resources(struct msc_connection *fw)
continue;
/* wait for the clear commands */
- mtp_link_set_submit_sccp_data(set, con->sls, msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, con->sls, msg->l2h, msgb_l2len(msg));
msgb_free(msg);
}
@@ -304,7 +304,7 @@ static void send_rlc_to_bsc(struct mtp_link_set *set,
if (!msg)
return;
- mtp_link_set_submit_sccp_data(set, sls, msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, sls, msg->l2h, msgb_l2len(msg));
msgb_free(msg);
}
@@ -498,7 +498,7 @@ static void send_local_rlsd_for_con(void *data)
LOGP(DINP, LOGL_DEBUG, "Sending RLSD for 0x%x the %d time.\n",
sccp_src_ref_to_int(&con->src_ref), con->rls_tries);
- mtp_link_set_submit_sccp_data(set, con->sls, rlsd->l2h, msgb_l2len(rlsd));
+ set->submit_sccp(set, con->sls, rlsd->l2h, msgb_l2len(rlsd));
msgb_free(rlsd);
}
@@ -523,7 +523,7 @@ static void send_reset_ack(struct mtp_link_set *set, int sls)
0x00, 0x01, 0x31
};
- mtp_link_set_submit_sccp_data(set, sls, reset_ack, sizeof(reset_ack));
+ set->submit_sccp(set, sls, reset_ack, sizeof(reset_ack));
}
void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg)
@@ -543,8 +543,8 @@ void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg)
if (msc->app->forward_only) {
if (!set->sccp_up)
return;
- mtp_link_set_submit_sccp_data(set, -1,
- msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, -1,
+ msg->l2h, msgb_l2len(msg));
} else {
struct sccp_parse_result result;
int rc;
@@ -574,8 +574,8 @@ void msc_dispatch_sccp(struct msc_connection *msc, struct msgb *msg)
bss_rewrite_header_to_bsc(msg, set->opc, set->dpc);
/* we can not forward it right now */
- mtp_link_set_submit_sccp_data(set, sls,
- msg->l2h, msgb_l2len(msg));
+ set->submit_sccp(set, sls,
+ msg->l2h, msgb_l2len(msg));
}
}
}
diff --git a/src/ss7_application.c b/src/ss7_application.c
index 49f005d..cdb100f 100644
--- a/src/ss7_application.c
+++ b/src/ss7_application.c
@@ -38,7 +38,7 @@ static void forward_sccp_stp(struct mtp_link_set *set, struct msgb *_msg, int sl
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));
+ set->submit_sccp(other, sls, _msg->l2h, msgb_l2len(_msg));
}
static void forward_isup_stp(struct mtp_link_set *set, struct msgb *msg, int sls)
@@ -47,7 +47,7 @@ static void forward_isup_stp(struct mtp_link_set *set, struct msgb *msg, int sls
other = set->app->route_src.set == set ?
set->app->route_dst.set : set->app->route_src.set;
isup_scan_for_reset(set->app, msg);
- mtp_link_set_submit_isup_data(other, sls, msg->l3h, msgb_l3len(msg));
+ set->submit_isup(other, sls, msg->l3h, msgb_l3len(msg));
}
static void on_link_set_sccp(struct mtp_link_set *set, struct msgb *_msg, int sls)