#include <ClientActivity.h>
Inheritance diagram for CODEX_KeyService::ClientActivity:


Public Types | |
| typedef CODEX_Events::DeadPileType | DeadPileType |
| Convenient typedef. | |
| typedef CODEX_Events::QType | QType |
| Convenient typedef. | |
Public Member Functions | |
| ClientActivity (int port, const CODEX_Quorum::SocketBuilder &socketBuilder, DeadPileType &deadPile, QType &eventQueue, ClientMessageHandler *destination, CODEX_Quorum::SocketBase *socket=NULL) | |
| Create a new ClientActivity. | |
| virtual | ~ClientActivity () |
| Virtual destructor. | |
| void | processRequest (CODEX_Quorum::SocketBase::StateType s) |
| When a LocalServer has activity on its socket, this method is called. | |
| bool | handler (CODEX_Events::EventAck &event) |
| Override the default acknowledgment handler. | |
| bool | handler (CODEX_Events::CloseEvent &event) |
| bool | handler (ClientResponseEvent< SignedPublicKeyMsg > &event) |
| Abstract handler for a signed PublicKeyMsg. | |
| bool | handler (ClientResponseEvent< SignedBoundNameMsg > &event) |
| Abstract handler for a signed BoundNameMsg. | |
| bool | handler (ClientResponseEvent< SignedKeyStoredMsg > &event) |
| Abstract handler for a signed KeyStoredMsg. | |
| bool | handler (ClientResponseEvent< SignedBlindKeyMsg > &event) |
| Abstract handler for a signed BlindKeyMsg. | |
| void | close () |
| Hook to tell the activity that it needs to be closed. | |
| virtual bool | handler (CloseEvent &event)=0 |
| Abstract handler for CloseEvent%s. | |
| virtual bool | handler (EventAck &event) |
| The base class is responsible for handling acknowledgements, which are relevant to whether the Activity is ready for deletion. | |
| virtual void | enable () |
| Create a socket and begin listening. | |
| virtual void | disable () |
| Stop listening and destroy the open socket. | |
| int | port () const |
| The port on which the server is listening. | |
| virtual int | set_fd (fd_set *fd_bitmap, SocketBase::StateType s) |
| Set the bitmap for this socket. | |
| virtual bool | isset_fd (const fd_set *fd_bitmap, SocketBase::StateType s) |
| Whether the bitmap is set for this socket. | |
| virtual void | processRequest (SocketBase::StateType s)=0 |
| Process incoming requests. | |
Protected Member Functions | |
| void | sendEvent (EventBase *event, Activity *source, bool failure=false) |
| void | enableTerminate () |
| This method should be called when an Activity has received a CloseEvent or other indicator that it is no longer needed. | |
| SocketBase * | socket () const |
| Returns the socket on which this server is listening. | |
| const SocketBuilder & | builder () const |
| Returns the SocketBuilder for this server. | |
| void | setSocket (SocketBase *socket) |
| Set a SocketBase for this server. | |
Protected Attributes | |
| DeadPileType & | m_deadPile |
| The pile of Activity%s to be garbage-collected. | |
| QType & | m_queue |
| The event queue. | |
It is an Activity because it emits and handles events, notably dispatching incoming and outgoing messages for its client. It is a LocalServer because it maintains a socket connected to a remote process, the client. As a LocalServer, it has all of the functionality needed for detecting when a socket is ready for reading or writing.
Definition at line 48 of file ClientActivity.h.
|
||||||||||||||||||||||||||||
|
Create a new ClientActivity.
Definition at line 35 of file ClientActivity.cc. References CODEX_KeyService::StateInfo::addClient(), CODEX_Server::ServerState::instance(), CODEX_KeyService::StateInfo::instance(), and CODEX_Quorum::LocalServer::setSocket(). |
|
|
Returns the SocketBuilder for this server.
Definition at line 120 of file LocalServer.h. Referenced by CODEX_KeyService::ClientServer::processRequest(). |
|
|
Stop listening and destroy the open socket. Derived classes needing to clean up any state on shutdown should reimplement this method. This base-class version should be called explicitly, to ensure the necessary base class cleanup. Reimplemented in CODEX_Server::InternalVerifier. Definition at line 53 of file LocalServer.cc. Referenced by CODEX_Server::InternalVerifier::disable(). |
|
|
Create a socket and begin listening. Derived classes should reimplement this to perform other service initialization tasks needed. This base-class version should be called explicitly, to ensure the necessary base class initialization. Definition at line 41 of file LocalServer.cc. References CODEX_Quorum::SocketBase::setup(). |
|
|
This method should be called when an Activity has received a CloseEvent or other indicator that it is no longer needed. Actual termination will not occur until there are no remaining events outstanding (unacknowledged). Definition at line 63 of file Activity.cc. Referenced by handler(), and processRequest(). |
|
|
The base class is responsible for handling acknowledgements, which are relevant to whether the Activity is ready for deletion. If a derived class reimpliments this method, it must call this version explicitly. Definition at line 39 of file Activity.cc. Referenced by CODEX_Events::EventAck::handle(), and handler(). |
|
|
Override the default acknowledgment handler. This activity might receive negative acknowledgments, at which point it should terminate the connection. Definition at line 177 of file ClientActivity.cc. References CODEX_Events::Activity::enableTerminate(), CODEX_Events::Activity::handler(), and CODEX_Events::Activity::sendEvent(). |
|
||||||||||||
|
Whether the bitmap is set for this socket. Some types of sockets may need to know the operation being tested. Definition at line 76 of file LocalServer.cc. References CODEX_Quorum::SocketBase::isset_fd(). |
|
|
Process incoming requests. Derived classes must implement this routine, which is called whenever a connection is made.
Implemented in CODEX_Quorum::EchoServer. |
|
|
When a LocalServer has activity on its socket, this method is called. Because we are using an event architecture to achieve concurrency, this method should be fairly light-weight (as should all). For incoming data, it performs the necessary type determinations to create events for the polymorphic ClientMessageHandler::handler() method. Definition at line 81 of file ClientActivity.cc. References CODEX_Quorum::Message::buffer(), CODEX_Events::Activity::enableTerminate(), CODEX_Quorum::Message::length(), CODEX_Events::Activity::sendEvent(), CODEX_Quorum::LocalServer::socket(), and CODEX_KeyService::ClientMessageEventBase::unmarshal(). |
|
||||||||||||||||
|
||||||||||||
|
Set the bitmap for this socket. Some types of sockets may need to know the operation being tested. Definition at line 69 of file LocalServer.cc. References CODEX_Quorum::SocketBase::set_fd(). |
|
|
Set a SocketBase for this server. Useful for servers that clone themselves. Definition at line 126 of file LocalServer.h. References CODEX_Quorum::LocalServer::socket(). Referenced by ClientActivity(), and CODEX_Server::InternalVerifier::InternalVerifier(). |
1.4.1