-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A client library for the D-Bus IPC system. -- -- D-Bus is a simple, message-based protocol for inter-process -- communication, which allows applications to interact with other parts -- of the machine and the user's session using remote procedure calls. -- -- D-Bus is a essential part of the modern Linux desktop, where it -- replaces earlier protocols such as CORBA and DCOP. -- -- This library is an implementation of the D-Bus protocol in Haskell. It -- can be used to add D-Bus support to Haskell applications, without the -- awkward interfaces common to foreign bindings. -- -- Example: connect to the session bus, and get a list of active names. -- --
-- {-# LANGUAGE OverloadedStrings #-}
--
-- import Data.List (sort)
-- import DBus
-- import DBus.Client
--
-- main = do
-- client <- connectSession
--
-- -- Request a list of connected clients from the bus
-- reply <- call_ client (methodCall "/org/freedesktop/DBus" "org.freedesktop.DBus" "ListNames")
-- { methodCallDestination = Just "org.freedesktop.DBus"
-- }
--
-- -- org.freedesktop.DBus.ListNames() returns a single value, which is
-- -- a list of names (here represented as [String])
-- let Just names = fromVariant (methodReturnBody reply !! 0)
--
-- -- Print each name on a line, sorted so reserved names are below
-- -- temporary names.
-- mapM_ putStrLn (sort names)
--
--
-- -- $ ghc --make list-names.hs -- $ ./list-names -- :1.0 -- :1.1 -- :1.10 -- :1.106 -- :1.109 -- :1.110 -- ca.desrt.dconf -- org.freedesktop.DBus -- org.freedesktop.Notifications -- org.freedesktop.secrets -- org.gnome.ScreenSaver --@package dbus @version 1.3.2 module DBus.Internal.Address -- | When a D-Bus server must listen for connections, or a client must -- connect to a server, the listening socket's configuration is specified -- with an address. An address contains the method, which -- determines the protocol and transport mechanism, and -- parameters, which provide additional method-specific -- information about the address. data Address Address :: String -> Map String String -> Address addressMethod :: Address -> String addressParameters :: Address -> Map String String -- | Try to convert a method string and parameter map to an Address. -- -- Returns Nothing if the method or parameters are invalid. address :: String -> Map String String -> Maybe Address validMethod :: String -> Bool validParams :: Map String String -> Bool optionallyEncoded :: [Char] -- | Convert an address to a string in the format expected by -- parseAddress. formatAddress :: Address -> String -- | Convert a list of addresses to a string in the format expected by -- parseAddresses. formatAddresses :: [Address] -> String -- | Try to parse a string containing one valid address. -- -- An address string is in the format -- method:key1=val1,key2=val2. There are some limitations on the -- characters allowed within methods and parameters; see the D-Bus -- specification for full details. parseAddress :: String -> Maybe Address -- | Try to parse a string containing one or more valid addresses. -- -- Addresses are separated by semicolons. See parseAddress for the -- format of addresses. parseAddresses :: String -> Maybe [Address] parsecAddress :: Parser Address -- | Returns the address in the environment variable -- DBUS_SYSTEM_BUS_ADDRESS, or -- unix:path=/var/run/dbus/system_bus_socket if -- DBUS_SYSTEM_BUS_ADDRESS is not set. -- -- Returns Nothing if DBUS_SYSTEM_BUS_ADDRESS contains an -- invalid address. getSystemAddress :: IO (Maybe Address) -- | Returns the first address in the environment variable -- DBUS_SESSION_BUS_ADDRESS, which must be set. -- -- Returns Nothing if DBUS_SYSTEM_BUS_ADDRESS contains an -- invalid address or DBUS_SESSION_BUS_ADDRESS is unset -- XDG_RUNTIME_DIR doesn't have /bus. getSessionAddress :: IO (Maybe Address) -- | Returns the address in the environment variable -- DBUS_STARTER_ADDRESS, which must be set. -- -- Returns Nothing if DBUS_STARTER_ADDRESS is unset or -- contains an invalid address. getStarterAddress :: IO (Maybe Address) hexToInt :: String -> Int maybeParseString :: Parser a -> String -> Maybe a instance GHC.Classes.Eq DBus.Internal.Address.Address instance GHC.Show.Show DBus.Internal.Address.Address module DBus.Internal.Types data Type TypeBoolean :: Type TypeWord8 :: Type TypeWord16 :: Type TypeWord32 :: Type TypeWord64 :: Type TypeInt16 :: Type TypeInt32 :: Type TypeInt64 :: Type TypeDouble :: Type TypeUnixFd :: Type TypeString :: Type TypeSignature :: Type TypeObjectPath :: Type TypeVariant :: Type TypeArray :: Type -> Type TypeDictionary :: Type -> Type -> Type TypeStructure :: [Type] -> Type showType :: Bool -> Type -> String -- | A signature is a list of D-Bus types, obeying some basic rules of -- validity. -- -- The rules of signature validity are complex: see -- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures -- for details. newtype Signature Signature :: [Type] -> Signature -- | Get the list of types in a signature. The inverse of signature. signatureTypes :: Signature -> [Type] -- | Convert a signature into a signature string. The inverse of -- parseSignature. formatSignature :: Signature -> String typeCode :: Type -> String -- | Convert a list of types into a valid signature. -- -- Throws if the given types are not a valid signature. signature :: MonadThrow m => [Type] -> m Signature -- | Convert a list of types into a valid signature. -- -- Throws an exception if the given types are not a valid signature. signature_ :: [Type] -> Signature -- | Parse a signature string into a valid signature. -- -- Throws if the given string is not a valid signature. parseSignature :: MonadThrow m => String -> m Signature parseSignatureBytes :: MonadThrow m => ByteString -> m Signature parseSigFast :: MonadThrow m => ByteString -> m Signature parseAtom :: Int -> (Type -> a) -> a -> a data SigParseError SigParseError :: SigParseError peekWord8AsInt :: ByteString -> Int -> Int parseSigFull :: MonadThrow m => ByteString -> m Signature extractFromVariant :: IsValue a => Variant -> Maybe a typeOf :: forall a. IsValue a => a -> Type class IsVariant a toVariant :: IsVariant a => a -> Variant fromVariant :: IsVariant a => Variant -> Maybe a -- | Value types can be used as items in containers, such as lists or -- dictionaries. -- -- Users may not provide new instances of IsValue because this -- could allow containers to be created with items of heterogenous types. class IsVariant a => IsValue a typeOf_ :: IsValue a => Proxy a -> Type toValue :: IsValue a => a -> Value fromValue :: IsValue a => Value -> Maybe a -- | Atomic types can be used as keys to dictionaries. -- -- Users may not provide new instances of IsAtom because this -- could allow dictionaries to be created with invalid keys. class IsValue a => IsAtom a toAtom :: IsAtom a => a -> Atom fromAtom :: IsAtom a => Atom -> Maybe a -- | Variants may contain any other built-in D-Bus value. Besides -- representing native VARIANT values, they allow type-safe -- storage and inspection of D-Bus collections. newtype Variant Variant :: Value -> Variant data Value ValueAtom :: Atom -> Value ValueVariant :: Variant -> Value ValueBytes :: ByteString -> Value ValueVector :: Type -> Vector Value -> Value ValueMap :: Type -> Type -> Map Atom Value -> Value ValueStructure :: [Value] -> Value data Atom AtomBool :: Bool -> Atom AtomWord8 :: Word8 -> Atom AtomWord16 :: Word16 -> Atom AtomWord32 :: Word32 -> Atom AtomWord64 :: Word64 -> Atom AtomInt16 :: Int16 -> Atom AtomInt32 :: Int32 -> Atom AtomInt64 :: Int64 -> Atom AtomDouble :: Double -> Atom AtomUnixFd :: Fd -> Atom AtomText :: Text -> Atom AtomSignature :: Signature -> Atom AtomObjectPath :: ObjectPath -> Atom showAtom :: Bool -> Atom -> String showValue :: Bool -> Value -> String showThings :: String -> (a -> String) -> String -> [a] -> String vectorToBytes :: Vector Value -> ByteString -- | Every variant is strongly-typed; that is, the type of its contained -- value is known at all times. This function retrieves that type, so -- that the correct cast can be used to retrieve the value. variantType :: Variant -> Type valueType :: Value -> Type atomType :: Atom -> Type bimap :: Ord k' => (k -> v -> (k', v')) -> Map k v -> Map k' v' bimapM :: (Monad m, Ord k') => (k -> v -> m (k', v')) -> Map k v -> m (Map k' v') varToVal :: IsVariant a => a -> Value -- | Object paths are special strings, used to identify a particular object -- exported from a D-Bus application. -- -- Object paths must begin with a slash, and consist of alphanumeric -- characters separated by slashes. -- -- See -- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path -- for details. newtype ObjectPath ObjectPath :: String -> ObjectPath pathElements :: ObjectPath -> [String] fromElements :: [String] -> ObjectPath formatObjectPath :: ObjectPath -> String parseObjectPath :: MonadThrow m => String -> m ObjectPath objectPath_ :: String -> ObjectPath parserObjectPath :: Parser () -- | Interfaces are used to group a set of methods and signals within an -- exported object. Interface names consist of alphanumeric characters -- separated by periods. -- -- See -- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface -- for details. newtype InterfaceName InterfaceName :: String -> InterfaceName formatInterfaceName :: InterfaceName -> String parseInterfaceName :: MonadThrow m => String -> m InterfaceName interfaceName_ :: String -> InterfaceName parserInterfaceName :: Parser () -- | Member names are used to identify a single method or signal within an -- interface. Method names consist of alphanumeric characters. -- -- See -- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-member -- for details. newtype MemberName MemberName :: String -> MemberName formatMemberName :: MemberName -> String parseMemberName :: MonadThrow m => String -> m MemberName memberName_ :: String -> MemberName parserMemberName :: Parser () -- | Error names are used to identify which type of error was returned from -- a method call. Error names consist of alphanumeric characters -- separated by periods. -- -- See -- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-error -- for details. newtype ErrorName ErrorName :: String -> ErrorName formatErrorName :: ErrorName -> String parseErrorName :: MonadThrow m => String -> m ErrorName errorName_ :: String -> ErrorName -- | Bus names are used to identify particular clients on the message bus. -- A bus name may be either unique or well-known, where -- unique names start with a colon. Bus names consist of alphanumeric -- characters separated by periods. -- -- See -- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus -- for details. newtype BusName BusName :: String -> BusName formatBusName :: BusName -> String parseBusName :: MonadThrow m => String -> m BusName busName_ :: String -> BusName parserBusName :: Parser () -- | A D-Bus Structure is a container type similar to Haskell tuples, -- storing values of any type that is convertable to IsVariant. A -- Structure may contain up to 255 values. -- -- Most users can use the IsVariant instance for tuples to extract -- the values of a structure. This type is for very large structures, -- which may be awkward to work with as tuples. newtype Structure Structure :: [Value] -> Structure structureItems :: Structure -> [Variant] -- | A D-Bus Array is a container type similar to Haskell lists, storing -- zero or more values of a single D-Bus type. -- -- Most users can use the IsVariant instance for lists or vectors -- to extract the values of an array. This type is for advanced use -- cases, where the user wants to convert array values to Haskell types -- that are not instances of IsValue. data Array Array :: Type -> Vector Value -> Array ArrayBytes :: ByteString -> Array arrayItems :: Array -> [Variant] -- | A D-Bus Dictionary is a container type similar to Haskell maps, -- storing zero or more associations between keys and values. -- -- Most users can use the IsVariant instance for maps to extract -- the values of a dictionary. This type is for advanced use cases, where -- the user wants to convert dictionary items to Haskell types that are -- not instances of IsValue. data Dictionary Dictionary :: Type -> Type -> Map Atom Value -> Dictionary dictionaryItems :: Dictionary -> [(Variant, Variant)] -- | A value used to uniquely identify a particular message within a -- session. Serials are 32-bit unsigned integers, and eventually wrap. newtype Serial Serial :: Word32 -> Serial serialValue :: Serial -> Word32 -- | Get the first serial in the sequence. firstSerial :: Serial -- | Get the next serial in the sequence. This may wrap around to -- firstSerial. nextSerial :: Serial -> Serial skipSepBy1 :: Parser a -> Parser b -> Parser () forceParse :: String -> (String -> Maybe a) -> String -> a maybeParseString :: MonadThrow m => Parser a -> String -> m a instance Language.Haskell.TH.Syntax.Lift DBus.Internal.Types.BusName instance Language.Haskell.TH.Syntax.Lift DBus.Internal.Types.ObjectPath instance Language.Haskell.TH.Syntax.Lift DBus.Internal.Types.InterfaceName instance Language.Haskell.TH.Syntax.Lift DBus.Internal.Types.MemberName instance GHC.Generics.Generic DBus.Internal.Types.Type instance GHC.Classes.Ord DBus.Internal.Types.Type instance GHC.Classes.Eq DBus.Internal.Types.Type instance Control.DeepSeq.NFData DBus.Internal.Types.Signature instance GHC.Classes.Ord DBus.Internal.Types.Signature instance GHC.Classes.Eq DBus.Internal.Types.Signature instance GHC.Show.Show DBus.Internal.Types.SigParseError instance Control.DeepSeq.NFData DBus.Internal.Types.ObjectPath instance GHC.Show.Show DBus.Internal.Types.ObjectPath instance GHC.Classes.Ord DBus.Internal.Types.ObjectPath instance GHC.Classes.Eq DBus.Internal.Types.ObjectPath instance GHC.Classes.Ord DBus.Internal.Types.Atom instance GHC.Classes.Eq DBus.Internal.Types.Atom instance GHC.Show.Show DBus.Internal.Types.Atom instance GHC.Classes.Eq DBus.Internal.Types.Variant instance GHC.Show.Show DBus.Internal.Types.Value instance Control.DeepSeq.NFData DBus.Internal.Types.InterfaceName instance GHC.Show.Show DBus.Internal.Types.InterfaceName instance GHC.Classes.Ord DBus.Internal.Types.InterfaceName instance GHC.Classes.Eq DBus.Internal.Types.InterfaceName instance Control.DeepSeq.NFData DBus.Internal.Types.MemberName instance GHC.Show.Show DBus.Internal.Types.MemberName instance GHC.Classes.Ord DBus.Internal.Types.MemberName instance GHC.Classes.Eq DBus.Internal.Types.MemberName instance Control.DeepSeq.NFData DBus.Internal.Types.ErrorName instance GHC.Show.Show DBus.Internal.Types.ErrorName instance GHC.Classes.Ord DBus.Internal.Types.ErrorName instance GHC.Classes.Eq DBus.Internal.Types.ErrorName instance Control.DeepSeq.NFData DBus.Internal.Types.BusName instance GHC.Show.Show DBus.Internal.Types.BusName instance GHC.Classes.Ord DBus.Internal.Types.BusName instance GHC.Classes.Eq DBus.Internal.Types.BusName instance GHC.Classes.Eq DBus.Internal.Types.Structure instance GHC.Classes.Eq DBus.Internal.Types.Dictionary instance GHC.Show.Show DBus.Internal.Types.Serial instance GHC.Classes.Ord DBus.Internal.Types.Serial instance GHC.Classes.Eq DBus.Internal.Types.Serial instance DBus.Internal.Types.IsVariant DBus.Internal.Types.Serial instance GHC.Show.Show DBus.Internal.Types.Dictionary instance DBus.Internal.Types.IsVariant DBus.Internal.Types.Dictionary instance GHC.Show.Show DBus.Internal.Types.Array instance GHC.Classes.Eq DBus.Internal.Types.Array instance DBus.Internal.Types.IsVariant DBus.Internal.Types.Array instance GHC.Show.Show DBus.Internal.Types.Structure instance DBus.Internal.Types.IsVariant DBus.Internal.Types.Structure instance Data.String.IsString DBus.Internal.Types.BusName instance DBus.Internal.Types.IsVariant DBus.Internal.Types.BusName instance Data.String.IsString DBus.Internal.Types.ErrorName instance DBus.Internal.Types.IsVariant DBus.Internal.Types.ErrorName instance Data.String.IsString DBus.Internal.Types.MemberName instance DBus.Internal.Types.IsVariant DBus.Internal.Types.MemberName instance Data.String.IsString DBus.Internal.Types.InterfaceName instance DBus.Internal.Types.IsVariant DBus.Internal.Types.InterfaceName instance DBus.Internal.Types.IsAtom GHC.Types.Bool instance DBus.Internal.Types.IsValue GHC.Types.Bool instance DBus.Internal.Types.IsAtom GHC.Word.Word8 instance DBus.Internal.Types.IsValue GHC.Word.Word8 instance DBus.Internal.Types.IsAtom GHC.Word.Word16 instance DBus.Internal.Types.IsValue GHC.Word.Word16 instance DBus.Internal.Types.IsAtom GHC.Word.Word32 instance DBus.Internal.Types.IsValue GHC.Word.Word32 instance DBus.Internal.Types.IsAtom GHC.Word.Word64 instance DBus.Internal.Types.IsValue GHC.Word.Word64 instance DBus.Internal.Types.IsAtom GHC.Int.Int16 instance DBus.Internal.Types.IsValue GHC.Int.Int16 instance DBus.Internal.Types.IsAtom GHC.Int.Int32 instance DBus.Internal.Types.IsValue GHC.Int.Int32 instance DBus.Internal.Types.IsAtom GHC.Int.Int64 instance DBus.Internal.Types.IsValue GHC.Int.Int64 instance DBus.Internal.Types.IsAtom GHC.Types.Double instance DBus.Internal.Types.IsValue GHC.Types.Double instance DBus.Internal.Types.IsAtom System.Posix.Types.Fd instance DBus.Internal.Types.IsValue System.Posix.Types.Fd instance DBus.Internal.Types.IsAtom Data.Text.Internal.Text instance DBus.Internal.Types.IsValue Data.Text.Internal.Text instance DBus.Internal.Types.IsAtom DBus.Internal.Types.Signature instance DBus.Internal.Types.IsValue DBus.Internal.Types.Signature instance DBus.Internal.Types.IsAtom DBus.Internal.Types.ObjectPath instance DBus.Internal.Types.IsValue DBus.Internal.Types.ObjectPath instance DBus.Internal.Types.IsAtom Data.Text.Internal.Lazy.Text instance DBus.Internal.Types.IsValue Data.Text.Internal.Lazy.Text instance DBus.Internal.Types.IsAtom GHC.Base.String instance DBus.Internal.Types.IsValue GHC.Base.String instance (GHC.Classes.Ord k, DBus.Internal.Types.IsAtom k, DBus.Internal.Types.IsValue v) => DBus.Internal.Types.IsValue (Data.Map.Internal.Map k v) instance (GHC.Classes.Ord k, DBus.Internal.Types.IsAtom k, DBus.Internal.Types.IsValue v) => DBus.Internal.Types.IsVariant (Data.Map.Internal.Map k v) instance DBus.Internal.Types.IsVariant GHC.Types.Bool instance DBus.Internal.Types.IsVariant GHC.Word.Word8 instance DBus.Internal.Types.IsVariant GHC.Word.Word16 instance DBus.Internal.Types.IsVariant GHC.Word.Word32 instance DBus.Internal.Types.IsVariant GHC.Word.Word64 instance DBus.Internal.Types.IsVariant GHC.Int.Int16 instance DBus.Internal.Types.IsVariant GHC.Int.Int32 instance DBus.Internal.Types.IsVariant GHC.Int.Int64 instance DBus.Internal.Types.IsVariant GHC.Types.Double instance DBus.Internal.Types.IsVariant System.Posix.Types.Fd instance DBus.Internal.Types.IsVariant Data.Text.Internal.Text instance DBus.Internal.Types.IsVariant DBus.Internal.Types.Signature instance DBus.Internal.Types.IsVariant DBus.Internal.Types.ObjectPath instance DBus.Internal.Types.IsValue DBus.Internal.Types.Variant instance DBus.Internal.Types.IsVariant DBus.Internal.Types.Variant instance DBus.Internal.Types.IsVariant Data.Text.Internal.Lazy.Text instance DBus.Internal.Types.IsVariant GHC.Base.String instance DBus.Internal.Types.IsValue a => DBus.Internal.Types.IsValue (Data.Vector.Vector a) instance DBus.Internal.Types.IsValue a => DBus.Internal.Types.IsVariant (Data.Vector.Vector a) instance DBus.Internal.Types.IsValue a => DBus.Internal.Types.IsValue [a] instance DBus.Internal.Types.IsValue a => DBus.Internal.Types.IsVariant [a] instance DBus.Internal.Types.IsValue Data.ByteString.Internal.ByteString instance DBus.Internal.Types.IsVariant Data.ByteString.Internal.ByteString instance DBus.Internal.Types.IsValue Data.ByteString.Lazy.Internal.ByteString instance DBus.Internal.Types.IsVariant Data.ByteString.Lazy.Internal.ByteString instance DBus.Internal.Types.IsValue () instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2) => DBus.Internal.Types.IsValue (a1, a2) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3) => DBus.Internal.Types.IsValue (a1, a2, a3) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4) => DBus.Internal.Types.IsValue (a1, a2, a3, a4) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9, DBus.Internal.Types.IsValue a10) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9, DBus.Internal.Types.IsValue a10, DBus.Internal.Types.IsValue a11) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9, DBus.Internal.Types.IsValue a10, DBus.Internal.Types.IsValue a11, DBus.Internal.Types.IsValue a12) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9, DBus.Internal.Types.IsValue a10, DBus.Internal.Types.IsValue a11, DBus.Internal.Types.IsValue a12, DBus.Internal.Types.IsValue a13) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9, DBus.Internal.Types.IsValue a10, DBus.Internal.Types.IsValue a11, DBus.Internal.Types.IsValue a12, DBus.Internal.Types.IsValue a13, DBus.Internal.Types.IsValue a14) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) instance (DBus.Internal.Types.IsValue a1, DBus.Internal.Types.IsValue a2, DBus.Internal.Types.IsValue a3, DBus.Internal.Types.IsValue a4, DBus.Internal.Types.IsValue a5, DBus.Internal.Types.IsValue a6, DBus.Internal.Types.IsValue a7, DBus.Internal.Types.IsValue a8, DBus.Internal.Types.IsValue a9, DBus.Internal.Types.IsValue a10, DBus.Internal.Types.IsValue a11, DBus.Internal.Types.IsValue a12, DBus.Internal.Types.IsValue a13, DBus.Internal.Types.IsValue a14, DBus.Internal.Types.IsValue a15) => DBus.Internal.Types.IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) instance DBus.Internal.Types.IsVariant () instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2) => DBus.Internal.Types.IsVariant (a1, a2) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3) => DBus.Internal.Types.IsVariant (a1, a2, a3) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9, DBus.Internal.Types.IsVariant a10) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9, DBus.Internal.Types.IsVariant a10, DBus.Internal.Types.IsVariant a11) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9, DBus.Internal.Types.IsVariant a10, DBus.Internal.Types.IsVariant a11, DBus.Internal.Types.IsVariant a12) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9, DBus.Internal.Types.IsVariant a10, DBus.Internal.Types.IsVariant a11, DBus.Internal.Types.IsVariant a12, DBus.Internal.Types.IsVariant a13) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9, DBus.Internal.Types.IsVariant a10, DBus.Internal.Types.IsVariant a11, DBus.Internal.Types.IsVariant a12, DBus.Internal.Types.IsVariant a13, DBus.Internal.Types.IsVariant a14) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) instance (DBus.Internal.Types.IsVariant a1, DBus.Internal.Types.IsVariant a2, DBus.Internal.Types.IsVariant a3, DBus.Internal.Types.IsVariant a4, DBus.Internal.Types.IsVariant a5, DBus.Internal.Types.IsVariant a6, DBus.Internal.Types.IsVariant a7, DBus.Internal.Types.IsVariant a8, DBus.Internal.Types.IsVariant a9, DBus.Internal.Types.IsVariant a10, DBus.Internal.Types.IsVariant a11, DBus.Internal.Types.IsVariant a12, DBus.Internal.Types.IsVariant a13, DBus.Internal.Types.IsVariant a14, DBus.Internal.Types.IsVariant a15) => DBus.Internal.Types.IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) instance GHC.Classes.Eq DBus.Internal.Types.Value instance GHC.Show.Show DBus.Internal.Types.Variant instance Data.String.IsString DBus.Internal.Types.ObjectPath instance GHC.Exception.Type.Exception DBus.Internal.Types.SigParseError instance GHC.Show.Show DBus.Internal.Types.Signature instance Data.String.IsString DBus.Internal.Types.Signature instance Control.DeepSeq.NFData DBus.Internal.Types.Type instance GHC.Show.Show DBus.Internal.Types.Type module DBus.Internal.Message class Message a messageTypeCode :: Message a => a -> Word8 messageHeaderFields :: Message a => a -> [HeaderField] messageBody :: Message a => a -> [Variant] messageFlags :: Message a => a -> Word8 data UnknownMessage UnknownMessage :: Word8 -> Maybe BusName -> [Variant] -> UnknownMessage [unknownMessageType] :: UnknownMessage -> Word8 [unknownMessageSender] :: UnknownMessage -> Maybe BusName [unknownMessageBody] :: UnknownMessage -> [Variant] -- | A method call is a request to run some procedure exported by the -- remote process. Procedures are identified by an (object_path, -- interface_name, method_name) tuple. data MethodCall MethodCall :: ObjectPath -> Maybe InterfaceName -> MemberName -> Maybe BusName -> Maybe BusName -> Bool -> Bool -> [Variant] -> MethodCall -- | The object path of the method call. Conceptually, object paths act -- like a procedural language's pointers. Each object referenced by a -- path is a collection of procedures. [methodCallPath] :: MethodCall -> ObjectPath -- | The interface of the method call. Each object may implement any number -- of interfaces. Each method is part of at least one interface. -- -- In certain cases, this may be Nothing, but most users should -- set it to a value. [methodCallInterface] :: MethodCall -> Maybe InterfaceName -- | The method name of the method call. Method names are unique within an -- interface, but might not be unique within an object. [methodCallMember] :: MethodCall -> MemberName -- | The name of the application that sent this call. -- -- Most users will just leave this empty, because the bus overwrites the -- sender for security reasons. Setting the sender manually is used for -- peer-peer connections. -- -- Defaults to Nothing. [methodCallSender] :: MethodCall -> Maybe BusName -- | The name of the application to send the call to. -- -- Most users should set this. If a message with no destination is sent -- to the bus, the bus will behave as if the destination was set to -- org.freedesktop.DBus. For peer-peer connections, the -- destination can be empty because there is only one peer. -- -- Defaults to Nothing. [methodCallDestination] :: MethodCall -> Maybe BusName -- | Set whether a reply is expected. This can save network and cpu -- resources by inhibiting unnecessary replies. -- -- Defaults to True. [methodCallReplyExpected] :: MethodCall -> Bool -- | Set whether the bus should auto-start the remote -- -- Defaults to True. [methodCallAutoStart] :: MethodCall -> Bool -- | The arguments to the method call. See toVariant. -- -- Defaults to []. [methodCallBody] :: MethodCall -> [Variant] -- | A method return is a reply to a method call, indicating that the call -- succeeded. data MethodReturn MethodReturn :: Serial -> Maybe BusName -> Maybe BusName -> [Variant] -> MethodReturn -- | The serial of the original method call. This lets the original caller -- match up this reply to the pending call. [methodReturnSerial] :: MethodReturn -> Serial -- | The name of the application that is returning from a call. -- -- Most users will just leave this empty, because the bus overwrites the -- sender for security reasons. Setting the sender manually is used for -- peer-peer connections. -- -- Defaults to Nothing. [methodReturnSender] :: MethodReturn -> Maybe BusName -- | The name of the application that initiated the call. -- -- Most users should set this. If a message with no destination is sent -- to the bus, the bus will behave as if the destination was set to -- org.freedesktop.DBus. For peer-peer connections, the -- destination can be empty because there is only one peer. -- -- Defaults to Nothing. [methodReturnDestination] :: MethodReturn -> Maybe BusName -- | Values returned from the method call. See toVariant. -- -- Defaults to []. [methodReturnBody] :: MethodReturn -> [Variant] -- | A method error is a reply to a method call, indicating that the call -- received an error and did not succeed. data MethodError MethodError :: ErrorName -> Serial -> Maybe BusName -> Maybe BusName -> [Variant] -> MethodError -- | The name of the error type. Names are used so clients can handle -- certain classes of error differently from others. [methodErrorName] :: MethodError -> ErrorName -- | The serial of the original method call. This lets the original caller -- match up this reply to the pending call. [methodErrorSerial] :: MethodError -> Serial -- | The name of the application that is returning from a call. -- -- Most users will just leave this empty, because the bus overwrites the -- sender for security reasons. Setting the sender manually is used for -- peer-peer connections. -- -- Defaults to Nothing. [methodErrorSender] :: MethodError -> Maybe BusName -- | The name of the application that initiated the call. -- -- Most users should set this. If a message with no destination is sent -- to the bus, the bus will behave as if the destination was set to -- org.freedesktop.DBus. For peer-peer connections, the -- destination can be empty because there is only one peer. -- -- Defaults to Nothing. [methodErrorDestination] :: MethodError -> Maybe BusName -- | Additional information about the error. By convention, if the error -- body contains any items, the first item should be a string describing -- the error. [methodErrorBody] :: MethodError -> [Variant] -- | Get a human-readable description of the error, by returning the first -- item in the error body if it's a string. methodErrorMessage :: MethodError -> String -- | Signals are broadcast by applications to notify other clients of some -- event. data Signal Signal :: ObjectPath -> InterfaceName -> MemberName -> Maybe BusName -> Maybe BusName -> [Variant] -> Signal -- | The path of the object that emitted this signal. [signalPath] :: Signal -> ObjectPath -- | The interface that this signal belongs to. [signalInterface] :: Signal -> InterfaceName -- | The name of this signal. [signalMember] :: Signal -> MemberName -- | The name of the application that emitted this signal. -- -- Most users will just leave this empty, because the bus overwrites the -- sender for security reasons. Setting the sender manually is used for -- peer-peer connections. -- -- Defaults to Nothing. [signalSender] :: Signal -> Maybe BusName -- | The name of the application to emit the signal to. If -- Nothing, the signal is sent to any application that has -- registered an appropriate match rule. -- -- Defaults to Nothing. [signalDestination] :: Signal -> Maybe BusName -- | Additional information about the signal, such as the new value or the -- time. -- -- Defaults to []. [signalBody] :: Signal -> [Variant] -- | Not an actual message type, but a wrapper around messages received -- from the bus. Each value contains the message's Serial. -- -- If casing against these constructors, always include a default case to -- handle messages of an unknown type. New message types may be added to -- the D-Bus specification, and applications should handle them -- gracefully by either ignoring or logging them. data ReceivedMessage ReceivedMethodCall :: Serial -> MethodCall -> ReceivedMessage ReceivedMethodReturn :: Serial -> MethodReturn -> ReceivedMessage ReceivedMethodError :: Serial -> MethodError -> ReceivedMessage ReceivedSignal :: Serial -> Signal -> ReceivedMessage ReceivedUnknown :: Serial -> UnknownMessage -> ReceivedMessage data HeaderField HeaderPath :: ObjectPath -> HeaderField HeaderInterface :: InterfaceName -> HeaderField HeaderMember :: MemberName -> HeaderField HeaderErrorName :: ErrorName -> HeaderField HeaderReplySerial :: Serial -> HeaderField HeaderDestination :: BusName -> HeaderField HeaderSender :: BusName -> HeaderField HeaderSignature :: Signature -> HeaderField HeaderUnixFds :: Word32 -> HeaderField setMethodCallFlags :: MethodCall -> Word8 -> MethodCall instance GHC.Classes.Eq DBus.Internal.Message.UnknownMessage instance GHC.Show.Show DBus.Internal.Message.UnknownMessage instance GHC.Classes.Eq DBus.Internal.Message.HeaderField instance GHC.Show.Show DBus.Internal.Message.HeaderField instance GHC.Show.Show DBus.Internal.Message.MethodCall instance GHC.Classes.Eq DBus.Internal.Message.MethodCall instance GHC.Classes.Eq DBus.Internal.Message.MethodReturn instance GHC.Show.Show DBus.Internal.Message.MethodReturn instance GHC.Classes.Eq DBus.Internal.Message.MethodError instance GHC.Show.Show DBus.Internal.Message.MethodError instance GHC.Classes.Eq DBus.Internal.Message.Signal instance GHC.Show.Show DBus.Internal.Message.Signal instance GHC.Classes.Eq DBus.Internal.Message.ReceivedMessage instance GHC.Show.Show DBus.Internal.Message.ReceivedMessage instance DBus.Internal.Message.Message DBus.Internal.Message.Signal instance DBus.Internal.Message.Message DBus.Internal.Message.MethodError instance DBus.Internal.Message.Message DBus.Internal.Message.MethodReturn instance DBus.Internal.Message.Message DBus.Internal.Message.MethodCall module DBus.Internal.Wire data Endianness LittleEndian :: Endianness BigEndian :: Endianness data MarshalError marshalErrorMessage :: MarshalError -> String data UnmarshalError unmarshalErrorMessage :: UnmarshalError -> String marshalMessage :: Message a => Endianness -> Serial -> a -> Either MarshalError (ByteString, [Fd]) unmarshalMessage :: ByteString -> [Fd] -> Either UnmarshalError ReceivedMessage unmarshalMessageM :: Monad m => (Int -> m (ByteString, [Fd])) -> m (Either UnmarshalError ReceivedMessage) instance GHC.Classes.Eq DBus.Internal.Wire.Endianness instance GHC.Show.Show DBus.Internal.Wire.Endianness instance GHC.Classes.Eq DBus.Internal.Wire.MarshalError instance GHC.Show.Show DBus.Internal.Wire.MarshalError instance GHC.Classes.Eq DBus.Internal.Wire.UnmarshalError instance GHC.Show.Show DBus.Internal.Wire.UnmarshalError instance GHC.Base.Monad m => GHC.Base.Functor (DBus.Internal.Wire.ErrorT e m) instance GHC.Base.Monad m => GHC.Base.Applicative (DBus.Internal.Wire.ErrorT e m) instance GHC.Base.Monad m => GHC.Base.Monad (DBus.Internal.Wire.ErrorT e m) instance GHC.Base.Functor (DBus.Internal.Wire.ErrorM e) instance GHC.Base.Applicative (DBus.Internal.Wire.ErrorM e) instance GHC.Base.Monad (DBus.Internal.Wire.ErrorM e) instance GHC.Base.Functor (DBus.Internal.Wire.Wire s) instance GHC.Base.Applicative (DBus.Internal.Wire.Wire s) instance GHC.Base.Monad (DBus.Internal.Wire.Wire s) -- | Basic types, useful to every D-Bus application. -- -- Authors of client applications should import DBus.Client, which -- provides an easy RPC-oriented interface to D-Bus methods and signals. module DBus class Message a -- | A method call is a request to run some procedure exported by the -- remote process. Procedures are identified by an (object_path, -- interface_name, method_name) tuple. data MethodCall -- | Construct a new MethodCall for the given object, interface, and -- method. -- -- Use fields such as methodCallDestination and -- methodCallBody to populate a MethodCall. -- --
-- {-# LANGUAGE OverloadedStrings #-}
--
-- methodCall "/" "org.example.Math" "Add"
-- { methodCallDestination = Just "org.example.Calculator"
-- , methodCallBody = [toVariant (1 :: Int32), toVariant (2 :: Int32)]
-- }
--
--
methodCall :: ObjectPath -> InterfaceName -> MemberName -> MethodCall
-- | The object path of the method call. Conceptually, object paths act
-- like a procedural language's pointers. Each object referenced by a
-- path is a collection of procedures.
methodCallPath :: MethodCall -> ObjectPath
-- | The interface of the method call. Each object may implement any number
-- of interfaces. Each method is part of at least one interface.
--
-- In certain cases, this may be Nothing, but most users should
-- set it to a value.
methodCallInterface :: MethodCall -> Maybe InterfaceName
-- | The method name of the method call. Method names are unique within an
-- interface, but might not be unique within an object.
methodCallMember :: MethodCall -> MemberName
-- | The name of the application that sent this call.
--
-- Most users will just leave this empty, because the bus overwrites the
-- sender for security reasons. Setting the sender manually is used for
-- peer-peer connections.
--
-- Defaults to Nothing.
methodCallSender :: MethodCall -> Maybe BusName
-- | The name of the application to send the call to.
--
-- Most users should set this. If a message with no destination is sent
-- to the bus, the bus will behave as if the destination was set to
-- org.freedesktop.DBus. For peer-peer connections, the
-- destination can be empty because there is only one peer.
--
-- Defaults to Nothing.
methodCallDestination :: MethodCall -> Maybe BusName
-- | Set whether the bus should auto-start the remote
--
-- Defaults to True.
methodCallAutoStart :: MethodCall -> Bool
-- | Set whether a reply is expected. This can save network and cpu
-- resources by inhibiting unnecessary replies.
--
-- Defaults to True.
methodCallReplyExpected :: MethodCall -> Bool
-- | The arguments to the method call. See toVariant.
--
-- Defaults to [].
methodCallBody :: MethodCall -> [Variant]
-- | A method return is a reply to a method call, indicating that the call
-- succeeded.
data MethodReturn
-- | Construct a new MethodReturn, in reply to a method call with
-- the given serial.
--
-- Use fields such as methodReturnBody to populate a
-- MethodReturn.
methodReturn :: Serial -> MethodReturn
-- | The serial of the original method call. This lets the original caller
-- match up this reply to the pending call.
methodReturnSerial :: MethodReturn -> Serial
-- | The name of the application that is returning from a call.
--
-- Most users will just leave this empty, because the bus overwrites the
-- sender for security reasons. Setting the sender manually is used for
-- peer-peer connections.
--
-- Defaults to Nothing.
methodReturnSender :: MethodReturn -> Maybe BusName
-- | The name of the application that initiated the call.
--
-- Most users should set this. If a message with no destination is sent
-- to the bus, the bus will behave as if the destination was set to
-- org.freedesktop.DBus. For peer-peer connections, the
-- destination can be empty because there is only one peer.
--
-- Defaults to Nothing.
methodReturnDestination :: MethodReturn -> Maybe BusName
-- | Values returned from the method call. See toVariant.
--
-- Defaults to [].
methodReturnBody :: MethodReturn -> [Variant]
-- | A method error is a reply to a method call, indicating that the call
-- received an error and did not succeed.
data MethodError
-- | Construct a new MethodError, in reply to a method call with the
-- given serial.
--
-- Use fields such as methodErrorBody to populate a
-- MethodError.
methodError :: Serial -> ErrorName -> MethodError
-- | The name of the error type. Names are used so clients can handle
-- certain classes of error differently from others.
methodErrorName :: MethodError -> ErrorName
-- | The serial of the original method call. This lets the original caller
-- match up this reply to the pending call.
methodErrorSerial :: MethodError -> Serial
-- | The name of the application that is returning from a call.
--
-- Most users will just leave this empty, because the bus overwrites the
-- sender for security reasons. Setting the sender manually is used for
-- peer-peer connections.
--
-- Defaults to Nothing.
methodErrorSender :: MethodError -> Maybe BusName
-- | The name of the application that initiated the call.
--
-- Most users should set this. If a message with no destination is sent
-- to the bus, the bus will behave as if the destination was set to
-- org.freedesktop.DBus. For peer-peer connections, the
-- destination can be empty because there is only one peer.
--
-- Defaults to Nothing.
methodErrorDestination :: MethodError -> Maybe BusName
-- | Additional information about the error. By convention, if the error
-- body contains any items, the first item should be a string describing
-- the error.
methodErrorBody :: MethodError -> [Variant]
-- | Get a human-readable description of the error, by returning the first
-- item in the error body if it's a string.
methodErrorMessage :: MethodError -> String
-- | Signals are broadcast by applications to notify other clients of some
-- event.
data Signal
-- | Construct a new Signal for the given object, interface, and
-- signal name.
--
-- Use fields such as signalBody to populate a Signal.
signal :: ObjectPath -> InterfaceName -> MemberName -> Signal
-- | The path of the object that emitted this signal.
signalPath :: Signal -> ObjectPath
-- | The name of this signal.
signalMember :: Signal -> MemberName
-- | The interface that this signal belongs to.
signalInterface :: Signal -> InterfaceName
-- | The name of the application that emitted this signal.
--
-- Most users will just leave this empty, because the bus overwrites the
-- sender for security reasons. Setting the sender manually is used for
-- peer-peer connections.
--
-- Defaults to Nothing.
signalSender :: Signal -> Maybe BusName
-- | The name of the application to emit the signal to. If
-- Nothing, the signal is sent to any application that has
-- registered an appropriate match rule.
--
-- Defaults to Nothing.
signalDestination :: Signal -> Maybe BusName
-- | Additional information about the signal, such as the new value or the
-- time.
--
-- Defaults to [].
signalBody :: Signal -> [Variant]
-- | Not an actual message type, but a wrapper around messages received
-- from the bus. Each value contains the message's Serial.
--
-- If casing against these constructors, always include a default case to
-- handle messages of an unknown type. New message types may be added to
-- the D-Bus specification, and applications should handle them
-- gracefully by either ignoring or logging them.
data ReceivedMessage
ReceivedMethodCall :: Serial -> MethodCall -> ReceivedMessage
ReceivedMethodReturn :: Serial -> MethodReturn -> ReceivedMessage
ReceivedMethodError :: Serial -> MethodError -> ReceivedMessage
ReceivedSignal :: Serial -> Signal -> ReceivedMessage
-- | No matter what sort of message was received, get its serial.
receivedMessageSerial :: ReceivedMessage -> Serial
-- | No matter what sort of message was received, get its sender (if
-- provided).
receivedMessageSender :: ReceivedMessage -> Maybe BusName
-- | No matter what sort of message was received, get its body (if
-- provided).
receivedMessageBody :: ReceivedMessage -> [Variant]
-- | Variants may contain any other built-in D-Bus value. Besides
-- representing native VARIANT values, they allow type-safe
-- storage and inspection of D-Bus collections.
data Variant
class IsVariant a
toVariant :: IsVariant a => a -> Variant
fromVariant :: IsVariant a => Variant -> Maybe a
-- | Every variant is strongly-typed; that is, the type of its contained
-- value is known at all times. This function retrieves that type, so
-- that the correct cast can be used to retrieve the value.
variantType :: Variant -> Type
-- | Atomic types can be used as keys to dictionaries.
--
-- Users may not provide new instances of IsAtom because this
-- could allow dictionaries to be created with invalid keys.
class IsValue a => IsAtom a
-- | Value types can be used as items in containers, such as lists or
-- dictionaries.
--
-- Users may not provide new instances of IsValue because this
-- could allow containers to be created with items of heterogenous types.
class IsVariant a => IsValue a
-- | Deprecated. Get the D-Bus type corresponding to the given Haskell
-- value. The value may be undefined.
typeOf :: IsValue a => a -> Type
-- | Get the D-Bus type corresponding to the given Haskell type a.
typeOf' :: IsValue a => Proxy a -> Type
-- | A signature is a list of D-Bus types, obeying some basic rules of
-- validity.
--
-- The rules of signature validity are complex: see
-- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures
-- for details.
data Signature
data Type
TypeBoolean :: Type
TypeWord8 :: Type
TypeWord16 :: Type
TypeWord32 :: Type
TypeWord64 :: Type
TypeInt16 :: Type
TypeInt32 :: Type
TypeInt64 :: Type
TypeDouble :: Type
TypeUnixFd :: Type
TypeString :: Type
TypeSignature :: Type
TypeObjectPath :: Type
TypeVariant :: Type
TypeArray :: Type -> Type
TypeDictionary :: Type -> Type -> Type
TypeStructure :: [Type] -> Type
-- | Convert a list of types into a valid signature.
--
-- Throws if the given types are not a valid signature.
signature :: MonadThrow m => [Type] -> m Signature
-- | Convert a list of types into a valid signature.
--
-- Throws an exception if the given types are not a valid signature.
signature_ :: [Type] -> Signature
-- | Get the list of types in a signature. The inverse of signature.
signatureTypes :: Signature -> [Type]
-- | Convert a signature into a signature string. The inverse of
-- parseSignature.
formatSignature :: Signature -> String
-- | Parse a signature string into a valid signature.
--
-- Throws if the given string is not a valid signature.
parseSignature :: MonadThrow m => String -> m Signature
-- | Object paths are special strings, used to identify a particular object
-- exported from a D-Bus application.
--
-- Object paths must begin with a slash, and consist of alphanumeric
-- characters separated by slashes.
--
-- See
-- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path
-- for details.
data ObjectPath
objectPath_ :: String -> ObjectPath
formatObjectPath :: ObjectPath -> String
parseObjectPath :: MonadThrow m => String -> m ObjectPath
-- | Interfaces are used to group a set of methods and signals within an
-- exported object. Interface names consist of alphanumeric characters
-- separated by periods.
--
-- See
-- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface
-- for details.
data InterfaceName
interfaceName_ :: String -> InterfaceName
formatInterfaceName :: InterfaceName -> String
parseInterfaceName :: MonadThrow m => String -> m InterfaceName
-- | Member names are used to identify a single method or signal within an
-- interface. Method names consist of alphanumeric characters.
--
-- See
-- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-member
-- for details.
data MemberName
memberName_ :: String -> MemberName
formatMemberName :: MemberName -> String
parseMemberName :: MonadThrow m => String -> m MemberName
-- | Error names are used to identify which type of error was returned from
-- a method call. Error names consist of alphanumeric characters
-- separated by periods.
--
-- See
-- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-error
-- for details.
data ErrorName
errorName_ :: String -> ErrorName
formatErrorName :: ErrorName -> String
parseErrorName :: MonadThrow m => String -> m ErrorName
-- | Bus names are used to identify particular clients on the message bus.
-- A bus name may be either unique or well-known, where
-- unique names start with a colon. Bus names consist of alphanumeric
-- characters separated by periods.
--
-- See
-- http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus
-- for details.
data BusName
busName_ :: String -> BusName
formatBusName :: BusName -> String
parseBusName :: MonadThrow m => String -> m BusName
-- | A D-Bus Structure is a container type similar to Haskell tuples,
-- storing values of any type that is convertable to IsVariant. A
-- Structure may contain up to 255 values.
--
-- Most users can use the IsVariant instance for tuples to extract
-- the values of a structure. This type is for very large structures,
-- which may be awkward to work with as tuples.
data Structure
structureItems :: Structure -> [Variant]
-- | A D-Bus Array is a container type similar to Haskell lists, storing
-- zero or more values of a single D-Bus type.
--
-- Most users can use the IsVariant instance for lists or vectors
-- to extract the values of an array. This type is for advanced use
-- cases, where the user wants to convert array values to Haskell types
-- that are not instances of IsValue.
data Array
arrayItems :: Array -> [Variant]
-- | A D-Bus Dictionary is a container type similar to Haskell maps,
-- storing zero or more associations between keys and values.
--
-- Most users can use the IsVariant instance for maps to extract
-- the values of a dictionary. This type is for advanced use cases, where
-- the user wants to convert dictionary items to Haskell types that are
-- not instances of IsValue.
data Dictionary
dictionaryItems :: Dictionary -> [(Variant, Variant)]
-- | When a D-Bus server must listen for connections, or a client must
-- connect to a server, the listening socket's configuration is specified
-- with an address. An address contains the method, which
-- determines the protocol and transport mechanism, and
-- parameters, which provide additional method-specific
-- information about the address.
data Address
addressMethod :: Address -> String
addressParameters :: Address -> Map String String
-- | Try to convert a method string and parameter map to an Address.
--
-- Returns Nothing if the method or parameters are invalid.
address :: String -> Map String String -> Maybe Address
-- | Convert an address to a string in the format expected by
-- parseAddress.
formatAddress :: Address -> String
-- | Convert a list of addresses to a string in the format expected by
-- parseAddresses.
formatAddresses :: [Address] -> String
-- | Try to parse a string containing one valid address.
--
-- An address string is in the format
-- method:key1=val1,key2=val2. There are some limitations on the
-- characters allowed within methods and parameters; see the D-Bus
-- specification for full details.
parseAddress :: String -> Maybe Address
-- | Try to parse a string containing one or more valid addresses.
--
-- Addresses are separated by semicolons. See parseAddress for the
-- format of addresses.
parseAddresses :: String -> Maybe [Address]
-- | Returns the address in the environment variable
-- DBUS_SYSTEM_BUS_ADDRESS, or
-- unix:path=/var/run/dbus/system_bus_socket if
-- DBUS_SYSTEM_BUS_ADDRESS is not set.
--
-- Returns Nothing if DBUS_SYSTEM_BUS_ADDRESS contains an
-- invalid address.
getSystemAddress :: IO (Maybe Address)
-- | Returns the first address in the environment variable
-- DBUS_SESSION_BUS_ADDRESS, which must be set.
--
-- Returns Nothing if DBUS_SYSTEM_BUS_ADDRESS contains an
-- invalid address or DBUS_SESSION_BUS_ADDRESS is unset
-- XDG_RUNTIME_DIR doesn't have /bus.
getSessionAddress :: IO (Maybe Address)
-- | Returns the address in the environment variable
-- DBUS_STARTER_ADDRESS, which must be set.
--
-- Returns Nothing if DBUS_STARTER_ADDRESS is unset or
-- contains an invalid address.
getStarterAddress :: IO (Maybe Address)
data Endianness
LittleEndian :: Endianness
BigEndian :: Endianness
-- | Convert a Message into a ByteString. Although unusual,
-- it is possible for marshaling to fail; if this occurs, an error will
-- be returned instead.
marshal :: Message msg => Endianness -> Serial -> msg -> Either MarshalError ByteString
-- | Convert a Message into a ByteString along with all
-- Fd values mentioned in the message (the marshaled bytes will
-- contain indices into this list). Although unusual, it is possible for
-- marshaling to fail; if this occurs, an error will be returned instead.
marshalWithFds :: Message msg => Endianness -> Serial -> msg -> Either MarshalError (ByteString, [Fd])
data MarshalError
marshalErrorMessage :: MarshalError -> String
-- | Parse a ByteString into a ReceivedMessage. The result
-- can be inspected to see what type of message was parsed. Unknown
-- message types can still be parsed successfully, as long as they
-- otherwise conform to the D-Bus standard.
--
-- Unmarshaling will fail if the message contains file descriptors. If
-- you need file descriptor support then use unmarshalWithFds
-- instead.
unmarshal :: ByteString -> Either UnmarshalError ReceivedMessage
-- | Parse a ByteString into a ReceivedMessage. The Fd
-- values are needed because the marshaled message contains indices into
-- the Fd list rather then Fd values directly. The result
-- can be inspected to see what type of message was parsed. Unknown
-- message types can still be parsed successfully, as long as they
-- otherwise conform to the D-Bus standard.
unmarshalWithFds :: ByteString -> [Fd] -> Either UnmarshalError ReceivedMessage
data UnmarshalError
unmarshalErrorMessage :: UnmarshalError -> String
-- | A value used to uniquely identify a particular message within a
-- session. Serials are 32-bit unsigned integers, and eventually wrap.
data Serial
serialValue :: Serial -> Word32
-- | Get the first serial in the sequence.
firstSerial :: Serial
-- | Get the next serial in the sequence. This may wrap around to
-- firstSerial.
nextSerial :: Serial -> Serial
-- | A D-Bus UUID is 128 bits of data, usually randomly generated. They are
-- used for identifying unique server instances to clients.
--
-- Older versions of the D-Bus spec also called these values
-- GUIDs.
--
-- D-Bus UUIDs are not the same as the RFC-standardized UUIDs or GUIDs.
data UUID
-- | Format a D-Bus UUID as hex-encoded ASCII.
formatUUID :: UUID -> String
-- | Generate a random D-Bus UUID. This value is suitable for use in a
-- randomly-allocated address, or as a listener's socket address
-- "guid" parameter.
randomUUID :: IO UUID
instance GHC.Show.Show DBus.UUID
instance GHC.Classes.Ord DBus.UUID
instance GHC.Classes.Eq DBus.UUID
module DBus.Introspection.Types
data Object
Object :: ObjectPath -> [Interface] -> [Object] -> Object
[objectPath] :: Object -> ObjectPath
[objectInterfaces] :: Object -> [Interface]
[objectChildren] :: Object -> [Object]
data Interface
Interface :: InterfaceName -> [Method] -> [Signal] -> [Property] -> Interface
[interfaceName] :: Interface -> InterfaceName
[interfaceMethods] :: Interface -> [Method]
[interfaceSignals] :: Interface -> [Signal]
[interfaceProperties] :: Interface -> [Property]
data Method
Method :: MemberName -> [MethodArg] -> Method
[methodName] :: Method -> MemberName
[methodArgs] :: Method -> [MethodArg]
data MethodArg
MethodArg :: String -> Type -> Direction -> MethodArg
[methodArgName] :: MethodArg -> String
[methodArgType] :: MethodArg -> Type
[methodArgDirection] :: MethodArg -> Direction
data Direction
In :: Direction
Out :: Direction
data Signal
Signal :: MemberName -> [SignalArg] -> Signal
[signalName] :: Signal -> MemberName
[signalArgs] :: Signal -> [SignalArg]
data SignalArg
SignalArg :: String -> Type -> SignalArg
[signalArgName] :: SignalArg -> String
[signalArgType] :: SignalArg -> Type
data Property
Property :: String -> Type -> Bool -> Bool -> Property
[propertyName] :: Property -> String
[propertyType] :: Property -> Type
[propertyRead] :: Property -> Bool
[propertyWrite] :: Property -> Bool
instance GHC.Classes.Eq DBus.Introspection.Types.Direction
instance GHC.Show.Show DBus.Introspection.Types.Direction
instance GHC.Classes.Eq DBus.Introspection.Types.MethodArg
instance GHC.Show.Show DBus.Introspection.Types.MethodArg
instance GHC.Classes.Eq DBus.Introspection.Types.Method
instance GHC.Show.Show DBus.Introspection.Types.Method
instance GHC.Classes.Eq DBus.Introspection.Types.SignalArg
instance GHC.Show.Show DBus.Introspection.Types.SignalArg
instance GHC.Classes.Eq DBus.Introspection.Types.Signal
instance GHC.Show.Show DBus.Introspection.Types.Signal
instance GHC.Classes.Eq DBus.Introspection.Types.Property
instance GHC.Show.Show DBus.Introspection.Types.Property
instance GHC.Classes.Eq DBus.Introspection.Types.Interface
instance GHC.Show.Show DBus.Introspection.Types.Interface
instance GHC.Classes.Eq DBus.Introspection.Types.Object
instance GHC.Show.Show DBus.Introspection.Types.Object
module DBus.Introspection.Render
formatXML :: Object -> Maybe String
instance GHC.Base.Functor (DBus.Introspection.Render.Render s)
instance GHC.Base.Applicative (DBus.Introspection.Render.Render s)
instance GHC.Base.Monad (DBus.Introspection.Render.Render s)
instance Control.Monad.Catch.MonadThrow (DBus.Introspection.Render.Render s)
instance Control.Monad.Primitive.PrimMonad (DBus.Introspection.Render.Render s)
module DBus.Introspection.Parse
parseXML :: ObjectPath -> Text -> Maybe Object
module DBus.Introspection
-- | Support for defining custom transport mechanisms. Most users will not
-- need to care about the types defined in this module.
module DBus.Transport
-- | A Transport can exchange bytes with a remote peer.
class Transport t where {
-- | Additional options that this transport type may use when establishing
-- a connection.
data TransportOptions t :: Type;
}
-- | Default values for this transport's options.
transportDefaultOptions :: Transport t => TransportOptions t
-- | Send a ByteString over the transport.
--
-- Throws a TransportError if an error occurs.
transportPut :: Transport t => t -> ByteString -> IO ()
-- | Send a ByteString and Unix file descriptors over the transport.
--
-- Throws a TransportError if an error occurs.
transportPutWithFds :: Transport t => t -> ByteString -> [Fd] -> IO ()
-- | 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.
transportGet :: Transport t => t -> Int -> IO ByteString
-- | Receive a ByteString of the given size from the transport, plus
-- any Unix file descriptors that arrive with the byte data. 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.
transportGetWithFds :: Transport t => t -> Int -> IO (ByteString, [Fd])
-- | Close an open transport, and release any associated resources or
-- handles.
transportClose :: Transport t => t -> IO ()
-- | A Transport which can open a connection to a remote peer.
class Transport t => TransportOpen t
-- | Open a connection to the given address, using the given options.
--
-- Throws a TransportError if the connection could not be
-- established.
transportOpen :: TransportOpen t => TransportOptions t -> Address -> IO t
-- | A Transport which can listen for and accept connections from
-- remote peers.
class Transport t => TransportListen t where {
-- | Used for transports that listen on a port or address.
data TransportListener t :: Type;
}
-- | 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).
transportListen :: TransportListen t => TransportOptions t -> Address -> IO (TransportListener t)
-- | Accept a new connection.
--
-- Throws a TransportError if some error happens before the
-- transport is ready to exchange bytes.
transportAccept :: TransportListen t => TransportListener t -> IO t
-- | Close an open listener.
transportListenerClose :: TransportListen t => TransportListener t -> IO ()
-- | Get the address to use to connect to a listener.
transportListenerAddress :: TransportListen t => TransportListener t -> Address
-- | Get the UUID allocated to this transport listener.
--
-- See randomUUID.
transportListenerUUID :: TransportListen t => TransportListener t -> UUID
-- | Thrown from transport methods when an error occurs.
data TransportError
transportError :: String -> TransportError
transportErrorMessage :: TransportError -> String
transportErrorAddress :: TransportError -> Maybe Address
-- | 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.
data SocketTransport
-- | Returns the processID, userID, and groupID of the socket's peer.
--
-- See getPeerCredential.
socketTransportCredentials :: SocketTransport -> IO (Maybe CUInt, Maybe CUInt, Maybe CUInt)
instance GHC.Show.Show DBus.Transport.TransportError
instance GHC.Classes.Eq DBus.Transport.TransportError
instance Network.Socket.Types.SocketAddress DBus.Transport.NullSockAddr
instance DBus.Transport.Transport DBus.Transport.SocketTransport
instance DBus.Transport.TransportOpen DBus.Transport.SocketTransport
instance DBus.Transport.TransportListen DBus.Transport.SocketTransport
instance GHC.Exception.Type.Exception DBus.Transport.TransportError
-- | D-Bus sockets are used for communication between two peers. In this
-- model, there is no "bus" or "client", simply two endpoints sending
-- messages.
--
-- Most users will want to use the DBus.Client module instead.
module DBus.Socket
-- | An open socket to another process. Messages can be sent to the remote
-- peer using send, or received using receive.
data Socket
-- | 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.
--
-- Sockets are thread-safe. Only one message may be sent at a time; if
-- multiple threads attempt to send messages concurrently, one will block
-- until after the other has finished.
--
-- Throws SocketError on failure.
send :: Message msg => Socket -> msg -> (Serial -> IO a) -> IO a
-- | Receive the next message from the socket , blocking until one is
-- available.
--
-- Sockets are thread-safe. Only one message may be received at a time;
-- if multiple threads attempt to receive messages concurrently, one will
-- block until after the other has finished.
--
-- Throws SocketError on failure.
receive :: Socket -> IO ReceivedMessage
-- | Stores information about an error encountered while creating or using
-- a Socket.
data SocketError
socketError :: String -> SocketError
socketErrorMessage :: SocketError -> String
socketErrorFatal :: SocketError -> Bool
socketErrorAddress :: SocketError -> Maybe Address
-- | Used with openWith and listenWith to provide custom
-- authenticators or transport options.
data SocketOptions t
-- | Used to perform authentication with the remote peer. After a transport
-- has been opened, it will be passed to the authenticator. If the
-- authenticator returns true, then the socket was authenticated.
socketAuthenticator :: SocketOptions t -> Authenticator t
-- | Options for the underlying transport, to be used by custom transports
-- for controlling how to connect to the remote peer.
--
-- See DBus.Transport for details on defining custom transports
socketTransportOptions :: SocketOptions t -> TransportOptions t
-- | Default SocketOptions, which uses the default Unix/TCP
-- transport and authenticator (without support for Unix file descriptor
-- passing).
defaultSocketOptions :: SocketOptions SocketTransport
-- | Open a socket to a remote peer listening at the given address.
--
-- -- open = openWith defaultSocketOptions -- ---- -- Throws SocketError on failure. open :: Address -> IO Socket -- | Open a socket to a remote peer listening at the given address. -- -- Most users should use open. This function is for users who need -- to define custom authenticators or transports. -- -- Throws SocketError on failure. openWith :: TransportOpen t => SocketOptions t -> Address -> IO Socket -- | Close an open Socket. Once closed, the socket is no longer -- valid and must not be used. close :: Socket -> IO () data SocketListener -- | Begin listening at the given address. -- -- Use accept to create sockets from incoming connections. -- -- Use closeListener to stop listening, and to free underlying -- transport resources such as file descriptors. -- -- Throws SocketError on failure. listen :: Address -> IO SocketListener -- | Begin listening at the given address. -- -- Use accept to create sockets from incoming connections. -- -- Use closeListener to stop listening, and to free underlying -- transport resources such as file descriptors. -- -- This function is for users who need to define custom authenticators or -- transports. -- -- Throws SocketError on failure. listenWith :: TransportListen t => SocketOptions t -> Address -> IO SocketListener -- | Accept a new connection from a socket listener. -- -- Throws SocketError on failure. accept :: SocketListener -> IO Socket -- | Close an open SocketListener. Once closed, the listener is no -- longer valid and must not be used. closeListener :: SocketListener -> IO () -- | Get the address to use to connect to a listener. socketListenerAddress :: SocketListener -> Address -- | An Authenticator defines how the local peer (client) authenticates -- itself to the remote peer (server). data Authenticator t -- | An empty authenticator. Use authenticatorClient or -- authenticatorServer to control how the authentication is -- performed. -- --
-- myAuthenticator :: Authenticator MyTransport
-- myAuthenticator = authenticator
-- { authenticatorClient = clientMyAuth
-- , authenticatorServer = serverMyAuth
-- }
--
-- clientMyAuth :: MyTransport -> IO Bool
-- serverMyAuth :: MyTransport -> String -> IO Bool
--
--
authenticator :: Authenticator t
-- | An authenticator that implements the D-Bus EXTERNAL
-- mechanism, which uses credential passing over a Unix socket, with
-- support for Unix file descriptor passing.
authenticatorWithUnixFds :: Authenticator SocketTransport
-- | Defines the client-side half of an authenticator.
authenticatorClient :: Authenticator t -> t -> IO Bool
-- | Defines the server-side half of an authenticator. The UUID is
-- allocated by the socket listener.
authenticatorServer :: Authenticator t -> t -> UUID -> IO Bool
instance GHC.Show.Show DBus.Socket.SocketError
instance GHC.Classes.Eq DBus.Socket.SocketError
instance DBus.Transport.Transport DBus.Socket.SomeTransport
instance GHC.Exception.Type.Exception DBus.Socket.SocketError
-- | D-Bus clients are an abstraction over the lower-level messaging
-- system. When combined with an external daemon called the "bus",
-- clients can perform remote procedure calls to other clients on the
-- bus.
--
-- Clients may also listen for or emit signals, which are
-- asynchronous broadcast notifications.
--
-- Example: connect to the session bus, and get a list of active names.
--
--
-- {-# LANGUAGE OverloadedStrings #-}
--
-- import Data.List (sort)
-- import DBus
-- import DBus.Client
--
-- main = do
-- client <- connectSession
-- //
-- -- Request a list of connected clients from the bus
-- reply <- call_ client (methodCall "/org/freedesktop/DBus" "org.freedesktop.DBus" "ListNames")
-- { methodCallDestination = Just "org.freedesktop.DBus"
-- }
-- //
-- -- org.freedesktop.DBus.ListNames() returns a single value, which is
-- -- a list of names (here represented as [String])
-- let Just names = fromVariant (methodReturnBody reply !! 0)
-- //
-- -- Print each name on a line, sorted so reserved names are below
-- -- temporary names.
-- mapM_ putStrLn (sort names)
--
--
module DBus.Client
-- | An active client session to a message bus. Clients may send or receive
-- method calls, and listen for or emit signals.
data Client
Client :: Socket -> IORef (Map Serial (MVar (Either MethodError MethodReturn))) -> IORef (Map Unique SignalHandler) -> IORef PathInfo -> ThreadId -> [Interface] -> Client
[clientSocket] :: Client -> Socket
[clientPendingCalls] :: Client -> IORef (Map Serial (MVar (Either MethodError MethodReturn)))
[clientSignalHandlers] :: Client -> IORef (Map Unique SignalHandler)
[clientObjects] :: Client -> IORef PathInfo
[clientThreadID] :: Client -> ThreadId
[clientInterfaces] :: Client -> [Interface]
type DBusR a = ReaderT Client IO a
data PathInfo
PathInfo :: [Interface] -> Map String PathInfo -> PathInfo
[_pathInterfaces] :: PathInfo -> [Interface]
[_pathChildren] :: PathInfo -> Map String PathInfo
pathInterfaces :: Lens' PathInfo [Interface]
pathChildren :: Lens' PathInfo (Map String PathInfo)
pathLens :: Applicative f => ObjectPath -> ((PathInfo -> f PathInfo) -> Maybe PathInfo -> f (Maybe PathInfo)) -> (PathInfo -> f PathInfo) -> PathInfo -> f PathInfo
findPath :: ObjectPath -> PathInfo -> Maybe PathInfo
data Interface
Interface :: InterfaceName -> [Method] -> [Property] -> [Signal] -> Interface
[interfaceName] :: Interface -> InterfaceName
[interfaceMethods] :: Interface -> [Method]
[interfaceProperties] :: Interface -> [Property]
[interfaceSignals] :: Interface -> [Signal]
defaultInterface :: Interface
-- | Connect to the bus at the specified address.
--
-- Throws a ClientError on failure.
connect :: Address -> IO Client
-- | Connect to the bus specified in the environment variable
-- DBUS_SYSTEM_BUS_ADDRESS, or to
-- unix:path=/var/run/dbus/system_bus_socket if
-- DBUS_SYSTEM_BUS_ADDRESS is not set.
--
-- Throws a ClientError if DBUS_SYSTEM_BUS_ADDRESS
-- contains an invalid address, or if connecting to the bus failed.
connectSystem :: IO Client
-- | Connect to the bus specified in the environment variable
-- DBUS_SESSION_BUS_ADDRESS, which must be set.
--
-- Throws a ClientError if DBUS_SESSION_BUS_ADDRESS is
-- unset, contains an invalid address, or if connecting to the bus
-- failed.
connectSession :: IO Client
-- | Connect to the bus specified in the environment variable
-- DBUS_STARTER_ADDRESS, which must be set.
--
-- Throws a ClientError if DBUS_STARTER_ADDRESS is unset,
-- contains an invalid address, or if connecting to the bus failed.
connectStarter :: IO Client
-- | Stop a Client's callback thread and close its underlying
-- socket.
disconnect :: Client -> IO ()
-- | Send a method call to the bus, and wait for the response.
--
-- Throws a ClientError if the method call couldn't be sent, or if
-- the reply couldn't be parsed.
call :: Client -> MethodCall -> IO (Either MethodError MethodReturn)
-- | Send a method call to the bus, and wait for the response.
--
-- Unsets the noReplyExpected message flag before sending.
--
-- Throws a ClientError if the method call couldn't sent, if the
-- reply couldn't be parsed, or if the reply was a MethodError.
call_ :: Client -> MethodCall -> IO MethodReturn
-- | Send a method call to the bus, and do not wait for a response.
--
-- Sets the noReplyExpected message flag before sending.
--
-- Throws a ClientError if the method call couldn't be sent.
callNoReply :: Client -> MethodCall -> IO ()
-- | Retrieve a property using the method call parameters that were
-- provided.
--
-- Throws a ClientError if the property request couldn't be sent.
getProperty :: Client -> MethodCall -> IO (Either MethodError Variant)
getPropertyValue :: IsValue a => Client -> MethodCall -> IO (Either MethodError a)
setProperty :: Client -> MethodCall -> Variant -> IO (Either MethodError MethodReturn)
setPropertyValue :: IsValue a => Client -> MethodCall -> a -> IO (Maybe MethodError)
getAllProperties :: Client -> MethodCall -> IO (Either MethodError MethodReturn)
getAllPropertiesMap :: Client -> MethodCall -> IO (Either MethodError (Map String Variant))
buildPropertiesInterface :: Client -> Interface
-- | Export the given Interface at the given ObjectPath
--
-- Use autoMethod to construct a Method from a function
-- that accepts and returns simple types.
--
-- Use method to construct a Method from a function that
-- handles parameter conversion manually.
--
--
-- ping :: MethodCall -> IO Reply
-- ping _ = ReplyReturn []
--
-- sayHello :: String -> IO String
-- sayHello name = return ("Hello " ++ name ++ "!")
--
-- export client "/hello_world"
-- defaultInterface { interfaceName = "com.example.HelloWorld"
-- , interfaceMethods =
-- [ method "com.example.HelloWorld" "Ping" ping
-- , autoMethod "com.example.HelloWorld" "Hello" sayHello
-- ]
-- }
--
--
export :: Client -> ObjectPath -> Interface -> IO ()
-- | Revokes the export of the given ObjectPath. This will remove
-- all interfaces and methods associated with the path.
unexport :: Client -> ObjectPath -> IO ()
data Method
Method :: MemberName -> Signature -> Signature -> (MethodCall -> DBusR Reply) -> Method
[methodName] :: Method -> MemberName
[inSignature] :: Method -> Signature
[outSignature] :: Method -> Signature
[methodHandler] :: Method -> MethodCall -> DBusR Reply
-- | Define a method handler, which will accept method calls with the given
-- interface and member name.
--
-- Note that the input and output parameter signatures are used for
-- introspection, but are not checked when executing a method.
--
-- See autoMethod for an easier way to export functions with
-- simple parameter and return types.
makeMethod :: MemberName -> Signature -> Signature -> (MethodCall -> DBusR Reply) -> Method
-- | Used to automatically generate method signatures for introspection
-- documents. To support automatic signatures, a method's parameters and
-- return value must all be instances of IsValue.
--
-- This class maps Haskell idioms to D-Bus; it is therefore unable to
-- generate some signatures. In particular, it does not support methods
-- which accept/return a single structure, or single-element structures.
-- It also cannot generate signatures for methods with parameters or
-- return values which are only instances of IsVariant. For these
-- cases, please use method.
--
-- To match common Haskell use, if the return value is a tuple, it will
-- be converted to a list of return values.
class AutoMethod a
-- | Prepare a Haskell function for export, automatically detecting the
-- function's type signature.
--
-- See AutoMethod for details on the limitations of this function.
--
-- See method for exporting functions with user-defined types.
autoMethod :: AutoMethod fn => MemberName -> fn -> Method
autoMethodWithMsg :: AutoMethod fn => MemberName -> (MethodCall -> fn) -> Method
data Property
Property :: MemberName -> Type -> Maybe (IO Variant) -> Maybe (Variant -> IO ()) -> Property
[propertyName] :: Property -> MemberName
[propertyType] :: Property -> Type
[propertyGetter] :: Property -> Maybe (IO Variant)
[propertySetter] :: Property -> Maybe (Variant -> IO ())
autoProperty :: forall v. IsValue v => MemberName -> Maybe (IO v) -> Maybe (v -> IO ()) -> Property
readOnlyProperty :: IsValue v => MemberName -> IO v -> Property
data Reply
ReplyReturn :: [Variant] -> Reply
ReplyError :: ErrorName -> [Variant] -> Reply
-- | Normally, any exceptions raised while executing a method will be given
-- the generic "org.freedesktop.DBus.Error.Failed" name.
-- throwError allows the programmer to specify an error name, and
-- provide additional information to the remote application. You may use
-- this instead of throwIO to abort a method call.
throwError :: ErrorName -> String -> [Variant] -> IO a
data SignalHandler
-- | Request that the bus forward signals matching the given rule to this
-- client, and process them in a callback.
--
-- A received signal might be processed by more than one callback at a
-- time. Callbacks each run in their own thread.
--
-- The returned SignalHandler can be passed to removeMatch
-- to stop handling this signal.
--
-- Throws a ClientError if the match rule couldn't be added to the
-- bus.
addMatch :: Client -> MatchRule -> (Signal -> IO ()) -> IO SignalHandler
-- | Request that the bus stop forwarding signals for the given handler.
--
-- Throws a ClientError if the match rule couldn't be removed from
-- the bus.
removeMatch :: Client -> SignalHandler -> IO ()
-- | Emit the signal on the bus.
--
-- Throws a ClientError if the signal message couldn't be sent.
emit :: Client -> Signal -> IO ()
-- | Equivalent to addMatch, but does not return the added
-- SignalHandler.
-- | Deprecated: Prefer DBus.Client.addMatch in new code.
listen :: Client -> MatchRule -> (Signal -> IO ()) -> IO ()
-- | A match rule describes which signals a particular callback is
-- interested in. Use matchAny to construct match rules.
--
-- Example: a match rule which matches signals sent by the root object.
--
--
-- matchFromRoot :: MatchRule
-- matchFromRoot = matchAny { matchPath = Just "/" }
--
--
data MatchRule
-- | Convert a match rule into the textual format accepted by the bus.
formatMatchRule :: MatchRule -> String
-- | Match any signal.
matchAny :: MatchRule
-- | If set, only receives signals sent from the given bus name.
--
-- The standard D-Bus implementation from
-- http://dbus.freedesktop.org/ almost always sets signal senders
-- to the unique name of the sending client. If matchSender is a
-- requested name like "com.example.Foo", it will not match any
-- signals.
--
-- The exception is for signals sent by the bus itself, which always have
-- a sender of "org.freedesktop.DBus".
matchSender :: MatchRule -> Maybe BusName
-- | If set, only receives signals sent to the given bus name.
matchDestination :: MatchRule -> Maybe BusName
-- | If set, only receives signals sent with the given path.
matchPath :: MatchRule -> Maybe ObjectPath
-- | If set, only receives signals sent with the given interface name.
matchInterface :: MatchRule -> Maybe InterfaceName
-- | If set, only receives signals sent with the given member name.
matchMember :: MatchRule -> Maybe MemberName
-- | If set, only receives signals sent with the given path or any of its
-- children.
matchPathNamespace :: MatchRule -> Maybe ObjectPath
buildIntrospectionObject :: [Interface] -> PathInfo -> [String] -> Object
buildIntrospectionInterface :: Interface -> Interface
buildIntrospectionMethod :: Method -> Method
buildIntrospectionProperty :: Property -> Property
buildIntrospectableInterface :: Client -> Interface
-- | Asks the message bus to assign the given name to this client. The bus
-- maintains a queue of possible owners, where the head of the queue is
-- the current ("primary") owner.
--
-- There are several uses for name reservation:
--
--