TAO_ECG_UDP_Out_Endpoint Class Reference

Maintains information about an outgoing endpoint. More...

#include <ECG_UDP_Out_Endpoint.h>

Collaboration diagram for TAO_ECG_UDP_Out_Endpoint:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_ECG_UDP_Out_Endpoint (void)
 Constructor.

 ~TAO_ECG_UDP_Out_Endpoint (void)
 Constructor.

 TAO_ECG_UDP_Out_Endpoint (const TAO_ECG_UDP_Out_Endpoint &rhs)
 Copy Constructor.

TAO_ECG_UDP_Out_Endpointoperator= (const TAO_ECG_UDP_Out_Endpoint &rhs)
 Assignment operator.

ACE_SOCK_Dgramdgram (void)
CORBA::ULong next_request_id (void)
 Obtain the next request id.

CORBA::Boolean is_loopback (const ACE_INET_Addr &from)

Private Attributes

ACE_Atomic_Op< TAO_SYNCH_MUTEX,
CORBA::ULong
request_id_generator_
 The request id....

ACE_SOCK_Dgram dgram_
 The datagram....

u_short port_number_
size_t if_count_
ACE_INET_Addrifs_

Detailed Description

Maintains information about an outgoing endpoint.

UDP senders can share a single endpoint to send UDP packets, but there is more state associated with this endpoint than its datagram SAP; for instance we need to keep track of the request id.

Definition at line 46 of file ECG_UDP_Out_Endpoint.h.


Constructor & Destructor Documentation

TAO_ECG_UDP_Out_Endpoint::TAO_ECG_UDP_Out_Endpoint void   ) 
 

Constructor.

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_ECG_UDP_Out_Endpoint::~TAO_ECG_UDP_Out_Endpoint void   ) 
 

Constructor.

Definition at line 16 of file ECG_UDP_Out_Endpoint.cpp.

References ACE_SOCK::close(), and ifs_.

00017 {
00018   this->dgram_.close ();
00019 
00020   delete [] this->ifs_;
00021 }

TAO_ECG_UDP_Out_Endpoint::TAO_ECG_UDP_Out_Endpoint const TAO_ECG_UDP_Out_Endpoint rhs  ) 
 

Copy Constructor.


Member Function Documentation

ACE_SOCK_Dgram& TAO_ECG_UDP_Out_Endpoint::dgram void   ) 
 

Obtain the datagram associated with this endpoint. Clients of this class must open, and register (if necessary) this datagram.

Referenced by is_loopback().

CORBA::Boolean TAO_ECG_UDP_Out_Endpoint::is_loopback const ACE_INET_Addr from  ) 
 

The endpoint can detect if a data-gram was sent by itself, this is useful to ignore or remove messages sent by the same process.

Definition at line 24 of file ECG_UDP_Out_Endpoint.cpp.

References dgram(), ACE::get_ip_interfaces(), ACE_SOCK::get_local_addr(), ACE_INET_Addr::get_port_number(), if_count_, ifs_, ACE_INET_Addr::is_ip_equal(), and port_number_.

00025 {
00026   if (this->port_number_ == 0)
00027     {
00028       // Cache the port number...
00029       ACE_INET_Addr local_addr;
00030       if (this->dgram ().get_local_addr (local_addr) == -1)
00031         return false;
00032       this->port_number_ = local_addr.get_port_number ();
00033     }
00034 
00035   // Most of the time the port number is enough to determine if the
00036   // message is remote, only when the local port number and the remote
00037   // port number match we have to look at the local ip addresses.
00038   if (from.get_port_number () != this->port_number_)
00039     return false;
00040 
00041   if (this->ifs_ == 0)
00042     {
00043       ACE::get_ip_interfaces (this->if_count_, this->ifs_);
00044     }
00045 
00046   for (ACE_INET_Addr* i = this->ifs_;
00047        i != this->ifs_ + this->if_count_;
00048        ++i)
00049     {
00050       if (i->is_ip_equal(from))
00051         return true;
00052     }
00053   return false;
00054 }

CORBA::ULong TAO_ECG_UDP_Out_Endpoint::next_request_id void   ) 
 

Obtain the next request id.

TAO_ECG_UDP_Out_Endpoint & TAO_ECG_UDP_Out_Endpoint::operator= const TAO_ECG_UDP_Out_Endpoint rhs  ) 
 

Assignment operator.

Definition at line 57 of file ECG_UDP_Out_Endpoint.cpp.

References ACE_NEW_RETURN, dgram_, if_count_, ifs_, port_number_, and request_id_generator_.

00058 {
00059   if (this != &rhs)
00060     {
00061       this->request_id_generator_ = rhs.request_id_generator_;
00062       this->dgram_ = rhs.dgram_;
00063       this->port_number_ = rhs.port_number_;
00064       this->if_count_ = rhs.if_count_;
00065 
00066       delete [] this->ifs_;
00067       this->ifs_ = 0;
00068 
00069       if (this->if_count_ != 0)
00070         {
00071           ACE_NEW_RETURN (this->ifs_,
00072                           ACE_INET_Addr [this->if_count_],
00073                           *this);
00074           for (size_t i = 0; i < this->if_count_; ++i)
00075             this->ifs_[i] = rhs.ifs_[i];
00076         }
00077     }
00078 
00079   return *this;
00080 }


Member Data Documentation

ACE_SOCK_Dgram TAO_ECG_UDP_Out_Endpoint::dgram_ [private]
 

The datagram....

Definition at line 77 of file ECG_UDP_Out_Endpoint.h.

Referenced by operator=().

size_t TAO_ECG_UDP_Out_Endpoint::if_count_ [private]
 

Keep the list of local interfaces, needed for the is_loopback method.

Definition at line 85 of file ECG_UDP_Out_Endpoint.h.

Referenced by is_loopback(), and operator=().

ACE_INET_Addr* TAO_ECG_UDP_Out_Endpoint::ifs_ [private]
 

Definition at line 86 of file ECG_UDP_Out_Endpoint.h.

Referenced by is_loopback(), operator=(), and ~TAO_ECG_UDP_Out_Endpoint().

u_short TAO_ECG_UDP_Out_Endpoint::port_number_ [private]
 

Cache the port-number so we can quickly determine if an event is coming from another endpoint.

Definition at line 81 of file ECG_UDP_Out_Endpoint.h.

Referenced by is_loopback(), and operator=().

ACE_Atomic_Op<TAO_SYNCH_MUTEX,CORBA::ULong> TAO_ECG_UDP_Out_Endpoint::request_id_generator_ [private]
 

The request id....

Definition at line 74 of file ECG_UDP_Out_Endpoint.h.

Referenced by operator=().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 15:36:41 2008 for TAO_RTEvent by doxygen 1.3.6