gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.DBusServer

Description

GDBusServer 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 busOwnName.

An example of peer-to-peer communication with GDBus can be found in gdbus-example-peer.c.

Note that a minimal GDBusServer will accept connections from any peer. In many use-cases it will be necessary to add a DBusAuthObserver that only accepts connections that have successfully authenticated as the same user that is running the GDBusServer. Since GLib 2.68 this can be achieved more simply by passing the G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flag to the server.

Since: 2.26

Synopsis

Exported types

newtype DBusServer Source #

Memory-managed wrapper type.

Instances

Instances details
Eq DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

GObject DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

ManagedPtrNewtype DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

TypedObject DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

glibType :: IO GType #

HasParentTypes DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

HasAttributeList DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

(info ~ ResolveDBusServerMethod t DBusServer, OverloadedMethod info DBusServer p, HasField t DBusServer p) => HasField (t :: Symbol) DBusServer (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

getField :: DBusServer -> p #

(info ~ ResolveDBusServerMethod t DBusServer, OverloadedMethodInfo info DBusServer) => IsLabel t (MethodProxy info DBusServer) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

(info ~ ResolveDBusServerMethod t DBusServer, OverloadedMethod info DBusServer p) => IsLabel t (DBusServer -> p) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

fromLabel :: DBusServer -> p #

IsGValue (Maybe DBusServer) Source #

Convert DBusServer to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.DBusServer

type AttributeList DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type ParentTypes DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type SignalList DBusServer Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

class (GObject o, IsDescendantOf DBusServer o) => IsDBusServer o Source #

Type class for types which can be safely cast to DBusServer, for instance with toDBusServer.

Instances

Instances details
(GObject o, IsDescendantOf DBusServer o) => IsDBusServer o Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

toDBusServer :: (MonadIO m, IsDBusServer o) => o -> m DBusServer Source #

Cast to DBusServer, for types for which this is known to be safe. For general casts, use castTo.

Methods

type family ResolveDBusServerMethod (t :: Symbol) o where ... Source #

Equations

ResolveDBusServerMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveDBusServerMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveDBusServerMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveDBusServerMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveDBusServerMethod "getv" o = ObjectGetvMethodInfo 
ResolveDBusServerMethod "init" o = InitableInitMethodInfo 
ResolveDBusServerMethod "isActive" o = DBusServerIsActiveMethodInfo 
ResolveDBusServerMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveDBusServerMethod "notify" o = ObjectNotifyMethodInfo 
ResolveDBusServerMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveDBusServerMethod "ref" o = ObjectRefMethodInfo 
ResolveDBusServerMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveDBusServerMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveDBusServerMethod "start" o = DBusServerStartMethodInfo 
ResolveDBusServerMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveDBusServerMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveDBusServerMethod "stop" o = DBusServerStopMethodInfo 
ResolveDBusServerMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveDBusServerMethod "unref" o = ObjectUnrefMethodInfo 
ResolveDBusServerMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveDBusServerMethod "getClientAddress" o = DBusServerGetClientAddressMethodInfo 
ResolveDBusServerMethod "getData" o = ObjectGetDataMethodInfo 
ResolveDBusServerMethod "getFlags" o = DBusServerGetFlagsMethodInfo 
ResolveDBusServerMethod "getGuid" o = DBusServerGetGuidMethodInfo 
ResolveDBusServerMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveDBusServerMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveDBusServerMethod "setData" o = ObjectSetDataMethodInfo 
ResolveDBusServerMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveDBusServerMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveDBusServerMethod l o = MethodResolutionFailed l o :: Type 

getClientAddress

dBusServerGetClientAddress Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusServer a) 
=> a

server: A DBusServer.

-> m Text

Returns: A D-Bus address string. Do not free, the string is owned by server.

Gets a D-Bus address string that can be used by clients to connect to server.

This is valid and non-empty if initializing the DBusServer succeeded.

Since: 2.26

getFlags

dBusServerGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusServer a) 
=> a

server: A DBusServer.

-> m [DBusServerFlags]

Returns: A set of flags from the DBusServerFlags enumeration.

Gets the flags for server.

Since: 2.26

getGuid

data DBusServerGetGuidMethodInfo Source #

Instances

Instances details
(signature ~ m Text, MonadIO m, IsDBusServer a) => OverloadedMethod DBusServerGetGuidMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo DBusServerGetGuidMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

dBusServerGetGuid Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusServer a) 
=> a

server: A DBusServer.

-> m Text

Returns: A D-Bus GUID. Do not free this string, it is owned by server.

Gets the GUID for server, as provided to dBusServerNewSync.

Since: 2.26

isActive

data DBusServerIsActiveMethodInfo Source #

Instances

Instances details
(signature ~ m Bool, MonadIO m, IsDBusServer a) => OverloadedMethod DBusServerIsActiveMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo DBusServerIsActiveMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

dBusServerIsActive Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusServer a) 
=> a

server: A DBusServer.

-> m Bool

Returns: True if server is active, False otherwise.

Gets whether server is active.

Since: 2.26

newSync

dBusServerNewSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) 
=> Text

address: A D-Bus address.

-> [DBusServerFlags]

flags: Flags from the DBusServerFlags enumeration.

-> Text

guid: A D-Bus GUID.

-> Maybe a

observer: A DBusAuthObserver or Nothing.

-> Maybe b

cancellable: A Cancellable or Nothing.

-> m DBusServer

Returns: A DBusServer or Nothing if error is set. Free with objectUnref. (Can throw GError)

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.

To have control over the available authentication mechanisms and the users that are authorized to connect, it is strongly recommended to provide a non-Nothing DBusAuthObserver.

Connect to the DBusServer::newConnection signal to handle incoming connections.

The returned DBusServer isn't active - you have to start it with dBusServerStart.

