summaryrefslogtreecommitdiff
path: root/ace/INET_Addr.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/INET_Addr.h')
-rw-r--r--ace/INET_Addr.h60
1 files changed, 47 insertions, 13 deletions
diff --git a/ace/INET_Addr.h b/ace/INET_Addr.h
index 25f3ad1049c..25847d3a5aa 100644
--- a/ace/INET_Addr.h
+++ b/ace/INET_Addr.h
@@ -27,6 +27,14 @@
# include /**/ "inetLib.h"
#endif /* VXWORKS */
+// I don't know if this is a good place to put this, but it's
+// the most logical.
+#if defined (ACE_HAS_IPV6)
+#define ACE_ADDRESS_FAMILY AF_INET6
+#else
+#define ACE_ADDRESS_FAMILY AF_INET
+#endif
+
/**
* @class ACE_INET_Addr
*
@@ -66,12 +74,12 @@ public:
* are in host byte order.
*/
ACE_INET_Addr (u_short port_number,
- ACE_UINT32 ip_addr = INADDR_ANY);
+ ACE_UINT32 ip_addr = INADDR_ANY);
/// Uses <getservbyname> to create an <ACE_INET_Addr> from a
/// <port_name>, the remote <host_name>, and the <protocol>.
ACE_INET_Addr (const char port_name[],
- const char host_name[],
+ const char host_name[],
const char protocol[] = "tcp");
/**
@@ -80,7 +88,7 @@ public:
* method assumes that <ip_addr> is in host byte order.
*/
ACE_INET_Addr (const char port_name[],
- ACE_UINT32 ip_addr,
+ ACE_UINT32 ip_addr,
const char protocol[] = "tcp");
#if defined (ACE_HAS_WCHAR)
@@ -90,11 +98,11 @@ public:
ACE_EXPLICIT ACE_INET_Addr (const wchar_t address[]);
ACE_INET_Addr (const wchar_t port_name[],
- const wchar_t host_name[],
+ const wchar_t host_name[],
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
ACE_INET_Addr (const wchar_t port_name[],
- ACE_UINT32 ip_addr,
+ ACE_UINT32 ip_addr,
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
#endif /* ACE_HAS_WCHAR */
@@ -115,7 +123,7 @@ public:
* in network byte order already and are passed straight through.
*/
int set (u_short port_number,
- const char host_name[],
+ const char host_name[],
int encode = 1);
/**
@@ -132,7 +140,7 @@ public:
/// Uses <getservbyname> to initialize an <ACE_INET_Addr> from a
/// <port_name>, the remote <host_name>, and the <protocol>.
int set (const char port_name[],
- const char host_name[],
+ const char host_name[],
const char protocol[] = "tcp");
/**
@@ -141,7 +149,7 @@ public:
* <ip_addr> is already in network byte order.
*/
int set (const char port_name[],
- ACE_UINT32 ip_addr,
+ ACE_UINT32 ip_addr,
const char protocol[] = "tcp");
/**
@@ -155,19 +163,19 @@ public:
/// Creates an <ACE_INET_Addr> from a sockaddr_in structure.
int set (const sockaddr_in *,
- int len);
+ int len);
#if defined (ACE_HAS_WCHAR)
int set (u_short port_number,
- const wchar_t host_name[],
+ const wchar_t host_name[],
int encode = 1);
int set (const wchar_t port_name[],
- const wchar_t host_name[],
+ const wchar_t host_name[],
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
int set (const wchar_t port_name[],
- ACE_UINT32 ip_addr,
+ ACE_UINT32 ip_addr,
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
int set (const wchar_t addr[]);
@@ -216,7 +224,18 @@ public:
* already and are passed straight through.
*/
void set_port_number (u_short,
- int encode = 1);
+ int encode = 1);
+
+ /**
+ * Sets the address without affecting the port number. If
+ * <encode> is enabled then <ip_addr> is converted into network
+ * byte order, otherwise it is assumed to be in network byte order
+ * already and are passed straight through. The size of the address
+ * is specified in the <len> parameter.
+ */
+ int set_address (const char *ip_addr,
+ int len,
+ int encode = 1);
/// Return the port number, converting it into host byte order.
u_short get_port_number (void) const;
@@ -243,6 +262,7 @@ public:
/// Return the "dotted decimal" Internet address.
const char *get_host_addr (void) const;
+ const char *get_host_addr (char *dst, int size) const;
/// Return the 4-byte IP address, converting it into host byte
/// order.
@@ -273,8 +293,22 @@ public:
ACE_ALLOC_HOOK_DECLARE;
private:
+ // Methods to gain access to the actual address of
+ // the underlying internet address structure.
+ void *addr_pointer(void) const;
+ size_t addr_size(void) const;
+
+ // Initialize the underlying internet address structure.
+ // This sets the structure to zeros and sets the address
+ // family.
+ void initialize(void);
+
/// Underlying representation.
+#if defined (ACE_HAS_IPV6)
+ sockaddr_in6 inet_addr_;
+#else
sockaddr_in inet_addr_;
+#endif
#if defined (VXWORKS)
char buf_[INET_ADDR_LEN];