Initial support for export + curses-visualization of measurements

This extends osmo_nitb to offer a UDP feed of real-time measurement
reports, which can be used by (a variety of) external tools for
visualization or other processing.

We also add a small ncurses based tool (meas_vis) which shows a
baragraph display of the last few mobile stations that were active,
indicating their uplink/downlink receive level and quality.

<WARNING>
This sends non-portable structures like gsm_meas_rep over UDP
and assumes the receiver has identical alignment and endianness!  Before
this feature is merged, it either needs to be converted to a unix domain
socket (but they don't do multicast, which would be nice) or the wire
format needs to change into something portable with defined alignment
and encoding
</WARNING>
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index f9213f5..06ef2d1 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -49,6 +49,8 @@
 #include <openbsc/mncc_int.h>
 #include <openbsc/handover.h>
 
+#include "meas_feed.h"
+
 extern struct gsm_network *gsmnet_from_vty(struct vty *v);
 
 static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr, int pending)
@@ -947,6 +949,11 @@
 
 static int config_write_mncc_int(struct vty *vty)
 {
+	uint16_t meas_port;
+	char *meas_host;
+
+	meas_feed_cfg_get(&meas_host, &meas_port);
+
 	vty_out(vty, "mncc-int%s", VTY_NEWLINE);
 	vty_out(vty, " default-codec tch-f %s%s",
 		get_value_string(tchf_codec_names, mncc_int.def_codec[0]),
@@ -954,6 +961,10 @@
 	vty_out(vty, " default-codec tch-h %s%s",
 		get_value_string(tchh_codec_names, mncc_int.def_codec[1]),
 		VTY_NEWLINE);
+	if (meas_port)
+		vty_out(vty, " meas-feed destination %s %u%s",
+			meas_host, meas_port, VTY_NEWLINE);
+
 
 	return CMD_SUCCESS;
 }
@@ -994,6 +1005,28 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(mnccint_meas_feed, mnccint_meas_feed_cmd,
+	"meas-feed destination ADDR <0-65535>",
+	"FIXME")
+{
+	int rc;
+
+	rc = meas_feed_cfg_set(argv[0], atoi(argv[1]));
+	if (rc < 0)
+		return CMD_WARNING;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(meas_feed_scenario, meas_feed_scenario_cmd,
+	"meas-feed scenario NAME",
+	"FIXME")
+{
+	meas_feed_scenario_set(argv[0]);
+
+	return CMD_SUCCESS;
+}
+
 int bsc_vty_init_extra(void)
 {
 	osmo_signal_register_handler(SS_SCALL, scall_cbfn, NULL);
@@ -1028,12 +1061,14 @@
 	install_element(ENABLE_NODE, &smsqueue_clear_cmd);
 	install_element(ENABLE_NODE, &smsqueue_fail_cmd);
 	install_element(ENABLE_NODE, &subscriber_send_pending_sms_cmd);
+	install_element(ENABLE_NODE, &meas_feed_scenario_cmd);
 
 	install_element(CONFIG_NODE, &cfg_mncc_int_cmd);
 	install_node(&mncc_int_node, config_write_mncc_int);
 	vty_install_default(MNCC_INT_NODE);
 	install_element(MNCC_INT_NODE, &mnccint_def_codec_f_cmd);
 	install_element(MNCC_INT_NODE, &mnccint_def_codec_h_cmd);
+	install_element(MNCC_INT_NODE, &mnccint_meas_feed_cmd);
 
 	install_element(CFG_LOG_NODE, &log_level_sms_cmd);