summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsm29205.c21
-rw-r--r--src/gsm/libosmogsm.map1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/gsm/gsm29205.c b/src/gsm/gsm29205.c
index 0ef29b72..0d344688 100644
--- a/src/gsm/gsm29205.c
+++ b/src/gsm/gsm29205.c
@@ -91,3 +91,24 @@ int osmo_dec_gcr(struct osmo_gcr_parsed *gcr, const uint8_t *elem, uint8_t len)
return parsed + 5;
}
+
+/*! Compare two GCR structs.
+ * \param[in] gcr1 pointer to the GCR struct
+ * \param[in] gcr2 pointer to the GCR struct
+ * \returns true if GCRs are equal, false otherwise */
+bool osmo_gcr_eq(const struct osmo_gcr_parsed *gcr1, const struct osmo_gcr_parsed *gcr2)
+{
+ if (gcr1->net_len != gcr2->net_len)
+ return false;
+
+ if (gcr1->node != gcr2->node)
+ return false;
+
+ if (memcmp(gcr1->cr, gcr2->cr, 5) != 0)
+ return false;
+
+ if (memcmp(gcr1->net, gcr2->net, gcr2->net_len) != 0)
+ return false;
+
+ return true;
+}
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 60ce5d13..f9e9b8bf 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -240,6 +240,7 @@ gsm29118_create_service_abort_req;
osmo_enc_gcr;
osmo_dec_gcr;
+osmo_gcr_eq;
gsm0858_rsl_ul_meas_enc;