debian: added Replaces/Breaks to barrybackup-gui
[barry.git] / src / j_server.h
blob9123f93fbf778999193a387838d34f3ae6d4b037
1 ///
2 /// \file j_server.h
3 /// Java Debug server classes
4 ///
6 /*
7 Copyright (C) 2009, Nicolas VIVIEN
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYJDWP_SERVER_H__
23 #define __BARRYJDWP_SERVER_H__
25 #include "dll.h"
26 #include "j_manager.h"
27 #include "dp_codinfo.h"
28 #include "m_jvmdebug.h"
29 #include "threadwrap.h"
30 #include <string>
31 #include <memory>
34 namespace Barry { namespace JDWP {
36 class BXEXPORT JDWServer
38 public:
39 typedef void (*ConsoleCallbackType)(const std::string &);
41 private:
42 Barry::Mode::JVMDebug *jvmdebug;
44 int acceptfd;
45 int sockfd;
47 std::string address;
48 int port;
50 bool loop;
51 bool targetrunning;
53 std::string password;
55 Barry::JVMModulesList modulesList; // List of COD applications installed on the device
56 Barry::JDG::DebugFileList debugFileList; // List of debug file on the host
58 JDWAppList appList; // List of BlackBerry application (an application contents several COD files)
59 Barry::JDG::ClassList visibleClassList; // Visible class list from JDB
61 std::auto_ptr<Thread> handler;
62 ConsoleCallbackType printConsoleMessage;
64 void CommandsetProcess(Barry::Data &cmd);
66 void CommandsetVirtualMachineProcess(Barry::Data &cmd);
67 void CommandsetEventRequestProcess(Barry::Data &cmd);
69 void CommandVersion(Barry::Data &cmd);
70 void CommandIdSizes(Barry::Data &cmd);
71 void CommandAllClasses(Barry::Data &cmd);
72 void CommandAllThreads(Barry::Data &cmd);
73 void CommandSuspend(Barry::Data &cmd);
74 void CommandResume(Barry::Data &cmd);
75 void CommandClassPaths(Barry::Data &cmd);
77 void CommandSet(Barry::Data &cmd);
79 // void BackgroundDeviceProcess();
81 protected:
83 public:
84 JDWServer(Barry::Mode::JVMDebug &device, const char *address, int port);
85 ~JDWServer();
87 void SetPasswordDevice(std::string password);
89 void SetConsoleCallback(ConsoleCallbackType callback);
91 bool Start(); // starts new thread
92 bool AcceptConnection();
93 bool AttachToDevice();
94 bool InitVisibleClassList();
95 bool Hello();
96 void Run(volatile bool &stopflag);
97 void DetachFromDevice();
98 bool Stop(); // cancels thread if still running, and
99 // cleans up Start()
102 }} // namespace Barry::JDWP
104 #endif