diff options
Diffstat (limited to 'apps/Gateway/Gateway/Event_Channel.h')
-rw-r--r-- | apps/Gateway/Gateway/Event_Channel.h | 113 |
1 files changed, 69 insertions, 44 deletions
diff --git a/apps/Gateway/Gateway/Event_Channel.h b/apps/Gateway/Gateway/Event_Channel.h index 4e7afc5d328..1ecf468addf 100644 --- a/apps/Gateway/Gateway/Event_Channel.h +++ b/apps/Gateway/Gateway/Event_Channel.h @@ -19,64 +19,95 @@ #include "Proxy_Handler_Connector.h" -template <class SUPPLIER_HANDLER, class CONSUMER_HANDLER> -class ACE_Svc_Export ACE_Event_Channel : public ACE_Event_Handler +class ACE_Svc_Export ACE_Event_Channel_Options + // = TITLE + // Maintains the options for an <ACE_Event_Channel>. +{ +public: + ACE_Event_Channel_Options (void); + // Initialization. + + int performance_window_; + // Number of seconds after connection establishment to report + // throughput. + + int blocking_semantics_; + // 0 == blocking connects, ACE_NONBLOCK == non-blocking connects. + + int socket_queue_size_; + // Size of the socket queue (0 means "use default"). +}; + +class ACE_Svc_Export ACE_Event_Channel : public ACE_Task<SYNCH_STRATEGY> // = TITLE // Define a generic Event_Channel. + // + // = DESCRIPTION { public: // = Initialization and termination methods. ACE_Event_Channel (void); ~ACE_Event_Channel (void); - int open (int argc, char *argv[]); - // Initialize the Channel. + virtual int open (void * = 0); + // Open the channel. - int close (void); + virtual int close (u_long = 0); // Close down the Channel. -private: - int parse_args (int argc, char *argv[]); - // Parse the command-line arguments. + // = Proxy management methods. + int initiate_proxy_connection (Proxy_Handler *, + ACE_Synch_Options & = ACE_Synch_Options::synch); + // Initiate the connection of the <Proxy_Handler> to its peer. - int parse_connection_config_file (void); - // Parse the connection configuration file. + int complete_proxy_connection (Proxy_Handler *); + // Complete the initialization of the <Proxy_Handler> once it's + // connected to its Peer. - int parse_consumer_config_file (void); - // Parse the consumer map configuration file. + int reinitiate_proxy_connection (Proxy_Handler *); + // Reinitiate a connection asynchronously when the Peer fails. - int initiate_connections (void); - // Initiate connections to the peers. + int bind_proxy (Proxy_Handler *); + // Bind the <Proxy_Handler> to the <connection_map_>. - virtual int handle_timeout (const ACE_Time_Value &, const void *arg); - // Perform timer-based performance profiling. + int find_proxy (ACE_INT32 conn_id, Proxy_Handler *&); + // Locate the <Proxy_Handler> with <conn_id>. - const char *connection_config_file_; - // Name of the connection configuration file. + int subscribe (const Event_Key &event_addr, + Consumer_Dispatch_Set *cds); + // Subscribe the <Consumer_Dispatch_Set> to receive events that + // match <Event_Key>. - const char *consumer_config_file_; - // Name of the consumer map configuration file. + // = Event forwarding method. + virtual int put (ACE_Message_Block *mb, ACE_Time_Value * = 0); + // Pass <mb> to the Event Channel so it can forward it to Consumers. - int active_connector_role_; - // Enabled if we are playing the role of the active Connector. + ACE_Event_Channel_Options &options (void); + // Points to the Event_Channel options. - int performance_window_; - // Number of seconds after connection establishment to report - // throughput. - - int blocking_semantics_; - // 0 == blocking connects, ACE_NONBLOCK == non-blocking connects. + int initiate_connections (void); + // Initiate connections to the peers. + +private: + virtual int svc (void); + // Run as an active object. - int debug_; - // Are we debugging? + int parse_args (int argc, char *argv[]); + // Parse the command-line arguments. - Proxy_Handler_Connector *connector_; - // This is used to establish the connections actively. + virtual int handle_timeout (const ACE_Time_Value &, + const void *arg); + // Perform timer-based performance profiling. - int socket_queue_size_; - // Size of the socket queue (0 means "use default"). + Proxy_Handler_Connector connector_; + // Used to establish the connections actively. + + // Proxy_Handler_Acceptor acceptor_; + // Used to establish the connections passively. // = Make life easier by defining typedefs. + // Note that Proxy_Handler is assumed to the base class of + // SUPPLIER_PROXY and CONSUMER_PROXY. typedef ACE_Map_Manager<ACE_INT32, Proxy_Handler *, MAP_MUTEX> CONNECTION_MAP; typedef ACE_Map_Iterator<ACE_INT32, Proxy_Handler *, MAP_MUTEX> CONNECTION_MAP_ITERATOR; typedef ACE_Map_Entry<ACE_INT32, Proxy_Handler *> CONNECTION_MAP_ENTRY; @@ -85,16 +116,10 @@ private: // Table that maps Connection IDs to Proxy_Handler *'s. Event_Forwarding_Discriminator efd_; - // Map that associates event addresses to a set of Consumer_Proxy - // *'s. -}; + // Map that associates an event to a set of Consumer_Proxy *'s. -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "Event_Channel.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Event_Channel.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + ACE_Event_Channel_Options options_; + // The options for the channel. +}; #endif /* ACE_EVENT_CHANNEL */ |