![]() |
|
|
00001 /*************************************************************************** 00002 * inspectorJ - java profiler * 00003 * Copyright (C) 2007 by James May 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00027 #ifndef AGENT_AGENT_SERVER_H 00028 #define AGENT_AGENT_SERVER_H 00029 00030 #include "inspectorj/agent/agentpackethandler.h" 00031 #include <ctime> 00032 #include <iostream> 00033 #include <string> 00034 #include <boost/date_time/posix_time/posix_time.hpp> 00035 00036 /* JAVA / JVM Includes */ 00037 00038 00039 using boost::asio::ip::tcp; 00040 using namespace inspectorj::jdwp; 00041 00042 namespace inspectorj { 00043 namespace agent { 00044 00053 class AgentServer 00054 { 00055 public: 00056 AgentServer(int portNum, AgentPacketHandler*); 00057 00058 ~AgentServer(); 00059 void start(); 00060 void stop(); 00061 bool isStarted(); 00062 00063 protected: 00064 void shutDown(); 00065 int portNum; 00066 AgentPacketHandler *pktHandler; 00067 volatile bool quit; 00068 volatile bool started; 00069 boost::system::error_code* error; 00070 tcp::socket* socket; 00071 tcp::acceptor* acceptor; 00072 AgentSocket* agentSocket; 00073 bool checkError(boost::system::error_code&); 00074 }; 00075 00076 } // end namespace agent 00077 } // end namespace inspectorj 00078 00079 #endif AGENT_AGENT_SERVER_H