gsm: Introduce functions to convert between FN and RFN (Reduced FN)

Implementation ported from osmo-pcu.git
e98b315d12fb009359410809f4169f9380f3d933, function bts_rfn_to_fn().

This functionality can be used by osmo-pcu, libosmo-gprs or any other
related code which needs to handle RFNs.

Change-Id: Ib71e8da976f6cc84c3a4ab17b0a8c2101492e243
diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h
index 721456d..b250c59 100644
--- a/include/osmocom/gsm/gsm_utils.h
+++ b/include/osmocom/gsm/gsm_utils.h
@@ -188,6 +188,14 @@
 char *osmo_dump_gsmtime_buf(char *buf, size_t buf_len, const struct gsm_time *tm);
 char *osmo_dump_gsmtime_c(const void *ctx, const struct gsm_time *tm);
 
+/* Reduced Frame Number (3GPP TS 44.018 §10.5.2.38) */
+#define GSM_RFN_MODULUS 42432
+uint32_t gsm_rfn2fn(uint16_t rfn, uint32_t curr_fn);
+static inline uint16_t gsm_fn2rfn(uint32_t fn)
+{
+	return fn % GSM_RFN_MODULUS;
+}
+
 /* GSM TS 03.03 Chapter 2.6 */
 enum gprs_tlli_type {
 	TLLI_LOCAL,