|
282 | 282 |
|
283 | 283 | pub struct icmp6_filter { |
284 | 284 | #[cfg(not(target_os = "solaris"))] |
285 | | - pub icmp6_filt: [u32; 8], |
| 285 | + icmp6_filt: [u32; 8], |
286 | 286 | #[cfg(target_os = "solaris")] |
287 | | - pub __icmp6_filt: [u32; 8], |
| 287 | + __icmp6_filt: [u32; 8], |
288 | 288 | } |
289 | 289 |
|
290 | 290 | #[cfg_attr( |
@@ -453,6 +453,46 @@ s_no_extra_traits! { |
453 | 453 | } |
454 | 454 | } |
455 | 455 |
|
| 456 | +f! { |
| 457 | + pub fn ICMP6_FILTER_SETPASSALL(filt: &mut icmp6_filter) -> () { |
| 458 | + #[cfg(not(target_os = "solaris"))] |
| 459 | + for i in &mut filt.icmp6_filt { |
| 460 | + *i = u32::MAX; |
| 461 | + } |
| 462 | + #[cfg(target_os = "solaris")] |
| 463 | + for i in &mut filt.__icmp6_filt { |
| 464 | + *i = u32::MAX; |
| 465 | + } |
| 466 | + } |
| 467 | + |
| 468 | + pub fn ICMP6_FILTER_SETBLOCKALL(filt: &mut icmp6_filter) -> () { |
| 469 | + #[cfg(not(target_os = "solaris"))] |
| 470 | + for i in &mut filt.icmp6_filt { |
| 471 | + *i = 0; |
| 472 | + } |
| 473 | + #[cfg(target_os = "solaris")] |
| 474 | + for i in &mut filt.__icmp6_filt { |
| 475 | + *i = 0; |
| 476 | + } |
| 477 | + } |
| 478 | + |
| 479 | + pub fn ICMP6_FILTER_SETPASS(msg: u8, filt: &mut icmp6_filter) -> () { |
| 480 | + #[cfg(not(target_os = "solaris"))] |
| 481 | + let filt = &mut filt.icmp6_filt; |
| 482 | + #[cfg(target_os = "solaris")] |
| 483 | + let filt = &mut filt.__icmp6_filt; |
| 484 | + filt[(msg >> 5) as usize] |= 1 << (msg & 31); |
| 485 | + } |
| 486 | + |
| 487 | + pub fn ICMP6_FILTER_SETBLOCK(msg: u8, filt: &mut icmp6_filter) -> () { |
| 488 | + #[cfg(not(target_os = "solaris"))] |
| 489 | + let filt = &mut filt.icmp6_filt; |
| 490 | + #[cfg(target_os = "solaris")] |
| 491 | + let filt = &mut filt.__icmp6_filt; |
| 492 | + filt[(msg >> 5) as usize] &= !(1 << (msg & 31)); |
| 493 | + } |
| 494 | +} |
| 495 | + |
456 | 496 | cfg_if! { |
457 | 497 | if #[cfg(feature = "extra_traits")] { |
458 | 498 | impl PartialEq for sigval { |
|
0 commit comments