///|
#derive(Debug)
pub(all) suberror InputError {
InputError(String)
}
///|
#derive(Debug, Eq)
pub(all) enum PortState {
Open
Closed
TimedOut
Failed
}
///|
#derive(Debug)
pub struct ScanResult {
target : String
address : String
port : Int32
state : PortState
elapsed_ms : Int64
error : String?
service : ServiceInfo?
probe_error : String?
attempts : Int32
detection : DetectionReport?
}
///|
#derive(Debug)
pub struct ScanSummary {
mut completed : Int64
mut open : Int64
mut closed : Int64
mut timed_out : Int64
mut failed : Int64
}
///|
pub fn ScanSummary::new() -> ScanSummary {
{ completed: 0, open: 0, closed: 0, timed_out: 0, failed: 0, }
}
///|
fn ScanSummary::record(self : ScanSummary, state : PortState) -> Unit {
self.completed += 1
match state {
Open => self.open += 1
Closed => self.closed += 1
TimedOut => self.timed_out += 1
Failed => self.failed += 1
}
}