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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
// -*- C++ -*-
//
// $Id$
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
ACE_ATM_Stream::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_ATM_Stream::dump");
#endif /* ACE_HAS_DUMP */
}
ACE_INLINE
ACE_ATM_Stream::ACE_ATM_Stream (void)
{
ACE_TRACE ("ACE_ATM_Stream::ACE_ATM_Stream");
}
ACE_INLINE
int
ACE_ATM_Stream::open (ACE_ATM_Params params)
{
ACE_TRACE ("ACE_ATM_Stream::open");
#if defined (ACE_HAS_FORE_ATM_XTI)
ACE_HANDLE handle = stream_.open (params.get_device(),
params.get_oflag(),
params.get_info());
return (handle == ACE_INVALID_HANDLE ? -1 : 0);
#elif defined (ACE_HAS_FORE_ATM_WS2)
params.set_flags( ACE_FLAG_MULTIPOINT_C_ROOT | ACE_FLAG_MULTIPOINT_D_ROOT );
int retval = stream_.open (params.get_type(),
params.get_protocol_family(),
params.get_protocol(),
params.get_protocol_info(),
params.get_sock_group(),
params.get_flags(),
params.get_reuse_addr());
if (retval == -1)
return -1;
struct sockaddr_atm sock_addr;
ACE_OS::memset(&sock_addr, 0, sizeof(struct sockaddr_atm));
sock_addr.satm_family = AF_ATM;
sock_addr.satm_number.AddressType=ADDR_ANY;
sock_addr.satm_number.NumofDigits = ATM_ADDR_SIZE;
sock_addr.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT;
sock_addr.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT;
sock_addr.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT;
if (ACE_OS::bind(get_handle(),
(struct sockaddr FAR *)&sock_addr,
sizeof(struct sockaddr_atm)) < 0)
{
ACE_OS::printf("Error binding local address: %d",WSAGetLastError());
return -1;
}
return 0;
#else
ACE_UNUSED_ARG(params);
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI */
}
ACE_INLINE
int
ACE_ATM_Stream::close (void)
{
ACE_TRACE ("ACE_ATM_Stream::close");
#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
return stream_.close ();
#else
return 0;
#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */
}
ACE_INLINE
ATM_Stream&
ACE_ATM_Stream::get_stream (void)
{
ACE_TRACE ("ACE_ATM_Stream::get_stream");
return stream_;
}
ACE_INLINE
ssize_t
ACE_ATM_Stream::recv (void *buf,
size_t n,
int *flags) const
{
ACE_TRACE ("ACE_ATM_Stream::recv");
#if defined (ACE_HAS_FORE_ATM_XTI)
return stream_.recv (buf,
n,
flags);
#elif defined (ACE_HAS_FORE_ATM_WS2)
return stream_.recv (buf,
n);
#else
ACE_UNUSED_ARG(buf);
ACE_UNUSED_ARG(n);
ACE_UNUSED_ARG(flags);
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
ACE_INLINE
ssize_t
ACE_ATM_Stream::send_n (const void *buf,
size_t n,
int flags) const
{
ACE_TRACE ("ACE_ATM_Stream::send_n");
#if defined (ACE_HAS_FORE_ATM_XTI)
return stream_.send_n (buf,
n,
flags);
#elif defined (ACE_HAS_FORE_ATM_WS2)
return stream_.send_n (buf,
n,
flags);
#else
ACE_UNUSED_ARG(buf);
ACE_UNUSED_ARG(n);
ACE_UNUSED_ARG(flags);
return (0);
#endif /* ACE_HAS_FORE_ATM_XTI */
}
ACE_END_VERSIONED_NAMESPACE_DECL
|