/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM e:/builds/moz2_slave/m-aurora-w32-xr/build/netwerk/protocol/websocket/nsIWebSocketListener.idl
 */

#ifndef __gen_nsIWebSocketListener_h__
#define __gen_nsIWebSocketListener_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif

/* starting interface:    nsIWebSocketListener */
#define NS_IWEBSOCKETLISTENER_IID_STR "b0c27050-31e9-42e5-bc59-499d54b52f99"

#define NS_IWEBSOCKETLISTENER_IID \
  {0xb0c27050, 0x31e9, 0x42e5, \
    { 0xbc, 0x59, 0x49, 0x9d, 0x54, 0xb5, 0x2f, 0x99 }}

/**
 * nsIWebSocketListener: passed to nsIWebSocketChannel::AsyncOpen. Receives
 * websocket traffic events as they arrive.
 */
class NS_NO_VTABLE NS_SCRIPTABLE nsIWebSocketListener : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWEBSOCKETLISTENER_IID)

  /**
     * Called to signify the establishment of the message stream.
     * Any listener that receives onStart will also receive OnStop.
     *
     * @param aContext user defined context
     */
  /* void onStart (in nsISupports aContext); */
  NS_SCRIPTABLE NS_IMETHOD OnStart(nsISupports *aContext) = 0;

  /**
     * Called to signify the completion of the message stream.
     * OnStop is the final notification the listener will receive and it
     * completes the WebSocket connection. This event can be received in error
     * cases even if nsIWebSocketChannel::Close() has not been called.
     *
     * @param aContext user defined context
     * @param aStatusCode reason for stopping (NS_OK if completed successfully)
     */
  /* void onStop (in nsISupports aContext, in nsresult aStatusCode); */
  NS_SCRIPTABLE NS_IMETHOD OnStop(nsISupports *aContext, nsresult aStatusCode) = 0;

  /**
     * Called to deliver text message.
     *
     * @param aContext user defined context
     * @param aMsg the message data
     */
  /* void onMessageAvailable (in nsISupports aContext, in AUTF8String aMsg); */
  NS_SCRIPTABLE NS_IMETHOD OnMessageAvailable(nsISupports *aContext, const nsACString & aMsg) = 0;

  /**
     * Called to deliver binary message.
     *
     * @param aContext user defined context
     * @param aMsg the message data
     */
  /* void onBinaryMessageAvailable (in nsISupports aContext, in ACString aMsg); */
  NS_SCRIPTABLE NS_IMETHOD OnBinaryMessageAvailable(nsISupports *aContext, const nsACString & aMsg) = 0;

  /**
     * Called to acknowledge message sent via sendMsg() or sendBinaryMsg.
     *
     * @param aContext user defined context
     * @param aSize number of bytes placed in OS send buffer
     */
  /* void onAcknowledge (in nsISupports aContext, in PRUint32 aSize); */
  NS_SCRIPTABLE NS_IMETHOD OnAcknowledge(nsISupports *aContext, PRUint32 aSize) = 0;

  /**
     * Called to inform receipt of WebSocket Close message from server.
     * In the case of errors onStop() can be called without ever
     * receiving server close.
     *
     * No additional messages through onMessageAvailable(),
     * onBinaryMessageAvailable() or onAcknowledge() will be delievered
     * to the listener after onServerClose(), though outgoing messages can still
     * be sent through the nsIWebSocketChannel connection.
     */
  /* void onServerClose (in nsISupports aContext); */
  NS_SCRIPTABLE NS_IMETHOD OnServerClose(nsISupports *aContext) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIWebSocketListener, NS_IWEBSOCKETLISTENER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIWEBSOCKETLISTENER \
  NS_SCRIPTABLE NS_IMETHOD OnStart(nsISupports *aContext); \
  NS_SCRIPTABLE NS_IMETHOD OnStop(nsISupports *aContext, nsresult aStatusCode); \
  NS_SCRIPTABLE NS_IMETHOD OnMessageAvailable(nsISupports *aContext, const nsACString & aMsg); \
  NS_SCRIPTABLE NS_IMETHOD OnBinaryMessageAvailable(nsISupports *aContext, const nsACString & aMsg); \
  NS_SCRIPTABLE NS_IMETHOD OnAcknowledge(nsISupports *aContext, PRUint32 aSize); \
  NS_SCRIPTABLE NS_IMETHOD OnServerClose(nsISupports *aContext); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIWEBSOCKETLISTENER(_to) \
  NS_SCRIPTABLE NS_IMETHOD OnStart(nsISupports *aContext) { return _to OnStart(aContext); } \
  NS_SCRIPTABLE NS_IMETHOD OnStop(nsISupports *aContext, nsresult aStatusCode) { return _to OnStop(aContext, aStatusCode); } \
  NS_SCRIPTABLE NS_IMETHOD OnMessageAvailable(nsISupports *aContext, const nsACString & aMsg) { return _to OnMessageAvailable(aContext, aMsg); } \
  NS_SCRIPTABLE NS_IMETHOD OnBinaryMessageAvailable(nsISupports *aContext, const nsACString & aMsg) { return _to OnBinaryMessageAvailable(aContext, aMsg); } \
  NS_SCRIPTABLE NS_IMETHOD OnAcknowledge(nsISupports *aContext, PRUint32 aSize) { return _to OnAcknowledge(aContext, aSize); } \
  NS_SCRIPTABLE NS_IMETHOD OnServerClose(nsISupports *aContext) { return _to OnServerClose(aContext); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIWEBSOCKETLISTENER(_to) \
  NS_SCRIPTABLE NS_IMETHOD OnStart(nsISupports *aContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStart(aContext); } \
  NS_SCRIPTABLE NS_IMETHOD OnStop(nsISupports *aContext, nsresult aStatusCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStop(aContext, aStatusCode); } \
  NS_SCRIPTABLE NS_IMETHOD OnMessageAvailable(nsISupports *aContext, const nsACString & aMsg) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnMessageAvailable(aContext, aMsg); } \
  NS_SCRIPTABLE NS_IMETHOD OnBinaryMessageAvailable(nsISupports *aContext, const nsACString & aMsg) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnBinaryMessageAvailable(aContext, aMsg); } \
  NS_SCRIPTABLE NS_IMETHOD OnAcknowledge(nsISupports *aContext, PRUint32 aSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnAcknowledge(aContext, aSize); } \
  NS_SCRIPTABLE NS_IMETHOD OnServerClose(nsISupports *aContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnServerClose(aContext); } 

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

