aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/gsm0408
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-02-08 15:20:48 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-02-20 11:35:56 +0100
commitca114432be6c9e108f0f3182c564d264b78669e0 (patch)
tree72b76cab760993bd27025885883854264a1147e4 /openbsc/tests/gsm0408
parent6ab5d4f861c05ef57cde423cf2ddf0699940b4fc (diff)
sms: Increment the RP Message Reference for each transaction
Each RP-DATA should have a unique msg reference. Currently 42 is used for all of these. Remember the last reference we used and increment it on the next SMS. Do not track if the reference is still in use a clash is a lot less likely now. First unless SMPP is used only one SMS is delivered at a time, second the transaction space is a lot smaller than the one for the reference.
Diffstat (limited to 'openbsc/tests/gsm0408')
-rw-r--r--openbsc/tests/gsm0408/gsm0408_test.c25
-rw-r--r--openbsc/tests/gsm0408/gsm0408_test.ok4
2 files changed, 29 insertions, 0 deletions
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c
index 38c1a6a8c..692ec90b0 100644
--- a/openbsc/tests/gsm0408/gsm0408_test.c
+++ b/openbsc/tests/gsm0408/gsm0408_test.c
@@ -25,6 +25,7 @@
#include <arpa/inet.h>
#include <openbsc/gsm_04_08.h>
+#include <openbsc/gsm_04_11.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/debug.h>
#include <openbsc/arfcn_range_encode.h>
@@ -448,6 +449,29 @@ static void test_si_range_helpers()
VERIFY(f0, ==, 1);
}
+static void test_gsm411_rp_ref_wrap(void)
+{
+ struct gsm_subscriber_connection conn;
+ int res;
+
+ printf("testing RP-Reference wrap\n");
+
+ memset(&conn, 0, sizeof(conn));
+ conn.next_rp_ref = 255;
+
+ res = sms_next_rp_msg_ref(&conn);
+ printf("Allocated reference: %d\n", res);
+ OSMO_ASSERT(res == 255);
+
+ res = sms_next_rp_msg_ref(&conn);
+ printf("Allocated reference: %d\n", res);
+ OSMO_ASSERT(res == 0);
+
+ res = sms_next_rp_msg_ref(&conn);
+ printf("Allocated reference: %d\n", res);
+ OSMO_ASSERT(res == 1);
+}
+
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
@@ -460,6 +484,7 @@ int main(int argc, char **argv)
test_arfcn_filter();
test_print_encoding();
test_range_encoding();
+ test_gsm411_rp_ref_wrap();
printf("Done.\n");
return EXIT_SUCCESS;
diff --git a/openbsc/tests/gsm0408/gsm0408_test.ok b/openbsc/tests/gsm0408/gsm0408_test.ok
index 3d3c4e6a1..058563aab 100644
--- a/openbsc/tests/gsm0408/gsm0408_test.ok
+++ b/openbsc/tests/gsm0408/gsm0408_test.ok
@@ -58,4 +58,8 @@ Random range test: range 127, max num ARFCNs 29
Random range test: range 255, max num ARFCNs 22
Random range test: range 511, max num ARFCNs 18
Random range test: range 1023, max num ARFCNs 16
+testing RP-Reference wrap
+Allocated reference: 255
+Allocated reference: 0
+Allocated reference: 1
Done.