Skip to main content

ProcessLookup

Trait ProcessLookup 

Source
pub trait ProcessLookup: Send + Sync {
    // Required methods
    fn get_process_for_connection(
        &self,
        conn: &Connection,
    ) -> Option<(u32, String)>;
    fn get_detection_method(&self) -> &str;

    // Provided methods
    fn refresh(&self) -> Result<()> { ... }
    fn get_degradation_reason(&self) -> DegradationReason { ... }
    fn fallback_lookup(
        map: &HashMap<ConnectionKey, (u32, String)>,
        key: &ConnectionKey,
    ) -> Option<(u32, String)>
       where Self: Sized { ... }
}
Expand description

Trait for platform-specific process lookup

Required Methods§

Source

fn get_process_for_connection(&self, conn: &Connection) -> Option<(u32, String)>

Look up process information for a connection Returns (pid, process_name) if found

Source

fn get_detection_method(&self) -> &str

Get the detection method name for display purposes

Provided Methods§

Source

fn refresh(&self) -> Result<()>

Refresh internal caches if any (best-effort)

Source

fn get_degradation_reason(&self) -> DegradationReason

Get the reason why process detection is degraded (if any) Returns DegradationReason::None if using optimal detection method

Source

fn fallback_lookup( map: &HashMap<ConnectionKey, (u32, String)>, key: &ConnectionKey, ) -> Option<(u32, String)>
where Self: Sized,

Fallback lookup that relaxes the connection key to handle sockets stored with wildcard addresses in OS-level tables.

Three shapes that actually appear in OS socket tables:

  1. (lip:lport, 0:0) — listening on a specific local IP
  2. (0:lport, rip:rport) — INADDR_ANY socket connected to a known remote
  3. (0:lport, 0:0) — listening on INADDR_ANY

If two candidates resolve to different processes the result is ambiguous and None is returned to avoid mis-attribution.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§