ACE_LSOCK_Acceptor Class Reference

Defines the format and interface for the acceptor side of the local ACE_SOCK ACE_Stream. More...

#include <LSOCK_Acceptor.h>

Inheritance diagram for ACE_LSOCK_Acceptor:

Inheritance graph
[legend]
Collaboration diagram for ACE_LSOCK_Acceptor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_UNIX_Addr PEER_ADDR
typedef ACE_LSOCK_Stream PEER_STREAM

Public Member Functions

 ACE_LSOCK_Acceptor (void)
 Default constructor.

 ACE_LSOCK_Acceptor (const ACE_Addr &local_sap, int reuse_addr=0, int protocol_family=PF_UNIX, int backlog=ACE_DEFAULT_BACKLOG, int protocol=0)
 Initiate a passive mode socket.

int open (const ACE_Addr &local_sap, int reuse_addr=0, int protocol_family=PF_UNIX, int backlog=ACE_DEFAULT_BACKLOG, int protocol=0)
 Initiate a passive mode socket.

int accept (ACE_LSOCK_Stream &new_ipc_sap, ACE_Addr *=0, ACE_Time_Value *timeout=0, int restart=1, int reset_new_handle=0) const
 Accept a new data transfer connection.

int remove (void)
int get_local_addr (ACE_Addr &) const
 Return the local endpoint address.

void dump (void) const
 Dump the state of an object.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

ACE_UNIX_Addr local_addr_
 Address of our rendezvous point.


Detailed Description

Defines the format and interface for the acceptor side of the local ACE_SOCK ACE_Stream.

Definition at line 41 of file LSOCK_Acceptor.h.


Member Typedef Documentation

typedef ACE_UNIX_Addr ACE_LSOCK_Acceptor::PEER_ADDR
 

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 77 of file LSOCK_Acceptor.h.

typedef ACE_LSOCK_Stream ACE_LSOCK_Acceptor::PEER_STREAM
 

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 78 of file LSOCK_Acceptor.h.


Constructor & Destructor Documentation

ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor void   ) 
 

Default constructor.

Definition at line 45 of file LSOCK_Acceptor.cpp.

References ACE_TRACE.

00046 {
00047   ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor");
00048 }

ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor const ACE_Addr local_sap,
int  reuse_addr = 0,
int  protocol_family = PF_UNIX,
int  backlog = ACE_DEFAULT_BACKLOG,
int  protocol = 0
 

Initiate a passive mode socket.

Definition at line 65 of file LSOCK_Acceptor.cpp.

References ACE_ERROR, ACE_TRACE, LM_ERROR, and open().

00070 {
00071   ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor");
00072   if (this->open (remote_sap,
00073                   reuse_addr,
00074                   protocol_family,
00075                   backlog,
00076                   protocol) == -1)
00077     ACE_ERROR ((LM_ERROR,
00078                 "ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor"));
00079 }


Member Function Documentation

int ACE_LSOCK_Acceptor::accept ACE_LSOCK_Stream new_ipc_sap,
ACE_Addr = 0,
ACE_Time_Value timeout = 0,
int  restart = 1,
int  reset_new_handle = 0
const
 

Accept a new data transfer connection.

Definition at line 84 of file LSOCK_Acceptor.cpp.

References ACE_TRACE, ACE_Addr::get_addr(), ACE_LSOCK_Stream::get_handle(), ACE_Addr::get_size(), ACE_LSOCK_Stream::set_handle(), ACE_Addr::set_size(), ACE_SOCK_Acceptor::shared_accept_finish(), and ACE_SOCK_Acceptor::shared_accept_start().

