dbus-1.3.11: 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 #

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

addressMethod :: Address -> String #

addressParameters :: Address -> Map String String #

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

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

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

validMethod :: String -> Bool #

validParams :: Map String String -> Bool #

optionallyEncoded :: [Char] #

formatAddress :: Address -> String #

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

formatAddresses :: [Address] -> String #

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

parseAddress :: String -> Maybe Address #

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] #

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 #

getSystemAddress :: IO (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.

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

getStarterAddress :: 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.

hexToInt :: String -> Int #

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