@@ -25,6 +25,23 @@ use sys::net::netc as c;
25
25
use sys_common:: { AsInner , FromInner , IntoInner } ;
26
26
use time:: Duration ;
27
27
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
+
28
45
////////////////////////////////////////////////////////////////////////////////
29
46
// sockaddr and misc bindings
30
47
////////////////////////////////////////////////////////////////////////////////
@@ -40,7 +57,8 @@ pub fn setsockopt<T>(sock: &Socket, opt: c_int, val: c_int,
40
57
}
41
58
42
59
pub 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 {
44
62
let mut slot: T = mem:: zeroed ( ) ;
45
63
let mut len = mem:: size_of :: < T > ( ) as c:: socklen_t ;
46
64
try!( cvt ( c:: getsockopt ( * sock. as_inner ( ) , opt, val,
@@ -532,7 +550,7 @@ impl UdpSocket {
532
550
ipv6mr_multiaddr : * multiaddr. as_inner ( ) ,
533
551
ipv6mr_interface : to_ipv6mr_interface ( interface) ,
534
552
} ;
535
- setsockopt ( & self . inner , c:: IPPROTO_IPV6 , c :: IPV6_ADD_MEMBERSHIP , mreq)
553
+ setsockopt ( & self . inner , c:: IPPROTO_IPV6 , IPV6_ADD_MEMBERSHIP , mreq)
536
554
}
537
555
538
556
pub fn leave_multicast_v4 ( & self , multiaddr : & Ipv4Addr , interface : & Ipv4Addr )
@@ -550,7 +568,7 @@ impl UdpSocket {
550
568
ipv6mr_multiaddr : * multiaddr. as_inner ( ) ,
551
569
ipv6mr_interface : to_ipv6mr_interface ( interface) ,
552
570
} ;
553
- setsockopt ( & self . inner , c:: IPPROTO_IPV6 , c :: IPV6_DROP_MEMBERSHIP , mreq)
571
+ setsockopt ( & self . inner , c:: IPPROTO_IPV6 , IPV6_DROP_MEMBERSHIP , mreq)
554
572
}
555
573
556
574
pub fn set_ttl ( & self , ttl : u32 ) -> io:: Result < ( ) > {
0 commit comments