diff --git a/lib/src/diag/diaglog/mac.rs b/lib/src/diag/diaglog/mac.rs index 672a95f..a1ed45f 100644 --- a/lib/src/diag/diaglog/mac.rs +++ b/lib/src/diag/diaglog/mac.rs @@ -1,3 +1,7 @@ +//! Diag MAC RACH serialization/deserialization. As with most of our diag +//! parsers, these structs were derived SCAT: +//! https://github.com/fgsect/scat/blob/9763cb5b1dcd5ee980f5b0ead9a8d520c8c51a51/src/scat/parsers/qualcomm/diagltelogparser.py#L853 + use deku::prelude::*; #[derive(DekuRead, DekuWrite, Debug, Clone, PartialEq)] @@ -31,6 +35,7 @@ pub enum SubpacketBody { } pub mod rach { + //! Derived from https://github.com/fgsect/scat/blob/9763cb5b1dcd5ee980f5b0ead9a8d520c8c51a51/src/scat/parsers/qualcomm/diagltelogparser.py#L496 use super::*; #[derive(DekuRead, DekuWrite, Debug, Clone, PartialEq)] @@ -204,6 +209,12 @@ pub mod rach { #[cfg(test)] pub(crate) mod test { + //! These tests were adapted from SCAT's MAC RACH parser's unit tests, + //! and the values were produced by modifying the tests to output the + //! entire parsed struct rather than the hexlified gsmtap packets. See + //! the changes in this commit for more info: + //! https://github.com/wgreenberg/scat/commit/adb21575832b4f3b30c8f2aaca9ee843ef74f38b + use super::*; use crate::diag::diaglog::mac::rach::{AdditionalInfo, AttemptHeader, Msg1, Msg2, Msg3}; use crate::{diag::diaglog::mac::rach::Msg3Grant, test_util::unhexlify}; @@ -268,13 +279,6 @@ pub(crate) mod test { #[test] fn test_rach_attempt_parsing() { - /* - * These tests were adapted from SCAT's MAC RACH parser's unit tests, - * and the values were produced by modifying the tests to output the - * entire parsed struct rather than the hexlified gsmtap packets. See - * the changes in this commit for more info: - * https://github.com/wgreenberg/scat/commit/adb21575832b4f3b30c8f2aaca9ee843ef74f38b - */ let test_packets = mac_rach_test_packets_from_scat(); assert_rach_subpacket( &test_packets[0], diff --git a/lib/src/diag/diaglog/measurement.rs b/lib/src/diag/diaglog/measurement.rs index f106766..535ea97 100644 --- a/lib/src/diag/diaglog/measurement.rs +++ b/lib/src/diag/diaglog/measurement.rs @@ -1,6 +1,7 @@ -//! Diag ML1 measurement log serialization/deserialization. These are pretty -//! much entirely based on Shinjo Park's work in scat, since we couldn't find -//! any other documentation for the logs' structure. +//! Diag ML1 measurement log serialization/deserialization. As with most of our +//! diag parsers, these structs were derived SCAT: +//! Neighbor cell measurements: https://github.com/fgsect/scat/blob/9763cb5b1dcd5ee980f5b0ead9a8d520c8c51a51/src/scat/parsers/qualcomm/diagltelogparser.py#L192 +//! Serving cell measurements: https://github.com/fgsect/scat/blob/9763cb5b1dcd5ee980f5b0ead9a8d520c8c51a51/src/scat/parsers/qualcomm/diagltelogparser.py#L114 use deku::ctx::Order; use deku::prelude::*; @@ -194,6 +195,11 @@ pub mod neighbor_cells { #[cfg(test)] mod test { + //! The tests for serving cell/neighbor cell measurements were adapted from + //! SCAT's tests. The expected values were collected by modifying SCAT to + //! print out the full-precision expected values. See: + //! https://github.com/wgreenberg/scat/commit/e53d657861e8a66b52d635ff9518ac896c23ab06 + use super::*; use crate::diag::diaglog::LogBody; use crate::log_codes::{LOG_LTE_ML1_NEIGHBOR_MEAS, LOG_LTE_ML1_SERVING_CELL_MEAS_AND_EVAL_C}; @@ -269,8 +275,6 @@ mod test { assert_eq!(data.get_meas_rssi(), rssi, "incorrect rssi"); } - // Adapted from scat's TestDiagLteLogParser::test_parse_lte_ml1_scell_meas, - // but edited to print full-precision floats #[test] fn test_scell_meas() { scell_meas_and_eval_case( @@ -329,8 +333,6 @@ mod test { } } - // Adapted from scat's TestDiagLteLogParser::test_parse_lte_ml1_ncell_meas, - // but edited to print full-precision floats #[test] fn test_ncell_meas() { ncell_meas_case( diff --git a/lib/src/gsmtap/mac.rs b/lib/src/gsmtap/mac.rs index ee32c71..db89768 100644 --- a/lib/src/gsmtap/mac.rs +++ b/lib/src/gsmtap/mac.rs @@ -1,3 +1,8 @@ +//! The structs/enum values defined here are derived from a number of sources: +//! * SCAT's construction of MAC GSMTAP packets: https://github.com/fgsect/scat/blob/9763cb5b1dcd5ee980f5b0ead9a8d520c8c51a51/src/scat/parsers/qualcomm/diagltelogparser.py#L562-L640 +//! * https://www.sharetechnote.com/html/MAC_LTE.html#MAC_PDU_Structure_RAR +//! * 3GPP's TS 36.321, mostly sections 6.1.4, 6.1.5, and 6.1.6 + use deku::prelude::*; use crate::{ @@ -6,7 +11,6 @@ use crate::{ }; use deku::{DekuContainerWrite, DekuError}; -// based primarily off of SCAT's gsmtap responses and https://www.sharetechnote.com/html/MAC_LTE.html#MAC_PDU_Structure_RAR #[derive(DekuRead, DekuWrite)] pub struct Header { pub radio_type: RadioType, @@ -57,7 +61,6 @@ pub enum RntiType { G, } -// defined in 6.5.1 of 3GPP TS 36.321 #[derive(DekuRead, DekuWrite)] #[deku(endian = "big")] pub struct ETRAPIDSubheader {