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

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

Issue 2502103002: Add FIDO U2F message and packet classes (Closed)
Patch Set: Add FIDO U2F message and packet classes Created 4 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_U2F_U2F_PACKET_H_
6 #define DEVICE_U2F_U2F_PACKET_H_
7
8 #include "base/macros.h"
9 #include "net/base/io_buffer.h"
10
11 namespace device {
12 class U2fPacket : public base::RefCountedThreadSafe<U2fPacket> {
13 public:
14 static const size_t kChannelIdSize = 4;
15 // Packet size of 64 bytes + 1 byte report ID
16 static const size_t kPacketSize = 65;
17
18 U2fPacket(const std::vector<char> data,
19 const char channel_id[kChannelIdSize]);
20 scoped_refptr<net::IOBufferWithSize> GetBuffer();
21
22 protected:
23 std::vector<char> data_;
24 char channel_id_[kChannelIdSize];
25 scoped_refptr<net::IOBufferWithSize> serialized_;
26 virtual ~U2fPacket();
27
28 private:
29 friend class base::RefCountedThreadSafe<U2fPacket>;
30 };
31
32 class U2fInitPacket : public U2fPacket {
33 public:
34 U2fInitPacket(const char channel_id[kChannelIdSize],
35 const char cmd,
36 const std::vector<char> data);
37
38 protected:
39 ~U2fInitPacket() final;
40
41 private:
42 char command_;
43 };
44
45 class U2fContPacket : public U2fPacket {
46 public:
47 U2fContPacket(const char channel_id[kChannelIdSize],
48 const char sequence,
49 std::vector<char> data);
50
51 protected:
52 ~U2fContPacket() final;
53
54 private:
55 char sequence_;
56 };
57 } // namespace device
58
59 #endif // DEVICE_U2F_U2F_PACKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698