OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "webrtc/pc/channel.h" | 24 #include "webrtc/pc/channel.h" |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 | 27 |
28 class DataChannel; | 28 class DataChannel; |
29 | 29 |
30 class DataChannelProviderInterface { | 30 class DataChannelProviderInterface { |
31 public: | 31 public: |
32 // Sends the data to the transport. | 32 // Sends the data to the transport. |
33 virtual bool SendData(const cricket::SendDataParams& params, | 33 virtual bool SendData(const cricket::SendDataParams& params, |
34 const rtc::Buffer& payload, | 34 const rtc::CopyOnWriteBuffer& payload, |
35 cricket::SendDataResult* result) = 0; | 35 cricket::SendDataResult* result) = 0; |
36 // Connects to the transport signals. | 36 // Connects to the transport signals. |
37 virtual bool ConnectDataChannel(DataChannel* data_channel) = 0; | 37 virtual bool ConnectDataChannel(DataChannel* data_channel) = 0; |
38 // Disconnects from the transport signals. | 38 // Disconnects from the transport signals. |
39 virtual void DisconnectDataChannel(DataChannel* data_channel) = 0; | 39 virtual void DisconnectDataChannel(DataChannel* data_channel) = 0; |
40 // Adds the data channel SID to the transport for SCTP. | 40 // Adds the data channel SID to the transport for SCTP. |
41 virtual void AddSctpDataStream(int sid) = 0; | 41 virtual void AddSctpDataStream(int sid) = 0; |
42 // Removes the data channel SID from the transport for SCTP. | 42 // Removes the data channel SID from the transport for SCTP. |
43 virtual void RemoveSctpDataStream(int sid) = 0; | 43 virtual void RemoveSctpDataStream(int sid) = 0; |
44 // Returns true if the transport channel is ready to send data. | 44 // Returns true if the transport channel is ready to send data. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 virtual void OnMessage(rtc::Message* msg); | 136 virtual void OnMessage(rtc::Message* msg); |
137 | 137 |
138 // Called when the channel's ready to use. That can happen when the | 138 // Called when the channel's ready to use. That can happen when the |
139 // underlying DataMediaChannel becomes ready, or when this channel is a new | 139 // underlying DataMediaChannel becomes ready, or when this channel is a new |
140 // stream on an existing DataMediaChannel, and we've finished negotiation. | 140 // stream on an existing DataMediaChannel, and we've finished negotiation. |
141 void OnChannelReady(bool writable); | 141 void OnChannelReady(bool writable); |
142 | 142 |
143 // Sigslots from cricket::DataChannel | 143 // Sigslots from cricket::DataChannel |
144 void OnDataReceived(cricket::DataChannel* channel, | 144 void OnDataReceived(cricket::DataChannel* channel, |
145 const cricket::ReceiveDataParams& params, | 145 const cricket::ReceiveDataParams& params, |
146 const rtc::Buffer& payload); | 146 const rtc::CopyOnWriteBuffer& payload); |
147 void OnStreamClosedRemotely(uint32_t sid); | 147 void OnStreamClosedRemotely(uint32_t sid); |
148 | 148 |
149 // The remote peer request that this channel should be closed. | 149 // The remote peer request that this channel should be closed. |
150 void RemotePeerRequestClose(); | 150 void RemotePeerRequestClose(); |
151 | 151 |
152 // The following methods are for SCTP only. | 152 // The following methods are for SCTP only. |
153 | 153 |
154 // Sets the SCTP sid and adds to transport layer if not set yet. Should only | 154 // Sets the SCTP sid and adds to transport layer if not set yet. Should only |
155 // be called once. | 155 // be called once. |
156 void SetSctpSid(int sid); | 156 void SetSctpSid(int sid); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 void SetState(DataState state); | 229 void SetState(DataState state); |
230 void DisconnectFromProvider(); | 230 void DisconnectFromProvider(); |
231 | 231 |
232 void DeliverQueuedReceivedData(); | 232 void DeliverQueuedReceivedData(); |
233 | 233 |
234 void SendQueuedDataMessages(); | 234 void SendQueuedDataMessages(); |
235 bool SendDataMessage(const DataBuffer& buffer, bool queue_if_blocked); | 235 bool SendDataMessage(const DataBuffer& buffer, bool queue_if_blocked); |
236 bool QueueSendDataMessage(const DataBuffer& buffer); | 236 bool QueueSendDataMessage(const DataBuffer& buffer); |
237 | 237 |
238 void SendQueuedControlMessages(); | 238 void SendQueuedControlMessages(); |
239 void QueueControlMessage(const rtc::Buffer& buffer); | 239 void QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer); |
240 bool SendControlMessage(const rtc::Buffer& buffer); | 240 bool SendControlMessage(const rtc::CopyOnWriteBuffer& buffer); |
241 | 241 |
242 std::string label_; | 242 std::string label_; |
243 InternalDataChannelInit config_; | 243 InternalDataChannelInit config_; |
244 DataChannelObserver* observer_; | 244 DataChannelObserver* observer_; |
245 DataState state_; | 245 DataState state_; |
246 cricket::DataChannelType data_channel_type_; | 246 cricket::DataChannelType data_channel_type_; |
247 DataChannelProviderInterface* provider_; | 247 DataChannelProviderInterface* provider_; |
248 HandshakeState handshake_state_; | 248 HandshakeState handshake_state_; |
249 bool connected_to_provider_; | 249 bool connected_to_provider_; |
250 bool send_ssrc_set_; | 250 bool send_ssrc_set_; |
(...skipping 22 matching lines...) Expand all Loading... |
273 PROXY_CONSTMETHOD0(int, id) | 273 PROXY_CONSTMETHOD0(int, id) |
274 PROXY_CONSTMETHOD0(DataState, state) | 274 PROXY_CONSTMETHOD0(DataState, state) |
275 PROXY_CONSTMETHOD0(uint64_t, buffered_amount) | 275 PROXY_CONSTMETHOD0(uint64_t, buffered_amount) |
276 PROXY_METHOD0(void, Close) | 276 PROXY_METHOD0(void, Close) |
277 PROXY_METHOD1(bool, Send, const DataBuffer&) | 277 PROXY_METHOD1(bool, Send, const DataBuffer&) |
278 END_PROXY() | 278 END_PROXY() |
279 | 279 |
280 } // namespace webrtc | 280 } // namespace webrtc |
281 | 281 |
282 #endif // WEBRTC_API_DATACHANNEL_H_ | 282 #endif // WEBRTC_API_DATACHANNEL_H_ |
OLD | NEW |