|
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 /** |
|
8 * nsIHttpActivityObserver |
|
9 * |
|
10 * This interface provides a way for http activities to be reported |
|
11 * to observers. |
|
12 */ |
|
13 [scriptable, uuid(412880C8-6C36-48d8-BF8F-84F91F892503)] |
|
14 interface nsIHttpActivityObserver : nsISupports |
|
15 { |
|
16 /** |
|
17 * observe activity from the http transport |
|
18 * |
|
19 * @param aHttpChannel |
|
20 * nsISupports interface for the the http channel that |
|
21 * generated this activity |
|
22 * @param aActivityType |
|
23 * The value of this aActivityType will be one of |
|
24 * ACTIVITY_TYPE_SOCKET_TRANSPORT or |
|
25 * ACTIVITY_TYPE_HTTP_TRANSACTION |
|
26 * @param aActivitySubtype |
|
27 * The value of this aActivitySubtype, will be depend |
|
28 * on the value of aActivityType. When aActivityType |
|
29 * is ACTIVITY_TYPE_SOCKET_TRANSPORT |
|
30 * aActivitySubtype will be one of the |
|
31 * nsISocketTransport::STATUS_???? values defined in |
|
32 * nsISocketTransport.idl |
|
33 * OR when aActivityType |
|
34 * is ACTIVITY_TYPE_HTTP_TRANSACTION |
|
35 * aActivitySubtype will be one of the |
|
36 * nsIHttpActivityObserver::ACTIVITY_SUBTYPE_???? values |
|
37 * defined below |
|
38 * @param aTimestamp |
|
39 * microseconds past the epoch of Jan 1, 1970 |
|
40 * @param aExtraSizeData |
|
41 * Any extra size data optionally available with |
|
42 * this activity |
|
43 * @param aExtraStringData |
|
44 * Any extra string data optionally available with |
|
45 * this activity |
|
46 */ |
|
47 void observeActivity(in nsISupports aHttpChannel, |
|
48 in uint32_t aActivityType, |
|
49 in uint32_t aActivitySubtype, |
|
50 in PRTime aTimestamp, |
|
51 in uint64_t aExtraSizeData, |
|
52 in ACString aExtraStringData); |
|
53 |
|
54 /** |
|
55 * This attribute is true when this interface is active and should |
|
56 * observe http activities. When false, observeActivity() should not |
|
57 * be called. It is present for compatibility reasons and should be |
|
58 * implemented only by nsHttpActivityDistributor. |
|
59 */ |
|
60 readonly attribute boolean isActive; |
|
61 |
|
62 const unsigned long ACTIVITY_TYPE_SOCKET_TRANSPORT = 0x0001; |
|
63 const unsigned long ACTIVITY_TYPE_HTTP_TRANSACTION = 0x0002; |
|
64 |
|
65 const unsigned long ACTIVITY_SUBTYPE_REQUEST_HEADER = 0x5001; |
|
66 const unsigned long ACTIVITY_SUBTYPE_REQUEST_BODY_SENT = 0x5002; |
|
67 const unsigned long ACTIVITY_SUBTYPE_RESPONSE_START = 0x5003; |
|
68 const unsigned long ACTIVITY_SUBTYPE_RESPONSE_HEADER = 0x5004; |
|
69 const unsigned long ACTIVITY_SUBTYPE_RESPONSE_COMPLETE = 0x5005; |
|
70 const unsigned long ACTIVITY_SUBTYPE_TRANSACTION_CLOSE = 0x5006; |
|
71 |
|
72 /** |
|
73 * When aActivityType is ACTIVITY_TYPE_SOCKET_TRANSPORT |
|
74 * and aActivitySubtype is STATUS_SENDING_TO |
|
75 * aExtraSizeData will contain the count of bytes sent |
|
76 * There may be more than one of these activities reported |
|
77 * for a single http transaction, each aExtraSizeData |
|
78 * represents only that portion of the total bytes sent |
|
79 * |
|
80 * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION |
|
81 * and aActivitySubtype is ACTIVITY_SUBTYPE_REQUEST_HEADER |
|
82 * aExtraStringData will contain the text of the header |
|
83 * |
|
84 * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION |
|
85 * and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_HEADER |
|
86 * aExtraStringData will contain the text of the header |
|
87 * |
|
88 * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION |
|
89 * and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_COMPLETE |
|
90 * aExtraSizeData will contain the count of total bytes received |
|
91 */ |
|
92 }; |
|
93 |
|
94 %{C++ |
|
95 |
|
96 #define NS_HTTP_ACTIVITY_TYPE_SOCKET_TRANSPORT \ |
|
97 nsIHttpActivityObserver::ACTIVITY_TYPE_SOCKET_TRANSPORT |
|
98 #define NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION \ |
|
99 nsIHttpActivityObserver::ACTIVITY_TYPE_HTTP_TRANSACTION |
|
100 |
|
101 #define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_HEADER \ |
|
102 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_HEADER |
|
103 #define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_BODY_SENT \ |
|
104 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_BODY_SENT |
|
105 #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_START \ |
|
106 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_START |
|
107 #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_HEADER \ |
|
108 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_HEADER |
|
109 #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE \ |
|
110 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_COMPLETE |
|
111 #define NS_HTTP_ACTIVITY_SUBTYPE_TRANSACTION_CLOSE \ |
|
112 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_TRANSACTION_CLOSE |
|
113 |
|
114 %} |
|
115 |
|
116 /** |
|
117 * nsIHttpActivityDistributor |
|
118 * |
|
119 * This interface provides a way to register and unregister observers to the |
|
120 * http activities. |
|
121 */ |
|
122 [scriptable, uuid(7C512CB8-582A-4625-B5B6-8639755271B5)] |
|
123 interface nsIHttpActivityDistributor : nsIHttpActivityObserver |
|
124 { |
|
125 void addObserver(in nsIHttpActivityObserver aObserver); |
|
126 void removeObserver(in nsIHttpActivityObserver aObserver); |
|
127 }; |