| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ | 5 #ifndef NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ |
| 6 #define NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ | 6 #define NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "net/quic/core/quic_error_codes.h" |
| 13 #include "net/quic/core/quic_types.h" |
| 12 #include "net/quic/quartc/quartc_stream_interface.h" | 14 #include "net/quic/quartc/quartc_stream_interface.h" |
| 13 | 15 |
| 14 namespace net { | 16 namespace net { |
| 15 | 17 |
| 16 // Given a PacketTransport, provides a way to send and receive separate streams | 18 // Given a PacketTransport, provides a way to send and receive separate streams |
| 17 // of reliable, in-order, encrypted data. For example, this can build on top of | 19 // of reliable, in-order, encrypted data. For example, this can build on top of |
| 18 // a WebRTC IceTransport for sending and receiving data over QUIC. | 20 // a WebRTC IceTransport for sending and receiving data over QUIC. |
| 19 class QuartcSessionInterface { | 21 class QUIC_EXPORT_PRIVATE QuartcSessionInterface { |
| 20 public: | 22 public: |
| 21 virtual ~QuartcSessionInterface() {} | 23 virtual ~QuartcSessionInterface() {} |
| 22 | 24 |
| 23 virtual void StartCryptoHandshake() = 0; | 25 virtual void StartCryptoHandshake() = 0; |
| 24 | 26 |
| 25 // Only needed when using SRTP with QuicTransport | 27 // Only needed when using SRTP with QuicTransport |
| 26 // Key Exporter interface from RFC 5705 | 28 // Key Exporter interface from RFC 5705 |
| 27 // Arguments are: | 29 // Arguments are: |
| 28 // label -- the exporter label. | 30 // label -- the exporter label. |
| 29 // part of the RFC defining each exporter usage (IN) | 31 // part of the RFC defining each exporter usage (IN) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 uint8_t* result, | 43 uint8_t* result, |
| 42 size_t result_len) = 0; | 44 size_t result_len) = 0; |
| 43 | 45 |
| 44 // For forward-compatibility. More parameters could be added through the | 46 // For forward-compatibility. More parameters could be added through the |
| 45 // struct without changing the API. | 47 // struct without changing the API. |
| 46 struct OutgoingStreamParameters {}; | 48 struct OutgoingStreamParameters {}; |
| 47 | 49 |
| 48 virtual QuartcStreamInterface* CreateOutgoingStream( | 50 virtual QuartcStreamInterface* CreateOutgoingStream( |
| 49 const OutgoingStreamParameters& params) = 0; | 51 const OutgoingStreamParameters& params) = 0; |
| 50 | 52 |
| 53 // If the given stream is still open, sends a reset frame to cancel it. |
| 54 // Note: This method cancels a stream by QuicStreamId rather than by pointer |
| 55 // (or by a method on QuartcStreamInterface) because QuartcSession (and not |
| 56 // the caller) owns the streams. Streams may finish and be deleted before the |
| 57 // caller tries to cancel them, rendering the caller's pointers invalid. |
| 58 virtual void CancelStream(QuicStreamId stream_id) = 0; |
| 59 |
| 51 // Send and receive packets, like a virtual UDP socket. For example, this | 60 // Send and receive packets, like a virtual UDP socket. For example, this |
| 52 // could be implemented by WebRTC's IceTransport. | 61 // could be implemented by WebRTC's IceTransport. |
| 53 class PacketTransport { | 62 class PacketTransport { |
| 54 public: | 63 public: |
| 55 virtual ~PacketTransport() {} | 64 virtual ~PacketTransport() {} |
| 56 | 65 |
| 57 // Called by the QuartcPacketWriter to check if the underneath transport is | 66 // Called by the QuartcPacketWriter to check if the underneath transport is |
| 58 // writable. True if packets written are expected to be sent. False if | 67 // writable. True if packets written are expected to be sent. False if |
| 59 // packets will be dropped. | 68 // packets will be dropped. |
| 60 virtual bool CanWrite() = 0; | 69 virtual bool CanWrite() = 0; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // TODO(zhihuang): Add proof verification. | 101 // TODO(zhihuang): Add proof verification. |
| 93 }; | 102 }; |
| 94 | 103 |
| 95 // The |delegate| is not owned by QuartcSession. | 104 // The |delegate| is not owned by QuartcSession. |
| 96 virtual void SetDelegate(Delegate* delegate) = 0; | 105 virtual void SetDelegate(Delegate* delegate) = 0; |
| 97 }; | 106 }; |
| 98 | 107 |
| 99 } // namespace net | 108 } // namespace net |
| 100 | 109 |
| 101 #endif // NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ | 110 #endif // NET_QUIC_QUARTC_QUARTC_SESSION_INTERFACE_H_ |
| OLD | NEW |