lib: support mac ul as well

This commit is contained in:
Will Greenberg
2025-07-30 16:00:04 -07:00
committed by Cooper Quintin
parent 9b6051380f
commit 6b07b4e460
2 changed files with 16 additions and 5 deletions
+14 -3
View File
@@ -211,12 +211,14 @@ pub enum LogBody {
msg: Vec<u8>,
},
#[deku(id = "0xb063")]
LteMacDl {
LteMac {
#[deku(ctx = "log_type")]
direction: LteMacMessageDirection,
version: u8,
#[deku(pad_bytes_after = "2")]
num_subpacket: u8,
#[deku(count = "num_subpacket")]
subpackets: Vec<LteMacDlSubpacket>,
subpackets: Vec<LteMacSubpacket>,
},
#[deku(id = "0x713a")]
UmtsNasOtaMessage {
@@ -233,7 +235,7 @@ pub enum LogBody {
}
#[derive(Debug, Clone, PartialEq, DekuRead, DekuWrite)]
pub struct LteMacDlSubpacket {
pub struct LteMacSubpacket {
pub id: u8,
pub version: u8,
pub size: u16,
@@ -241,6 +243,15 @@ pub struct LteMacDlSubpacket {
pub data: Vec<u8>,
}
#[derive(Debug, Clone, PartialEq, DekuRead, DekuWrite)]
#[deku(ctx = "log_type: u16", id = "log_type")]
pub enum LteMacMessageDirection {
#[deku(id_pat = "0xb063")]
Downlink,
#[deku(id_pat = "0xb064")]
Uplink,
}
#[derive(Debug, Clone, PartialEq, DekuRead, DekuWrite)]
#[deku(ctx = "log_type: u16", id = "log_type")]
pub enum Nas4GMessageDirection {
+2 -2
View File
@@ -150,9 +150,9 @@ fn log_to_gsmtap(value: LogBody) -> Result<Option<GsmtapMessage>, GsmtapParserEr
payload: msg,
}))
},
LogBody::LteMacDl { subpackets, .. } => {
LogBody::LteMac { direction, subpackets, .. } => {
let mut header = GsmtapHeader::new(GsmtapType::LteMac);
header.uplink = false;
header.uplink = matches!(direction, LteMacMessageDirection::Uplink);
let mut payload = Vec::new();
for packet in subpackets {
payload.extend(packet.to_bytes().unwrap());