// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// <p>
//   The <code>chrome.networking.onc</code> API is used for configuring
//   network connections (Cellular, Ethernet, VPN, WiFi or WiMAX).
//   This API is available in Chrome OS kiosk sessions.
// </p>
// <p>
//   Network connection configurations are specified following
//   <a href="https://chromium.googlesource.com/chromium/src/+/master/components/onc/docs/onc_spec.md">
//   Open Network Configuration (ONC)</a> specification.
// </p>
// <p>
//   <b>NOTE</b>: Most dictionary properties and enum values use UpperCamelCase
//   to match the ONC specification instead of the JavaScript lowerCamelCase
//   convention.
// </p>
namespace networking.onc {
  enum ActivationStateType {
    Activated, Activating, NotActivated, PartiallyActivated
  };

  enum CaptivePortalStatus {
    Unknown, Offline, Online, Portal, ProxyAuthRequired
  };

  enum ConnectionStateType {
    Connected, Connecting, NotConnected
  };

  enum DeviceStateType {
    // Device is available but not initialized.
    Uninitialized,
    // Device is initialized but not enabled.
    Disabled,
    // Enabled state has been requested but has not completed.
    Enabling,
    // Device is enabled.
    Enabled,
    // Device is prohibited.
    Prohibited
  };

  enum IPConfigType {
    DHCP, Static
  };

  enum NetworkType {
    All, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX
  };

  enum ProxySettingsType {
    Direct, Manual, PAC, WPAD
  };

  enum ClientCertificateType {
    Ref, Pattern
  };

  dictionary ManagedBoolean {
    // The active value currently used by the network configuration manager
    // (e.g. Shill).
    boolean? Active;
    // The source from which the effective property value was determined.
    DOMString? Effective;
    // The property value provided by the user policy.
    boolean? UserPolicy;
    // The property value provided by the device policy.
    boolean? DevicePolicy;
    // The property value set by the logged in user. Only provided if
    // |UserEditable| is <code>true</code>.
    boolean? UserSetting;
    // The value set for all users of the device. Only provided if
    // |DeviceEditiable| is <code>true</code>.
    boolean? SharedSetting;
    // Whether a UserPolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? UserEditable;
    // Whether a DevicePolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? DeviceEditable;
  };

  dictionary ManagedLong {
    // The active value currently used by the network configuration manager
    // (e.g. Shill).
    long? Active;
    // The source from which the effective property value was determined.
    DOMString? Effective;
    // The property value provided by the user policy.
    long? UserPolicy;
    // The property value provided by the device policy.
    long? DevicePolicy;
    // The property value set by the logged in user. Only provided if
    // |UserEditable| is <code>true</code>.
    long? UserSetting;
    // The value set for all users of the device. Only provided if
    // |DeviceEditiable| is <code>true</code>.
    long? SharedSetting;
    // Whether a UserPolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? UserEditable;
    // Whether a DevicePolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? DeviceEditable;
  };

  dictionary ManagedDOMString {
    // The active value currently used by the network configuration manager
    // (e.g. Shill).
    DOMString? Active;
    // The source from which the effective property value was determined.
    DOMString? Effective;
    // The property value provided by the user policy.
    DOMString? UserPolicy;
    // The property value provided by the device policy.
    DOMString? DevicePolicy;
    // The property value set by the logged in user. Only provided if
    // |UserEditable| is <code>true</code>.
    DOMString? UserSetting;
    // The value set for all users of the device. Only provided if
    // |DeviceEditiable| is <code>true</code>.
    DOMString? SharedSetting;
    // Whether a UserPolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? UserEditable;
    // Whether a DevicePolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? DeviceEditable;
  };

  dictionary ManagedDOMStringList {
    // The active value currently used by the network configuration manager
    // (e.g. Shill).
    DOMString[]? Active;
    // The source from which the effective property value was determined.
    DOMString? Effective;
    // The property value provided by the user policy.
    DOMString[]? UserPolicy;
    // The property value provided by the device policy.
    DOMString[]? DevicePolicy;
    // The property value set by the logged in user. Only provided if
    // |UserEditable| is <code>true</code>.
    DOMString[]? UserSetting;
    // The value set for all users of the device. Only provided if
    // |DeviceEditiable| is <code>true</code>.
    DOMString[]? SharedSetting;
    // Whether a UserPolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? UserEditable;
    // Whether a DevicePolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? DeviceEditable;
  };

