blob: 7e4b12557e9d0909e1939d3a20a4feb6e228d33e [file] [log] [blame]
fayangd58736d2019-11-27 13:35:31 -08001// 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
10namespace quic {
11
12class QuicDecrypter;
13class QuicEncrypter;
14
15// Pure virtual class to get notified when particular handshake events occurred.
16class QUIC_EXPORT_PRIVATE HandshakerDelegateInterface {
17 public:
18 virtual ~HandshakerDelegateInterface() {}
19
fayang3f7bcbe2020-02-10 11:08:47 -080020 // 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;
fayangd58736d2019-11-27 13:35:31 -080031
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
fayang01062942020-01-22 07:23:23 -080046 // 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
fayangd58736d2019-11-27 13:35:31 -080048 // encryption level and 2) a server successfully processes a forward secure
fayang01062942020-01-22 07:23:23 -080049 // packet.
fayangd58736d2019-11-27 13:35:31 -080050 virtual void NeuterHandshakeData() = 0;
51};
52
53} // namespace quic
54
55#endif // QUICHE_QUIC_CORE_HANDSHAKER_DELEGATE_INTERFACE_H_