TLI_Acceptor.h

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

Generated on Thu Nov 9 09:42:08 2006 for ACE by doxygen 1.3.6