ATM_Connector.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    ATM_Connector.h
00006  *
00007  *  ATM_Connector.h,v 4.15 2005/10/28 16:14:51 ossama Exp
00008  *
00009  *  @author Joe Hoffert <joeh@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_ATM_CONNECTOR_H
00014 #define ACE_ATM_CONNECTOR_H
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "ace/config-all.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #if defined (ACE_HAS_ATM)
00024 
00025 #include "ace/ATM_Stream.h"
00026 #include "ace/ATM_Params.h"
00027 #include "ace/ATM_QoS.h"
00028 
00029 #if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM)
00030 #include "ace/SOCK_Connector.h"
00031 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00032 typedef ACE_SOCK_Connector ATM_Connector;
00033 ACE_END_VERSIONED_NAMESPACE_DECL
00034 #else
00035 #include "ace/XTI_ATM_Mcast.h"
00036 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00037 typedef ACE_XTI_ATM_Mcast ATM_Connector;
00038 // Open versioned namespace, if enabled by the user.
00039 ACE_END_VERSIONED_NAMESPACE_DECL
00040 #endif
00041 
00042 // Open versioned namespace, if enabled by the user.
00043 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00044 
00045 /**
00046  * @class ACE_ATM_Connector
00047  *
00048  * @brief Defines an active connection factory for the ACE_ATM C++
00049  * wrappers.
00050  */
00051 class ACE_Export ACE_ATM_Connector
00052 {
00053 public:
00054   // = Initialization methods.
00055   /// Default constructor.
00056   ACE_ATM_Connector (void);
00057 
00058   /**
00059    * Actively connect and produce a <new_stream> if things go well.
00060    * The <remote_sap> is the address that we are trying to connect
00061    * with.  The <params> are the parameters needed for either socket
00062    * or XTI/ATM connections.  The <timeout> is the amount of time to
00063    * wait to connect. If it's 0 then we block indefinitely.  If
00064    * *timeout == {0, 0} then the connection is done using non-blocking
00065    * mode.  In this case, if the connection can't be made immediately
00066    * the value of -1 is returned with <errno == EWOULDBLOCK>.  If
00067    * *timeout > {0, 0} then this is the maximum amount of time to wait before
00068    * timing out.  If the time expires before the connection is made
00069    * <errno == ETIME>.  The <local_sap> is the value of local address
00070    * to bind to.  If it's the default value of <ACE_ATM_Addr::sap_any> then
00071    * the user is letting the OS do the binding.  If <reuse_addr> == 1
00072    * then the <local_addr> is reused, even if it hasn't been cleanedup yet.
00073    */
00074   ACE_ATM_Connector (ACE_ATM_Stream &new_stream,
00075                      const ACE_ATM_Addr &remote_sap,
00076                      ACE_ATM_Params params = ACE_ATM_Params(),
00077                      ACE_ATM_QoS options = ACE_ATM_QoS(),
00078                      ACE_Time_Value *timeout = 0,
00079                      const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "", 0 ),
00080                      int reuse_addr = 0,
00081 #if defined (ACE_WIN32)
00082                      int flags = 0,
00083 #else
00084                      int flags = O_RDWR,
00085 #endif /* ACE_WIN32 */
00086                      int perms = 0);
00087 
00088   /**
00089    * Actively connect and produce a <new_stream> if things go well.
00090    * The <remote_sap> is the address that we are trying to connect
00091    * with.  The <params> are the parameters needed for either socket
00092    * or XTI/ATM connections.  The <timeout> is the amount of time to
00093    * wait to connect. If it's 0 then we block indefinitely.  If
00094    * *timeout == {0, 0} then the connection is done using non-blocking
00095    * mode.  In this case, if the connection can't be made immediately
00096    * the value of -1 is returned with <errno == EWOULDBLOCK>.  If
00097    * *timeout > {0, 0} then this is the maximum amount of time to wait before
00098    * timing out.  If the time expires before the connection is made
00099    * <errno == ETIME>.  The <local_sap> is the value of local address
00100    * to bind to.  If it's the default value of <ACE_ATM_Addr::sap_any> then
00101    * the user is letting the OS do the binding.  If <reuse_addr> == 1
00102    * then the <local_addr> is reused, even if it hasn't been cleanedup yet.
00103    */
00104   int connect (ACE_ATM_Stream &new_stream,
00105                const ACE_ATM_Addr &remote_sap,
00106                ACE_ATM_Params params = ACE_ATM_Params(),
00107                ACE_ATM_QoS options = ACE_ATM_QoS(),
00108                ACE_Time_Value *timeout = 0,
00109                const ACE_ATM_Addr &local_sap = ACE_ATM_Addr( "",
00110                                                              0 ),
00111                int reuse_addr = 0,
00112 #if defined (ACE_WIN32)
00113                int flags = 0,
00114 #else
00115                int flags = O_RDWR,
00116 #endif /* ACE_WIN32 */
00117                int perms = 0);
00118 
00119   /**
00120    * Try to complete a non-blocking connection.
00121    * If connection completion is successful then <new_stream> contains
00122    * the connected ACE_SOCK_Stream.  If <remote_sap> is non-NULL then it
00123    * will contain the address of the connected peer.
00124    */
00125   int complete (ACE_ATM_Stream &new_stream,
00126                 ACE_ATM_Addr *remote_sap,
00127                 ACE_Time_Value *tv);
00128 
00129   //int add_leaf (ACE_ATM_Stream &current_stream,
00130   //              const ACE_Addr &remote_sap,
00131   //              ACE_INT32 leaf_id,
00132   //              ACE_Time_Value *timeout = 0);
00133 
00134   /**
00135    * Actively add a leaf to the root (i.e., point-to-multipoint). The
00136    * <remote_sap> is the address of the leaf that we
00137    * are trying to add.
00138    */
00139   int add_leaf (ACE_ATM_Stream &current_stream,
00140                 const ACE_Addr &remote_sap,
00141                 ACE_ATM_QoS &qos);
00142 
00143   /// Resets any event associations on this handle
00144   int reset_new_handle (ACE_HANDLE handle);
00145 
00146   // = Meta-type info
00147   typedef ACE_ATM_Addr PEER_ADDR;
00148   typedef ACE_ATM_Stream PEER_STREAM;
00149 
00150   /// Dump the state of an object.
00151   void dump (void) const;
00152 
00153   /// Declare the dynamic allocation hooks.
00154   ACE_ALLOC_HOOK_DECLARE;
00155 
00156 private:
00157   ATM_Connector connector_;
00158 };
00159 
00160 // Open versioned namespace, if enabled by the user.
00161 ACE_END_VERSIONED_NAMESPACE_DECL
00162 
00163 #if defined (__ACE_INLINE__)
00164 #include "ace/ATM_Connector.inl"
00165 #endif /* __ACE_INLINE__ */
00166 
00167 #endif /* ACE_HAS_ATM */
00168 #include /**/ "ace/post.h"
00169 #endif /* ACE_ATM_CONNECTOR_H */

Generated on Thu Nov 9 09:41:46 2006 for ACE by doxygen 1.3.6