-
Notifications
You must be signed in to change notification settings - Fork 18
Implement safe sendmsg/recvmsg abstractions #16
base: master
Are you sure you want to change the base?
Conversation
Supports SCM_CREDENTIALS and SCM_RIGHTS control messages
thank you! |
@@ -8,11 +8,16 @@ repository = "https://github.com/sfackler/rust-unix-socket" | |||
documentation = "https://sfackler.github.io/rust-unix-socket/doc/v0.4.5/unix_socket" | |||
readme = "README.md" | |||
keywords = ["posix", "unix", "socket", "domain"] | |||
links = "cmsg_manip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary - it's only needed when linking to third party stuff.
Thanks for doing this! I left some comments here and there. Also, this'll need to be put behind a feature since these are Linux-only APIs I believe. I'm not totally sure what the API for |
I think all of the flags are potentially applicable and usable with this API. If you want, I can replace the c_int with a struct of bools to make it a bit more friendly? Can also take it out completely, but I think the options flags provides and the data it returns are genuinely useful. Will probably work to address comments today |
Oh yeah, the options flags are definitely useful, I'd just prefer something more structured than a raw c_int. A struct with bool setters/getters seems reasonable to me. |
Take a look at the latest version of the pull request. Replaced it with the struct as requested |
I just saw this -- I have a PR for a pure-Rust implementation of this (just |
@@ -771,6 +802,46 @@ impl UnixDatagram { | |||
} | |||
} | |||
|
|||
/// Receives data on the socket. | |||
/// | |||
/// If path is None, the peer address set by the `connect` method will be used. If it has not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path
doesn't appear to be a parameter here anymore.
Finally got around to addressing the comments |
/// | ||
/// This is a Rust version of `struct ucred` from sys/socket.h | ||
#[derive(Clone, Debug)] | ||
pub struct UCred{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct ucred
now exists in libc
, from version 0.2.3: rust-lang/libc@4920c7e :)
Supports SCM_CREDENTIALS and SCM_RIGHTS control messages
Resolves #4 and resolves #5