fayang | d58736d | 2019-11-27 13:35:31 -0800 | [diff] [blame] | 1 | // Copyright (c) 2019 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 QUICHE_QUIC_CORE_HANDSHAKER_DELEGATE_INTERFACE_H_ |
| 6 | #define QUICHE_QUIC_CORE_HANDSHAKER_DELEGATE_INTERFACE_H_ |
| 7 | |
| 8 | #include "net/third_party/quiche/src/quic/core/quic_types.h" |
| 9 | |
| 10 | namespace quic { |
| 11 | |
| 12 | class QuicDecrypter; |
| 13 | class QuicEncrypter; |
| 14 | |
| 15 | // Pure virtual class to get notified when particular handshake events occurred. |
| 16 | class QUIC_EXPORT_PRIVATE HandshakerDelegateInterface { |
| 17 | public: |
| 18 | virtual ~HandshakerDelegateInterface() {} |
| 19 | |
fayang | 3f7bcbe | 2020-02-10 11:08:47 -0800 | [diff] [blame^] | 20 | // Called when new decryption key of |level| is available. |
| 21 | virtual void OnNewDecryptionKeyAvailable( |
| 22 | EncryptionLevel level, |
| 23 | std::unique_ptr<QuicDecrypter> decrypter, |
| 24 | bool set_alternative_decrypter, |
| 25 | bool latch_once_used) = 0; |
| 26 | |
| 27 | // Called when new encryption key of |level| is available. |
| 28 | virtual void OnNewEncryptionKeyAvailable( |
| 29 | EncryptionLevel level, |
| 30 | std::unique_ptr<QuicEncrypter> encrypter) = 0; |
fayang | d58736d | 2019-11-27 13:35:31 -0800 | [diff] [blame] | 31 | |
| 32 | // Called to set default encryption level to |level|. |
| 33 | virtual void SetDefaultEncryptionLevel(EncryptionLevel level) = 0; |
| 34 | |
| 35 | // Called to discard old decryption keys to stop processing packets of |
| 36 | // encryption |level|. |
| 37 | virtual void DiscardOldDecryptionKey(EncryptionLevel level) = 0; |
| 38 | |
| 39 | // Called to discard old encryption keys (and neuter obsolete data). |
| 40 | // TODO(fayang): consider to combine this with DiscardOldDecryptionKey. |
| 41 | virtual void DiscardOldEncryptionKey(EncryptionLevel level) = 0; |
| 42 | |
| 43 | // Called to neuter ENCRYPTION_INITIAL data (without discarding initial keys). |
| 44 | virtual void NeuterUnencryptedData() = 0; |
| 45 | |
fayang | 0106294 | 2020-01-22 07:23:23 -0800 | [diff] [blame] | 46 | // Called to neuter data of HANDSHAKE_DATA packet number space. Only used in |
| 47 | // QUIC crypto. This is called 1) when a client switches to forward secure |
fayang | d58736d | 2019-11-27 13:35:31 -0800 | [diff] [blame] | 48 | // encryption level and 2) a server successfully processes a forward secure |
fayang | 0106294 | 2020-01-22 07:23:23 -0800 | [diff] [blame] | 49 | // packet. |
fayang | d58736d | 2019-11-27 13:35:31 -0800 | [diff] [blame] | 50 | virtual void NeuterHandshakeData() = 0; |
| 51 | }; |
| 52 | |
| 53 | } // namespace quic |
| 54 | |
| 55 | #endif // QUICHE_QUIC_CORE_HANDSHAKER_DELEGATE_INTERFACE_H_ |