@@ -44,9 +44,9 @@ cfg_if::cfg_if! {
44
44
target_os = "dragonfly" , target_os = "freebsd" ,
45
45
target_os = "openbsd" , target_os = "netbsd" ,
46
46
target_os = "solaris" ) ) ] {
47
- type ip_mcast_type_v4 = c_uchar;
47
+ type IpV4MultiCastType = c_uchar;
48
48
} else {
49
- type ip_mcast_type_v4 = c_int;
49
+ type IpV4MultiCastType = c_int;
50
50
}
51
51
}
52
52
@@ -533,20 +533,30 @@ impl UdpSocket {
533
533
}
534
534
535
535
pub fn set_multicast_loop_v4 ( & self , multicast_loop_v4 : bool ) -> io:: Result < ( ) > {
536
- setsockopt ( & self . inner , c:: IPPROTO_IP , c:: IP_MULTICAST_LOOP , multicast_loop_v4 as ip_mcast_type_v4 )
536
+ setsockopt (
537
+ & self . inner ,
538
+ c:: IPPROTO_IP ,
539
+ c:: IP_MULTICAST_LOOP ,
540
+ multicast_loop_v4 as IpV4MultiCastType ,
541
+ )
537
542
}
538
543
539
544
pub fn multicast_loop_v4 ( & self ) -> io:: Result < bool > {
540
- let raw: ip_mcast_type_v4 = getsockopt ( & self . inner , c:: IPPROTO_IP , c:: IP_MULTICAST_LOOP ) ?;
545
+ let raw: IpV4MultiCastType = getsockopt ( & self . inner , c:: IPPROTO_IP , c:: IP_MULTICAST_LOOP ) ?;
541
546
Ok ( raw != 0 )
542
547
}
543
548
544
549
pub fn set_multicast_ttl_v4 ( & self , multicast_ttl_v4 : u32 ) -> io:: Result < ( ) > {
545
- setsockopt ( & self . inner , c:: IPPROTO_IP , c:: IP_MULTICAST_TTL , multicast_ttl_v4 as ip_mcast_type_v4 )
550
+ setsockopt (
551
+ & self . inner ,
552
+ c:: IPPROTO_IP ,
553
+ c:: IP_MULTICAST_TTL ,
554
+ multicast_ttl_v4 as IpV4MultiCastType ,
555
+ )
546
556
}
547
557
548
558
pub fn multicast_ttl_v4 ( & self ) -> io:: Result < u32 > {
549
- let raw: ip_mcast_type_v4 = getsockopt ( & self . inner , c:: IPPROTO_IP , c:: IP_MULTICAST_TTL ) ?;
559
+ let raw: IpV4MultiCastType = getsockopt ( & self . inner , c:: IPPROTO_IP , c:: IP_MULTICAST_TTL ) ?;
550
560
Ok ( raw as u32 )
551
561
}
552
562
0 commit comments