/* Header file */
class nsWebSocketListener : public nsIWebSocketListener
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIWEBSOCKETLISTENER

  nsWebSocketListener();

private:
  ~nsWebSocketListener();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsWebSocketListener, nsIWebSocketListener)

nsWebSocketListener::nsWebSocketListener()
{
  /* member initializers and constructor code */
}

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

/* void onStart (in nsISupports aContext); */
NS_IMETHODIMP nsWebSocketListener::OnStart(nsISupports *aContext)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onStop (in nsISupports aContext, in nsresult aStatusCode); */
NS_IMETHODIMP nsWebSocketListener::OnStop(nsISupports *aContext, nsresult aStatusCode)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onMessageAvailable (in nsISupports aContext, in AUTF8String aMsg); */
NS_IMETHODIMP nsWebSocketListener::OnMessageAvailable(nsISupports *aContext, const nsACString & aMsg)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onBinaryMessageAvailable (in nsISupports aContext, in ACString aMsg); */
NS_IMETHODIMP nsWebSocketListener::OnBinaryMessageAvailable(nsISupports *aContext, const nsACString & aMsg)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onAcknowledge (in nsISupports aContext, in PRUint32 aSize); */
NS_IMETHODIMP nsWebSocketListener::OnAcknowledge(nsISupports *aContext, PRUint32 aSize)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onServerClose (in nsISupports aContext); */
NS_IMETHODIMP nsWebSocketListener::OnServerClose(nsISupports *aContext)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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


#endif /* __gen_nsIWebSocketListener_h__ */
