dbus-0.10.7: A client library for the D-Bus IPC system.

Safe HaskellNone




Support for defining custom transport mechanisms. Most users will not need to care about the types defined in this module.



class Transport t whereSource

A Transport can exchange bytes with a remote peer.

Associated Types

data TransportOptions t :: *Source

Additional options that this transport type may use when establishing a connection.


transportDefaultOptions :: TransportOptions tSource

Default values for this transport's options.

transportPut :: t -> ByteString -> IO ()Source

Send a ByteString over the transport.

Throws a TransportError if an error occurs.

transportGet :: t -> Int -> IO ByteStringSource

Receive a ByteString of the given size from the transport. The transport should block until sufficient bytes are available, and only return fewer than the requested amount if there will not be any more data.

Throws a TransportError if an error occurs.

transportClose :: t -> IO ()Source

Close an open transport, and release any associated resources or handles.

class Transport t => TransportOpen t whereSource

A Transport which can open a connection to a remote peer.


transportOpen :: TransportOptions t -> Address -> IO tSource

Open a connection to the given address, using the given options.

Throws a TransportError if the connection could not be established.

class Transport t => TransportListen t whereSource

A Transport which can listen for and accept connections from remote peers.

Associated Types

data TransportListener t :: *Source

Used for transports that listen on a port or address.


transportListen :: TransportOptions t -> Address -> IO (TransportListener t)Source

Begin listening for connections on the given address, using the given options.

Throws a TransportError if it's not possible to listen at that address (for example, if the port is already in use).

transportAccept :: TransportListener t -> IO tSource

Accept a new connection.

Throws a TransportError if some error happens before the transport is ready to exchange bytes.

transportListenerClose :: TransportListener t -> IO ()Source

Close an open listener.

transportListenerAddress :: TransportListener t -> AddressSource

Get the address to use to connect to a listener.

transportListenerUUID :: TransportListener t -> UUIDSource

Get the UUID allocated to this transport listener.

See randomUUID.

Transport errors

data TransportError Source

Thrown from transport methods when an error occurs.

Socket transport

data SocketTransport Source

Supports connecting over Unix or TCP sockets.

Unix sockets are similar to pipes, but exist as special files in the filesystem. On Linux, abstract sockets have a path-like address, but do not actually have entries in the filesystem.

TCP sockets may use either IPv4 or IPv6.

socketTransportCredentials :: SocketTransport -> IO (CUInt, CUInt, CUInt)Source

Returns the processID, userID, and groupID of the socket's peer.

See getPeerCred.