#include <Name_Proxy.h>
Inheritance diagram for ACE_Name_Proxy:
Public Member Functions | |
ACE_Name_Proxy (void) | |
Default constructor. | |
ACE_Name_Proxy (const ACE_INET_Addr &remote_addr, ACE_Synch_Options &options=ACE_Synch_Options::defaults) | |
int | open (const ACE_INET_Addr &remote_addr, ACE_Synch_Options &options=ACE_Synch_Options::defaults) |
int | request_reply (ACE_Name_Request &request) |
Perform the request and wait for the reply. | |
int | send_request (ACE_Name_Request &request) |
Perform the request. | |
int | recv_reply (ACE_Name_Request &reply) |
Receive the reply. | |
virtual ACE_HANDLE | get_handle (void) const |
Obtain underlying handle. | |
virtual | ~ACE_Name_Proxy (void) |
Close down the connection to the server. | |
void | dump (void) const |
Dump the state of the object;. | |
Private Member Functions | |
ACE_Name_Proxy (const ACE_Name_Proxy &) | |
ACE_Name_Proxy & | operator= (const ACE_Name_Proxy &) |
Private Attributes | |
ACE_SOCK_Connector | connector_ |
ACE_Connector factory used to establish connections actively. | |
ACE_SOCK_Stream | peer_ |
Connection to ACE_Name Server peer. | |
ACE_Reactor * | reactor_ |
Pointer to ACE_Reactor (used if we are run in "reactive-mode"). |
Shields applications from details of interacting with the ACE_Name Server.
Definition at line 48 of file Name_Proxy.h.
|
Default constructor.
Definition at line 27 of file Name_Proxy.cpp. References ACE_TRACE.
|
|
Definition at line 53 of file Name_Proxy.cpp. References ACE_ERROR, ACE_TEXT, ACE_TRACE, EWOULDBLOCK, LM_ERROR, and open().
00056 : reactor_ (0) 00057 { 00058 ACE_TRACE ("ACE_Name_Proxy::ACE_Name_Proxy"); 00059 if (this->open (remote_addr, options) == -1 00060 && options[ACE_Synch_Options::USE_TIMEOUT] && errno != EWOULDBLOCK) 00061 ACE_ERROR ((LM_ERROR, 00062 ACE_TEXT ("%p\n"), 00063 ACE_TEXT ("ACE_Name_Proxy::ACE_Name_Proxy"))); 00064 } |
|
Close down the connection to the server.
Definition at line 203 of file Name_Proxy.cpp. References ACE_TRACE, and ACE_SOCK_Stream::close().
|
|
|
|
Dump the state of the object;.
Definition at line 12 of file Name_Proxy.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, ACE_SOCK_Stream::dump(), ACE_SOCK_Connector::dump(), and LM_DEBUG. Referenced by ACE_Remote_Name_Space::dump().
00013 { 00014 #if defined (ACE_HAS_DUMP) 00015 ACE_TRACE ("ACE_Name_Proxy::dump"); 00016 00017 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00018 this->connector_.dump (); 00019 this->peer_.dump (); 00020 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("reactor_ = %x"), this->reactor_)); 00021 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00022 #endif /* ACE_HAS_DUMP */ 00023 } |
|
Obtain underlying handle.
Reimplemented from ACE_Event_Handler. Definition at line 69 of file Name_Proxy.cpp. References ACE_TRACE, and ACE_IPC_SAP::get_handle().
00070 { 00071 ACE_TRACE ("ACE_Name_Proxy::get_handle"); 00072 return this->peer_.get_handle (); 00073 } |
|
Definition at line 36 of file Name_Proxy.cpp. References ACE_TRACE, ACE_SOCK_Connector::connect(), and ACE_Synch_Options::time_value(). Referenced by ACE_Name_Proxy(), and ACE_Remote_Name_Space::open().
00038 { 00039 ACE_TRACE ("ACE_Name_Proxy::open"); 00040 ACE_Time_Value *timeout = 0; 00041 00042 if (options[ACE_Synch_Options::USE_TIMEOUT]) 00043 timeout = const_cast<ACE_Time_Value *> (options.time_value ()); 00044 00045 // Initiate the connection. 00046 return this->connector_.connect (this->peer_, 00047 remote_addr, 00048 timeout); 00049 } |
|
|
|
Receive the reply.
Definition at line 141 of file Name_Proxy.cpp. References ACE_DEBUG, ACE_ERROR, ACE_NTOHL, ACE_TEXT, ACE_TRACE, LM_DEBUG, LM_ERROR, ACE_SOCK_IO::recv(), and ssize_t. Referenced by ACE_Remote_Name_Space::list_name_entries(), ACE_Remote_Name_Space::list_names(), ACE_Remote_Name_Space::list_type_entries(), ACE_Remote_Name_Space::list_types(), ACE_Remote_Name_Space::list_value_entries(), ACE_Remote_Name_Space::list_values(), and ACE_Remote_Name_Space::resolve().
00142 { 00143 ACE_TRACE ("ACE_Name_Proxy::recv_reply"); 00144 // Read the first 4 bytes to get the length of the message This 00145 // implementation assumes that the first 4 bytes are the length of 00146 // the message. 00147 ssize_t n = this->peer_.recv ((void *) &reply, sizeof (ACE_UINT32)); 00148 00149 switch (n) 00150 { 00151 case -1: 00152 // FALLTHROUGH 00153 ACE_DEBUG ((LM_DEBUG, 00154 ACE_TEXT ("****************** recv_reply returned -1\n"))); 00155 default: 00156 ACE_ERROR ((LM_ERROR, 00157 ACE_TEXT ("%p got %d bytes, expected %d bytes\n"), 00158 ACE_TEXT ("recv failed"), 00159 n, 00160 sizeof (ACE_UINT32))); 00161 // FALLTHROUGH 00162 case 0: 00163 // We've shutdown unexpectedly 00164 return -1; 00165 // NOTREACHED 00166 case sizeof (ACE_UINT32): 00167 { 00168 // Transform the length into host byte order. 00169 ssize_t length = ACE_NTOHL (reply.length ()); 00170 00171 // Receive the rest of the request message. 00172 // @@ beware of blocking read!!!. 00173 n = this->peer_.recv ((void *) (((char *) &reply) 00174 + sizeof (ACE_UINT32)), 00175 length - sizeof (ACE_UINT32)); 00176 00177 // Subtract off the size of the part we skipped over... 00178 if (n != ssize_t (length - sizeof (ACE_UINT32))) 00179 { 00180 ACE_ERROR ((LM_ERROR, 00181 ACE_TEXT ("%p expected %d, got %d\n"), 00182 ACE_TEXT ("invalid length"), 00183 length, 00184 n)); 00185 return -1; 00186 } 00187 00188 // Decode the request into host byte order. 00189 if (reply.decode () == -1) 00190 { 00191 ACE_ERROR ((LM_ERROR, 00192 ACE_TEXT ("%p\n"), 00193 ACE_TEXT ("decode failed"))); 00194 return -1; 00195 } 00196 } 00197 } 00198 return 0; 00199 } |
|
Perform the request and wait for the reply.
Definition at line 76 of file Name_Proxy.cpp. References ACE_ERROR_RETURN, ACE_TEXT, ACE_TRACE, ACE_Name_Request::encode(), LM_ERROR, ACE_SOCK_Stream::recv_n(), ACE_SOCK_Stream::send_n(), and ssize_t. Referenced by ACE_Remote_Name_Space::bind(), ACE_Remote_Name_Space::rebind(), and ACE_Remote_Name_Space::unbind().
00077 { 00078 ACE_TRACE ("ACE_Name_Proxy::request_reply"); 00079 void *buffer; 00080 ssize_t length = request.encode (buffer); 00081 00082 if (length == -1) 00083 ACE_ERROR_RETURN ((LM_ERROR, 00084 ACE_TEXT ("%p\n"), 00085 ACE_TEXT ("encode failed")), 00086 -1); 00087 00088 // Transmit request via a blocking send. 00089 00090 if (this->peer_.send_n (buffer, length) != length) 00091 ACE_ERROR_RETURN ((LM_ERROR, 00092 ACE_TEXT ("%p\n"), 00093 ACE_TEXT ("send_n failed")), 00094 -1); 00095 else 00096 { 00097 ACE_Name_Reply reply; 00098 00099 // Receive reply via blocking read. 00100 00101 if (this->peer_.recv_n (&reply, 00102 sizeof reply) == -1) 00103 ACE_ERROR_RETURN ((LM_ERROR, 00104 ACE_TEXT ("%p\n"), 00105 ACE_TEXT ("recv failed")), 00106 -1); 00107 else if (reply.decode () == -1) 00108 ACE_ERROR_RETURN ((LM_ERROR, 00109 ACE_TEXT ("%p\n"), 00110 ACE_TEXT ("decode failed")), 00111 -1); 00112 errno = int (reply.errnum ()); 00113 return reply.status (); 00114 } 00115 } |
|
Perform the request.
Definition at line 118 of file Name_Proxy.cpp. References ACE_ERROR_RETURN, ACE_TEXT, ACE_TRACE, ACE_Name_Request::encode(), LM_ERROR, ACE_SOCK_Stream::send_n(), and ssize_t. Referenced by ACE_Remote_Name_Space::list_name_entries(), ACE_Remote_Name_Space::list_names(), ACE_Remote_Name_Space::list_type_entries(), ACE_Remote_Name_Space::list_types(), ACE_Remote_Name_Space::list_value_entries(), ACE_Remote_Name_Space::list_values(), and ACE_Remote_Name_Space::resolve().
00119 { 00120 ACE_TRACE ("ACE_Name_Proxy::send_request"); 00121 void *buffer; 00122 ssize_t length = request.encode (buffer); 00123 00124 if (length == -1) 00125 ACE_ERROR_RETURN ((LM_ERROR, 00126 ACE_TEXT ("%p\n"), 00127 ACE_TEXT ("encode failed")), 00128 -1); 00129 00130 // Transmit request via a blocking send. 00131 00132 else if (this->peer_.send_n (buffer, length) != length) 00133 ACE_ERROR_RETURN ((LM_ERROR, 00134 ACE_TEXT ("%p\n"), 00135 ACE_TEXT ("send_n failed")), 00136 -1); 00137 return 0; 00138 } |
|
ACE_Connector factory used to establish connections actively.
Definition at line 84 of file Name_Proxy.h. |
|
Connection to ACE_Name Server peer.
Definition at line 87 of file Name_Proxy.h. |
|
Pointer to ACE_Reactor (used if we are run in "reactive-mode").
Reimplemented from ACE_Event_Handler. Definition at line 90 of file Name_Proxy.h. |