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