Add bts counters to count BTS events where we don't have a bts

In some (error-) cases we might be unable to determine which BTS to use
when counting handover events. We don't want to loose these events
because then ctr(bsc) == sum(ctr(bsc->bts)) would not be true anymore.

Those events are now counted by a counter in struct gsm_network which
uses an index that is out of range for regular BTS (65536).

Change-Id: Ic0f3edd5dc014c4eac5e8423133633a3e5d4c13e
Related: SYS#4877
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 1dac670..1a4a1c4 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1089,6 +1089,11 @@
 	BSC_STAT_NUM_BTS_TOTAL,
 };
 
+/* BTS counter index if a BTS could not be found
+ * Currently we are limited to bts 0 - 255 in the VTY, but that might change in
+ * the future so use 2**16 */
+#define BTS_STAT_IDX_UNKNOWN (UINT16_MAX + 1)
+
 struct gsm_tz {
 	int override; /* if 0, use system's time zone instead. */
 	int hr; /* hour */
@@ -1123,6 +1128,11 @@
 	struct llist_head bts_list;
 	struct llist_head bts_rejected;
 
+        /* BTS-based counters when we can't find the actual BTS
+         * e.g. when conn->lchan is NULL */
+        struct rate_ctr_group *bts_unknown_ctrs;
+        struct osmo_stat_item_group *bts_unknown_statg;
+
 	/* see gsm_network_T_defs */
 	struct osmo_tdef *T_defs;