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

Safe Haskell | Safe
Language | Haskell98

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)
- getenv :: String -> IO (Maybe String)
- 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

Eq Address # |
Methods (==) :: Address -> Address -> Bool # (/=) :: Address -> Address -> Bool #
Show Address # |
Methods showsPrec :: Int -> Address -> ShowS # show :: Address -> String # showList :: [Address] -> ShowS #

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 address in the environment variable `DBUS_SESSION_BUS_ADDRESS`, which must be set.

Returns `Nothing` if `DBUS_SYSTEM_BUS_ADDRESS` is unset or contains an invalid address.

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.

getenv :: String -> IO (Maybe String) #

hexToInt :: String -> Int #

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