| 9 | namespace osidbg |
| 10 | { |
| 11 | class DebugInterface |
| 12 | { |
| 13 | public: |
| 14 | DebugInterface(uint16_t port); |
| 15 | ~DebugInterface(); |
| 16 | |
| 17 | void SetMessageHandler( |
| 18 | std::function<bool(DebuggerToBackend const *)> messageHandler, |
| 19 | std::function<void()> connectHandler, |
| 20 | std::function<void()> disconnectHandler |
| 21 | ); |
| 22 | bool IsConnected() const; |
| 23 | void Send(BackendToDebugger const & msg); |
| 24 | void Run(); |
| 25 | void Disconnect(); |
| 26 | |
| 27 | private: |
| 28 | void Send(uint8_t * buf, uint32_t length); |
| 29 | bool ProcessMessage(uint8_t * buf, uint32_t length); |
| 30 | void MessageLoop(SOCKET sock); |
| 31 | |
| 32 | uint16_t port_; |
| 33 | SOCKET socket_; |
| 34 | SOCKET clientSocket_{ 0 }; |
| 35 | uint8_t receiveBuf_[0x10000]; |
| 36 | uint32_t receivePos_; |
| 37 | std::function<bool (DebuggerToBackend const *)> messageHandler_; |
| 38 | std::function<void ()> connectHandler_; |
| 39 | std::function<void ()> disconnectHandler_; |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected