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

TLI_Acceptor.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    TLI_Acceptor.h
00006  *
00007  *  $Id: TLI_Acceptor.h,v 1.1.1.3 2001/12/04 14:33:10 chad Exp $
00008  *
00009  *  @author Doug Schmidt
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_TLI_ACCEPTOR_H
00015 #define ACE_TLI_ACCEPTOR_H
00016 #include "ace/pre.h"
00017 
00018 #include "ace/TLI.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/Time_Value.h"
00025 #include "ace/TLI_Stream.h"
00026 
00027 #if defined (ACE_HAS_TLI)
00028 
00029 // Forward reference...
00030 class ACE_TLI_Request_Queue;
00031 
00032 /**
00033  * @class ACE_TLI_Acceptor
00034  *
00035  * @brief Defines the member functions for ACE_TLI_Acceptor abstraction.
00036  *
00037  * This class implements the algorithm described in Steve Rago's
00038  * book on System V UNIX network programming.  It basically
00039  * makes TLI look like the C++ SOCK_SAP socket wrappers with
00040  * respect to establishing passive-mode listener endpoints.
00041  */
00042 class ACE_Export ACE_TLI_Acceptor : public ACE_TLI
00043 {
00044 public:
00045   friend class ACE_Request_Queue;
00046 
00047   // = Initialization and termination methods.
00048   /// Default constructor.
00049   ACE_TLI_Acceptor (void);
00050 
00051   /// Initiate a passive mode socket.
00052   ACE_TLI_Acceptor (const ACE_Addr &remote_sap,
00053                     int reuse_addr = 0,
00054                     int oflag = O_RDWR,
00055                     struct t_info *info = 0,
00056                     int backlog = ACE_DEFAULT_BACKLOG,
00057                     const char device[] = ACE_TLI_TCP_DEVICE);
00058 
00059   /// Initiate a passive mode socket.
00060   ACE_HANDLE open (const ACE_Addr &remote_sap,
00061                    int reuse_addr = 0,
00062                    int oflag = O_RDWR,
00063                    struct t_info *info = 0,
00064                    int backlog = ACE_DEFAULT_BACKLOG,
00065                    const char device[] = ACE_TLI_TCP_DEVICE);
00066 
00067   /// Close down the acceptor and release resources.
00068   int close (void);
00069 
00070   // = Passive connection acceptance method.
00071 
00072   /**
00073    * Accept a new data transfer connection.  A <timeout> of 0 means
00074    * block forever, a <timeout> of {0, 0} means poll.  <restart> == 1
00075    * means "restart if interrupted."
00076    */
00077   int accept (ACE_TLI_Stream &new_tli_sap,
00078               ACE_Addr *remote_addr = 0,
00079               ACE_Time_Value *timeout = 0,
00080               int restart = 1,
00081               int reset_new_handle = 0,
00082               int rwflag = 1,
00083               netbuf *udata = 0,
00084               netbuf *opt = 0);
00085 
00086   // = Meta-type info
00087   typedef ACE_INET_Addr PEER_ADDR;
00088   typedef ACE_TLI_Stream PEER_STREAM;
00089 
00090   /// Dump the state of an object.
00091   void dump (void) const;
00092 
00093   /// Declare the dynamic allocation hooks.
00094   ACE_ALLOC_HOOK_DECLARE;
00095 
00096 private:
00097   /// Network "device" we are using.
00098   const char *device_;
00099 
00100   /// Number of connections to queue.
00101   int backlog_;
00102 
00103   /// Are we using "tirdwr" mod?
00104   int rwflag_;
00105 
00106   /// Handle TLI accept insanity...
00107   int handle_async_event (int restart, int rwflag);
00108 
00109   /// Used for queueing up pending requests.
00110   ACE_TLI_Request_Queue *queue_;
00111 
00112   /// Used for handling disconnects
00113   struct t_discon *disp_;
00114 };
00115 
00116 #endif /* ACE_HAS_TLI */
00117 #include "ace/post.h"
00118 #endif /* ACE_TLI_ACCEPTOR_H */

Generated on Mon Jun 16 11:21:55 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002