Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_MEM_Addr Class Reference

Defines a C++ wrapper facade for the shared memory transport address family format. More...

#include <MEM_Addr.h>

Inheritance diagram for ACE_MEM_Addr:

Inheritance graph
[legend]
Collaboration diagram for ACE_MEM_Addr:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_MEM_Addr (void)
 Default constructor. More...

 ACE_MEM_Addr (const ACE_MEM_Addr &)
 Copy constructor. More...

 ACE_MEM_Addr (u_short port_number)
 Creates an <ACE_INET_Addr> from a <port_number> and the remote <host_name>. More...

ACE_EXPLICIT ACE_MEM_Addr (const ACE_TCHAR port_name[])
 Creates an <ACE_INET_Addr> from a <port_name>. More...

 ~ACE_MEM_Addr (void)
 Default dtor. More...

int initialize_local (u_short port)
 default initialization routine. More...

int same_host (const ACE_INET_Addr &sap)
 Check if <sap> designate an enpoint withing the same host. More...

int set (u_short port_number, int encode=1)
int set (const ACE_TCHAR port_name[])
 Uses <getservbyname> to initialize an <ACE_INET_Addr> from a <port_name>, the remote <host_name>, and the <protocol>. More...

virtual void * get_addr (void) const
 Return a pointer to the underlying network address. More...

virtual void set_addr (void *, int len)
 Set a pointer to the address. More...

virtual int addr_to_string (ACE_TCHAR buffer[], size_t size, int ipaddr_format=1) const
 Transform the external <ACE_INET_Addr> address into string format. More...

virtual int string_to_addr (const ACE_TCHAR address[])
 Initializes the external <ACE_INET_Addr> from the <address>. More...

void set_port_number (u_short, int encode=1)
 Sets the port number. More...

u_short get_port_number (void) const
 Return the port number, converting it into host byte order. More...

int get_host_name (ACE_TCHAR hostname[], size_t hostnamelen) const
 Return the character representation of the hostname. More...

const char * get_host_name (void) const
const char * get_host_addr (void) const
 Return the "dotted decimal" external address. More...

ACE_UINT32 get_ip_address (void) const
 Return the 4-byte external IP address, converting it into host byte order. More...

const ACE_INET_Addrget_remote_addr (void) const
const ACE_INET_Addrget_local_addr (void) const
int operator== (const ACE_MEM_Addr &SAP) const
 Compare two addresses for equality. The addresses are considered equal if they contain the same IP address and port number. More...

int operator== (const ACE_INET_Addr &SAP) const
int operator!= (const ACE_MEM_Addr &SAP) const
 Compare two addresses for inequality. More...

int operator!= (const ACE_INET_Addr &SAP) const
virtual u_long hash (void) const
 Computes and returns hash value. More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

ACE_INET_Addr external_
 External INET addr used for identifying host. More...

ACE_INET_Addr internal_
 Internal INET addr for accepting/connecting. More...


Detailed Description

Defines a C++ wrapper facade for the shared memory transport address family format.

Definition at line 34 of file MEM_Addr.h.


Constructor & Destructor Documentation

ACE_MEM_Addr::ACE_MEM_Addr void   
 

Default constructor.

Definition at line 21 of file MEM_Addr.cpp.

References initialize_local.

00022   : ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
00023 {
00024   // ACE_TRACE ("ACE_MEM_Addr::ACE_MEM_Addr");
00025   this->initialize_local (0);
00026 }

ACE_MEM_Addr::ACE_MEM_Addr const ACE_MEM_Addr &   
 

Copy constructor.

Definition at line 28 of file MEM_Addr.cpp.

References ACE_TRACE, external_, internal_, and ACE_INET_Addr::set.

00029   : ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
00030 {
00031   ACE_TRACE ("ACE_MEM_Addr::ACE_MEM_Addr");
00032   this->external_.set (sa.external_);
00033   this->internal_.set (sa.internal_);
00034 }

ACE_MEM_Addr::ACE_MEM_Addr u_short    port_number
 

Creates an <ACE_INET_Addr> from a <port_number> and the remote <host_name>.

