mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-27 16:09:58 -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
@@ -10,10 +10,12 @@ pub struct LteSib6And7DowngradeAnalyzer {
|
||||
|
||||
impl LteSib6And7DowngradeAnalyzer {
|
||||
fn unpack_system_information<'a>(&self, ie: &'a InformationElement) -> Option<&'a SystemInformation_r8_IEsSib_TypeAndInfo> {
|
||||
if let InformationElement::LTE(LteInformationElement::BcchDlSch(bcch_dl_sch_message)) = ie {
|
||||
if let BCCH_DL_SCH_MessageType::C1(BCCH_DL_SCH_MessageType_c1::SystemInformation(system_information)) = &bcch_dl_sch_message.message {
|
||||
if let SystemInformationCriticalExtensions::SystemInformation_r8(sib) = &system_information.critical_extensions {
|
||||
return Some(&sib.sib_type_and_info);
|
||||
if let InformationElement::LTE(lte_ie) = ie {
|
||||
if let LteInformationElement::BcchDlSch(bcch_dl_sch_message) = &**lte_ie {
|
||||
if let BCCH_DL_SCH_MessageType::C1(BCCH_DL_SCH_MessageType_c1::SystemInformation(system_information)) = &bcch_dl_sch_message.message {
|
||||
if let SystemInformationCriticalExtensions::SystemInformation_r8(sib) = &system_information.critical_extensions {
|
||||
return Some(&sib.sib_type_and_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user