3 // ===================================================================
5 * @file SCIOP_Acceptor.h
7 * SCIOP specific acceptor processing
9 * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com>
10 * @author Keith O'Hara, Lockheed Martin ATL
12 // ===================================================================
14 #ifndef TAO_SCIOP_ACCEPTOR_H
15 #define TAO_SCIOP_ACCEPTOR_H
16 #include /**/ "ace/pre.h"
18 #include "tao/orbconf.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #if TAO_HAS_SCIOP == 1
26 #include "tao/Transport_Acceptor.h"
27 #include "tao/Strategies/SCIOP_Connection_Handler.h"
28 #include "tao/Acceptor_Impl.h"
29 #include "tao/GIOP_Message_Version.h"
31 #include "ace/SOCK_SEQPACK_Acceptor.h"
32 #include "ace/Acceptor.h"
34 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
36 // TAO SCIOP_Acceptor concrete call definition
39 * @class TAO_SCIOP_Acceptor
41 * @brief TAO_SCIOP_Acceptor
43 * The SCIOP-specific bridge class for the concrete acceptor.
45 class TAO_Strategies_Export TAO_SCIOP_Acceptor
: public TAO_Acceptor
49 TAO_SCIOP_Acceptor ();
52 ~TAO_SCIOP_Acceptor ();
54 /// @@ Helper method for the implementation repository, should go
56 const ACE_INET_Addr
& address () const;
58 /// Returns the array of endpoints in this acceptor
59 const ACE_INET_Addr
*endpoints ();
61 typedef TAO_Strategy_Acceptor
<TAO_SCIOP_Connection_Handler
, ACE_SOCK_SEQPACK_ACCEPTOR
> TAO_SCIOP_BASE_ACCEPTOR
;
62 typedef TAO_Creation_Strategy
<TAO_SCIOP_Connection_Handler
> TAO_SCIOP_CREATION_STRATEGY
;
63 typedef TAO_Concurrency_Strategy
<TAO_SCIOP_Connection_Handler
> TAO_SCIOP_CONCURRENCY_STRATEGY
;
64 typedef TAO_Accept_Strategy
<TAO_SCIOP_Connection_Handler
, ACE_SOCK_SEQPACK_ACCEPTOR
> TAO_SCIOP_ACCEPT_STRATEGY
;
67 * The TAO_Acceptor methods, check the documentation in
68 * Transport_Acceptor.h for details.
70 virtual int open (TAO_ORB_Core
*orb_core
,
75 const char *options
= 0);
76 virtual int open_default (TAO_ORB_Core
*orb_core
,
80 const char *options
= 0);
82 virtual int create_profile (const TAO::ObjectKey
&object_key
,
83 TAO_MProfile
&mprofile
,
84 CORBA::Short priority
);
85 virtual int is_collocated (const TAO_Endpoint
*endpoint
);
86 virtual CORBA::ULong
endpoint_count ();
88 virtual int object_key (IOP::TaggedProfile
&profile
,
92 * Set the host name for the given addr.
93 * A hostname may be forced by using specified_hostname. This
94 * is useful if the given address corresponds to more than one
95 * hostname and the desired one cannot be determined in any
98 int hostname (TAO_ORB_Core
*orb_core
,
101 const char *specified_hostname
= 0);
104 * Set the host name for the given address using the dotted decimal
107 int dotted_decimal_address (ACE_INET_Addr
&addr
,
112 * Implement the common part of the open*() methods. This method is
113 * virtual to allow a derived class implementation to be invoked
116 virtual int open_i (const ACE_Multihomed_INET_Addr
&addr
,
117 ACE_Reactor
*reactor
);
120 * Probe the system for available network interfaces, and initialize
121 * the <addrs_> array with an ACE_INET_Addr for each network
122 * interface. The port for each initialized ACE_INET_Addr will be
123 * set in the open_i() method. This method only gets invoked when
124 * no explicit hostname is provided in the specified endpoint.
126 int probe_interfaces (TAO_ORB_Core
*orb_core
);
129 * Split the string into hostnames separated by the plus character
132 int parse_multiple_hostnames (const char *hostnames
,
133 ACE_Array
<ACE_CString
> &hostnames_out
);
136 * Parse protocol specific options.
138 * Currently supported:
139 * portspan -- specifies the range of ports over which the acceptor
140 * should scan looking for a free port (this is convenient
141 * for situations where you might normally use an ephemeral
142 * port but can't because you're behind a firewall and don't
143 * want to permit passage on all ephemeral ports)
145 virtual int parse_options (const char *options
);
147 /// Obtain tcp properties that must be used by this acceptor, i.e.,
148 /// initialize <tcp_properties_>.
149 int init_tcp_properties ();
151 /// Helper method to add a new profile to the mprofile for
153 int create_new_profile (const TAO::ObjectKey
&object_key
,
154 TAO_MProfile
&mprofile
,
155 CORBA::Short priority
);
157 /// Helper method to create a profile that contains all of
159 int create_shared_profile (const TAO::ObjectKey
&object_key
,
160 TAO_MProfile
&mprofile
,
161 CORBA::Short priority
);
164 /// Array of ACE_INET_Addr instances, each one corresponding to a
165 /// given network interface.
166 ACE_INET_Addr
*addrs_
;
169 * The number of ports over which the acceptor should search (starting
170 * at the port specified in each element of addrs_) for an available
171 * port. This is specified via the "portspan=" option to the endpoint.
176 * Cache the information about the endpoints serviced by this
178 * There may in fact be multiple hostnames for this endpoint. For
179 * example, if the IP address is INADDR_ANY (0.0.0.0) then there
180 * will be possibly a different hostname for each interface.
184 /// The number of host names cached in the hosts_ array (equivalent
185 /// to the number of endpoints opened by this Acceptor).
186 CORBA::ULong endpoint_count_
;
189 * Override the hostname used in the ORBEndPoint.
191 char *hostname_in_ior_
;
194 * The GIOP version for this endpoint
195 * @@ Theoretically they shouldn't be here!! We need to look at a
196 * way to move this out
198 TAO_GIOP_Message_Version version_
;
201 TAO_ORB_Core
*orb_core_
;
204 /// the concrete acceptor, as a pointer to it's base class.
205 TAO_SCIOP_BASE_ACCEPTOR base_acceptor_
;
207 /// Acceptor strategies.
208 TAO_SCIOP_CREATION_STRATEGY
*creation_strategy_
;
209 TAO_SCIOP_CONCURRENCY_STRATEGY
*concurrency_strategy_
;
210 TAO_SCIOP_ACCEPT_STRATEGY
*accept_strategy_
;
213 TAO_END_VERSIONED_NAMESPACE_DECL
215 #if defined(__ACE_INLINE__)
216 #include "tao/Strategies/SCIOP_Acceptor.inl"
217 #endif /* __ACE_INLINE__ */
219 #endif /* TAO_HAS_SCIOP == 1 */
221 #include /**/ "ace/post.h"
222 #endif /* TAO_SCIOP_ACCEPTOR_H */