add osmo_classmark_* API

osmo-bsc and osmo-msc implement identical Classmark structures. It makes sense
to define once near the gsm48 protocol definitions.

Also move along some generic Classmark API from osmo-msc.

Change-Id: Ifd27bab0380f7ad0c44c719aa6c8bd62cf7b034c
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 234fa79..fbd4fe6 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -56,6 +56,22 @@
 #endif
 } __attribute__ ((packed));
 
+struct osmo_gsm48_classmark {
+	bool classmark1_set;
+	struct gsm48_classmark1 classmark1;
+	uint8_t classmark2_len;
+	struct gsm48_classmark2 classmark2;
+	uint8_t classmark3_len;
+	uint8_t classmark3[14]; /* if cm3 gets extended by spec, it will be truncated */
+};
+
+bool osmo_gsm48_classmark_is_r99(const struct osmo_gsm48_classmark *cm);
+bool osmo_gsm48_classmark1_is_r99(const struct gsm48_classmark1 *cm1);
+bool osmo_gsm48_classmark2_is_r99(const struct gsm48_classmark2 *cm2, uint8_t cm2_len);
+int osmo_gsm48_classmark_supports_a5(const struct osmo_gsm48_classmark *cm, uint8_t a5);
+const char *osmo_gsm48_classmark_a5_name(const struct osmo_gsm48_classmark *cm);
+void osmo_gsm48_classmark_update(struct osmo_gsm48_classmark *dst, const struct osmo_gsm48_classmark *src);
+
 /* Chapter 10.5.2.1b.3 */
 #if OSMO_IS_LITTLE_ENDIAN == 1
 struct gsm48_range_1024 {