aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_ctrl.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-05-26 22:56:59 +0200
committerHarald Welte <laforge@gnumonks.org>2018-11-29 18:14:25 +0100
commitba6c93d3c4563032892e71e4c87b2152df3c74cb (patch)
tree4a6be11f4aa0c1b747cbee7850f153e8b22e564b /src/osmo-bsc/osmo_bsc_ctrl.c
parent7ae0f9c271fd403bab96897056eb2efe87b2adec (diff)
Re-introduce support for IPA-encapsulated MGCPlaforge/mgcp-ipa
Old osmo-bsc-sccplite already supported this, but in the migration over to libosmo-sigtran and to real 3GPP AoIP, this functionality got lost. We now crate a UDP proxy socket. Any MGCP commands received via IPA from MSC (or rather: bsc_nat) are retransmitted to the MGW via UDP on this socket. Any responses back from the MGW received on the UDP socket are retransmitted back to MSC/bsc_nat as MGCP inside the IPA multiplex. Closes: OS#2536 Change-Id: I38ad8fa645c08900e0e1f1b4b96136bc6d96b3ab
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_ctrl.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_ctrl.c59
1 files changed, 41 insertions, 18 deletions
diff --git a/src/osmo-bsc/osmo_bsc_ctrl.c b/src/osmo-bsc/osmo_bsc_ctrl.c
index 80699f877..afe061ecc 100644
--- a/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -52,6 +52,39 @@ static struct osmo_ss7_as *msc_get_ss7_as(struct bsc_msc_data *msc)
return rt->dest.as;
}
+static int _ss7_as_send(struct osmo_ss7_as *as, struct msgb *msg)
+{
+ struct osmo_ss7_asp *asp;
+ unsigned int i;
+
+ /* FIXME: unify with xua_as_transmit_msg() and perform proper ASP lookup */
+ for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
+ asp = as->cfg.asps[i];
+ if (!asp)
+ continue;
+ /* FIXME: deal with multiple ASPs per AS */
+ return osmo_ss7_asp_send(asp, msg);
+ }
+ msgb_free(msg);
+ return -1;
+}
+
+int bsc_sccplite_msc_send(struct bsc_msc_data *msc, struct msgb *msg)
+{
+ struct osmo_ss7_as *as;
+
+ as = msc_get_ss7_as(msc);
+ if (!as) {
+ msgb_free(msg);
+ return -1;
+ }
+
+ /* don't attempt to send CTRL on a non-SCCPlite AS */
+ if (as->cfg.proto != OSMO_SS7_ASP_PROT_IPA)
+ return 0;
+
+ return _ss7_as_send(as, msg);
+}
/* Encode a CTRL command and send it to the given ASP
* \param[in] asp ASP through which we shall send the encoded message
@@ -83,30 +116,20 @@ static int sccplite_asp_ctrl_cmd_send(struct osmo_ss7_asp *asp, struct ctrl_cmd
* Caller must hence free 'cmd' itself. */
static int sccplite_msc_ctrl_cmd_send(struct bsc_msc_data *msc, struct ctrl_cmd *cmd)
{
- struct osmo_ss7_as *as;
- struct osmo_ss7_asp *asp;
- unsigned int i;
+ struct msgb *msg;
- as = msc_get_ss7_as(msc);
- if (!as)
+ msg = ctrl_cmd_make(cmd);
+ if (!msg)
return -1;
- /* don't attempt to send CTRL on a non-SCCPlite AS */
- if (as->cfg.proto != OSMO_SS7_ASP_PROT_IPA)
- return 0;
+ ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_CTRL);
+ ipa_prepend_header(msg, IPAC_PROTO_OSMO);
- /* FIXME: unify with xua_as_transmit_msg() and perform proper ASP lookup */
- for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
- asp = as->cfg.asps[i];
- if (!asp)
- continue;
- /* FIXME: deal with multiple ASPs per AS */
- return sccplite_asp_ctrl_cmd_send(asp, cmd);
- }
- return -1;
+ return bsc_sccplite_msc_send(msc, msg);
}
-/* receive + process a CTRL command from the piggy-back on the IPA/SCCPlite link */
+/* receive + process a CTRL command from the piggy-back on the IPA/SCCPlite link.
+ * Transfers msg ownership. */
int bsc_sccplite_rx_ctrl(struct osmo_ss7_asp *asp, struct msgb *msg)
{
struct ctrl_cmd *cmd;