Skip to main content

leodos_protocols/transport/cfdp/pdu/file_directive/keepalive/
mod.rs

1/// Keep Alive PDU for large file transactions (64-bit progress).
2pub mod large;
3/// Keep Alive PDU for small file transactions (32-bit progress).
4pub mod small;
5
6/// A parsed Keep Alive PDU, dispatching between small and large file variants.
7#[derive(Debug)]
8pub enum KeepAlivePdu<'a> {
9    /// Keep Alive PDU for small file transactions (32-bit progress).
10    Small(&'a small::KeepAlivePduSmall),
11    /// Keep Alive PDU for large file transactions (64-bit progress).
12    Large(&'a large::KeepAlivePduLarge),
13}
14
15impl<'a> KeepAlivePdu<'a> {
16    /// Returns the receiver's progress as a byte count.
17    pub fn progress(&self) -> u64 {
18        match self {
19            KeepAlivePdu::Small(small) => small.progress() as u64,
20            KeepAlivePdu::Large(large) => large.progress(),
21        }
22    }
23}