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

Side by Side Diff: device/u2f/u2f_message.h

Issue 2771673002: Use vectors instead of IOBuffer for U2fPackets (Closed)
Patch Set: Modify fuzzer Created 3 years, 9 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 | « device/u2f/u2f_hid_device.cc ('k') | device/u2f/u2f_message.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef DEVICE_U2F_U2F_MESSAGE_H_ 5 #ifndef DEVICE_U2F_U2F_MESSAGE_H_
6 #define DEVICE_U2F_U2F_MESSAGE_H_ 6 #define DEVICE_U2F_U2F_MESSAGE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 U2fMessage(uint32_t channel_id, Type type, const std::vector<uint8_t>& data); 34 U2fMessage(uint32_t channel_id, Type type, const std::vector<uint8_t>& data);
35 U2fMessage(std::unique_ptr<U2fInitPacket> init_packet, size_t remaining_size); 35 U2fMessage(std::unique_ptr<U2fInitPacket> init_packet, size_t remaining_size);
36 ~U2fMessage(); 36 ~U2fMessage();
37 37
38 static std::unique_ptr<U2fMessage> Create(uint32_t channel_id, 38 static std::unique_ptr<U2fMessage> Create(uint32_t channel_id,
39 Type type, 39 Type type,
40 const std::vector<uint8_t>& data); 40 const std::vector<uint8_t>& data);
41 // Reconstruct a message from serialized message data 41 // Reconstruct a message from serialized message data
42 static std::unique_ptr<U2fMessage> CreateFromSerializedData( 42 static std::unique_ptr<U2fMessage> CreateFromSerializedData(
43 scoped_refptr<net::IOBufferWithSize> buf); 43 const std::vector<uint8_t>& buf);
44 // Pop front of queue with next packet 44 // Pop front of queue with next packet
45 scoped_refptr<net::IOBufferWithSize> PopNextPacket(); 45 scoped_refptr<net::IOBufferWithSize> PopNextPacket();
46 // Adds a continuation packet to the packet list, from the serialized 46 // Adds a continuation packet to the packet list, from the serialized
47 // response value 47 // response value
48 bool AddContinuationPacket(scoped_refptr<net::IOBufferWithSize> packet_buf); 48 bool AddContinuationPacket(const std::vector<uint8_t>& packet_buf);
49 size_t NumPackets(); 49 size_t NumPackets();
50 // Returns entire message payload 50 // Returns entire message payload
51 std::vector<uint8_t> GetMessagePayload() const; 51 std::vector<uint8_t> GetMessagePayload() const;
52 uint32_t channel_id() { return channel_id_; } 52 uint32_t channel_id() { return channel_id_; }
53 // Message construction complete 53 // Message construction complete
54 bool MessageComplete(); 54 bool MessageComplete();
55 std::list<std::unique_ptr<U2fPacket>>::const_iterator begin(); 55 std::list<std::unique_ptr<U2fPacket>>::const_iterator begin();
56 std::list<std::unique_ptr<U2fPacket>>::const_iterator end(); 56 std::list<std::unique_ptr<U2fPacket>>::const_iterator end();
57 57
58 private: 58 private:
(...skipping 14 matching lines...) Expand all
73 // Maximum payload length therefore is 64-7 + 128 * (64-5) = 7609 bytes 73 // Maximum payload length therefore is 64-7 + 128 * (64-5) = 7609 bytes
74 static constexpr size_t kMaxMessageSize = 7609; 74 static constexpr size_t kMaxMessageSize = 7609;
75 75
76 std::list<std::unique_ptr<U2fPacket>> packets_; 76 std::list<std::unique_ptr<U2fPacket>> packets_;
77 size_t remaining_size_; 77 size_t remaining_size_;
78 uint32_t channel_id_; 78 uint32_t channel_id_;
79 }; 79 };
80 } // namespace device 80 } // namespace device
81 81
82 #endif // DEVICE_U2F_U2F_MESSAGE_H_ 82 #endif // DEVICE_U2F_U2F_MESSAGE_H_
OLDNEW
« no previous file with comments | « device/u2f/u2f_hid_device.cc ('k') | device/u2f/u2f_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698