  dictionary ManagedIPConfigType {
    // The active value currently used by the network configuration manager
    // (e.g. Shill).
    IPConfigType? Active;
    // The source from which the effective property value was determined.
    DOMString? Effective;
    // The property value provided by the user policy.
    IPConfigType? UserPolicy;
    // The property value provided by the device policy.
    IPConfigType? DevicePolicy;
    // The property value set by the logged in user. Only provided if
    // |UserEditable| is <code>true</code>.
    IPConfigType? UserSetting;
    // The value set for all users of the device. Only provided if
    // |DeviceEditiable| is <code>true</code>.
    IPConfigType? SharedSetting;
    // Whether a UserPolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? UserEditable;
    // Whether a DevicePolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? DeviceEditable;
  };

  dictionary ManagedProxySettingsType {
    // The active value currently used by the network configuration manager
    // (e.g. Shill).
    ProxySettingsType? Active;
    // The source from which the effective property value was determined.
    DOMString? Effective;
    // The property value provided by the user policy.
    ProxySettingsType? UserPolicy;
    // The property value provided by the device policy.
    ProxySettingsType? DevicePolicy;
    // The property value set by the logged in user. Only provided if
    // |UserEditable| is <code>true</code>.
    ProxySettingsType? UserSetting;
    // The value set for all users of the device. Only provided if
    // |DeviceEditiable| is <code>true</code>.
    ProxySettingsType? SharedSetting;
    // Whether a UserPolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? UserEditable;
    // Whether a DevicePolicy for the property exists and allows the property to
    // be edited (i.e. the policy set recommended property value).
    // Defaults to <code>false</code>.
    boolean? DeviceEditable;
  };

  // Sub-dictionary types.

  dictionary CellularProviderProperties {
    // The operator name.
    DOMString Name;
    // Cellular network ID as a simple concatenation of the network's
    // MCC (Mobile Country Code) and MNC (Mobile Network Code).
    DOMString Code;
    // The two-letter country code.
    DOMString? Country;
  };

  dictionary IssuerSubjectPattern {
    // If set, the value against which to match the certificate subject's
    // common name.
    DOMString? CommonName;
    // If set, the value against which to match the certificate subject's
    // common location.
    DOMString? Locality;
    // If set, the value against which to match the certificate subject's
    // organizations. At least one organization should match the value.
    DOMString? Organization;
    // If set, the value against which to match the certificate subject's
    // organizational units. At least one organizational unit should match the
    // value.
    DOMString? OrganizationalUnit;    
  };

  dictionary CertificatePattern {
    // List of URIs to which the user can be directed in case no certificates
    // that match this pattern are found.
    DOMString[]? EnrollmentURI;
    // If set, pattern against which X.509 issuer settings should be matched.
    IssuerSubjectPattern? Issuer;
    // List of certificate issuer CA certificates. A certificate must be signed
    // by one of them in order to match this pattern.
    DOMString[]? IssuerCARef;
    // If set, pattern against which X.509 subject settings should be matched.
    IssuerSubjectPattern? Subject;
  };

  dictionary EAPProperties {
    DOMString? AnonymousIdentity;
    CertificatePattern? ClientCertPattern;
    DOMString? ClientCertPKCS11Id;
    DOMString? ClientCertRef;
    ClientCertificateType ClientCertType;
    DOMString? Identity;
    DOMString? Inner;
    // The outer EAP type. Required by ONC, but may not be provided when
    // translating from Shill.
    DOMString? Outer;
    DOMString? Password;
    boolean? SaveCredentials;
    DOMString[]? ServerCAPEMs;
    DOMString[]? ServerCARefs;
    ManagedDOMString? SubjectMatch;
    boolean? UseProactiveKeyCaching;
    boolean? UseSystemCAs;
  };

  dictionary FoundNetworkProperties {
    // Network availability.
    DOMString Status;
    // Network ID.
    DOMString NetworkId;
    // Access technology used by the network.
    DOMString Technology;
    // The network operator's short-format name.
    DOMString? ShortName;
    // The network operator's long-format name.
    DOMString? LongName;
  };

  dictionary IPConfigProperties {
    // Gateway address used for the IP configuration.
    DOMString? Gateway;
    // The IP address for a connection. Can be IPv4 or IPv6 address, depending
    // on value of <code>Type</code>.
    DOMString? IPAddress;
    // Array of addresses used for name servers.
    DOMString[]? NameServers;
    // The routing prefix.
    long? RoutingPrefix;
    // The IP configuration type. Can be <code>IPv4</code> or <code>IPv6</code>.
    DOMString? Type;
    // The URL for WEb Proxy Auto-Discovery, as reported over DHCP.
    DOMString? WebProxyAutoDiscoveryUrl;
  };

