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

Safe Haskell | None
Language | Haskell2010

DBus.Internal.Message

Synopsis

- class Message a where
  - messageTypeCode :: a -> Word8
  - messageHeaderFields :: a -> [HeaderField]
  - messageBody :: a -> [Variant]
  - messageFlags :: a -> Word8
- data UnknownMessage = UnknownMessage {
  - unknownMessageType :: Word8
  - unknownMessageSender :: Maybe BusName
  - unknownMessageBody :: [Variant]
  }
- data MethodCall = MethodCall {
  - methodCallPath :: ObjectPath
  - methodCallInterface :: Maybe InterfaceName
  - methodCallMember :: MemberName
  - methodCallSender :: Maybe BusName
  - methodCallDestination :: Maybe BusName
  - methodCallReplyExpected :: Bool
  - methodCallAutoStart :: Bool
  - methodCallBody :: [Variant]
  }
- data MethodReturn = MethodReturn {
  - methodReturnSerial :: Serial
  - methodReturnSender :: Maybe BusName
  - methodReturnDestination :: Maybe BusName
  - methodReturnBody :: [Variant]
  }
- data MethodError = MethodError {
  - methodErrorName :: ErrorName
  - methodErrorSerial :: Serial
  - methodErrorSender :: Maybe BusName
  - methodErrorDestination :: Maybe BusName
  - methodErrorBody :: [Variant]
  }
- methodErrorMessage :: MethodError -> String
- data Signal = Signal {
  - signalPath :: ObjectPath
  - signalInterface :: InterfaceName
  - signalMember :: MemberName
  - signalSender :: Maybe BusName
  - signalDestination :: Maybe BusName
  - signalBody :: [Variant]
  }
- data ReceivedMessage
  - = ReceivedMethodCall Serial MethodCall
  - | ReceivedMethodReturn Serial MethodReturn
  - | ReceivedMethodError Serial MethodError
  - | ReceivedSignal Serial Signal
  - | ReceivedUnknown Serial UnknownMessage
- data HeaderField
  - = HeaderPath ObjectPath
  - | HeaderInterface InterfaceName
  - | HeaderMember MemberName
  - | HeaderErrorName ErrorName
  - | HeaderReplySerial Serial
  - | HeaderDestination BusName
  - | HeaderSender BusName
  - | HeaderSignature Signature
  - | HeaderUnixFds Word32
- setMethodCallFlags :: MethodCall -> Word8 -> MethodCall

# Documentation

class Message a where #

Minimal complete definition

messageTypeCode, messageHeaderFields, messageBody

Methods

messageTypeCode :: a -> Word8 #

messageHeaderFields :: a -> [HeaderField] #

messageBody :: a -> [Variant] #

messageFlags :: a -> Word8 #

#### Instances

Instances details

Message MethodCall # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodCall -> Word8 # messageHeaderFields :: MethodCall -> [HeaderField] # messageBody :: MethodCall -> [Variant] # messageFlags :: MethodCall -> Word8 #
Message MethodError # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodError -> Word8 # messageHeaderFields :: MethodError -> [HeaderField] # messageBody :: MethodError -> [Variant] # messageFlags :: MethodError -> Word8 #
Message MethodReturn # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodReturn -> Word8 # messageHeaderFields :: MethodReturn -> [HeaderField] # messageBody :: MethodReturn -> [Variant] # messageFlags :: MethodReturn -> Word8 #
Message Signal # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: Signal -> Word8 # messageHeaderFields :: Signal -> [HeaderField] # messageBody :: Signal -> [Variant] # messageFlags :: Signal -> Word8 #

data UnknownMessage #

Constructors

UnknownMessage |
Fields unknownMessageType :: Word8 unknownMessageSender :: Maybe BusName unknownMessageBody :: [Variant]

#### Instances

Instances details

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

data MethodCall #

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.

Constructors

MethodCall |
Fields methodCallPath :: ObjectPath 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. methodCallInterface :: Maybe InterfaceName 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. methodCallMember :: MemberName The method name of the method call. Method names are unique within an interface, but might not be unique within an object. methodCallSender :: Maybe BusName 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`. methodCallDestination :: 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`. methodCallReplyExpected :: Bool Set whether a reply is expected. This can save network and cpu resources by inhibiting unnecessary replies. Defaults to `True`. methodCallAutoStart :: Bool Set whether the bus should auto-start the remote Defaults to `True`. methodCallBody :: [Variant] The arguments to the method call. See `toVariant`. Defaults to `[]`.

