OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ |
| 6 #define NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ |
| 7 |
| 8 namespace net { |
| 9 class QuartcReliableStreamInterface { |
| 10 public: |
| 11 virtual uint32_t stream_id() = 0; |
| 12 virtual uint64_t buffered_amount() = 0; |
| 13 |
| 14 // For forward-compatibility |
| 15 struct WriteParameters { |
| 16 bool fin = false; |
| 17 }; |
| 18 virtual void Write(const char* data, |
| 19 size_t size, |
| 20 const WriteParameters& param) = 0; |
| 21 virtual void Close() = 0; |
| 22 |
| 23 // Implemented on the WebRTC side. |
| 24 class Observer { |
| 25 public: |
| 26 // Called when the data are ready. |
| 27 virtual void OnReceived(QuartcReliableStreamInterface* stream, |
| 28 const char* data, |
| 29 size_t size) = 0; |
| 30 |
| 31 // TODO(zhihuang) Create a map from the integer error_code to WebRTC native |
| 32 // error code. |
| 33 virtual void OnClose(QuartcReliableStreamInterface* stream, |
| 34 int error_code) = 0; |
| 35 |
| 36 // Called when the buffered data has been sent. |
| 37 virtual void OnBufferedAmountChanged( |
| 38 QuartcReliableStreamInterface* stream) = 0; |
| 39 }; |
| 40 virtual void SetObserver(Observer*) = 0; |
| 41 }; |
| 42 } |
| 43 |
| 44 #endif // NET_QUIC_QUARTC_QUARTC_RELIABLE_STREAM_INTERFACE_H_ |
OLD | NEW |