blob: 231acfcdb30dfa4a9ce48dfacfbf863b20f5fd35 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright (c) 2012 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_QUIC_CRYPTO_HANDSHAKER_H_
6#define QUICHE_QUIC_CORE_QUIC_CRYPTO_HANDSHAKER_H_
7
8#include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h"
9#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
10
11namespace quic {
12
13class QUIC_EXPORT_PRIVATE QuicCryptoHandshaker
14 : public CryptoFramerVisitorInterface {
15 public:
16 QuicCryptoHandshaker(QuicCryptoStream* stream, QuicSession* session);
17 QuicCryptoHandshaker(const QuicCryptoHandshaker&) = delete;
18 QuicCryptoHandshaker& operator=(const QuicCryptoHandshaker&) = delete;
19
20 ~QuicCryptoHandshaker() override;
21
22 // Sends |message| to the peer.
23 // TODO(wtc): return a success/failure status.
24 void SendHandshakeMessage(const CryptoHandshakeMessage& message);
25
26 void OnError(CryptoFramer* framer) override;
27 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override;
28
29 CryptoMessageParser* crypto_message_parser();
30
31 protected:
32 QuicTag last_sent_handshake_message_tag() const {
33 return last_sent_handshake_message_tag_;
34 }
35
36 private:
37 QuicSession* session() { return session_; }
38
39 QuicCryptoStream* stream_;
40 QuicSession* session_;
41
42 CryptoFramer crypto_framer_;
43
44 // Records last sent crypto handshake message tag.
45 QuicTag last_sent_handshake_message_tag_;
46};
47
48} // namespace quic
49
50#endif // QUICHE_QUIC_CORE_QUIC_CRYPTO_HANDSHAKER_H_