summaryrefslogtreecommitdiffstats
path: root/dom/network/interfaces/nsIEthernetManager.idl
blob: 2b92dc88f0d87d169e62c537c83847d8a060ea02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

[scriptable, function, uuid(2a3ad56c-edc0-439f-8aae-900b331ddf49)]
interface nsIEthernetManagerCallback : nsISupports
{
  /**
   * Callback function used to report the success of different operations.
   *
   * @param success
   *        Boolean value indicates the success of an operation.
   * @prarm message
   *        Message reported in the end of operation.
   */
  void notify(in boolean success, in DOMString message);
};

[scriptable, function, uuid(1746e7dd-92d4-43fa-8ef4-bc13d0b60353)]
interface nsIEthernetManagerScanCallback : nsISupports
{
  /**
   * Callback function used to report the result of scan function.
   *
   * @param list
   *        List of available ethernet interfaces.
   */
  void notify(in jsval list);
};

/**
 * An internal idl provides control to ethernet interfaces.
 */
[scriptable, uuid(81750c87-bb3b-4724-b955-834eafa53fd1)]
interface nsIEthernetManager : nsISupports
{
  /**
   * List of exisiting interface name.
   */
  readonly attribute jsval interfaceList;

  /**
   * Scan available ethernet interfaces on device.
   *
   * @param callback
   *        Callback function.
   */
  void scan(in nsIEthernetManagerScanCallback callback);

  /**
   * Add a new interface to the interface list.
   *
   * @param ifname
   *        Interface name. Should be the form of "eth*".
   * @param callback
   *        Callback function.
   */
  void addInterface(in DOMString ifname,
                    in nsIEthernetManagerCallback callback);

  /**
   * Remove an existing interface from the interface list.
   *
   * @param ifname
   *        Interface name.
   * @param Callback
   *        Callback function.
   */
  void removeInterface(in DOMString ifname,
                       in nsIEthernetManagerCallback callback);

  /**
   * Update a conifg of an existing interface in the interface list.
   *
   * @param ifname
   *        Interface name.
   * @param config
   *        .ip: IP address.
   *        .prefixLength: Mask length.
   *        .gateway: Gateway.
   *        .dnses: DNS addresses.
   *        .httpProxyHost: HTTP proxy host.
   *        .httpProxyPort: HTTP proxy port.
   *        .ipMode: IP mode, can be 'dhcp' or 'static'.
   * @param callback
   *        Callback function.
   */
  void updateInterfaceConfig(in DOMString ifname,
                             in jsval config,
                             in nsIEthernetManagerCallback callback);

  /**
   * Enable networking of an existing interface in the interface list.
   *
   * @param ifname
   *        Interface name.
   * @param callback
   *        Callback function.
   */
  void enable(in DOMString ifname,
              in nsIEthernetManagerCallback callback);

  /**
   * Disable networking of an existing interface in the interface list.
   *
   * @param ifname
   *        Interface name.
   * @param callback
   *        Callback function.
   */
  void disable(in DOMString ifname,
               in nsIEthernetManagerCallback callback);

  /**
   * Make an existing interface connect to network.
   *
   * @param ifname
   *        Interface name.
   * @param callback
   *        Callback function.
   */
  void connect(in DOMString ifname,
               in nsIEthernetManagerCallback callback);

  /**
   * Disconnect a connected interface in the interface list.
   *
   * @param ifname
   *        Interface name.
   * @param callback
   *        Callback function.
   */
  void disconnect(in DOMString ifname,
                  in nsIEthernetManagerCallback callback);
};