ij-16.png   inspectorJ -- JavaTM Profiler
sf project site browse source checkout source
SourceForge.net Logo



inspectorj::agent::AgentServer Class Reference

#include <agentserver.h>

Collaboration diagram for inspectorj::agent::AgentServer:

Collaboration graph
[legend]
List of all members.

Detailed Description

AgentServer class handles reading and writing packets for the inspectorJ agent.

The server is started in the agent's VM INIT callback. The server will accept exactly one inspectorJ client at a time.

Author:
James May

Definition at line 53 of file agentserver.h.

Public Member Functions

 AgentServer (int portNum, AgentPacketHandler *)
 Constructor.
 ~AgentServer ()
 Destructor.
void start ()
 Start the server.
void stop ()
 Stop the server.
bool isStarted ()
 Returns true if the server is started.

Protected Member Functions

void shutDown ()
bool checkError (boost::system::error_code &)
 Check to see if an error has occurred.

Protected Attributes

int portNum
AgentPacketHandlerpktHandler
volatile bool quit
volatile bool started
boost::system::error_code * error
tcp::socket * socket
tcp::acceptor * acceptor
AgentSocketagentSocket


Constructor & Destructor Documentation

inspectorj::agent::AgentServer::AgentServer ( int  portNum,
AgentPacketHandler handler 
)

Constructor.

Parameters:
portNum The port number that the server will listen on.
handler The AgentPacketHandler to handle client commands

Definition at line 40 of file agentserver.cpp.

inspectorj::agent::AgentServer::~AgentServer (  ) 

Destructor.

Definition at line 56 of file agentserver.cpp.

References agentSocket, error, and socket.


Member Function Documentation

void inspectorj::agent::AgentServer::start (  ) 

Start the server.

This will cause the server to start listening for a client connection. Once attached, the server will begin processing commands.

Definition at line 114 of file agentserver.cpp.

References acceptor, agentSocket, inspectorj::agent::AgentPacketHandler::attachCurrentThreadToVM(), checkError(), inspectorj::agent::AgentLogger::error(), error, inspectorj::agent::AgentLogger::info(), inspectorj::jdwp::JDWP_HANDSHAKE, inspectorj::jdwp::JDWP_HANDSHAKE_LENGTH, inspectorj::jdwp::JDWP_HEADER_LENGTH, pktHandler, portNum, inspectorj::agent::AgentPacketHandler::processCommand(), quit, inspectorj::agent::AgentSocket::read(), inspectorj::agent::AgentPacketHandler::setAgentSocket(), shutDown(), socket, started, and inspectorj::agent::AgentLogger::warn().

Referenced by startServer().

void inspectorj::agent::AgentServer::stop (  ) 

Stop the server.

This is a no-op if the server is not running.

Definition at line 75 of file agentserver.cpp.

References acceptor, quit, and socket.

Referenced by Agent_OnUnload().

bool inspectorj::agent::AgentServer::isStarted (  ) 

Returns true if the server is started.

Definition at line 105 of file agentserver.cpp.

References started.

Referenced by Agent_OnUnload().

bool inspectorj::agent::AgentServer::checkError ( boost::system::error_code &  error  )  [protected]

Check to see if an error has occurred.

Parameters:
error The boost::system::error_code to check

Definition at line 256 of file agentserver.cpp.

Referenced by start().


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 17:08:13 2007 for inspectorJ by  doxygen 1.5.1