Definition at line 48 of file MEM_Addr.cpp.

References ACE_TRACE, and initialize_local.

00049   : ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
00050 {
00051   ACE_TRACE ("ACE_MEM_Addr::ACE_MEM_Addr");
00052   this->initialize_local (port_number);
00053 }

ACE_MEM_Addr::ACE_MEM_Addr const ACE_TCHAR    port_name[]
 

Creates an <ACE_INET_Addr> from a <port_name>.

Definition at line 36 of file MEM_Addr.cpp.

References ACE_TCHAR, ACE_TRACE, initialize_local, and ACE_OS_String::strtoul.

00037   : ACE_Addr (AF_INET, sizeof (ACE_MEM_Addr))
00038 {
00039   ACE_TRACE ("ACE_MEM_Addr::ACE_MEM_Addr");
00040   u_short pn
00041     = ACE_static_cast (u_short,
00042                        ACE_OS::strtoul (port_number,
00043                                         0,
00044                                         10));
00045   this->initialize_local (pn);
00046 }

ACE_INLINE ACE_MEM_Addr::~ACE_MEM_Addr void   
 

Default dtor.

Definition at line 8 of file MEM_Addr.i.

00009 {
00010 }


Member Function Documentation

int ACE_MEM_Addr::addr_to_string ACE_TCHAR    buffer[],
size_t    size,
int    ipaddr_format = 1
const [virtual]
 

Transform the external <ACE_INET_Addr> address into string format.

Definition at line 79 of file MEM_Addr.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_INET_Addr::addr_to_string, and external_.

00082 {
00083   ACE_TRACE ("ACE_MEM_Addr::addr_to_string");
00084 
00085   return this->external_.addr_to_string (s, size, ipaddr_format);
00086 }

void ACE_MEM_Addr::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Addr.

Definition at line 140 of file MEM_Addr.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TRACE, ACE_INET_Addr::dump, external_, internal_, and LM_DEBUG.

00141 {
00142   ACE_TRACE ("ACE_MEM_Addr::dump");
00143 
00144   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00145   this->external_.dump ();
00146   this->internal_.dump ();
00147   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00148 }

void * ACE_MEM_Addr::get_addr void    const [virtual]
 

Return a pointer to the underlying network address.

Reimplemented from ACE_Addr.

Definition at line 106 of file MEM_Addr.cpp.

References ACE_TRACE, external_, and ACE_INET_Addr::get_addr.

00107 {
00108   ACE_TRACE ("ACE_MEM_Addr::get_addr");
00109   return this->external_.get_addr ();
00110 }

ACE_INLINE const char * ACE_MEM_Addr::get_host_addr void    const
 

Return the "dotted decimal" external address.

Definition at line 51 of file MEM_Addr.i.

References ACE_TRACE, ACE_INET_Addr::get_host_addr, and internal_.

00052 {
00053   ACE_TRACE ("ACE_MEM_Addr::get_host_addr");
00054   return this->internal_.get_host_addr ();
00055 }

const char * ACE_MEM_Addr::get_host_name void    const
 

Return the character representation of the hostname (this version is non-reentrant since it returns a pointer to a static data area).

Definition at line 133 of file MEM_Addr.cpp.

References ACE_TRACE, external_, and ACE_INET_Addr::get_host_name.

00134 {
00135   ACE_TRACE ("ACE_MEM_Addr::get_host_name");
00136   return this->external_.get_host_name ();
00137 }

int ACE_MEM_Addr::get_host_name ACE_TCHAR    hostname[],
size_t    hostnamelen
const
 

Return the character representation of the hostname.

Definition at line 123 of file MEM_Addr.cpp.

References ACE_TCHAR, ACE_TRACE, external_, and ACE_INET_Addr::get_host_name.

Referenced by ACE_MEM_Connector::connect.

00125 {
00126   ACE_TRACE ("ACE_MEM_Addr::get_host_name");
00127   return this->external_.get_host_name (hostname, len);
00128 }

ACE_INLINE ACE_UINT32 ACE_MEM_Addr::get_ip_address void    const
 

