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:
Sashanoraa
2025-03-25 18:38:42 -04:00
committed by Will Greenberg
parent 4edf001ca4
commit 034e0632e4
7 changed files with 44 additions and 19 deletions

View File

@@ -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