{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.SocketControlMessage
(
SocketControlMessage(..) ,
IsSocketControlMessage ,
toSocketControlMessage ,
#if defined(ENABLE_OVERLOADING)
ResolveSocketControlMessageMethod ,
#endif
socketControlMessageDeserialize ,
#if defined(ENABLE_OVERLOADING)
SocketControlMessageGetLevelMethodInfo ,
#endif
socketControlMessageGetLevel ,
#if defined(ENABLE_OVERLOADING)
SocketControlMessageGetMsgTypeMethodInfo,
#endif
socketControlMessageGetMsgType ,
#if defined(ENABLE_OVERLOADING)
SocketControlMessageGetSizeMethodInfo ,
#endif
socketControlMessageGetSize ,
#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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GObject.Objects.Object as GObject.Object
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
/= :: SocketControlMessage -> SocketControlMessage -> Bool
$c/= :: SocketControlMessage -> SocketControlMessage -> Bool
== :: SocketControlMessage -> SocketControlMessage -> Bool
$c== :: 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
instance B.GValue.IsGValue SocketControlMessage where
toGValue :: SocketControlMessage -> IO GValue
toGValue SocketControlMessage
o = do
GType
gtype <- IO GType
c_g_socket_control_message_get_type
SocketControlMessage
-> (Ptr SocketControlMessage -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SocketControlMessage
o (GType
-> (GValue -> Ptr SocketControlMessage -> IO ())
-> Ptr SocketControlMessage
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr SocketControlMessage -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO SocketControlMessage
fromGValue GValue
gv = do
Ptr SocketControlMessage
ptr <- GValue -> IO (Ptr SocketControlMessage)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr SocketControlMessage)
(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
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]
toSocketControlMessage :: (MonadIO m, IsSocketControlMessage o) => o -> m SocketControlMessage
toSocketControlMessage :: o -> m SocketControlMessage
toSocketControlMessage = IO SocketControlMessage -> m SocketControlMessage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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'
unsafeCastTo ManagedPtr SocketControlMessage -> SocketControlMessage
SocketControlMessage
#if defined(ENABLE_OVERLOADING)
type family ResolveSocketControlMessageMethod (t :: Symbol) (o :: *) :: * 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.MethodInfo 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
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SocketControlMessage
type instance O.AttributeList SocketControlMessage = SocketControlMessageAttributeList
type SocketControlMessageAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SocketControlMessage = SocketControlMessageSignalList
type SocketControlMessageSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_socket_control_message_get_level" g_socket_control_message_get_level ::
Ptr SocketControlMessage ->
IO Int32
socketControlMessageGetLevel ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
a
-> m Int32
socketControlMessageGetLevel :: a -> m Int32
socketControlMessageGetLevel a
message = IO Int32 -> m Int32
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 (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.MethodInfo SocketControlMessageGetLevelMethodInfo a signature where
overloadedMethod = socketControlMessageGetLevel
#endif
foreign import ccall "g_socket_control_message_get_msg_type" g_socket_control_message_get_msg_type ::
Ptr SocketControlMessage ->
IO Int32
socketControlMessageGetMsgType ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
a
-> m Int32
socketControlMessageGetMsgType :: a -> m Int32
socketControlMessageGetMsgType a
message = IO Int32 -> m Int32
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 (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.MethodInfo SocketControlMessageGetMsgTypeMethodInfo a signature where
overloadedMethod = socketControlMessageGetMsgType
#endif
foreign import ccall "g_socket_control_message_get_size" g_socket_control_message_get_size ::
Ptr SocketControlMessage ->
IO Word64
socketControlMessageGetSize ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
a
-> m Word64
socketControlMessageGetSize :: a -> m Word64
socketControlMessageGetSize a
message = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
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
Word64
result <- Ptr SocketControlMessage -> IO Word64
g_socket_control_message_get_size Ptr SocketControlMessage
message'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
message
Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result
#if defined(ENABLE_OVERLOADING)
data SocketControlMessageGetSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsSocketControlMessage a) => O.MethodInfo SocketControlMessageGetSizeMethodInfo a signature where
overloadedMethod = socketControlMessageGetSize
#endif
foreign import ccall "g_socket_control_message_serialize" g_socket_control_message_serialize ::
Ptr SocketControlMessage ->
Ptr () ->
IO ()
socketControlMessageSerialize ::
(B.CallStack.HasCallStack, MonadIO m, IsSocketControlMessage a) =>
a
-> Ptr ()
-> m ()
socketControlMessageSerialize :: a -> Ptr () -> m ()
socketControlMessageSerialize a
message Ptr ()
data_ = IO () -> m ()
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 (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SocketControlMessageSerializeMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m, IsSocketControlMessage a) => O.MethodInfo SocketControlMessageSerializeMethodInfo a signature where
overloadedMethod = socketControlMessageSerialize
#endif
foreign import ccall "g_socket_control_message_deserialize" g_socket_control_message_deserialize ::
Int32 ->
Int32 ->
Word64 ->
Ptr Word8 ->
IO (Ptr SocketControlMessage)
socketControlMessageDeserialize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> Int32
-> ByteString
-> m SocketControlMessage
socketControlMessageDeserialize :: Int32 -> Int32 -> ByteString -> m SocketControlMessage
socketControlMessageDeserialize Int32
level Int32
type_ ByteString
data_ = IO SocketControlMessage -> m SocketControlMessage
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SocketControlMessage -> m SocketControlMessage)
-> IO SocketControlMessage -> m SocketControlMessage
forall a b. (a -> b) -> a -> b
$ do
let size :: Word64
size = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
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 -> Word64 -> Ptr Word8 -> IO (Ptr SocketControlMessage)
g_socket_control_message_deserialize Int32
level Int32
type_ Word64
size Ptr Word8
data_'
Text -> Ptr SocketControlMessage -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"socketControlMessageDeserialize" Ptr SocketControlMessage
result
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
Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
data_'
SocketControlMessage -> IO SocketControlMessage
forall (m :: * -> *) a. Monad m => a -> m a
return SocketControlMessage
result'
#if defined(ENABLE_OVERLOADING)
#endif