DBusServer is used in this example.

This is a synchronous failable constructor. There is currently no asynchronous version.

Since: 2.26

start

data DBusServerStartMethodInfo Source #

Instances

Instances details
(signature ~ m (), MonadIO m, IsDBusServer a) => OverloadedMethod DBusServerStartMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo DBusServerStartMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

dBusServerStart Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusServer a) 
=> a

server: A DBusServer.

-> m () 

Starts server.

Since: 2.26

stop

data DBusServerStopMethodInfo Source #

Instances

Instances details
(signature ~ m (), MonadIO m, IsDBusServer a) => OverloadedMethod DBusServerStopMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo DBusServerStopMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

dBusServerStop Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusServer a) 
=> a

server: A DBusServer.

-> m () 

Stops server.

Since: 2.26

Properties

active

Whether the server is currently active.

Since: 2.26

data DBusServerActivePropertyInfo Source #

Instances

Instances details
AttrInfo DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrAllowedOps DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerActivePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

getDBusServerActive :: (MonadIO m, IsDBusServer o) => o -> m Bool Source #

Get the value of the “active” property. When overloading is enabled, this is equivalent to

get dBusServer #active

address

The D-Bus address to listen on.

Since: 2.26

data DBusServerAddressPropertyInfo Source #

Instances

Instances details
AttrInfo DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrAllowedOps DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

constructDBusServerAddress :: (IsDBusServer o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “address” property. This is rarely needed directly, but it is used by new.

getDBusServerAddress :: (MonadIO m, IsDBusServer o) => o -> m (Maybe Text) Source #

Get the value of the “address” property. When overloading is enabled, this is equivalent to

get dBusServer #address

authenticationObserver

A DBusAuthObserver object to assist in the authentication process or Nothing.

Since: 2.26

data DBusServerAuthenticationObserverPropertyInfo Source #

Instances

Instances details
AttrInfo DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

Associated Types

type AttrAllowedOps DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerAuthenticationObserverPropertyInfo 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrAllowedOps DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerAuthenticationObserverPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

constructDBusServerAuthenticationObserver :: (IsDBusServer o, MonadIO m, IsDBusAuthObserver a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “authentication-observer” property. This is rarely needed directly, but it is used by new.

getDBusServerAuthenticationObserver :: (MonadIO m, IsDBusServer o) => o -> m (Maybe DBusAuthObserver) Source #

Get the value of the “authentication-observer” property. When overloading is enabled, this is equivalent to

get dBusServer #authenticationObserver

clientAddress

The D-Bus address that clients can use.

Since: 2.26

data DBusServerClientAddressPropertyInfo Source #

Instances

Instances details
AttrInfo DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrAllowedOps DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerClientAddressPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

getDBusServerClientAddress :: (MonadIO m, IsDBusServer o) => o -> m Text Source #

Get the value of the “client-address” property. When overloading is enabled, this is equivalent to

get dBusServer #clientAddress

flags

Flags from the DBusServerFlags enumeration.

Since: 2.26

data DBusServerFlagsPropertyInfo Source #

Instances

Instances details
AttrInfo DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrAllowedOps DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerFlagsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

constructDBusServerFlags :: (IsDBusServer o, MonadIO m) => [DBusServerFlags] -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “flags” property. This is rarely needed directly, but it is used by new.

getDBusServerFlags :: (MonadIO m, IsDBusServer o) => o -> m [DBusServerFlags] Source #

Get the value of the “flags” property. When overloading is enabled, this is equivalent to

get dBusServer #flags

guid

The GUID of the server.

See DBusConnection:guid for more details.

Since: 2.26

data DBusServerGuidPropertyInfo Source #

Instances

Instances details
AttrInfo DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrAllowedOps DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrBaseTypeConstraint DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrGetType DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrLabel DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrOrigin DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrSetTypeConstraint DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferType DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

type AttrTransferTypeConstraint DBusServerGuidPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.DBusServer

constructDBusServerGuid :: (IsDBusServer o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “guid” property. This is rarely needed directly, but it is used by new.

getDBusServerGuid :: (MonadIO m, IsDBusServer o) => o -> m Text Source #

Get the value of the “guid” property. When overloading is enabled, this is equivalent to

get dBusServer #guid

Signals

newConnection

type DBusServerNewConnectionCallback Source #

Arguments

 = DBusConnection

connection: A DBusConnection for the new connection.

-> IO Bool

Returns: True to claim connection, False to let other handlers run.

Emitted when a new authenticated connection has been made. Use dBusConnectionGetPeerCredentials to figure out what identity (if any), was authenticated.

If you want to accept the connection, take a reference to the connection object and return True. When you are done with the connection call dBusConnectionClose and give up your reference. Note that the other peer may disconnect at any time - a typical thing to do when accepting a connection is to listen to the DBusConnection::closed signal.

If DBusServer:flags contains DBusServerFlagsRunInThread then the signal is emitted in a new thread dedicated to the connection. Otherwise the signal is emitted in the thread-default main context (see mainContextPushThreadDefault) of the thread that server was constructed in.

You are guaranteed that signal handlers for this signal runs before incoming messages on connection are processed. This means that it's suitable to call g_dbus_connection_register_object() or similar from the signal handler.

Since: 2.26

afterDBusServerNewConnection :: (IsDBusServer a, MonadIO m) => a -> ((?self :: a) => DBusServerNewConnectionCallback) -> m SignalHandlerId Source #

Connect a signal handler for the newConnection signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after dBusServer #newConnection callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onDBusServerNewConnection :: (IsDBusServer a, MonadIO m) => a -> ((?self :: a) => DBusServerNewConnectionCallback) -> m SignalHandlerId Source #

Connect a signal handler for the newConnection signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on dBusServer #newConnection callback