MCPcopy Index your code
hub / github.com/Starry-OS/StarryOS / SocketAddrExt

Interface SocketAddrExt

api/src/socket.rs:20–31  ·  view source on GitHub ↗

Trait to extend [`SocketAddr`] and its variants with methods for reading from and writing to user space.

Source from the content-addressed store, hash-verified

18/// Trait to extend [`SocketAddr`] and its variants with methods for reading
19/// from and writing to user space.
20pub trait SocketAddrExt: Sized {
21 /// This method attempts to interpret the data pointed to by `addr` with the
22 /// given `addrlen` as a valid socket address of the implementing type.
23 fn read_from_user(addr: UserConstPtr<sockaddr>, addrlen: socklen_t) -> AxResult<Self>;
24
25 /// This method serializes the current socket address instance into the
26 /// [`sockaddr`] structure pointed to by `addr` in user space.
27 fn write_to_user(&self, addr: UserPtr<sockaddr>, addrlen: &mut socklen_t) -> AxResult<()>;
28
29 /// Gets the address family of the socket address.
30 fn family(&self) -> u16;
31}
32
33fn read_family(addr: UserConstPtr<sockaddr>, addrlen: socklen_t) -> AxResult<u16> {
34 if size_of::<__kernel_sa_family_t>() > addrlen as usize {

Callers

nothing calls this directly

Implementers 1

socket.rsapi/src/socket.rs

Calls

no outgoing calls

Tested by

no test coverage detected