Expand description
sockaddr ⇄ SocketAddr conversions for the addressed socket seam.
recvfrom/recvmsg/sendto/sendmsg all speak libc::sockaddr_storage
(IPv4 or IPv6, selected by ss_family); the rest of yip works with
std::net::SocketAddr. These two helpers are the only place that bridges
the two representations, and the only new unsafe this task introduces
(confined to yip-io, per the crate’s unsafe-only-here contract).
Functions§
- sockaddr_
to_ std - Convert a
sockaddr_storage(as filled in byrecvfrom/recvmsg) into aSocketAddr, given the address length the kernel reported. - std_
to_ sockaddr - Convert a
SocketAddrinto asockaddr_storage+ length suitable forsendto/sendmsg’smsg_name/msg_namelen.