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

Side by Side Diff: net/quic/core/crypto/crypto_handshake_message.cc

Issue 2651673004: Add quic_map_util. (Closed)
Patch Set: Created 3 years, 11 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/net.gypi ('k') | net/quic/core/crypto/quic_crypto_client_config.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/core/crypto/crypto_handshake_message.h" 5 #include "net/quic/core/crypto/crypto_handshake_message.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/stl_util.h"
10 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
11 #include "net/quic/core/crypto/crypto_framer.h" 10 #include "net/quic/core/crypto/crypto_framer.h"
12 #include "net/quic/core/crypto/crypto_protocol.h" 11 #include "net/quic/core/crypto/crypto_protocol.h"
13 #include "net/quic/core/crypto/crypto_utils.h" 12 #include "net/quic/core/crypto/crypto_utils.h"
14 #include "net/quic/core/quic_socket_address_coder.h" 13 #include "net/quic/core/quic_socket_address_coder.h"
15 #include "net/quic/core/quic_utils.h" 14 #include "net/quic/core/quic_utils.h"
15 #include "net/quic/platform/api/quic_map_util.h"
16 #include "net/quic/platform/api/quic_text_utils.h" 16 #include "net/quic/platform/api/quic_text_utils.h"
17 17
18 using base::ContainsKey;
19 using base::StringPiece; 18 using base::StringPiece;
20 using base::StringPrintf; 19 using base::StringPrintf;
21 using std::string; 20 using std::string;
22 21
23 namespace net { 22 namespace net {
24 23
25 CryptoHandshakeMessage::CryptoHandshakeMessage() : tag_(0), minimum_size_(0) {} 24 CryptoHandshakeMessage::CryptoHandshakeMessage() : tag_(0), minimum_size_(0) {}
26 25
27 CryptoHandshakeMessage::CryptoHandshakeMessage( 26 CryptoHandshakeMessage::CryptoHandshakeMessage(
28 const CryptoHandshakeMessage& other) 27 const CryptoHandshakeMessage& other)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 StringPiece* out) const { 104 StringPiece* out) const {
106 QuicTagValueMap::const_iterator it = tag_value_map_.find(tag); 105 QuicTagValueMap::const_iterator it = tag_value_map_.find(tag);
107 if (it == tag_value_map_.end()) { 106 if (it == tag_value_map_.end()) {
108 return false; 107 return false;
109 } 108 }
110 *out = it->second; 109 *out = it->second;
111 return true; 110 return true;
112 } 111 }
113 112
114 bool CryptoHandshakeMessage::HasStringPiece(QuicTag tag) const { 113 bool CryptoHandshakeMessage::HasStringPiece(QuicTag tag) const {
115 return ContainsKey(tag_value_map_, tag); 114 return QuicContainsKey(tag_value_map_, tag);
116 } 115 }
117 116
118 QuicErrorCode CryptoHandshakeMessage::GetNthValue24(QuicTag tag, 117 QuicErrorCode CryptoHandshakeMessage::GetNthValue24(QuicTag tag,
119 unsigned index, 118 unsigned index,
120 StringPiece* out) const { 119 StringPiece* out) const {
121 StringPiece value; 120 StringPiece value;
122 if (!GetStringPiece(tag, &value)) { 121 if (!GetStringPiece(tag, &value)) {
123 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; 122 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND;
124 } 123 }
125 124
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 ret += "0x" + QuicTextUtils::HexEncode(it->second); 321 ret += "0x" + QuicTextUtils::HexEncode(it->second);
323 } 322 }
324 ret += "\n"; 323 ret += "\n";
325 } 324 }
326 --indent; 325 --indent;
327 ret += string(2 * indent, ' ') + ">"; 326 ret += string(2 * indent, ' ') + ">";
328 return ret; 327 return ret;
329 } 328 }
330 329
331 } // namespace net 330 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/crypto/quic_crypto_client_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698