1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef NETWERK_SCTP_DATACHANNEL_DATACHANNELLISTENER_H_
8 #define NETWERK_SCTP_DATACHANNEL_DATACHANNELLISTENER_H_
10 #include "nsISupports.h"
15 // Implemented by consumers of a Channel to receive messages.
16 // Can't nest it in DataChannelConnection because C++ doesn't allow forward
17 // refs to embedded classes
18 class DataChannelListener
{
20 virtual ~DataChannelListener() = default;
22 // Called when a DOMString message is received.
23 virtual nsresult
OnMessageAvailable(nsISupports
* aContext
,
24 const nsACString
& message
) = 0;
26 // Called when a binary message is received.
27 virtual nsresult
OnBinaryMessageAvailable(nsISupports
* aContext
,
28 const nsACString
& message
) = 0;
30 // Called when the channel is connected
31 virtual nsresult
OnChannelConnected(nsISupports
* aContext
) = 0;
33 // Called when the channel is closed
34 virtual nsresult
OnChannelClosed(nsISupports
* aContext
) = 0;
36 // Called when the BufferedAmount drops below the BufferedAmountLowThreshold
37 virtual nsresult
OnBufferLow(nsISupports
* aContext
) = 0;
39 // Called when the BufferedAmount drops to 0
40 virtual nsresult
NotBuffered(nsISupports
* aContext
) = 0;
43 } // namespace mozilla