netwerk/protocol/http/nsIHttpActivityObserver.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/http/nsIHttpActivityObserver.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,127 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +/**
    1.11 + * nsIHttpActivityObserver
    1.12 + *
    1.13 + * This interface provides a way for http activities to be reported
    1.14 + * to observers.
    1.15 + */
    1.16 +[scriptable, uuid(412880C8-6C36-48d8-BF8F-84F91F892503)]
    1.17 +interface nsIHttpActivityObserver : nsISupports
    1.18 +{
    1.19 +    /**
    1.20 +     * observe activity from the http transport
    1.21 +     *
    1.22 +     * @param aHttpChannel
    1.23 +     *        nsISupports interface for the the http channel that
    1.24 +     *        generated this activity
    1.25 +     * @param aActivityType
    1.26 +     *        The value of this aActivityType will be one of
    1.27 +     *          ACTIVITY_TYPE_SOCKET_TRANSPORT or
    1.28 +     *          ACTIVITY_TYPE_HTTP_TRANSACTION
    1.29 +     * @param aActivitySubtype
    1.30 +     *        The value of this aActivitySubtype, will be depend
    1.31 +     *        on the value of aActivityType. When aActivityType
    1.32 +     *        is ACTIVITY_TYPE_SOCKET_TRANSPORT
    1.33 +     *          aActivitySubtype will be one of the
    1.34 +     *          nsISocketTransport::STATUS_???? values defined in
    1.35 +     *          nsISocketTransport.idl
    1.36 +     *        OR when aActivityType
    1.37 +     *        is ACTIVITY_TYPE_HTTP_TRANSACTION
    1.38 +     *          aActivitySubtype will be one of the
    1.39 +     *          nsIHttpActivityObserver::ACTIVITY_SUBTYPE_???? values
    1.40 +     *          defined below
    1.41 +     * @param aTimestamp
    1.42 +     *        microseconds past the epoch of Jan 1, 1970
    1.43 +     * @param aExtraSizeData
    1.44 +     *        Any extra size data optionally available with
    1.45 +     *        this activity
    1.46 +     * @param aExtraStringData
    1.47 +     *        Any extra string data optionally available with
    1.48 +     *        this activity
    1.49 +     */
    1.50 +    void observeActivity(in nsISupports  aHttpChannel,
    1.51 +                         in uint32_t     aActivityType,
    1.52 +                         in uint32_t     aActivitySubtype,
    1.53 +                         in PRTime       aTimestamp,
    1.54 +                         in uint64_t     aExtraSizeData,
    1.55 +                         in ACString     aExtraStringData);
    1.56 +
    1.57 +    /**
    1.58 +     * This attribute is true when this interface is active and should
    1.59 +     * observe http activities. When false, observeActivity() should not
    1.60 +     * be called. It is present for compatibility reasons and should be
    1.61 +     * implemented only by nsHttpActivityDistributor.
    1.62 +     */
    1.63 +    readonly attribute boolean isActive;
    1.64 +
    1.65 +    const unsigned long ACTIVITY_TYPE_SOCKET_TRANSPORT     = 0x0001;
    1.66 +    const unsigned long ACTIVITY_TYPE_HTTP_TRANSACTION     = 0x0002;
    1.67 +
    1.68 +    const unsigned long ACTIVITY_SUBTYPE_REQUEST_HEADER    = 0x5001;
    1.69 +    const unsigned long ACTIVITY_SUBTYPE_REQUEST_BODY_SENT = 0x5002;
    1.70 +    const unsigned long ACTIVITY_SUBTYPE_RESPONSE_START    = 0x5003;
    1.71 +    const unsigned long ACTIVITY_SUBTYPE_RESPONSE_HEADER   = 0x5004;
    1.72 +    const unsigned long ACTIVITY_SUBTYPE_RESPONSE_COMPLETE = 0x5005;
    1.73 +    const unsigned long ACTIVITY_SUBTYPE_TRANSACTION_CLOSE = 0x5006;
    1.74 +
    1.75 +    /**
    1.76 +     *  When aActivityType is ACTIVITY_TYPE_SOCKET_TRANSPORT
    1.77 +     *  and aActivitySubtype is STATUS_SENDING_TO
    1.78 +     *  aExtraSizeData will contain the count of bytes sent
    1.79 +     *  There may be more than one of these activities reported
    1.80 +     *  for a single http transaction, each aExtraSizeData
    1.81 +     *  represents only that portion of the total bytes sent
    1.82 +     *
    1.83 +     *  When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION
    1.84 +     *  and aActivitySubtype is ACTIVITY_SUBTYPE_REQUEST_HEADER
    1.85 +     *  aExtraStringData will contain the text of the header
    1.86 +     *
    1.87 +     *  When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION
    1.88 +     *  and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_HEADER
    1.89 +     *  aExtraStringData will contain the text of the header
    1.90 +     *
    1.91 +     *  When aActivityType is ACTIVITY_TYPE_HTTP_TRANSACTION
    1.92 +     *  and aActivitySubtype is ACTIVITY_SUBTYPE_RESPONSE_COMPLETE
    1.93 +     *  aExtraSizeData will contain the count of total bytes received
    1.94 +     */
    1.95 +};
    1.96 +
    1.97 +%{C++
    1.98 +
    1.99 +#define NS_HTTP_ACTIVITY_TYPE_SOCKET_TRANSPORT    \
   1.100 +            nsIHttpActivityObserver::ACTIVITY_TYPE_SOCKET_TRANSPORT
   1.101 +#define NS_HTTP_ACTIVITY_TYPE_HTTP_TRANSACTION    \
   1.102 +            nsIHttpActivityObserver::ACTIVITY_TYPE_HTTP_TRANSACTION
   1.103 +
   1.104 +#define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_HEADER    \
   1.105 +            nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_HEADER
   1.106 +#define NS_HTTP_ACTIVITY_SUBTYPE_REQUEST_BODY_SENT \
   1.107 +            nsIHttpActivityObserver::ACTIVITY_SUBTYPE_REQUEST_BODY_SENT
   1.108 +#define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_START    \
   1.109 +            nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_START
   1.110 +#define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_HEADER   \
   1.111 +            nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_HEADER
   1.112 +#define NS_HTTP_ACTIVITY_SUBTYPE_RESPONSE_COMPLETE \
   1.113 +            nsIHttpActivityObserver::ACTIVITY_SUBTYPE_RESPONSE_COMPLETE
   1.114 +#define NS_HTTP_ACTIVITY_SUBTYPE_TRANSACTION_CLOSE \
   1.115 +            nsIHttpActivityObserver::ACTIVITY_SUBTYPE_TRANSACTION_CLOSE
   1.116 +
   1.117 +%}
   1.118 +
   1.119 +/**
   1.120 + * nsIHttpActivityDistributor
   1.121 + *
   1.122 + * This interface provides a way to register and unregister observers to the
   1.123 + * http activities.
   1.124 + */
   1.125 +[scriptable, uuid(7C512CB8-582A-4625-B5B6-8639755271B5)]
   1.126 +interface nsIHttpActivityDistributor : nsIHttpActivityObserver
   1.127 +{
   1.128 +    void addObserver(in nsIHttpActivityObserver aObserver);
   1.129 +    void removeObserver(in nsIHttpActivityObserver aObserver);
   1.130 +};

mercurial