]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/unix/l4re.rs
2c6f21aa21a3a5a9b1aea03a158837ffa9161f3b
[rust.git] / src / libstd / sys / unix / l4re.rs
1 macro_rules! unimpl {
2     () => (return Err(io::Error::new(io::ErrorKind::Other, "No networking available on L4Re."));)
3 }
4
5 pub mod net {
6     #![allow(warnings)]
7     use crate::fmt;
8     use crate::io::{self, IoSlice, IoSliceMut};
9     use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr};
10     use crate::sys_common::{AsInner, FromInner, IntoInner};
11     use crate::sys::fd::FileDesc;
12     use crate::time::Duration;
13     use crate::convert::TryFrom;
14
15     #[allow(unused_extern_crates)]
16     pub extern crate libc as netc;
17
18     pub struct Socket(FileDesc);
19     impl Socket {
20         pub fn new(_: &SocketAddr, _: libc::c_int) -> io::Result<Socket> {
21             unimpl!();
22         }
23
24         pub fn new_raw(_: libc::c_int, _: libc::c_int) -> io::Result<Socket> {
25             unimpl!();
26         }
27
28         pub fn new_pair(_: libc::c_int, _: libc::c_int) -> io::Result<(Socket, Socket)> {
29             unimpl!();
30         }
31
32         pub fn connect_timeout(&self, _: &SocketAddr, _: Duration) -> io::Result<()> {
33             unimpl!();
34         }
35
36         pub fn accept(&self, _: *mut libc::sockaddr, _: *mut libc::socklen_t)
37                   -> io::Result<Socket> {
38             unimpl!();
39         }
40
41         pub fn duplicate(&self) -> io::Result<Socket> {
42             unimpl!();
43         }
44
45         pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
46             unimpl!();
47         }
48
49         pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
50             unimpl!();
51         }
52
53         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
54             unimpl!();
55         }
56
57         pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
58             unimpl!();
59         }
60
61         pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
62             unimpl!();
63         }
64
65         pub fn write(&self, _: &[u8]) -> io::Result<usize> {
66             unimpl!();
67         }
68
69         pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
70             unimpl!();
71         }
72
73         pub fn set_timeout(&self, _: Option<Duration>, _: libc::c_int) -> io::Result<()> {
74             unimpl!();
75         }
76
77         pub fn timeout(&self, _: libc::c_int) -> io::Result<Option<Duration>> {
78             unimpl!();
79         }
80
81         pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
82             unimpl!();
83         }
84
85         pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
86             unimpl!();
87         }
88
89         pub fn nodelay(&self) -> io::Result<bool> {
90             unimpl!();
91         }
92
93         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
94             unimpl!();
95         }
96
97         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
98             unimpl!();
99         }
100     }
101
102     impl AsInner<libc::c_int> for Socket {
103         fn as_inner(&self) -> &libc::c_int { self.0.as_inner() }
104     }
105
106     impl FromInner<libc::c_int> for Socket {
107         fn from_inner(fd: libc::c_int) -> Socket { Socket(FileDesc::new(fd)) }
108     }
109
110     impl IntoInner<libc::c_int> for Socket {
111         fn into_inner(self) -> libc::c_int { self.0.into_raw() }
112     }
113
114     pub struct TcpStream {
115         inner: Socket,
116     }
117
118     impl TcpStream {
119         pub fn connect(_: io::Result<&SocketAddr>) -> io::Result<TcpStream> {
120             unimpl!();
121         }
122
123         pub fn connect_timeout(_: &SocketAddr, _: Duration) -> io::Result<TcpStream> {
124             unimpl!();
125         }
126
127         pub fn socket(&self) -> &Socket { &self.inner }
128
129         pub fn into_socket(self) -> Socket { self.inner }
130
131         pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
132             unimpl!();
133         }
134
135         pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
136             unimpl!();
137         }
138
139         pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
140             unimpl!();
141         }
142
143         pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
144             unimpl!();
145         }
146
147         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
148             unimpl!();
149         }
150
151         pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
152             unimpl!();
153         }
154
155         pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
156             unimpl!();
157         }
158
159         pub fn write(&self, _: &[u8]) -> io::Result<usize> {
160             unimpl!();
161         }
162
163         pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
164             unimpl!();
165         }
166
167         pub fn peer_addr(&self) -> io::Result<SocketAddr> {
168             unimpl!();
169         }
170
171         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
172             unimpl!();
173         }
174
175         pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
176             unimpl!();
177         }
178
179         pub fn duplicate(&self) -> io::Result<TcpStream> {
180             unimpl!();
181         }
182
183         pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
184             unimpl!();
185         }
186
187         pub fn nodelay(&self) -> io::Result<bool> {
188             unimpl!();
189         }
190
191         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
192             unimpl!();
193         }
194
195         pub fn ttl(&self) -> io::Result<u32> {
196             unimpl!();
197         }
198
199         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
200             unimpl!();
201         }
202
203         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
204             unimpl!();
205         }
206     }
207
208     impl FromInner<Socket> for TcpStream {
209         fn from_inner(socket: Socket) -> TcpStream {
210             TcpStream { inner: socket }
211         }
212     }
213
214     impl fmt::Debug for TcpStream {
215         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
216             write!(f, "No networking support available on L4Re")
217         }
218     }
219
220     pub struct TcpListener {
221         inner: Socket,
222     }
223
224     impl TcpListener {
225         pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<TcpListener> {
226             unimpl!();
227         }
228
229         pub fn socket(&self) -> &Socket { &self.inner }
230
231         pub fn into_socket(self) -> Socket { self.inner }
232
233         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
234             unimpl!();
235         }
236
237         pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
238             unimpl!();
239         }
240
241         pub fn duplicate(&self) -> io::Result<TcpListener> {
242             unimpl!();
243         }
244
245         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
246             unimpl!();
247         }
248
249         pub fn ttl(&self) -> io::Result<u32> {
250             unimpl!();
251         }
252
253         pub fn set_only_v6(&self, _: bool) -> io::Result<()> {
254             unimpl!();
255         }
256
257         pub fn only_v6(&self) -> io::Result<bool> {
258             unimpl!();
259         }
260
261         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
262             unimpl!();
263         }
264
265         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
266             unimpl!();
267         }
268     }
269
270     impl FromInner<Socket> for TcpListener {
271         fn from_inner(socket: Socket) -> TcpListener {
272             TcpListener { inner: socket }
273         }
274     }
275
276     impl fmt::Debug for TcpListener {
277         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
278             write!(f, "No networking support available on L4Re.")
279         }
280     }
281
282     pub struct UdpSocket {
283         inner: Socket,
284     }
285
286     impl UdpSocket {
287         pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<UdpSocket> {
288             unimpl!();
289         }
290
291         pub fn socket(&self) -> &Socket { &self.inner }
292
293         pub fn into_socket(self) -> Socket { self.inner }
294
295         pub fn peer_addr(&self) -> io::Result<SocketAddr> {
296             unimpl!();
297         }
298
299         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
300             unimpl!();
301         }
302
303         pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
304             unimpl!();
305         }
306
307         pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
308             unimpl!();
309         }
310
311         pub fn send_to(&self, _: &[u8], _: &SocketAddr) -> io::Result<usize> {
312             unimpl!();
313         }
314
315         pub fn duplicate(&self) -> io::Result<UdpSocket> {
316             unimpl!();
317         }
318
319         pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
320             unimpl!();
321         }
322
323         pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
324             unimpl!();
325         }
326
327         pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
328             unimpl!();
329         }
330
331         pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
332             unimpl!();
333         }
334
335         pub fn set_broadcast(&self, _: bool) -> io::Result<()> {
336             unimpl!();
337         }
338
339         pub fn broadcast(&self) -> io::Result<bool> {
340             unimpl!();
341         }
342
343         pub fn set_multicast_loop_v4(&self, _: bool) -> io::Result<()> {
344             unimpl!();
345         }
346
347         pub fn multicast_loop_v4(&self) -> io::Result<bool> {
348             unimpl!();
349         }
350
351         pub fn set_multicast_ttl_v4(&self, _: u32) -> io::Result<()> {
352             unimpl!();
353         }
354
355         pub fn multicast_ttl_v4(&self) -> io::Result<u32> {
356             unimpl!();
357         }
358
359         pub fn set_multicast_loop_v6(&self, _: bool) -> io::Result<()> {
360             unimpl!();
361         }
362
363         pub fn multicast_loop_v6(&self) -> io::Result<bool> {
364             unimpl!();
365         }
366
367         pub fn join_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr)
368                              -> io::Result<()> {
369                                  unimpl!();
370         }
371
372         pub fn join_multicast_v6(&self, _: &Ipv6Addr, _: u32)
373                              -> io::Result<()> {
374                                  unimpl!();
375         }
376
377         pub fn leave_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr)
378                               -> io::Result<()> {
379                                   unimpl!();
380         }
381
382         pub fn leave_multicast_v6(&self, _: &Ipv6Addr, _: u32)
383                               -> io::Result<()> {
384                                   unimpl!();
385         }
386
387         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
388             unimpl!();
389         }
390
391         pub fn ttl(&self) -> io::Result<u32> {
392             unimpl!();
393         }
394
395         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
396             unimpl!();
397         }
398
399         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
400             unimpl!();
401         }
402
403         pub fn recv(&self, _: &mut [u8]) -> io::Result<usize> {
404             unimpl!();
405         }
406
407         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
408             unimpl!();
409         }
410
411         pub fn send(&self, _: &[u8]) -> io::Result<usize> {
412             unimpl!();
413         }
414
415         pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> {
416             unimpl!();
417         }
418     }
419
420     impl FromInner<Socket> for UdpSocket {
421         fn from_inner(socket: Socket) -> UdpSocket {
422             UdpSocket { inner: socket }
423         }
424     }
425
426     impl fmt::Debug for UdpSocket {
427         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
428             write!(f, "No networking support on L4Re available.")
429         }
430     }
431
432     pub struct LookupHost {
433         original: *mut libc::addrinfo,
434         cur: *mut libc::addrinfo,
435     }
436
437     impl Iterator for LookupHost {
438         type Item = SocketAddr;
439         fn next(&mut self) -> Option<SocketAddr> {
440             None
441         }
442     }
443
444     impl LookupHost {
445         pub fn port(&self) -> u16 {
446             unimpl!();
447         }
448     }
449
450     unsafe impl Sync for LookupHost {}
451     unsafe impl Send for LookupHost {}
452
453
454     impl TryFrom<&str> for LookupHost {
455         type Error = io::Error;
456
457         fn try_from(_v: &str) -> io::Result<LookupHost> {
458             unimpl!();
459         }
460     }
461
462     impl<'a> TryFrom<(&'a str, u16)> for LookupHost {
463         type Error = io::Error;
464
465         fn try_from(_v: (&'a str, u16)) -> io::Result<LookupHost> {
466             unimpl!();
467         }
468     }
469 }