  dictionary ManagedIPConfigProperties {
    // See $(ref:IPConfigProperties.Gateway).
    ManagedDOMString? Gateway;
    // See $(ref:IPConfigProperties.IPAddress).
    ManagedDOMString? IPAddress;
    // See $(ref:IPConfigProperties.NameServers).
    ManagedDOMStringList? NameServers;
    // See $(ref:IPConfigProperties.RoutingPrefix).
    ManagedLong? RoutingPrefix;
    // See $(ref:IPConfigProperties.Type).
    ManagedDOMString? Type;
    // See $(ref:IPConfigProperties.WebProxyAutoDiscoveryUrl).
    ManagedDOMString? WebProxyAutoDiscoveryUrl;
  };

  dictionary PaymentPortal {
    // The HTTP method to use for the payment portal.
    DOMString Method;
    // The post data to send to the payment portal. Ignored unless
    // <code>Method</code> is <code>POST</code>.
    DOMString? PostData;
    // The payment portal URL.
    DOMString? Url;
  };

  dictionary ProxyLocation {
    // The proxy IP address host.
    DOMString Host;
    // The port to use for the proxy.
    long Port;
  };

  dictionary ManagedProxyLocation {
    // See $(ref:ProxyLocation.Host).
    ManagedDOMString Host;
    // See $(ref:ProxyLocation.Port).
    ManagedLong Port;
  };

  [noinline_doc] dictionary ManualProxySettings {
    // Settings for HTTP proxy.
    ProxyLocation? HTTPProxy;
    // Settings for secure HTTP proxy.
    ProxyLocation? SecureHTTPProxy;
    // Settings for FTP proxy.
    ProxyLocation? FTPProxy;
    // Settings for SOCKS proxy.
    ProxyLocation? SOCKS;
  };

  dictionary ManagedManualProxySettings {
    // See $(ref:ManualProxySettings.HTTPProxy).
    ManagedProxyLocation? HTTPProxy;
    // See $(ref:ManualProxySettings.SecureHTTPProxy).
    ManagedProxyLocation? SecureHTTPProxy;
    // See $(ref:ManualProxySettings.FTPProxy).
    ManagedProxyLocation? FTPProxy;
    // See $(ref:ManualProxySettings.SOCKS).
    ManagedProxyLocation? SOCKS;
  };

  [noinline_doc] dictionary ProxySettings {
    // The type of proxy settings.
    ProxySettingsType Type;
    // Manual proxy settings - used only for <code>Manual</code> proxy settings.
    ManualProxySettings? Manual;
    // Domains and hosts for which manual proxy settings are excluded.
    DOMString[]? ExcludeDomains;
    // URL for proxy auto-configuration file.
    DOMString? PAC;
  };

  dictionary ManagedProxySettings {
    // See $(ref:ProxySettings.Type).
    ManagedProxySettingsType Type;
    // See $(ref:ProxySettings.Manual).
    ManagedManualProxySettings? Manual;
    // See $(ref:ProxySettings.ExcludeDomains).
    ManagedDOMStringList? ExcludeDomains;
    // See $(ref:ProxySettings.PAC).
    ManagedDOMString? PAC;
  };

  dictionary SIMLockStatus {
    // The status of SIM lock - possible values are <code>'sim-pin'</code>,
    // <code>'sim-puk'</code> and <code>''</code>.
    DOMString LockType;
    // Whether SIM lock is enabled.
    boolean LockEnabled;
    // Number of PIN lock tries allowed before PUK is required to unlock the
    // SIM.
    long? RetriesLeft;
  };

  dictionary ThirdPartyVPNProperties {
    // ID of the third-party VPN provider extension.
    DOMString ExtensionID;
    // The VPN provider name.
    DOMString? ProviderName;
  };

  dictionary ManagedThirdPartyVPNProperties {
    // See $(ref:ThirdPartyVPNProperties.ExtensionID).
    ManagedDOMString ExtensionID;
    // See $(ref:ThirdPartyVPNProperties.ProviderName).
    DOMString? ProviderName;
  };

  // Network type dictionary types.

