ms: Integrate the MS storage

Use the MS storage to find a MS object for a given TLLI instead of
searching the TBF lists. The TBFs are then taken from the MS object,
if one has been found. If all TBF might be temporarily detached from
the MS object, a GprsMs::Guard is added to prevent the deletion of
the object, in case another TBF gets attached later on in the scope.

Ticket: #1674
Sponsored-by: On-Waves ehf
diff --git a/src/bts.cpp b/src/bts.cpp
index d027993..8d4f494 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -884,13 +884,21 @@
 	int rc;
 
 	if (request->ID.UnionType) {
-		struct gprs_rlcmac_ul_tbf *ul_tbf;
-		struct gprs_rlcmac_dl_tbf *dl_tbf;
+		struct gprs_rlcmac_ul_tbf *ul_tbf = NULL;
+		struct gprs_rlcmac_dl_tbf *dl_tbf = NULL;
 		uint32_t tlli = request->ID.u.TLLI;
 		uint8_t ms_class = 0;
 		uint8_t ta;
 
-		ul_tbf = bts()->ul_tbf_by_tlli(tlli);
+		GprsMs *ms = bts()->ms_by_tlli(tlli);
+		/* Keep the ms, even if it gets idle temporarily */
+		GprsMs::Guard guard(ms);
+
+		if (ms) {
+			ul_tbf = ms->ul_tbf();
+			dl_tbf = ms->dl_tbf();
+		}
+
 		if (ul_tbf) {
 			LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
 				"TLLI=0x%08x while %s still "
@@ -900,7 +908,7 @@
 			ul_tbf = NULL;
 		}
 
-		if ((dl_tbf = bts()->dl_tbf_by_tlli(tlli))) {
+		if (dl_tbf) {
 			LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
 				"TLLI=0x%08x while %s still exists. "
 				"Killing pending DL TBF\n", tlli,