// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{EcnCodePoint, SocketControlMessage, ffi};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "GIPv6TclassMessage")]
    pub struct IPv6TclassMessage(Object<ffi::GIPv6TclassMessage, ffi::GIPv6TclassMessageClass>) @extends SocketControlMessage;

    match fn {
        type_ => || ffi::g_ipv6_tclass_message_get_type(),
    }
}

impl IPv6TclassMessage {
    #[doc(alias = "g_ipv6_tclass_message_new")]
    pub fn new(dscp: u8, ecn: EcnCodePoint) -> IPv6TclassMessage {
        unsafe {
            SocketControlMessage::from_glib_full(ffi::g_ipv6_tclass_message_new(
                dscp,
                ecn.into_glib(),
            ))
            .unsafe_cast()
        }
    }

    #[doc(alias = "g_ipv6_tclass_message_get_dscp")]
    #[doc(alias = "get_dscp")]
    pub fn dscp(&self) -> u8 {
        unsafe { ffi::g_ipv6_tclass_message_get_dscp(self.to_glib_none().0) }
    }

    #[doc(alias = "g_ipv6_tclass_message_get_ecn")]
    #[doc(alias = "get_ecn")]
    pub fn ecn(&self) -> EcnCodePoint {
        unsafe { from_glib(ffi::g_ipv6_tclass_message_get_ecn(self.to_glib_none().0)) }
    }
}
