Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

 ACE_LSOCK_Acceptor (void)
 Default constructor. More...

 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. More...

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. More...

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. More...

int remove (void)
 Close down the ACE_LSOCK and remove the rendezvous point from the file system. More...

int get_local_addr (ACE_Addr &) const
 Return the local endpoint address. 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_UNIX_Addr local_addr_
 Address of our rendezvous point. More...


Detailed Description

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

Definition at line 39 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 75 of file LSOCK_Acceptor.h.

typedef ACE_LSOCK_Stream ACE_LSOCK_Acceptor::PEER_STREAM
 

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 76 of file LSOCK_Acceptor.h.


Constructor & Destructor Documentation

ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor void   
 

Default constructor.

Definition at line 40 of file LSOCK_Acceptor.cpp.

References ACE_TRACE.

00041 {
00042   ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor");
00043 }

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 60 of file LSOCK_Acceptor.cpp.

References ACE_ERROR, ACE_TRACE, LM_ERROR, and open.

00065 {
00066   ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor");
00067   if (this->open (remote_sap,
00068                   reuse_addr,
00069                   protocol_family,
00070                   backlog,
00071                   protocol) == -1)
00072     ACE_ERROR ((LM_ERROR,
00073                 "ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor"));
00074 }


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 79 of file LSOCK_Acceptor.cpp.

References ACE_OS::accept, 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.

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

void ACE_LSOCK_Acceptor::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 29 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_.

00030 {
00031   ACE_TRACE ("ACE_LSOCK_Acceptor::dump");
00032 
00033   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00034   this->local_addr_.dump ();
00035   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00036 }

int ACE_LSOCK_Acceptor::get_local_addr ACE_Addr   const
 

Return the local endpoint address.

Reimplemented from ACE_SOCK.

Definition at line 17 of file LSOCK_Acceptor.cpp.

References ACE_TRACE, and local_addr_.

00018 {
00019   ACE_TRACE ("ACE_LSOCK_Acceptor::get_local_addr");
00020 
00021   ACE_UNIX_Addr& target = ACE_dynamic_cast (ACE_UNIX_Addr &, a);
00022 
00023   target = this->local_addr_;
00024 
00025   return 0;
00026 }

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 46 of file LSOCK_Acceptor.cpp.

References ACE_TRACE, local_addr_, and ACE_SOCK_Acceptor::open.

Referenced by ACE_LSOCK_Acceptor.

00051 {
00052   ACE_TRACE ("ACE_LSOCK_Acceptor::open");
00053   this->local_addr_ = *((ACE_UNIX_Addr *) &remote_sap); // This is a gross hack...
00054   return ACE_SOCK_Acceptor::open (remote_sap, reuse_addr, 
00055                                   protocol_family, backlog, protocol);
00056 }

int ACE_LSOCK_Acceptor::remove void   
 

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

Definition at line 128 of file LSOCK_Acceptor.cpp.

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

00129 {
00130   ACE_TRACE ("ACE_LSOCK_Acceptor::remove");
00131   int result = this->close ();
00132   return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 
00133     || result == -1 ? -1 : 0;
00134 }


Member Data Documentation

ACE_LSOCK_Acceptor::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_SOCK_Acceptor.

Definition at line 82 of file LSOCK_Acceptor.h.

ACE_UNIX_Addr ACE_LSOCK_Acceptor::local_addr_ [private]
 

Address of our rendezvous point.

Definition at line 86 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 Mon Jun 16 12:49:39 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002