diff options
author | Steve Huston <shuston@riverace.com> | 1997-08-20 23:33:04 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 1997-08-20 23:33:04 +0000 |
commit | 3806e9352df727e3cf94c2c2080b1090654010a4 (patch) | |
tree | 44a6512b4757c4491eb58a0b0c6f32c0b0b98d25 | |
parent | caa0c8e1eab259c65514c6fcb96666f95cec6ee9 (diff) | |
download | ATCD-3806e9352df727e3cf94c2c2080b1090654010a4.tar.gz |
Moved definition of Peer_Handler from Peer.cpp to Peer.h
to help the AIX template instantiator along.
-rw-r--r-- | apps/Gateway/Peer/Peer.cpp | 75 | ||||
-rw-r--r-- | apps/Gateway/Peer/Peer.h | 77 |
2 files changed, 77 insertions, 75 deletions
diff --git a/apps/Gateway/Peer/Peer.cpp b/apps/Gateway/Peer/Peer.cpp index 1072341b02f..49b4197dddb 100644 --- a/apps/Gateway/Peer/Peer.cpp +++ b/apps/Gateway/Peer/Peer.cpp @@ -23,88 +23,13 @@ #include "ace/Get_Opt.h" #include "ace/Service_Config.h" -#include "ace/Svc_Handler.h" #include "ace/Acceptor.h" -#include "ace/SOCK_Stream.h" #include "ace/SOCK_Acceptor.h" -#include "ace/INET_Addr.h" #include "Event.h" #include "Peer.h" static int verbose = 0; -// Handle Peer events arriving as events. - -class ACE_Svc_Export Peer_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> -{ -public: - // = Initialization and termination methods. - Peer_Handler (void); - // Initialize the peer. - - ~Peer_Handler (void); - // Shutdown the Peer. - - virtual int open (void * = 0); - // Initialize the handler (called by ACE_Acceptor::handle_input()) - - virtual int handle_input (ACE_HANDLE); - // Receive and process peer events. - - virtual int put (ACE_Message_Block *, ACE_Time_Value *tv = 0); - // Send a event to a gateway (may be queued if necessary). - - virtual int handle_output (ACE_HANDLE); - // Finish sending a event when flow control conditions abate. - - virtual int handle_timeout (const ACE_Time_Value &, - const void *arg); - // Periodically send events via ACE_Reactor timer mechanism. - - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - // Perform object termination. - -protected: - typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> inherited; - - // We'll allow up to 16 megabytes to be queued per-output - // channel!!!! This is clearly a policy in search of refinement... - enum { MAX_QUEUE_SIZE = 1024 * 1024 * 16 }; - - ACE_INT32 proxy_id_; - // Proxy ID of the peer (obtained from gatewayd). For simplicity, - // in this implementation we also use the Proxy ID as the Supplier - // ID. This might change in future releases. - - virtual int nonblk_put (ACE_Message_Block *mb); - // Perform a non-blocking put(). - - virtual int recv (ACE_Message_Block *&); - // Receive an Peer event from gatewayd. - - virtual int send (ACE_Message_Block *); - // Send an Peer event to gatewayd. - - int xmit_stdin (void); - // 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. - - int await_supplier_id (void); - // Action that receives the route id. - - int await_events (void); - // Action that receives events. - - ACE_Message_Block *msg_frag_; - // 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. -}; - Peer_Handler::Peer_Handler (void) : proxy_id_ (0), msg_frag_ (0), diff --git a/apps/Gateway/Peer/Peer.h b/apps/Gateway/Peer/Peer.h index d319134a603..cea851fff26 100644 --- a/apps/Gateway/Peer/Peer.h +++ b/apps/Gateway/Peer/Peer.h @@ -5,8 +5,85 @@ #define PEER #include "ace/OS.h" +#include "ace/INET_Addr.h" +#include "ace/Message_Block.h" +#include "ace/Svc_Handler.h" +#include "ace/Synch.h" +#include "ace/SOCK_Stream.h" 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> +{ +public: + // = Initialization and termination methods. + Peer_Handler (void); + // Initialize the peer. + + ~Peer_Handler (void); + // Shutdown the Peer. + + virtual int open (void * = 0); + // Initialize the handler (called by ACE_Acceptor::handle_input()) + + virtual int handle_input (ACE_HANDLE); + // Receive and process peer events. + + virtual int put (ACE_Message_Block *, ACE_Time_Value *tv = 0); + // Send a event to a gateway (may be queued if necessary). + + virtual int handle_output (ACE_HANDLE); + // Finish sending a event when flow control conditions abate. + + virtual int handle_timeout (const ACE_Time_Value &, + const void *arg); + // Periodically send events via ACE_Reactor timer mechanism. + + virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + // Perform object termination. + +protected: + typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> inherited; + + // We'll allow up to 16 megabytes to be queued per-output + // channel!!!! This is clearly a policy in search of refinement... + enum { MAX_QUEUE_SIZE = 1024 * 1024 * 16 }; + + ACE_INT32 proxy_id_; + // Proxy ID of the peer (obtained from gatewayd). For simplicity, + // in this implementation we also use the Proxy ID as the Supplier + // ID. This might change in future releases. + + virtual int nonblk_put (ACE_Message_Block *mb); + // Perform a non-blocking put(). + + virtual int recv (ACE_Message_Block *&); + // Receive an Peer event from gatewayd. + + virtual int send (ACE_Message_Block *); + // Send an Peer event to gatewayd. + + int xmit_stdin (void); + // 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. + + int await_supplier_id (void); + // Action that receives the route id. + + int await_events (void); + // Action that receives events. + + ACE_Message_Block *msg_frag_; + // 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 */ |