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

DEV_Connector.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    DEV_Connector.h
00006  *
00007  *  $Id: DEV_Connector.h,v 1.1.1.3 2001/12/04 14:33:00 chad Exp $
00008  *
00009  *  @author Gerhard Lenzer and Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_DEV_CONNECTOR_H
00014 #define ACE_DEV_CONNECTOR_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/DEV_IO.h"
00018 #include "ace/Log_Msg.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 /**
00025  * @class ACE_DEV_Connector
00026  *
00027  * @brief Defines an active connection factory for the ACE_DEV wrappers.
00028  */
00029 class ACE_Export ACE_DEV_Connector
00030 {
00031 public:
00032   /// Default constructor.
00033   ACE_DEV_Connector (void);
00034 
00035   /**
00036    * Actively connect and produce a <new_stream> if things go well.
00037    * The <remote_sap> is the address that we are trying to connect
00038    * with.  The <timeout> is the amount of time to wait to connect.
00039    * If it's 0 then we block indefinitely.  If *timeout == {0, 0} then
00040    * the connection is done using non-blocking mode.  In this case, if
00041    * the connection can't be made immediately the value of -1 is
00042    * returned with <errno == EWOULDBLOCK>.  If *timeout > {0, 0} then
00043    * this is the maximum amount of time to wait before timing out.  If the
00044    * time expires before the connection is made <errno == ETIME>.  The
00045    * <local_sap> is the value of local address to bind to.  If it's
00046    * the default value of <ACE_Addr::sap_any> then the user is letting
00047    * the OS do the binding.  If <reuse_addr> == 1 then the
00048    * <local_addr> is reused, even if it hasn't been cleanedup yet.
00049    * The <flags> and <perms> arguments are passed down to the <open>
00050    * method.
00051    */
00052   ACE_DEV_Connector (ACE_DEV_IO &new_io,
00053                      const ACE_DEV_Addr &remote_sap,
00054                      ACE_Time_Value *timeout = 0,
00055                      const ACE_Addr &local_sap = ACE_Addr::sap_any,
00056                      int reuse_addr = 0,
00057                      int flags = O_RDWR,
00058                      int perms = 0);
00059 
00060   /**
00061    * Actively connect and produce a <new_stream> if things go well.
00062    * The <remote_sap> is the address that we are trying to connect
00063    * with.  The <timeout> is the amount of time to wait to connect.
00064    * If it's 0 then we block indefinitely.  If *timeout == {0, 0} then
00065    * the connection is done using non-blocking mode.  In this case, if
00066    * the connection can't be made immediately the value of -1 is
00067    * returned with <errno == EWOULDBLOCK>.  If *timeout > {0, 0} then
00068    * this is the maximum amount of time to wait before timing out.  If the
00069    * time expires before the connection is made <errno == ETIME>.  The
00070    * <local_sap> is the value of local address to bind to.  If it's
00071    * the default value of <ACE_Addr::sap_any> then the user is letting
00072    * the OS do the binding.  If <reuse_addr> == 1 then the
00073    * <local_addr> is reused, even if it hasn't been cleanedup yet.
00074    * The <flags> and <perms> arguments are passed down to the <open>
00075    * method.
00076    */
00077   int connect (ACE_DEV_IO &new_io,
00078                const ACE_DEV_Addr &remote_sap,
00079                ACE_Time_Value *timeout = 0,
00080                const ACE_Addr &local_sap = ACE_Addr::sap_any,
00081                int reuse_addr = 0,
00082                int flags = O_RDWR,
00083                int perms = 0);
00084 
00085   /// Resets any event associations on this handle
00086   int reset_new_handle (ACE_HANDLE handle);
00087 
00088   /// Dump the state of an object.
00089   void dump (void) const;
00090 
00091   /// Declare the dynamic allocation hooks.
00092   ACE_ALLOC_HOOK_DECLARE;
00093 
00094   // = Meta-type info
00095   typedef ACE_DEV_Addr PEER_ADDR;
00096   typedef ACE_DEV_IO   PEER_STREAM;
00097 };
00098 
00099 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00100 #include "ace/DEV_Connector.i"
00101 #endif
00102 
00103 #include "ace/post.h"
00104 #endif /* ACE_DEV_CONNECTOR_H */

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