OLD | NEW |
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" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "net/quic/core/crypto/crypto_framer.h" | 12 #include "net/quic/core/crypto/crypto_framer.h" |
13 #include "net/quic/core/crypto/crypto_protocol.h" | 13 #include "net/quic/core/crypto/crypto_protocol.h" |
14 #include "net/quic/core/crypto/crypto_utils.h" | 14 #include "net/quic/core/crypto/crypto_utils.h" |
15 #include "net/quic/core/quic_socket_address_coder.h" | 15 #include "net/quic/core/quic_socket_address_coder.h" |
16 #include "net/quic/core/quic_utils.h" | 16 #include "net/quic/core/quic_utils.h" |
17 | 17 |
| 18 using base::ContainsKey; |
18 using base::StringPiece; | 19 using base::StringPiece; |
19 using base::StringPrintf; | 20 using base::StringPrintf; |
20 using std::string; | 21 using std::string; |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 | 24 |
24 CryptoHandshakeMessage::CryptoHandshakeMessage() : tag_(0), minimum_size_(0) {} | 25 CryptoHandshakeMessage::CryptoHandshakeMessage() : tag_(0), minimum_size_(0) {} |
25 | 26 |
26 CryptoHandshakeMessage::CryptoHandshakeMessage( | 27 CryptoHandshakeMessage::CryptoHandshakeMessage( |
27 const CryptoHandshakeMessage& other) | 28 const CryptoHandshakeMessage& other) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 StringPiece* out) const { | 105 StringPiece* out) const { |
105 QuicTagValueMap::const_iterator it = tag_value_map_.find(tag); | 106 QuicTagValueMap::const_iterator it = tag_value_map_.find(tag); |
106 if (it == tag_value_map_.end()) { | 107 if (it == tag_value_map_.end()) { |
107 return false; | 108 return false; |
108 } | 109 } |
109 *out = it->second; | 110 *out = it->second; |
110 return true; | 111 return true; |
111 } | 112 } |
112 | 113 |
113 bool CryptoHandshakeMessage::HasStringPiece(QuicTag tag) const { | 114 bool CryptoHandshakeMessage::HasStringPiece(QuicTag tag) const { |
114 return base::ContainsKey(tag_value_map_, tag); | 115 return ContainsKey(tag_value_map_, tag); |
115 } | 116 } |
116 | 117 |
117 QuicErrorCode CryptoHandshakeMessage::GetNthValue24(QuicTag tag, | 118 QuicErrorCode CryptoHandshakeMessage::GetNthValue24(QuicTag tag, |
118 unsigned index, | 119 unsigned index, |
119 StringPiece* out) const { | 120 StringPiece* out) const { |
120 StringPiece value; | 121 StringPiece value; |
121 if (!GetStringPiece(tag, &value)) { | 122 if (!GetStringPiece(tag, &value)) { |
122 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; | 123 return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; |
123 } | 124 } |
124 | 125 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 ret += "0x" + QuicUtils::HexEncode(it->second); | 322 ret += "0x" + QuicUtils::HexEncode(it->second); |
322 } | 323 } |
323 ret += "\n"; | 324 ret += "\n"; |
324 } | 325 } |
325 --indent; | 326 --indent; |
326 ret += string(2 * indent, ' ') + ">"; | 327 ret += string(2 * indent, ' ') + ">"; |
327 return ret; | 328 return ret; |
328 } | 329 } |
329 | 330 |
330 } // namespace net | 331 } // namespace net |
OLD | NEW |