  [noinline_doc] dictionary CellularProperties {
    // Whether the cellular network should be connected automatically (when
    // in range). 
    boolean? AutoConnect;
    // The cellular network activation type.
    DOMString? ActivationType;
    // Carrier account activation state.
    ActivationStateType? ActivationState;
    // Whether roaming is allowed for the network.
    boolean? AllowRoaming;
    // The name of the carrier for which the cellular device is configured.
    DOMString? Carrier;
    // Cellular device technology family - <code>CDMA</code> or
    // <code>GSM</code>.
    DOMString? Family;
    // The firmware revision loaded in the cellular modem.
    DOMString? FirmwareRevision;
    // The list of networks found during the most recent network scan.
    FoundNetworkProperties[]? FoundNetworks;
    // The cellular modem hardware revision.
    DOMString? HardwareRevision;
    // Information about the operator that issued the SIM card currently
    // installed in the modem.
    CellularProviderProperties? HomeProvider;
    // The cellular modem manufacturer.
    DOMString? Manufacturer;
    // The cellular modem model ID.
    DOMString? ModelID;
    // If the modem is registered on a network, the network technology
    // currently in use.
    DOMString? NetworkTechnology;
    // Online payment portal a user can use to sign-up for or modify a mobile
    // data plan.
    PaymentPortal? PaymentPortal;
    // The revision of the Preferred Roaming List loaded in the modem.
    long? PRLVersion;
    // The roaming state of the cellular modem on the current network.
    DOMString? RoamingState;
    // Information about the operator on whose network the modem is currently
    // registered.
    CellularProviderProperties? ServingOperator;
    // The state of SIM lock for GSM family networks.
    SIMLockStatus? SIMLockStatus;
    // Whether a SIM card is present.
    boolean? SIMPresent;
     // The current network signal strength.
    long? SignalStrength;
    // Whether the cellular network supports scanning.
    boolean? SupportNetworkScan;
    // A list of supported carriers.
    DOMString[]? SupportedCarriers;
  };

  dictionary ManagedCellularProperties {
    // See $(ref:CellularProperties.AutoConnect).
    ManagedBoolean? AutoConnect;
    // See $(ref:CellularProperties.ActivationType).
    DOMString? ActivationType;
    // See $(ref:CellularProperties.ActivationState).
    ActivationStateType? ActivationState;
    // See $(ref:CellularProperties.AllowRoaming).
    boolean? AllowRoaming;
    // See $(ref:CellularProperties.Carrier).
    ManagedDOMString? Carrier;
    // See $(ref:CellularProperties.Family).
    DOMString? Family;
    // See $(ref:CellularProperties.FirmwareRevision).
    DOMString? FirmwareRevision;
    // See $(ref:CellularProperties.FoundNetworks).
    FoundNetworkProperties[]? FoundNetworks;
    // See $(ref:CellularProperties.HardwareRevision).
    DOMString? HardwareRevision;
    // See $(ref:CellularProperties.HomeProvider).
    CellularProviderProperties[]? HomeProvider;
    // See $(ref:CellularProperties.Manufacturer).
    DOMString? Manufacturer;
    // See $(ref:CellularProperties.ModelID).
    DOMString? ModelID;
    // See $(ref:CellularProperties.NetworkTechnology).
    DOMString? NetworkTechnology;
    // See $(ref:CellularProperties.PaymentPortal).
    PaymentPortal? PaymentPortal;
    // See $(ref:CellularProperties.PRLVersion).
    long? PRLVersion;
    // See $(ref:CellularProperties.RoamingState).
    DOMString? RoamingState;
    // See $(ref:CellularProperties.ServingOperator).
    CellularProviderProperties? ServingOperator;
    // See $(ref:CellularProperties.SIMLockStatus).
    SIMLockStatus? SIMLockStatus;
    // See $(ref:CellularProperties.SIMPresent).
    boolean? SIMPresent;
    // See $(ref:CellularProperties.SignalStrength).
    long? SignalStrength;
    // See $(ref:CellularProperties.SupportNetworkScan).
    boolean? SupportNetworkScan;
    // See $(ref:CellularProperties.SupportedCarriers).
    DOMString[]? SupportedCarriers;
  };

  dictionary CellularStateProperties {
    // See $(ref:CellularProperties.ActivationState).
    ActivationStateType? ActivationState;
    // See $(ref:CellularProperties.NetworkTechnology).
    DOMString? NetworkTechnology;
    // See $(ref:CellularProperties.RoamingState).
    DOMString? RoamingState;
    // See $(ref:CellularProperties.SIMPresent).
    boolean? SIMPresent;
    // See $(ref:CellularProperties.SignalStrength).
    long? SignalStrength;
  };

  dictionary EthernetProperties {
    // Whether the Ethernet network should be connected automatically. 
    boolean? AutoConnect;
    // The authentication used by the Ethernet network. Possible values are
    // <code>None</code> and <code>8021X</code>.
    DOMString? Authentication;
    // Network's EAP settings. Required for 8021X authentication.
    EAPProperties? EAP;
  };

  dictionary ManagedEthernetProperties {
    // See $(ref:EthernetProperties.AutoConnect).
    ManagedBoolean? AutoConnect;
    // See $(ref:EthernetProperties.Authentication).
    ManagedDOMString? Authentication;
  };

