]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/cloudabi/shims/net.rs
93eaf6a9e7d6970171ce5bf12463a07ffbc0ff07
[rust.git] / src / libstd / sys / cloudabi / shims / net.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use fmt;
12 use io;
13 use net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
14 use time::Duration;
15 use sys::{unsupported, Void};
16
17 pub extern crate libc as netc;
18
19 pub struct TcpStream(Void);
20
21 impl TcpStream {
22     pub fn connect(_: &SocketAddr) -> io::Result<TcpStream> {
23         unsupported()
24     }
25
26     pub fn connect_timeout(_: &SocketAddr, _: Duration) -> io::Result<TcpStream> {
27         unsupported()
28     }
29
30     pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
31         match self.0 {}
32     }
33
34     pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
35         match self.0 {}
36     }
37
38     pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
39         match self.0 {}
40     }
41
42     pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
43         match self.0 {}
44     }
45
46     pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
47         match self.0 {}
48     }
49
50     pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
51         match self.0 {}
52     }
53
54     pub fn write(&self, _: &[u8]) -> io::Result<usize> {
55         match self.0 {}
56     }
57
58     pub fn peer_addr(&self) -> io::Result<SocketAddr> {
59         match self.0 {}
60     }
61
62     pub fn socket_addr(&self) -> io::Result<SocketAddr> {
63         match self.0 {}
64     }
65
66     pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
67         match self.0 {}
68     }
69
70     pub fn duplicate(&self) -> io::Result<TcpStream> {
71         match self.0 {}
72     }
73
74     pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
75         match self.0 {}
76     }
77
78     pub fn nodelay(&self) -> io::Result<bool> {
79         match self.0 {}
80     }
81
82     pub fn set_ttl(&self, _: u32) -> io::Result<()> {
83         match self.0 {}
84     }
85
86     pub fn ttl(&self) -> io::Result<u32> {
87         match self.0 {}
88     }
89
90     pub fn take_error(&self) -> io::Result<Option<io::Error>> {
91         match self.0 {}
92     }
93
94     pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
95         match self.0 {}
96     }
97 }
98
99 impl fmt::Debug for TcpStream {
100     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
101         match self.0 {}
102     }
103 }
104
105 pub struct TcpListener(Void);
106
107 impl TcpListener {
108     pub fn bind(_: &SocketAddr) -> io::Result<TcpListener> {
109         unsupported()
110     }
111
112     pub fn socket_addr(&self) -> io::Result<SocketAddr> {
113         match self.0 {}
114     }
115
116     pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
117         match self.0 {}
118     }
119
120     pub fn duplicate(&self) -> io::Result<TcpListener> {
121         match self.0 {}
122     }
123
124     pub fn set_ttl(&self, _: u32) -> io::Result<()> {
125         match self.0 {}
126     }
127
128     pub fn ttl(&self) -> io::Result<u32> {
129         match self.0 {}
130     }
131
132     pub fn set_only_v6(&self, _: bool) -> io::Result<()> {
133         match self.0 {}
134     }
135
136     pub fn only_v6(&self) -> io::Result<bool> {
137         match self.0 {}
138     }
139
140     pub fn take_error(&self) -> io::Result<Option<io::Error>> {
141         match self.0 {}
142     }
143
144     pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
145         match self.0 {}
146     }
147 }
148
149 impl fmt::Debug for TcpListener {
150     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
151         match self.0 {}
152     }
153 }
154
155 pub struct UdpSocket(Void);
156
157 impl UdpSocket {
158     pub fn bind(_: &SocketAddr) -> io::Result<UdpSocket> {
159         unsupported()
160     }
161
162     pub fn socket_addr(&self) -> io::Result<SocketAddr> {
163         match self.0 {}
164     }
165
166     pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
167         match self.0 {}
168     }
169
170     pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
171         match self.0 {}
172     }
173
174     pub fn send_to(&self, _: &[u8], _: &SocketAddr) -> io::Result<usize> {
175         match self.0 {}
176     }
177
178     pub fn duplicate(&self) -> io::Result<UdpSocket> {
179         match self.0 {}
180     }
181
182     pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
183         match self.0 {}
184     }
185
186     pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
187         match self.0 {}
188     }
189
190     pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
191         match self.0 {}
192     }
193
194     pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
195         match self.0 {}
196     }
197
198     pub fn set_broadcast(&self, _: bool) -> io::Result<()> {
199         match self.0 {}
200     }
201
202     pub fn broadcast(&self) -> io::Result<bool> {
203         match self.0 {}
204     }
205
206     pub fn set_multicast_loop_v4(&self, _: bool) -> io::Result<()> {
207         match self.0 {}
208     }
209
210     pub fn multicast_loop_v4(&self) -> io::Result<bool> {
211         match self.0 {}
212     }
213
214     pub fn set_multicast_ttl_v4(&self, _: u32) -> io::Result<()> {
215         match self.0 {}
216     }
217
218     pub fn multicast_ttl_v4(&self) -> io::Result<u32> {
219         match self.0 {}
220     }
221
222     pub fn set_multicast_loop_v6(&self, _: bool) -> io::Result<()> {
223         match self.0 {}
224     }
225
226     pub fn multicast_loop_v6(&self) -> io::Result<bool> {
227         match self.0 {}
228     }
229
230     pub fn join_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
231         match self.0 {}
232     }
233
234     pub fn join_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
235         match self.0 {}
236     }
237
238     pub fn leave_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
239         match self.0 {}
240     }
241
242     pub fn leave_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
243         match self.0 {}
244     }
245
246     pub fn set_ttl(&self, _: u32) -> io::Result<()> {
247         match self.0 {}
248     }
249
250     pub fn ttl(&self) -> io::Result<u32> {
251         match self.0 {}
252     }
253
254     pub fn take_error(&self) -> io::Result<Option<io::Error>> {
255         match self.0 {}
256     }
257
258     pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
259         match self.0 {}
260     }
261
262     pub fn recv(&self, _: &mut [u8]) -> io::Result<usize> {
263         match self.0 {}
264     }
265
266     pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
267         match self.0 {}
268     }
269
270     pub fn send(&self, _: &[u8]) -> io::Result<usize> {
271         match self.0 {}
272     }
273
274     pub fn connect(&self, _: &SocketAddr) -> io::Result<()> {
275         match self.0 {}
276     }
277 }
278
279 impl fmt::Debug for UdpSocket {
280     fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
281         match self.0 {}
282     }
283 }
284
285 pub struct LookupHost(Void);
286
287 impl Iterator for LookupHost {
288     type Item = SocketAddr;
289     fn next(&mut self) -> Option<SocketAddr> {
290         match self.0 {}
291     }
292 }
293
294 pub fn lookup_host(_: &str) -> io::Result<LookupHost> {
295     unsupported()
296 }