aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/gprs_llc.h
diff options
context:
space:
mode:
Diffstat (limited to 'openbsc/include/openbsc/gprs_llc.h')
-rw-r--r--openbsc/include/openbsc/gprs_llc.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h
index f905473a1..e3fc82ef9 100644
--- a/openbsc/include/openbsc/gprs_llc.h
+++ b/openbsc/include/openbsc/gprs_llc.h
@@ -179,4 +179,20 @@ int gprs_llgmm_assign(struct gprs_llc_llme *llme,
int gprs_llc_init(const char *cipher_plugin_path);
int gprs_llc_vty_init(void);
+/**
+ * \short Check if N(U) should be considered a retransmit
+ *
+ * Implements the range check as of GSM 04.64 8.4.2
+ * Receipt of unacknowledged information.
+ *
+ * @returns Returns 1 if (V(UR)-32) <= N(U) < V(UR)
+ * @param nu N(U) unconfirmed sequence number of the UI frame
+ * @param vur V(UR) unconfirmend received state variable
+ */
+static inline int gprs_llc_is_retransmit(uint16_t nu, uint16_t vur)
+{
+ int delta = (vur - nu) & 0x1ff;
+ return 0 < delta && delta < 32;
+}
+
#endif