@@ -25,6 +25,23 @@ use sys::net::netc as c;
2525use sys_common:: { AsInner , FromInner , IntoInner } ;
2626use time:: Duration ;
2727
28+ #[ cfg( any( target_os = "dragonfly" , target_os = "freebsd" ,
29+ target_os = "ios" , target_os = "macos" ,
30+ target_os = "openbsd" ) ) ]
31+ use sys:: net:: netc:: IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP ;
32+ #[ cfg( not( any( target_os = "dragonfly" , target_os = "freebsd" ,
33+ target_os = "ios" , target_os = "macos" ,
34+ target_os = "openbsd" ) ) ) ]
35+ use sys:: net:: netc:: IPV6_ADD_MEMBERSHIP ;
36+ #[ cfg( any( target_os = "dragonfly" , target_os = "freebsd" ,
37+ target_os = "ios" , target_os = "macos" ,
38+ target_os = "openbsd" ) ) ]
39+ use sys:: net:: netc:: IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP ;
40+ #[ cfg( not( any( target_os = "dragonfly" , target_os = "freebsd" ,
41+ target_os = "ios" , target_os = "macos" ,
42+ target_os = "openbsd" ) ) ) ]
43+ use sys:: net:: netc:: IPV6_DROP_MEMBERSHIP ;
44+
2845////////////////////////////////////////////////////////////////////////////////
2946// sockaddr and misc bindings
3047////////////////////////////////////////////////////////////////////////////////
@@ -40,7 +57,8 @@ pub fn setsockopt<T>(sock: &Socket, opt: c_int, val: c_int,
4057}
4158
4259pub fn getsockopt < T : Copy > ( sock : & Socket , opt : c_int ,
43- val : c_int ) -> io:: Result < T > { unsafe {
60+ val : c_int ) -> io:: Result < T > {
61+ unsafe {
4462 let mut slot: T = mem:: zeroed ( ) ;
4563 let mut len = mem:: size_of :: < T > ( ) as c:: socklen_t ;
4664 try!( cvt ( c:: getsockopt ( * sock. as_inner ( ) , opt, val,
@@ -532,7 +550,7 @@ impl UdpSocket {
532550 ipv6mr_multiaddr : * multiaddr. as_inner ( ) ,
533551 ipv6mr_interface : to_ipv6mr_interface ( interface) ,
534552 } ;
535- setsockopt ( & self . inner , c:: IPPROTO_IPV6 , c :: IPV6_ADD_MEMBERSHIP , mreq)
553+ setsockopt ( & self . inner , c:: IPPROTO_IPV6 , IPV6_ADD_MEMBERSHIP , mreq)
536554 }
537555
538556 pub fn leave_multicast_v4 ( & self , multiaddr : & Ipv4Addr , interface : & Ipv4Addr )
@@ -550,7 +568,7 @@ impl UdpSocket {
550568 ipv6mr_multiaddr : * multiaddr. as_inner ( ) ,
551569 ipv6mr_interface : to_ipv6mr_interface ( interface) ,
552570 } ;
553- setsockopt ( & self . inner , c:: IPPROTO_IPV6 , c :: IPV6_DROP_MEMBERSHIP , mreq)
571+ setsockopt ( & self . inner , c:: IPPROTO_IPV6 , IPV6_DROP_MEMBERSHIP , mreq)
554572 }
555573
556574 pub fn set_ttl ( & self , ttl : u32 ) -> io:: Result < ( ) > {
0 commit comments