{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Contains the type of service (ToS) byte of an IPv4 header.
-- 
-- This consists of the DSCP field as per
-- <https://www.rfc-editor.org/rfc/rfc2474#section-3 RFC 2474>,
-- and the ECN field as per
-- <https://www.rfc-editor.org/rfc/rfc3168#section-5 RFC 3168>.
-- 
-- It may be received using 'GI.Gio.Objects.Socket.socketReceiveMessage' over UDP sockets
-- (i.e. sockets in the @G_SOCKET_FAMILY_IPV4@ family with
-- @G_SOCKET_TYPE_DATAGRAM@ type). The message is not meant for sending. To set
-- ToS field to be used in datagrams sent on a t'GI.Gio.Objects.Socket.Socket' use:
-- 
-- === /c code/
-- >g_socket_set_option (socket, IPPROTO_IP, IP_TOS, <ToS value>, &error);
-- 
-- 
-- /Since: 2.88/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gio.Objects.IPTosMessage
    ( 

-- * Exported types
    IPTosMessage(..)                        ,
    IsIPTosMessage                          ,
    toIPTosMessage                          ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [serialize]("GI.Gio.Objects.SocketControlMessage#g:method:serialize"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getDscp]("GI.Gio.Objects.IPTosMessage#g:method:getDscp"), [getEcn]("GI.Gio.Objects.IPTosMessage#g:method:getEcn"), [getLevel]("GI.Gio.Objects.SocketControlMessage#g:method:getLevel"), [getMsgType]("GI.Gio.Objects.SocketControlMessage#g:method:getMsgType"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSize]("GI.Gio.Objects.SocketControlMessage#g:method:getSize").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveIPTosMessageMethod               ,
#endif

-- ** getDscp #method:getDscp#

#if defined(ENABLE_OVERLOADING)
    IPTosMessageGetDscpMethodInfo           ,
#endif
    iPTosMessageGetDscp                     ,


-- ** getEcn #method:getEcn#

#if defined(ENABLE_OVERLOADING)
    IPTosMessageGetEcnMethodInfo            ,
#endif
    iPTosMessageGetEcn                      ,


-- ** new #method:new#

    iPTosMessageNew                         ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketControlMessage as Gio.SocketControlMessage

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketControlMessage as Gio.SocketControlMessage

#endif

-- | Memory-managed wrapper type.
newtype IPTosMessage = IPTosMessage (SP.ManagedPtr IPTosMessage)
    deriving (IPTosMessage -> IPTosMessage -> Bool
(IPTosMessage -> IPTosMessage -> Bool)
-> (IPTosMessage -> IPTosMessage -> Bool) -> Eq IPTosMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IPTosMessage -> IPTosMessage -> Bool
== :: IPTosMessage -> IPTosMessage -> Bool
$c/= :: IPTosMessage -> IPTosMessage -> Bool
/= :: IPTosMessage -> IPTosMessage -> Bool
Eq)

instance SP.ManagedPtrNewtype IPTosMessage where
    toManagedPtr :: IPTosMessage -> ManagedPtr IPTosMessage
toManagedPtr (IPTosMessage ManagedPtr IPTosMessage
p) = ManagedPtr IPTosMessage
p

foreign import ccall "g_ip_tos_message_get_type"
    c_g_ip_tos_message_get_type :: IO B.Types.GType

instance B.Types.TypedObject IPTosMessage where
    glibType :: IO GType
glibType = IO GType
c_g_ip_tos_message_get_type

instance B.Types.GObject IPTosMessage

-- | Type class for types which can be safely cast to t'IPTosMessage', for instance with `toIPTosMessage`.
class (SP.GObject o, O.IsDescendantOf IPTosMessage o) => IsIPTosMessage o
instance (SP.GObject o, O.IsDescendantOf IPTosMessage o) => IsIPTosMessage o

instance O.HasParentTypes IPTosMessage
type instance O.ParentTypes IPTosMessage = '[Gio.SocketControlMessage.SocketControlMessage, GObject.Object.Object]

-- | Cast to t'IPTosMessage', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toIPTosMessage :: (MIO.MonadIO m, IsIPTosMessage o) => o -> m IPTosMessage
toIPTosMessage :: forall (m :: * -> *) o.
(MonadIO m, IsIPTosMessage o) =>
o -> m IPTosMessage
toIPTosMessage = IO IPTosMessage -> m IPTosMessage
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO IPTosMessage -> m IPTosMessage)
-> (o -> IO IPTosMessage) -> o -> m IPTosMessage
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr IPTosMessage -> IPTosMessage) -> o -> IO IPTosMessage
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr IPTosMessage -> IPTosMessage
IPTosMessage

