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

Side by Side Diff: experimental/windows_debugger/debugger/rsp/rsp_packetizer.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2011 The Native Client SDK Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4
5 #ifndef SRC_EXPERIMENTAL_DEBUG_SERVER_COMMON_RSP_PACKETIZER_H_
6 #define SRC_EXPERIMENTAL_DEBUG_SERVER_COMMON_RSP_PACKETIZER_H_
7
8 #include <deque>
9 #include <string>
10 #include "debugger/base/debug_blob.h"
11 #include "debugger/rsp/rsp_packet_util.h"
12
13 namespace rsp {
14 class PacketConsumer {
15 public:
16 PacketConsumer() {}
17 virtual ~PacketConsumer() {}
18 virtual void OnPacket(const debug::Blob& body, bool valid_checksum) = 0;
19 virtual void OnUnexpectedChar(char unexpected_char) = 0;
20 virtual void OnBreak() = 0;
21 };
22
23 class Packetizer {
24 public:
25 Packetizer();
26 virtual ~Packetizer();
27
28 virtual void SetPacketConsumer(PacketConsumer* consumer);
29 virtual void OnData(const void* data, size_t data_length);
30 virtual void OnData(const debug::Blob& data);
31 virtual void OnData(const char* data_str); // From zero-terminated string.
32 virtual void Reset();
33 virtual bool IsIdle() const;
34
35 private:
36 enum State {IDLE, BODY, END, CHECKSUM, ESCAPE, RUNLEN};
37
38 virtual void OnChar(unsigned char c);
39 bool HexCharToint(unsigned char c, unsigned int* result);
40 virtual void AddToChecksum(unsigned char c);
41 virtual void AddCharToBody(unsigned char c);
42 virtual void AddRepeatedChars(size_t n);
43
44 State state_;
45 PacketConsumer* consumer_;
46 debug::Blob body_;
47 unsigned int calculated_checksum_;
48 unsigned int recv_checksum_;
49 };
50
51 } // namespace rsp
52
53 #endif // SRC_EXPERIMENTAL_DEBUG_SERVER_COMMON_RSP_PACKETIZER_H_
54
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698