#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.
|
|
Constructor.
Definition at line 8 of file ECG_UDP_Out_Endpoint.i.
00009 : port_number_ (0), 00010 if_count_ (0), 00011 ifs_ (0) 00012 { 00013 } |
|
|
Constructor.
Definition at line 15 of file ECG_UDP_Out_Endpoint.cpp. References ACE_SOCK::close(), and ifs_.
|
|
|
Copy Constructor.
Definition at line 16 of file ECG_UDP_Out_Endpoint.i.
00018 : port_number_ (0), 00019 if_count_ (0), 00020 ifs_ (0) 00021 { 00022 *this = rhs; 00023 } |
|
|
Obtain the datagram associated with this endpoint. Clients of this class must open, and register (if necessary) this datagram. Definition at line 26 of file ECG_UDP_Out_Endpoint.i. Referenced by is_loopback().
00027 {
00028 return this->dgram_;
00029 }
|
|
|
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 23 of file ECG_UDP_Out_Endpoint.cpp. References dgram(), ACE_INET_Addr::get_ip_address(), ACE::get_ip_interfaces(), ACE_SOCK::get_local_addr(), ACE_INET_Addr::get_port_number(), if_count_, ifs_, and port_number_.
00024 {
00025 if (this->port_number_ == 0)
00026 {
00027 // Cache the port number...
00028 ACE_INET_Addr local_addr;
00029 if (this->dgram ().get_local_addr (local_addr) == -1)
00030 return 0;
00031 this->port_number_ = local_addr.get_port_number ();
00032 }
00033
00034 // Most of the time the port number is enough to determine if the
00035 // message is remote, only when the local port number and the remote
00036 // port number match we have to look at the local ip addresses.
00037 if (from.get_port_number () != this->port_number_)
00038 return 0;
00039
00040 if (this->ifs_ == 0)
00041 {
00042 ACE::get_ip_interfaces (this->if_count_, this->ifs_);
00043 }
00044
00045 for (ACE_INET_Addr* i = this->ifs_;
00046 i != this->ifs_ + this->if_count_;
00047 ++i)
00048 {
00049 if ((*i).get_ip_address () == from.get_ip_address ())
00050 return 1;
00051 }
00052 return 0;
00053 }
|
|
|
Obtain the next request id.
Definition at line 32 of file ECG_UDP_Out_Endpoint.i.
00033 {
00034 return this->request_id_generator_++;
00035 }
|
|
|
Assignment operator.
Definition at line 56 of file ECG_UDP_Out_Endpoint.cpp. References ACE_NEW_RETURN, dgram_, if_count_, ifs_, port_number_, and request_id_generator_.
00057 {
00058 if (this != &rhs)
00059 {
00060 this->request_id_generator_ = rhs.request_id_generator_;
00061 this->dgram_ = rhs.dgram_;
00062 this->port_number_ = rhs.port_number_;
00063 this->if_count_ = rhs.if_count_;
00064
00065 delete [] this->ifs_;
00066 this->ifs_ = 0;
00067
00068 if (this->if_count_ != 0)
00069 {
00070 ACE_NEW_RETURN (this->ifs_,
00071 ACE_INET_Addr [this->if_count_],
00072 *this);
00073 for(size_t i = 0; i < this->if_count_; ++i)
00074 {
00075 this->ifs_[i] = rhs.ifs_[i];
00076 }
00077 }
00078 }
00079
00080 return *this;
00081 }
|
|
|
The datagram....
Definition at line 77 of file ECG_UDP_Out_Endpoint.h. Referenced by operator=(). |
|
|
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=(). |
|
|
Definition at line 86 of file ECG_UDP_Out_Endpoint.h. Referenced by is_loopback(), operator=(), and ~TAO_ECG_UDP_Out_Endpoint(). |
|
|
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=(). |
|
|
The request id....
Definition at line 74 of file ECG_UDP_Out_Endpoint.h. Referenced by operator=(). |
1.3.6