blob: 9eae32ab8cf8a36567b045ec0f2a9c3923aaf35f [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
20 // Called when new keys are available.
21 virtual void OnNewKeysAvailable(EncryptionLevel level,
22 std::unique_ptr<QuicDecrypter> decrypter,
23 bool set_alternative_decrypter,
24 bool latch_once_used,
25 std::unique_ptr<QuicEncrypter> encrypter) = 0;
26
27 // Called to set default encryption level to |level|.
28 virtual void SetDefaultEncryptionLevel(EncryptionLevel level) = 0;
29
30 // Called to discard old decryption keys to stop processing packets of
31 // encryption |level|.
32 virtual void DiscardOldDecryptionKey(EncryptionLevel level) = 0;
33
34 // Called to discard old encryption keys (and neuter obsolete data).
35 // TODO(fayang): consider to combine this with DiscardOldDecryptionKey.
36 virtual void DiscardOldEncryptionKey(EncryptionLevel level) = 0;
37
38 // Called to neuter ENCRYPTION_INITIAL data (without discarding initial keys).
39 virtual void NeuterUnencryptedData() = 0;
40
41 // Called to neuter data of HANDSHAKE_DATA packet number space. In QUIC
42 // crypto, this is called 1) when a client switches to forward secure
43 // encryption level and 2) a server successfully processes a forward secure
44 // packet. Temporarily use this method in TLS handshake when both endpoints
45 // switch to forward secure encryption level.
46 // TODO(fayang): use DiscardOldEncryptionKey instead of this method in TLS
47 // handshake when handshake key discarding settles down.
48 virtual void NeuterHandshakeData() = 0;
49};
50
51} // namespace quic
52
53#endif // QUICHE_QUIC_CORE_HANDSHAKER_DELEGATE_INTERFACE_H_