PCLISocket Class Reference

#include <cli.h>

Inheritance diagram for PCLISocket:

PCLI PObject List of all members.

Operations

bool m_singleThreadForAll
PTCPSocket m_listenSocket
PThreadm_thread
ContextMap_t m_contextBySocket
typedef std::map< PSocket *,
Context * > 
ContextMap_t
bool Listen (WORD port=0)
WORD GetPort () const
 PDECLARE_NOTIFIER (PThread, PCLISocket, ThreadMain)
bool HandleSingleThreadForAll ()
bool HandleIncoming ()

Public Member Functions

Overrides from PCLI
virtual bool Start (bool runInBackground=true)
virtual void Stop ()
virtual Context * AddContext (Context *context=NULL)
virtual void RemoveContext (Context *context)

Detailed Description

Command Line Interpreter over TCP sockets. This class allows for access and automatic creation of command line interpreter contexts from incoming TCP connections on a listening port.


Member Typedef Documentation

typedef std::map<PSocket *, Context *> PCLISocket::ContextMap_t [protected]


Constructor & Destructor Documentation

PCLISocket::PCLISocket ( WORD  port = 0,
const char *  prompt = NULL,
bool  singleThreadForAll = false 
)

PCLISocket::~PCLISocket (  ) 

PCLISocket::PCLISocket ( WORD  port = 0,
const char *  prompt = NULL,
bool  singleThreadForAll = false 
)

PCLISocket::~PCLISocket (  ) 


Member Function Documentation

virtual bool PCLISocket::Start ( bool  runInBackground = true  )  [virtual]

Start a command line interpreter. This will start listening for incoming TCP connections and create/dispatch contexts to handle them.

Parameters:
runInBackground  Spawn a thread to read and interpret commands

Reimplemented from PCLI.

virtual void PCLISocket::Stop (  )  [virtual]

Stop and clean up command line interpreters. All the running contexts threads will be stopped, closing the channels and memory cleaned up.

The listening socket is also closed and the listener dispatch thread shut down.

Reimplemented from PCLI.

virtual Context* PCLISocket::AddContext ( Context *  context = NULL  )  [virtual]

Add a command line interpreter context to the system. If context is NULL then CreateContext() is called to create one.

virtual void PCLISocket::RemoveContext ( Context *  context  )  [virtual]

Remove the command line interpreter context. The context thread is stopped, the channel closed and memory deleted.

bool PCLISocket::Listen ( WORD  port = 0  ) 

Start listening socket.

WORD PCLISocket::GetPort (  )  const [inline]

Get the port we are listing on.

PCLISocket::PDECLARE_NOTIFIER ( PThread  ,
PCLISocket  ,
ThreadMain   
) [protected]

bool PCLISocket::HandleSingleThreadForAll (  )  [protected]

bool PCLISocket::HandleIncoming (  )  [protected]


Member Data Documentation

bool PCLISocket::m_singleThreadForAll [protected]

PTCPSocket PCLISocket::m_listenSocket [protected]

PThread* PCLISocket::m_thread [protected]

ContextMap_t PCLISocket::m_contextBySocket [protected]


The documentation for this class was generated from the following file:
Generated on Mon Aug 3 20:41:53 2009 for PTLib by  doxygen 1.5.1