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

Side by Side Diff: net/tools/quic/quic_client_base.h

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enough! Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_client_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // A base class for the toy client, which connects to a specified port and sends 5 // A base class for the toy client, which connects to a specified port and sends
6 // QUIC request to that endpoint. 6 // QUIC request to that endpoint.
7 7
8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ 8 #ifndef NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_
9 #define NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ 9 #define NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_
10 10
(...skipping 29 matching lines...) Expand all
40 ~DummyPacketWriterFactory() override; 40 ~DummyPacketWriterFactory() override;
41 41
42 QuicPacketWriter* Create(QuicConnection* connection) const override; 42 QuicPacketWriter* Create(QuicConnection* connection) const override;
43 43
44 private: 44 private:
45 QuicPacketWriter* writer_; 45 QuicPacketWriter* writer_;
46 }; 46 };
47 47
48 QuicClientBase(const QuicServerId& server_id, 48 QuicClientBase(const QuicServerId& server_id,
49 const QuicVersionVector& supported_versions, 49 const QuicVersionVector& supported_versions,
50 const QuicConfig& config); 50 const QuicConfig& config,
51 ProofVerifier* proof_verifier);
51 52
52 ~QuicClientBase(); 53 ~QuicClientBase();
53 54
54 // Initializes the client to create a connection. Should be called exactly 55 // Initializes the client to create a connection. Should be called exactly
55 // once before calling StartConnect or Connect. Returns true if the 56 // once before calling StartConnect or Connect. Returns true if the
56 // initialization succeeds, false otherwise. 57 // initialization succeeds, false otherwise.
57 virtual bool Initialize(); 58 virtual bool Initialize();
58 59
59 // Returns true if the crypto handshake has yet to establish encryption. 60 // Returns true if the crypto handshake has yet to establish encryption.
60 // Returns false if encryption is active (even if the server hasn't confirmed 61 // Returns false if encryption is active (even if the server hasn't confirmed
(...skipping 21 matching lines...) Expand all
82 83
83 const QuicServerId& server_id() const { return server_id_; } 84 const QuicServerId& server_id() const { return server_id_; }
84 85
85 // This should only be set before the initial Connect() 86 // This should only be set before the initial Connect()
86 void set_server_id(const QuicServerId& server_id) { server_id_ = server_id; } 87 void set_server_id(const QuicServerId& server_id) { server_id_ = server_id; }
87 88
88 void SetUserAgentID(const std::string& user_agent_id) { 89 void SetUserAgentID(const std::string& user_agent_id) {
89 crypto_config_.set_user_agent_id(user_agent_id); 90 crypto_config_.set_user_agent_id(user_agent_id);
90 } 91 }
91 92
92 // SetProofVerifier sets the ProofVerifier that will be used to verify the
93 // server's certificate and takes ownership of |verifier|.
94 void SetProofVerifier(ProofVerifier* verifier) {
95 // TODO(rtenneti): We should set ProofVerifier in QuicClientSession.
96 crypto_config_.SetProofVerifier(verifier);
97 }
98
99 // SetChannelIDSource sets a ChannelIDSource that will be called, when the 93 // SetChannelIDSource sets a ChannelIDSource that will be called, when the
100 // server supports channel IDs, to obtain a channel ID for signing a message 94 // server supports channel IDs, to obtain a channel ID for signing a message
101 // proving possession of the channel ID. This object takes ownership of 95 // proving possession of the channel ID. This object takes ownership of
102 // |source|. 96 // |source|.
103 void SetChannelIDSource(ChannelIDSource* source) { 97 void SetChannelIDSource(ChannelIDSource* source) {
104 crypto_config_.SetChannelIDSource(source); 98 crypto_config_.SetChannelIDSource(source);
105 } 99 }
106 100
107 const QuicVersionVector& supported_versions() const { 101 const QuicVersionVector& supported_versions() const {
108 return supported_versions_; 102 return supported_versions_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (writer_.get() != writer) { 154 if (writer_.get() != writer) {
161 writer_.reset(writer); 155 writer_.reset(writer);
162 } 156 }
163 } 157 }
164 void reset_writer() { writer_.reset(); } 158 void reset_writer() { writer_.reset(); }
165 159
166 QuicByteCount initial_max_packet_length() { 160 QuicByteCount initial_max_packet_length() {
167 return initial_max_packet_length_; 161 return initial_max_packet_length_;
168 } 162 }
169 163
164 ProofVerifier* proof_verifier() const;
165
170 protected: 166 protected:
171 virtual QuicClientSession* CreateQuicClientSession( 167 virtual QuicClientSession* CreateQuicClientSession(
172 QuicConnection* connection); 168 QuicConnection* connection);
173 169
174 // Generates the next ConnectionId for |server_id_|. By default, if the 170 // Generates the next ConnectionId for |server_id_|. By default, if the
175 // cached server config contains a server-designated ID, that ID will be 171 // cached server config contains a server-designated ID, that ID will be
176 // returned. Otherwise, the next random ID will be returned. 172 // returned. Otherwise, the next random ID will be returned.
177 QuicConnectionId GetNextConnectionId(); 173 QuicConnectionId GetNextConnectionId();
178 174
179 // Returns the next server-designated ConnectionId from the cached config for 175 // Returns the next server-designated ConnectionId from the cached config for
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // to the previous client-level connection. 228 // to the previous client-level connection.
233 bool connected_or_attempting_connect_; 229 bool connected_or_attempting_connect_;
234 230
235 DISALLOW_COPY_AND_ASSIGN(QuicClientBase); 231 DISALLOW_COPY_AND_ASSIGN(QuicClientBase);
236 }; 232 };
237 233
238 } // namespace tools 234 } // namespace tools
239 } // namespace net 235 } // namespace net
240 236
241 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_ 237 #endif // NET_TOOLS_QUIC_QUIC_CLIENT_BASE_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_client_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698