summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-12-19 18:51:00 +0100
committerHarald Welte <laforge@gnumonks.org>2018-12-23 10:20:05 +0000
commit470221575deaa14c670a5d4233df80119599141d (patch)
tree6665bd28d7d8be42c85aacedaf87573be1529be3 /tests
parente5bde9053238ba8fdce9797f97d76016abf474f7 (diff)
LCLS: enc/dec entire parameter set instead of GCR
In 3GPP TS 48.008 the Global Call Reference IE is only used in HANDOVER REQUEST (§3.2.1.8) and ASSIGNMENT REQUEST (§3.2.1.1) messages which also include LCLS Config and CSC parameters. Hence, there's no point in using GCR encode/decode functions alone. Introduce gsm0808_dec_lcls() and gsm0808_enc_lcls() as trivial wrappers on top of GCR enc/dec routines which are made static. Adjust tests accordingly. Test output intentionally left unchanged. Change-Id: Icfbb2404e1a1d500243e2071173299b557369335
Diffstat (limited to 'tests')
-rw-r--r--tests/gsm0808/gsm0808_test.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index ebdfc29c..40e2b87b 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -668,7 +668,7 @@ static void test_prepend_dtap()
msgb_free(in_msg);
}
-static void test_enc_dec_gcr()
+static void test_enc_dec_lcls()
{
static const uint8_t res[] = {
GSM0808_IE_GLOBAL_CALL_REF,
@@ -690,11 +690,18 @@ static void test_enc_dec_gcr()
};
int rc;
struct tlv_parsed tp;
- msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "global call reference");
+ struct osmo_lcls lcls_out = { .gcr = &p }, lcls_in = {
+ .gcr = &g,
+ .config = GSM0808_LCLS_CFG_NA,
+ .control = GSM0808_LCLS_CSC_NA,
+ .corr_needed = true,
+ };
+
+ msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "LCLS IE");
if (!msg)
return;
- len = gsm0808_enc_gcr(msg, &g);
+ len = gsm0808_enc_lcls(msg, &lcls_in);
printf("Testing Global Call Reference IE encoder...\n\t%d bytes added: %s\n",
len, len == ARRAY_SIZE(res) ? "OK" : "FAIL");
@@ -707,29 +714,29 @@ static void test_enc_dec_gcr()
abort();
}
- rc = gsm0808_dec_gcr(&p, &tp);
+ rc = gsm0808_dec_lcls(&lcls_out, &tp);
if (rc < 0) {
printf("decoding failed: %s [%s]\n", strerror(-rc), msgb_hexdump(msg));
abort();
}
- if (p.net_len != g.net_len) {
- printf("Network ID length parsed wrong: %u != %u\n", p.net_len, g.net_len);
+ if (lcls_out.gcr->net_len != g.net_len) {
+ printf("Network ID length parsed wrong: %u != %u\n", lcls_out.gcr->net_len, g.net_len);
abort();
}
- if (p.node != g.node) {
- printf("Node ID parsed wrong: 0x%X != 0x%X\n", p.node, g.node);
+ if (lcls_out.gcr->node != g.node) {
+ printf("Node ID parsed wrong: 0x%X != 0x%X\n", lcls_out.gcr->node, g.node);
abort();
}
- if (memcmp(p.net, g.net, g.net_len) != 0) {
- printf("Network ID parsed wrong: %s\n", osmo_hexdump(p.net, p.net_len));
+ if (memcmp(lcls_out.gcr->net, g.net, g.net_len) != 0) {
+ printf("Network ID parsed wrong: %s\n", osmo_hexdump(lcls_out.gcr->net, lcls_out.gcr->net_len));
abort();
}
- if (memcmp(p.cr, g.cr, 5) != 0) {
- printf("Call ref. ID parsed wrong: %s\n", osmo_hexdump(p.cr, 5));
+ if (memcmp(lcls_out.gcr->cr, g.cr, 5) != 0) {
+ printf("Call ref. ID parsed wrong: %s\n", osmo_hexdump(lcls_out.gcr->cr, 5));
abort();
}
@@ -1959,7 +1966,7 @@ int main(int argc, char **argv)
test_create_dtap();
test_prepend_dtap();
- test_enc_dec_gcr();
+ test_enc_dec_lcls();
test_enc_dec_aoip_trasp_addr_v4();
test_enc_dec_aoip_trasp_addr_v6();