{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.UnixConnection
(
UnixConnection(..) ,
IsUnixConnection ,
toUnixConnection ,
#if defined(ENABLE_OVERLOADING)
ResolveUnixConnectionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
UnixConnectionReceiveCredentialsMethodInfo,
#endif
unixConnectionReceiveCredentials ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionReceiveCredentialsAsyncMethodInfo,
#endif
unixConnectionReceiveCredentialsAsync ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionReceiveCredentialsFinishMethodInfo,
#endif
unixConnectionReceiveCredentialsFinish ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionReceiveFdMethodInfo ,
#endif
unixConnectionReceiveFd ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionSendCredentialsMethodInfo ,
#endif
unixConnectionSendCredentials ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionSendCredentialsAsyncMethodInfo,
#endif
unixConnectionSendCredentialsAsync ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionSendCredentialsFinishMethodInfo,
#endif
unixConnectionSendCredentialsFinish ,
#if defined(ENABLE_OVERLOADING)
UnixConnectionSendFdMethodInfo ,
#endif
unixConnectionSendFd ,
) 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
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Flags as GLib.Flags
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.PollFD as GLib.PollFD
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Callbacks as GObject.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GObject.Structs.Parameter as GObject.Parameter
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.DatagramBased as Gio.DatagramBased
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials
import {-# SOURCE #-} qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.InetAddress as Gio.InetAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.Socket as Gio.Socket
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddress as Gio.SocketAddress
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketAddressEnumerator as Gio.SocketAddressEnumerator
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketControlMessage as Gio.SocketControlMessage
import {-# SOURCE #-} qualified GI.Gio.Structs.InputMessage as Gio.InputMessage
import {-# SOURCE #-} qualified GI.Gio.Structs.InputVector as Gio.InputVector
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputMessage as Gio.OutputMessage
import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials
import {-# SOURCE #-} qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.SocketConnection as Gio.SocketConnection
#endif
newtype UnixConnection = UnixConnection (SP.ManagedPtr UnixConnection)
deriving (UnixConnection -> UnixConnection -> Bool
(UnixConnection -> UnixConnection -> Bool)
-> (UnixConnection -> UnixConnection -> Bool) -> Eq UnixConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnixConnection -> UnixConnection -> Bool
== :: UnixConnection -> UnixConnection -> Bool
$c/= :: UnixConnection -> UnixConnection -> Bool
/= :: UnixConnection -> UnixConnection -> Bool
Eq)
instance SP.ManagedPtrNewtype UnixConnection where
toManagedPtr :: UnixConnection -> ManagedPtr UnixConnection
toManagedPtr (UnixConnection ManagedPtr UnixConnection
p) = ManagedPtr UnixConnection
p
foreign import ccall "g_unix_connection_get_type"
c_g_unix_connection_get_type :: IO B.Types.GType
instance B.Types.TypedObject UnixConnection where
glibType :: IO GType
glibType = IO GType
c_g_unix_connection_get_type
instance B.Types.GObject UnixConnection
class (SP.GObject o, O.IsDescendantOf UnixConnection o) => IsUnixConnection o
instance (SP.GObject o, O.IsDescendantOf UnixConnection o) => IsUnixConnection o
instance O.HasParentTypes UnixConnection
type instance O.ParentTypes UnixConnection = '[Gio.SocketConnection.SocketConnection, Gio.IOStream.IOStream, GObject.Object.Object]
toUnixConnection :: (MIO.MonadIO m, IsUnixConnection o) => o -> m UnixConnection
toUnixConnection :: forall (m :: * -> *) o.
(MonadIO m, IsUnixConnection o) =>
o -> m UnixConnection
toUnixConnection = IO UnixConnection -> m UnixConnection
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO UnixConnection -> m UnixConnection)
-> (o -> IO UnixConnection) -> o -> m UnixConnection
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr UnixConnection -> UnixConnection)
-> o -> IO UnixConnection
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr UnixConnection -> UnixConnection
UnixConnection
instance B.GValue.IsGValue (Maybe UnixConnection) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_unix_connection_get_type
gvalueSet_ :: Ptr GValue -> Maybe UnixConnection -> IO ()
gvalueSet_ Ptr GValue
gv Maybe UnixConnection
P.Nothing = Ptr GValue -> Ptr UnixConnection -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr UnixConnection
forall a. Ptr a
FP.nullPtr :: FP.Ptr UnixConnection)
gvalueSet_ Ptr GValue
gv (P.Just UnixConnection
obj) = UnixConnection -> (Ptr UnixConnection -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr UnixConnection
obj (Ptr GValue -> Ptr UnixConnection -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe UnixConnection)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr UnixConnection)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr UnixConnection)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject UnixConnection ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveUnixConnectionMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveUnixConnectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveUnixConnectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveUnixConnectionMethod "clearPending" o = Gio.IOStream.IOStreamClearPendingMethodInfo
ResolveUnixConnectionMethod "close" o = Gio.IOStream.IOStreamCloseMethodInfo
ResolveUnixConnectionMethod "closeAsync" o = Gio.IOStream.IOStreamCloseAsyncMethodInfo
ResolveUnixConnectionMethod "closeFinish" o = Gio.IOStream.IOStreamCloseFinishMethodInfo
ResolveUnixConnectionMethod "connect" o = Gio.SocketConnection.SocketConnectionConnectMethodInfo
ResolveUnixConnectionMethod "connectAsync" o = Gio.SocketConnection.SocketConnectionConnectAsyncMethodInfo
ResolveUnixConnectionMethod "connectFinish" o = Gio.SocketConnection.SocketConnectionConnectFinishMethodInfo
ResolveUnixConnectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveUnixConnectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveUnixConnectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveUnixConnectionMethod "hasPending" o = Gio.IOStream.IOStreamHasPendingMethodInfo
ResolveUnixConnectionMethod "isClosed" o = Gio.IOStream.IOStreamIsClosedMethodInfo
ResolveUnixConnectionMethod "isConnected" o = Gio.SocketConnection.SocketConnectionIsConnectedMethodInfo
ResolveUnixConnectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveUnixConnectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveUnixConnectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveUnixConnectionMethod "receiveCredentials" o = UnixConnectionReceiveCredentialsMethodInfo
ResolveUnixConnectionMethod "receiveCredentialsAsync" o = UnixConnectionReceiveCredentialsAsyncMethodInfo
ResolveUnixConnectionMethod "receiveCredentialsFinish" o = UnixConnectionReceiveCredentialsFinishMethodInfo
ResolveUnixConnectionMethod "receiveFd" o = UnixConnectionReceiveFdMethodInfo
ResolveUnixConnectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveUnixConnectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveUnixConnectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveUnixConnectionMethod "sendCredentials" o = UnixConnectionSendCredentialsMethodInfo
ResolveUnixConnectionMethod "sendCredentialsAsync" o = UnixConnectionSendCredentialsAsyncMethodInfo
ResolveUnixConnectionMethod "sendCredentialsFinish" o = UnixConnectionSendCredentialsFinishMethodInfo
ResolveUnixConnectionMethod "sendFd" o = UnixConnectionSendFdMethodInfo
ResolveUnixConnectionMethod "spliceAsync" o = Gio.IOStream.IOStreamSpliceAsyncMethodInfo
ResolveUnixConnectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveUnixConnectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveUnixConnectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveUnixConnectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveUnixConnectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveUnixConnectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveUnixConnectionMethod "getInputStream" o = Gio.IOStream.IOStreamGetInputStreamMethodInfo
ResolveUnixConnectionMethod "getLocalAddress" o = Gio.SocketConnection.SocketConnectionGetLocalAddressMethodInfo
ResolveUnixConnectionMethod "getOutputStream" o = Gio.IOStream.IOStreamGetOutputStreamMethodInfo
ResolveUnixConnectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveUnixConnectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveUnixConnectionMethod "getRemoteAddress" o = Gio.SocketConnection.SocketConnectionGetRemoteAddressMethodInfo
ResolveUnixConnectionMethod "getSocket" o = Gio.SocketConnection.SocketConnectionGetSocketMethodInfo
ResolveUnixConnectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveUnixConnectionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveUnixConnectionMethod "setPending" o = Gio.IOStream.IOStreamSetPendingMethodInfo
ResolveUnixConnectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveUnixConnectionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveUnixConnectionMethod t UnixConnection, O.OverloadedMethod info UnixConnection p) => OL.IsLabel t (UnixConnection -> 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 ~ ResolveUnixConnectionMethod t UnixConnection, O.OverloadedMethod info UnixConnection p, R.HasField t UnixConnection p) => R.HasField t UnixConnection p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveUnixConnectionMethod t UnixConnection, O.OverloadedMethodInfo info UnixConnection) => OL.IsLabel t (O.MethodProxy info UnixConnection) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList UnixConnection
type instance O.AttributeList UnixConnection = UnixConnectionAttributeList
type UnixConnectionAttributeList = ('[ '("closed", Gio.IOStream.IOStreamClosedPropertyInfo), '("inputStream", Gio.IOStream.IOStreamInputStreamPropertyInfo), '("outputStream", Gio.IOStream.IOStreamOutputStreamPropertyInfo), '("socket", Gio.SocketConnection.SocketConnectionSocketPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList UnixConnection = UnixConnectionSignalList
type UnixConnectionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "g_unix_connection_receive_credentials" g_unix_connection_receive_credentials ::
Ptr UnixConnection ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Credentials.Credentials)
unixConnectionReceiveCredentials ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Gio.Credentials.Credentials
unixConnectionReceiveCredentials :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) =>
a -> Maybe b -> m Credentials
unixConnectionReceiveCredentials a
connection Maybe b
cancellable = IO Credentials -> m Credentials
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credentials -> m Credentials)
-> IO Credentials -> m Credentials
forall a b. (a -> b) -> a -> b
$ do
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_unix_connection_receive_credentials connection' maybeCancellable
checkUnexpectedReturnNULL "unixConnectionReceiveCredentials" result
result' <- (wrapObject Gio.Credentials.Credentials) result
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveCredentialsMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.Credentials.Credentials), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod UnixConnectionReceiveCredentialsMethodInfo a signature where
overloadedMethod = unixConnectionReceiveCredentials
instance O.OverloadedMethodInfo UnixConnectionReceiveCredentialsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionReceiveCredentials",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionReceiveCredentials"
})
#endif
foreign import ccall "g_unix_connection_receive_credentials_async" g_unix_connection_receive_credentials_async ::
Ptr UnixConnection ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
unixConnectionReceiveCredentialsAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
unixConnectionReceiveCredentialsAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
unixConnectionReceiveCredentialsAsync a
connection Maybe b
cancellable Maybe AsyncReadyCallback
callback = 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
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_unix_connection_receive_credentials_async connection' maybeCancellable maybeCallback userData
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveCredentialsAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod UnixConnectionReceiveCredentialsAsyncMethodInfo a signature where
overloadedMethod = unixConnectionReceiveCredentialsAsync
instance O.OverloadedMethodInfo UnixConnectionReceiveCredentialsAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionReceiveCredentialsAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionReceiveCredentialsAsync"
})
#endif
foreign import ccall "g_unix_connection_receive_credentials_finish" g_unix_connection_receive_credentials_finish ::
Ptr UnixConnection ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.Credentials.Credentials)
unixConnectionReceiveCredentialsFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m Gio.Credentials.Credentials
unixConnectionReceiveCredentialsFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsAsyncResult b) =>
a -> b -> m Credentials
unixConnectionReceiveCredentialsFinish a
connection b
result_ = IO Credentials -> m Credentials
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Credentials -> m Credentials)
-> IO Credentials -> m Credentials
forall a b. (a -> b) -> a -> b
$ do
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
result_' <- unsafeManagedPtrCastPtr result_
onException (do
result <- propagateGError $ g_unix_connection_receive_credentials_finish connection' result_'
checkUnexpectedReturnNULL "unixConnectionReceiveCredentialsFinish" result
result' <- (wrapObject Gio.Credentials.Credentials) result
touchManagedPtr connection
touchManagedPtr result_
return result'
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveCredentialsFinishMethodInfo
instance (signature ~ (b -> m Gio.Credentials.Credentials), MonadIO m, IsUnixConnection a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod UnixConnectionReceiveCredentialsFinishMethodInfo a signature where
overloadedMethod = unixConnectionReceiveCredentialsFinish
instance O.OverloadedMethodInfo UnixConnectionReceiveCredentialsFinishMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionReceiveCredentialsFinish",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionReceiveCredentialsFinish"
})
#endif
foreign import ccall "g_unix_connection_receive_fd" g_unix_connection_receive_fd ::
Ptr UnixConnection ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int32
unixConnectionReceiveFd ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m Int32
unixConnectionReceiveFd :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) =>
a -> Maybe b -> m Int32
unixConnectionReceiveFd a
connection Maybe b
cancellable = 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
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_unix_connection_receive_fd connection' maybeCancellable
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return result
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveFdMethodInfo
instance (signature ~ (Maybe (b) -> m Int32), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod UnixConnectionReceiveFdMethodInfo a signature where
overloadedMethod = unixConnectionReceiveFd
instance O.OverloadedMethodInfo UnixConnectionReceiveFdMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionReceiveFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionReceiveFd"
})
#endif
foreign import ccall "g_unix_connection_send_credentials" g_unix_connection_send_credentials ::
Ptr UnixConnection ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
unixConnectionSendCredentials ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> m ()
unixConnectionSendCredentials :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) =>
a -> Maybe b -> m ()
unixConnectionSendCredentials a
connection Maybe b
cancellable = 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
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_unix_connection_send_credentials connection' maybeCancellable
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendCredentialsMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod UnixConnectionSendCredentialsMethodInfo a signature where
overloadedMethod = unixConnectionSendCredentials
instance O.OverloadedMethodInfo UnixConnectionSendCredentialsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionSendCredentials",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionSendCredentials"
})
#endif
foreign import ccall "g_unix_connection_send_credentials_async" g_unix_connection_send_credentials_async ::
Ptr UnixConnection ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
unixConnectionSendCredentialsAsync ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (b)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
unixConnectionSendCredentialsAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
unixConnectionSendCredentialsAsync a
connection Maybe b
cancellable Maybe AsyncReadyCallback
callback = 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
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
maybeCallback <- case callback of
Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
forall a. FunPtr a
FP.nullFunPtr
Just AsyncReadyCallback
jCallback -> do
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback))
poke ptrcallback jCallback'
return jCallback'
let userData = Ptr a
forall a. Ptr a
nullPtr
g_unix_connection_send_credentials_async connection' maybeCancellable maybeCallback userData
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendCredentialsAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod UnixConnectionSendCredentialsAsyncMethodInfo a signature where
overloadedMethod = unixConnectionSendCredentialsAsync
instance O.OverloadedMethodInfo UnixConnectionSendCredentialsAsyncMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionSendCredentialsAsync",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionSendCredentialsAsync"
})
#endif
foreign import ccall "g_unix_connection_send_credentials_finish" g_unix_connection_send_credentials_finish ::
Ptr UnixConnection ->
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO CInt
unixConnectionSendCredentialsFinish ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.AsyncResult.IsAsyncResult b) =>
a
-> b
-> m ()
unixConnectionSendCredentialsFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsAsyncResult b) =>
a -> b -> m ()
unixConnectionSendCredentialsFinish a
connection b
result_ = 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
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_unix_connection_send_credentials_finish connection' result_'
touchManagedPtr connection
touchManagedPtr result_
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendCredentialsFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsUnixConnection a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod UnixConnectionSendCredentialsFinishMethodInfo a signature where
overloadedMethod = unixConnectionSendCredentialsFinish
instance O.OverloadedMethodInfo UnixConnectionSendCredentialsFinishMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionSendCredentialsFinish",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionSendCredentialsFinish"
})
#endif
foreign import ccall "g_unix_connection_send_fd" g_unix_connection_send_fd ::
Ptr UnixConnection ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
unixConnectionSendFd ::
(B.CallStack.HasCallStack, MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) =>
a
-> Int32
-> Maybe (b)
-> m ()
unixConnectionSendFd :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) =>
a -> Int32 -> Maybe b -> m ()
unixConnectionSendFd a
connection Int32
fd Maybe b
cancellable = 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
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
maybeCancellable <- case cancellable of
Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
FP.nullPtr
Just b
jCancellable -> do
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_unix_connection_send_fd connection' fd maybeCancellable
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendFdMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> m ()), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod UnixConnectionSendFdMethodInfo a signature where
overloadedMethod = unixConnectionSendFd
instance O.OverloadedMethodInfo UnixConnectionSendFdMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Objects.UnixConnection.unixConnectionSendFd",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Objects-UnixConnection.html#v:unixConnectionSendFd"
})
#endif