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

Safe Haskell | Safe-Inferred
Language | Haskell2010

DBus.Internal.Address

Synopsis

- data Address = Address String (Map String String)
- addressMethod :: Address -> String
- addressParameters :: Address -> Map String String
- address :: String -> Map String String -> Maybe Address
- validMethod :: String -> Bool
- validParams :: Map String String -> Bool
- optionallyEncoded :: [Char]
- formatAddress :: Address -> String
- formatAddresses :: [Address] -> String
- parseAddress :: String -> Maybe Address
- parseAddresses :: String -> Maybe [Address]
- parsecAddress :: Parser Address
- getSystemAddress :: IO (Maybe Address)
- getSessionAddress :: IO (Maybe Address)
- getStarterAddress :: IO (Maybe Address)
- hexToInt :: String -> Int
- maybeParseString :: Parser a -> String -> Maybe a

# Documentation

data Address Source #

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.

Constructors

Address String (Map String String) |

#### Instances

Instances details

Show Address Source # |
Instance details Defined in DBus.Internal.Address Methods showsPrec :: Int -> Address -> ShowS Source # show :: Address -> String Source # showList :: [Address] -> ShowS Source #
Eq Address Source # |
Instance details Defined in DBus.Internal.Address Methods (==) :: Address -> Address -> Bool Source # (/=) :: Address -> Address -> Bool Source #

addressMethod :: Address -> String Source #

addressParameters :: Address -> Map String String Source #

address :: String -> Map String String -> Maybe Address Source #

Try to convert a method string and parameter map to an `Address`.

Returns `Nothing` if the method or parameters are invalid.

validMethod :: String -> Bool Source #

validParams :: Map String String -> Bool Source #

optionallyEncoded :: [Char] Source #

formatAddress :: Address -> String Source #

Convert an address to a string in the format expected by `parseAddress`.

formatAddresses :: [Address] -> String Source #

Convert a list of addresses to a string in the format expected by `parseAddresses`.

parseAddress :: String -> Maybe Address Source #

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.

parseAddresses :: String -> Maybe [Address] Source #

Try to parse a string containing one or more valid addresses.

Addresses are separated by semicolons. See `parseAddress` for the format of addresses.

parsecAddress :: Parser Address Source #

getSystemAddress :: IO (Maybe Address) Source #

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.

getSessionAddress :: IO (Maybe Address) Source #

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`.

getStarterAddress :: IO (Maybe Address) Source #

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.

hexToInt :: String -> Int Source #

maybeParseString :: Parser a -> String -> Maybe a Source #