|
|
@ -226,6 +226,9 @@ pub enum Flow {}
|
|
|
|
/// Extern functions operating on Flow.
|
|
|
|
/// Extern functions operating on Flow.
|
|
|
|
extern {
|
|
|
|
extern {
|
|
|
|
pub fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64);
|
|
|
|
pub fn FlowGetLastTimeAsParts(flow: &Flow, secs: *mut u64, usecs: *mut u64);
|
|
|
|
|
|
|
|
pub fn FlowGetFlags(flow: &Flow) -> u32;
|
|
|
|
|
|
|
|
pub fn FlowGetSourcePort(flow: &Flow) -> u16;
|
|
|
|
|
|
|
|
pub fn FlowGetDestinationPort(flow: &Flow) -> u16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Rust implementation of Flow.
|
|
|
|
/// Rust implementation of Flow.
|
|
|
@ -241,4 +244,14 @@ impl Flow {
|
|
|
|
std::time::Duration::new(secs, usecs as u32 * 1000)
|
|
|
|
std::time::Duration::new(secs, usecs as u32 * 1000)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Return the flow flags.
|
|
|
|
|
|
|
|
pub fn get_flags(&self) -> u32 {
|
|
|
|
|
|
|
|
unsafe { FlowGetFlags(self) }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Return flow ports
|
|
|
|
|
|
|
|
pub fn get_ports(&self) -> (u16, u16) {
|
|
|
|
|
|
|
|
unsafe { (FlowGetSourcePort(self), FlowGetDestinationPort(self)) }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|