#include <MEM_IO.h>
Inheritance diagram for ACE_Reactive_MEM_IO:
Public Member Functions | |
ACE_Reactive_MEM_IO (void) | |
virtual | ~ACE_Reactive_MEM_IO (void) |
virtual int | init (ACE_HANDLE handle, const ACE_TCHAR *name, MALLOC_OPTIONS *options) |
virtual ssize_t | recv_buf (ACE_MEM_SAP_Node *&buf, int flags, const ACE_Time_Value *timeout) |
virtual ssize_t | send_buf (ACE_MEM_SAP_Node *buf, int flags, const ACE_Time_Value *timeout) |
ssize_t | get_buf_len (const off_t off, ACE_MEM_SAP_Node *&buf) |
|
Definition at line 9 of file MEM_IO.inl.
00010 { 00011 } |
|
Definition at line 19 of file MEM_IO.cpp.
00020 { 00021 } |
|
Convert the buffer offset to absolute address to . Return the size of valid information containing in the , -1 if is not initialized. Definition at line 51 of file MEM_IO.inl. References ACE_SEH_EXCEPT, ACE_SEH_TRY, ACE_TRACE, ACE_MEM_SAP_Node::size(), and ssize_t. Referenced by recv_buf().
00052 { 00053 #if !defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) 00054 ACE_TRACE ("ACE_Reactive_MEM_IO::get_buf_len"); 00055 #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ 00056 00057 if (this->shm_malloc_ == 0) 00058 return -1; 00059 00060 ssize_t retv = 0; 00061 00062 ACE_SEH_TRY 00063 { 00064 buf = 00065 reinterpret_cast<ACE_MEM_SAP_Node *> ( 00066 static_cast<char *> (this->shm_malloc_->base_addr ()) + off); 00067 retv = buf->size (); 00068 } 00069 ACE_SEH_EXCEPT (this->shm_malloc_->memory_pool ().seh_selector (GetExceptionInformation ())) 00070 { 00071 } 00072 00073 return retv; 00074 } |
|
Initialize the MEM_SAP object. options is used to pass in the Malloc_Options to initialize underlying ACE_MMAP. Implements ACE_MEM_SAP. Definition at line 24 of file MEM_IO.cpp. References ACE_TCHAR, ACE_TRACE, and ACE_MEM_SAP::create_shm_malloc().
00027 { 00028 ACE_TRACE ("ACE_Reactive_MEM_IO::init"); 00029 this->handle_ = handle; 00030 return this->create_shm_malloc (name, 00031 options); 00032 } |
|
Fetch location of next available data into . As this operation read the address of the data off the socket using ACE::recv, timeout only applies to ACE::recv. Implements ACE_MEM_SAP. Definition at line 35 of file MEM_IO.cpp. References ACE_TRACE, get_buf_len(), ACE::recv(), and ssize_t.
00038 { 00039 ACE_TRACE ("ACE_Reactive_MEM_IO::recv_buf"); 00040 00041 if (this->shm_malloc_ == 0 || this->handle_ == ACE_INVALID_HANDLE) 00042 return -1; 00043 00044 off_t new_offset = 0; 00045 ssize_t retv = ACE::recv (this->handle_, 00046 (char *) &new_offset, 00047 sizeof (off_t), 00048 flags, 00049 timeout); 00050 00051 if (retv == 0) 00052 { 00053 // ACE_DEBUG ((LM_INFO, "MEM_Stream closed\n")); 00054 buf = 0; 00055 return 0; 00056 } 00057 else if (retv != sizeof (off_t)) 00058 { 00059 // Nothing available or we are really screwed. 00060 buf = 0; 00061 return -1; 00062 } 00063 00064 return this->get_buf_len (new_offset, buf); 00065 } |
|
Wait to to amount of time to send . If times out a -1 is returned with <errno == ETIME>. If it succeeds the number of bytes sent is returned. Implements ACE_MEM_SAP. Definition at line 68 of file MEM_IO.cpp. References ACE_TRACE, ACE_MEM_SAP::release_buffer(), ACE::send(), and ACE_MEM_SAP_Node::size().
00071 { 00072 ACE_TRACE ("ACE_Reactive_MEM_IO::send_buf"); 00073 00074 if (this->shm_malloc_ == 0 || this->handle_ == ACE_INVALID_HANDLE) 00075 return -1; 00076 00077 off_t offset = reinterpret_cast<char *> (buf) - 00078 static_cast<char *> (this->shm_malloc_->base_addr ()); // the offset. 00079 // Send the offset value over the socket. 00080 if (ACE::send (this->handle_, 00081 (const char *) &offset, 00082 sizeof (offset), 00083 flags, 00084 timeout) != sizeof (offset)) 00085 { 00086 // unsucessful send, release the memory in the shared-memory. 00087 this->release_buffer (buf); 00088 00089 return -1; 00090 } 00091 return buf->size (); 00092 } |