1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is Mozilla.
15 *
16 * The Initial Developer of the Original Code is IBM Corporation.
17 * Portions created by IBM Corporation are Copyright (C) 2003
18 * IBM Corporation. All Rights Reserved.
19 *
20 * Contributor(s):
21 * IBM Corp.
22 *
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
34 *
35 * ***** END LICENSE BLOCK ***** */
36
37 #include "nsISupports.idl"
38
39
40 /**
41 * nsIHttpActivityObserver
42 *
43 * This interface provides a way for http activities to be reported
44 * to observers.
45 */
46 [scriptable, uuid(412880C8-6C36-48d8-BF8F-84F91F892503)]
47 interface nsIHttpActivityObserver : nsISupports
48 {
49 /**
50 * observe activity from the http transport
51 *
52 * @param aHttpChannel
53 * nsISupports interface for the the http channel that
54 * generated this activity
55 * @param aActivityType
56 * The value of this aActivityType will be one of
57 * ACTIVITY_TYPE_SOCKET_TRANSPORT or
58 * ACTIVITY_TYPE_HTTP_TRANSACTION
59 * @param aActivitySubtype
60 * The value of this aActivitySubtype, will be depend
61 * on the value of aActivityType. When aActivityType
62 * is ACTIVITY_TYPE_SOCKET_TRANSPORT
63 * aActivitySubtype will be one of the
64 * nsISocketTransport::STATUS_???? values defined in
65 * nsISocketTransport.idl
66 * OR when aActivityType
67 * is ACTIVITY_TYPE_HTTP_TRANSACTION
68 * aActivitySubtype will be one of the
69 * nsIHttpActivityObserver::ACTIVITY_SUBTYPE_???? values
70 * defined below
71 * @param aTimestamp
72 * microseconds past the epoch of Jan 1, 1970
73 * @param aExtraSizeData
74 * Any extra size data optionally available with
75 * this activity
76 * @param aExtraStringData
77 * Any extra string data optionally available with
78 * this activity
79 */
80 void observeActivity(in nsISupports aHttpChannel,
81 in PRUint32 aActivityType,
82 in PRUint32 aActivitySubtype,
83 in PRTime aTimestamp,
84 in PRUint64 aExtraSizeData,
85 in ACString aExtraStringData);
86
87 /**
88 * This attribute is true when this interface is active and should
89 * observe http activities. When false, observeActivity() should not
90 * be called.
91 */
92 readonly attribute boolean isActive;
93
94 const unsigned long ACTIVITY_TYPE_SOCKET_TRANSPORT = 0x0001;
95 const unsigned long ACTIVITY_TYPE_HTTP_TRANSACTION = 0x0002;
96
97 const unsigned long ACTIVITY_SUBTYPE_REQUEST_HEADER = 0x5001;
98 const unsigned long ACTIVITY_SUBTYPE_REQUEST_BODY_SENT = 0x5002;
99 const unsigned long ACTIVITY_SUBTYPE_RESPONSE_START = 0x5003;
100 const unsigned long ACTIVITY_SUBTYPE_RESPONSE_HEADER = 0x5004;
101 const unsigned long ACTIVITY_SUBTYPE_RESPONSE_COMPLETE = 0x5005;
102 const unsigned long ACTIVITY_SUBTYPE_TRANSACTION_CLOSE = 0x5006;
103
104 /**
105 * When aActivityType is ACTIVITY_TYPE_SOCKET_TRANSPORT
106 * and aActivitySubtype is STATUS_SENDING_TO
107 * aExtraSizeData will contain the count of bytes sent
108 * There may be more than one of these activities reported
109 * for a single http transaction, each aExtraSizeData
110 * represents only that portion of the total bytes sent
111 *
112 * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION
113 * and aActivitySubtype is ACTIVITY_SUBTYPE_REQUEST_HEADER
114 * aExtraStringData will contain the text of the header
115 *
116 * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION
117 * and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_HEADER
118 * aExtraStringData will contain the text of the header
119 *
120 * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION
121 * and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_COMPLETE
122 * aExtraSizeData will contain the count of total bytes received
123 */
124 };
125
126 %{C++
127
128 #define NS_HTTPACTIVITYOBSERVER_TOPIC \
129 "http-activity-observer"
130
131 #define NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID \
132 "@mozilla.org/netwerk/protocol/http/http-activity-distributor;1"
133
134 #define NS_HTTP_ACTIVITY_TYPE_SOCKET_TRANSPORT \
135 nsIHttpActivityObserver::ACTIVITY_TYPE_SOCKET_TRANSPORT
136 #define NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION \
137 nsIHttpActivityObserver::ACTIVITY_TYPE_HTTP_TRANSACTION
138
139 #define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_HEADER \
140 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_HEADER
141 #define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_BODY_SENT \
142 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_BODY_SENT
143 #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_START \
144 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_START
145 #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_HEADER \
146 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_HEADER
147 #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE \
148 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_COMPLETE
149 #define NS_HTTP_ACTIVITY_SUBTYPE_TRANSACTION_CLOSE \
150 nsIHttpActivityObserver::ACTIVITY_SUBTYPE_TRANSACTION_CLOSE
151
152 %}