2 #include "ace/ATM_Connector.h"
3 #if defined (ACE_HAS_ATM)
5 #include "ace/Handle_Set.h"
7 #if !defined (__ACE_INLINE__)
8 #include "ace/ATM_Connector.inl"
9 #endif /* __ACE_INLINE__ */
11 // Open versioned namespace, if enabled by the user.
12 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector
)
16 ACE_ATM_Connector::ACE_ATM_Connector (void)
18 ACE_TRACE ("ACE_ATM_Connector::ACE_ATM_Connector");
21 // Actively connect and produce a new ACE_ATM_Stream if things go well...
22 // Connect the <new_stream> to the <remote_sap>, waiting up to
23 // <timeout> amount of time if necessary.
26 ACE_ATM_Connector::connect (ACE_ATM_Stream
&new_stream
,
27 const ACE_ATM_Addr
&remote_sap
,
28 ACE_ATM_Params params
,
30 ACE_Time_Value
*timeout
,
31 const ACE_ATM_Addr
&local_sap
,
36 ACE_TRACE ("ACE_ATM_Connector::connect");
37 #if defined (ACE_HAS_FORE_ATM_XTI)
38 return connector_
.connect(new_stream
.get_stream(),
48 params
.get_user_data(),
50 #elif defined (ACE_HAS_FORE_ATM_WS2)
51 ACELIB_DEBUG(LM_DEBUG
,
52 ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" ));
54 ACE_HANDLE s
= new_stream
.get_handle();
55 struct sockaddr_atm
*saddr
= ( struct sockaddr_atm
*)remote_sap
.get_addr();
56 ACE_QoS cqos
= options
.get_qos();
58 ACE_QoS_Params qos_params
= ACE_QoS_Params(0,
64 ACELIB_DEBUG(LM_DEBUG
,
65 ACE_TEXT ("ATM_Connector(connect): connecting...\n"));
67 int result
= ACE_OS::connect( s
,
68 ( struct sockaddr
*)saddr
,
69 sizeof( struct sockaddr_atm
),
73 ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n",
77 #elif defined (ACE_HAS_LINUX_ATM)
78 ACE_UNUSED_ARG (params
);
79 ACE_UNUSED_ARG (timeout
);
80 ACE_UNUSED_ARG (reuse_addr
);
81 ACE_UNUSED_ARG (perms
);
82 ACE_UNUSED_ARG (flags
);
84 ACE_HANDLE handle
= new_stream
.get_handle();
85 ATM_QoS qos
=options
.get_qos();
86 ATM_Addr
*local_addr
=(ATM_Addr
*)local_sap
.get_addr(),
87 *remote_addr
=(ATM_Addr
*)remote_sap
.get_addr();
89 if (ACE_OS::setsockopt(handle
,
92 reinterpret_cast<char*> (&(local_addr
->atmsap
)),
93 sizeof(local_addr
->atmsap
)) < 0) {
94 ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...",
97 if (ACE_OS::setsockopt(handle
,
100 reinterpret_cast<char*> (&qos
),
102 ACELIB_DEBUG((LM_DEBUG
,ACE_TEXT ("ATM_Connector(connect): unable to set qos %d\n"),
107 int result
= ACE_OS::connect(handle
,
108 (struct sockaddr
*)&(remote_addr
->sockaddratmsvc
),
109 sizeof( remote_addr
->sockaddratmsvc
));
112 ACELIB_DEBUG(LM_DEBUG
,
113 ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"),
118 ACE_UNUSED_ARG (new_stream
);
119 ACE_UNUSED_ARG (remote_sap
);
120 ACE_UNUSED_ARG (params
);
121 ACE_UNUSED_ARG (options
);
122 ACE_UNUSED_ARG (timeout
);
123 ACE_UNUSED_ARG (local_sap
);
124 ACE_UNUSED_ARG (reuse_addr
);
125 ACE_UNUSED_ARG (flags
);
126 ACE_UNUSED_ARG (perms
);
128 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
131 // Close versioned namespace, if enabled by the user.
132 ACE_END_VERSIONED_NAMESPACE_DECL
134 #endif /* ACE_HAS_ATM */