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

Side by Side Diff: net/quic/quartc/quartc_session.cc

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/quic/platform/impl/quic_url_utils_impl.cc ('k') | net/quic/quartc/quartc_session_test.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) 2016 The Chromium Authors. All rights reserved. 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 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 #include "net/quic/quartc/quartc_session.h" 5 #include "net/quic/quartc/quartc_session.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "net/quic/platform/api/quic_string_piece.h"
8 9
9 namespace { 10 namespace {
10 11
11 // Default priority for incoming QUIC streams. 12 // Default priority for incoming QUIC streams.
12 // TODO(zhihuang): Determine if this value is correct. 13 // TODO(zhihuang): Determine if this value is correct.
13 static const net::SpdyPriority kDefaultPriority = 3; 14 static const net::SpdyPriority kDefaultPriority = 3;
14 15
15 // Arbitrary server port number for net::QuicCryptoClientConfig. 16 // Arbitrary server port number for net::QuicCryptoClientConfig.
16 const int kQuicServerPort = 0; 17 const int kQuicServerPort = 0;
17 18
18 // Length of HKDF input keying material, equal to its number of bytes. 19 // Length of HKDF input keying material, equal to its number of bytes.
19 // https://tools.ietf.org/html/rfc5869#section-2.2. 20 // https://tools.ietf.org/html/rfc5869#section-2.2.
20 // TODO(zhihuang): Verify that input keying material length is correct. 21 // TODO(zhihuang): Verify that input keying material length is correct.
21 const size_t kInputKeyingMaterialLength = 32; 22 const size_t kInputKeyingMaterialLength = 32;
22 23
23 // Used by QuicCryptoServerConfig to provide dummy proof credentials. 24 // Used by QuicCryptoServerConfig to provide dummy proof credentials.
24 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible. 25 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible.
25 class DummyProofSource : public net::ProofSource { 26 class DummyProofSource : public net::ProofSource {
26 public: 27 public:
27 DummyProofSource() {} 28 DummyProofSource() {}
28 ~DummyProofSource() override {} 29 ~DummyProofSource() override {}
29 30
30 // ProofSource override. 31 // ProofSource override.
31 void GetProof(const net::QuicSocketAddress& server_addr, 32 void GetProof(const net::QuicSocketAddress& server_addr,
32 const std::string& hostname, 33 const std::string& hostname,
33 const std::string& server_config, 34 const std::string& server_config,
34 net::QuicVersion quic_version, 35 net::QuicVersion quic_version,
35 base::StringPiece chlo_hash, 36 net::QuicStringPiece chlo_hash,
36 const net::QuicTagVector& connection_options, 37 const net::QuicTagVector& connection_options,
37 std::unique_ptr<Callback> callback) override { 38 std::unique_ptr<Callback> callback) override {
38 net::QuicReferenceCountedPointer<net::ProofSource::Chain> chain; 39 net::QuicReferenceCountedPointer<net::ProofSource::Chain> chain;
39 net::QuicCryptoProof proof; 40 net::QuicCryptoProof proof;
40 std::vector<std::string> certs; 41 std::vector<std::string> certs;
41 certs.push_back("Dummy cert"); 42 certs.push_back("Dummy cert");
42 chain = new ProofSource::Chain(certs); 43 chain = new ProofSource::Chain(certs);
43 proof.signature = "Dummy signature"; 44 proof.signature = "Dummy signature";
44 proof.leaf_cert_scts = "Dummy timestamp"; 45 proof.leaf_cert_scts = "Dummy timestamp";
45 callback->Run(true, chain, proof, nullptr /* details */); 46 callback->Run(true, chain, proof, nullptr /* details */);
46 } 47 }
47 }; 48 };
48 49
49 // Used by QuicCryptoClientConfig to ignore the peer's credentials 50 // Used by QuicCryptoClientConfig to ignore the peer's credentials
50 // and establish an insecure QUIC connection. 51 // and establish an insecure QUIC connection.
51 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible. 52 // TODO(zhihuang): Remove when secure P2P QUIC handshake is possible.
52 class InsecureProofVerifier : public net::ProofVerifier { 53 class InsecureProofVerifier : public net::ProofVerifier {
53 public: 54 public:
54 InsecureProofVerifier() {} 55 InsecureProofVerifier() {}
55 ~InsecureProofVerifier() override {} 56 ~InsecureProofVerifier() override {}
56 57
57 // ProofVerifier override. 58 // ProofVerifier override.
58 net::QuicAsyncStatus VerifyProof( 59 net::QuicAsyncStatus VerifyProof(
59 const std::string& hostname, 60 const std::string& hostname,
60 const uint16_t port, 61 const uint16_t port,
61 const std::string& server_config, 62 const std::string& server_config,
62 net::QuicVersion quic_version, 63 net::QuicVersion quic_version,
63 base::StringPiece chlo_hash, 64 net::QuicStringPiece chlo_hash,
64 const std::vector<std::string>& certs, 65 const std::vector<std::string>& certs,
65 const std::string& cert_sct, 66 const std::string& cert_sct,
66 const std::string& signature, 67 const std::string& signature,
67 const net::ProofVerifyContext* context, 68 const net::ProofVerifyContext* context,
68 std::string* error_details, 69 std::string* error_details,
69 std::unique_ptr<net::ProofVerifyDetails>* verify_details, 70 std::unique_ptr<net::ProofVerifyDetails>* verify_details,
70 std::unique_ptr<net::ProofVerifierCallback> callback) override { 71 std::unique_ptr<net::ProofVerifierCallback> callback) override {
71 return net::QUIC_SUCCESS; 72 return net::QUIC_SUCCESS;
72 } 73 }
73 74
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 ActivateStream(std::unique_ptr<QuicStream>(stream)); 276 ActivateStream(std::unique_ptr<QuicStream>(stream));
276 // Register the stream to the QuicWriteBlockedList. |priority| is clamped 277 // Register the stream to the QuicWriteBlockedList. |priority| is clamped
277 // between 0 and 7, with 0 being the highest priority and 7 the lowest 278 // between 0 and 7, with 0 being the highest priority and 7 the lowest
278 // priority. 279 // priority.
279 write_blocked_streams()->RegisterStream(stream->id(), priority); 280 write_blocked_streams()->RegisterStream(stream->id(), priority);
280 } 281 }
281 return stream; 282 return stream;
282 } 283 }
283 284
284 } // namespace net 285 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/platform/impl/quic_url_utils_impl.cc ('k') | net/quic/quartc/quartc_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698