1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Use the <code>chrome.vpnProvider</code> API to implement a VPN
7 namespace vpnProvider {
8 // A parameters class for the vpn interface
9 dictionary Parameters {
10 // IP address for the VPN interface in CIDR notation.
11 // IPv4 is currently the only supported mode.
13 // Broadcast address for the VPN interface. (default: Deduced
14 // from IP address and mask).
15 DOMString? broadcastAddress;
16 // MTU for the VPN interface. (default: 1500)
18 // Bypass network traffic to the below IPs (in CIDR notation)
19 // from the tunnel. Typically used to bypass traffic to/from
21 DOMString[] bypassTunnelForIp;
22 // A list of search domains (default: system setting).
23 DOMString[]? domainSearch;
24 // A list of DNS servers in CIDR notation (default: system
26 DOMString[]? dnsServers;
29 // The enum is used by the platform to notify the client of
30 // connection and network related status.
31 // TODO(kaliamoorthi) : Document the messages
32 enum PlatformMessage {
35 underlyingNetworkDisconnected,
39 // The enum is used by the VPN client to inform the platform
40 // of its current state. This helps provide meaningful messages
41 // to the user. The states listed below are currently known to
42 // the platform (Shill daemon).
43 // TODO(kaliamoorthi) : Document all states
44 // TODO(kaliamoorthi) : Make failure more informative by expanding the failure
46 enum VpnConnectionState {
53 // The callback is used by <code>setParameters, sendPacket</code>
54 // to signal completion. The callback is called with
55 // <code>chrome.runtime.lastError</code> set to error code if
57 [inline_doc] callback CallCompleteCallback = void ();
59 // The callback is used by createConfig to signal completion.
60 callback ConfigCreatedCallback = void (long handle);
63 // Creates a new VPN configuration.
64 static void createConfig(DOMString name,
65 ConfigCreatedCallback callback);
67 // Destroys a VPN configuration created by the extension.
68 static void destroyConfig(long handle,
69 optional CallCompleteCallback callback);
71 // Sets the parameters for a VPN configuration. This should be
72 // called after connected is received from the platform.
73 static void setParameters(long handle, Parameters parameters,
74 CallCompleteCallback callback);
76 // Injects an IP packet into the network stack of Chrome OS.
77 static void sendPacket(long handle, ArrayBuffer data,
78 optional CallCompleteCallback callback);
80 // Notifies the VPN connection state to Chrome OS.
81 static void notifyConnectionStateChanged(
82 long handle, VpnConnectionState state,
83 optional CallCompleteCallback callback);
87 // Called when a message is received from the platform for a
88 // VPN configuration owned by the extension.
89 static void onPlatformMessage(long handle,
90 PlatformMessage message);
92 // Called when an IP packet is received from the platform for a
93 // VPN configuration owned by the extension.
94 static void onPacketReceived(long handle, ArrayBuffer data);