summaryrefslogtreecommitdiff
path: root/ACE/ace/INET_Addr.h
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/ace/INET_Addr.h')
-rw-r--r--ACE/ace/INET_Addr.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/ACE/ace/INET_Addr.h b/ACE/ace/INET_Addr.h
index 94528891bbd..c1a40553754 100644
--- a/ACE/ace/INET_Addr.h
+++ b/ACE/ace/INET_Addr.h
@@ -19,6 +19,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Addr.h"
+#include <vector>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -27,6 +28,10 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
*
* @brief Defines a C++ wrapper facade for the Internet domain address
* family format.
+ *
+ * ACE_INET_Addr can hold all of the IP addresses assigned to a single name.
+ * By default it refers only to the first, if there is more than one. The
+ * next() method can make the others available in turn.
*/
class ACE_Export ACE_INET_Addr : public ACE_Addr
{
@@ -203,14 +208,14 @@ public:
int get_addr_size(void) const;
/// Set a pointer to the address.
- virtual void set_addr (void *, int len);
+ virtual void set_addr (const void *, int len);
/// Set a pointer to the address.
- virtual void set_addr (void *, int len, int map);
+ virtual void set_addr (const void *, int len, int map);
/**
* Transform the current ACE_INET_Addr address into string format.
- * If @a ipaddr_format is ttrue this produces "ip-number:port-number"
+ * If @a ipaddr_format is true this produces "ip-number:port-number"
* (e.g., "128.252.166.57:1234"), whereas if @a ipaddr_format is false
* this produces "ip-name:port-number" (e.g.,
* "tango.cs.wustl.edu:1234"). Returns -1 if the @a size of the
@@ -361,6 +366,13 @@ public:
/// Computes and returns hash value.
virtual u_long hash (void) const;
+ /// If there is another address to examine, move to it and return true;
+ /// else return false.
+ bool next (void);
+
+ /// Reset the set of address so they can be scanned again using next().
+ void reset (void);
+
/// Dump the state of an object.
void dump (void) const;
@@ -378,18 +390,22 @@ private:
int determine_type (void) const;
/// Initialize underlying inet_addr_ to default values
- void reset (void);
+ void reset_i (void);
/// Underlying representation.
/// This union uses the knowledge that the two structures share the
/// first member, sa_family (as all sockaddr structures do).
- union
+ union ip46
{
sockaddr_in in4_;
#if defined (ACE_HAS_IPV6)
sockaddr_in6 in6_;
#endif /* ACE_HAS_IPV6 */
} inet_addr_;
+ // If there is more than one address assigned to a given name, this
+ // holds all of them; one is always copied to inet_addr_.
+ std::vector<union ip46> inet_addrs_;
+ std::vector<union ip46>::iterator inet_addrs_iter_;
};
ACE_END_VERSIONED_NAMESPACE_DECL