Return the 4-byte external IP address, converting it into host byte order.

Definition at line 60 of file MEM_Addr.i.

References ACE_TRACE, external_, and ACE_INET_Addr::get_ip_address.

00061 {
00062   ACE_TRACE ("ACE_MEM_Addr::get_ip_address");
00063   return this->external_.get_ip_address ();
00064 }

ACE_INLINE const ACE_INET_Addr & ACE_MEM_Addr::get_local_addr void    const
 

Definition at line 67 of file MEM_Addr.i.

References internal_.

Referenced by ACE_MEM_Acceptor::open.

00068 {
00069   return this->internal_;
00070 }

ACE_INLINE u_short ACE_MEM_Addr::get_port_number void    const
 

Return the port number, converting it into host byte order.

Definition at line 42 of file MEM_Addr.i.

References ACE_TRACE, ACE_INET_Addr::get_port_number, and internal_.

Referenced by ACE_MEM_Connector::connect.

00043 {
00044   ACE_TRACE ("ACE_MEM_Addr::get_port_number");
00045   return this->internal_.get_port_number ();
00046 }

ACE_INLINE const ACE_INET_Addr & ACE_MEM_Addr::get_remote_addr void    const
 

Definition at line 73 of file MEM_Addr.i.

References external_.

00074 {
00075   return this->external_;
00076 }

ACE_INLINE u_long ACE_MEM_Addr::hash void    const [virtual]
 

Computes and returns hash value.

Reimplemented from ACE_Addr.

Definition at line 114 of file MEM_Addr.i.

References external_, and ACE_INET_Addr::hash.

00115 {
00116   return this->external_.hash ();
00117 }

int ACE_MEM_Addr::initialize_local u_short    port
 

default initialization routine.

Definition at line 56 of file MEM_Addr.cpp.

References ACE_LIB_TEXT, ACE_TCHAR, external_, ACE_OS::hostname, internal_, MAXHOSTNAMELEN, and ACE_INET_Addr::set.

Referenced by ACE_MEM_Addr.

00057 {
00058   ACE_TCHAR name[MAXHOSTNAMELEN + 1];
00059   if (ACE_OS::hostname (name, MAXHOSTNAMELEN+1) == -1)
00060     return -1;
00061 
00062   this->external_.set (port_number, name);
00063   this->internal_.set (port_number, ACE_LIB_TEXT ("localhost"));
00064   return 0;
00065 }

ACE_INLINE int ACE_MEM_Addr::operator!= const ACE_INET_Addr   SAP const
 

Definition at line 107 of file MEM_Addr.i.

References ACE_TRACE.

00108 {
00109   ACE_TRACE ("ACE_MEM_Addr::operator !=");
00110   return !((*this) == sap);
00111 }

ACE_INLINE int ACE_MEM_Addr::operator!= const ACE_MEM_Addr &    SAP const
 

Compare two addresses for inequality.

Definition at line 100 of file MEM_Addr.i.

References ACE_TRACE.

00101 {
00102   ACE_TRACE ("ACE_MEM_Addr::operator !=");
00103   return !((*this) == sap);
00104 }

ACE_INLINE int ACE_MEM_Addr::operator== const ACE_INET_Addr   SAP const
 

Definition at line 90 of file MEM_Addr.i.

References ACE_TRACE, and external_.

00091 {
00092   ACE_TRACE ("ACE_MEM_Addr::operator ==");
00093 
00094   return this->external_ == sap;
00095 }

ACE_INLINE int ACE_MEM_Addr::operator== const ACE_MEM_Addr &    SAP const
 

Compare two addresses for equality. The addresses are considered equal if they contain the same IP address and port number.

Definition at line 81 of file MEM_Addr.i.

References ACE_TRACE, external_, and internal_.

00082 {
00083   ACE_TRACE ("ACE_MEM_Addr::operator ==");
00084 
00085   return this->external_ == sap.external_ &&
00086     this->internal_ == sap.internal_;
00087 }

int ACE_MEM_Addr::same_host const ACE_INET_Addr   sap
 

Check if <sap> designate an enpoint withing the same host.

