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