  dictionary EthernetStateProperties {
    // See $(ref:EthernetProperties.Authentication).
    DOMString Authentication;
  };

  dictionary VPNProperties {
    // Whether the VPN network should be connected automatically.
    boolean? AutoConnect;
    // The VPN host.
    DOMString? Host;
    // The VPN type.
    DOMString? Type;
  };

  dictionary ManagedVPNProperties {
    // See $(ref:VPNProperties.AutoConnect).
    ManagedBoolean? AutoConnect;
    // See $(ref:VPNProperties.Host).
    ManagedDOMString? Host;
    // See $(ref:VPNProperties.Type).
    ManagedDOMString Type;
  };

  dictionary VPNStateProperties {
    // See $(ref:VPNProperties.Type).
    DOMString Type;
  };

  [noinline_doc] dictionary WiFiProperties {
    // Whether ARP polling of default gateway is allowed. Defaults to true.
    boolean? AllowGatewayARPPolling;
    // Whether the WiFi network should be connected automatically when in range.
    boolean? AutoConnect;
    // The BSSID of the associated access point..
    DOMString? BSSID;
    // The network EAP properties. Required for <code>WEP-8021X</code> and
    // <code>WPA-EAP</code> networks.
    EAPProperties? EAP;
    // The WiFi service operating frequency in MHz. For connected networks, the
    // current frequency on which the network is connected. Otherwise, the
    // frequency of the best available BSS.
    long? Frequency;
    // Contains all operating frequency recently seen for the WiFi network.
    long[]? FrequencyList;
    // HEX-encoded copy of the network SSID.
    DOMString? HexSSID;
    // Whether the network SSID will be broadcast.
    boolean? HiddenSSID;
    // Signal-to-noise value (in dB) below which roaming to a new network
    // should be attempted.
    long? RoamThreshold;
    // The network SSID.
    DOMString? SSID;
    // The network security type.
    DOMString? Security;
    // The network signal strength.
    long? SignalStrength;
  };

  dictionary ManagedWiFiProperties {
    // See $(ref:WiFiProperties.AllowGatewayARPPolling).
    ManagedBoolean? AllowGatewayARPPolling;
    // See $(ref:WiFiProperties.AutoConnect).
    ManagedBoolean? AutoConnect;
    // See $(ref:WiFiProperties.BSSID).
    DOMString? BSSID;
    // See $(ref:WiFiProperties.Frequency).
    long? Frequency;
    // See $(ref:WiFiProperties.FrequencyList).
    long[]? FrequencyList;
    // See $(ref:WiFiProperties.HexSSID).
    ManagedDOMString? HexSSID;
    // See $(ref:WiFiProperties.HiddenSSID).
    ManagedBoolean? HiddenSSID;
    // See $(ref:WiFiProperties.RoamThreshold).
    ManagedLong? RoamThreshold;
    // See $(ref:WiFiProperties.SSID).
    ManagedDOMString? SSID;
    // See $(ref:WiFiProperties.Security).
    ManagedDOMString Security;
    // See $(ref:WiFiProperties.SignalStrength).
    long? SignalStrength;
  };

  dictionary WiFiStateProperties {
    // See $(ref:WiFiProperties.BSSID).
    DOMString? BSSID;
    // See $(ref:WiFiProperties.Frequency).
    long? Frequency;
    // See $(ref:WiFiProperties.Security).
    DOMString Security;
    // See $(ref:WiFiProperties.SignalStrength).
    long? SignalStrength;
  };

  dictionary WiMAXProperties {
    // Whether the network should be connected automatically.
    boolean? AutoConnect;
    // The network EAP properties.
    EAPProperties? EAP;
    // The network signal strength.
    long? SignalStrength;
  };

  dictionary ManagedWiMAXProperties {
    // See $(ref:WiMAXProperties.AutoConnect).
    ManagedBoolean? AutoConnect;
    // See $(ref:WiMAXProperties.SignalStrength).
    long? SignalStrength;
  };

  dictionary WiMAXStateProperties {
    // See $(ref:WiMAXProperties.SignalStrength).
    long? SignalStrength;
  };

