Commit Graph

29 Commits

Author SHA1 Message Date
wbokslag 86796c6c4a Fixups and clarifying comments for msgb tail modifications
Added fixups for msgb len field whenever the tail is modified
Also, added some clarifying comments

Change-Id: Ia725edbeafe26bd2ea9b5a1810d0b26bc79d84db
2023-07-29 11:48:22 +02:00
wbokslag e3f1aa97e1 Added calls to stub decryption functions for MAC resources
The tcs (Tetra Crypto State) struct now maintains information relevant for decryption, such as the current network, colour code, hyperframe, etcetera.
Also, the upper mac now calls a stub decryption function when receiving an encrypted resource.

Change-Id: I92d718789d6b7e84c1901d09165fce59cdf8c1ca
2023-07-27 20:51:10 +02:00
wbokslag 8a4542a77f added support for advanced link defragmentation
the rx_tm_sdu and rx_tl_sdu did not belong in tetra_upper_mac and are removed. Instead, we use rx_tm_sdu in tetra_llc.c, who in turn invokes rx_tl_sdu in tetra_mle.c. The llc can now also make use of the advanced link defragmentation code that was already there but unused.

Change-Id: I294c684e97c55876f1a207a7152a83dad4ebaa26
2022-09-22 11:46:35 +02:00
wbokslag 79560cbf86 Support parsing of multiple mac resources in the same timeslot
Change-Id: Ic2956a5f10cffe296b76a290a0d16f45461eb2e7
2022-09-22 11:46:35 +02:00
wbokslag 1f48ec8627 added support for fill bits and basic link defragmentation (also thanks to SQ5BPF)
The upper mac now maintains a defragmentation buffer for each timeslot. Resources with length -1 (fragmentation start) are added to the buf for that slot, further mac/frag frames are appended. When a mac/end is encountered, the reconstructed l2 message is passed to rx_tm_sdu. The tetra_llc_pdu struct now uses a uint32_t for tl_sdu_len in order to account for the possibly longer sdus. Fill bits processing was required in order to reliably determine the end of a MAC PDU.

Change-Id: I41c9438b0b12c2fac9dff1b226eec5b33f30fbb4
2022-09-22 11:46:29 +02:00
wbokslag 1b7ebde55d Keep timeslot number in range 1-4 instead of 0-3 in parsing of SYNC frame
According to the tetra_tdma_time struct definition, the tn should be in range 1-4. Also, tetra_burst_sync_in increments the timeslot number when in a synchronized state. The timeslot is then normalized with normalize_tn which also expects the tn to be within the 1-4 range.

Change-Id: Ib0967fdeef3bf37c612124626a74d240aa571a66
2022-09-18 15:16:51 +02:00
wbokslag a5bc24792b Improved parsing in macpdu_decode_resource
fill_bits and grant_position bits are now parsed and stored in the tetra_resrc_decoded struct
A flag is_encrypted is set to to true if resource was not encrypted or if the calling function
states that the frame has been decrypted successfully before passing it to tetra_resrc_decoded.
Lastly, the channel_alloc element is only parsed if the frame is unencrypted.

Change-Id: I6c85c93b70a34e01fd1a96a863f0e113be6424d3
2022-08-02 12:32:55 +02:00
Jan Hrach 73e9e0e871 add traffic dumping patch, use getopt to parse arguments
Enable the user to specify a directory, where contents of traffic channel will
be saved. Together with this dump, a text file with SSIs of the engaged
stations is saved too.

Based on 0004-HACK-Quick-hack-to-save-the-speech-data-from-TCH.patch available at
https://build.opensuse.org/package/view_file/home:mnhauke:sdr/osmo-tetra/0004-HACK-Quick-hack-to-save-the-speech-data-from-TCH.patch

Change-Id: I94135753a76cadfa373167ffca18e89bee5bcff8
2018-09-28 23:27:20 +00:00
luckyhacky 6dcdb89454 set hyperframe number in struct tdma_time 2015-08-21 01:46:50 +02:00
Frank A. Stevenson 6430bdeb5f fix some global ugliness
This removes a static global variable which will only work if you only
have once instance of the tetra receiver.
2012-12-01 14:48:52 +01:00
Harald Welte 5868bbf87f save state if traffic or non-traffic burst at AACH time
the later code processing the SB/NB can then refer to that state.
2011-05-28 20:10:56 +02:00
Harald Welte ee7a645ca4 Add LLC defragmentation + SDNCP output via tun device
this allows us to look at IP messages contained in SNDCP
2011-05-27 09:37:06 +02:00
Harald Welte 0ad20fd762 create 'struct tetra_mac_state' in main and pass through all layers/SAPs 2011-05-27 08:44:12 +02:00
Harald Welte a22f5923d1 libosmocore namespace changes ("osmo_") 2011-05-08 09:46:46 +02:00
Harald Welte 4911ba91ef TETRA: start to use msgb as part of osmo_prim / tmvsap_prim
This will allow us to pass the same msgb (with different l1h/l2h)
up the stack.
2011-04-24 16:55:42 +02:00
Harald Welte 2840dc5f07 don't decode NULL pdu or TL-SDU of non-starting LLC segments 2011-04-24 11:45:20 +02:00
Harald Welte b5d6edbb82 Introduce LLC layer that has been completely missign so far
All our MM/CMCE/SNDCP 'decodes' were broken previously, as they
assumed that the MM/CMCE/SNDCP message follows immediately after the
MAC header.  However, there's the LLC layer in between.

This is just simple LLC decoding and does not do re-assembly yet.
2011-04-24 11:10:52 +02:00
Harald Welte 2c6eab8f48 upper mac: fix printing of carrier frequency Hz 2011-04-24 10:00:37 +02:00
Harald Welte 51147d4e7a upper mac: fix printing of certain PDUs (remove additional newline) 2011-04-24 09:54:02 +02:00
Harald Welte ba1ec17db6 upper mac: print MLE PDU type 2011-04-24 09:24:13 +02:00
Harald Welte ec02a9f038 upper mac: initial SUPPLEMENTARY parsing, fix fake FRAG/END decoding 2011-04-24 09:15:28 +02:00
Harald Welte 863c31401b MAC: correctly decode length of MAC PDU 2011-04-24 08:07:27 +02:00
Harald Welte c547e9f0de upper mac: print slot grant (if any) 2011-04-24 07:52:06 +02:00
Harald Welte 5c14298646 Add SNDCP PDU type name printing 2011-04-24 05:12:16 +02:00
Harald Welte 2bca149dca fix CR/LF when BNCH FOLLOWS 2011-04-23 17:47:07 +02:00
Harald Welte c3ba1f39df add decode of CMCE PDU type 2011-04-23 17:08:03 +02:00
Sylvain Munaut 6d08da3bd3 Adapt to the new "osmocom/core/" include path
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-04-17 20:21:41 +02:00
Harald Welte 140c2f80c1 use ubit_dump() which is part of libosmocore instead of local bitdump() 2011-02-08 16:57:48 +01:00
Harald Welte 7ee08faee0 initial import of Osmocom TETRA phy and lower MAC code 2011-01-19 10:39:59 +01:00