1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include "nsISupports.idl"
6
7/* A JavaScript callback function that takes a JSON as its parameter.
8 * The returned JSON contains arrays with data
9 */
10[scriptable, function, uuid(19d7f24f-a95a-4fd9-87e2-d96e9e4b1f6d)]
11interface nsINetDashboardCallback : nsISupports
12{
13    void onDashboardDataAvailable(in jsval data);
14};
15
16/* The dashboard service.
17 * The async API returns JSONs, which hold arrays with the required info.
18 * Only one request of each type may be pending at any time.
19 */
20[scriptable, uuid(c79eb3c6-091a-45a6-8544-5a8d1ab79537)]
21interface nsIDashboard : nsISupports
22{
23    /* Arrays: host, port, tcp, active, socksent, sockreceived
24     * Values: sent, received  */
25    void requestSockets(in nsINetDashboardCallback cb);
26
27    /* Arrays: host, port, spdy, ssl
28     * Array of arrays: active, idle */
29    void requestHttpConnections(in nsINetDashboardCallback cb);
30
31    /* Arrays: hostport, encrypted, msgsent, msgreceived, sentsize, receivedsize */
32    void requestWebsocketConnections(in nsINetDashboardCallback cb);
33
34    /* Arrays: hostname, family, hostaddr, expiration */
35    void requestDNSInfo(in nsINetDashboardCallback cb);
36
37    /* aProtocol: a transport layer protocol:
38     *      ex: "ssl", "tcp", default is "tcp".
39     * aHost: the host's name
40     * aPort: the port which the connection will open on
41     * aTimeout: the timespan before the connection will be timed out */
42    void requestConnection(in ACString aHost, in unsigned long aPort,
43                           in string aProtocol, in unsigned long aTimeout,
44                           in nsINetDashboardCallback cb);
45
46    /* When true, the service will log websocket events */
47    attribute boolean enableLogging;
48
49    /* DNS resolver for host name
50     * aHost: host name */
51    void requestDNSLookup(in ACString aHost, in nsINetDashboardCallback cb);
52
53    /* Resolve HTTPS RRs for host name
54     * aHost: host name */
55    void requestDNSHTTPSRRLookup(in ACString aHost,
56                                 in nsINetDashboardCallback cb);
57
58    /**
59     * Asyncly returns stats regarding the "Race Cache With Network" feature.
60     */
61    void requestRcwnStats(in nsINetDashboardCallback cb);
62
63    AUTF8String getLogPath();
64};
65