Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
not at google - send to devlin
2014/10/30 17:46:47
I saw a lot of "I will add this later..." response
kaliamoorthi
2014/10/31 10:04:55
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Use the <code>chrome.vpnProvider</code> API to implement a VPN | |
| 6 // client. | |
| 7 [inline_doc] namespace vpnProvider { | |
|
not at google - send to devlin
2014/10/30 17:46:47
You don't need inline_doc either.
kaliamoorthi
2014/10/31 10:04:55
Done.
| |
| 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. | |
| 12 DOMString address; | |
| 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) | |
| 17 DOMString? mtu; | |
| 18 // Bypass network traffic to the below IPs (in CIDR notation) | |
| 19 // from the tunnel. Typically used to bypass traffic to/from | |
| 20 // VPN server. | |
| 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 | |
| 25 // setting). | |
| 26 DOMString[]? dnsServers; | |
| 27 }; | |
| 28 | |
| 29 // The enum is used by the platform to notify the client of | |
| 30 // connection and network related status. | |
| 31 enum PlatformMessage { | |
| 32 connected, | |
| 33 disconnected, | |
| 34 underlyingNetworkDisconnected, | |
| 35 error | |
| 36 }; | |
| 37 | |
| 38 // The enum is used by the VPN client to inform the platform | |
| 39 // of its current state. This helps provide meaningful messages | |
| 40 // to the user. The states listed below are currently known to | |
| 41 // the platform (Shill daemon). | |
| 42 enum VpnConnectionState { | |
| 43 connected, | |
| 44 portal, | |
| 45 online, | |
| 46 failure | |
| 47 }; | |
| 48 | |
| 49 // The callback is used by <code>setParameters, sendPacket</code> | |
| 50 // to signal completion. The callback is called with | |
| 51 // <code>chrome.runtime.lastError</code> set to error code if | |
| 52 // there is an error. | |
| 53 [inline_doc] callback CallCompleteCallback = void (); | |
| 54 | |
| 55 // The callback is used by createConfig to signal completion. | |
| 56 callback ConfigCreatedCallback = void (long handle); | |
| 57 | |
| 58 interface Functions { | |
| 59 // Creates a new VPN configuration. | |
| 60 static void createConfig(DOMString name, | |
| 61 ConfigCreatedCallback callback); | |
| 62 | |
| 63 // Destroys a VPN configuration created by the extension. | |
| 64 static void destroyConfig(long handle); | |
| 65 | |
| 66 // Sets the parameters for a VPN configuration. This should be | |
| 67 // called after connected is received from the platform. | |
| 68 static void setParameters(long handle, Parameters parameters, | |
| 69 CallCompleteCallback callback); | |
| 70 | |
| 71 // Injects an IP packet into the network stack of Chrome OS. | |
| 72 static void sendPacket(long handle, ArrayBuffer data, | |
| 73 optional CallCompleteCallback callback); | |
| 74 | |
| 75 // Notifies the VPN connection state to Chrome OS. | |
| 76 static void notifyConnectionStateChanged(long handle, | |
| 77 VpnConnectionState state); | |
| 78 }; | |
| 79 | |
| 80 interface Events { | |
| 81 // Called when a message is received from the platform for a | |
| 82 // VPN configuration owned by the extension. | |
| 83 static void onPlatformMessage(long handle, | |
| 84 PlatformMessage message); | |
| 85 | |
| 86 // Called when an IP packet is received from the platform for a | |
| 87 // VPN configuration owned by the extension. | |
| 88 static void onPacketReceived(long handle, ArrayBuffer data); | |
| 89 }; | |
| 90 }; | |
| OLD | NEW |