use std::ffi::c_int;
use crate::{IPPROTO_IPV6, SockOptMarker, OptRMarker, OptWMarker, IPV6_UNICAST_HOPS};
#[repr(transparent)]
#[derive(Debug, Clone, Copy)]
pub struct Ip6UnicastHops(c_int);
impl SockOptMarker for Ip6UnicastHops
{
const SO_LEVEL: c_int = IPPROTO_IPV6;
const SO_OPTNAME: c_int = IPV6_UNICAST_HOPS;
type DataType = i32;
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(hops: Self::DataType) -> Self where Self: Sized
{
return Self(hops as Self::InputType);
}
}
impl OptRMarker for Ip6UnicastHops {}
impl OptWMarker for Ip6UnicastHops {}