#include <ECG_UDP_Out_Endpoint.h>
Collaboration diagram for TAO_ECG_UDP_Out_Endpoint:
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_Endpoint & | operator= (const TAO_ECG_UDP_Out_Endpoint &rhs) |
Assignment operator. | |
ACE_SOCK_Dgram & | dgram (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_Addr * | ifs_ |
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.
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 | ) |
TAO_ECG_UDP_Out_Endpoint::TAO_ECG_UDP_Out_Endpoint | ( | const TAO_ECG_UDP_Out_Endpoint & | rhs | ) |
Copy Constructor.
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.
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 ACE::get_ip_interfaces(), ACE_INET_Addr::get_port_number(), 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 }
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 operator=().
ACE_INET_Addr* TAO_ECG_UDP_Out_Endpoint::ifs_ [private] |
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=().