DBus.Internal.Message

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

Safe Haskell | None
Language | Haskell98

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

Message Signal |
Message MethodError |
Message MethodReturn |
Message MethodCall |

data UnknownMessage

Constructors

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

Instances

Eq UnknownMessage |
Show UnknownMessage |

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

Eq MethodCall |
Show MethodCall |
Message MethodCall |

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

Eq MethodReturn |
Show MethodReturn |
Message MethodReturn |

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

Eq MethodError |
Show MethodError |
Message MethodError |

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

Eq Signal |
Show Signal |
Message Signal |

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

Eq ReceivedMessage |
Show ReceivedMessage |

data HeaderField

Constructors

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

Instances

Eq HeaderField |
Show HeaderField |

setMethodCallFlags :: MethodCall -> Word8 -> MethodCall