• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 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_CHLO_EXTRACTOR_H_
6 #define QUICHE_QUIC_CORE_CHLO_EXTRACTOR_H_
7 
8 #include "quiche/quic/core/crypto/crypto_handshake_message.h"
9 #include "quiche/quic/core/quic_packets.h"
10 
11 namespace quic {
12 
13 // A utility for extracting QUIC Client Hello messages from packets,
14 // without needing to spin up a full QuicSession.
15 class QUIC_NO_EXPORT ChloExtractor {
16  public:
17   class QUIC_NO_EXPORT Delegate {
18    public:
~Delegate()19     virtual ~Delegate() {}
20 
21     // Called when a CHLO message is found in the packets.
22     virtual void OnChlo(QuicTransportVersion version,
23                         QuicConnectionId connection_id,
24                         const CryptoHandshakeMessage& chlo) = 0;
25   };
26 
27   // Extracts a CHLO message from |packet| and invokes the OnChlo
28   // method of |delegate|. Return true if a CHLO message was found,
29   // and false otherwise. If non-empty,
30   // |create_session_tag_indicators| contains a list of QUIC tags that
31   // if found will result in the session being created early, to
32   // enable support for multi-packet CHLOs.
33   static bool Extract(const QuicEncryptedPacket& packet,
34                       ParsedQuicVersion version,
35                       const QuicTagVector& create_session_tag_indicators,
36                       Delegate* delegate, uint8_t connection_id_length);
37 
38   ChloExtractor(const ChloExtractor&) = delete;
39   ChloExtractor operator=(const ChloExtractor&) = delete;
40 };
41 
42 }  // namespace quic
43 
44 #endif  // QUICHE_QUIC_CORE_CHLO_EXTRACTOR_H_
45