use std::ffi::c_int;
use crate::{IPPROTO_IP, SockOptMarker, OptRMarker, OptWMarker, IP_MULTICAST_ALL};
#[repr(transparent)]
#[derive(Debug, Clone, Copy)]
pub struct IpMulticastAll(c_int);
impl SockOptMarker for IpMulticastAll
{
const SO_LEVEL: c_int = IPPROTO_IP;
const SO_OPTNAME: c_int = IP_MULTICAST_ALL;
type DataType = bool;
type InputType = c_int;
#[inline]
fn from(value: Self::InputType) -> Self
{
return Self(value);
}
#[inline]
fn get(self) -> Self::DataType
{
return self.0 != 0;
}
#[inline]
fn from_user(flag: Self::DataType) -> Self where Self: Sized
{
return Self(flag as Self::InputType);
}
}
impl OptRMarker for IpMulticastAll {}
impl OptWMarker for IpMulticastAll {}