Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: net/tools/quic/chlo_extractor.h

Issue 1980663003: Add a new QUIC ChloExtractor class used by the QuicProxyDispatcher to extract CHLO message from pac… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121403250
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/tools/quic/chlo_extractor.h
diff --git a/net/tools/quic/chlo_extractor.h b/net/tools/quic/chlo_extractor.h
new file mode 100644
index 0000000000000000000000000000000000000000..eefaae3f51db31a28f3a2b317b8deaaf3c9ba728
--- /dev/null
+++ b/net/tools/quic/chlo_extractor.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_TOOLS_QUIC_CHLO_EXTRACTOR_H_
+#define NET_TOOLS_QUIC_CHLO_EXTRACTOR_H_
+
+#include "net/quic/crypto/crypto_handshake_message.h"
+#include "net/quic/quic_protocol.h"
+
+namespace net {
+
+// A utility for extracting QUIC Client Hello messages from packets,
+// without needs to spin up a full QuicSession.
+class ChloExtractor {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+
+ // Called when a CHLO message is found in the packets.
+ virtual void OnChlo(QuicVersion version,
+ QuicConnectionId connection_id,
+ const CryptoHandshakeMessage& chlo) = 0;
+ };
+
+ // Extracts a CHLO message from |packet| and invokes the OnChlo method
+ // of |delegate|. Return true if a CHLO message was found, and false
+ // otherwise.
+ static bool Extract(const QuicEncryptedPacket& packet,
+ const QuicVersionVector& versions,
+ Delegate* delegate);
+
+ ChloExtractor(ChloExtractor&) = delete;
+ ChloExtractor operator=(const ChloExtractor&) = delete;
+};
+
+} // namespace net
+
+#endif // NET_TOOLS_QUIC_CHLO_EXTRACTOR_H_

Powered by Google App Engine
This is Rietveld 408576698