Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.UnixConnection
Description
This is the subclass of SocketConnection
that is created
for UNIX domain sockets.
It contains functions to do some of the UNIX socket specific functionality like passing file descriptors.
Since GLib 2.72, GUnixConnection
is available on all platforms. It requires
underlying system support (such as Windows 10 with AF_UNIX
) at run time.
Before GLib 2.72, <gio/gunixconnection.h>
belonged to the UNIX-specific GIO
interfaces, thus you had to use the gio-unix-2.0.pc
pkg-config file when
using it. This is no longer necessary since GLib 2.72.
Since: 2.22
Synopsis
- newtype UnixConnection = UnixConnection (ManagedPtr UnixConnection)
- class (GObject o, IsDescendantOf UnixConnection o) => IsUnixConnection o
- toUnixConnection :: (MonadIO m, IsUnixConnection o) => o -> m UnixConnection
- type family ResolveUnixConnectionMethod (t :: Symbol) o where ...
- data UnixConnectionReceiveCredentialsMethodInfo
- unixConnectionReceiveCredentials :: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) => a -> Maybe b -> m Credentials
- data UnixConnectionReceiveCredentialsAsyncMethodInfo
- unixConnectionReceiveCredentialsAsync :: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data UnixConnectionReceiveCredentialsFinishMethodInfo
- unixConnectionReceiveCredentialsFinish :: (HasCallStack, MonadIO m, IsUnixConnection a, IsAsyncResult b) => a -> b -> m Credentials
- data UnixConnectionReceiveFdMethodInfo
- unixConnectionReceiveFd :: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) => a -> Maybe b -> m Int32
- data UnixConnectionSendCredentialsMethodInfo
- unixConnectionSendCredentials :: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) => a -> Maybe b -> m ()
- data UnixConnectionSendCredentialsAsyncMethodInfo
- unixConnectionSendCredentialsAsync :: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data UnixConnectionSendCredentialsFinishMethodInfo
- unixConnectionSendCredentialsFinish :: (HasCallStack, MonadIO m, IsUnixConnection a, IsAsyncResult b) => a -> b -> m ()
- data UnixConnectionSendFdMethodInfo
- unixConnectionSendFd :: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) => a -> Int32 -> Maybe b -> m ()
Exported types
newtype UnixConnection Source #
Memory-managed wrapper type.
Constructors
UnixConnection (ManagedPtr UnixConnection) |
Instances
class (GObject o, IsDescendantOf UnixConnection o) => IsUnixConnection o Source #
Type class for types which can be safely cast to UnixConnection
, for instance with toUnixConnection
.
Instances
(GObject o, IsDescendantOf UnixConnection o) => IsUnixConnection o Source # | |
Defined in GI.Gio.Objects.UnixConnection |
toUnixConnection :: (MonadIO m, IsUnixConnection o) => o -> m UnixConnection Source #
Cast to UnixConnection
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, clearPending, close, closeAsync, closeFinish, connect, connectAsync, connectFinish, forceFloating, freezeNotify, getv, hasPending, isClosed, isConnected, isFloating, notify, notifyByPspec, receiveCredentials, receiveCredentialsAsync, receiveCredentialsFinish, receiveFd, ref, refSink, runDispose, sendCredentials, sendCredentialsAsync, sendCredentialsFinish, sendFd, spliceAsync, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getInputStream, getLocalAddress, getOutputStream, getProperty, getQdata, getRemoteAddress, getSocket.
Setters
type family ResolveUnixConnectionMethod (t :: Symbol) o where ... Source #
Equations
receiveCredentials
data UnixConnectionReceiveCredentialsMethodInfo Source #
Instances
(signature ~ (Maybe b -> m Credentials), MonadIO m, IsUnixConnection a, IsCancellable b) => OverloadedMethod UnixConnectionReceiveCredentialsMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionReceiveCredentialsMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionReceiveCredentials Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m Credentials | Returns: Received credentials on success (free with
|
Receives credentials from the sending end of the connection. The
sending end has to call unixConnectionSendCredentials
(or
similar) for this to work.
As well as reading the credentials this also reads (and discards) a single byte from the stream, as this is required for credentials passing to work on some implementations.
This method can be expected to be available on the following platforms:
- Linux since GLib 2.26
- FreeBSD since GLib 2.26
- GNU/kFreeBSD since GLib 2.36
- Solaris, Illumos and OpenSolaris since GLib 2.40
- GNU/Hurd since GLib 2.40
Other ways to exchange credentials with a foreign peer includes the
UnixCredentialsMessage
type and socketGetCredentials
function.
Since: 2.26
receiveCredentialsAsync
data UnixConnectionReceiveCredentialsAsyncMethodInfo Source #
Instances
(signature ~ (Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsUnixConnection a, IsCancellable b) => OverloadedMethod UnixConnectionReceiveCredentialsAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionReceiveCredentialsAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionReceiveCredentialsAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously receive credentials.
For more details, see unixConnectionReceiveCredentials
which is
the synchronous version of this call.
When the operation is finished, callback
will be called. You can then call
unixConnectionReceiveCredentialsFinish
to get the result of the operation.
Since: 2.32
receiveCredentialsFinish
data UnixConnectionReceiveCredentialsFinishMethodInfo Source #
Instances
(signature ~ (b -> m Credentials), MonadIO m, IsUnixConnection a, IsAsyncResult b) => OverloadedMethod UnixConnectionReceiveCredentialsFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionReceiveCredentialsFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionReceiveCredentialsFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m Credentials | Returns: a |
Finishes an asynchronous receive credentials operation started with
unixConnectionReceiveCredentialsAsync
.
Since: 2.32
receiveFd
data UnixConnectionReceiveFdMethodInfo Source #
Instances
(signature ~ (Maybe b -> m Int32), MonadIO m, IsUnixConnection a, IsCancellable b) => OverloadedMethod UnixConnectionReceiveFdMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionReceiveFdMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionReceiveFd Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m Int32 | Returns: a file descriptor on success, -1 on error. (Can throw |
Receives a file descriptor from the sending end of the connection.
The sending end has to call unixConnectionSendFd
for this
to work.
As well as reading the fd this also reads a single byte from the stream, as this is required for fd passing to work on some implementations.
Since: 2.22
sendCredentials
data UnixConnectionSendCredentialsMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsUnixConnection a, IsCancellable b) => OverloadedMethod UnixConnectionSendCredentialsMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionSendCredentialsMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionSendCredentials Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Passes the credentials of the current user the receiving side
of the connection. The receiving end has to call
unixConnectionReceiveCredentials
(or similar) to accept the
credentials.
As well as sending the credentials this also writes a single NUL byte to the stream, as this is required for credentials passing to work on some implementations.
This method can be expected to be available on the following platforms:
- Linux since GLib 2.26
- FreeBSD since GLib 2.26
- GNU/kFreeBSD since GLib 2.36
- Solaris, Illumos and OpenSolaris since GLib 2.40
- GNU/Hurd since GLib 2.40
Other ways to exchange credentials with a foreign peer includes the
UnixCredentialsMessage
type and socketGetCredentials
function.
Since: 2.26
sendCredentialsAsync
data UnixConnectionSendCredentialsAsyncMethodInfo Source #
Instances
(signature ~ (Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsUnixConnection a, IsCancellable b) => OverloadedMethod UnixConnectionSendCredentialsAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionSendCredentialsAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionSendCredentialsAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously send credentials.
For more details, see unixConnectionSendCredentials
which is
the synchronous version of this call.
When the operation is finished, callback
will be called. You can then call
unixConnectionSendCredentialsFinish
to get the result of the operation.
Since: 2.32
sendCredentialsFinish
data UnixConnectionSendCredentialsFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsUnixConnection a, IsAsyncResult b) => OverloadedMethod UnixConnectionSendCredentialsFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionSendCredentialsFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
unixConnectionSendCredentialsFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes an asynchronous send credentials operation started with
unixConnectionSendCredentialsAsync
.
Since: 2.32
sendFd
data UnixConnectionSendFdMethodInfo Source #
Instances
(signature ~ (Int32 -> Maybe b -> m ()), MonadIO m, IsUnixConnection a, IsCancellable b) => OverloadedMethod UnixConnectionSendFdMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo UnixConnectionSendFdMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.UnixConnection Methods |
Arguments
:: (HasCallStack, MonadIO m, IsUnixConnection a, IsCancellable b) | |
=> a |
|
-> Int32 |
|
-> Maybe b |
|
-> m () | (Can throw |
Passes a file descriptor to the receiving side of the
connection. The receiving end has to call unixConnectionReceiveFd
to accept the file descriptor.
As well as sending the fd this also writes a single byte to the stream, as this is required for fd passing to work on some implementations.
Since: 2.22