summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h')
-rw-r--r--chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h b/chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h
index bf31aed5d53..9256e0e071f 100644
--- a/chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h
+++ b/chromium/third_party/libjingle/source/talk/app/webrtc/datachannel.h
@@ -64,6 +64,25 @@ class DataChannelProviderInterface {
virtual ~DataChannelProviderInterface() {}
};
+struct InternalDataChannelInit : public DataChannelInit {
+ enum OpenHandshakeRole {
+ kOpener,
+ kAcker,
+ kNone
+ };
+ // The default role is kOpener because the default |negotiated| is false.
+ InternalDataChannelInit() : open_handshake_role(kOpener) {}
+ explicit InternalDataChannelInit(const DataChannelInit& base)
+ : DataChannelInit(base), open_handshake_role(kOpener) {
+ // If the channel is externally negotiated, do not send the OPEN message.
+ if (base.negotiated) {
+ open_handshake_role = kNone;
+ }
+ }
+
+ OpenHandshakeRole open_handshake_role;
+};
+
// DataChannel is a an implementation of the DataChannelInterface based on
// libjingle's data engine. It provides an implementation of unreliable or
// reliabledata channels. Currently this class is specifically designed to use
@@ -87,7 +106,7 @@ class DataChannel : public DataChannelInterface,
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
const std::string& label,
- const DataChannelInit* config);
+ const InternalDataChannelInit& config);
virtual void RegisterObserver(DataChannelObserver* observer);
virtual void UnregisterObserver();
@@ -156,7 +175,7 @@ class DataChannel : public DataChannelInterface,
virtual ~DataChannel();
private:
- bool Init(const DataChannelInit* config);
+ bool Init(const InternalDataChannelInit& config);
void DoClose();
void UpdateState();
void SetState(DataState state);
@@ -172,19 +191,20 @@ class DataChannel : public DataChannelInterface,
cricket::SendDataResult* send_result);
bool QueueSendData(const DataBuffer& buffer);
bool SendOpenMessage(const talk_base::Buffer* buffer);
-
+ bool SendOpenAckMessage(const talk_base::Buffer* buffer);
std::string label_;
- DataChannelInit config_;
+ InternalDataChannelInit config_;
DataChannelObserver* observer_;
DataState state_;
- bool was_ever_writable_;
- bool connected_to_provider_;
cricket::DataChannelType data_channel_type_;
DataChannelProviderInterface* provider_;
+ bool waiting_for_open_ack_;
+ bool was_ever_writable_;
+ bool connected_to_provider_;
bool send_ssrc_set_;
- uint32 send_ssrc_;
bool receive_ssrc_set_;
+ uint32 send_ssrc_;
uint32 receive_ssrc_;
// Control messages that always have to get sent out before any queued
// data.
@@ -197,7 +217,7 @@ class DataChannelFactory {
public:
virtual talk_base::scoped_refptr<DataChannel> CreateDataChannel(
const std::string& label,
- const DataChannelInit* config) = 0;
+ const InternalDataChannelInit* config) = 0;
protected:
virtual ~DataChannelFactory() {}