00089 {
00090   ACE_TRACE ("ACE_LSOCK_Acceptor::accept");
00091 
00092   int in_blocking_mode = 0;
00093   if (this->shared_accept_start (timeout,
00094                                  restart,
00095                                  in_blocking_mode) == -1)
00096     return -1;
00097   else
00098     {
00099       sockaddr *addr = 0;
00100       int len = 0;
00101 
00102       if (remote_addr != 0)
00103         {
00104           len = remote_addr->get_size ();
00105           addr = (sockaddr *) remote_addr->get_addr ();
00106         }
00107 
00108       do
00109         new_stream.set_handle (ACE_OS::accept (this->get_handle (),
00110                                                addr,
00111                                                &len));
00112       while (new_stream.get_handle () == ACE_INVALID_HANDLE
00113              && restart != 0
00114              && errno == EINTR
00115              && timeout == 0);
00116 
00117       // Reset the size of the addr, which is only necessary for UNIX
00118       // domain sockets.
00119       if (new_stream.get_handle () != ACE_INVALID_HANDLE
00120           && remote_addr != 0)
00121         remote_addr->set_size (len);
00122     }
00123 
00124   return this->shared_accept_finish (new_stream,
00125                                      in_blocking_mode,
00126                                      reset_new_handle);
00127 }

void ACE_LSOCK_Acceptor::dump void   )  const
 

Dump the state of an object.

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 32 of file LSOCK_Acceptor.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TRACE, ACE_UNIX_Addr::dump(), LM_DEBUG, and local_addr_.

00033 {
00034 #if defined (ACE_HAS_DUMP)
00035   ACE_TRACE ("ACE_LSOCK_Acceptor::dump");
00036 
00037   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00038   this->local_addr_.dump ();
00039   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00040 #endif /* ACE_HAS_DUMP */
00041 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_LSOCK_Acceptor::get_local_addr ACE_Addr  )  const
 

Return the local endpoint address.

Reimplemented from ACE_SOCK.

Definition at line 20 of file LSOCK_Acceptor.cpp.

References ACE_TRACE, and local_addr_.

00021 {
00022   ACE_TRACE ("ACE_LSOCK_Acceptor::get_local_addr");
00023 
00024   ACE_UNIX_Addr& target = dynamic_cast<ACE_UNIX_Addr &> (a);
00025 
00026   target = this->local_addr_;
00027 
00028   return 0;
00029 }

int ACE_LSOCK_Acceptor::open const ACE_Addr local_sap,
int  reuse_addr = 0,
int  protocol_family = PF_UNIX,
int  backlog = ACE_DEFAULT_BACKLOG,
int  protocol = 0
 

Initiate a passive mode socket.

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 51 of file LSOCK_Acceptor.cpp.

References ACE_TRACE, local_addr_, and ACE_SOCK_Acceptor::open().

Referenced by ACE_LSOCK_Acceptor().

00056 {
00057   ACE_TRACE ("ACE_LSOCK_Acceptor::open");
00058   this->local_addr_ = *((ACE_UNIX_Addr *) &remote_sap); // This is a gross hack...
00059   return ACE_SOCK_Acceptor::open (remote_sap, reuse_addr,
00060                                   protocol_family, backlog, protocol);
00061 }

int ACE_LSOCK_Acceptor::remove void   ) 
 

Close down the ACE_LSOCK and remove the rendezvous point from the file system.

Definition at line 133 of file LSOCK_Acceptor.cpp.

References ACE_TRACE, ACE_SOCK_Acceptor::close(), and ACE_OS::unlink().

00134 {
00135   ACE_TRACE ("ACE_LSOCK_Acceptor::remove");
00136   int result = this->close ();
00137   return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1
00138     || result == -1 ? -1 : 0;
00139 }


Member Data Documentation

ACE_LSOCK_Acceptor::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 84 of file LSOCK_Acceptor.h.

ACE_UNIX_Addr ACE_LSOCK_Acceptor::local_addr_ [private]
 

Address of our rendezvous point.

Definition at line 88 of file LSOCK_Acceptor.h.

Referenced by dump(), get_local_addr(), and open().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:24:10 2006 for ACE by doxygen 1.3.6