#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.UnixConnection
(
UnixConnection(..) ,
IsUnixConnection ,
toUnixConnection ,
noUnixConnection ,
#if ENABLE_OVERLOADING
UnixConnectionReceiveCredentialsMethodInfo,
#endif
unixConnectionReceiveCredentials ,
#if ENABLE_OVERLOADING
UnixConnectionReceiveCredentialsAsyncMethodInfo,
#endif
unixConnectionReceiveCredentialsAsync ,
#if ENABLE_OVERLOADING
UnixConnectionReceiveCredentialsFinishMethodInfo,
#endif
unixConnectionReceiveCredentialsFinish ,
#if ENABLE_OVERLOADING
UnixConnectionReceiveFdMethodInfo ,
#endif
unixConnectionReceiveFd ,
#if ENABLE_OVERLOADING
UnixConnectionSendCredentialsMethodInfo ,
#endif
unixConnectionSendCredentials ,
#if ENABLE_OVERLOADING
UnixConnectionSendCredentialsAsyncMethodInfo,
#endif
unixConnectionSendCredentialsAsync ,
#if ENABLE_OVERLOADING
UnixConnectionSendCredentialsFinishMethodInfo,
#endif
unixConnectionSendCredentialsFinish ,
#if 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.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)
foreign import ccall "g_unix_connection_get_type"
c_g_unix_connection_get_type :: IO GType
instance GObject UnixConnection where
gobjectType = c_g_unix_connection_get_type
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 = liftIO . unsafeCastTo UnixConnection
noUnixConnection :: Maybe UnixConnection
noUnixConnection = Nothing
#if 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 (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#if 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 ENABLE_OVERLOADING
#endif
#if 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 connection cancellable = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr 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 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 connection cancellable callback = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- 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 = nullPtr
g_unix_connection_receive_credentials_async connection' maybeCancellable maybeCallback userData
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
#if 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 connection result_ = liftIO $ do
connection' <- unsafeManagedPtrCastPtr 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 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 connection cancellable = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
result <- propagateGError $ g_unix_connection_receive_fd connection' maybeCancellable
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return result
) (do
return ()
)
#if 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 connection cancellable = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_unix_connection_send_credentials connection' maybeCancellable
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if 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 connection cancellable callback = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
maybeCallback <- case callback of
Nothing -> return (castPtrToFunPtr nullPtr)
Just jCallback -> do
ptrcallback <- 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 = nullPtr
g_unix_connection_send_credentials_async connection' maybeCancellable maybeCallback userData
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
#if 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 connection result_ = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
result_' <- unsafeManagedPtrCastPtr result_
onException (do
_ <- propagateGError $ g_unix_connection_send_credentials_finish connection' result_'
touchManagedPtr connection
touchManagedPtr result_
return ()
) (do
return ()
)
#if 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 connection fd cancellable = liftIO $ do
connection' <- unsafeManagedPtrCastPtr connection
maybeCancellable <- case cancellable of
Nothing -> return nullPtr
Just jCancellable -> do
jCancellable' <- unsafeManagedPtrCastPtr jCancellable
return jCancellable'
onException (do
_ <- propagateGError $ g_unix_connection_send_fd connection' fd maybeCancellable
touchManagedPtr connection
whenJust cancellable touchManagedPtr
return ()
) (do
return ()
)
#if 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