prepare sgsn_mm_ctx for Gb and Iu mode (UMTS)

Explicitly mark those sgsn_mm_ctx members that apply for Gb mode and (upcoming)
Iu mode, respectively.

Add some comments in sgsn_mm_ctx.

Change-Id: Ife9b02549f284e2547f16117cf43d7a36948fc4b
Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de>
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index afff30f..3fb359b 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -174,7 +174,7 @@
 	lle = gprs_lle_get_or_create(tlli, 3);
 	ctx = sgsn_mm_ctx_alloc(tlli, raid);
 	ctx->mm_state = GMM_REGISTERED_NORMAL;
-	ctx->llme = lle->llme;
+	ctx->gb.llme = lle->llme;
 
 	ictx = sgsn_mm_ctx_by_tlli(tlli, raid);
 	OSMO_ASSERT(ictx == ctx);
@@ -729,7 +729,7 @@
 	ctx = alloc_mm_ctx(local_tlli, &raid);
 
 	/* inject the detach */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  detach_req, ARRAY_SIZE(detach_req));
 
 	/* verify that a single message (hopefully the Detach Accept) has been
@@ -770,7 +770,7 @@
 	ctx = alloc_mm_ctx(local_tlli, &raid);
 
 	/* inject the detach */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  detach_req, ARRAY_SIZE(detach_req));
 
 	/* verify that no message (and therefore no Detach Accept) has been
@@ -967,14 +967,14 @@
 	OSMO_ASSERT(sgsn_tx_counter == 1);
 
 	/* inject the identity response (IMEI) */
-	send_0408_message(ctx->llme, foreign_tlli, &raid,
+	send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 			  ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
 
 	/* we expect an identity request (IMSI) */
 	OSMO_ASSERT(sgsn_tx_counter == 1);
 
 	/* inject the identity response (IMSI) */
-	send_0408_message(ctx->llme, foreign_tlli, &raid,
+	send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 			  ident_resp_imsi, ARRAY_SIZE(ident_resp_imsi));
 
 	/* check that the MM context has not been removed due to a failed
@@ -996,7 +996,7 @@
 		/* we got an auth & ciph request */
 
 		/* inject the auth & ciph response */
-		send_0408_message(ctx->llme, foreign_tlli, &raid,
+		send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 				  auth_ciph_resp, ARRAY_SIZE(auth_ciph_resp));
 
 		/* check that the MM context has not been removed due to a
@@ -1018,7 +1018,7 @@
 	local_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
 
 	/* inject the attach complete */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  attach_compl, ARRAY_SIZE(attach_compl));
 
 	OSMO_ASSERT(ctx->mm_state == GMM_REGISTERED_NORMAL);
@@ -1027,7 +1027,7 @@
 	OSMO_ASSERT(sgsn_tx_counter == 0);
 
 	/* inject the detach */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  detach_req, ARRAY_SIZE(detach_req));
 
 	/* verify that things are gone */
@@ -1555,14 +1555,14 @@
 	OSMO_ASSERT(sgsn_tx_counter == 1);
 
 	/* inject the identity response (IMEI) */
-	send_0408_message(ctx->llme, foreign_tlli, &raid,
+	send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 			  ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
 
 	/* we expect an identity request (IMSI) */
 	OSMO_ASSERT(sgsn_tx_counter == 1);
 
 	/* inject the identity response (IMSI) */
-	send_0408_message(ctx->llme, foreign_tlli, &raid,
+	send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 			  ident_resp_imsi, ARRAY_SIZE(ident_resp_imsi));
 
 	/* check that the MM context has not been removed due to a failed
@@ -1580,7 +1580,7 @@
 	local_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
 
 	/* inject the attach complete */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 			  attach_compl, ARRAY_SIZE(attach_compl));
 
 	OSMO_ASSERT(ctx->mm_state == GMM_REGISTERED_NORMAL);
@@ -1707,7 +1707,7 @@
 	OSMO_ASSERT(sgsn_tx_counter == 1);
 
 	/* inject the identity response (IMEI) */
-	send_0408_message(ctx->llme, foreign_tlli, &raid,
+	send_0408_message(ctx->gb.llme, foreign_tlli, &raid,
 			  ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
 
 	/* check that the MM context has not been removed due to a failed
@@ -1740,7 +1740,7 @@
 
 	/* inject the attach complete */
 	local_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  attach_compl, ARRAY_SIZE(attach_compl));
 
 	/* we don't expect a response */
@@ -1753,7 +1753,7 @@
 	printf("  - Repeated RA Update Request\n");
 
 	/* inject the RA update request */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  ra_upd_req, ARRAY_SIZE(ra_upd_req));
 
 	/* we expect an RA update accept */
@@ -1766,7 +1766,7 @@
 	ptmsi2 = ctx->p_tmsi;
 
 	/* repeat the RA update request */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  ra_upd_req, ARRAY_SIZE(ra_upd_req));
 
 	/* we expect an RA update accept */
