{-# 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 ,
noUnixConnection ,
#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.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 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
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
newtype UnixConnection = UnixConnection (ManagedPtr UnixConnection)
deriving (UnixConnection -> UnixConnection -> Bool
(UnixConnection -> UnixConnection -> Bool)
-> (UnixConnection -> UnixConnection -> Bool) -> Eq UnixConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnixConnection -> UnixConnection -> Bool
$c/= :: UnixConnection -> UnixConnection -> Bool
== :: UnixConnection -> UnixConnection -> Bool
$c== :: UnixConnection -> UnixConnection -> Bool
Eq)
foreign import ccall "g_unix_connection_get_type"
c_g_unix_connection_get_type :: IO GType
instance GObject UnixConnection where
gobjectType :: IO GType
gobjectType = IO GType
c_g_unix_connection_get_type
instance B.GValue.IsGValue UnixConnection where
toGValue :: UnixConnection -> IO GValue
toGValue o :: UnixConnection
o = do
GType
gtype <- IO GType
c_g_unix_connection_get_type
UnixConnection -> (Ptr UnixConnection -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr UnixConnection
o (GType
-> (GValue -> Ptr UnixConnection -> IO ())
-> Ptr UnixConnection
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr UnixConnection -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO UnixConnection
fromGValue gv :: GValue
gv = do
Ptr UnixConnection
ptr <- GValue -> IO (Ptr UnixConnection)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr UnixConnection)
(ManagedPtr UnixConnection -> UnixConnection)
-> Ptr UnixConnection -> IO UnixConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr UnixConnection -> UnixConnection
UnixConnection Ptr UnixConnection
ptr
class (GObject o, O.IsDescendantOf UnixConnection o) => IsUnixConnection o
instance (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 :: (MonadIO m, IsUnixConnection o) => o -> m UnixConnection
toUnixConnection :: o -> m UnixConnection
toUnixConnection = IO UnixConnection -> m UnixConnection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr UnixConnection -> UnixConnection
UnixConnection
noUnixConnection :: Maybe UnixConnection
noUnixConnection :: Maybe UnixConnection
noUnixConnection = Maybe UnixConnection
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveUnixConnectionMethod (t :: Symbol) (o :: *) :: * 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.MethodInfo 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
#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, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList UnixConnection = UnixConnectionSignalList
type UnixConnectionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#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 :: a -> Maybe b -> m Credentials
unixConnectionReceiveCredentials connection :: a
connection cancellable :: Maybe b
cancellable = IO Credentials -> m Credentials
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
Ptr UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Credentials -> IO () -> IO Credentials
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Credentials
result <- (Ptr (Ptr GError) -> IO (Ptr Credentials)) -> IO (Ptr Credentials)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Credentials))
-> IO (Ptr Credentials))
-> (Ptr (Ptr GError) -> IO (Ptr Credentials))
-> IO (Ptr Credentials)
forall a b. (a -> b) -> a -> b
$ Ptr UnixConnection
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr Credentials)
g_unix_connection_receive_credentials Ptr UnixConnection
connection' Ptr Cancellable
maybeCancellable
Text -> Ptr Credentials -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixConnectionReceiveCredentials" Ptr Credentials
result
Credentials
result' <- ((ManagedPtr Credentials -> Credentials)
-> Ptr Credentials -> IO Credentials
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Credentials -> Credentials
Gio.Credentials.Credentials) Ptr Credentials
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Credentials -> IO Credentials
forall (m :: * -> *) a. Monad m => a -> m a
return Credentials
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveCredentialsMethodInfo
instance (signature ~ (Maybe (b) -> m Gio.Credentials.Credentials), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo UnixConnectionReceiveCredentialsMethodInfo a signature where
overloadedMethod = 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 :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
unixConnectionReceiveCredentialsAsync connection :: a
connection cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = 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 UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr UnixConnection
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_unix_connection_receive_credentials_async Ptr UnixConnection
connection' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
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.MethodInfo UnixConnectionReceiveCredentialsAsyncMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> m Credentials
unixConnectionReceiveCredentialsFinish connection :: a
connection result_ :: b
result_ = IO Credentials -> m Credentials
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
Ptr UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO Credentials -> IO () -> IO Credentials
forall a b. IO a -> IO b -> IO a
onException (do
Ptr Credentials
result <- (Ptr (Ptr GError) -> IO (Ptr Credentials)) -> IO (Ptr Credentials)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Credentials))
-> IO (Ptr Credentials))
-> (Ptr (Ptr GError) -> IO (Ptr Credentials))
-> IO (Ptr Credentials)
forall a b. (a -> b) -> a -> b
$ Ptr UnixConnection
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr Credentials)
g_unix_connection_receive_credentials_finish Ptr UnixConnection
connection' Ptr AsyncResult
result_'
Text -> Ptr Credentials -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixConnectionReceiveCredentialsFinish" Ptr Credentials
result
Credentials
result' <- ((ManagedPtr Credentials -> Credentials)
-> Ptr Credentials -> IO Credentials
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Credentials -> Credentials
Gio.Credentials.Credentials) Ptr Credentials
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
Credentials -> IO Credentials
forall (m :: * -> *) a. Monad m => a -> m a
return Credentials
result'
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveCredentialsFinishMethodInfo
instance (signature ~ (b -> m Gio.Credentials.Credentials), MonadIO m, IsUnixConnection a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo UnixConnectionReceiveCredentialsFinishMethodInfo a signature where
overloadedMethod = 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 :: a -> Maybe b -> m Int32
unixConnectionReceiveFd connection :: a
connection cancellable :: Maybe b
cancellable = 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 UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO Int32 -> IO () -> IO Int32
forall a b. IO a -> IO b -> IO a
onException (do
Int32
result <- (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int32) -> IO Int32)
-> (Ptr (Ptr GError) -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ Ptr UnixConnection
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO Int32
g_unix_connection_receive_fd Ptr UnixConnection
connection' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionReceiveFdMethodInfo
instance (signature ~ (Maybe (b) -> m Int32), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo UnixConnectionReceiveFdMethodInfo a signature where
overloadedMethod = 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 :: a -> Maybe b -> m ()
unixConnectionSendCredentials connection :: a
connection cancellable :: Maybe b
cancellable = 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 UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr UnixConnection
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_unix_connection_send_credentials Ptr UnixConnection
connection' Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendCredentialsMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo UnixConnectionSendCredentialsMethodInfo a signature where
overloadedMethod = 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 :: a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
unixConnectionSendCredentialsAsync connection :: a
connection cancellable :: Maybe b
cancellable callback :: Maybe AsyncReadyCallback
callback = 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 UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just jCallback :: AsyncReadyCallback
jCallback -> do
Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
Ptr UnixConnection
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_unix_connection_send_credentials_async Ptr UnixConnection
connection' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
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.MethodInfo UnixConnectionSendCredentialsAsyncMethodInfo a signature where
overloadedMethod = 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 :: a -> b -> m ()
unixConnectionSendCredentialsFinish connection :: a
connection result_ :: b
result_ = 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 UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr UnixConnection
-> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_unix_connection_send_credentials_finish Ptr UnixConnection
connection' Ptr AsyncResult
result_'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendCredentialsFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsUnixConnection a, Gio.AsyncResult.IsAsyncResult b) => O.MethodInfo UnixConnectionSendCredentialsFinishMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> Maybe b -> m ()
unixConnectionSendFd connection :: a
connection fd :: Int32
fd cancellable :: Maybe b
cancellable = 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 UnixConnection
connection' <- a -> IO (Ptr UnixConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
Just jCancellable :: b
jCancellable -> do
Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr UnixConnection
-> Int32 -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_unix_connection_send_fd Ptr UnixConnection
connection' Int32
fd Ptr Cancellable
maybeCancellable
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
) (do
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
)
#if defined(ENABLE_OVERLOADING)
data UnixConnectionSendFdMethodInfo
instance (signature ~ (Int32 -> Maybe (b) -> m ()), MonadIO m, IsUnixConnection a, Gio.Cancellable.IsCancellable b) => O.MethodInfo UnixConnectionSendFdMethodInfo a signature where
overloadedMethod = unixConnectionSendFd
#endif