summaryrefslogtreecommitdiffstats
path: root/netwerk/base/nsINetworkLinkService.idl
blob: 29c7fab8361bc373456f8f9e7de3484c2d50375d (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:expandtab:shiftwidth=4:tabstop=4:
 */
/* 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"
interface nsINetAddr;

%{ C++
#include "nsTArrayForwardDeclare.h"
namespace mozilla {
namespace net {
union NetAddr;
}
}
%}
native NetAddr(mozilla::net::NetAddr);

/**
 * Network link status monitoring service.
 */
[scriptable, uuid(103e5293-77b3-4b70-af59-6e9e4a1f994a)]
interface nsINetworkLinkService : nsISupports
{
  /* Link type constants */
  const unsigned long LINK_TYPE_UNKNOWN = 0;
  const unsigned long LINK_TYPE_ETHERNET = 1;
  const unsigned long LINK_TYPE_USB = 2;
  const unsigned long LINK_TYPE_WIFI = 3;
  const unsigned long LINK_TYPE_WIMAX = 4;
  const unsigned long LINK_TYPE_MOBILE = 9;

  /**
   * This is set to true when the system is believed to have a usable
   * network connection.
   *
   * The link is only up when network connections can be established. For
   * example, the link is down during DHCP configuration (unless there
   * is another usable interface already configured).
   *
   * If the link status is not currently known, we generally assume that
   * it is up.
   */
  readonly attribute boolean isLinkUp;

  /**
   * This is set to true when we believe that isLinkUp is accurate.
   */
  readonly attribute boolean linkStatusKnown;

  /**
   * The type of network connection.
   */
  readonly attribute unsigned long linkType;

  /**
   * A string uniquely identifying the current active network interfaces.
   * Empty when there are no active network interfaces.
   */
  readonly attribute ACString networkID;

  /**
   * The list of DNS suffixes for the currently active network interfaces.
   */
  readonly attribute Array<ACString> dnsSuffixList;

  /**
   * The IPs of the DNS resolvers currently used by the platform.
   */
  [noscript] readonly attribute Array<NetAddr> nativeResolvers;

  /**
   * Same as previous - returns the IPs of DNS resolvers but this time as
   * XPCOM objects usable by extensions.
   */
  readonly attribute Array<nsINetAddr> resolvers;

  const unsigned long NONE_DETECTED = 0;
  const unsigned long VPN_DETECTED = 1 << 0;
  const unsigned long PROXY_DETECTED = 1 << 1;
  const unsigned long NRPT_DETECTED = 1 << 2;

  /**
   * A bitfield that encodes the platform attributes we detected which
   * indicate that we should only use DNS, not TRR.
   */
  readonly attribute unsigned long platformDNSIndications;
};

%{C++
/**
 * We send notifications through nsIObserverService with topic
 * NS_NETWORK_LINK_TOPIC whenever one of isLinkUp or linkStatusKnown
 * changes. We pass one of the NS_NETWORK_LINK_DATA_ constants below
 * as the aData parameter of the notification.
 */
#define NS_NETWORK_LINK_TOPIC "network:link-status-changed"

/**
 * isLinkUp is now true, linkStatusKnown is true.
 */
#define NS_NETWORK_LINK_DATA_UP      "up"
/**
 * isLinkUp is now false, linkStatusKnown is true.
 */
#define NS_NETWORK_LINK_DATA_DOWN    "down"
/**
 * isLinkUp is still true, but the network setup is modified.
 * linkStatusKnown is true.
 */
#define NS_NETWORK_LINK_DATA_CHANGED "changed"
/**
 * linkStatusKnown is now false.
 */
#define NS_NETWORK_LINK_DATA_UNKNOWN "unknown"

/**
 * network ID has changed.
 */
#define NS_NETWORK_ID_CHANGED_TOPIC "network:networkid-changed"

/**
 * DNS suffix list has updated.
 */
#define NS_DNS_SUFFIX_LIST_UPDATED_TOPIC "network:dns-suffix-list-updated"

/**
 * We send notifications through nsIObserverService with topic
 * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type
 * changes. We pass one of the valid connection type constants
 * below as the aData parameter of the notification.
 */
#define NS_NETWORK_LINK_TYPE_TOPIC "network:link-type-changed"

/** We were unable to determine the network connection type */
#define NS_NETWORK_LINK_TYPE_UNKNOWN  "unknown"

/** A standard wired ethernet connection */
#define NS_NETWORK_LINK_TYPE_ETHERNET    "ethernet"

/** A connection via a USB port */
#define NS_NETWORK_LINK_TYPE_USB    "usb"

/** A connection via a WiFi access point (IEEE802.11) */
#define NS_NETWORK_LINK_TYPE_WIFI "wifi"

/** A connection via WiMax (IEEE802.16) */
#define NS_NETWORK_LINK_TYPE_WIMAX "wimax"

/** A mobile connection (e.g. 2G, 3G, etc) */
#define NS_NETWORK_LINK_TYPE_MOBILE "mobile"
%}