aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluckyhacky <github@mail.my-cp.de>2013-12-30 23:42:36 +0100
committerHarald Welte <laforge@gnumonks.org>2015-08-21 01:48:46 +0200
commit83140af8d0cf66b8ebf7c414f4ed8ef561f4fec2 (patch)
tree0d2e9f27dec9e20d077a53d622ae366ac2993b34
parent732d06d531a3bb43ca6bd489da09bade6295ef55 (diff)
extended sysinfo as described in section 21.4.4.1
now every transmitted field in sysinfo is analyzed
-rw-r--r--src/tetra_mac_pdu.c25
-rw-r--r--src/tetra_mac_pdu.h6
2 files changed, 27 insertions, 4 deletions
diff --git a/src/tetra_mac_pdu.c b/src/tetra_mac_pdu.c
index ec31e4f..f1fed10 100644
--- a/src/tetra_mac_pdu.c
+++ b/src/tetra_mac_pdu.c
@@ -39,9 +39,12 @@ static void decode_d_mle_sysinfo(struct tetra_mle_si_decoded *msid, const uint8_
msid->bs_service_details = bits_to_uint(cur, 12); cur += 12;
}
+/* see 21.4.4.1 */
void macpdu_decode_sysinfo(struct tetra_si_decoded *sid, const uint8_t *si_bits)
{
- const uint8_t *cur = si_bits + 4;
+ const uint8_t *cur = si_bits;
+ cur += 2; // skip Broadcast PDU header
+ cur += 2; // skip Sysinfo PDU header
sid->main_carrier = bits_to_uint(cur, 12); cur += 12;
sid->freq_band = bits_to_uint(cur, 4); cur += 4;
@@ -58,9 +61,23 @@ void macpdu_decode_sysinfo(struct tetra_si_decoded *sid, const uint8_t *si_bits)
sid->cck_id = bits_to_uint(cur, 16);
else
sid->hyperframe_number = bits_to_uint(cur, 16);
- cur += 16;
- /* FIXME: more */
- decode_d_mle_sysinfo(&sid->mle_si, si_bits + 124-42);
+
+ sid->option_field = bits_to_uint(cur, 2); cur += 2;
+ switch(sid->option_field)
+ {
+ case 0x00: // Even multiframe definition for TS mode
+ case 0x01: // Odd multiframe definition for TS mode
+ sid->frame_bitmap = bits_to_uint(cur, 20); cur += 20;
+ break;
+ case 0x02: // Default definition for access code A
+ sid->access_code = bits_to_uint(cur, 20); cur += 20;
+ break;
+ case 0x04: // Extended services broadcast
+ sid->ext_service = bits_to_uint(cur, 20); cur += 20;
+ break;
+ }
+
+ decode_d_mle_sysinfo(&sid->mle_si, si_bits + 124-42); // could be also cur due to previous fixes
}
static const uint8_t addr_len_by_type[] = {
diff --git a/src/tetra_mac_pdu.h b/src/tetra_mac_pdu.h
index 74608a6..b0244ff 100644
--- a/src/tetra_mac_pdu.h
+++ b/src/tetra_mac_pdu.h
@@ -60,6 +60,12 @@ struct tetra_si_decoded {
uint16_t cck_id;
uint16_t hyperframe_number;
};
+ uint8_t option_field;
+ union {
+ uint32_t frame_bitmap;
+ uint32_t access_code;
+ uint32_t ext_service;
+ };
struct tetra_mle_si_decoded mle_si;
};