-- | Convert t'IPTosMessage' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe IPTosMessage) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_ip_tos_message_get_type
    gvalueSet_ :: Ptr GValue -> Maybe IPTosMessage -> IO ()
gvalueSet_ Ptr GValue
gv Maybe IPTosMessage
P.Nothing = Ptr GValue -> Ptr IPTosMessage -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr IPTosMessage
forall a. Ptr a
FP.nullPtr :: FP.Ptr IPTosMessage)
    gvalueSet_ Ptr GValue
gv (P.Just IPTosMessage
obj) = IPTosMessage -> (Ptr IPTosMessage -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr IPTosMessage
obj (Ptr GValue -> Ptr IPTosMessage -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe IPTosMessage)
gvalueGet_ Ptr GValue
gv = do
        ptr <- Ptr GValue -> IO (Ptr IPTosMessage)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr IPTosMessage)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newObject IPTosMessage ptr
        else return P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveIPTosMessageMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveIPTosMessageMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveIPTosMessageMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveIPTosMessageMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveIPTosMessageMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveIPTosMessageMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveIPTosMessageMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveIPTosMessageMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveIPTosMessageMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveIPTosMessageMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveIPTosMessageMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveIPTosMessageMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveIPTosMessageMethod "serialize" o = Gio.SocketControlMessage.SocketControlMessageSerializeMethodInfo
    ResolveIPTosMessageMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveIPTosMessageMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveIPTosMessageMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveIPTosMessageMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveIPTosMessageMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveIPTosMessageMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveIPTosMessageMethod "getDscp" o = IPTosMessageGetDscpMethodInfo
    ResolveIPTosMessageMethod "getEcn" o = IPTosMessageGetEcnMethodInfo
    ResolveIPTosMessageMethod "getLevel" o = Gio.SocketControlMessage.SocketControlMessageGetLevelMethodInfo
    ResolveIPTosMessageMethod "getMsgType" o = Gio.SocketControlMessage.SocketControlMessageGetMsgTypeMethodInfo
    ResolveIPTosMessageMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveIPTosMessageMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveIPTosMessageMethod "getSize" o = Gio.SocketControlMessage.SocketControlMessageGetSizeMethodInfo
    ResolveIPTosMessageMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveIPTosMessageMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveIPTosMessageMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveIPTosMessageMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveIPTosMessageMethod t IPTosMessage, O.OverloadedMethod info IPTosMessage p) => OL.IsLabel t (IPTosMessage -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveIPTosMessageMethod t IPTosMessage, O.OverloadedMethod info IPTosMessage p, R.HasField t IPTosMessage p) => R.HasField t IPTosMessage p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveIPTosMessageMethod t IPTosMessage, O.OverloadedMethodInfo info IPTosMessage) => OL.IsLabel t (O.MethodProxy info IPTosMessage) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList IPTosMessage
type instance O.AttributeList IPTosMessage = IPTosMessageAttributeList
type IPTosMessageAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList IPTosMessage = IPTosMessageSignalList
type IPTosMessageSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method IPTosMessage::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "dscp"
--           , argType = TBasicType TUInt8
--           , argCType = Just "guint8"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the DSCP value of the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ecn"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "EcnCodePoint" }
--           , argCType = Just "GEcnCodePoint"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the ECN value of the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "IPTosMessage" })
-- throws : False
-- Skip return : False

foreign import ccall "g_ip_tos_message_new" g_ip_tos_message_new :: 
    Word8 ->                                -- dscp : TBasicType TUInt8
    CUInt ->                                -- ecn : TInterface (Name {namespace = "Gio", name = "EcnCodePoint"})
    IO (Ptr IPTosMessage)

-- | Creates a new type-of-service message with given DSCP and ECN values.
-- 
-- /Since: 2.88/
iPTosMessageNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    -- ^ /@dscp@/: the DSCP value of the message
    -> Gio.Enums.EcnCodePoint
    -- ^ /@ecn@/: the ECN value of the message
    -> m IPTosMessage
    -- ^ __Returns:__ a new type-of-service message
iPTosMessageNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word8 -> EcnCodePoint -> m IPTosMessage
iPTosMessageNew Word8
dscp EcnCodePoint
ecn = IO IPTosMessage -> m IPTosMessage
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IPTosMessage -> m IPTosMessage)
-> IO IPTosMessage -> m IPTosMessage
forall a b. (a -> b) -> a -> b
$ do
    let ecn' :: CUInt
