use std::ffi::c_int;
use crate::{IPPROTO_IPV6, SockOptMarker, OptRMarker, OptWMarker, IPV6_V6ONLY};
#[repr(transparent)]
#[derive(Debug, Clone, Copy)]
pub struct Ip6V6Only(c_int);
impl SockOptMarker for Ip6V6Only
{
const SO_LEVEL: c_int = IPPROTO_IPV6;
const SO_OPTNAME: c_int = IPV6_V6ONLY;
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 Ip6V6Only {}
impl OptWMarker for Ip6V6Only {}