michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * nsIHttpActivityObserver michael@0: * michael@0: * This interface provides a way for http activities to be reported michael@0: * to observers. michael@0: */ michael@0: [scriptable, uuid(412880C8-6C36-48d8-BF8F-84F91F892503)] michael@0: interface nsIHttpActivityObserver : nsISupports michael@0: { michael@0: /** michael@0: * observe activity from the http transport michael@0: * michael@0: * @param aHttpChannel michael@0: * nsISupports interface for the the http channel that michael@0: * generated this activity michael@0: * @param aActivityType michael@0: * The value of this aActivityType will be one of michael@0: * ACTIVITY_TYPE_SOCKET_TRANSPORT or michael@0: * ACTIVITY_TYPE_HTTP_TRANSACTION michael@0: * @param aActivitySubtype michael@0: * The value of this aActivitySubtype, will be depend michael@0: * on the value of aActivityType. When aActivityType michael@0: * is ACTIVITY_TYPE_SOCKET_TRANSPORT michael@0: * aActivitySubtype will be one of the michael@0: * nsISocketTransport::STATUS_???? values defined in michael@0: * nsISocketTransport.idl michael@0: * OR when aActivityType michael@0: * is ACTIVITY_TYPE_HTTP_TRANSACTION michael@0: * aActivitySubtype will be one of the michael@0: * nsIHttpActivityObserver::ACTIVITY_SUBTYPE_???? values michael@0: * defined below michael@0: * @param aTimestamp michael@0: * microseconds past the epoch of Jan 1, 1970 michael@0: * @param aExtraSizeData michael@0: * Any extra size data optionally available with michael@0: * this activity michael@0: * @param aExtraStringData michael@0: * Any extra string data optionally available with michael@0: * this activity michael@0: */ michael@0: void observeActivity(in nsISupports aHttpChannel, michael@0: in uint32_t aActivityType, michael@0: in uint32_t aActivitySubtype, michael@0: in PRTime aTimestamp, michael@0: in uint64_t aExtraSizeData, michael@0: in ACString aExtraStringData); michael@0: michael@0: /** michael@0: * This attribute is true when this interface is active and should michael@0: * observe http activities. When false, observeActivity() should not michael@0: * be called. It is present for compatibility reasons and should be michael@0: * implemented only by nsHttpActivityDistributor. michael@0: */ michael@0: readonly attribute boolean isActive; michael@0: michael@0: const unsigned long ACTIVITY_TYPE_SOCKET_TRANSPORT = 0x0001; michael@0: const unsigned long ACTIVITY_TYPE_HTTP_TRANSACTION = 0x0002; michael@0: michael@0: const unsigned long ACTIVITY_SUBTYPE_REQUEST_HEADER = 0x5001; michael@0: const unsigned long ACTIVITY_SUBTYPE_REQUEST_BODY_SENT = 0x5002; michael@0: const unsigned long ACTIVITY_SUBTYPE_RESPONSE_START = 0x5003; michael@0: const unsigned long ACTIVITY_SUBTYPE_RESPONSE_HEADER = 0x5004; michael@0: const unsigned long ACTIVITY_SUBTYPE_RESPONSE_COMPLETE = 0x5005; michael@0: const unsigned long ACTIVITY_SUBTYPE_TRANSACTION_CLOSE = 0x5006; michael@0: michael@0: /** michael@0: * When aActivityType is ACTIVITY_TYPE_SOCKET_TRANSPORT michael@0: * and aActivitySubtype is STATUS_SENDING_TO michael@0: * aExtraSizeData will contain the count of bytes sent michael@0: * There may be more than one of these activities reported michael@0: * for a single http transaction, each aExtraSizeData michael@0: * represents only that portion of the total bytes sent michael@0: * michael@0: * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION michael@0: * and aActivitySubtype is ACTIVITY_SUBTYPE_REQUEST_HEADER michael@0: * aExtraStringData will contain the text of the header michael@0: * michael@0: * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION michael@0: * and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_HEADER michael@0: * aExtraStringData will contain the text of the header michael@0: * michael@0: * When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION michael@0: * and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_COMPLETE michael@0: * aExtraSizeData will contain the count of total bytes received michael@0: */ michael@0: }; michael@0: michael@0: %{C++ michael@0: michael@0: #define NS_HTTP_ACTIVITY_TYPE_SOCKET_TRANSPORT \ michael@0: nsIHttpActivityObserver::ACTIVITY_TYPE_SOCKET_TRANSPORT michael@0: #define NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION \ michael@0: nsIHttpActivityObserver::ACTIVITY_TYPE_HTTP_TRANSACTION michael@0: michael@0: #define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_HEADER \ michael@0: nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_HEADER michael@0: #define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_BODY_SENT \ michael@0: nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_BODY_SENT michael@0: #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_START \ michael@0: nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_START michael@0: #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_HEADER \ michael@0: nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_HEADER michael@0: #define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE \ michael@0: nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_COMPLETE michael@0: #define NS_HTTP_ACTIVITY_SUBTYPE_TRANSACTION_CLOSE \ michael@0: nsIHttpActivityObserver::ACTIVITY_SUBTYPE_TRANSACTION_CLOSE michael@0: michael@0: %} michael@0: michael@0: /** michael@0: * nsIHttpActivityDistributor michael@0: * michael@0: * This interface provides a way to register and unregister observers to the michael@0: * http activities. michael@0: */ michael@0: [scriptable, uuid(7C512CB8-582A-4625-B5B6-8639755271B5)] michael@0: interface nsIHttpActivityDistributor : nsIHttpActivityObserver michael@0: { michael@0: void addObserver(in nsIHttpActivityObserver aObserver); michael@0: void removeObserver(in nsIHttpActivityObserver aObserver); michael@0: };