1 <h2 id=
"usage">Usage
</h2>
3 Typical usage of vpnProvider is as follows:
6 <li>Create VPN configurations using the $(ref:createConfig) method. A VPN
7 configuration is a persistent entry shown to the user in a native Chrome OS
8 UI. The user can select a VPN configuration from a list and connect to it or
9 disconnect from it.
</li>
10 <li>Add listeners to the events $(ref:onPlatformMessage),
11 $(ref:onPacketReceived) and $(ref:onConfigRemoved).
</li>
12 <li>When the user connects to the VPN configuration, $(ref:onPlatformMessage)
13 will be received with the message
<code>"connected"</code>. We refer to the
14 period between the messages
<code>"connected"</code> and
15 <code>"disconnected"</code> as a VPN session. In this time period, the
16 extension that receives the message is said to own the VPN session.
</li>
17 <li>Initiate connection to the VPN server and start the VPN client.
</li>
18 <li>Set the Parameters of the connection using $(ref:setParameters).
</li>
19 <li>Notify the connection state as
<code>"connected"</code> using
20 $(ref:notifyConnectionStateChanged).
</li>
21 <li>When the steps above are completed without errors, a virtual tunnel is
22 created to the network stack of Chrome OS. IP packets can be sent through
23 the tunnel using $(ref:sendPacket) and any packets originating on the Chrome
24 OS device will be received using the event $(ref:onPacketReceived).
</li>
25 <li>When the user disconnects from the VPN configuration,
26 $(ref:onPlatformMessage) will be fired with the message
27 <code>"disconnected"</code>.
</li>
28 <li>If the VPN configuration is no longer necessary, it can be destroyed using
29 $(ref:destroyConfig).
</li>