mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-30 09:29:58 -07:00
lte-parser: add autogenerated parser for LTE RRC messages
This crate's code is nearly entirely autogenerated using an ASN.1 parsing tool called hampi. The code in src/lte_rrc.rs shouldn't be manually modified, and should only be regenerated using hampi (or a similar tool).
This commit is contained in:
17
lte-parser/tests/lte_rrc_test.rs
Normal file
17
lte-parser/tests/lte_rrc_test.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use telcom_parser::lte_rrc::BCCH_DL_SCH_Message;
|
||||
use asn1_codecs::{uper::UperCodec, PerCodecData};
|
||||
|
||||
fn hex_to_bin(hex: &str) -> Vec<u8> {
|
||||
(0..hex.len())
|
||||
.step_by(2)
|
||||
.map(|i| u8::from_str_radix(&hex[i..i+2], 16).unwrap())
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
let data = hex_to_bin("484c469010600018fd1a9207e22103108ac21bdc09802292cdd20000");
|
||||
let mut asn_data = PerCodecData::from_slice_uper(&data);
|
||||
let sib1 = BCCH_DL_SCH_Message::uper_decode(&mut asn_data);
|
||||
dbg!(&sib1);
|
||||
}
|
||||
Reference in New Issue
Block a user