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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 virtual uint16_t maxRetransmitTime() const { | 123 virtual uint16_t maxRetransmitTime() const { |
124 return config_.maxRetransmitTime; | 124 return config_.maxRetransmitTime; |
125 } | 125 } |
126 virtual uint16_t maxRetransmits() const { return config_.maxRetransmits; } | 126 virtual uint16_t maxRetransmits() const { return config_.maxRetransmits; } |
127 virtual std::string protocol() const { return config_.protocol; } | 127 virtual std::string protocol() const { return config_.protocol; } |
128 virtual bool negotiated() const { return config_.negotiated; } | 128 virtual bool negotiated() const { return config_.negotiated; } |
129 virtual int id() const { return config_.id; } | 129 virtual int id() const { return config_.id; } |
130 virtual uint64_t buffered_amount() const; | 130 virtual uint64_t buffered_amount() const; |
131 virtual void Close(); | 131 virtual void Close(); |
132 virtual DataState state() const { return state_; } | 132 virtual DataState state() const { return state_; } |
| 133 virtual uint32_t messages_sent() const { return messages_sent_; } |
| 134 virtual uint64_t bytes_sent() const { return bytes_sent_; } |
| 135 virtual uint32_t messages_received() const { return messages_received_; } |
| 136 virtual uint64_t bytes_received() const { return bytes_received_; } |
133 virtual bool Send(const DataBuffer& buffer); | 137 virtual bool Send(const DataBuffer& buffer); |
134 | 138 |
135 // rtc::MessageHandler override. | 139 // rtc::MessageHandler override. |
136 virtual void OnMessage(rtc::Message* msg); | 140 virtual void OnMessage(rtc::Message* msg); |
137 | 141 |
138 // Called when the channel's ready to use. That can happen when the | 142 // 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 | 143 // underlying DataMediaChannel becomes ready, or when this channel is a new |
140 // stream on an existing DataMediaChannel, and we've finished negotiation. | 144 // stream on an existing DataMediaChannel, and we've finished negotiation. |
141 void OnChannelReady(bool writable); | 145 void OnChannelReady(bool writable); |
142 | 146 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 bool QueueSendDataMessage(const DataBuffer& buffer); | 242 bool QueueSendDataMessage(const DataBuffer& buffer); |
239 | 243 |
240 void SendQueuedControlMessages(); | 244 void SendQueuedControlMessages(); |
241 void QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer); | 245 void QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer); |
242 bool SendControlMessage(const rtc::CopyOnWriteBuffer& buffer); | 246 bool SendControlMessage(const rtc::CopyOnWriteBuffer& buffer); |
243 | 247 |
244 std::string label_; | 248 std::string label_; |
245 InternalDataChannelInit config_; | 249 InternalDataChannelInit config_; |
246 DataChannelObserver* observer_; | 250 DataChannelObserver* observer_; |
247 DataState state_; | 251 DataState state_; |
| 252 uint32_t messages_sent_; |
| 253 uint64_t bytes_sent_; |
| 254 uint32_t messages_received_; |
| 255 uint64_t bytes_received_; |
248 cricket::DataChannelType data_channel_type_; | 256 cricket::DataChannelType data_channel_type_; |
249 DataChannelProviderInterface* provider_; | 257 DataChannelProviderInterface* provider_; |
250 HandshakeState handshake_state_; | 258 HandshakeState handshake_state_; |
251 bool connected_to_provider_; | 259 bool connected_to_provider_; |
252 bool send_ssrc_set_; | 260 bool send_ssrc_set_; |
253 bool receive_ssrc_set_; | 261 bool receive_ssrc_set_; |
254 bool writable_; | 262 bool writable_; |
255 uint32_t send_ssrc_; | 263 uint32_t send_ssrc_; |
256 uint32_t receive_ssrc_; | 264 uint32_t receive_ssrc_; |
257 // Control messages that always have to get sent out before any queued | 265 // Control messages that always have to get sent out before any queued |
258 // data. | 266 // data. |
259 PacketQueue queued_control_data_; | 267 PacketQueue queued_control_data_; |
260 PacketQueue queued_received_data_; | 268 PacketQueue queued_received_data_; |
261 PacketQueue queued_send_data_; | 269 PacketQueue queued_send_data_; |
262 }; | 270 }; |
263 | 271 |
264 // Define proxy for DataChannelInterface. | 272 // Define proxy for DataChannelInterface. |
265 BEGIN_SIGNALING_PROXY_MAP(DataChannel) | 273 BEGIN_SIGNALING_PROXY_MAP(DataChannel) |
266 PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*) | 274 PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*) |
267 PROXY_METHOD0(void, UnregisterObserver) | 275 PROXY_METHOD0(void, UnregisterObserver) |
268 PROXY_CONSTMETHOD0(std::string, label) | 276 PROXY_CONSTMETHOD0(std::string, label) |
269 PROXY_CONSTMETHOD0(bool, reliable) | 277 PROXY_CONSTMETHOD0(bool, reliable) |
270 PROXY_CONSTMETHOD0(bool, ordered) | 278 PROXY_CONSTMETHOD0(bool, ordered) |
271 PROXY_CONSTMETHOD0(uint16_t, maxRetransmitTime) | 279 PROXY_CONSTMETHOD0(uint16_t, maxRetransmitTime) |
272 PROXY_CONSTMETHOD0(uint16_t, maxRetransmits) | 280 PROXY_CONSTMETHOD0(uint16_t, maxRetransmits) |
273 PROXY_CONSTMETHOD0(std::string, protocol) | 281 PROXY_CONSTMETHOD0(std::string, protocol) |
274 PROXY_CONSTMETHOD0(bool, negotiated) | 282 PROXY_CONSTMETHOD0(bool, negotiated) |
275 PROXY_CONSTMETHOD0(int, id) | 283 PROXY_CONSTMETHOD0(int, id) |
276 PROXY_CONSTMETHOD0(DataState, state) | 284 PROXY_CONSTMETHOD0(DataState, state) |
| 285 PROXY_CONSTMETHOD0(uint32_t, messages_sent) |
| 286 PROXY_CONSTMETHOD0(uint64_t, bytes_sent) |
| 287 PROXY_CONSTMETHOD0(uint32_t, messages_received) |
| 288 PROXY_CONSTMETHOD0(uint64_t, bytes_received) |
277 PROXY_CONSTMETHOD0(uint64_t, buffered_amount) | 289 PROXY_CONSTMETHOD0(uint64_t, buffered_amount) |
278 PROXY_METHOD0(void, Close) | 290 PROXY_METHOD0(void, Close) |
279 PROXY_METHOD1(bool, Send, const DataBuffer&) | 291 PROXY_METHOD1(bool, Send, const DataBuffer&) |
280 END_SIGNALING_PROXY() | 292 END_SIGNALING_PROXY() |
281 | 293 |
282 } // namespace webrtc | 294 } // namespace webrtc |
283 | 295 |
284 #endif // WEBRTC_API_DATACHANNEL_H_ | 296 #endif // WEBRTC_API_DATACHANNEL_H_ |
OLD | NEW |