ACE_ATM_Connector Class Reference

Defines an active connection factory for the ACE_ATM C++ wrappers. More...

#include <ATM_Connector.h>

List of all members.

Public Types

typedef ACE_ATM_Addr PEER_ADDR
typedef ACE_ATM_Stream PEER_STREAM

Public Member Functions

 ACE_ATM_Connector (void)
 Default constructor.
 ACE_ATM_Connector (ACE_ATM_Stream &new_stream, const ACE_ATM_Addr &remote_sap, ACE_ATM_Params params=ACE_ATM_Params(), ACE_ATM_QoS options=ACE_ATM_QoS(), ACE_Time_Value *timeout=0, const ACE_ATM_Addr &local_sap=ACE_ATM_Addr("", 0), int reuse_addr=0,#if defined(ACE_WIN32) int flags=0,#else int flags=O_RDWR,#endifint perms=0)
int connect (ACE_ATM_Stream &new_stream, const ACE_ATM_Addr &remote_sap, ACE_ATM_Params params=ACE_ATM_Params(), ACE_ATM_QoS options=ACE_ATM_QoS(), ACE_Time_Value *timeout=0, const ACE_ATM_Addr &local_sap=ACE_ATM_Addr("", 0), int reuse_addr=0,#if defined(ACE_WIN32) int flags=0,#else int flags=O_RDWR,#endifint perms=0)
int complete (ACE_ATM_Stream &new_stream, ACE_ATM_Addr *remote_sap, ACE_Time_Value *tv)
int add_leaf (ACE_ATM_Stream &current_stream, const ACE_Addr &remote_sap, ACE_ATM_QoS &qos)
bool reset_new_handle (ACE_HANDLE handle)
 Resets any event associations on this handle.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Private Attributes

ATM_Connector connector_

Detailed Description

Defines an active connection factory for the ACE_ATM C++ wrappers.

Definition at line 51 of file ATM_Connector.h.


Member Typedef Documentation

Definition at line 142 of file ATM_Connector.h.

Definition at line 143 of file ATM_Connector.h.


Constructor & Destructor Documentation

ACE_ATM_Connector::ACE_ATM_Connector ( void   ) 

Default constructor.

ACE_ATM_Connector::ACE_ATM_Connector ( ACE_ATM_Stream new_stream,
const ACE_ATM_Addr remote_sap,
ACE_ATM_Params  params = ACE_ATM_Params(),
ACE_ATM_QoS  options = ACE_ATM_QoS(),
ACE_Time_Value timeout = 0,
const ACE_ATM_Addr local_sap = ACE_ATM_Addr("", 0),
int  reuse_addr = 0,
#if defined(ACE_WIN32) int  flags = 0,
#else int  flags = O_RDWR,
#endifint  perms = 0 
)

Actively connect and produce a new_stream if things go well. The remote_sap is the address that we are trying to connect with. The <params> are the parameters needed for either socket or XTI/ATM connections. The timeout is the amount of time to wait to connect. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the connection is done using non-blocking mode. In this case, if the connection can't be made immediately the value of -1 is returned with errno == EWOULDBLOCK. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made errno == ETIME. The local_sap is the value of local address to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then the user is letting the OS do the binding. If reuse_addr == 1 then the <local_addr> is reused, even if it hasn't been cleanedup yet.


Member Function Documentation

int ACE_ATM_Connector::add_leaf ( ACE_ATM_Stream current_stream,
const ACE_Addr remote_sap,
ACE_ATM_QoS qos 
)

Actively add a leaf to the root (i.e., point-to-multipoint). The remote_sap is the address of the leaf that we are trying to add.

Definition at line 65 of file ATM_Connector.inl.

00068 {
00069   ACE_TRACE ("ACE_ATM_Connector::add_leaf");
00070 #if defined (ACE_HAS_FORE_ATM_XTI)
00071   return connector_.add_leaf(current_stream.get_stream(),
00072                              remote_sap,
00073                              leaf_id,
00074                              timeout);
00075 #elif defined (ACE_HAS_FORE_ATM_WS2)
00076   struct sockaddr_atm *saddr = (struct sockaddr_atm *)remote_sap.get_addr();
00077   ACE_QoS cqos = qos.get_qos();
00078   int addr_len = sizeof( struct sockaddr_atm );
00079 
00080   ACE_QoS_Params qos_params(0,
00081                             0,
00082                             &cqos,
00083                             0,
00084                             (JL_SENDER_ONLY));
00085 
00086   ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" );
00087 
00088   ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(),
00089                                         (struct sockaddr *)saddr,
00090                                         addr_len,
00091                                         qos_params);
00092 
00093   if ( result == ACE_INVALID_HANDLE )
00094     ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n",
00095                     ::WSAGetLastError());
00096 
00097   return (result != ACE_INVALID_HANDLE);
00098 #elif defined (ACE_HAS_LINUX_ATM)
00099   ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux\n");
00100 
00101   ACE_UNUSED_ARG(current_stream);
00102   ACE_UNUSED_ARG(remote_sap);
00103   ACE_UNUSED_ARG(leaf_id);
00104   ACE_UNUSED_ARG(timeout);
00105 
00106   return 0;
00107 #else
00108   ACE_UNUSED_ARG(current_stream);
00109   ACE_UNUSED_ARG(remote_sap);
00110   ACE_UNUSED_ARG(leaf_id);
00111   ACE_UNUSED_ARG(timeout);
00112   return 0;
00113 #endif
00114 }

