Implement AoIP, port to M3UA SIGTRAN (large addition and refactoring)

This was originally a long series of commits converging to the final result
seen in this patch. It does not make much sense to review the smaller steps'
trial and error, we need to review this entire change as a whole.

Implement AoIP in osmo-msc and osmo-bsc.

Change over to the new libosmo-sigtran API with support for proper
SCCP/M3UA/SCTP stacking, as mandated by 3GPP specifications for the IuCS and
IuPS interfaces.

From here on, a separate osmo-stp process is required for SCCP routing between
OsmoBSC / OsmoHNBGW <-> OsmoMSC / OsmoSGSN

jenkins.sh: build from libosmo-sccp and osmo-iuh master branches now for new
M3UA SIGTRAN.

Patch-by: pmaier, nhofmeyr, laforge
Change-Id: I5ae4e05ee7c57cad341ea5e86af37c1f6b0ffa77
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.c b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
index c4cf353..095da81 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_reject.c
+++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
@@ -38,9 +38,11 @@
 
 	btw("HLR sends _SEND_AUTH_INFO_ERROR = unknown IMSI");
 	auth_request_sent = false;
+	expect_bssap_clear();
 	gsup_rx("09" "010809710000004026f0" "020102", NULL);
 	VERBOSE_ASSERT(auth_request_sent, == false, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	EXPECT_CONN_COUNT(0);
 	clear_vlr();
@@ -62,9 +64,11 @@
 
 	btw("HLR sends _SEND_AUTH_INFO_ERROR = net fail");
 	auth_request_sent = false;
+	expect_bssap_clear();
 	gsup_rx("09" "010809710000004026f0" "020111", NULL);
 	VERBOSE_ASSERT(auth_request_sent, == false, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	EXPECT_CONN_COUNT(0);
 	clear_vlr();
@@ -118,7 +122,9 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
+	expect_bssap_clear();
 	gsup_rx("06010809710000004026f0", NULL);
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	btw("LU was successful, and the conn has already been closed");
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
@@ -145,9 +151,11 @@
 
 	btw("HLR sends _SEND_AUTH_INFO_ERROR = net fail");
 	auth_request_sent = false;
+	expect_bssap_clear();
 	gsup_rx("09" "010809710000004026f0" "020111", NULL);
 	VERBOSE_ASSERT(auth_request_sent, == false, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	EXPECT_CONN_COUNT(0);
 	clear_vlr();
@@ -201,7 +209,9 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
+	expect_bssap_clear();
 	gsup_rx("06010809710000004026f0", NULL);
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	btw("LU was successful, and the conn has already been closed");
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
@@ -229,9 +239,11 @@
 
 	btw("HLR sends _SEND_AUTH_INFO_ERROR = unknown IMSI");
 	auth_request_sent = false;
+	expect_bssap_clear();
 	gsup_rx("09" "010809710000004026f0" "020102", NULL);
 	VERBOSE_ASSERT(auth_request_sent, == false, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	EXPECT_CONN_COUNT(0);
 	clear_vlr();
@@ -255,6 +267,7 @@
 
 	btw("from HLR, rx _SEND_AUTH_INFO_RESULT but it lacks auth tuples");
 	auth_request_sent = false;
+	expect_bssap_clear();
 	gsup_rx("0a"
 		/* imsi */
 		"0108" "09710000004026f0"
@@ -262,6 +275,7 @@
 		,NULL);
 	VERBOSE_ASSERT(auth_request_sent, == false, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	EXPECT_CONN_COUNT(0);
 	clear_vlr();
@@ -315,7 +329,9 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
+	expect_bssap_clear();
 	gsup_rx("06010809710000004026f0", NULL);
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	btw("LU was successful, and the conn has already been closed");
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
@@ -357,7 +373,9 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("HLR also sends GSUP _UPDATE_LOCATION_RESULT");
+	expect_bssap_clear();
 	gsup_rx("06010809710000004026f0", NULL);
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	btw("LU was successful, and the conn has already been closed");
 	VERBOSE_ASSERT(lu_result_sent, == RES_ACCEPT, "%d");
@@ -379,9 +397,11 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("HLR sends UPDATE_LOCATION_ERROR");
+	expect_bssap_clear();
 	gsup_rx("05" "010809710000004026f0" "020102",
 		NULL);
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 	EXPECT_CONN_COUNT(0);
 
 	clear_vlr();
@@ -400,7 +420,9 @@
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	btw("HLR sends only _UPDATE_LOCATION_RESULT, no INSERT DATA");
+	expect_bssap_clear();
 	gsup_rx("06010809710000004026f0", NULL);
+	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 
 	/* TODO should we wait for OSMO_GSUP_MSGT_INSERT_DATA_REQUEST? */