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