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 ()
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.
25 ACE_ATM_Connector::connect (ACE_ATM_Stream
&new_stream
,
26 const ACE_ATM_Addr
&remote_sap
,
27 ACE_ATM_Params params
,
29 ACE_Time_Value
*timeout
,
30 const ACE_ATM_Addr
&local_sap
,
35 ACE_TRACE ("ACE_ATM_Connector::connect");
36 #if defined (ACE_HAS_FORE_ATM_XTI)
37 return connector_
.connect(new_stream
.get_stream(),
47 params
.get_user_data(),
49 #elif defined (ACE_HAS_FORE_ATM_WS2)
50 ACELIB_DEBUG(LM_DEBUG
,
51 ACE_TEXT ("ATM_Connector(connect): set QoS parameters\n" ));
53 ACE_HANDLE s
= new_stream
.get_handle();
54 struct sockaddr_atm
*saddr
= ( struct sockaddr_atm
*)remote_sap
.get_addr();
55 ACE_QoS cqos
= options
.get_qos();
57 ACE_QoS_Params qos_params
= ACE_QoS_Params(0,
63 ACELIB_DEBUG(LM_DEBUG
,
64 ACE_TEXT ("ATM_Connector(connect): connecting...\n"));
66 int result
= ACE_OS::connect( s
,
67 ( struct sockaddr
*)saddr
,
68 sizeof( struct sockaddr_atm
),
72 ACE_OS::printf( "ATM_Connector(connect): connection failed, %d\n",
76 #elif defined (ACE_HAS_LINUX_ATM)
77 ACE_UNUSED_ARG (params
);
78 ACE_UNUSED_ARG (timeout
);
79 ACE_UNUSED_ARG (reuse_addr
);
80 ACE_UNUSED_ARG (perms
);
81 ACE_UNUSED_ARG (flags
);
83 ACE_HANDLE handle
= new_stream
.get_handle();
84 ATM_QoS qos
=options
.get_qos();
85 ATM_Addr
*local_addr
=(ATM_Addr
*)local_sap
.get_addr(),
86 *remote_addr
=(ATM_Addr
*)remote_sap
.get_addr();
88 if (ACE_OS::setsockopt(handle
,
91 reinterpret_cast<char*> (&(local_addr
->atmsap
)),
92 sizeof(local_addr
->atmsap
)) < 0) {
93 ACE_OS::printf( "ATM_Connector(connect): unable to set atmsap %d\nContinuing...",
96 if (ACE_OS::setsockopt(handle
,
99 reinterpret_cast<char*> (&qos
),
101 ACELIB_DEBUG((LM_DEBUG
,ACE_TEXT ("ATM_Connector(connect): unable to set qos %d\n"),
106 int result
= ACE_OS::connect(handle
,
107 (struct sockaddr
*)&(remote_addr
->sockaddratmsvc
),
108 sizeof( remote_addr
->sockaddratmsvc
));
111 ACELIB_DEBUG(LM_DEBUG
,
112 ACE_TEXT ("ATM_Connector(connect): connection failed, %d\n"),
117 ACE_UNUSED_ARG (new_stream
);
118 ACE_UNUSED_ARG (remote_sap
);
119 ACE_UNUSED_ARG (params
);
120 ACE_UNUSED_ARG (options
);
121 ACE_UNUSED_ARG (timeout
);
122 ACE_UNUSED_ARG (local_sap
);
123 ACE_UNUSED_ARG (reuse_addr
);
124 ACE_UNUSED_ARG (flags
);
125 ACE_UNUSED_ARG (perms
);
127 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
130 // Close versioned namespace, if enabled by the user.
131 ACE_END_VERSIONED_NAMESPACE_DECL
133 #endif /* ACE_HAS_ATM */