/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIStreamObserver.idl
 */

#ifndef __gen_nsIStreamObserver_h__
#define __gen_nsIStreamObserver_h__

#include "nsISupports.h"

class nsIEventQueue; /* forward declaration */

class nsIChannel; /* forward declaration */


/* starting interface:    nsIStreamObserver */
#define NS_ISTREAMOBSERVER_IID_STR "fd91e2e0-1481-11d3-9333-00104ba0fd40"

#define NS_ISTREAMOBSERVER_IID \
  {0xfd91e2e0, 0x1481, 0x11d3, \
    { 0x93, 0x33, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }}

class NS_NO_VTABLE nsIStreamObserver : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTREAMOBSERVER_IID)

  /**
     * Called to signify the beginning of an asyncronous request.
     */
  /* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */
  NS_IMETHOD OnStartRequest(nsIChannel *channel, nsISupports *ctxt) = 0;

  /**
     * Called to signify the end of an asyncronous request.
     * @param notif - a notification object containing any error code and error parameters
     *                (may be null if the notification status is NS_OK)
     */
  /* void onStopRequest (in nsIChannel channel, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
  NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISTREAMOBSERVER \
  NS_IMETHOD OnStartRequest(nsIChannel *channel, nsISupports *ctxt); \
  NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISTREAMOBSERVER(_to) \
  NS_IMETHOD OnStartRequest(nsIChannel *channel, nsISupports *ctxt) { return _to ## OnStartRequest(channel, ctxt); } \
  NS_IMETHOD OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg) { return _to ## OnStopRequest(channel, ctxt, status, statusArg); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsStreamObserver : public nsIStreamObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSISTREAMOBSERVER

  nsStreamObserver();
  virtual ~nsStreamObserver();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsStreamObserver, nsIStreamObserver)

nsStreamObserver::nsStreamObserver()
{
  NS_INIT_ISUPPORTS();
  /* member initializers and constructor code */
}

nsStreamObserver::~nsStreamObserver()
{
  /* destructor code */
}

/* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */
NS_IMETHODIMP nsStreamObserver::OnStartRequest(nsIChannel *channel, nsISupports *ctxt)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onStopRequest (in nsIChannel channel, in nsISupports ctxt, in nsresult status, in wstring statusArg); */
NS_IMETHODIMP nsStreamObserver::OnStopRequest(nsIChannel *channel, nsISupports *ctxt, nsresult status, const PRUnichar *statusArg)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


/* starting interface:    nsIAsyncStreamObserver */
#define NS_IASYNCSTREAMOBSERVER_IID_STR "a28dc590-91b3-11d3-8cd9-0060b0fc14a3"

#define NS_IASYNCSTREAMOBSERVER_IID \
  {0xa28dc590, 0x91b3, 0x11d3, \
    { 0x8c, 0xd9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3 }}

/**
 * An asynchronous stream observer is used to ship data over to another thread specified
 * by the thread's event queue. The receiver stream observer is then used to receive
 * the notifications on the other thread. 
 *
 * This interface only provides the initialization needed after construction. Otherwise,
 * these objects are used simply as nsIStreamObservers.
 */
class NS_NO_VTABLE nsIAsyncStreamObserver : public nsIStreamObserver {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_IASYNCSTREAMOBSERVER_IID)

  /**
     * Initializes an nsIAsyncStreamObserver. 
     * @param eventQueue - may be null indicating the calling thread's event queue
     */
  /* void init (in nsIStreamObserver receiver, in nsIEventQueue eventQueue); */
  NS_IMETHOD Init(nsIStreamObserver *receiver, nsIEventQueue *eventQueue) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIASYNCSTREAMOBSERVER \
  NS_IMETHOD Init(nsIStreamObserver *receiver, nsIEventQueue *eventQueue); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIASYNCSTREAMOBSERVER(_to) \
  NS_IMETHOD Init(nsIStreamObserver *receiver, nsIEventQueue *eventQueue) { return _to ## Init(receiver, eventQueue); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsAsyncStreamObserver : public nsIAsyncStreamObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIASYNCSTREAMOBSERVER

  nsAsyncStreamObserver();
  virtual ~nsAsyncStreamObserver();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsAsyncStreamObserver, nsIAsyncStreamObserver)

nsAsyncStreamObserver::nsAsyncStreamObserver()
{
  NS_INIT_ISUPPORTS();
  /* member initializers and constructor code */
}

nsAsyncStreamObserver::~nsAsyncStreamObserver()
{
  /* destructor code */
}

/* void init (in nsIStreamObserver receiver, in nsIEventQueue eventQueue); */
NS_IMETHODIMP nsAsyncStreamObserver::Init(nsIStreamObserver *receiver, nsIEventQueue *eventQueue)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

// Use this CID to construct an nsIAsyncStreamObserver
#define NS_ASYNCSTREAMOBSERVER_CID                   \
{ /* fcc7c380-91b3-11d3-8cd9-0060b0fc14a3 */         \
    0xfcc7c380,                                      \
    0x91b3,                                          \
    0x11d3,                                          \
    {0x8c, 0xd9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
}
////////////////////////////////////////////////////////////////////////////////
// Generic status codes for OnStopRequest:
#define NS_BINDING_SUCCEEDED    NS_OK
#define NS_BINDING_FAILED       NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
#define NS_BINDING_ABORTED      NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)

#endif /* __gen_nsIStreamObserver_h__ */
