| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_data_reader.h" | 5 #include "net/quic/core/quic_data_reader.h" |
| 6 | 6 |
| 7 #include "net/base/int128.h" | 7 #include "net/base/int128.h" |
| 8 #include "net/quic/core/quic_flags.h" | 8 #include "net/quic/core/quic_flags.h" |
| 9 #include "net/quic/core/quic_packets.h" | 9 #include "net/quic/core/quic_packets.h" |
| 10 #include "net/quic/core/quic_utils.h" |
| 10 #include "net/quic/platform/api/quic_bug_tracker.h" | 11 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 11 #include "net/quic/platform/api/quic_endian.h" | 12 #include "net/quic/platform/api/quic_endian.h" |
| 12 #include "net/quic/platform/api/quic_logging.h" | 13 #include "net/quic/platform/api/quic_logging.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 | 16 |
| 16 #define ENDPOINT \ | 17 #define ENDPOINT \ |
| 17 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") | 18 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") |
| 18 | 19 |
| 19 QuicDataReader::QuicDataReader(const char* data, | 20 QuicDataReader::QuicDataReader(const char* data, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 pos_ += size; | 94 pos_ += size; |
| 94 | 95 |
| 95 return true; | 96 return true; |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool QuicDataReader::ReadConnectionId(uint64_t* connection_id) { | 99 bool QuicDataReader::ReadConnectionId(uint64_t* connection_id) { |
| 99 if (!ReadUInt64(connection_id)) { | 100 if (!ReadUInt64(connection_id)) { |
| 100 return false; | 101 return false; |
| 101 } | 102 } |
| 102 | 103 |
| 103 if (FLAGS_quic_restart_flag_quic_big_endian_connection_id) { | 104 if (QuicUtils::IsConnectionIdWireFormatBigEndian(perspective_)) { |
| 104 *connection_id = QuicEndian::NetToHost64(*connection_id); | 105 *connection_id = QuicEndian::NetToHost64(*connection_id); |
| 105 } | 106 } |
| 106 | 107 |
| 107 return true; | 108 return true; |
| 108 } | 109 } |
| 109 | 110 |
| 110 bool QuicDataReader::ReadTag(uint32_t* tag) { | 111 bool QuicDataReader::ReadTag(uint32_t* tag) { |
| 111 return ReadBytes(tag, sizeof(*tag)); | 112 return ReadBytes(tag, sizeof(*tag)); |
| 112 } | 113 } |
| 113 | 114 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 uint8_t QuicDataReader::PeekByte() const { | 159 uint8_t QuicDataReader::PeekByte() const { |
| 159 if (pos_ >= len_) { | 160 if (pos_ >= len_) { |
| 160 QUIC_BUG << "Reading is done, cannot peek next byte. Tried to read pos = " | 161 QUIC_BUG << "Reading is done, cannot peek next byte. Tried to read pos = " |
| 161 << pos_ << " buffer length = " << len_; | 162 << pos_ << " buffer length = " << len_; |
| 162 return 0; | 163 return 0; |
| 163 } | 164 } |
| 164 return data_[pos_]; | 165 return data_[pos_]; |
| 165 } | 166 } |
| 166 | 167 |
| 167 } // namespace net | 168 } // namespace net |
| OLD | NEW |