# ACE_Multihomed_INET_Addr Class Reference

Extends ACE_INET_Addr with support for multi-homed addresses. More...

`#include <Multihomed_INET_Addr.h>`

Inheritance diagram for ACE_Multihomed_INET_Addr:

[legend]
Collaboration diagram for ACE_Multihomed_INET_Addr:

[legend]
List of all members.

## Public Member Functions

| ACE_Multihomed_INET_Addr (void)
| Default constructor.
| ACE_Multihomed_INET_Addr (const char address[])
| ACE_Multihomed_INET_Addr (u_short port_number, const char primary_host_name[], int encode=1, int address_family=AF_UNSPEC, const char *(secondary_host_names[])=0, size_t size=0)
| ACE_Multihomed_INET_Addr (u_short port_number, ACE_UINT32 primary_ip_addr=INADDR_ANY, int encode=1, const ACE_UINT32 *secondary_ip_addrs=0, size_t size=0)
| ACE_Multihomed_INET_Addr (u_short port_number, const wchar_t primary_host_name[], int encode=1, int address_family=AF_UNSPEC, const wchar_t *(secondary_host_names[])=0, size_t size=0)
int | set (u_short port_number, const wchar_t primary_host_name[], int encode=1, int address_family=AF_UNSPEC, const wchar_t *(secondary_host_names[])=0, size_t size=0)
| ~ACE_Multihomed_INET_Addr (void)
| Use compiler-generated copy constructor. Use compiler-generated assignment operator. Default dtor.
int | set (u_short port_number, const char primary_host_name[], int encode=1, int address_family=AF_UNSPEC, const char *(secondary_host_names[])=0, size_t size=0)
int | set (u_short port_number, ACE_UINT32 primary_ip_addr=INADDR_ANY, int encode=1, const ACE_UINT32 *secondary_ip_addrs=0, size_t size=0)
void | set_port_number (u_short, int encode=1)
size_t | get_num_secondary_addresses () const
int | get_secondary_addresses (ACE_INET_Addr *secondary_addrs, size_t size) const
void | get_addresses (sockaddr_in *addrs, size_t size) const
void | get_addresses (sockaddr_in6 *addrs, size_t size) const
| IPV6 version of the above.

## Private Attributes

ACE_Array< ACE_INET_Addr > | secondaries_

## Detailed Description

Extends ACE_INET_Addr with support for multi-homed addresses.

## Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr | ( | void |  | ) |

| Default constructor.

ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr | ( | const char | address[] | ) | `[explicit]`

| Initializes an <ace_multihomed_inet_addr> from the <address>, which can be "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or "128.252.166.57:1234"). If there is no ':' in the <address> it is assumed to be a port number, with the IP address being INADDR_ANY.

ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr | ( | u_short | port_number,
|  | const char | primary_host_name[],
|  | int | encode = `1`,
|  | int | address_family = `AF_UNSPEC`,
|  | const char * | (secondary_host_names[]) = `0`,
|  | size_t | size = `0`
| ) |

Constructs an <ace_multihomed_inet_addr> from a <port_number>, a <primary_host_name>, and an array of <secondary_host_names>. <size> is taken to be the length of the array. If <encode> is non-zero, then <port_number> is converted into network byte order; otherwise it is assumed to be in network byte order already and is passed straight through. <address_family> can be used to select IPv4/IPv6 if the OS has IPv6 capability (ACE_HAS_IPV6 is defined). To specify IPv6, use the value AF_INET6. To specify IPv4, use AF_INET.

ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr | ( | u_short | port_number,
|  | ACE_UINT32 | primary_ip_addr = `INADDR_ANY`,
|  | int | encode = `1`,
|  | const ACE_UINT32 * | secondary_ip_addrs = `0`,
|  | size_t | size = `0`
| ) |

