summaryrefslogtreecommitdiff
path: root/apps/Gateway
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-12-31 23:33:04 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-12-31 23:33:04 +0000
commit9ce8c08f1c728d437b62aa8fb49bc6a4170e94ec (patch)
tree1a50811a7e95f472f295416354421e14e8072a1e /apps/Gateway
parentcfa8353c086d114acd8bd8bdff3ed3dba8e200b1 (diff)
downloadATCD-9ce8c08f1c728d437b62aa8fb49bc6a4170e94ec.tar.gz
*** empty log message ***
Diffstat (limited to 'apps/Gateway')
-rw-r--r--apps/Gateway/Peer/Peer.cpp57
-rw-r--r--apps/Gateway/Peer/Peer.h88
2 files changed, 81 insertions, 64 deletions
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 */