#### Instances

Instances details

Message MethodCall # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodCall -> Word8 # messageHeaderFields :: MethodCall -> [HeaderField] # messageBody :: MethodCall -> [Variant] # messageFlags :: MethodCall -> Word8 #
Show MethodCall # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> MethodCall -> ShowS # show :: MethodCall -> String # showList :: [MethodCall] -> ShowS #
Eq MethodCall # |
Instance details Defined in DBus.Internal.Message Methods (==) :: MethodCall -> MethodCall -> Bool # (/=) :: MethodCall -> MethodCall -> Bool #

data MethodReturn #

A method return is a reply to a method call, indicating that the call succeeded.

Constructors

MethodReturn |
Fields methodReturnSerial :: Serial The serial of the original method call. This lets the original caller match up this reply to the pending call. methodReturnSender :: Maybe BusName 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`. methodReturnDestination :: 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`. methodReturnBody :: [Variant] Values returned from the method call. See `toVariant`. Defaults to `[]`.

#### Instances

Instances details

Message MethodReturn # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodReturn -> Word8 # messageHeaderFields :: MethodReturn -> [HeaderField] # messageBody :: MethodReturn -> [Variant] # messageFlags :: MethodReturn -> Word8 #
Show MethodReturn # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> MethodReturn -> ShowS # show :: MethodReturn -> String # showList :: [MethodReturn] -> ShowS #
Eq MethodReturn # |
Instance details Defined in DBus.Internal.Message Methods (==) :: MethodReturn -> MethodReturn -> Bool # (/=) :: MethodReturn -> MethodReturn -> Bool #

data MethodError #

A method error is a reply to a method call, indicating that the call received an error and did not succeed.

Constructors

MethodError |
Fields methodErrorName :: ErrorName The name of the error type. Names are used so clients can handle certain classes of error differently from others. methodErrorSerial :: Serial The serial of the original method call. This lets the original caller match up this reply to the pending call. methodErrorSender :: Maybe BusName 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`. methodErrorDestination :: 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`. methodErrorBody :: [Variant] Additional information about the error. By convention, if the error body contains any items, the first item should be a string describing the error.

#### Instances

Instances details

Message MethodError # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodError -> Word8 # messageHeaderFields :: MethodError -> [HeaderField] # messageBody :: MethodError -> [Variant] # messageFlags :: MethodError -> Word8 #
Show MethodError # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> MethodError -> ShowS # show :: MethodError -> String # showList :: [MethodError] -> ShowS #
Eq MethodError # |
Instance details Defined in DBus.Internal.Message Methods (==) :: MethodError -> MethodError -> Bool # (/=) :: MethodError -> MethodError -> Bool #

methodErrorMessage :: MethodError -> String #

Get a human-readable description of the error, by returning the first item in the error body if it's a string.

data Signal #

Signals are broadcast by applications to notify other clients of some event.

Constructors

Signal |
Fields signalPath :: ObjectPath The path of the object that emitted this signal. signalInterface :: InterfaceName The interface that this signal belongs to. signalMember :: MemberName The name of this signal. signalSender :: Maybe BusName 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`. signalDestination :: 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`. signalBody :: [Variant] Additional information about the signal, such as the new value or the time. Defaults to `[]`.

#### Instances

Instances details

Message Signal # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: Signal -> Word8 # messageHeaderFields :: Signal -> [HeaderField] # messageBody :: Signal -> [Variant] # messageFlags :: Signal -> Word8 #
Show Signal # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> Signal -> ShowS # show :: Signal -> String # showList :: [Signal] -> ShowS #
Eq Signal # |
Instance details Defined in DBus.Internal.Message Methods (==) :: Signal -> Signal -> Bool # (/=) :: Signal -> Signal -> Bool #

data ReceivedMessage #

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.

Constructors

ReceivedMethodCall Serial MethodCall |
ReceivedMethodReturn Serial MethodReturn |
ReceivedMethodError Serial MethodError |
ReceivedSignal Serial Signal |
ReceivedUnknown Serial UnknownMessage |

#### Instances

Instances details

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

data HeaderField #

Constructors

HeaderPath ObjectPath |
HeaderInterface InterfaceName |
HeaderMember MemberName |
HeaderErrorName ErrorName |
HeaderReplySerial Serial |
HeaderDestination BusName |
HeaderSender BusName |
HeaderSignature Signature |
HeaderUnixFds Word32 |

#### Instances

Instances details

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

setMethodCallFlags :: MethodCall -> Word8 -> MethodCall #