  dictionary NetworkConfigProperties {
    // See $(ref:NetworkProperties.Cellular).
    CellularProperties? Cellular;
    // See $(ref:NetworkProperties.Ethernet).
    EthernetProperties? Ethernet;
    // See $(ref:NetworkProperties.GUID).
    DOMString? GUID;
    // See $(ref:NetworkProperties.IPAddressConfigType).
    IPConfigType? IPAddressConfigType;
    // See $(ref:NetworkProperties.Name).
    DOMString? Name;
    // See $(ref:NetworkProperties.NameServersConfigType).
    IPConfigType? NameServersConfigType;
    // See $(ref:NetworkProperties.Priority).
    long? Priority;
    // See $(ref:NetworkProperties.Type).
    NetworkType? Type;
    // See $(ref:NetworkProperties.VPN).
    VPNProperties? VPN;
    // See $(ref:NetworkProperties.WiFi).
    WiFiProperties? WiFi;
    // See $(ref:NetworkProperties.WiMAX).
    WiMAXProperties? WiMAX;
  };

  [noinline_doc]
  dictionary NetworkProperties {
    // For cellular networks, cellular network properties.
    CellularProperties? Cellular;
    // Whether the network is connectable.
    boolean? Connectable;
    // The network's current connection state.
    ConnectionStateType? ConnectionState;
    // The last recorded network error state.
    DOMString? ErrorState;
    // For Ethernet networks, the Ethernet network properties.
    EthernetProperties? Ethernet;
    // The network GUID.
    DOMString GUID;
    // The network's IP address configuration type.
    IPConfigType? IPAddressConfigType;
    // The network's IP configuration.
    IPConfigProperties[]? IPConfigs;
    // The network's MAC address.
    DOMString? MacAddress;
    // A user friendly network name.
    DOMString? Name;
    // The IP configuration type for the name servers used by the network.
    IPConfigType? NameServersConfigType;
    // The network priority.
    long? Priority;
    // The network's proxy settings.
    ProxySettings? ProxySettings;
    // For a connected network, whether the network connectivity to the
    // Internet is limited, e.g. if the network is behind a portal, or a
    // cellular network is not activated.
    boolean? RestrictedConnectivity;
    // The network's static IP configuration.
    IPConfigProperties? StaticIPConfig;
    // IP configuration that was received from the DHCP server before applying
    // static IP configuration.
    IPConfigProperties? SavedIPConfig;
    // Indicates whether and how the network is configured.
    DOMString? Source;
    // The network type.
    NetworkType Type;
    // For VPN networks, the network VPN properties.
    VPNProperties? VPN;
    // For WiFi networks, the network WiFi properties.
    WiFiProperties? WiFi;
    // For WiMAX networks, the network WiMAX properties.
    WiMAXProperties? WiMAX;
  };

  [noinline_doc]
  dictionary ManagedProperties {
    // See $(ref:NetworkProperties.Cellular).
    ManagedCellularProperties? Cellular;
    // See $(ref:NetworkProperties.Connectable).
    boolean? Connectable;
    // See $(ref:NetworkProperties.ConnectionState).
    ConnectionStateType? ConnectionState;
    // See $(ref:NetworkProperties.ErrorState).
    DOMString? ErrorState;
    // See $(ref:NetworkProperties.Ethernet).
    ManagedEthernetProperties? Ethernet;
    // See $(ref:NetworkProperties.GUID).
    DOMString GUID;
    // See $(ref:NetworkProperties.IPAddressConfigType).
    ManagedIPConfigType? IPAddressConfigType;
    // See $(ref:NetworkProperties.IPConfigs).
    IPConfigProperties[]? IPConfigs;
    // See $(ref:NetworkProperties.MacAddress).
    DOMString? MacAddress;
    // See $(ref:NetworkProperties.Name).
    ManagedDOMString? Name;
    // See $(ref:NetworkProperties.NameServersConfigType).
    ManagedIPConfigType? NameServersConfigType;
    // See $(ref:NetworkProperties.Priority).
    ManagedLong? Priority;
    // See $(ref:NetworkProperties.ProxySettings).
    ManagedProxySettings? ProxySettings;
    // See $(ref:NetworkProperties.RestrictedConnectivity).
    boolean? RestrictedConnectivity;
    // See $(ref:NetworkProperties.StaticIPConfig).
    ManagedIPConfigProperties? StaticIPConfig;
    // See $(ref:NetworkProperties.SavedIPConfig).
    IPConfigProperties? SavedIPConfig;
    // See $(ref:NetworkProperties.Source).
    DOMString? Source;
    // See $(ref:NetworkProperties.Type).
    NetworkType Type;
    // See $(ref:NetworkProperties.VPN).
    ManagedVPNProperties? VPN;
    // See $(ref:NetworkProperties.WiFi).
    ManagedWiFiProperties? WiFi;
    // See $(ref:NetworkProperties.WiMAX).
    ManagedWiMAXProperties? WiMAX;
  };

