Skip to main content

Module addr

Module addr 

Source
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 by recvfrom/recvmsg) into a SocketAddr, given the address length the kernel reported.
std_to_sockaddr
Convert a SocketAddr into a sockaddr_storage + length suitable for sendto/sendmsg’s msg_name/msg_namelen.