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_SESSION_INTERFACE_H_ |
| 6 #define NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ |
| 7 |
| 8 #include "net/quic/quartc/quartc_reliable_stream_interface.h" |
| 9 |
| 10 namespace net { |
| 11 class QuartcSessionInterface { |
| 12 public: |
| 13 virtual void StartCryptoHandshake() = 0; |
| 14 |
| 15 // Only needed when using SRTP with QuicTransport |
| 16 // Key Exporter interface from RFC 5705 |
| 17 // Arguments are: |
| 18 // label -- the exporter label. |
| 19 // part of the RFC defining each exporter |
| 20 // usage (IN) |
| 21 // context/context_len -- a context to bind to for this connection indicating |
| 22 // where and how the keying material will be used. |
| 23 virtual bool ExportKeyingMaterial(const std::string& label, |
| 24 const uint8_t* context, |
| 25 size_t context_len, |
| 26 uint8_t* result, |
| 27 size_t result_len) = 0; |
| 28 |
| 29 // For forward-compatibility |
| 30 struct OutgoingStreamParameters {}; |
| 31 virtual QuartcReliableStreamInterface* CreateOutgoingStream( |
| 32 const OutgoingStreamParameters& params) = 0; |
| 33 |
| 34 // Implemented by WebRTC (ICE) code. Used by QUIC for sending and receiving |
| 35 // (hopefully UDP) packets. |
| 36 class Transport { |
| 37 public: |
| 38 // Called by the QuartcPacketWriter to check if the underneath transport |
| 39 // writable. |
| 40 virtual bool CanWrite() = 0; |
| 41 // Called by the QuartcPacketWriter when writing packets to the network. |
| 42 virtual int Write(const char* buffer, size_t buf_len) = 0; |
| 43 |
| 44 // Implemented by QUIC code. |
| 45 class Observer { |
| 46 virtual void OnCanWrite() = 0; |
| 47 virtual bool OnReceived(const char* data, size_t data_len) = 0; |
| 48 }; |
| 49 virtual void SetObserver(Observer* observer) = 0; |
| 50 }; |
| 51 virtual void SetTransport(Transport*) = 0; |
| 52 |
| 53 // Implemented by WebRTC code. |
| 54 class Observer { |
| 55 public: |
| 56 virtual void OnCryptoHandshakeComplete() = 0; |
| 57 |
| 58 virtual void OnIncomingStream(QuartcReliableStreamInterface* stream) = 0; |
| 59 |
| 60 // TODO(zhihuang) Create mapping from integer error code to WebRTC error |
| 61 // code. |
| 62 virtual void OnConnectionClosed(int error_code, bool from_remote) = 0; |
| 63 |
| 64 // TODO(zhihuang): Proof verification. |
| 65 }; |
| 66 virtual void SetObserver(Observer* observer) = 0; |
| 67 }; |
| 68 } // namespace net |
| 69 |
| 70 #endif // NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ |
OLD | NEW |