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