#include <ace/INET_Addr.h>
class ACE_INET_Addr : public ACE_Addr {
public:
ACE_INET_Addr (void);
ACE_INET_Addr (const ACE_INET_Addr &);
ACE_INET_Addr (const sockaddr_in *, int len);
ACE_INET_Addr (u_short port_number, const ASYS_TCHAR host_name[]);
ACE_INET_Addr (const ASYS_TCHAR address[]);
ACE_INET_Addr ( u_short port_number, ACE_UINT32 ip_addr = INADDR_ANY );
ACE_INET_Addr ( const ASYS_TCHAR port_name[], const ASYS_TCHAR host_name[], const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp") );
ACE_INET_Addr ( const ASYS_TCHAR port_name[], ACE_UINT32 ip_addr, const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp") );
~ACE_INET_Addr (void);
int set (const ACE_INET_Addr &);
int set ( u_short port_number, const ASYS_TCHAR host_name[], int encode = 1 );
int set ( u_short port_number, ACE_UINT32 ip_addr = INADDR_ANY, int encode = 1 );
int set ( const ASYS_TCHAR port_name[], const ASYS_TCHAR host_name[], const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp") );
int set ( const ASYS_TCHAR port_name[], ACE_UINT32 ip_addr, const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp") );
int set (const ASYS_TCHAR addr[]);
int set (const sockaddr_in *, int len);
virtual void *get_addr (void) const;
virtual void set_addr (void *, int len);
virtual int addr_to_string ( ASYS_TCHAR buffer[], size_t size, int ipaddr_format = 1 ) const;
virtual int string_to_addr (const ASYS_TCHAR address[]);
void set_port_number (u_short, int encode = 1);
u_short get_port_number (void) const;
int get_host_name ( ASYS_TCHAR hostname[], size_t hostnamelen ) const;
const ASYS_TCHAR *get_host_name (void) const;
const char *get_host_addr (void) const;
ACE_UINT32 get_ip_address (void) const;
int operator == (const ACE_INET_Addr &SAP) const;
int operator != (const ACE_INET_Addr &SAP) const;
virtual u_long hash (void) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
sockaddr_in inet_addr_;
};
ACE_INET_Addr (void);
ACE_INET_Addr (const ACE_INET_Addr &);
ACE_INET_Addr (const sockaddr_in *, int len);
ACE_INET_Addr
from a sockaddr_in structure.
ACE_INET_Addr (u_short port_number, const ASYS_TCHAR host_name[]);
ACE_INET_Addr
from a port_number
and the remote
host_name
.
ACE_INET_Addr (const ASYS_TCHAR address[]);
ACE_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_INET_Addr (u_short port_number, ACE_UINT32 ip_addr = INADDR_ANY);
ACE_INET_Addr
from a port_number
and an Internet
ip_addr
. This method assumes that port_number
and ip_addr
are in host byte order.
ACE_INET_Addr (
const ASYS_TCHAR port_name[],
const ASYS_TCHAR host_name[],
const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp")
);
getservbyname
to create an ACE_INET_Addr
from a
port_name
, the remote host_name
, and the protocol
.
ACE_INET_Addr (
const ASYS_TCHAR port_name[],
ACE_UINT32 ip_addr,
const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp")
);
getservbyname
to create an ACE_INET_Addr
from a
port_name
, an Internet ip_addr
, and the protocol
. This
method assumes that ip_addr
is in host byte order.
~ACE_INET_Addr (void);
int set (const ACE_INET_Addr &);
ACE_INET_Addr
.
int set (
u_short port_number,
const ASYS_TCHAR host_name[],
int encode = 1
);
ACE_INET_Addr
from a port_number
and the
remote host_name
. 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 are passed straight through.
int set (
u_short port_number,
ACE_UINT32 ip_addr = INADDR_ANY,
int encode = 1
);
ACE_INET_Addr
from a port_number
and an
Internet ip_addr
. If encode
is enabled then port_number
and ip_addr
are converted into network byte order, otherwise
they are assumed to be in network byte order already and are
passed straight through.
int set (
const ASYS_TCHAR port_name[],
const ASYS_TCHAR host_name[],
const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp")
);
getservbyname
to initialize an ACE_INET_Addr
from a
port_name
, the remote host_name
, and the protocol
.
int set (
const ASYS_TCHAR port_name[],
ACE_UINT32 ip_addr,
const ASYS_TCHAR protocol[] = ASYS_TEXT ("tcp")
);
getservbyname
to initialize an ACE_INET_Addr
from a
port_name
, an ip_addr
, and the protocol
. This assumes that
ip_addr
is already in network byte order.
int set (const ASYS_TCHAR addr[]);
ACE_INET_Addr
from the addr
, 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.
int set (const sockaddr_in *, int len);
ACE_INET_Addr
from a sockaddr_in structure.
virtual void *get_addr (void) const;
virtual void set_addr (void *, int len);
virtual int addr_to_string (
ASYS_TCHAR buffer[],
size_t size,
int ipaddr_format = 1
) const;
ACE_INET_Addr
address into string format.
If ipaddr_format
is non-0 this produces "ip-number:port-number"
(e.g., "128.252.166.57:1234"), whereas if ipaddr_format
is 0
this produces "ip-name:port-number" (e.g.,
"tango.cs.wustl.edu:1234"). Returns -1 if the size
of the
buffer
is too small, else 0.
virtual int string_to_addr (const ASYS_TCHAR address[]);
ACE_INET_Addr
from the address
, which can be
"ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"),
"ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"),
"ip-number:port-number" (e.g., "128.252.166.57:1234"), or
"ip-number:port-name" (e.g., "128.252.166.57:telnet"). If there
is no ':' in the address
it is assumed to be a port number,
with the IP address being INADDR_ANY.
void set_port_number (u_short, int encode = 1);
encode
is enabled then port_number
is converted into network
byte order, otherwise it is assumed to be in network byte order
already and are passed straight through.
u_short get_port_number (void) const;
int get_host_name (ASYS_TCHAR hostname[], size_t hostnamelen) const;
hostname
(which is assumed to be
hostnamelen
bytes long). This version is reentrant.
const ASYS_TCHAR *get_host_name (void) const;
const char *get_host_addr (void) const;
ACE_UINT32 get_ip_address (void) const;
int operator == (const ACE_INET_Addr &SAP) const;
int operator != (const ACE_INET_Addr &SAP) const;
virtual u_long hash (void) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;