summaryrefslogtreecommitdiff
path: root/apps/Gateway/Gateway/Event_Channel.h
blob: 4e7afc5d328c07d7ce555f436e03f65fb046c18d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    apps
// 
// = FILENAME
//    Event_Channel.h
//
// = AUTHOR
//    Doug Schmidt 
// 
// ============================================================================

#if !defined (ACE_EVENT_CHANNEL)
#define ACE_EVENT_CHANNEL

#include "Proxy_Handler_Connector.h"

template <class SUPPLIER_HANDLER, class CONSUMER_HANDLER>
class ACE_Svc_Export ACE_Event_Channel : public ACE_Event_Handler
  // = TITLE
  //    Define a generic Event_Channel.
{
public:
  // = Initialization and termination methods.
  ACE_Event_Channel (void);
  ~ACE_Event_Channel (void);

  int open (int argc, char *argv[]);
  // Initialize the Channel.

  int close (void);
  // Close down the Channel.

private:
  int parse_args (int argc, char *argv[]);
  // Parse the command-line arguments.

  int parse_connection_config_file (void);
  // Parse the connection configuration file.

  int parse_consumer_config_file (void);
  // Parse the consumer map configuration file.

  int initiate_connections (void);
  // Initiate connections to the peers.

  virtual int handle_timeout (const ACE_Time_Value &, const void *arg);
  // Perform timer-based performance profiling.

  const char *connection_config_file_;
  // Name of the connection configuration file.

  const char *consumer_config_file_;
  // Name of the consumer map configuration file.

  int active_connector_role_;
  // Enabled if we are playing the role of the active Connector.

  int performance_window_;
  // Number of seconds after connection establishment to report
  // throughput.
  
  int blocking_semantics_;
  // 0 == blocking connects, ACE_NONBLOCK == non-blocking connects.

  int debug_;
  // Are we debugging?

  Proxy_Handler_Connector *connector_;
  // This is used to establish the connections actively.

  int socket_queue_size_;
  // Size of the socket queue (0 means "use default").

  // = Make life easier by defining typedefs.
  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;

  CONNECTION_MAP connection_map_;
  // 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.
};

#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 */

#endif /* ACE_EVENT_CHANNEL */