summaryrefslogtreecommitdiffstats
path: root/dom/system/gonk/nsINetworkInterface.idl
blob: bd40e751a179065f6987e10a84d75570b5cef5c4 (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
/* 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, uuid(4816a559-5620-4cb5-8433-ff0b25e6622f)]
interface nsINetworkInfo : nsISupports
{
  const long NETWORK_STATE_UNKNOWN       = -1;
  const long NETWORK_STATE_CONNECTING    = 0;
  const long NETWORK_STATE_CONNECTED     = 1;
  const long NETWORK_STATE_DISCONNECTING = 2;
  const long NETWORK_STATE_DISCONNECTED  = 3;
  const long NETWORK_STATE_ENABLED = 4;
  const long NETWORK_STATE_DISABLED = 5;

  /**
   * Current network state, one of the NETWORK_STATE_* constants.
   *
   * When this changes, network interface implementations notify with
   * updateNetworkInterface() API.
   */
  readonly attribute long state;

  const long NETWORK_TYPE_UNKNOWN     = -1;
  const long NETWORK_TYPE_WIFI        = 0;
  const long NETWORK_TYPE_MOBILE      = 1;
  const long NETWORK_TYPE_MOBILE_MMS  = 2;
  const long NETWORK_TYPE_MOBILE_SUPL = 3;
  const long NETWORK_TYPE_WIFI_P2P    = 4;
  const long NETWORK_TYPE_MOBILE_IMS  = 5;
  const long NETWORK_TYPE_MOBILE_DUN  = 6;
  const long NETWORK_TYPE_MOBILE_FOTA = 7;
  const long NETWORK_TYPE_ETHERNET    = 8;

  /**
   * Network type. One of the NETWORK_TYPE_* constants.
   */
  readonly attribute long type;

  /**
   * Interface name of the network interface this network info belongs to.
   */
  readonly attribute DOMString name;

  /**
   * Get the list of ip addresses and prefix lengths, ip address could be IPv4
   * or IPv6, typically 1 IPv4 or 1 IPv6 or one of each.
   *
   * @param ips
   *        The list of ip addresses retrieved.
   * @param prefixLengths
   *        The list of prefix lengths retrieved.
   *
   * @returns the length of the lists.
   */
  void getAddresses([array, size_is(count)] out wstring ips,
                    [array, size_is(count)] out unsigned long prefixLengths,
                    [retval] out unsigned long count);

  /**
   * Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1
   * IPv6 or one of each.
   *
   * @param count
   *        The length of the list of gateways
   *
   * @returns the list of gateways.
   */
  void getGateways([optional] out unsigned long count,
                   [array, size_is(count), retval] out wstring gateways);

  /**
   * Get the list of dnses, could be IPv4 or IPv6.
   *
   * @param count
   *        The length of the list of dnses.
   *
   * @returns the list of dnses.
   */
  void getDnses([optional] out unsigned long count,
                [array, size_is(count), retval] out wstring dnses);
};

[scriptable, uuid(8b1345fa-b34c-41b3-8d21-09f961bf8887)]
interface nsINetworkInterface : nsISupports
{
  /**
   * The network information about this network interface.
   */
  readonly attribute nsINetworkInfo info;

  /**
   * The host name of the http proxy server.
   */
  readonly attribute DOMString httpProxyHost;

  /*
   * The port number of the http proxy server.
   */
  readonly attribute long httpProxyPort;

  /*
   * The Maximun Transmit Unit for this network interface, -1 if not set.
   */
  readonly attribute long mtu;
};