| Constructs an <ace_multihomed_inet_addr> from a port_number, a primary_ip_addr, and an array of secondary_ip_addrs. size is taken to be the length of the array. If encode is non-zero, then the port number and the IP addresses are converted into network byte order; otherwise they are assumed to be in network byte order already and are passed straight through.

ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr | ( | u_short | port_number,
|  | const wchar_t | primary_host_name[],
|  | int | encode = `1`,
|  | int | address_family = `AF_UNSPEC`,
|  | const wchar_t * | (secondary_host_names[]) = `0`,
|  | size_t | size = `0`
| ) |

| WCHAR versions of the methods that take char's as arguments.

ACE_Multihomed_INET_Addr::~ACE_Multihomed_INET_Addr | ( | void |  | ) |

| Use compiler-generated copy constructor. Use compiler-generated assignment operator. Default dtor.

## Member Function Documentation

void ACE_Multihomed_INET_Addr::get_addresses | ( | sockaddr_in6 * | addrs,
|  | size_t | size
| ) | const

| IPV6 version of the above.

void ACE_Multihomed_INET_Addr::get_addresses | ( | sockaddr_in * | addrs,
|  | size_t | size
| ) | const

| Initialize user-supplied array <addrs> with the the current primary and secondary addresses. <size> is taken as the size of this array.

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE size_t ACE_Multihomed_INET_Addr::get_num_secondary_addresses | ( |  | ) | const

| Returns the number of secondary addresses.

int ACE_Multihomed_INET_Addr::get_secondary_addresses | ( | ACE_INET_Addr * | secondary_addrs,
|  | size_t | size
| ) | const

| Initialize user-supplied array <secondary_addrs> with the current secondary addresses. <size> is taken as the size of this array.

int ACE_Multihomed_INET_Addr::set | ( | u_short | port_number,
|  | ACE_UINT32 | primary_ip_addr = `INADDR_ANY`,
|  | int | encode = `1`,
|  | const ACE_UINT32 * | secondary_ip_addrs = `0`,
|  | size_t | size = `0`
| ) |

| Initializes an <ace_multihomed_inet_addr> from a port_number, a primary_ip_addr, and an array of secondary_ip_addrs. size is taken to be the length of the array. If encode is non-zero, then the port number and the IP addresses are converted into network byte order; otherwise they are assumed to be in network byte order already and are passed straight through.

int ACE_Multihomed_INET_Addr::set | ( | u_short | port_number,
|  | const char | primary_host_name[],
|  | int | encode = `1`,
|  | int | address_family = `AF_UNSPEC`,
|  | const char * | (secondary_host_names[]) = `0`,
|  | size_t | size = `0`
| ) |

Initializes an <ace_multihomed_inet_addr> from a <port_number>, a <primary_host_name>, and an array of <secondary_host_names>. <size> is taken to be the length of the array. If <encode> is non-zero, then <port_number> is converted into network byte order; otherwise it is assumed to be in network byte order already and is passed straight through. <address_family> can be used to select IPv4/IPv6 if the OS has IPv6 capability (ACE_HAS_IPV6 is defined). To specify IPv6, use the value AF_INET6. To specify IPv4, use AF_INET.

int ACE_Multihomed_INET_Addr::set | ( | u_short | port_number,
|  | const wchar_t | primary_host_name[],
|  | int | encode = `1`,
|  | int | address_family = `AF_UNSPEC`,
|  | const wchar_t * | (secondary_host_names[]) = `0`,
|  | size_t | size = `0`
| ) |

void ACE_Multihomed_INET_Addr::set_port_number | ( | u_short | ,
|  | int | encode = `1`
| ) |

| Sets the port number without affecting the host name. The port numbers of the primary address, and of any and all secondary addresses, are affected. If <encode> is enabled, then <port_number> is converted into network byte order, otherwise it is assumed to be in network byte order already and is passed straight through. Reimplemented from ACE_INET_Addr.

## Member Data Documentation

ACE_Array<ACE_INET_Addr> ACE_Multihomed_INET_Addr::secondaries_`[private]`

The documentation for this class was generated from the following files:

- Multihomed_INET_Addr.h
- Multihomed_INET_Addr.cpp
- Multihomed_INET_Addr.inl