Commit Graph

18 Commits

Author SHA1 Message Date
Kamal Marhubi
6d01a26510 socket: Respect IPv6 flowinfo and scope_id in InetAddr::from_std
Fixes #329
2016-03-30 14:20:02 -04:00
Philipp Matthias Schaefer
98352705b3 Convert MSG_ flags to bitflags! type. 2016-01-29 22:51:44 -05:00
Mattis Marjak
73dd2e05b8 update libc to 0.2.2 2016-01-18 21:29:38 -08:00
Geoffrey Thomas
ad87c3bdc9 Fix handling of sockaddr_un lengths
The returned length of AF_UNIX sockaddrs is significant, and generally
does not match the length of the entire structure. For filesystem
sockets, this is ignorable because the path is also NUL-terminated, but
for unbound sockets (e.g., a socketpair) or abstract-namespace
sockets (a Linux extension where the address is an arbitrary
bytestring), we need to keep track of the length.

Fixes #177. Also add a UnixAddr::new_abstract function and some better
handling of abstract-namespace socket addresses to fix #169.
2015-10-28 09:34:43 -07:00
Geoffrey Thomas
b5c1346374 Add support for sendmsg(2), recvmsg(2), and cmsg(3)
The best specification for control message layout appears to be
[RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4),
despite this not being a wire protocol. These definitions have also been
checked against glibc 2.19 <bits/socket.h> and Linux 4.0
<linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64.

The API differs a bit from the cmsg(3) API for type-safety reasons (and
also because the cmsg(3) API is terrible). See test/sys/test_socket.rs
for an example.

Only supports SCM_RIGHTS at the moment.

Fixes #88.
2015-10-06 19:30:26 -04:00
Carl Lerche
5948204460 Revert "Add support for sendmsg(2), recvmsg(2), and cmsg(4)"
This reverts commit 046af7d1ba.
2015-09-28 12:37:01 -07:00
Geoffrey Thomas
046af7d1ba Add support for sendmsg(2), recvmsg(2), and cmsg(4)
The best specification for control message layout appears to be
[RFC 2292, section 4](https://tools.ietf.org/html/rfc2292#section-4),
despite this not being a wire protocol. These definitions have also been
checked against glibc 2.19 <bits/socket.h> and Linux 4.0
<linux/socket.h>, and tested on Debian 8.1 and FreeBSD 10.2 x86_64.

The API differs a bit from the cmsg(4) API for type-safety reasons (and
also because the cmsg(4) API is terrible). See test/sys/test_socket.rs
for an example.

Only supports SCM_RIGHTS at the moment.

Fixes #88.
2015-09-24 23:18:44 -04:00
Florian Hartwig
e3d86a9ccd Add socketpair 2015-04-11 23:51:13 +02:00
Carl Lerche
ffc8826dfe Remove usage of std::num::Int 2015-04-01 20:35:24 -07:00
Carl Lerche
bf3d7c4939 Tweak conversion in test 2015-03-25 16:39:51 -07:00
Carl Lerche
0d5ea0b16d Track Rust master 2015-03-25 10:52:05 -07:00
Carl Lerche
47d2332c3c NixResult -> nix::Result; NixError -> nix::Error 2015-03-24 23:25:10 -07:00
Carl Lerche
2b60633c8b Track Rust nightlies 2015-03-19 15:08:45 -07:00
Carl Lerche
e8a58c83a5 Further SockAddr & NixPath cleanup 2015-02-27 11:14:38 -08:00
Carl Lerche
8a7cd5675d Large cleanup, mostly of socket functions 2015-02-25 12:24:43 -08:00
Carl Lerche
88988a31a0 Remove prefix from SockAddr variants 2015-02-22 20:50:34 -08:00
Carl Lerche
eb278aa4d7 Implement round trip SockAddr conversions 2015-02-22 12:57:01 -08:00
Carl Lerche
6af51aa232 Fix uio and add SockAddr conversions 2015-02-21 22:42:10 -08:00