Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
DBusServer
is a helper for listening to and accepting D-Bus
connections. This can be used to create a new D-Bus server, allowing two
peers to use the D-Bus protocol for their own specialized communication.
A server instance provided in this way will not perform message routing or
implement the org.freedesktop.DBus interface.
To just export an object on a well-known name on a message bus, such as the
session or system bus, you should instead use g_bus_own_name()
.
An example of peer-to-peer communication with G-DBus can be found in gdbus-example-peer.c.
- newtype DBusServer = DBusServer (ManagedPtr DBusServer)
- class GObject o => IsDBusServer o
- toDBusServer :: (MonadIO m, IsDBusServer o) => o -> m DBusServer
- noDBusServer :: Maybe DBusServer
- dBusServerGetClientAddress :: (HasCallStack, MonadIO m, IsDBusServer a) => a -> m Text
- dBusServerGetFlags :: (HasCallStack, MonadIO m, IsDBusServer a) => a -> m [DBusServerFlags]
- dBusServerGetGuid :: (HasCallStack, MonadIO m, IsDBusServer a) => a -> m Text
- dBusServerIsActive :: (HasCallStack, MonadIO m, IsDBusServer a) => a -> m Bool
- dBusServerNewSync :: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) => Text -> [DBusServerFlags] -> Text -> Maybe a -> Maybe b -> m DBusServer
- dBusServerStart :: (HasCallStack, MonadIO m, IsDBusServer a) => a -> m ()
- dBusServerStop :: (HasCallStack, MonadIO m, IsDBusServer a) => a -> m ()
- getDBusServerActive :: (MonadIO m, IsDBusServer o) => o -> m Bool
- constructDBusServerAddress :: IsDBusServer o => Text -> IO (GValueConstruct o)
- getDBusServerAddress :: (MonadIO m, IsDBusServer o) => o -> m (Maybe Text)
- constructDBusServerAuthenticationObserver :: (IsDBusServer o, IsDBusAuthObserver a) => a -> IO (GValueConstruct o)
- getDBusServerAuthenticationObserver :: (MonadIO m, IsDBusServer o) => o -> m (Maybe DBusAuthObserver)
- getDBusServerClientAddress :: (MonadIO m, IsDBusServer o) => o -> m Text
- constructDBusServerFlags :: IsDBusServer o => [DBusServerFlags] -> IO (GValueConstruct o)
- getDBusServerFlags :: (MonadIO m, IsDBusServer o) => o -> m [DBusServerFlags]
- constructDBusServerGuid :: IsDBusServer o => Text -> IO (GValueConstruct o)
- getDBusServerGuid :: (MonadIO m, IsDBusServer o) => o -> m Text
- type C_DBusServerNewConnectionCallback = Ptr () -> Ptr DBusConnection -> Ptr () -> IO CInt
- type DBusServerNewConnectionCallback = DBusConnection -> IO Bool
- afterDBusServerNewConnection :: (IsDBusServer a, MonadIO m) => a -> DBusServerNewConnectionCallback -> m SignalHandlerId
- genClosure_DBusServerNewConnection :: DBusServerNewConnectionCallback -> IO Closure
- mk_DBusServerNewConnectionCallback :: C_DBusServerNewConnectionCallback -> IO (FunPtr C_DBusServerNewConnectionCallback)
- noDBusServerNewConnectionCallback :: Maybe DBusServerNewConnectionCallback
- onDBusServerNewConnection :: (IsDBusServer a, MonadIO m) => a -> DBusServerNewConnectionCallback -> m SignalHandlerId
- wrap_DBusServerNewConnectionCallback :: DBusServerNewConnectionCallback -> Ptr () -> Ptr DBusConnection -> Ptr () -> IO CInt
Exported types
newtype DBusServer Source #
class GObject o => IsDBusServer o Source #
toDBusServer :: (MonadIO m, IsDBusServer o) => o -> m DBusServer Source #
Methods
getClientAddress
dBusServerGetClientAddress Source #
:: (HasCallStack, MonadIO m, IsDBusServer a) | |
=> a |
|
-> m Text | Returns: A D-Bus address string. Do not free, the string is owned
by |
Gets a
D-Bus address
string that can be used by clients to connect to server
.
Since: 2.26
getFlags
:: (HasCallStack, MonadIO m, IsDBusServer a) | |
=> a |
|
-> m [DBusServerFlags] | Returns: A set of flags from the |
Gets the flags for server
.
Since: 2.26
getGuid
:: (HasCallStack, MonadIO m, IsDBusServer a) | |
=> a |
|
-> m Text | Returns: A D-Bus GUID. Do not free this string, it is owned by |
Gets the GUID for server
.
Since: 2.26
isActive
:: (HasCallStack, MonadIO m, IsDBusServer a) | |
=> a |
|
-> m Bool |
Gets whether server
is active.
Since: 2.26
newSync
:: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) | |
=> Text |
|
-> [DBusServerFlags] |
|
-> Text |
|
-> Maybe a |
|
-> Maybe b |
|
-> m DBusServer | Returns: A |
Creates a new D-Bus server that listens on the first address in
address
that works.
Once constructed, you can use dBusServerGetClientAddress
to
get a D-Bus address string that clients can use to connect.
Connect to the DBusServer
::new-connection
signal to handle
incoming connections.
The returned DBusServer
isn't active - you have to start it with
dBusServerStart
.
DBusServer
is used in this [example][gdbus-peer-to-peer].
This is a synchronous failable constructor. See
g_dbus_server_new()
for the asynchronous version.
Since: 2.26
start
:: (HasCallStack, MonadIO m, IsDBusServer a) | |
=> a |
|
-> m () |
Starts server
.
Since: 2.26
stop
:: (HasCallStack, MonadIO m, IsDBusServer a) | |
=> a |
|
-> m () |
Stops server
.
Since: 2.26
Properties
active
getDBusServerActive :: (MonadIO m, IsDBusServer o) => o -> m Bool Source #
address
constructDBusServerAddress :: IsDBusServer o => Text -> IO (GValueConstruct o) Source #
getDBusServerAddress :: (MonadIO m, IsDBusServer o) => o -> m (Maybe Text) Source #
authenticationObserver
constructDBusServerAuthenticationObserver :: (IsDBusServer o, IsDBusAuthObserver a) => a -> IO (GValueConstruct o) Source #
getDBusServerAuthenticationObserver :: (MonadIO m, IsDBusServer o) => o -> m (Maybe DBusAuthObserver) Source #
clientAddress
getDBusServerClientAddress :: (MonadIO m, IsDBusServer o) => o -> m Text Source #
flags
constructDBusServerFlags :: IsDBusServer o => [DBusServerFlags] -> IO (GValueConstruct o) Source #
getDBusServerFlags :: (MonadIO m, IsDBusServer o) => o -> m [DBusServerFlags] Source #
guid
constructDBusServerGuid :: IsDBusServer o => Text -> IO (GValueConstruct o) Source #
getDBusServerGuid :: (MonadIO m, IsDBusServer o) => o -> m Text Source #
Signals
newConnection
type C_DBusServerNewConnectionCallback = Ptr () -> Ptr DBusConnection -> Ptr () -> IO CInt Source #
type DBusServerNewConnectionCallback = DBusConnection -> IO Bool Source #
afterDBusServerNewConnection :: (IsDBusServer a, MonadIO m) => a -> DBusServerNewConnectionCallback -> m SignalHandlerId Source #
mk_DBusServerNewConnectionCallback :: C_DBusServerNewConnectionCallback -> IO (FunPtr C_DBusServerNewConnectionCallback) Source #
onDBusServerNewConnection :: (IsDBusServer a, MonadIO m) => a -> DBusServerNewConnectionCallback -> m SignalHandlerId Source #
wrap_DBusServerNewConnectionCallback :: DBusServerNewConnectionCallback -> Ptr () -> Ptr DBusConnection -> Ptr () -> IO CInt Source #