| 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/crypto/crypto_handshake_message.h" | 5 #include "net/quic/crypto/crypto_handshake_message.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "net/quic/crypto/crypto_framer.h" | 9 #include "net/quic/crypto/crypto_framer.h" |
| 10 #include "net/quic/crypto/crypto_protocol.h" | 10 #include "net/quic/crypto/crypto_protocol.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 if (i == index) { | 159 if (i == index) { |
| 160 *out = StringPiece(value.data(), size); | 160 *out = StringPiece(value.data(), size); |
| 161 return QUIC_NO_ERROR; | 161 return QUIC_NO_ERROR; |
| 162 } | 162 } |
| 163 | 163 |
| 164 value.remove_prefix(size); | 164 value.remove_prefix(size); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 QuicErrorCode CryptoHandshakeMessage::GetUint16(QuicTag tag, | |
| 169 uint16* out) const { | |
| 170 return GetPOD(tag, out, sizeof(uint16)); | |
| 171 } | |
| 172 | |
| 173 QuicErrorCode CryptoHandshakeMessage::GetUint32(QuicTag tag, | 168 QuicErrorCode CryptoHandshakeMessage::GetUint32(QuicTag tag, |
| 174 uint32* out) const { | 169 uint32* out) const { |
| 175 return GetPOD(tag, out, sizeof(uint32)); | 170 return GetPOD(tag, out, sizeof(uint32)); |
| 176 } | 171 } |
| 177 | 172 |
| 178 QuicErrorCode CryptoHandshakeMessage::GetUint64(QuicTag tag, | 173 QuicErrorCode CryptoHandshakeMessage::GetUint64(QuicTag tag, |
| 179 uint64* out) const { | 174 uint64* out) const { |
| 180 return GetPOD(tag, out, sizeof(uint64)); | 175 return GetPOD(tag, out, sizeof(uint64)); |
| 181 } | 176 } |
| 182 | 177 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 it != tag_value_map_.end(); ++it) { | 232 it != tag_value_map_.end(); ++it) { |
| 238 ret += string(2 * indent, ' ') + QuicUtils::TagToString(it->first) + ": "; | 233 ret += string(2 * indent, ' ') + QuicUtils::TagToString(it->first) + ": "; |
| 239 | 234 |
| 240 bool done = false; | 235 bool done = false; |
| 241 switch (it->first) { | 236 switch (it->first) { |
| 242 case kICSL: | 237 case kICSL: |
| 243 case kCFCW: | 238 case kCFCW: |
| 244 case kSFCW: | 239 case kSFCW: |
| 245 case kIRTT: | 240 case kIRTT: |
| 246 case kMSPC: | 241 case kMSPC: |
| 242 case kSRBF: |
| 247 case kSWND: | 243 case kSWND: |
| 248 // uint32 value | 244 // uint32 value |
| 249 if (it->second.size() == 4) { | 245 if (it->second.size() == 4) { |
| 250 uint32 value; | 246 uint32 value; |
| 251 memcpy(&value, it->second.data(), sizeof(value)); | 247 memcpy(&value, it->second.data(), sizeof(value)); |
| 252 ret += base::UintToString(value); | 248 ret += base::UintToString(value); |
| 253 done = true; | 249 done = true; |
| 254 } | 250 } |
| 255 break; | 251 break; |
| 256 case kKEXS: | 252 case kKEXS: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 ret += "0x" + base::HexEncode(it->second.data(), it->second.size()); | 309 ret += "0x" + base::HexEncode(it->second.data(), it->second.size()); |
| 314 } | 310 } |
| 315 ret += "\n"; | 311 ret += "\n"; |
| 316 } | 312 } |
| 317 --indent; | 313 --indent; |
| 318 ret += string(2 * indent, ' ') + ">"; | 314 ret += string(2 * indent, ' ') + ">"; |
| 319 return ret; | 315 return ret; |
| 320 } | 316 } |
| 321 | 317 |
| 322 } // namespace net | 318 } // namespace net |
| OLD | NEW |