pub fn scan_network(
    rtsp_paths_file: &str,
    mjpeg_paths_file: &str) -> Result<ScanReport> {
    let mut port_set = HashSet::<u16>::new();

    port_set.extend(RTSP_PORT_CANDIDATES);
    port_set.extend(HTTP_PORT_CANDIDATES);

    let port_candidates = PortCollection::new()
        .add_all(port_set);

    let mut report = try!(find_all_open_ports(&port_candidates));

    // note: we permit only one RTSP service per host (some stupid RTSP servers
    // are accessible from more than one port and they tend to crash when they
    // are accessed from the "incorrect" one)
    let rtsp_ports = try!(find_rtsp_ports(&report, RTSP_PORT_CANDIDATES));
    let rtsp_port_priorities = get_port_priorities(RTSP_PORT_CANDIDATES);
    let rtsp_ports = filter_duplicit_services(
        &rtsp_ports,
        &rtsp_port_priorities);

    // note: we permit only one HTTP service per host
    let http_ports = try!(find_http_ports(&report, HTTP_PORT_CANDIDATES));
    let http_port_priorities = get_port_priorities(HTTP_PORT_CANDIDATES);
    let http_ports = filter_duplicit_services(
        &http_ports,
        &http_port_priorities);

    let rtsp_services  = try!(find_rtsp_services(rtsp_paths_file, &rtsp_ports));
    let mjpeg_services = try!(find_mjpeg_services(mjpeg_paths_file, &http_ports));

    let mut hosts = Vec::new();

    hosts.extend(get_hosts(&rtsp_services));
    hosts.extend(get_hosts(&mjpeg_services));

    let http_services = find_http_services(&http_ports, &hosts);

    for svc in rtsp_services {
        report.add_service(svc);
    }

    for svc in mjpeg_services {
        report.add_service(svc);
    }

    for svc in http_services {
        report.add_service(svc);
    }

    Ok(report)
}
/// Find all RTSP and MJPEG streams and corresponding HTTP services in all
/// local networks.
Find all RTSP and MJPEG streams and corresponding HTTP services in all
local networks.
Find all RTSP and MJPEG streams and corresponding HTTP services in all local networks .
pub fn scan_network(
    rtsp_paths_file: &str,
    mjpeg_paths_file: &str) -> Result<ScanReport> {
    let mut port_set = HashSet::<u16>::new();
    port_set.extend(RTSP_PORT_CANDIDATES);
    port_set.extend(HTTP_PORT_CANDIDATES);
    let port_candidates = PortCollection::new()
        .add_all(port_set);
    let mut report = try!(find_all_open_ports(&port_candidates));
    // note: we permit only one RTSP service per host (some stupid RTSP servers
    // are accessible from more than one port and they tend to crash when they
    // are accessed from the "incorrect" one)
    let rtsp_ports = try!(find_rtsp_ports(&report, RTSP_PORT_CANDIDATES));
    let rtsp_port_priorities = get_port_priorities(RTSP_PORT_CANDIDATES);
    let rtsp_ports = filter_duplicit_services(
        &rtsp_ports,
        &rtsp_port_priorities);
    // note: we permit only one HTTP service per host
    let http_ports = try!(find_http_ports(&report, HTTP_PORT_CANDIDATES));
    let http_port_priorities = get_port_priorities(HTTP_PORT_CANDIDATES);
    let http_ports = filter_duplicit_services(
        &http_ports,
        &http_port_priorities);
    let rtsp_services  = try!(find_rtsp_services(rtsp_paths_file, &rtsp_ports));
    let mjpeg_services = try!(find_mjpeg_services(mjpeg_paths_file, &http_ports));
    let mut hosts = Vec::new();
    hosts.extend(get_hosts(&rtsp_services));
    hosts.extend(get_hosts(&mjpeg_services));
    let http_services = find_http_services(&http_ports, &hosts);
    for svc in rtsp_services {
        report.add_service(svc);
    }
    for svc in mjpeg_services {
        report.add_service(svc);
    }
    for svc in http_services {
        report.add_service(svc);
    }
    Ok(report)
}
pub fn scan_network ( rtsp_paths_file : & str , mjpeg_paths_file : & str ) -> Result < ScanReport > { let mut port_set = HashSet :: < u16 > :: new ( ) ; port_set . extend ( RTSP_PORT_CANDIDATES ) ; port_set . extend ( HTTP_PORT_CANDIDATES ) ; let port_candidates = PortCollection :: new ( ) . add_all ( port_set ) ; let mut report = try ! ( find_all_open_ports ( port_candidates ) ) ; // note: we permit only one RTSP service per host (some stupid RTSP servers // are accessible from more than one port and they tend to crash when they // are accessed from the "incorrect" one) let rtsp_ports = try ! ( find_rtsp_ports ( report RTSP_PORT_CANDIDATES ) ) ; let rtsp_port_priorities = get_port_priorities ( RTSP_PORT_CANDIDATES ) ; let rtsp_ports = filter_duplicit_services ( & rtsp_ports , & rtsp_port_priorities ) ; // note: we permit only one HTTP service per host let http_ports = try ! ( find_http_ports ( report HTTP_PORT_CANDIDATES ) ) ; let http_port_priorities = get_port_priorities ( HTTP_PORT_CANDIDATES ) ; let http_ports = filter_duplicit_services ( & http_ports , & http_port_priorities ) ; let rtsp_services = try ! ( find_rtsp_services ( rtsp_paths_file rtsp_ports ) ) ; let mjpeg_services = try ! ( find_mjpeg_services ( mjpeg_paths_file http_ports ) ) ; let mut hosts = Vec :: new ( ) ; hosts . extend ( get_hosts ( & rtsp_services ) ) ; hosts . extend ( get_hosts ( & mjpeg_services ) ) ; let http_services = find_http_services ( & http_ports , & hosts ) ; for svc in rtsp_services { report . add_service ( svc ) ; } for svc in mjpeg_services { report . add_service ( svc ) ; } for svc in http_services { report . add_service ( svc ) ; } Ok ( report ) }
Find all RTSP and MJPEG streams and corresponding HTTP services in all
local networks.
Find all RTSP and MJPEG streams and corresponding HTTP services in all local networks .
rtsp_paths_file
&str
mjpeg_paths_file
&str
rtsp_paths_file
&str
mjpeg_paths_file
&str