about summary refs log tree commit diff
path: root/library/std/src/sys/net/connection/xous
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2025-02-07 18:34:09 +0100
committerjoboet <jonasboettiger@icloud.com>2025-02-12 14:13:35 +0100
commit80c60fe78375cb10a2fed6540dc2b29751fc4263 (patch)
tree207a56b85129112a5c9d217777bd8fca36a35526 /library/std/src/sys/net/connection/xous
parentc182ce9cbc8c29ebc1b4559d027df545e6cdd287 (diff)
downloadrust-80c60fe78375cb10a2fed6540dc2b29751fc4263.tar.gz
rust-80c60fe78375cb10a2fed6540dc2b29751fc4263.zip
std: replace the `FromInner` implementation for addresses with private conversion functions
Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed.

I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside  `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
Diffstat (limited to 'library/std/src/sys/net/connection/xous')
-rw-r--r--library/std/src/sys/net/connection/xous/mod.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/library/std/src/sys/net/connection/xous/mod.rs b/library/std/src/sys/net/connection/xous/mod.rs
index 3e18ed24208..e44a375b9e3 100644
--- a/library/std/src/sys/net/connection/xous/mod.rs
+++ b/library/std/src/sys/net/connection/xous/mod.rs
@@ -46,38 +46,3 @@ pub struct GetAddress {
 }
 
 pub use dns::LookupHost;
-
-#[allow(nonstandard_style)]
-pub mod netc {
-    pub const AF_INET: u8 = 0;
-    pub const AF_INET6: u8 = 1;
-    pub type sa_family_t = u8;
-
-    #[derive(Copy, Clone)]
-    pub struct in_addr {
-        pub s_addr: u32,
-    }
-
-    #[derive(Copy, Clone)]
-    pub struct sockaddr_in {
-        #[allow(dead_code)]
-        pub sin_family: sa_family_t,
-        pub sin_port: u16,
-        pub sin_addr: in_addr,
-    }
-
-    #[derive(Copy, Clone)]
-    pub struct in6_addr {
-        pub s6_addr: [u8; 16],
-    }
-
-    #[derive(Copy, Clone)]
-    pub struct sockaddr_in6 {
-        #[allow(dead_code)]
-        pub sin6_family: sa_family_t,
-        pub sin6_port: u16,
-        pub sin6_addr: in6_addr,
-        pub sin6_flowinfo: u32,
-        pub sin6_scope_id: u32,
-    }
-}