Merge pull request #2218 from jwillemsen/jwi-pthreadsigmask
[ACE_TAO.git] / TAO / tao / Strategies / DIOP_Acceptor.h
blob2524d20a0da208676fcf74dc67ec836a9ed4569e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file DIOP_Acceptor.h
7 * DIOP specific acceptor processing
9 * @author Michael Kircher
11 //=============================================================================
14 #ifndef TAO_DIOP_ACCEPTOR_H
15 #define TAO_DIOP_ACCEPTOR_H
17 #include /**/ "ace/pre.h"
19 #include "tao/orbconf.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
27 #include "tao/Transport_Acceptor.h"
28 #include "tao/Strategies/DIOP_Connection_Handler.h"
29 #include "tao/Acceptor_Impl.h"
31 #include "tao/GIOP_Message_Version.h"
33 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
35 // TAO DIOP_Acceptor concrete call definition
37 /**
38 * @class TAO_DIOP_Acceptor
40 * @brief TAO_DIOP_Acceptor
42 * The DIOP-specific bridge class for the concrete acceptor.
44 class TAO_Strategies_Export TAO_DIOP_Acceptor : public TAO_Acceptor
46 public:
47 /// Constructor.
48 TAO_DIOP_Acceptor ();
50 /// Destructor.
51 ~TAO_DIOP_Acceptor ();
53 /// @@ Helper method for the implementation repository, should go
54 /// away
55 const ACE_INET_Addr& address () const;
57 /// Returns the array of endpoints in this acceptor
58 const ACE_INET_Addr *endpoints ();
60 /// Returns address for default endpoint
61 const ACE_INET_Addr& default_address () const;
63 /// Set address for default endpoint
64 void set_default_address (const ACE_INET_Addr& addr);
66 /**
67 * @name The TAO_Acceptor Methods
69 * Please check the documentation in Transport_Acceptor.h for details.
71 //@{
72 virtual int open (TAO_ORB_Core *orb_core,
73 ACE_Reactor *reactor,
74 int version_major,
75 int version_minor,
76 const char *address,
77 const char *options = 0);
78 virtual int open_default (TAO_ORB_Core *orb_core,
79 ACE_Reactor *reactor,
80 int version_major,
81 int version_minor,
82 const char *options = 0);
83 virtual int close ();
84 virtual int create_profile (const TAO::ObjectKey &object_key,
85 TAO_MProfile &mprofile,
86 CORBA::Short priority);
88 virtual int is_collocated (const TAO_Endpoint *endpoint);
89 virtual CORBA::ULong endpoint_count ();
91 virtual int object_key (IOP::TaggedProfile &profile,
92 TAO::ObjectKey &key);
93 //@}
95 /**
96 * Set the host name for the given addr.
97 * A hostname may be forced by using specified_hostname. This
98 * is useful if the given address corresponds to more than one
99 * hostname and the desired one cannot be determined in any
100 * other way.
102 virtual int hostname (TAO_ORB_Core *orb_core,
103 ACE_INET_Addr &addr,
104 char *&host,
105 const char *specified_hostname = 0);
108 * Set the host name for the given address using the dotted decimal
109 * format.
111 int dotted_decimal_address (ACE_INET_Addr &addr,
112 char *&host);
114 protected:
116 * Helper method
117 * Clear out 'addr' & 'specified_hostname' and initialize them based
118 * upon 'address'. If a non-zero pointer is passed in for def_type,
119 * this will be set to AF_INET6 if IPv6 support is enabled and
120 * supplied hostname is either [] or [::]. It will be set to AF_INET
121 * if the hostname is 0.0.0.0, otherwise it is set to
122 * AF_UNSPEC. This value is then passed to probe_interfaces by open.
124 int parse_address (const char *address,
125 ACE_INET_Addr &addr,
126 ACE_CString &specified_hostname,
127 int *def_type = 0);
130 * Implement the common part of the open*() methods. This method is
131 * virtual to allow a derived class implementation to be invoked
132 * instead.
134 virtual int open_i (const ACE_INET_Addr &addr,
135 ACE_Reactor *reactor);
138 * Probe the system for available network interfaces, and initialize
139 * the <addrs_> array with an ACE_INET_Addr for each network
140 * interface. The port for each initialized ACE_INET_Addr will be
141 * set in the open_i() method. This method only gets invoked when
142 * no explicit hostname is provided in the specified endpoint.
144 * The optional argument def_type is used to constrain the resulting
145 * list of interfaces to be either only IPv6 or IPv4, or both, when
146 * ACE_HAS_IPV6 is enabled and the source endpoint was an explicitly
147 * declared wildcard.
149 int probe_interfaces (TAO_ORB_Core *orb_core, int def_type = AF_UNSPEC);
152 * Parse protocol specific options.
154 * Currently supported:
155 * portspan -- specifies the range of ports over which the acceptor
156 * should scan looking for a free port (this is convenient
157 * for situations where you might normally use an ephemeral
158 * port but can't because you're behind a firewall and don't
159 * want to permit passage on all ephemeral ports)
161 virtual int parse_options (const char *options);
163 /// Helper method to add a new profile to the mprofile for
164 /// each endpoint.
165 int create_new_profile (const TAO::ObjectKey &object_key,
166 TAO_MProfile &mprofile,
167 CORBA::Short priority);
169 /// Helper method to create a profile that contains all of
170 /// our endpoints.
171 int create_shared_profile (const TAO::ObjectKey &object_key,
172 TAO_MProfile &mprofile,
173 CORBA::Short priority);
174 protected:
175 /// Array of ACE_INET_Addr instances, each one corresponding to a
176 /// given network interface.
177 ACE_INET_Addr *addrs_;
180 * The number of ports over which the acceptor should search (starting
181 * at the port specified in each element of addrs_) for an available
182 * port. This is specified via the "portspan=" option to the endpoint.
184 unsigned short port_span_;
187 * Cache the information about the endpoints serviced by this
188 * acceptor.
189 * There may in fact be multiple hostnames for this endpoint. For
190 * example, if the IP address is INADDR_ANY (0.0.0.0) then there
191 * will be possibly a different hostname for each interface.
193 char **hosts_;
195 /// The number of host names cached in the hosts_ array (equivalent
196 /// to the number of endpoints opened by this Acceptor).
197 CORBA::ULong endpoint_count_;
200 * The GIOP version for this endpoint
201 * @@ Theoretically they shouldn't be here!! We need to look at a
202 * way to move this out
204 TAO_GIOP_Message_Version version_;
206 /// ORB Core.
207 TAO_ORB_Core *orb_core_;
209 /// Address for default endpoint
210 ACE_INET_Addr default_address_;
212 private:
213 // @@ Frank: From DIOP_Acceptor.h
214 TAO_DIOP_Connection_Handler *connection_handler_;
217 TAO_END_VERSIONED_NAMESPACE_DECL
219 #if defined(__ACE_INLINE__)
220 #include "tao/Strategies/DIOP_Acceptor.inl"
221 #endif /* __ACE_INLINE__ */
223 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
225 #include /**/ "ace/post.h"
227 #endif /* TAO_DIOP_ACCEPTOR_H */