Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Strategies / DIOP_Endpoint.h
blobcc3a2e8af6ac153c74cc08e8a578e273bd331426
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file DIOP_Endpoint.h
7 * DIOP implementation of PP Framework Endpoint interface.
9 * @author Michael Kircher
11 //=============================================================================
14 #ifndef TAO_DIOP_ENDPOINT_H
15 #define TAO_DIOP_ENDPOINT_H
16 #include /**/ "ace/pre.h"
18 #include "tao/orbconf.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
26 #include "tao/Strategies/strategies_export.h"
27 #include "tao/Endpoint.h"
28 #include "tao/CORBA_String.h"
29 #include "ace/INET_Addr.h"
31 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
33 class TAO_DIOP_Connection_Handler;
35 /**
36 * @class TAO_DIOP_Endpoint
38 * @brief TAO_DIOP_Endpoint
40 * DIOP-specific implementation of PP Framework Endpoint interface.
42 class TAO_Strategies_Export TAO_DIOP_Endpoint : public TAO_Endpoint
44 public:
45 friend class TAO_DIOP_Profile;
46 friend class TAO_SSLIOP_Profile;
48 /// Default constructor.
49 TAO_DIOP_Endpoint ();
51 /// Constructor. This is the most efficient constructor since it
52 /// does not require any address resolution processing.
53 TAO_DIOP_Endpoint (const char *host,
54 CORBA::UShort port,
55 const ACE_INET_Addr &addr,
56 CORBA::Short priority = TAO_INVALID_PRIORITY);
58 /// Constructor.
59 TAO_DIOP_Endpoint (const ACE_INET_Addr &addr,
60 int use_dotted_decimal_addresses);
62 /// Constructor. This constructor is used when decoding endpoints.
63 TAO_DIOP_Endpoint (const char *host,
64 CORBA::UShort port,
65 CORBA::Short priority);
67 /// Destructor.
68 ~TAO_DIOP_Endpoint () = default;
70 /**
71 * @name TAO_Endpoint Methods
73 * Please check the documentation in Endpoint.h for details.
75 //@{
76 virtual TAO_Endpoint *next ();
77 virtual int addr_to_string (char *buffer, size_t length);
78 virtual TAO_Endpoint *duplicate ();
80 /// Return true if this endpoint is equivalent to @a other_endpoint. Two
81 /// endpoints are equivalent if their port and host are the same.
82 CORBA::Boolean is_equivalent (const TAO_Endpoint *other_endpoint);
84 /// Return a hash value for this object.
85 CORBA::ULong hash ();
86 //@}
88 // Allocates memory and returns a copy of <this>
90 // = DIOP_Endpoint-specific methods.
92 /// Return a reference to the <object_addr>.
93 const ACE_INET_Addr &object_addr () const;
95 /// Return a pointer to the host string. This object maintains
96 /// ownership of this string.
97 const char *host () const;
99 /// Copy the string @a h into <host_> and return the resulting pointer.
100 /// This object maintains ownership of this string.
101 const char *host (const char *h);
103 /// Return the port number.
104 CORBA::UShort port () const;
106 /// Set the port number.
107 CORBA::UShort port (CORBA::UShort p);
109 private:
110 /// Helper method for setting INET_Addr.
111 int set (const ACE_INET_Addr &addr,
112 int use_dotted_decimal_addresses);
114 /// Helper method for object_addr () call.
115 void object_addr_i () const;
117 /// String representing the host name.
118 CORBA::String_var host_;
120 /// TCP port number.
121 CORBA::UShort port_;
123 #if defined (ACE_HAS_IPV6)
124 /// Does the host string represent an IPv6 decimal address.
125 bool is_ipv6_decimal_;
126 #endif /* ACE_HAS_IPV6 */
128 /// Cached instance of <ACE_INET_Addr> for use in making
129 /// invocations, etc.
130 mutable ACE_INET_Addr object_addr_;
132 /// Flag to indicate if the address has been resolved and set.
133 mutable bool object_addr_set_;
135 /// DIOP Endpoints can be strung into a list. Return the next
136 /// endpoint in the list, if any.
137 TAO_DIOP_Endpoint *next_;
140 TAO_END_VERSIONED_NAMESPACE_DECL
142 #if defined (__ACE_INLINE__)
143 # include "tao/Strategies/DIOP_Endpoint.inl"
144 #endif /* __ACE_INLINE__ */
146 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
148 #include /**/ "ace/post.h"
149 #endif /* TAO_DIOP_PROFILE_H */