[BSC] Keep a SYSTEM INFORMATION cache for each BTS

This will later be useful for handover where we need to copy the cell
channel allocation into a normal 04.08 message
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 170ebab..5533fea 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -43,6 +43,7 @@
 #include <osmocore/timer.h>
 #include <openbsc/gsm_04_08.h>
 #include <openbsc/abis_rsl.h>
+#include <openbsc/system_information.h>
 #include <openbsc/mncc.h>
 #include <osmocore/tlv.h>
 #include <osmocore/bitvec.h>
@@ -393,6 +394,8 @@
 	struct gsm_bts_trx_ts ts[TRX_NR_TS];
 };
 
+#define GSM_BTS_SI(bts, i)	(void *)(bts->si_buf[i])
+
 enum gsm_bts_type {
 	GSM_BTS_TYPE_UNKNOWN,
 	GSM_BTS_TYPE_BS11,
@@ -541,6 +544,9 @@
 		} data;
 	} si_common;
 
+	/* buffers where we put the pre-computed SI */
+	sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
+
 	/* ip.accesss Unit ID's have Site/BTS/TRX layout */
 	union {
 		struct {
diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h
index 982a9ac..55c00d8 100644
--- a/openbsc/include/openbsc/system_information.h
+++ b/openbsc/include/openbsc/system_information.h
@@ -1,6 +1,39 @@
 #ifndef _SYSTEM_INFO_H
 #define _SYSTEM_INFO_H
 
-int gsm_generate_si(u_int8_t *output, struct gsm_bts *bts, int type);
+#define GSM_MACBLOCK_LEN 		23
+
+enum osmo_sysinfo_type {
+	SYSINFO_TYPE_NONE,
+	SYSINFO_TYPE_1,
+	SYSINFO_TYPE_2,
+	SYSINFO_TYPE_3,
+	SYSINFO_TYPE_4,
+	SYSINFO_TYPE_5,
+	SYSINFO_TYPE_6,
+	SYSINFO_TYPE_7,
+	SYSINFO_TYPE_8,
+	SYSINFO_TYPE_9,
+	SYSINFO_TYPE_10,
+	SYSINFO_TYPE_13,
+	SYSINFO_TYPE_16,
+	SYSINFO_TYPE_17,
+	SYSINFO_TYPE_18,
+	SYSINFO_TYPE_19,
+	SYSINFO_TYPE_20,
+	SYSINFO_TYPE_2bis,
+	SYSINFO_TYPE_2ter,
+	SYSINFO_TYPE_2quater,
+	SYSINFO_TYPE_5bis,
+	SYSINFO_TYPE_5ter,
+	/* FIXME all the various bis and ter */
+	_MAX_SYSINFO_TYPE
+};
+
+typedef u_int8_t sysinfo_buf_t[GSM_MACBLOCK_LEN];
+
+uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type);
+const char *gsm_sitype_name(enum osmo_sysinfo_type si_type);
+int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type);
 
 #endif