tbf: Add state WAIT_ASSIGN

Currently the state on the TBF is set to ASSIGN when it is created
and in general changed to FLOW when it is acknowledged by the MS. The
moment when the assignment is really transmitted to the MS (which can
take some time) is not reflected by the state. A TBF can considered
to be valid, when the assignment is received by the MS.

Add the state WAIT_ASSIGN that is entered when the assigment has been
send to the MS (more precisely: when the corresponding RTS has been
processed or the message has been sent to the BTS).

The TBF, its PDCH(s), and its TFI can be assumed to be valid, when the
TBF has a state of WAIT_ASSIGN or higher (assuming that the TBF
starting time has not been set, which is currently only done for SBA,
which are not associated with a TBF).

Note that due to queuing in the BTS there can still be a invalid
time period for immediate assignments, when the request is lingering
in the AGCH or PCH queues.

Sponsored-by: On-Waves ehf
diff --git a/src/bts.cpp b/src/bts.cpp
index 5cadda1..715fb51 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -544,8 +544,11 @@
 		m_bts.trx[trx_no].arfcn, ts_no, tsc, usf, 0, sb_fn,
 		m_bts.alpha, m_bts.gamma, -1);
 
-	if (plen >= 0)
+	if (plen >= 0) {
 		pcu_l1if_tx_agch(immediate_assignment, plen);
+		if (tbf)
+			tbf->set_state(GPRS_RLCMAC_WAIT_ASSIGN);
+	}
 
 	bitvec_free(immediate_assignment);
 
@@ -603,8 +606,10 @@
 		(tbf->pdch[ts]->last_rts_fn + 21216) % 2715648, tbf->ta(),
 		tbf->trx->arfcn, ts, tbf->tsc(), 7, poll,
 		tbf->poll_fn, m_bts.alpha, m_bts.gamma, -1);
-	if (plen >= 0)
+	if (plen >= 0) {
 		pcu_l1if_tx_pch(immediate_assignment, plen, imsi);
+		tbf->set_state(GPRS_RLCMAC_WAIT_ASSIGN);
+	}
 	bitvec_free(immediate_assignment);
 }