mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-26 23:49:59 -07:00
Box some of the larger information element enum variants
An enum is always the size needed to store its largest variant. Some of the variants of the InformationElement and LteInformationElement are substantially larger than the rest. Boxing the larger variants reduces the size of the enum, in some cases by several kilobytes. Since Rust does not currently support destructing a Box via pattern matching, some code that destructures these enums had to be modified.
This commit is contained in:
committed by
Will Greenberg
parent
4edf001ca4
commit
034e0632e4
@@ -26,8 +26,12 @@ impl Analyzer for ImsiRequestedAnalyzer {
|
||||
|
||||
fn analyze_information_element(&mut self, ie: &InformationElement) -> Option<Event> {
|
||||
self.packet_num += 1;
|
||||
let InformationElement::LTE(LteInformationElement::NAS(payload)) = ie else {
|
||||
return None;
|
||||
let payload = match ie {
|
||||
InformationElement::LTE(inner) => match &**inner {
|
||||
LteInformationElement::NAS(payload) => payload,
|
||||
_ => return None,
|
||||
}
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
// NAS identity request, ID type IMSI
|
||||
|
||||
Reference in New Issue
Block a user