  dictionary NetworkStateProperties {
    // See $(ref:NetworkProperties.Cellular).
    CellularStateProperties? Cellular;
    // See $(ref:NetworkProperties.Connectable).
    boolean? Connectable;
    // See $(ref:NetworkProperties.ConnectionState).
    ConnectionStateType? ConnectionState;
    // See $(ref:NetworkProperties.Ethernet).
    EthernetStateProperties? Ethernet;
    // See $(ref:NetworkProperties.ErrorState).
    DOMString? ErrorState;
    // See $(ref:NetworkProperties.GUID).
    DOMString GUID;
    // See $(ref:NetworkProperties.Name).
    DOMString? Name;
    // See $(ref:NetworkProperties.Priority).
    long? Priority;
    // See $(ref:NetworkProperties.Source).
    DOMString? Source;
    // See $(ref:NetworkProperties.Type).
    NetworkType Type;
    // See $(ref:NetworkProperties.VPN).
    VPNStateProperties? VPN;
    // See $(ref:NetworkProperties.WiFi).
    WiFiStateProperties? WiFi;
    // See $(ref:NetworkProperties.WiMAX).
    WiMAXStateProperties? WiMAX;
  };

  dictionary DeviceStateProperties {
    // Set if the device is enabled. True if the device is currently scanning.
    boolean? Scanning;

    // Set to the SIM lock type if the device type is Cellular and the device
    // is locked.
    DOMString? SimLockType;

    // Set to the SIM present state if the device type is Cellular.
    boolean? SimPresent;

    // The current state of the device.
    DeviceStateType State;

    // The network type associated with the device (Cellular, Ethernet, WiFi, or
    // WiMAX).
    NetworkType Type;
  };

  dictionary NetworkFilter {
    // The type of networks to return.
    NetworkType networkType;

    // If true, only include visible (physically connected or in-range)
    // networks. Defaults to 'false'.
    boolean? visible;

    // If true, only include configured (saved) networks. Defaults to 'false'.
    boolean? configured;

    // Maximum number of networks to return. Defaults to 1000 if unspecified.
    // Use 0 for no limit.
    long? limit;
  };

  dictionary GlobalPolicy {
    // If true, only policy networks may auto connect. Defaults to false.
    boolean? AllowOnlyPolicyNetworksToAutoconnect;

    // If true, only policy networks may be connected to and no new networks may
    // be added or configured. Defaults to false.
    boolean? AllowOnlyPolicyNetworksToConnect;
  };

  callback VoidCallback = void();
  callback BooleanCallback = void(boolean result);
  callback StringCallback = void(DOMString result);
  callback GetPropertiesCallback = void(NetworkProperties result);
  callback GetManagedPropertiesCallback = void(ManagedProperties result);
  callback GetStatePropertiesCallback = void(NetworkStateProperties result);
  callback GetNetworksCallback = void(NetworkStateProperties[] result);
  callback GetDeviceStatesCallback = void(DeviceStateProperties[] result);
  callback GetEnabledNetworkTypesCallback = void(NetworkType[] result);
  callback CaptivePortalStatusCallback = void(CaptivePortalStatus result);
  callback GetGlobalPolicyCallback = void(GlobalPolicy result);

  interface Functions {
    // Gets all the properties of the network with id networkGuid. Includes all
    // properties of the network (read-only and read/write values).
    // |networkGuid|: The GUID of the network to get properties for.
    // |callback|: Called with the network properties when received.
    static void getProperties(DOMString networkGuid,
                              GetPropertiesCallback callback);

    // Gets the merged properties of the network with id networkGuid from the
    // sources: User settings, shared settings, user policy, device policy and
    // the currently active settings.
    // |networkGuid|: The GUID of the network to get properties for.
    // |callback|: Called with the managed network properties when received.
    static void getManagedProperties(DOMString networkGuid,
                                     GetManagedPropertiesCallback callback);

    // Gets the cached read-only properties of the network with id networkGuid.
    // This is meant to be a higher performance function than
    // $(ref:getProperties), which requires a round trip to query the networking
    // subsystem. The following properties are returned for all networks: GUID,
    // Type, Name, WiFi.Security. Additional properties are provided for visible
    // networks: ConnectionState, ErrorState, WiFi.SignalStrength,
    // Cellular.NetworkTechnology, Cellular.ActivationState,
    // Cellular.RoamingState.
    // |networkGuid|: The GUID of the network to get properties for.
    // |callback|: Called immediately with the network state properties.
    static void getState(DOMString networkGuid,
                         GetStatePropertiesCallback callback);

