aboutsummaryrefslogtreecommitdiffstats
path: root/src/msc_conn.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-06 04:51:44 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-06 04:51:44 +0800
commita4ca6d3947bb6063ac4c5c64064f6f7a93f9857f (patch)
treea1a061ebb52d02a53f30368bf975a5ac138028cf /src/msc_conn.c
parent0f349f2c6df7c73653de8ef8b9082aab7a83c085 (diff)
msc: Create a function to send or queue messages.
Diffstat (limited to 'src/msc_conn.c')
-rw-r--r--src/msc_conn.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/msc_conn.c b/src/msc_conn.c
index b03dc5f..1cee1f9 100644
--- a/src/msc_conn.c
+++ b/src/msc_conn.c
@@ -63,6 +63,21 @@ void mtp_link_slta_recv(struct mtp_link *link)
}
}
+int send_or_queue_bsc_msg(struct mtp_link *link, int sls, struct msgb *msg)
+{
+ if (link->sltm_pending) {
+ LOGP(DMSC, LOGL_NOTICE, "Queueing msg for pending SLTM.\n");
+ msg->l3h = (uint8_t *) sls;
+ msgb_enqueue(&link->pending_msgs, msg);
+ return 1;
+ }
+
+ if (mtp_link_submit_sccp_data(link, sls, msg->l2h, msgb_l2len(msg)) != 0)
+ LOGP(DMSC, LOGL_ERROR, "Could not forward SCCP message.\n");
+ return 0;
+}
+
+
void msc_clear_queue(struct bsc_data *data)
{
struct msgb *msg;
@@ -210,15 +225,9 @@ static int ipaccess_a_fd_cb(struct bsc_fd *bfd)
bss_rewrite_header_to_bsc(msg, link->opc, link->dpc);
/* we can not forward it right now */
- if (link->sltm_pending) {
- LOGP(DMSC, LOGL_NOTICE, "Queueing msg for pending SLTM.\n");
- msg->l3h = (uint8_t *) sls;
- msgb_enqueue(&link->pending_msgs, msg);
+ if (send_or_queue_bsc_msg(link, sls, msg) == 1)
return 0;
- }
- if (mtp_link_submit_sccp_data(link, sls, msg->l2h, msgb_l2len(msg)) != 0)
- LOGP(DMSC, LOGL_ERROR, "Could not forward SCCP message.\n");
}
} else if (hh->proto == NAT_MUX) {
mgcp_forward(bsc, msg->l2h, msgb_l2len(msg));