int ACE_ATM_Connector::complete ( ACE_ATM_Stream new_stream,
ACE_ATM_Addr remote_sap,
ACE_Time_Value tv 
)

Try to complete a non-blocking connection. If connection completion is successful then new_stream contains the connected ACE_SOCK_Stream. If remote_sap is non-NULL then it will contain the address of the connected peer.

Definition at line 46 of file ATM_Connector.inl.

00049 {
00050   ACE_TRACE ("ACE_ATM_Connector::complete");
00051 #if defined (ACE_HAS_ATM)
00052   return connector_.complete(new_stream.get_stream(),
00053                              remote_sap,
00054                              tv);
00055 #else
00056   ACE_UNUSED_ARG(new_stream);
00057   ACE_UNUSED_ARG(remote_sap);
00058   ACE_UNUSED_ARG(tv);
00059   return 0;
00060 #endif
00061 }

int ACE_ATM_Connector::connect ( ACE_ATM_Stream new_stream,
const ACE_ATM_Addr remote_sap,
ACE_ATM_Params  params = ACE_ATM_Params(),
ACE_ATM_QoS  options = ACE_ATM_QoS(),
ACE_Time_Value timeout = 0,
const ACE_ATM_Addr local_sap = ACE_ATM_Addr("", 0),
int  reuse_addr = 0,
#if defined(ACE_WIN32) int  flags = 0,
#else int  flags = O_RDWR,
#endifint  perms = 0 
)

Actively connect and produce a new_stream if things go well. The remote_sap is the address that we are trying to connect with. The <params> are the parameters needed for either socket or XTI/ATM connections. The timeout is the amount of time to wait to connect. If it's 0 then we block indefinitely. If *timeout == {0, 0} then the connection is done using non-blocking mode. In this case, if the connection can't be made immediately the value of -1 is returned with errno == EWOULDBLOCK. If *timeout > {0, 0} then this is the maximum amount of time to wait before timing out. If the time expires before the connection is made errno == ETIME. The local_sap is the value of local address to bind to. If it's the default value of <ACE_ATM_Addr::sap_any> then the user is letting the OS do the binding. If reuse_addr == 1 then the <local_addr> is reused, even if it hasn't been cleanedup yet.

void ACE_ATM_Connector::dump ( void   )  const

Dump the state of an object.

Definition at line 9 of file ATM_Connector.inl.

00010 {
00011 #if defined (ACE_HAS_DUMP)
00012   ACE_TRACE ("ACE_ATM_Connector::dump");
00013 #endif /* ACE_HAS_DUMP */
00014 }

bool ACE_ATM_Connector::reset_new_handle ( ACE_HANDLE  handle  ) 

Resets any event associations on this handle.

Definition at line 118 of file ATM_Connector.inl.

00119 {
00120 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00121   // Reset the event association
00122   return ::WSAEventSelect ((SOCKET) handle,
00123                            0,
00124                            0);
00125 #else /* !defined ACE_HAS_WINSOCK2 */
00126   ACE_UNUSED_ARG (handle);
00127   return false;
00128 #endif /* ACE_WIN32 */
00129 }


Member Data Documentation

Declare the dynamic allocation hooks.

Definition at line 149 of file ATM_Connector.h.

Definition at line 152 of file ATM_Connector.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Nov 22 23:13:50 2009 for ACE by  doxygen 1.6.1