DebugServer2
Loading...
Searching...
No Matches
PacketProcessor.h
1//
2// Copyright (c) 2014-present, Facebook, Inc.
3// All rights reserved.
4//
5// This source code is licensed under the University of Illinois/NCSA Open
6// Source License found in the LICENSE file in the root directory of this
7// source tree. An additional grant of patent rights can be found in the
8// PATENTS file in the same directory.
9//
10
11#pragma once
12
13#include "DebugServer2/Types.h"
14
15namespace ds2 {
16namespace GDBRemote {
17
18struct PacketProcessorDelegate;
19
21public:
22 virtual ~PacketProcessor() {}
23
24protected:
25 std::string _buffer;
26 size_t _nreqs;
27 bool _needhash;
28 PacketProcessorDelegate *_delegate;
29
30public:
32
33public:
34 inline void setDelegate(PacketProcessorDelegate *delegate) {
35 _delegate = delegate;
36 }
37 inline PacketProcessorDelegate *delegate() const {
38 return const_cast<PacketProcessor *>(this)->_delegate;
39 }
40
41public:
42 void parse(std::string const &data);
43
44private:
45 void process();
46
47private:
48 bool validate();
49};
50
52 virtual ~PacketProcessorDelegate() {}
53 virtual void onPacketData(std::string const &data, bool valid) = 0;
54 virtual void onInvalidData(std::string const &data) = 0;
55};
56} // namespace GDBRemote
57} // namespace ds2
Definition PacketProcessor.h:20
Definition PacketProcessor.h:51