    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson and Iñaki García Etxebarria
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- A @GSocketControlMessage@ is a special-purpose utility message that
    -- can be sent to or received from a t'GI.Gio.Objects.Socket.Socket'. These types of
    -- messages are often called ‘ancillary data’.
    --
    -- The message can represent some sort of special instruction to or
    -- information from the socket or can represent a special kind of
    -- transfer to the peer (for example, sending a file descriptor over
    -- a UNIX socket).
    --
    -- These messages are sent with 'GI.Gio.Objects.Socket.socketSendMessage' and received
    -- with 'GI.Gio.Objects.Socket.socketReceiveMessage'.
    --
    -- To extend the set of control message that can be sent, subclass this
    -- class and override the @get_size@, @get_level@, @get_type@ and @serialize@
    -- methods.
    --
    -- To extend the set of control messages that can be received, subclass
    -- this class and implement the @deserialize@ method. Also, make sure your
    -- class is registered with the [type/@gObject@/.Type] type system before calling
    -- 'GI.Gio.Objects.Socket.socketReceiveMessage' to read such a message.
    --
    -- /Since: 2.22/

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gio.Objects.SocketControlMessage
        (

    -- * Exported types
        SocketControlMessage(..)                ,
        IsSocketControlMessage                  ,
        toSocketControlMessage                  ,

     -- * 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"), [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)
        ResolveSocketControlMessageMethod       ,
    #endif

    -- ** deserialize #method:deserialize#

        socketControlMessageDeserialize         ,

    -- ** getLevel #method:getLevel#

    #if defined(ENABLE_OVERLOADING)
        SocketControlMessageGetLevelMethodInfo  ,
    #endif
        socketControlMessageGetLevel            ,

    -- ** getMsgType #method:getMsgType#

    #if defined(ENABLE_OVERLOADING)
        SocketControlMessageGetMsgTypeMethodInfo,
    #endif
        socketControlMessageGetMsgType          ,

    -- ** getSize #method:getSize#

    #if defined(ENABLE_OVERLOADING)
        SocketControlMessageGetSizeMethodInfo   ,
    #endif
        socketControlMessageGetSize             ,

    -- ** serialize #method:serialize#

    #if defined(ENABLE_OVERLOADING)
        SocketControlMessageSerializeMethodInfo ,
    #endif
        socketControlMessageSerialize           ,

        ) 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

    #else
    import qualified GI.GObject.Objects.Object as GObject.Object

    #endif

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

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

    foreign import ccall "g_socket_control_message_get_type"
        c_g_socket_control_message_get_type :: IO B.Types.GType

    instance B.Types.TypedObject SocketControlMessage where
        glibType :: IO GType
    glibType = IO GType
    c_g_socket_control_message_get_type

    instance B.Types.GObject SocketControlMessage

    -- | Type class for types which can be safely cast to `SocketControlMessage`, for instance with `toSocketControlMessage`.
    class (SP.GObject o, O.IsDescendantOf SocketControlMessage o) => IsSocketControlMessage o
    instance (SP.GObject o, O.IsDescendantOf SocketControlMessage o) => IsSocketControlMessage o

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

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

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

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

    instance (info ~ ResolveSocketControlMessageMethod t SocketControlMessage, O.OverloadedMethod info SocketControlMessage p) => OL.IsLabel t (SocketControlMessage -> 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 ~ ResolveSocketControlMessageMethod t SocketControlMessage, O.OverloadedMethod info SocketControlMessage p, R.HasField t SocketControlMessage p) => R.HasField t SocketControlMessage p where
        getField = O.overloadedMethod @info

    #endif

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

    #endif

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

    #if defined(ENABLE_OVERLOADING)
    #endif

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

    #endif

    -- method SocketControlMessage::get_level
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "message"
    --           , argType =
    --               TInterface
    --                 Name { namespace = "Gio" , name = "SocketControlMessage" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GSocketControlMessage"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TInt)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_socket_control_message_get_level" g_socket_control_message_get_level ::
        Ptr SocketControlMessage ->             -- message : TInterface (Name {namespace = "Gio", name = "SocketControlMessage"})
        IO Int32

    -- | Returns the \"level\" (i.e. the originating protocol) of the control message.
    -- This is often SOL_SOCKET.
    --
    -- /Since: 2.22/
    socketControlMessageGetLevel ::
        (B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
        a
        -- ^ /@message@/: a t'GI.Gio.Objects.SocketControlMessage.SocketControlMessage'
        -> m Int32
        -- ^ __Returns:__ an integer describing the level
    socketControlMessageGetLevel :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsSocketControlMessage a) =>
    a -> m Int32
    socketControlMessageGetLevel a
    message = IO Int32 -> m Int32
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr SocketControlMessage
    message' <- a -> IO (Ptr SocketControlMessage)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    message
        Int32
    result <- Ptr SocketControlMessage -> IO Int32
    g_socket_control_message_get_level Ptr SocketControlMessage
    message'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    message
        Int32 -> IO Int32
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Int32
    result

    #if defined(ENABLE_OVERLOADING)
    data SocketControlMessageGetLevelMethodInfo
    instance (signature ~ (m Int32), MonadIO m, IsSocketControlMessage a) => O.OverloadedMethod SocketControlMessageGetLevelMethodInfo a signature where
        overloadedMethod = socketControlMessageGetLevel

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

    #endif

    -- method SocketControlMessage::get_msg_type
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "message"
    --           , argType =
    --               TInterface
    --                 Name { namespace = "Gio" , name = "SocketControlMessage" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GSocketControlMessage"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TInt)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_socket_control_message_get_msg_type" g_socket_control_message_get_msg_type ::
        Ptr SocketControlMessage ->             -- message : TInterface (Name {namespace = "Gio", name = "SocketControlMessage"})
        IO Int32

    -- | Returns the protocol specific type of the control message.
    -- For instance, for UNIX fd passing this would be SCM_RIGHTS.
    --
    -- /Since: 2.22/
    socketControlMessageGetMsgType ::
        (B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
        a
        -- ^ /@message@/: a t'GI.Gio.Objects.SocketControlMessage.SocketControlMessage'
        -> m Int32
        -- ^ __Returns:__ an integer describing the type of control message
    socketControlMessageGetMsgType :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsSocketControlMessage a) =>
    a -> m Int32
    socketControlMessageGetMsgType a
    message = IO Int32 -> m Int32
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr SocketControlMessage
    message' <- a -> IO (Ptr SocketControlMessage)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    message
        Int32
    result <- Ptr SocketControlMessage -> IO Int32
    g_socket_control_message_get_msg_type Ptr SocketControlMessage
    message'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    message
        Int32 -> IO Int32
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Int32
    result

    #if defined(ENABLE_OVERLOADING)
    data SocketControlMessageGetMsgTypeMethodInfo
    instance (signature ~ (m Int32), MonadIO m, IsSocketControlMessage a) => O.OverloadedMethod SocketControlMessageGetMsgTypeMethodInfo a signature where
        overloadedMethod = socketControlMessageGetMsgType

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

    #endif

    -- method SocketControlMessage::get_size
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "message"
    --           , argType =
    --               TInterface
    --                 Name { namespace = "Gio" , name = "SocketControlMessage" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GSocketControlMessage"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TBasicType TSize)
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_socket_control_message_get_size" g_socket_control_message_get_size ::
        Ptr SocketControlMessage ->             -- message : TInterface (Name {namespace = "Gio", name = "SocketControlMessage"})
        IO FCT.CSize

    -- | Returns the space required for the control message, not including
    -- headers or alignment.
    --
    -- /Since: 2.22/
    socketControlMessageGetSize ::
        (B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
        a
        -- ^ /@message@/: a t'GI.Gio.Objects.SocketControlMessage.SocketControlMessage'
        -> m FCT.CSize
        -- ^ __Returns:__ The number of bytes required.
    socketControlMessageGetSize :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsSocketControlMessage a) =>
    a -> m CSize
    socketControlMessageGetSize a
    message = IO CSize -> m CSize
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO CSize -> m CSize) -> IO CSize -> m CSize
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr SocketControlMessage
    message' <- a -> IO (Ptr SocketControlMessage)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    message
        CSize
    result <- Ptr SocketControlMessage -> IO CSize
    g_socket_control_message_get_size Ptr SocketControlMessage
    message'
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    message
        CSize -> IO CSize
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return CSize
    result

    #if defined(ENABLE_OVERLOADING)
    data SocketControlMessageGetSizeMethodInfo
    instance (signature ~ (m FCT.CSize), MonadIO m, IsSocketControlMessage a) => O.OverloadedMethod SocketControlMessageGetSizeMethodInfo a signature where
        overloadedMethod = socketControlMessageGetSize

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

    #endif

    -- method SocketControlMessage::serialize
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "message"
    --           , argType =
    --               TInterface
    --                 Name { namespace = "Gio" , name = "SocketControlMessage" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GSocketControlMessage"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "data"
    --           , argType = TBasicType TPtr
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "A buffer to write data to"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Nothing
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_socket_control_message_serialize" g_socket_control_message_serialize ::
        Ptr SocketControlMessage ->             -- message : TInterface (Name {namespace = "Gio", name = "SocketControlMessage"})
        Ptr () ->                               -- data : TBasicType TPtr
        IO ()

    -- | Converts the data in the message to bytes placed in the
    -- message.
    --
    -- /@data@/ is guaranteed to have enough space to fit the size
    -- returned by 'GI.Gio.Objects.SocketControlMessage.socketControlMessageGetSize' on this
    -- object.
    --
    -- /Since: 2.22/
    socketControlMessageSerialize ::
        (B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
        a
        -- ^ /@message@/: a t'GI.Gio.Objects.SocketControlMessage.SocketControlMessage'
        -> Ptr ()
        -- ^ /@data@/: A buffer to write data to
        -> m ()
    socketControlMessageSerialize :: forall (m :: * -> *) a.
    (HasCallStack, MonadIO m, IsSocketControlMessage a) =>
    a -> Ptr () -> m ()
    socketControlMessageSerialize a
    message Ptr ()
    data_ = IO () -> m ()
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr SocketControlMessage
    message' <- a -> IO (Ptr SocketControlMessage)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    message
        Ptr SocketControlMessage -> Ptr () -> IO ()
    g_socket_control_message_serialize Ptr SocketControlMessage
    message' Ptr ()
    data_
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    message
        () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    #if defined(ENABLE_OVERLOADING)
    data SocketControlMessageSerializeMethodInfo
    instance (signature ~ (Ptr () -> m ()), MonadIO m, IsSocketControlMessage a) => O.OverloadedMethod SocketControlMessageSerializeMethodInfo a signature where
        overloadedMethod = socketControlMessageSerialize

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

    #endif

    -- method SocketControlMessage::deserialize
    -- method type : MemberFunction
    -- Args: [ Arg
    --           { argCName = "level"
    --           , argType = TBasicType TInt
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a socket level" , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "type"
    --           , argType = TBasicType TInt
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText =
    --                     Just "a socket control message type for the given @level"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "size"
    --           , argType = TBasicType TSize
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "the size of the data in bytes"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       , Arg
    --           { argCName = "data"
    --           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "pointer to the message data"
    --                 , sinceVersion = Nothing
    --                 }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , argCallbackUserData = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: [ Arg
    --              { argCName = "size"
    --              , argType = TBasicType TSize
    --              , direction = DirectionIn
    --              , mayBeNull = False
    --              , argDoc =
    --                  Documentation
    --                    { rawDocText = Just "the size of the data in bytes"
    --                    , sinceVersion = Nothing
    --                    }
    --              , argScope = ScopeTypeInvalid
    --              , argClosure = -1
    --              , argDestroy = -1
    --              , argCallerAllocates = False
    --              , argCallbackUserData = False
    --              , transfer = TransferNothing
    --              }
    --          ]
    -- returnType: Just
    --               (TInterface
    --                  Name { namespace = "Gio" , name = "SocketControlMessage" })
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_socket_control_message_deserialize" g_socket_control_message_deserialize ::
        Int32 ->                                -- level : TBasicType TInt
        Int32 ->                                -- type : TBasicType TInt
        FCT.CSize ->                            -- size : TBasicType TSize
        Ptr Word8 ->                            -- data : TCArray False (-1) 2 (TBasicType TUInt8)
        IO (Ptr SocketControlMessage)

    -- | Tries to deserialize a socket control message of a given
    -- /@level@/ and /@type@/. This will ask all known (to GType) subclasses
    -- of t'GI.Gio.Objects.SocketControlMessage.SocketControlMessage' if they can understand this kind
    -- of message and if so deserialize it into a t'GI.Gio.Objects.SocketControlMessage.SocketControlMessage'.
    --
    -- If there is no implementation for this kind of control message, 'P.Nothing'
    -- will be returned.
    --
    -- /Since: 2.22/
    socketControlMessageDeserialize ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        Int32
        -- ^ /@level@/: a socket level
        -> Int32
        -- ^ /@type@/: a socket control message type for the given /@level@/
        -> ByteString
        -- ^ /@data@/: pointer to the message data
        -> m (Maybe SocketControlMessage)
        -- ^ __Returns:__ the deserialized message or 'P.Nothing'
    socketControlMessageDeserialize :: forall (m :: * -> *).
    (HasCallStack, MonadIO m) =>
    Int32 -> Int32 -> ByteString -> m (Maybe SocketControlMessage)
    socketControlMessageDeserialize Int32
    level Int32
    type_ ByteString
    data_ = IO (Maybe SocketControlMessage) -> m (Maybe SocketControlMessage)
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Maybe SocketControlMessage) -> m (Maybe SocketControlMessage))
    -> IO (Maybe SocketControlMessage)
    -> m (Maybe SocketControlMessage)
    forall a b. (a -> b) -> a -> b
    $ do
        let size :: CSize
    size = Int -> CSize
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Int -> CSize) -> Int -> CSize
    forall a b. (a -> b) -> a -> b
    $ ByteString -> Int
    B.length ByteString
    data_
        Ptr Word8
    data_' <- ByteString -> IO (Ptr Word8)
    packByteString ByteString
    data_
        Ptr SocketControlMessage
    result <- Int32
    -> Int32 -> CSize -> Ptr Word8 -> IO (Ptr SocketControlMessage)
    g_socket_control_message_deserialize Int32
    level Int32
    type_ CSize
    size Ptr Word8
    data_'
        Maybe SocketControlMessage
    maybeResult <- Ptr SocketControlMessage
    -> (Ptr SocketControlMessage -> IO SocketControlMessage)
    -> IO (Maybe SocketControlMessage)
    forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
    convertIfNonNull Ptr SocketControlMessage
    result ((Ptr SocketControlMessage -> IO SocketControlMessage)
     -> IO (Maybe SocketControlMessage))
    -> (Ptr SocketControlMessage -> IO SocketControlMessage)
    -> IO (Maybe SocketControlMessage)
    forall a b. (a -> b) -> a -> b
    $ \Ptr SocketControlMessage
    result' -> do
            SocketControlMessage
    result'' <- ((ManagedPtr SocketControlMessage -> SocketControlMessage)
    -> Ptr SocketControlMessage -> IO SocketControlMessage
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    wrapObject ManagedPtr SocketControlMessage -> SocketControlMessage
    SocketControlMessage) Ptr SocketControlMessage
    result'
            SocketControlMessage -> IO SocketControlMessage
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return SocketControlMessage
    result''
        Ptr Word8 -> IO ()
    forall a. Ptr a -> IO ()
    freeMem Ptr Word8
    data_'
        Maybe SocketControlMessage -> IO (Maybe SocketControlMessage)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return Maybe SocketControlMessage
    maybeResult

    #if defined(ENABLE_OVERLOADING)
    #endif