summaryrefslogtreecommitdiffstats
path: root/bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-07-29 00:36:37 +0200
committerlaforge <laforge@osmocom.org>2020-08-13 05:36:26 +0000
commit4c365329a963434fe4bb04fec94e5d3d3bb4749c (patch)
tree15647ff6bf562fb87b41deec616db587d2e8fb02 /bsc
parentba9c51b2239406761b10453b5a8594a30148a0b5 (diff)
bsc CBSP: f_gen_page(): allow passing explicit payload len
Keep the default of using a random payload length, but also allow picking one specifically. TC_cbsp_write_bss() will use this in a subsequent patch. Change-Id: I259da42cbcbfdfe930aabb45c9de8a2b67c69629
Diffstat (limited to 'bsc')
-rw-r--r--bsc/BSC_Tests_CBSP.ttcn18
1 files changed, 11 insertions, 7 deletions
diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index f54de9b..ea080a2 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -135,13 +135,17 @@ private function f_cbsp_init_tail() runs on cbsp_test_CT {
}
}
-function f_gen_page() return CBSP_IE {
- /* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page: the
- * maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero length).
- * note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
- var integer len := 1 + f_rnd_int(82);
- var octetstring payload := f_rnd_octstring(len);
- return valueof(ts_CbspMsgContent(payload, len));
+/* Generate a CBSP payload: random size for payload_len == 0, or specific fixed size for payload_len > 0. */
+function f_gen_page(integer payload_len := 0) return CBSP_IE {
+ if (payload_len < 1) {
+ /* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page:
+ * the maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero
+ * length). Note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
+ payload_len := 1 + f_rnd_int(82);
+ }
+ log("Generating CBSP payload: ", payload_len, " octets");
+ var octetstring payload := f_rnd_octstring(payload_len);
+ return valueof(ts_CbspMsgContent(payload, payload_len));
}
function f_cbsp_reset_bss(integer idx) runs on CBSP_Adapter_CT {