3 //=============================================================================
7 * @author Douglas C. Schmidt
9 //=============================================================================
15 #include "../Gateway/Event.h"
16 #include "ace/svc_export.h"
21 * @brief Singleton that consolidates all Options for a peerd.
23 class ACE_Svc_Export Options
26 // = Options that can be enabled/disabled.
30 SUPPLIER_ACCEPTOR
= 02,
31 CONSUMER_ACCEPTOR
= 04,
32 SUPPLIER_CONNECTOR
= 010,
33 CONSUMER_CONNECTOR
= 020
37 static Options
*instance ();
39 /// Parse the arguments and set the options.
40 void parse_args (int argc
, ACE_TCHAR
*argv
[]);
42 // = Accessor methods.
43 /// Determine if an option is enabled.
44 int enabled (int option
) const;
47 * Our acceptor port number, i.e., the one that we passively listen
48 * on for connections to arrive from a gatewayd and create a
51 u_short
supplier_acceptor_port () const;
54 * Our acceptor port number, i.e., the one that we passively listen
55 * on for connections to arrive from a gatewayd and create a
58 u_short
consumer_acceptor_port () const;
60 /// The connector port number, i.e., the one that we use to actively
61 /// establish connections with a gatewayd and create a Supplier.
62 u_short
supplier_connector_port () const;
64 /// The connector port number, i.e., the one that we use to actively
65 /// establish connections with a gatewayd and create a Consumer.
66 u_short
consumer_connector_port () const;
68 /// Our connector port host, i.e., the host running the gatewayd
70 const ACE_TCHAR
*connector_host () const;
72 /// Duration between disconnects.
73 long timeout () const;
75 /// The maximum size of the queue.
76 long max_queue_size () const;
78 /// Returns a reference to the connection id.
79 CONNECTION_ID
&connection_id ();
84 MAX_QUEUE_SIZE
= 1024 * 1024 * 16,
85 // We'll allow up to 16 megabytes to be queued per-output
86 // channel!!!! This is clearly a policy in search of
90 // By default, disconnect the peer every minute.
96 /// Explain usage and exit.
97 void print_usage_and_die ();
100 static Options
*instance_
;
102 /// Flag to indicate if we want verbose diagnostics.
106 * The acceptor port number, i.e., the one that we passively listen
107 * on for connections to arrive from a gatewayd and create a
110 u_short supplier_acceptor_port_
;
113 * The acceptor port number, i.e., the one that we passively listen
114 * on for connections to arrive from a gatewayd and create a
117 u_short consumer_acceptor_port_
;
119 /// The connector port number, i.e., the one that we use to actively
120 /// establish connections with a gatewayd and create a Supplier.
121 u_short supplier_connector_port_
;
123 /// The connector port number, i.e., the one that we use to actively
124 /// establish connections with a gatewayd and create a Consumer.
125 u_short consumer_connector_port_
;
127 /// Our connector host, i.e., where the gatewayd process is running.
128 const ACE_TCHAR
*connector_host_
;
130 /// The amount of time to wait before disconnecting from the Peerd.
133 /// The maximum size that the queue can grow to.
134 long max_queue_size_
;
136 /// The connection id.
137 CONNECTION_ID connection_id_
;
140 #endif /* OPTIONS_H */