Remove 'struct bsc_msc_connection' + fix IPA-encapsulated CTRL

The bsc_msc_connection dates back to the old pre-libosmo-sigtran
days, and 90% of the field members weren't used at all (even the
new sigtran specific ones!).  Let's merge what remains into struct
bsc_msc_data.

As a side effect, the already dysfunctional "dest A.B.C.D" VTY
command has been removed from the MSC node.

There's quite a bit of fall-out in the CTRL interface, which was
the code with strongest ties to bsc_msc_connection.  This was
resolved by properly porting CTRL handling over to libosmo-sigtran,
meaning that an IPA/SCCPlite connected MSC can now again send CTRL
GET/SET commands, and can also receive those selective few TRAPs
that old osmo-bsc-sccplite also sent to its MSC[s].

Change-Id: I6b7354f3b23a26bb4eab12213ca3d3b614c8154f
Related: OS#2012
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 80f9b01..bae13f0 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -5,7 +5,6 @@
 	abis_rsl.h \
 	acc_ramp.h \
 	arfcn_range_encode.h \
-	bsc_msc.h \
 	bsc_msg_filter.h \
 	bsc_rll.h \
 	bsc_subscriber.h \
diff --git a/include/osmocom/bsc/bsc_msc.h b/include/osmocom/bsc/bsc_msc.h
deleted file mode 100644
index ceaea53..0000000
--- a/include/osmocom/bsc/bsc_msc.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Routines to talk to the MSC using the IPA Protocol */
-/*
- * (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
- * (C) 2010 by On-Waves
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef BSC_MSC_H
-#define BSC_MSC_H
-
-#include <osmocom/core/write_queue.h>
-#include <osmocom/core/timer.h>
-#include <osmocom/sigtran/sccp_sap.h>
-#include <osmocom/bsc/a_reset.h>
-
-#include <netinet/in.h>
-
-struct bsc_msc_dest {
-	struct llist_head list;
-
-	char *ip;
-	int port;
-	int dscp;
-};
-
-
-struct bsc_msc_connection {
-	/* FIXME: Remove stuff that is no longer needed! */
-	struct osmo_wqueue write_queue;
-	int is_connected;
-	int is_authenticated;
-	int first_contact;
-
-	struct llist_head *dests;
-
-	const char *name;
-
-	void (*connection_loss) (struct bsc_msc_connection *);
-	void (*connected) (struct bsc_msc_connection *);
-	struct osmo_timer_list reconnect_timer;
-	struct osmo_timer_list timeout_timer;
-
-	struct msgb *pending_msg;
-
-	/* Sigtran connection data */
-	struct osmo_sccp_instance *sccp;
-	struct osmo_sccp_user *sccp_user;
-	struct osmo_sccp_addr g_calling_addr;
-	struct osmo_sccp_addr g_called_addr;
-	struct a_reset_ctx *reset;
-
-	int conn_id_counter;
-};
-
-struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest);
-int bsc_msc_connect(struct bsc_msc_connection *);
-void bsc_msc_schedule_connect(struct bsc_msc_connection *);
-
-void bsc_msc_lost(struct bsc_msc_connection *);
-
-struct msgb *bsc_msc_id_get_resp(int fixed, const char *token, const uint8_t *res, int len);
-
-#endif
diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h
index 2ace178..baa58e7 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -3,6 +3,7 @@
  *
  * (C) 2010-2015 by Holger Hans Peter Freyther <zecke@selfish.org>
  * (C) 2010-2015 by On-Waves
+ * (C) 2018 by Harald Welte <laforge@gnumonks.org>
  * All Rights Reserved
  *
  * This program is free software; you can redistribute it and/or modify
@@ -27,7 +28,6 @@
 #ifndef _OSMO_MSC_DATA_H
 #define _OSMO_MSC_DATA_H
 
-#include "bsc_msc.h"
 #include "debug.h"
 
 #include <osmocom/core/timer.h>
@@ -75,26 +75,20 @@
 
 
 	/* Connection data */
-	struct bsc_msc_connection *msc_con;
 	struct osmo_plmn_id core_plmn;
 	int core_lac;
 	int core_ci;
 	int rtp_base;
+	bool is_authenticated;
 
 	/* audio codecs */
 	struct gsm48_multi_rate_conf amr_conf;
 	struct gsm_audio_support **audio_support;
 	int audio_length;
 
-	/* destinations */
-	struct llist_head dests;
-
 	/* ussd welcome text */
 	char *ussd_welcome_txt;
 
-	/* mgcp agent */
-	struct osmo_wqueue mgcp_agent;
-
 	int nr;
 
 	/* ussd msc connection lost text */
diff --git a/include/osmocom/bsc/osmo_bsc_sigtran.h b/include/osmocom/bsc/osmo_bsc_sigtran.h
index 80d4f5b..bd8b063 100644
--- a/include/osmocom/bsc/osmo_bsc_sigtran.h
+++ b/include/osmocom/bsc/osmo_bsc_sigtran.h
@@ -41,3 +41,6 @@
 
 /* Send reset-ack to MSC */
 void osmo_bsc_sigtran_tx_reset_ack(const struct bsc_msc_data *msc);
+
+/* receive + process a CTRL command from the piggy-back on the IPA/SCCPlite link */
+int bsc_sccplite_rx_ctrl(struct osmo_ss7_asp *asp, struct msgb *msg);