ecn' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (EcnCodePoint -> Int) -> EcnCodePoint -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EcnCodePoint -> Int
forall a. Enum a => a -> Int
fromEnum) EcnCodePoint
ecn
    result <- Word8 -> CUInt -> IO (Ptr IPTosMessage)
g_ip_tos_message_new Word8
dscp CUInt
ecn'
    checkUnexpectedReturnNULL "iPTosMessageNew" result
    result' <- (wrapObject IPTosMessage) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method IPTosMessage::get_dscp
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "message"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IPTosMessage" }
--           , argCType = Just "GIPTosMessage*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type-of-service message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_ip_tos_message_get_dscp" g_ip_tos_message_get_dscp :: 
    Ptr IPTosMessage ->                     -- message : TInterface (Name {namespace = "Gio", name = "IPTosMessage"})
    IO Word8

-- | Gets the differentiated services code point stored in /@message@/.
-- 
-- /Since: 2.88/
iPTosMessageGetDscp ::
    (B.CallStack.HasCallStack, MonadIO m, IsIPTosMessage a) =>
    a
    -- ^ /@message@/: a type-of-service message
    -> m Word8
    -- ^ __Returns:__ A DSCP value as described in <https://www.rfc-editor.org/rfc/rfc2474.html#section-3 RFC 2474>.
iPTosMessageGetDscp :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIPTosMessage a) =>
a -> m Word8
iPTosMessageGetDscp a
message = IO Word8 -> m Word8
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    message' <- a -> IO (Ptr IPTosMessage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
message
    result <- g_ip_tos_message_get_dscp message'
    touchManagedPtr message
    return result

#if defined(ENABLE_OVERLOADING)
data IPTosMessageGetDscpMethodInfo
instance (signature ~ (m Word8), MonadIO m, IsIPTosMessage a) => O.OverloadedMethod IPTosMessageGetDscpMethodInfo a signature where
    overloadedMethod = iPTosMessageGetDscp

instance O.OverloadedMethodInfo IPTosMessageGetDscpMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.IPTosMessage.iPTosMessageGetDscp",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.38/docs/GI-Gio-Objects-IPTosMessage.html#v:iPTosMessageGetDscp"
        })


#endif

-- method IPTosMessage::get_ecn
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "message"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IPTosMessage" }
--           , argCType = Just "GIPTosMessage*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a type-of-service message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "EcnCodePoint" })
-- throws : False
-- Skip return : False

foreign import ccall "g_ip_tos_message_get_ecn" g_ip_tos_message_get_ecn :: 
    Ptr IPTosMessage ->                     -- message : TInterface (Name {namespace = "Gio", name = "IPTosMessage"})
    IO CUInt

-- | Gets the Explicit Congestion Notification code point stored in /@message@/.
-- 
-- /Since: 2.88/
iPTosMessageGetEcn ::
    (B.CallStack.HasCallStack, MonadIO m, IsIPTosMessage a) =>
    a
    -- ^ /@message@/: a type-of-service message
    -> m Gio.Enums.EcnCodePoint
    -- ^ __Returns:__ An ECN value as described in <https://www.rfc-editor.org/rfc/rfc3168#section-5 RFC 3168>.
iPTosMessageGetEcn :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsIPTosMessage a) =>
a -> m EcnCodePoint
iPTosMessageGetEcn a
message = IO EcnCodePoint -> m EcnCodePoint
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EcnCodePoint -> m EcnCodePoint)
-> IO EcnCodePoint -> m EcnCodePoint
forall a b. (a -> b) -> a -> b
$ do
    message' <- a -> IO (Ptr IPTosMessage)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
message
    result <- g_ip_tos_message_get_ecn message'
    let result' = (Int -> EcnCodePoint
forall a. Enum a => Int -> a
toEnum (Int -> EcnCodePoint) -> (CUInt -> Int) -> CUInt -> EcnCodePoint
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    touchManagedPtr message
    return result'

#if defined(ENABLE_OVERLOADING)
data IPTosMessageGetEcnMethodInfo
instance (signature ~ (m Gio.Enums.EcnCodePoint), MonadIO m, IsIPTosMessage a) => O.OverloadedMethod IPTosMessageGetEcnMethodInfo a signature where
    overloadedMethod = iPTosMessageGetEcn

instance O.OverloadedMethodInfo IPTosMessageGetEcnMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.IPTosMessage.iPTosMessageGetEcn",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.38/docs/GI-Gio-Objects-IPTosMessage.html#v:iPTosMessageGetEcn"
        })


#endif