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