ACE_MEM_Stream object.
More...
#include <MEM_Connector.h>
Inheritance diagram for ACE_MEM_Connector:


Public Types | |
| typedef ACE_INET_Addr | PEER_ADDR |
| typedef ACE_MEM_Stream | PEER_STREAM |
Public Methods | |
| ACE_MEM_Connector (void) | |
| Default constructor. More... | |
| ACE_MEM_Connector (ACE_MEM_Stream &new_stream, const ACE_INET_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=0, int perms=0) | |
| int | connect (ACE_MEM_Stream &new_stream, const ACE_INET_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=0, int perms=0) |
| ACE_MEM_IO::Signal_Strategy | preferred_strategy (void) const |
| Get the preferred signaling strategy. More... | |
| void | preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy) |
| Set the preferred signaling strategy. More... | |
| ACE_MEM_SAP::MALLOC_OPTIONS & | malloc_options (void) |
| Accessor to underlying malloc options. 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_MEM_Addr | address_ |
| The acceptor address this connector is connecting to. More... | |
| ACE_MEM_SAP::MALLOC_OPTIONS | malloc_options_ |
| A cached MALLOC_OPTIONS that the MEM_Connector used to initialize the shared memory malloc update connection establishment. More... | |
| ACE_MEM_IO::Signal_Strategy | preferred_strategy_ |
| Preferred signaling strategy. More... | |
ACE_MEM_Stream object.
Definition at line 34 of file MEM_Connector.h.
|
|
Reimplemented from ACE_SOCK_Connector. Definition at line 145 of file MEM_Connector.h. |
|
|
Reimplemented from ACE_SOCK_Connector. Definition at line 146 of file MEM_Connector.h. |
|
|
Default constructor.
Definition at line 27 of file MEM_Connector.cpp. References ACE_DEFAULT_BASE_ADDR, and ACE_TRACE.
00028 : malloc_options_ (ACE_DEFAULT_BASE_ADDR, 0), 00029 preferred_strategy_ (ACE_MEM_IO::Reactive) 00030 { 00031 ACE_TRACE ("ACE_MEM_Connector::ACE_MEM_Connector"); 00032 } |
|
||||||||||||||||||||||||||||||||
|
Actively connect to a peer, producing a connected
Definition at line 35 of file MEM_Connector.cpp. References ACE_DEFAULT_BASE_ADDR, ACE_TRACE, and connect.
00042 : malloc_options_ (ACE_DEFAULT_BASE_ADDR, 0), 00043 preferred_strategy_ (ACE_MEM_IO::Reactive) 00044 { 00045 ACE_TRACE ("ACE_MEM_Connector::ACE_MEM_Connector"); 00046 // This is necessary due to the weird inheritance relationships of 00047 // ACE_MEM_Stream. 00048 this->connect (new_stream, 00049 remote_sap, 00050 timeout, 00051 local_sap, 00052 reuse_addr, 00053 flags, 00054 perms); 00055 } |
|
||||||||||||||||||||||||||||||||
|
Actively connect to a peer, producing a connected
Definition at line 58 of file MEM_Connector.cpp. References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NONBLOCK, ACE_TCHAR, ACE_TRACE, address_, ACE_SOCK_Connector::connect, ACE_IPC_SAP::disable, ACE_IPC_SAP::get_handle, ACE_MEM_Addr::get_host_name, ACE_INET_Addr::get_host_name, ACE_SOCK::get_local_addr, ACE_MEM_Addr::get_port_number, ACE_INET_Addr::get_port_number, ACE_MEM_IO::init, LM_DEBUG, LM_ERROR, MAXPATHLEN, ACE_MEM_IO::MT, preferred_strategy_, ACE_MEM_IO::Reactive, ACE::recv, ACE_MEM_Addr::same_host, ACE::send, ACE_IPC_SAP::set_handle, ACE_MEM_Addr::set_port_number, and ACE_MEM_IO::Signal_Strategy. Referenced by ACE_MEM_Connector.
00065 {
00066 ACE_TRACE ("ACE_MEM_Connector::connect");
00067
00068 if (!this->address_.same_host (remote_sap))
00069 ACE_ERROR_RETURN ((LM_ERROR,
00070 ACE_LIB_TEXT ("(%P|%t) MEM_Connector can't connect ")
00071 ACE_LIB_TEXT ("to %s:%d which is not a local endpoint ")
00072 ACE_LIB_TEXT ("(local address is %s:%d)\n"),
00073 remote_sap.get_host_name (),
00074 remote_sap.get_port_number (),
00075 this->address_.get_host_name (),
00076 this->address_.get_port_number ()),
00077 -1);
00078 else
00079 this->address_.set_port_number (remote_sap.get_port_number ());
00080
00081
00082 ACE_SOCK_Stream temp_stream;
00083
00084 if (ACE_SOCK_Connector::connect (temp_stream,
00085 this->address_.get_local_addr (),
00086 timeout, local_sap,
00087 reuse_addr, flags, perms) == -1)
00088 ACE_ERROR_RETURN ((LM_DEBUG,
00089 ACE_LIB_TEXT ("%p\n"),
00090 ACE_LIB_TEXT ("ACE_MEM_Connector::connect")),
00091 -1);
00092
00093
00094 ACE_HANDLE new_handle = temp_stream.get_handle ();
00095 new_stream.set_handle (new_handle);
00096 new_stream.disable (ACE_NONBLOCK);
00097 // Do not close the handle.
00098
00099 // now we should setup the mmap malloc.
00100 ACE_TCHAR buf[MAXPATHLEN];
00101
00102 // @@ Need to handle timeout here.
00103 ACE_INT16 server_strategy = ACE_MEM_IO::Reactive;
00104 // Receive the signaling strategy theserver support.
00105 if (ACE::recv (new_handle, &server_strategy,
00106 sizeof (ACE_INT16)) == -1)
00107 ACE_ERROR_RETURN ((LM_DEBUG,
00108 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error receiving strategy\n")),
00109 -1);
00110
00111 // If either side don't support MT, we will not use it.
00112 #if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
00113 if (! (this->preferred_strategy_ == ACE_MEM_IO::MT &&
00114 server_strategy == ACE_MEM_IO::MT))
00115 #endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
00116 server_strategy = ACE_MEM_IO::Reactive;
00117
00118 if (ACE::send (new_handle, &server_strategy,
00119 sizeof (ACE_INT16)) == -1)
00120 ACE_ERROR_RETURN ((LM_DEBUG,
00121 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error sending strategy\n")),
00122 -1);
00123
00124 ACE_INT16 buf_len;
00125 // Byte-order is not a problem for this read.
00126 if (ACE::recv (new_handle, &buf_len, sizeof (buf_len)) == -1)
00127 ACE_ERROR_RETURN ((LM_DEBUG,
00128 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error receiving shm filename length\n")),
00129 -1);
00130
00131 if (ACE::recv (new_handle, buf, buf_len) == -1)
00132 ACE_ERROR_RETURN ((LM_DEBUG,
00133 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error receiving shm filename.\n")),
00134 -1);
00135
00136 if (new_stream.init (buf, ACE_static_cast (ACE_MEM_IO::Signal_Strategy, server_strategy),
00137 &this->malloc_options_) == -1)
00138 return -1;
00139
00140 return 0;
00141 }
|
|
|
Dump the state of an object.
Reimplemented from ACE_SOCK_Connector. Definition at line 18 of file MEM_Connector.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.
00019 {
00020 ACE_TRACE ("ACE_MEM_Connector::dump");
00021
00022 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00023 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
00024 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00025 }
|
|
|
Accessor to underlying malloc options.
Definition at line 21 of file MEM_Connector.i. References malloc_options_.
00022 {
00023 return this->malloc_options_;
00024 }
|
|
|
Set the preferred signaling strategy.
Definition at line 15 of file MEM_Connector.i. References preferred_strategy_, and ACE_MEM_IO::Signal_Strategy.
00016 {
00017 this->preferred_strategy_ = strategy;
00018 }
|
|
|
Get the preferred signaling strategy.
Definition at line 9 of file MEM_Connector.i. References preferred_strategy_.
00010 {
00011 return this->preferred_strategy_;
00012 }
|
|
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_SOCK_Connector. Definition at line 152 of file MEM_Connector.h. |
|
|
The acceptor address this connector is connecting to.
Definition at line 156 of file MEM_Connector.h. Referenced by connect. |
|
|
A cached MALLOC_OPTIONS that the MEM_Connector used to initialize the shared memory malloc update connection establishment.
Definition at line 160 of file MEM_Connector.h. Referenced by malloc_options. |
|
|
Preferred signaling strategy.
Definition at line 163 of file MEM_Connector.h. Referenced by connect, and preferred_strategy. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002