| 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_H_ | 5 #ifndef NET_QUIC_QUARTC_QUARTC_SESSION_H_ |
| 6 #define NET_QUIC_QUARTC_QUARTC_SESSION_H_ | 6 #define NET_QUIC_QUARTC_QUARTC_SESSION_H_ |
| 7 | 7 |
| 8 #include "net/quic/core/quic_crypto_client_stream.h" | 8 #include "net/quic/core/quic_crypto_client_stream.h" |
| 9 #include "net/quic/core/quic_crypto_server_stream.h" | 9 #include "net/quic/core/quic_crypto_server_stream.h" |
| 10 #include "net/quic/core/quic_crypto_stream.h" | 10 #include "net/quic/core/quic_crypto_stream.h" |
| 11 #include "net/quic/core/quic_error_codes.h" |
| 11 #include "net/quic/core/quic_session.h" | 12 #include "net/quic/core/quic_session.h" |
| 12 #include "net/quic/quartc/quartc_clock_interface.h" | 13 #include "net/quic/quartc/quartc_clock_interface.h" |
| 13 #include "net/quic/quartc/quartc_session_interface.h" | 14 #include "net/quic/quartc/quartc_session_interface.h" |
| 14 #include "net/quic/quartc/quartc_stream.h" | 15 #include "net/quic/quartc/quartc_stream.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 | 18 |
| 18 // A helper class is used by the QuicCryptoServerStream. | 19 // A helper class is used by the QuicCryptoServerStream. |
| 19 class QuartcCryptoServerStreamHelper : public QuicCryptoServerStream::Helper { | 20 class QuartcCryptoServerStreamHelper : public QuicCryptoServerStream::Helper { |
| 20 public: | 21 public: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool ExportKeyingMaterial(const std::string& label, | 61 bool ExportKeyingMaterial(const std::string& label, |
| 61 const uint8_t* context, | 62 const uint8_t* context, |
| 62 size_t context_len, | 63 size_t context_len, |
| 63 bool used_context, | 64 bool used_context, |
| 64 uint8_t* result, | 65 uint8_t* result, |
| 65 size_t result_len) override; | 66 size_t result_len) override; |
| 66 | 67 |
| 67 QuartcStreamInterface* CreateOutgoingStream( | 68 QuartcStreamInterface* CreateOutgoingStream( |
| 68 const OutgoingStreamParameters& param) override; | 69 const OutgoingStreamParameters& param) override; |
| 69 | 70 |
| 71 void CancelStream(QuicStreamId stream_id) override; |
| 72 |
| 70 void SetDelegate(QuartcSessionInterface::Delegate* session_delegate) override; | 73 void SetDelegate(QuartcSessionInterface::Delegate* session_delegate) override; |
| 71 | 74 |
| 72 void OnTransportCanWrite() override; | 75 void OnTransportCanWrite() override; |
| 73 | 76 |
| 74 // Decrypts an incoming QUIC packet to a data stream. | 77 // Decrypts an incoming QUIC packet to a data stream. |
| 75 bool OnTransportReceived(const char* data, size_t data_len) override; | 78 bool OnTransportReceived(const char* data, size_t data_len) override; |
| 76 | 79 |
| 77 // ProofHandler overrides. | 80 // ProofHandler overrides. |
| 78 void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override; | 81 void OnProofValid(const QuicCryptoClientConfig::CachedState& cached) override; |
| 79 | 82 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 // QuicSession override. | 96 // QuicSession override. |
| 94 QuicStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 97 QuicStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
| 95 std::unique_ptr<QuicStream> CreateStream(QuicStreamId id) override; | 98 std::unique_ptr<QuicStream> CreateStream(QuicStreamId id) override; |
| 96 | 99 |
| 97 std::unique_ptr<QuartcStream> CreateDataStream(QuicStreamId id, | 100 std::unique_ptr<QuartcStream> CreateDataStream(QuicStreamId id, |
| 98 SpdyPriority priority); | 101 SpdyPriority priority); |
| 99 // Activates a QuartcStream. The session takes ownership of the stream, but | 102 // Activates a QuartcStream. The session takes ownership of the stream, but |
| 100 // returns an unowned pointer to the stream for convenience. | 103 // returns an unowned pointer to the stream for convenience. |
| 101 QuartcStream* ActivateDataStream(std::unique_ptr<QuartcStream> stream); | 104 QuartcStream* ActivateDataStream(std::unique_ptr<QuartcStream> stream); |
| 102 | 105 |
| 106 void ResetStream(QuicStreamId stream_id, QuicRstStreamErrorCode error); |
| 107 |
| 103 private: | 108 private: |
| 104 // For crypto handshake. | 109 // For crypto handshake. |
| 105 std::unique_ptr<QuicCryptoStream> crypto_stream_; | 110 std::unique_ptr<QuicCryptoStream> crypto_stream_; |
| 106 const std::string unique_remote_server_id_; | 111 const std::string unique_remote_server_id_; |
| 107 Perspective perspective_; | 112 Perspective perspective_; |
| 108 // Take the ownership of the QuicConnection. | 113 // Take the ownership of the QuicConnection. |
| 109 std::unique_ptr<QuicConnection> connection_; | 114 std::unique_ptr<QuicConnection> connection_; |
| 110 // Not owned by QuartcSession. From the QuartcFactory. | 115 // Not owned by QuartcSession. From the QuartcFactory. |
| 111 QuicConnectionHelperInterface* helper_; | 116 QuicConnectionHelperInterface* helper_; |
| 112 // For recording packet receipt time | 117 // For recording packet receipt time |
| 113 QuicClock* clock_; | 118 QuicClock* clock_; |
| 114 // Not owned by QuartcSession. | 119 // Not owned by QuartcSession. |
| 115 QuartcSessionInterface::Delegate* session_delegate_ = nullptr; | 120 QuartcSessionInterface::Delegate* session_delegate_ = nullptr; |
| 116 // Used by QUIC crypto server stream to track most recently compressed certs. | 121 // Used by QUIC crypto server stream to track most recently compressed certs. |
| 117 std::unique_ptr<QuicCompressedCertsCache> quic_compressed_certs_cache_; | 122 std::unique_ptr<QuicCompressedCertsCache> quic_compressed_certs_cache_; |
| 118 // This helper is needed when create QuicCryptoServerStream. | 123 // This helper is needed when create QuicCryptoServerStream. |
| 119 QuartcCryptoServerStreamHelper stream_helper_; | 124 QuartcCryptoServerStreamHelper stream_helper_; |
| 120 // Config for QUIC crypto client stream, used by the client. | 125 // Config for QUIC crypto client stream, used by the client. |
| 121 std::unique_ptr<QuicCryptoClientConfig> quic_crypto_client_config_; | 126 std::unique_ptr<QuicCryptoClientConfig> quic_crypto_client_config_; |
| 122 // Config for QUIC crypto server stream, used by the server. | 127 // Config for QUIC crypto server stream, used by the server. |
| 123 std::unique_ptr<QuicCryptoServerConfig> quic_crypto_server_config_; | 128 std::unique_ptr<QuicCryptoServerConfig> quic_crypto_server_config_; |
| 124 | 129 |
| 125 DISALLOW_COPY_AND_ASSIGN(QuartcSession); | 130 DISALLOW_COPY_AND_ASSIGN(QuartcSession); |
| 126 }; | 131 }; |
| 127 | 132 |
| 128 } // namespace net | 133 } // namespace net |
| 129 | 134 |
| 130 #endif // NET_QUIC_QUARTC_QUARTC_SESSION_H_ | 135 #endif // NET_QUIC_QUARTC_QUARTC_SESSION_H_ |
| OLD | NEW |