Definition at line 68 of file MEM_Addr.cpp.

References ACE_TRACE, external_, and ACE_INET_Addr::get_ip_address.

Referenced by ACE_MEM_Connector::connect.

00069 {
00070   ACE_TRACE ("ACE_MEM_Addr::same_host");
00071 
00072   ACE_UINT32 me = this->external_.get_ip_address ();
00073   ACE_UINT32 you = sap.get_ip_address ();
00074 
00075   return me == you;
00076 }

ACE_INLINE int ACE_MEM_Addr::set const ACE_TCHAR    port_name[]
 

Uses <getservbyname> to initialize an <ACE_INET_Addr> from a <port_name>, the remote <host_name>, and the <protocol>.

Definition at line 33 of file MEM_Addr.i.

References ACE_TCHAR, ACE_TRACE, and string_to_addr.

00034 {
00035   ACE_TRACE ("ACE_MEM_Addr::set");
00036   return this->string_to_addr (port_number);
00037 }

ACE_INLINE int ACE_MEM_Addr::set u_short    port_number,
int    encode = 1
 

Initializes an <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.

Definition at line 25 of file MEM_Addr.i.

References ACE_TRACE, and set_port_number.

Referenced by string_to_addr.

00026 {
00027   ACE_TRACE ("ACE_MEM_Addr::set");
00028   this->set_port_number (port_number, encode);
00029   return 0;
00030 }

void ACE_MEM_Addr::set_addr void *   ,
int    len
[virtual]
 

Set a pointer to the address.

Reimplemented from ACE_Addr.

Definition at line 114 of file MEM_Addr.cpp.

References ACE_TRACE, external_, internal_, ACE_INET_Addr::set_addr, and ACE_INET_Addr::set_port_number.

00115 {
00116   ACE_TRACE ("ACE_MEM_Addr::set_addr");
00117 
00118   this->external_.set_addr (addr, len);
00119   this->internal_.set_port_number (this->external_.get_port_number ());
00120 }

ACE_INLINE void ACE_MEM_Addr::set_port_number u_short   ,
int    encode = 1
 

Sets the port number.

Definition at line 15 of file MEM_Addr.i.

References ACE_TRACE, external_, internal_, and ACE_INET_Addr::set_port_number.

Referenced by ACE_MEM_Acceptor::accept, ACE_MEM_Connector::connect, ACE_MEM_Acceptor::get_local_addr, and set.

00017 {
00018   ACE_TRACE ("ACE_MEM_Addr::set_port_number");
00019 
00020   this->external_.set_port_number (port_number, encode);
00021   this->internal_.set_port_number (port_number, encode);
00022 }

int ACE_MEM_Addr::string_to_addr const ACE_TCHAR    address[] [virtual]
 

Initializes the external <ACE_INET_Addr> from the <address>.

Definition at line 91 of file MEM_Addr.cpp.

References ACE_TCHAR, ACE_TRACE, set, and ACE_OS_String::strtoul.

Referenced by set.

00092 {
00093   ACE_TRACE ("ACE_MEM_Addr::string_to_addr");
00094 
00095   u_short pn
00096     = ACE_static_cast (u_short,
00097                        ACE_OS::strtoul (s,
00098                                         0,
00099                                         10));
00100   return this->set (pn);
00101 }


Member Data Documentation

ACE_MEM_Addr::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

Definition at line 136 of file MEM_Addr.h.

ACE_INET_Addr ACE_MEM_Addr::external_ [private]
 

External INET addr used for identifying host.

Definition at line 140 of file MEM_Addr.h.

Referenced by ACE_MEM_Addr, addr_to_string, dump, get_addr, get_host_name, get_ip_address, get_remote_addr, hash, initialize_local, operator==, same_host, set_addr, and set_port_number.

ACE_INET_Addr ACE_MEM_Addr::internal_ [private]
 

Internal INET addr for accepting/connecting.

Definition at line 143 of file MEM_Addr.h.

Referenced by ACE_MEM_Addr, dump, get_host_addr, get_local_addr, get_port_number, initialize_local, operator==, set_addr, and set_port_number.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:50:16 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002