1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#include "orbsvcs/FtRtEvent/EventChannel/SCTP_Fault_Detector.h"
#if (TAO_HAS_SCIOP == 1)
#include "orbsvcs/FtRtEvent/EventChannel/FTEC_Fault_Listener.h"
#include "ace/OS_NS_strings.h"
#include "ace/OS_NS_sys_socket.h"
#ifndef SCTP_HEARTBEAT_ITVL
#define SCTP_HEARTBEAT_ITVL 19
#endif
#ifndef SOL_SCTP
#define SOL_SCTP 132
#endif
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
SCTP_Connector::SCTP_Connector()
: heart_beat_(0)
{
}
int
SCTP_Connector::connect (ACE_SOCK_SEQPACK_Association &new_association,
const ACE_Addr &remote_sap,
const ACE_Time_Value *timeout,
const ACE_Addr &local_sap,
int reuse_addr,
int /* flags */,
int /* perms */,
int protocol)
{
ACE_TRACE ("SCTP_Connector::connect");
if (this->shared_open (new_association,
remote_sap.get_type (),
protocol,
reuse_addr) == -1)
return -1;
else if (this->shared_connect_start (new_association,
timeout,
local_sap) == -1)
return -1;
if (new_association.set_option(SOL_SCTP,
SCTP_HEARTBEAT_ITVL,
&heart_beat_,
sizeof(heart_beat_)) == -1)
return -1;
int result = ACE_OS::connect (new_association.get_handle (),
reinterpret_cast<sockaddr *> (remote_sap.get_addr ()),
remote_sap.get_size ());
return this->shared_connect_finish (new_association,
timeout,
result);
}
inline void SCTP_Connector::set_heart_beat(int hb)
{
heart_beat_ = hb;
}
SCTP_Fault_Detector::~SCTP_Fault_Detector()
{
}
int SCTP_Fault_Detector::parse_conf(int argc, ACE_TCHAR** argv)
{
ACE_TRACE ("SCTP_Fault_Detector::parse_conf");
for (int curarg = 0; curarg < argc; curarg++)
if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-HeartBeat")) == 0)
{
curarg++;
if (curarg < argc)
connector_.set_heart_beat(ACE_OS::atoi(argv[curarg]));
}
return 0;
}
TAO_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_SCTP == 1 */
|