@@ -1780,7 +1780,7 @@
 
 	/* inject the RA update complete */
 	local_tlli = gprs_tmsi2tlli(ptmsi2, TLLI_LOCAL);
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  ra_upd_complete, ARRAY_SIZE(ra_upd_complete));
 
 	/* we don't expect a response */
@@ -1791,7 +1791,7 @@
 	OSMO_ASSERT(ctx->p_tmsi == ptmsi2);
 
 	/* inject the detach */
-	send_0408_message(ctx->llme, local_tlli, &raid,
+	send_0408_message(ctx->gb.llme, local_tlli, &raid,
 			  detach_req, ARRAY_SIZE(detach_req));
 
 	/* verify that things are gone */
@@ -1931,7 +1931,7 @@
 	OSMO_ASSERT(last_dl_parse_ctx.tlli == ms_tlli);
 
 	/* inject the identity response (IMEI) */
-	send_0408_message(ctx->llme, ms_tlli, &raid1,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid1,
 			  ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
 
 	/* check that the MM context has not been removed due to a failed
@@ -1951,7 +1951,7 @@
 
 	/* inject the attach complete */
 	ms_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
-	send_0408_message(ctx->llme, ms_tlli, &raid1,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid1,
 			  attach_compl, ARRAY_SIZE(attach_compl));
 
 	/* we don't expect a response */
@@ -1964,7 +1964,7 @@
 	printf("  - RA Update Request (RA 1 -> RA 1)\n");
 
 	/* inject the RA update request */
-	send_0408_message(ctx->llme, ms_tlli, &raid1,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid1,
 			  ra_upd_req1, ARRAY_SIZE(ra_upd_req1));
 
 	/* we expect an RA update accept */
@@ -1983,7 +1983,7 @@
 
 	/* inject the RA update complete */
 	ms_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
-	send_0408_message(ctx->llme, ms_tlli, &raid1,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid1,
 			  ra_upd_complete, ARRAY_SIZE(ra_upd_complete));
 
 	/* we don't expect a response */
@@ -1992,7 +1992,7 @@
 	OSMO_ASSERT(ctx->mm_state == GMM_REGISTERED_NORMAL);
 	OSMO_ASSERT(ctx->p_tmsi_old == 0);
 	OSMO_ASSERT(ctx->p_tmsi == ptmsi1);
-	OSMO_ASSERT(ctx->tlli == ms_tlli);
+	OSMO_ASSERT(ctx->gb.tlli == ms_tlli);
 
 	printf("  - RA Update Request (RA 1 -> RA 2)\n");
 
@@ -2000,7 +2000,7 @@
 	ms_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_FOREIGN);
 
 	/* It is coming from RA 1 => ra_upd_req1 */
-	send_0408_message(ctx->llme, ms_tlli, &raid2,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid2,
 			  ra_upd_req1, ARRAY_SIZE(ra_upd_req1));
 
 	/* we expect an RA update accept */
@@ -2013,7 +2013,7 @@
 	ms_tlli = gprs_tmsi2tlli(0x12345678, TLLI_FOREIGN);
 
 	/* It is coming from RA 1 => ra_upd_req1 */
-	send_0408_message(ctx->llme, ms_tlli, &raid2,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid2,
 			  ra_upd_req_other, ARRAY_SIZE(ra_upd_req_other));
 
 	/* we expect an RA update reject (and a LLC XID RESET) */
@@ -2051,7 +2051,7 @@
 	OSMO_ASSERT(ictx != NULL);
 	OSMO_ASSERT(ictx == ctx);
 
-	send_0408_message(ctx->llme, ms_tlli, &raid2,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid2,
 			  attach_compl, ARRAY_SIZE(attach_compl));
 
 	/* we don't expect a response */
@@ -2064,7 +2064,7 @@
 	printf("  - RA Update Request (RA 2 -> RA 2)\n");
 
 	/* inject the RA update request */
-	send_0408_message(ctx->llme, ms_tlli, &raid2,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid2,
 			  ra_upd_req2, ARRAY_SIZE(ra_upd_req2));
 
 	/* we expect an RA update accept */
@@ -2082,7 +2082,7 @@
 
 	/* inject the RA update complete */
 	ms_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
-	send_0408_message(ctx->llme, ms_tlli, &raid2,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid2,
 			  ra_upd_complete, ARRAY_SIZE(ra_upd_complete));
 
 	/* we don't expect a response */
@@ -2091,11 +2091,11 @@
 	OSMO_ASSERT(ctx->mm_state == GMM_REGISTERED_NORMAL);
 	OSMO_ASSERT(ctx->p_tmsi_old == 0);
 	OSMO_ASSERT(ctx->p_tmsi == ptmsi1);
-	OSMO_ASSERT(ctx->tlli == ms_tlli);
+	OSMO_ASSERT(ctx->gb.tlli == ms_tlli);
 
 
 	/* inject the detach */
-	send_0408_message(ctx->llme, ms_tlli, &raid2,
+	send_0408_message(ctx->gb.llme, ms_tlli, &raid2,
 			  detach_req, ARRAY_SIZE(detach_req));
 
 	/* verify that things are gone */