// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Next MinVersion: 4 // // NOTE: This mojom exists in two places and must be kept in sync: // Chromium: chromeos/services/network_health/public/mojom/ // ChromeOS: src/platform2/diagnostics/mojom/external/ module chromeos.network_diagnostics.mojom; import "mojo/public/mojom/base/time.mojom"; // Enumeration of the possible network diagnostic routines. See // NetworkDiagnosticsRoutines interface for more details. [Stable, Extensible] enum RoutineType { [Default] kLanConnectivity, kSignalStrength, kGatewayCanBePinged, kHasSecureWiFiConnection, kDnsResolverPresent, kDnsLatency, kDnsResolution, kCaptivePortal, kHttpFirewall, kHttpsFirewall, kHttpsLatency, kVideoConferencing, kArcHttp, kArcDnsResolution, kArcPing, [MinVersion=3] kGoogleServicesConnectivity, }; // Each routine can result in one of the possible verdicts. [Stable, Extensible] enum RoutineVerdict { // Routine ran successfully and no connectivity problem found. [Default] kNoProblem, // Routine ran successfully and connectivity problem found. kProblem, // Routine has not been run. kNotRun, }; // Source of network_diagnostics call. [Stable, Extensible] enum RoutineCallSource { // Routine was called from an unknown source. [Default] kUnknown, // Routine was called from the Diagnostics page in the Settings UI. kDiagnosticsUI, // Routine was called from the Network Health tab in chrome://network. kChromeNetworkPage, // Routine was called from cros_healthd. kCrosHealthd, // Routine was called from telemetry metrics reporting. // See directory chrome/browser/ash/policy/reporting/metrics_reporting/ kMetricsReporting, // Routine was called from Network Health source. // See chrome/browser/ash/system_logs/network_health_source.cc kNetworkHealthSource, }; // Problems related to the LanConnectivity routine. [Stable, Extensible] enum LanConnectivityProblem { [Default] kNoLanConnectivity, }; // Problems related to the SignalStrength routine. [Stable, Extensible] enum SignalStrengthProblem { [Default] kWeakSignal, }; // Problems related to the GatewayCanBePinged routine. [Stable, Extensible] enum GatewayCanBePingedProblem { // All gateways are unreachable, hence cannot be pinged. [Default] kUnreachableGateway, // The default network cannot be pinged. kFailedToPingDefaultNetwork, // The default network has a latency above the threshold. kDefaultNetworkAboveLatencyThreshold, // One or more of the non-default networks has failed pings. kUnsuccessfulNonDefaultNetworksPings, // One or more of the non-default networks has a latency above the threshold. kNonDefaultNetworksAboveLatencyThreshold, }; // Problems related to the HasSecureWiFiConnection routine. [Stable, Extensible] enum HasSecureWiFiConnectionProblem { [Default] kSecurityTypeNone, kSecurityTypeWep8021x, kSecurityTypeWepPsk, kUnknownSecurityType, }; // Problems related to the DnsResolverPresent routine. [Stable, Extensible] enum DnsResolverPresentProblem { [Default] kNoNameServersFound, kMalformedNameServers, kEmptyNameServers, // DEPRECATED: Use kNoNameServersFound instead }; // Problems related to the DnsLatencyProblem routine. [Stable, Extensible] enum DnsLatencyProblem { // The routine was unable to resolve one or more hosts. [Default] kHostResolutionFailure, // Average DNS latency across hosts is slightly above expected threshold kSlightlyAboveThreshold, // Average DNS latency across hosts is significantly above expected threshold kSignificantlyAboveThreshold, }; // Problems related to the DnsResolution routine. [Stable, Extensible] enum DnsResolutionProblem { // The routine was unable to successfully resolve the test host [Default] kFailedToResolveHost, }; // Problems related to the CaptivePortal routine. [Stable, Extensible] enum CaptivePortalProblem { // No active networks found. [Default] kNoActiveNetworks, // The active network is not connected or the portal state is not available. kUnknownPortalState, // A portal is suspected but no redirect was provided. kPortalSuspected, // The network is in a portal state with a redirect URL. kPortal, // A proxy requiring authentication is detected. kProxyAuthRequired, // The active network is connected but no internet is available and no proxy // was detected. kNoInternet, }; // Problems related to the HttpFirewall routine. [Stable, Extensible] enum HttpFirewallProblem { // DNS resolution failures above threshold. [Default] kDnsResolutionFailuresAboveThreshold, // Firewall detected. kFirewallDetected, // A firewall may potentially exist. kPotentialFirewall, }; // Problems related to the HttpsFirewall routine. [Stable, Extensible] enum HttpsFirewallProblem { // DNS resolution failure rate is high. [Default] kHighDnsResolutionFailureRate, // Firewall detected. kFirewallDetected, // A firewall may potentially exist. kPotentialFirewall, }; // Problems related to the HttpsLatency routine. [Stable, Extensible] enum HttpsLatencyProblem { // One or more DNS resolutions resulted in a failure. [Default] kFailedDnsResolutions, // One or more HTTPS requests resulted in a failure. kFailedHttpsRequests, // HTTPS request latency is high. kHighLatency, // HTTPS request latency is very high. kVeryHighLatency, }; // Problems related to the VideoConferencing routine. [Stable, Extensible] enum VideoConferencingProblem { // Failed requests to a STUN server via UDP. [Default] kUdpFailure, // Failed requests to a STUN server via TCP. kTcpFailure, // Failed to establish a TLS connection to media hostnames. kMediaFailure, }; // Problems related to the ArcHttp routine. [Stable, Extensible] enum ArcHttpProblem { // Failed to get the ARC Service Manager. [Default] kFailedToGetArcServiceManager, // Failed to get instance of the NetInstance service. kFailedToGetNetInstanceForHttpTest, // HTTPS request latency is high. kHighLatency, // HTTPS request latency is very high. kVeryHighLatency, // One or more HTTP requests resulted in a failure. kFailedHttpRequests, }; // Problems related to the ArcDnsResolution routine. [Stable, Extensible] enum ArcDnsResolutionProblem { // Failed to get the ARC Service Manager. [Default] kFailedToGetArcServiceManager, // Failed to get instance of the NetInstance service. kFailedToGetNetInstanceForDnsResolutionTest, // DNS query latency is high. kHighLatency, // DNS query latency is very high. kVeryHighLatency, // One or more DNS queries resulted in a failure. kFailedDnsQueries, }; // Problems related to the ArcPing routine. [Stable, Extensible] enum ArcPingProblem { // Failed to get the ARC Service Manager. [Default] kFailedToGetArcServiceManager, // Failed to get instance of the NetInstance service. kFailedToGetNetInstanceForPingTest, // Timeout failure when getting managed properties of networks. kGetManagedPropertiesTimeoutFailure, // All gateways are unreachable, hence cannot be pinged. kUnreachableGateway, // The default network cannot be pinged. kFailedToPingDefaultNetwork, // The default network has a latency above the threshold. kDefaultNetworkAboveLatencyThreshold, // One or more of the non-default networks has failed pings. kUnsuccessfulNonDefaultNetworksPings, // One of more of the non-default networks has a latency above the threshold. kNonDefaultNetworksAboveLatencyThreshold, }; // Problem types for general connection errors (excludes proxy-specific errors // and kNoValidProxy which use separate union variants). // NextMinVersion: 1, NextIndex: 9 [Stable, Extensible] enum GoogleServicesConnectivityProblemType { // The routine failed due to internal reasons, // which does not indicate any problems with hosts' // connectivity. See `error_message` for more details. [Default] kInternalError = 0, // The tool was unable to determine the problem. kUnknownError = 1, // General connectivity error, when the tool is unable to determine the // reason of failure. kConnectionFailure = 2, // Operation timed out during connection to host. kConnectionTimeout = 3, // Unable to resolve hostname. kDnsResolutionError = 4, // Failed to establish SSL/TLS connection. kSSLConnectionError = 5, // Peer certificate cannot be authenticated with // known CA certificates kPeerCertificateError = 6, // Failures on http response. kHttpError = 7, // The network was disconnected during the time of the test. kNoNetworkError = 8, }; // Problem types for proxy-specific connection errors (reported only when a // proxy is configured on the device). // NextMinVersion: 1, NextIndex: 2 [Stable, Extensible] enum GoogleServicesConnectivityProxyProblemType { // Unable to resolve proxy. [Default] kProxyDnsResolutionError = 0, // Unable to establish connection to proxy. kProxyConnectionFailure = 1, }; // Common error details shared by all Google Services connectivity problems. [Stable] struct GoogleServicesConnectivityErrorDetails { // The specific, detailed error message describing the failure. string error_message; // Human-readable suggestion for resolving the issue, intended for enterprise // admins, CaPSE, or Tech Support personnel. Always in English (no i18n). string? resolution_message; }; // Common fields for connection errors (shared by regular and proxy errors). [Stable] struct GoogleServicesConnectivityConnectionErrorInfo { // Hostname that was tested. string hostname; // Common error details. GoogleServicesConnectivityErrorDetails error_details; // UTC Timestamp that represents the start of the connectivity test. mojo_base.mojom.Time? timestamp_start; // UTC Timestamp that represents the end of the connectivity test. mojo_base.mojom.Time? timestamp_end; }; // Connection error - proxy is optional (may or may not have been used). [Stable] struct GoogleServicesConnectivityConnectionError { // The specific error type. GoogleServicesConnectivityProblemType problem_type; // The proxy used for this test. Not set if no proxy was used. string? proxy; // Common connection error info. GoogleServicesConnectivityConnectionErrorInfo connection_info; }; // Proxy connection error - proxy is always present. [Stable] struct GoogleServicesConnectivityProxyConnectionError { // The specific proxy error type. GoogleServicesConnectivityProxyProblemType problem_type; // The proxy that failed. string proxy; // Common connection error info. GoogleServicesConnectivityConnectionErrorInfo connection_info; }; // No valid proxy error - no timestamps since connection was never attempted. // Problem type is implicit (always kNoValidProxy, which is not in any enum). [Stable] struct GoogleServicesConnectivityNoValidProxyError { // Hostname for which proxy couldn't be determined (system proxy mode). // Not set if user provided an invalid proxy URL directly. string? hostname; // The invalid proxy URL (user-provided proxy mode). // Not set if using system proxy and proxy couldn't be determined. string? proxy; // Common error details. GoogleServicesConnectivityErrorDetails error_details; }; // Union of connectivity problems - enforces correct field availability. [Stable] union GoogleServicesConnectivityProblem { // Connection was attempted but failed (non-proxy errors). GoogleServicesConnectivityConnectionError connection_error; // Connection to proxy failed. GoogleServicesConnectivityProxyConnectionError proxy_connection_error; // Proxy validation failed before connection could be attempted. GoogleServicesConnectivityNoValidProxyError no_valid_proxy_error; }; // Union of all possible routine problems. See each problem enum definition for // more details. [Stable] union RoutineProblems { array lan_connectivity_problems; array signal_strength_problems; array gateway_can_be_pinged_problems; array has_secure_wifi_connection_problems; array dns_resolver_present_problems; array dns_latency_problems; array dns_resolution_problems; array captive_portal_problems; array http_firewall_problems; array https_firewall_problems; array https_latency_problems; array video_conferencing_problems; array arc_http_problems; array arc_dns_resolution_problems; array arc_ping_problems; [MinVersion=3] array google_services_connectivity_problems; }; // Result values specific to HttpsLatency routine. [Stable] struct HttpsLatencyResultValue { mojo_base.mojom.TimeDelta latency; }; // Union of routine specific result values if any. [Stable] union RoutineResultValue { HttpsLatencyResultValue https_latency_result_value; }; // A single routine's result. [Stable] struct RoutineResult { // The result of the routine. RoutineVerdict verdict; // The list of detected problems, if any. RoutineProblems problems; // The timestamp when the routine was completed. mojo_base.mojom.Time timestamp; // Routine specific result values. [MinVersion=1] RoutineResultValue? result_value; // The source that invoked the routine. [MinVersion=2] RoutineCallSource source; }; // This interface is to be used by any clients that need to run specific // network-related diagnostics. Expected clients of this interface are // NetworkHealth, cros_healthd, and a connectivity diagnostics Web UI (to name // a few). The bound implementation is intended to live in the browser process. // Deprecated Methods: 1 - 11 // Next Method ID: 30 [Stable] interface NetworkDiagnosticsRoutines { // Returns the most recent result for the specified routine type, if it has // been run. GetResult@27(RoutineType routine) => (RoutineResult? result); // Returns a map of all previously run routine types and their most recent // result. GetAllResults@28() => (map results); // Tests whether the device is connected to a LAN. It is possible that the // device may be trapped in a captive portal yet pass this test successfully. // Captive portal checks are done separately and are outside of the scope of // this routine. See CaptivePortal([MinVersion=2] RoutineCallSource? source) // below. RunLanConnectivity@12([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether there is an acceptable signal strength on wireless networks. RunSignalStrength@13([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether the gateway of connected networks is pingable. RunGatewayCanBePinged@14([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether the WiFi connection is secure. Note that if WiFi is not // connected, the routine will result in a |kNotRun| verdict. RunHasSecureWiFiConnection@15([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether a DNS resolver is available to the browser. RunDnsResolverPresent@16([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether the DNS latency is below an acceptable threshold. RunDnsLatency@17([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether a DNS resolution can be completed successfully. RunDnsResolution@18([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether the internet connection is behind a captive portal. RunCaptivePortal@19([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether a firewall is blocking HTTP port 80. RunHttpFirewall@20([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether a firewall is blocking HTTPS port 443. RunHttpsFirewall@21([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether the HTTPS latency is within established tolerance levels for // the system. RunHttpsLatency@22([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests the device's video conferencing capabilities by testing whether the // device can: // (1) Contact either a default or specified STUN server via UDP. // (2) Contact either a default or specified STUN server via TCP. // (3) Reach common media endpoints. RunVideoConferencing@23(string? stun_server_hostname, [MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether ARC can make successful HTTP GET requests to the resources // needed during the ARC Provisioning step. RunArcHttp@24([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether ARC can reach the connected networks' gateways. RunArcPing@25([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether ARC can make successful DNS queries to the hostnames // needed during the ARC Provisioning step. RunArcDnsResolution@26([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); // Tests whether Google Services can be successfully reached. [MinVersion=3] RunGoogleServicesConnectivity@29([MinVersion=2] RoutineCallSource? source) => (RoutineResult result); };