diff options
-rw-r--r-- | ChangeLog-98a | 38 | ||||
-rw-r--r-- | ace/Reactor.h | 1 | ||||
-rw-r--r-- | apps/Gateway/Peer/Peer.cpp | 57 | ||||
-rw-r--r-- | apps/Gateway/Peer/Peer.h | 88 |
4 files changed, 102 insertions, 82 deletions
diff --git a/ChangeLog-98a b/ChangeLog-98a index b09c68946ea..ee2fa533bde 100644 --- a/ChangeLog-98a +++ b/ChangeLog-98a @@ -1,21 +1,8 @@ -Wed Dec 31 16:25:16 1997 Chris Cleeland <cleeland@cs.wustl.edu> - - * ace/Env_Value_T.*: Added a new template (ACE_Env_Value) which is - a typesafe encapsulation of environment variables with the ability - to provide a value to be used as a default if the variable isn't - set. An example of its use can be seen in the corresponding test, - tests/Env_Value_Test.cpp. Thanks to Carlos O'Ryan for giving me - the seed that started this. - - * tests/Env_Value_Test.cpp: Added test for the new template added - above. +Wed Dec 31 17:32:04 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * tests/Makefile: Added new Env_Value_Test test to the Makefile. - - * ace/OS.{h,i} (strtod): Added new function for converting strings - to doubles. - -Wed Dec 31 14:56:06 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> + * apps/Gateway/Peer/Peer: Moved the Peer_Acceptor into the Peer.h + file and updated the documentation to clarify what's going on + better. * examples/Reactor/Dgram/: Enhanced the examples to make sure they close() the dgram endpoint when the object is removed from the @@ -28,6 +15,23 @@ Wed Dec 31 14:56:06 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> * ace/Local_Name_Space_T.h: Updated the documentation for class ACE_Name_Space_Map to make it more clear. +Wed Dec 31 16:25:16 1997 Chris Cleeland <cleeland@cs.wustl.edu> + + * ace/Env_Value_T.*: Added a new template (ACE_Env_Value) which is + a typesafe encapsulation of environment variables with the + ability to provide a value to be used as a default if the + variable isn't set. An example of its use can be seen in the + corresponding test, tests/Env_Value_Test.cpp. Thanks to Carlos + O'Ryan for giving me the seed that started this. + + * tests/Env_Value_Test.cpp: Added test for the new template added + above. + + * tests/Makefile: Added new Env_Value_Test test to the Makefile. + + * ace/OS.{h,i} (strtod): Added new function for converting strings + to doubles. + Tue Dec 30 22:07:44 1997 David L. Levine <levine@cs.wustl.edu> * ace/High_Res_Timer.cpp (elapsed_time): added a cast in diff --git a/ace/Reactor.h b/ace/Reactor.h index ad9d8f7d9d0..32a9f4021ce 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -1,5 +1,4 @@ /* -*- C++ -*- */ - // $Id$ // ============================================================================ diff --git a/apps/Gateway/Peer/Peer.cpp b/apps/Gateway/Peer/Peer.cpp index 49b4197dddb..c1ed5c08d0f 100644 --- a/apps/Gateway/Peer/Peer.cpp +++ b/apps/Gateway/Peer/Peer.cpp @@ -1,24 +1,5 @@ // $Id$ -// These classes process Supplier/Consumer events sent from the gateway -// (gatewayd) to its various peers (peerd). These classes works as -// follows: -// -// 1. Gateway_Acceptor creates a listener endpoint and waits passively -// for gatewayd to connect with it. -// -// 2. When gatewayd connects, Peer_Acceptor creates an -// Peer_Handler object that sends/receives events from -// gatewayd. -// -// 3. The Peer_Handler waits for gatewayd to inform it of its supplier -// ID, which is prepended to all outgoing events sent from peerd. -// -// 4. Once the supplier ID is set, peerd periodically sends events to -// gatewayd. Peerd also receives and "processes" events -// forwarded to it from gatewayd. In this program, peerd -// "processes" events by writing them to stdout. - #define ACE_BUILD_SVC_DLL #include "ace/Get_Opt.h" @@ -539,44 +520,6 @@ Peer_Handler::handle_close (ACE_HANDLE, return 0; } -// A factory class that accept connections from gatewayd and -// dynamically creates a new Peer object to do the dirty work. - -class ACE_Svc_Export Peer_Acceptor : public ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR> -{ -public: - // = Initialization and termination methods. - Peer_Acceptor (void); - // Create the Peer. - - virtual int init (int argc, char *argv[]); - // Initialize the acceptor. - - virtual int info (char **, size_t) const; - // Return info about this service. - - virtual int fini (void); - // Perform termination. - - virtual int make_svc_handler (Peer_Handler *&); - // Factory method that creates the Peer_Handler once. - - virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); - // Handle various signals (e.g., SIGPIPE, SIGINT, and SIGQUIT) - - void parse_args (int argc, char *argv[]); - // Parse the command-line arguments. - -private: - Peer_Handler *peer_handler_; - // Pointer to memory allocated exactly once. - - ACE_INET_Addr addr_; - // Our addr. - - typedef ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR> inherited; -}; - Peer_Acceptor::Peer_Acceptor (void) : addr_ (ACE_DEFAULT_PEER_SERVER_PORT) { diff --git a/apps/Gateway/Peer/Peer.h b/apps/Gateway/Peer/Peer.h index cea851fff26..5238e02f91f 100644 --- a/apps/Gateway/Peer/Peer.h +++ b/apps/Gateway/Peer/Peer.h @@ -1,8 +1,42 @@ /* -*- C++ -*- */ // $Id$ -#if !defined (PEER) -#define PEER +// ============================================================================ +// +// = LIBRARY +// gateway +// +// = FILENAME +// Peer.h +// +// = DESCRIPTION +// These classes process Supplier/Consumer events sent from the +// gateway (gatewayd) to its various peers (peerd). The general +// collaboration works as follows: +// +// 1. <Peer_Acceptor> creates a listener endpoint and waits +// passively for gatewayd to connect with it. +// +// 2. When a gatewayd connects, <Peer_Acceptor> creates an +// <Peer_Handler> object that sends/receives events from +// gatewayd on that connection. +// +// 3. The <Peer_Handler> waits for gatewayd to inform it of its +// supplier ID, which is prepended to all subsequent outgoing +// events sent from peerd. +// +// 4. Once the supplier ID is set, peerd periodically sends events +// to gatewayd. Peerd also receives and "processes" events +// forwarded to it from gatewayd. In this program, peerd +// "processes" the events sent to it by writing them to stdout. +// +// = AUTHOR +// Douglas C. Schmidt +// +// ============================================================================ + +#if !defined (PEER_H) +#define PEER_H #include "ace/OS.h" #include "ace/INET_Addr.h" @@ -13,10 +47,10 @@ ACE_SVC_FACTORY_DECLARE (Peer_Acceptor) -// Handle Peer events arriving as events. - class ACE_Svc_Export Peer_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> { + // = TITLE + // Handle Peer events arriving from a Gateway. public: // = Initialization and termination methods. Peer_Handler (void); @@ -70,7 +104,8 @@ protected: // Receive a event from stdin and send it to the gateway. int (Peer_Handler::*do_action_) (void); - // Pointer-to-member-function for the current action to run in this state. + // Pointer-to-member-function for the current action to run in this + // state. int await_supplier_id (void); // Action that receives the route id. @@ -79,11 +114,50 @@ protected: // Action that receives events. ACE_Message_Block *msg_frag_; - // Keep track of event fragment to handle non-blocking recv's from gateway. + // Keep track of event fragment to handle non-blocking recv's from + // gateway. size_t total_bytes_; // The total number of bytes sent/received to the gateway. }; -#endif /* PEER */ +class ACE_Svc_Export Peer_Acceptor : public ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR> +{ + // = TITLE + // A factory class that accept connections from gatewayd and + // dynamically creates a new <Peer_Handler> object to do the work. +public: + // = Initialization and termination methods. + Peer_Acceptor (void); + // Create the Peer. + + virtual int init (int argc, char *argv[]); + // Initialize the acceptor. + + virtual int info (char **, size_t) const; + // Return info about this service. + + virtual int fini (void); + // Perform termination. + + virtual int make_svc_handler (Peer_Handler *&); + // Factory method that creates the Peer_Handler once. + + virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); + // Handle various signals (e.g., SIGPIPE, SIGINT, and SIGQUIT) + + void parse_args (int argc, char *argv[]); + // Parse the command-line arguments. + +private: + Peer_Handler *peer_handler_; + // Pointer to memory allocated exactly once. + + ACE_INET_Addr addr_; + // Our addr. + + typedef ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR> inherited; +}; + +#endif /* PEER_H */ |