| 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" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (ret != QUIC_NO_ERROR) { | 205 if (ret != QUIC_NO_ERROR) { |
| 206 memset(out, 0, len); | 206 memset(out, 0, len); |
| 207 return ret; | 207 return ret; |
| 208 } | 208 } |
| 209 | 209 |
| 210 memcpy(out, it->second.data(), len); | 210 memcpy(out, it->second.data(), len); |
| 211 return ret; | 211 return ret; |
| 212 } | 212 } |
| 213 | 213 |
| 214 string CryptoHandshakeMessage::DebugStringInternal(size_t indent) const { | 214 string CryptoHandshakeMessage::DebugStringInternal(size_t indent) const { |
| 215 string ret = string(2 * indent, ' ') + QuicUtils::TagToString(tag_) + "<\n"; | 215 string ret = string(2 * indent, ' ') + QuicTagToString(tag_) + "<\n"; |
| 216 ++indent; | 216 ++indent; |
| 217 for (QuicTagValueMap::const_iterator it = tag_value_map_.begin(); | 217 for (QuicTagValueMap::const_iterator it = tag_value_map_.begin(); |
| 218 it != tag_value_map_.end(); ++it) { | 218 it != tag_value_map_.end(); ++it) { |
| 219 ret += string(2 * indent, ' ') + QuicUtils::TagToString(it->first) + ": "; | 219 ret += string(2 * indent, ' ') + QuicTagToString(it->first) + ": "; |
| 220 | 220 |
| 221 bool done = false; | 221 bool done = false; |
| 222 switch (it->first) { | 222 switch (it->first) { |
| 223 case kICSL: | 223 case kICSL: |
| 224 case kCFCW: | 224 case kCFCW: |
| 225 case kSFCW: | 225 case kSFCW: |
| 226 case kIRTT: | 226 case kIRTT: |
| 227 case kMSPC: | 227 case kMSPC: |
| 228 case kSRBF: | 228 case kSRBF: |
| 229 case kSWND: | 229 case kSWND: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 254 case kPDMD: | 254 case kPDMD: |
| 255 case kVER: | 255 case kVER: |
| 256 // tag lists | 256 // tag lists |
| 257 if (it->second.size() % sizeof(QuicTag) == 0) { | 257 if (it->second.size() % sizeof(QuicTag) == 0) { |
| 258 for (size_t j = 0; j < it->second.size(); j += sizeof(QuicTag)) { | 258 for (size_t j = 0; j < it->second.size(); j += sizeof(QuicTag)) { |
| 259 QuicTag tag; | 259 QuicTag tag; |
| 260 memcpy(&tag, it->second.data() + j, sizeof(tag)); | 260 memcpy(&tag, it->second.data() + j, sizeof(tag)); |
| 261 if (j > 0) { | 261 if (j > 0) { |
| 262 ret += ","; | 262 ret += ","; |
| 263 } | 263 } |
| 264 ret += "'" + QuicUtils::TagToString(tag) + "'"; | 264 ret += "'" + QuicTagToString(tag) + "'"; |
| 265 } | 265 } |
| 266 done = true; | 266 done = true; |
| 267 } | 267 } |
| 268 break; | 268 break; |
| 269 case kRREJ: | 269 case kRREJ: |
| 270 // uint32_t lists | 270 // uint32_t lists |
| 271 if (it->second.size() % sizeof(uint32_t) == 0) { | 271 if (it->second.size() % sizeof(uint32_t) == 0) { |
| 272 for (size_t j = 0; j < it->second.size(); j += sizeof(uint32_t)) { | 272 for (size_t j = 0; j < it->second.size(); j += sizeof(uint32_t)) { |
| 273 uint32_t value; | 273 uint32_t value; |
| 274 memcpy(&value, it->second.data() + j, sizeof(value)); | 274 memcpy(&value, it->second.data() + j, sizeof(value)); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ret += "0x" + QuicUtils::HexEncode(it->second); | 322 ret += "0x" + QuicUtils::HexEncode(it->second); |
| 323 } | 323 } |
| 324 ret += "\n"; | 324 ret += "\n"; |
| 325 } | 325 } |
| 326 --indent; | 326 --indent; |
| 327 ret += string(2 * indent, ' ') + ">"; | 327 ret += string(2 * indent, ' ') + ">"; |
| 328 return ret; | 328 return ret; |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace net | 331 } // namespace net |
| OLD | NEW |