@@ -226,58 +226,6 @@ impl ByteRepr for SockaddrStorage {
226226 }
227227}
228228
229- impl SockaddrIn {
230- pub fn to_libc ( & self ) -> :: libc:: sockaddr_in {
231- let mut sin_zero = [ 0u8 ; 8 ] ;
232- sin_zero. copy_from_slice ( & self . sin_zero . borrow ( ) ) ;
233- :: libc:: sockaddr_in {
234- sin_family : * self . sin_family . borrow ( ) ,
235- sin_port : * self . sin_port . borrow ( ) ,
236- sin_addr : :: libc:: in_addr {
237- s_addr : * self . sin_addr . borrow ( ) . s_addr . borrow ( ) ,
238- } ,
239- sin_zero,
240- }
241- }
242- pub fn from_libc ( l : & :: libc:: sockaddr_in ) -> Self {
243- Self {
244- sin_family : Rc :: new ( RefCell :: new ( l. sin_family ) ) ,
245- sin_port : Rc :: new ( RefCell :: new ( l. sin_port ) ) ,
246- sin_addr : Rc :: new ( RefCell :: new ( InAddr {
247- s_addr : Rc :: new ( RefCell :: new ( l. sin_addr . s_addr ) ) ,
248- } ) ) ,
249- sin_zero : Rc :: new ( RefCell :: new ( l. sin_zero . to_vec ( ) . into_boxed_slice ( ) ) ) ,
250- }
251- }
252- }
253-
254- impl SockaddrIn6 {
255- pub fn to_libc ( & self ) -> :: libc:: sockaddr_in6 {
256- let mut s6 = [ 0u8 ; 16 ] ;
257- s6. copy_from_slice ( & self . sin6_addr . borrow ( ) . s6_addr . borrow ( ) ) ;
258- :: libc:: sockaddr_in6 {
259- sin6_family : * self . sin6_family . borrow ( ) ,
260- sin6_port : * self . sin6_port . borrow ( ) ,
261- sin6_flowinfo : * self . sin6_flowinfo . borrow ( ) ,
262- sin6_addr : :: libc:: in6_addr { s6_addr : s6 } ,
263- sin6_scope_id : * self . sin6_scope_id . borrow ( ) ,
264- }
265- }
266- pub fn from_libc ( l : & :: libc:: sockaddr_in6 ) -> Self {
267- Self {
268- sin6_family : Rc :: new ( RefCell :: new ( l. sin6_family ) ) ,
269- sin6_port : Rc :: new ( RefCell :: new ( l. sin6_port ) ) ,
270- sin6_flowinfo : Rc :: new ( RefCell :: new ( l. sin6_flowinfo ) ) ,
271- sin6_addr : Rc :: new ( RefCell :: new ( In6Addr {
272- s6_addr : Rc :: new ( RefCell :: new (
273- l. sin6_addr . s6_addr . to_vec ( ) . into_boxed_slice ( ) ,
274- ) ) ,
275- } ) ) ,
276- sin6_scope_id : Rc :: new ( RefCell :: new ( l. sin6_scope_id ) ) ,
277- }
278- }
279- }
280-
281229impl ByteRepr for :: libc:: sockaddr { }
282230impl ByteRepr for :: libc:: sockaddr_in { }
283231impl ByteRepr for :: libc:: sockaddr_in6 { }
0 commit comments