    // Sets the properties of the network with id networkGuid.
    // <b>
    //   In kiosk sessions, calling this method on a shared network will fail.
    // </b>
    // |networkGuid|: The GUID of the network to set properties for.
    // |properties|: The properties to set.
    // |callback|: Called when the operation has completed.
    static void setProperties(DOMString networkGuid,
                              NetworkConfigProperties properties,
                              optional VoidCallback callback);

    // Creates a new network configuration from properties. If a matching
    // configured network already exists, this will fail. Otherwise returns the
    // GUID of the new network.
    // |shared|: <p>
    //     If <code>true</code>, share this network configuration with
    //     other users.
    //     </p>
    //     <p>
    //       <b>This option is exposed only to Chrome's Web UI.</b>
    //       When called by apps, <code>false</code> is the only allowed value.
    //     </p>
    // |properties|: The properties to configure the new network with.
    // |callback|: Called with the GUID for the new network configuration once
    //     the network has been created.
    static void createNetwork(boolean shared,
                              NetworkConfigProperties properties,
                              optional StringCallback callback);

    // <p>
    //   Forgets a network configuration by clearing any configured properties
    //   for the network with GUID <code>networkGuid</code>. This may also
    //   include any other networks with matching identifiers (e.g. WiFi SSID
    //   and Security). If no such configuration exists, an error will be set
    //   and the operation will fail.
    // </p>
    // <p>
    //   <b>In kiosk sessions, this method will not be able to forget shared
    //      network configurations.</b>
    // </p>
    // |networkGuid|: The GUID of the network to forget.
    // |callback|: Called when the operation has completed.
    static void forgetNetwork(DOMString networkGuid,
                              optional VoidCallback callback);

    // Returns a list of network objects with the same properties provided by
    // $(ref:getState). A filter is provided to specify the
    // type of networks returned and to limit the number of networks. Networks
    // are ordered by the system based on their priority, with connected or
    // connecting networks listed first.
    // |filter|: Describes which networks to return.
    // |callback|: Called with a dictionary of networks and their state
    //     properties when received.
    static void getNetworks(NetworkFilter filter,
                            GetNetworksCallback callback);

    // Returns states of available networking devices.
    // |callback|: Called with a list of devices and their state.
    static void getDeviceStates(GetDeviceStatesCallback callback);

    // Enables any devices matching the specified network type. Note, the type
    // might represent multiple network types (e.g. 'Wireless').
    // |networkType|: The type of network to enable.
    static void enableNetworkType(NetworkType networkType);

    // Disables any devices matching the specified network type. See note for
    // $(ref:enableNetworkType).
    // |networkType|: The type of network to disable.
    static void disableNetworkType(NetworkType networkType);

    // Requests that the networking subsystem scan for new networks and
    // update the list returned by $(ref:getNetworks). This is only a
    // request: the network subsystem can choose to ignore it.  If the list
    // is updated, then the $(ref:onNetworkListChanged) event will be fired.
    static void requestNetworkScan();

    // Starts a connection to the network with networkGuid.
    // |networkGuid|: The GUID of the network to connect to.
    // |callback|: Called when the connect request has been sent. Note: the
    //     connection may not have completed. Observe $(ref:onNetworksChanged)
    //     to be notified when a network state changes.
    static void startConnect(DOMString networkGuid,
                             optional VoidCallback callback);

    // Starts a disconnect from the network with networkGuid.
    // |networkGuid|: The GUID of the network to disconnect from.
    // |callback|: Called when the disconnect request has been sent. See note
    //     for $(ref:startConnect).
    static void startDisconnect(DOMString networkGuid,
                                optional VoidCallback callback);

    // Returns captive portal status for the network matching 'networkGuid'.
    // |networkGuid|: The GUID of the network to get captive portal status for.
    // |callback|: A callback function that returns the results of the query for
    //     network captive portal status.
    static void getCaptivePortalStatus(DOMString networkGuid,
                                       CaptivePortalStatusCallback callback);

    // Gets the global policy properties. These properties are not expected to
    // change during a session.
    static void getGlobalPolicy(GetGlobalPolicyCallback callback);
  };

  interface Events {
    // Fired when the properties change on any of the networks.  Sends a list of
    // GUIDs for networks whose properties have changed.
    static void onNetworksChanged(DOMString[] changes);

    // Fired when the list of networks has changed.  Sends a complete list of
    // GUIDs for all the current networks.
    static void onNetworkListChanged(DOMString[] changes);

    // Fired when the list of devices has changed or any device state properties
    // have changed.
    static void onDeviceStateListChanged();

    // Fired when a portal detection for a network completes. Sends the GUID of
    // the network and the corresponding captive portal status.
    static void onPortalDetectionCompleted(DOMString networkGuid,
                                           CaptivePortalStatus status);
  };
};
