summaryrefslogtreecommitdiff
path: root/src/sys/socket/mod.rs
AgeCommit message (Collapse)Author
2016-08-10Fix nix on FreeBSD amd64Alan Somers
On Linux, the cmsg_len field of struct cmsghdr has type size_t, but it has size socklen_t on POSIX-compliant operating systems. So on POSIX-compliant 64-bit operating systems, struct cmsghdr has padding gaps that aren't present on Linux. Most of the issues fixed by this commit related to those gaps. src/sys/socket/ffi.rs Fix the type of the cmsg_data field so the struct layout will be correct. src/sys/socket/mod.rs In CmsgIterator.next, only return a single file descriptor. sendmsg(2) can only stuff a single file descriptor into each cmsg. In cmsg_align, fix the rounding calculation, and eliminate a division instruction. Add a missing cmsg_align call in ControlMessage.len In ControlMessage.encode_into, add any necessary padding bytes between the cmsghdr and the data. In sendmsg, fix some len<->capacity confusion.
2016-05-01Support sockaddr_nl in sockaddr_storage_to_addr().James Peach
Add support for converting AF_NETLINK sockaddr_nl addresses to Sockaddr::Netlink(). This lets socket::recvmsg() work on netlink sockets.
2016-01-29Convert MSG_ flags to bitflags! type.Philipp Matthias Schaefer
2016-01-28Derive all the thingsAlexander Polakov
as suggested by @kamalmarhubi
2016-01-28Netlink bitsAlexander Polakov
2016-01-28Move errno::Result back to crate rootarcnmx
2016-01-28Errno::result()arcnmx
2015-12-22Fix broken tests on nightlyCarl Lerche
2015-12-22Implement support for getsockopt of peer credentials using the Linux ↵Magnus Hoff
specific SO_PEERCRED
2015-12-04socket(): add protocol argument (breaking change)Alexander Polakov
2015-10-28Fix handling of sockaddr_un lengthsGeoffrey Thomas
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-06Add support for sendmsg(2), recvmsg(2), and cmsg(3)Geoffrey Thomas
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-09-28Revert "Add support for sendmsg(2), recvmsg(2), and cmsg(4)"Carl Lerche
This reverts commit 046af7d1ba82506f9bc48e62ac0584361025fc02.
2015-09-24Add support for sendmsg(2), recvmsg(2), and cmsg(4)Geoffrey Thomas
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-06-15TCP_KEEPALIVE, TCP_KEEPIDLE, split SockOpt traitY. T. Chung
* Split SockOpt trait into GetSockOpt and SetSockOpt. * Add support for TCP_KEEPALIVE & TCP_KEEPIDLE
2015-05-28Remove std::os::unix::io::RawFd re-exportCarl Lerche
2015-05-28Pass shutdown enum by valueCarl Lerche
2015-05-27Add sys::socket send and recvPhil Dawes
2015-05-21Add socket::shutdown functionhoxnox
libc::funcs::bsd43::shutdown is used
2015-05-07More multicast supportCarl Lerche
2015-04-24FromPrimitive is no moreFlorian Hartwig
2015-04-20Fix build on Rust nightliesCarl Lerche
2015-04-11Add socketpairFlorian Hartwig
2015-04-06Use fcntl:Fd vs. std::os::unix::io::RawFdCarl Lerche
2015-04-06Get compiling on Rust 1.0 betaCarl Lerche
Initially support this by assuming the lowest common denominator. The long term solution is to improve the build system to allow pulling in more specific features that are available on the target system.
2015-04-03'derive(Copy)' needs Clone nowFlorian Hartwig
2015-04-03Fd ist now RawFdFlorian Hartwig
2015-03-24NixResult -> nix::Result; NixError -> nix::ErrorCarl Lerche
2015-03-16Fix on 32bit platformsCarl Lerche
2015-03-14Make sockaddr_storage_to_addr public.Jan Bujak
2015-03-14Derive FromPrimitive for SockType.Jan Bujak
2015-03-13Amend some files to make it compile on arm-linux-androideabi.kennytm
2015-02-27Further SockAddr & NixPath cleanupCarl Lerche
2015-02-25Large cleanup, mostly of socket functionsCarl Lerche
2015-02-23in_addr conversions + IP_DROP_MEMBERSHIP supportCarl Lerche
2015-02-23Improve ergonomics of getsockopt / setsockoptCarl Lerche
2015-02-22Remove prefix from SockAddr variantsCarl Lerche
2015-02-22Split up socket moduleCarl Lerche