- data Connection
- data ConnectionError
- connect :: [Transport] -> [Mechanism] -> Address -> IO Connection
- disconnect :: Connection -> IO ()
- send :: Message msg => Connection -> msg -> (Serial -> IO a) -> IO (Either MarshalError a)
- receive :: Connection -> IO (Either UnmarshalError ReceivedMessage)
- data Mechanism
- mechanism :: (Socket -> IO Bool) -> Mechanism
- external :: Mechanism
- data Transport
- data Socket
- transport :: Text -> (Address -> IO Socket) -> Transport
- socket :: (ByteString -> IO ()) -> (Word32 -> IO ByteString) -> IO () -> Socket
- socketPut :: Socket -> ByteString -> IO ()
- socketGet :: Socket -> Word32 -> IO ByteString
- unix :: Transport
- tcp :: Transport
Documentation
data Connection Source
A Connection
is an opaque handle to an open D‐Bus channel, with
an internal state for maintaining the current message serial.
data ConnectionError Source
connect :: [Transport] -> [Mechanism] -> Address -> IO ConnectionSource
Open a connection to some address, using a given authentication
mechanism. If the connection fails, a ConnectionError
will be thrown.
disconnect :: Connection -> IO ()Source
Close an open connection. Once closed, the Connection
is no longer
valid and must not be used.
send :: Message msg => Connection -> msg -> (Serial -> IO a) -> IO (Either MarshalError a)Source
Send a single message, with a generated Serial
. The second parameter
exists to prevent race conditions when registering a reply handler; it
receives the serial the message will be sent with, before it’s
actually sent.
Only one message may be sent at a time; if multiple threads attempt to send messages in parallel, one will block until after the other has finished.
receive :: Connection -> IO (Either UnmarshalError ReceivedMessage)Source
Receive the next message from the connection, blocking until one is available.
Only one message may be received at a time; if multiple threads attempt to receive messages in parallel, one will block until after the other has finished.
Authentication
Transports
A Transport
is anything which can send and receive bytestrings,
typically via a socket.