pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-sgsn/+/30814 )
Change subject: Move gprs_tmr_to_secs() to tests/gprs/gprs_test.c
......................................................................
Move gprs_tmr_to_secs() to tests/gprs/gprs_test.c
That function is only used in the test. Let's hence move the function to
the same test file in order to simplify osmo-sgsn code.
Change-Id: I69d80810362d75eb93974af34f61639514f99f8a
---
M include/osmocom/sgsn/gprs_utils.h
M src/gprs/gprs_utils.c
M tests/gprs/gprs_test.c
3 files changed, 16 insertions(+), 17 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/14/30814/1
diff --git a/include/osmocom/sgsn/gprs_utils.h b/include/osmocom/sgsn/gprs_utils.h
index eacaec7..c05aca6 100644
--- a/include/osmocom/sgsn/gprs_utils.h
+++ b/include/osmocom/sgsn/gprs_utils.h
@@ -32,7 +32,6 @@
int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str);
/* GSM 04.08, 10.5.7.3 GPRS Timer */
-int gprs_tmr_to_secs(uint8_t tmr);
uint8_t gprs_secs_to_tmr_floor(int secs);
int gprs_is_mi_tmsi(const uint8_t *value, size_t value_len);
diff --git a/src/gprs/gprs_utils.c b/src/gprs/gprs_utils.c
index 632718a..3eac330 100644
--- a/src/gprs/gprs_utils.c
+++ b/src/gprs/gprs_utils.c
@@ -64,22 +64,6 @@
return len;
}
-/* GSM 04.08, 10.5.7.3 GPRS Timer */
-int gprs_tmr_to_secs(uint8_t tmr)
-{
- switch (tmr & GPRS_TMR_UNIT_MASK) {
- case GPRS_TMR_2SECONDS:
- return 2 * (tmr & GPRS_TMR_FACT_MASK);
- default:
- case GPRS_TMR_MINUTE:
- return 60 * (tmr & GPRS_TMR_FACT_MASK);
- case GPRS_TMR_6MINUTE:
- return 360 * (tmr & GPRS_TMR_FACT_MASK);
- case GPRS_TMR_DEACTIVATED:
- return -1;
- }
-}
-
/* This functions returns a tmr value such that
* - f is monotonic
* - f(s) <= s
diff --git a/tests/gprs/gprs_test.c b/tests/gprs/gprs_test.c
index 99e3ea5..89dac07 100644
--- a/tests/gprs/gprs_test.c
+++ b/tests/gprs/gprs_test.c
@@ -48,6 +48,22 @@
ASSERT_FALSE(nu_is_retransmission(479, 511)); // wrapped
}
+/* GSM 04.08, 10.5.7.3 GPRS Timer */
+static int gprs_tmr_to_secs(uint8_t tmr)
+{
+ switch (tmr & GPRS_TMR_UNIT_MASK) {
+ case GPRS_TMR_2SECONDS:
+ return 2 * (tmr & GPRS_TMR_FACT_MASK);
+ default:
+ case GPRS_TMR_MINUTE:
+ return 60 * (tmr & GPRS_TMR_FACT_MASK);
+ case GPRS_TMR_6MINUTE:
+ return 360 * (tmr & GPRS_TMR_FACT_MASK);
+ case GPRS_TMR_DEACTIVATED:
+ return -1;
+ }
+}
+
static void test_gprs_timer_enc_dec(void)
{
int i, u, secs, tmr;
--
To view, visit
https://gerrit.osmocom.org/c/osmo-sgsn/+/30814
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I69d80810362d75eb93974af34f61639514f99f8a
Gerrit-Change-Number: 30814
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange