|
glibmm 2.89.0
|
A type for representing D-Bus messages that can be sent or received on a Connection. More...
#include <giomm/dbusmessage.h>

Public Types | |
| enum class | ByteOrder { ByteOrder::BIG_ENDIAN_ORDER = 66 , ByteOrder::LITTLE_ENDIAN_ORDER = 108 } |
| Enumeration used to describe the byte order of a D-Bus message. More... | |
| Public Types inherited from Glib::Object | |
| using | DestroyNotify = void (*)(gpointer data) |
| Public Types inherited from sigc::trackable | |
| typedef internal::func_destroy_notify | func_destroy_notify |
| Public Types inherited from sigc::notifiable | |
| typedef internal::func_destroy_notify | func_destroy_notify |
Public Member Functions | |
| Message (Message && src) noexcept | |
| Message & | operator= (Message && src) noexcept |
| ~Message () noexcept override | |
| GDBusMessage * | gobj () |
| Provides access to the underlying C GObject. | |
| const GDBusMessage * | gobj () const |
| Provides access to the underlying C GObject. | |
| GDBusMessage * | gobj_copy () |
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
| Glib::ustring | print (guint indent) |
| Produces a human-readable multi-line description of message. | |
| bool | get_locked () const |
| Checks whether message is locked. | |
| void | lock () |
| Locks the message. | |
| Glib::RefPtr< Message > | copy () const |
| Copies message with a deep copy. | |
| MessageType | get_message_type () const |
| Gets the type of message. | |
| void | set_message_type (MessageType type) |
| Sets message to be of type. | |
| ByteOrder | get_byte_order () const |
| Gets the byte order of message. | |
| void | set_byte_order (ByteOrder byte_order) |
| Sets the byte order of message. | |
| guint32 | get_serial () const |
| Gets the serial for message. | |
| void | set_serial (guint32 serial) |
| Sets the serial for message. | |
| MessageFlags | get_flags () const |
| Gets the flags for message. | |
| void | set_flags (MessageFlags flags) |
| Sets the flags to set on message. | |
| void | get_body (Glib::VariantBase & value) const |
| Gets the body of a message. | |
| void | set_body (const Glib::VariantBase & body) |
| Sets the body of message. | |
| Glib::RefPtr< UnixFDList > | get_unix_fd_list () |
| Gets the UNIX file descriptors associated with message, if any. | |
| Glib::RefPtr< const UnixFDList > | get_unix_fd_list () const |
| Gets the UNIX file descriptors associated with message, if any. | |
| void | set_unix_fd_list (const Glib::RefPtr< UnixFDList > & fd_list) |
| Sets the UNIX file descriptors associated with message. | |
| void | unset_unix_fd_list () |
| Clears the existing UNIX file descriptor list. | |
| guint32 | get_num_unix_fds () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field. | |
| void | set_num_unix_fds (guint32 value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field. | |
| void | get_header (Glib::VariantBase & value, MessageHeaderField header_field) const |
| Gets a header field on the message. | |
| void | set_header (MessageHeaderField header_field, const Glib::VariantBase & value) |
| Sets a header field on message. | |
| std::vector< guchar > | get_header_fields () const |
| Gets an array of all header fields on message that are set. | |
| Glib::ustring | get_destination () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::DESTINATION header field. | |
| void | set_destination (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::DESTINATION header field. | |
| Glib::ustring | get_error_name () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field. | |
| void | set_error_name (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field. | |
| Glib::ustring | get_interface () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::INTERFACE header field. | |
| void | set_interface (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::INTERFACE header field. | |
| Glib::ustring | get_member () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::MEMBER header field. | |
| void | set_member (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::MEMBER header field. | |
| Glib::ustring | get_path () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::PATH header field. | |
| void | set_path (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::PATH header field. | |
| guint32 | get_reply_serial () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field. | |
| void | set_reply_serial (guint32 value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field. | |
| Glib::ustring | get_sender () const |
| Convenience getter for the Gio::DBus::MessageHeaderField::SENDER header field. | |
| void | set_sender (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::SENDER header field. | |
| Glib::ustring | get_signature () const |
| Convenience getter for the [enum Gio.DBusMessageHeaderField.SIGNATURE header field. | |
| void | set_signature (const Glib::ustring & value) |
| Convenience setter for the Gio::DBus::MessageHeaderField::SIGNATURE header field. | |
| Glib::ustring | get_arg0 () const |
| Convenience to get the first item in the body of message. | |
| Glib::DBusObjectPathString | get_arg0_path () const |
| Convenience to get the first item in the body of message. | |
| guchar * | to_blob (gsize & out_size, CapabilityFlags capabilities=CapabilityFlags::NONE) |
| Serializes message to a blob. | |
| void | to_exception () |
| Encodes the error in message as a Glib::Error. | |
| Glib::PropertyProxy_ReadOnly< bool > | property_locked () const |
| Default value: false. | |
| Public Member Functions inherited from Glib::Object | |
| Object (const Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object (Object && src) noexcept | |
| Object & | operator= (Object && src) noexcept |
| void * | get_data (const QueryQuark & key) |
| void | set_data (const Quark & key, void *data) |
| void | set_data_with_c_callback (const Quark & key, void *data, GDestroyNotify notify) |
| void | set_data (const Quark & key, void *data, DestroyNotify notify) |
| Prefer set_data_with_c_callback() with a callback with C linkage. | |
| void | remove_data (const QueryQuark & quark) |
| void * | steal_data (const QueryQuark & quark) |
| Public Member Functions inherited from Glib::ObjectBase | |
| ObjectBase (const ObjectBase &)=delete | |
| ObjectBase & | operator= (const ObjectBase &)=delete |
| void | set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value) |
| You probably want to use a specific property_*() accessor method instead. | |
| void | get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const |
| You probably want to use a specific property_*() accessor method instead. | |
| template<class PropertyType> | |
| void | set_property (const Glib::ustring & property_name, const PropertyType & value) |
| You probably want to use a specific property_*() accessor method instead. | |
| template<class PropertyType> | |
| void | get_property (const Glib::ustring & property_name, PropertyType & value) const |
| You probably want to use a specific property_*() accessor method instead. | |
| template<class PropertyType> | |
| PropertyType | get_property (const Glib::ustring & property_name) const |
| You probably want to use a specific property_*() accessor method instead. | |
| sigc::connection | connect_property_changed (const Glib::ustring & property_name, const sigc::slot< void()> & slot) |
| You can use the signal_changed() signal of the property proxy instead. | |
| sigc::connection | connect_property_changed (const Glib::ustring & property_name, sigc::slot< void()> && slot) |
| You can use the signal_changed() signal of the property proxy instead. | |
| void | freeze_notify () |
| Increases the freeze count on object. | |
| void | thaw_notify () |
| Reverts the effect of a previous call to freeze_notify(). | |
| virtual void | reference () const |
| Increment the reference count for this object. | |
| virtual void | unreference () const |
| Decrement the reference count for this object. | |
| GObject * | gobj () |
| Provides access to the underlying C GObject. | |
| const GObject * | gobj () const |
| Provides access to the underlying C GObject. | |
| GObject * | gobj_copy () const |
| Give a ref-ed copy to someone. Use for direct struct access. | |
| Public Member Functions inherited from sigc::trackable | |
| trackable () noexcept | |
| trackable (const trackable &src) noexcept | |
| trackable (trackable &&src) noexcept | |
| ~trackable () | |
| void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
| void | notify_callbacks () |
| trackable & | operator= (const trackable &src) |
| trackable & | operator= (trackable &&src) noexcept |
| void | remove_destroy_notify_callback (notifiable *data) const |
Static Public Member Functions | |
| static GType | get_type () |
| Get the GType for this class, for use with the underlying GObject type system. | |
| static Glib::RefPtr< Message > | create () |
| Creates a new empty D-Bus message. | |
| static Glib::RefPtr< Message > | create_signal (const Glib::ustring & path, const Glib::ustring & iface, const Glib::ustring & signal) |
| Creates a new D-Bus message for a signal emission. | |
| static Glib::RefPtr< Message > | create_method_call (const Glib::ustring & name, const Glib::ustring & path, const Glib::ustring & iface, const Glib::ustring & method) |
| Creates a new D-Bus message for a method call. | |
| static Glib::RefPtr< Message > | create_method_reply (const Glib::RefPtr< Message > & method_call_message) |
| Creates a new D-Bus message that is a reply to method_call_message. | |
| static Glib::RefPtr< Message > | create_method_error_literal (const Glib::RefPtr< const Message > & method_call_message, const Glib::ustring & error_name, const Glib::ustring & error_message) |
| Creates a new D-Bus message that is an error reply to method_call_message. | |
| static Glib::RefPtr< Message > | create_from_blob (const guchar * blob, gsize blob_len, CapabilityFlags capabilities=CapabilityFlags::NONE) |
| Creates a new D-Bus message from the data stored at blob. | |
| static gssize | bytes_needed (const guchar * blob, gsize blob_len) |
| Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at blob. | |
Protected Member Functions | |
| Message () | |
| Protected Member Functions inherited from Glib::Object | |
| Object () | |
| Object (const Glib::ConstructParams & construct_params) | |
| Object (GObject * castitem) | |
| ~Object () noexcept override | |
| Protected Member Functions inherited from Glib::ObjectBase | |
| ObjectBase () | |
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. | |
| ObjectBase (const char * custom_type_name) | |
| A derived constructor always overrides this choice. | |
| ObjectBase (const std::type_info & custom_type_info) | |
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. | |
| ObjectBase (ObjectBase && src) noexcept | |
| ObjectBase & | operator= (ObjectBase && src) noexcept |
| virtual | ~ObjectBase () noexcept=0 |
| void | initialize (GObject * castitem) |
| void | initialize_move (GObject * castitem, Glib::ObjectBase * previous_wrapper) |
Related Symbols | |
(Note that these are not member symbols.) | |
| Glib::RefPtr< Gio::DBus::Message > | wrap (GDBusMessage * object, bool take_copy=false) |
| A Glib::wrap() method for this object. | |
| Related Symbols inherited from Glib::Object | |
| Glib::RefPtr< Glib::Object > | wrap (GObject * object, bool take_copy=false) |
A type for representing D-Bus messages that can be sent or received on a Connection.
|
noexcept |
|
overridenoexcept |
|
protected |
|
static |
Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at blob.
An error will be returned if blob contains invalid data, or if not enough data is available to determine the size.
| blob | A blob representing a binary D-Bus message. |
| blob_len | The length of blob (must be at least 16 bytes). |
| Gio::Error |
| Glib::RefPtr< Message > Gio::DBus::Message::copy | ( | ) | const |
Copies message with a deep copy.
The returned D-Bus message is completely identical to message except that it is guaranteed to not be locked.
This operation can fail if (for example) message contains file descriptors and the per-process or system-wide open files limit is reached.
| Gio::Error |
|
static |
|
static |
Creates a new D-Bus message from the data stored at blob.
You must have previously called gio_dbus_message_bytes_needed() on blob, and ensure that blob is at least as long as the return value from that function indicates. In particular, that means that blob must be at least 16 bytes long (but will typically be much longer).
The byte order that the message was in can be retrieved using Gio::DBusMessage::get_byte_order().
If the blob cannot be parsed, contains invalid fields, or contains invalid headers, [error.nosp@m.@Gio.nosp@m..IOEr.nosp@m.rorE.nosp@m.num.I.nosp@m.NVAL.nosp@m.ID_AR.nosp@m.GUME.nosp@m.NT] will be returned.
| blob | A blob representing a binary D-Bus message. |
| blob_len | The length of blob, in bytes. |
| capabilities | Flags describing what protocol features are supported. |
| Gio::Error |
|
static |
Creates a new D-Bus message for a method call.
| name | A valid D-Bus name, or nullptr if no destination is needed. |
| path | A valid object path. |
| iface | A valid D-Bus interface name, or nullptr if none is needed. |
| method | A valid method name. |
|
static |
Creates a new D-Bus message that is an error reply to method_call_message.
| method_call_message | A message of type Gio::DBus::MessageType::METHOD_CALL to create a reply message to. |
| error_name | A valid D-Bus error name. |
| error_message | The D-Bus error message. |
|
static |
Creates a new D-Bus message that is a reply to method_call_message.
| method_call_message | A message of type Gio::DBus::MessageType::METHOD_CALL to create a reply message to. |
|
static |
Creates a new D-Bus message for a signal emission.
| path | A valid object path. |
| iface | A valid D-Bus interface name. |
| signal | A valid signal name. |
| Glib::ustring Gio::DBus::Message::get_arg0 | ( | ) | const |
Convenience to get the first item in the body of message.
See Gio::DBusMessage::get_arg0_path() for returning object-path-typed arg0 values.
| Glib::DBusObjectPathString Gio::DBus::Message::get_arg0_path | ( | ) | const |
Convenience to get the first item in the body of message.
See Gio::DBusMessage::get_arg0() for returning string-typed arg0 values.
| void Gio::DBus::Message::get_body | ( | Glib::VariantBase & | value | ) | const |
Gets the body of a message.
The body is returned in value.
| value | Location in which to store the header. |
| ByteOrder Gio::DBus::Message::get_byte_order | ( | ) | const |
Gets the byte order of message.
| Glib::ustring Gio::DBus::Message::get_destination | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::DESTINATION header field.
| Glib::ustring Gio::DBus::Message::get_error_name | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field.
| MessageFlags Gio::DBus::Message::get_flags | ( | ) | const |
Gets the flags for message.
| void Gio::DBus::Message::get_header | ( | Glib::VariantBase & | value, |
| MessageHeaderField | header_field ) const |
Gets a header field on the message.
The header is returned in value.
| value | Location in which to store the header. |
| header_field | The header field type. |
| std::vector< guchar > Gio::DBus::Message::get_header_fields | ( | ) | const |
Gets an array of all header fields on message that are set.
Each element in the array is an unsigned char.
| Glib::ustring Gio::DBus::Message::get_interface | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::INTERFACE header field.
| bool Gio::DBus::Message::get_locked | ( | ) | const |
Checks whether message is locked.
To monitor changes to this value, connect to the GObject::Object::signal_notify() signal to listen for changes on the Gio::DBusMessage::property_locked() property.
| Glib::ustring Gio::DBus::Message::get_member | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::MEMBER header field.
| MessageType Gio::DBus::Message::get_message_type | ( | ) | const |
Gets the type of message.
| guint32 Gio::DBus::Message::get_num_unix_fds | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field.
| Glib::ustring Gio::DBus::Message::get_path | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::PATH header field.
| guint32 Gio::DBus::Message::get_reply_serial | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field.
| Glib::ustring Gio::DBus::Message::get_sender | ( | ) | const |
Convenience getter for the Gio::DBus::MessageHeaderField::SENDER header field.
| guint32 Gio::DBus::Message::get_serial | ( | ) | const |
| Glib::ustring Gio::DBus::Message::get_signature | ( | ) | const |
Convenience getter for the [enum Gio.DBusMessageHeaderField.SIGNATURE header field.
This will always be non-nullptr, but may be an empty string.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
| Glib::RefPtr< UnixFDList > Gio::DBus::Message::get_unix_fd_list | ( | ) |
Gets the UNIX file descriptors associated with message, if any.
This method is only available on UNIX.
The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE values in the body of the message. For example, if Glib::Variant::get_handle() returns 5, that is intended to be a reference to the file descriptor that can be accessed by g_unix_fd_list_get (list, 5, ...).
| Glib::RefPtr< const UnixFDList > Gio::DBus::Message::get_unix_fd_list | ( | ) | const |
Gets the UNIX file descriptors associated with message, if any.
This method is only available on UNIX.
The file descriptors normally correspond to G_VARIANT_TYPE_HANDLE values in the body of the message. For example, if Glib::Variant::get_handle() returns 5, that is intended to be a reference to the file descriptor that can be accessed by g_unix_fd_list_get (list, 5, ...).
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
| GDBusMessage * Gio::DBus::Message::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
| void Gio::DBus::Message::lock | ( | ) |
| Glib::ustring Gio::DBus::Message::print | ( | guint | indent | ) |
Produces a human-readable multi-line description of message.
The contents and formatting are subject to change at any time and no ABI guarantees are given. Typical output looks something like this:
or
| indent | Indentation level. |
| Glib::PropertyProxy_ReadOnly< bool > Gio::DBus::Message::property_locked | ( | ) | const |
Default value: false.
| void Gio::DBus::Message::set_body | ( | const Glib::VariantBase & | body | ) |
Sets the body of message.
As a side-effect the Gio::DBus::MessageHeaderField::SIGNATURE header field is set to the type string of body (or cleared if body is nullptr).
If body is floating, message assumes ownership of body.
| body | A Glib::Variant containing a tuple, or nullptr if no body is needed. |
| void Gio::DBus::Message::set_byte_order | ( | ByteOrder | byte_order | ) |
Sets the byte order of message.
| byte_order | The byte order. |
| void Gio::DBus::Message::set_destination | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::DESTINATION header field.
| value | The value to set. |
| void Gio::DBus::Message::set_error_name | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field.
| value | The value to set. |
| void Gio::DBus::Message::set_flags | ( | MessageFlags | flags | ) |
Sets the flags to set on message.
| flags | Flags for message that are set (typically values from the Gio::DBusMessageFlags enumeration bitwise ORed together). |
| void Gio::DBus::Message::set_header | ( | MessageHeaderField | header_field, |
| const Glib::VariantBase & | value ) |
Sets a header field on message.
If value is floating, message assumes ownership of value.
| header_field | A 8-bit unsigned integer (typically a value from the [enum Gio.DBusMessageHeaderField enumeration). |
| value | A Glib::Variant to set the header field, or nullptr to clear the header field. |
| void Gio::DBus::Message::set_interface | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::INTERFACE header field.
| value | The value to set. |
| void Gio::DBus::Message::set_member | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::MEMBER header field.
| value | The value to set. |
| void Gio::DBus::Message::set_message_type | ( | MessageType | type | ) |
Sets message to be of type.
| type | A 8-bit unsigned integer (typically a value from the Gio::DBusMessageType enumeration). |
| void Gio::DBus::Message::set_num_unix_fds | ( | guint32 | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field.
| value | The value to set. |
| void Gio::DBus::Message::set_path | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::PATH header field.
| value | The value to set. |
| void Gio::DBus::Message::set_reply_serial | ( | guint32 | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field.
| value | The value to set. |
| void Gio::DBus::Message::set_sender | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::SENDER header field.
| value | The value to set. |
| void Gio::DBus::Message::set_serial | ( | guint32 | serial | ) |
Sets the serial for message.
The D-Bus specification does not allow the serial to be zero.
| serial | A serial number, which must not be zero. |
| void Gio::DBus::Message::set_signature | ( | const Glib::ustring & | value | ) |
Convenience setter for the Gio::DBus::MessageHeaderField::SIGNATURE header field.
| value | The value to set. |
| void Gio::DBus::Message::set_unix_fd_list | ( | const Glib::RefPtr< UnixFDList > & | fd_list | ) |
Sets the UNIX file descriptors associated with message.
As a side-effect the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field is set to the number of fds in fd_list (or cleared if fd_list is nullptr).
This method is only available on UNIX.
When designing D-Bus APIs that are intended to be interoperable, please note that non-GDBus implementations of D-Bus can usually only access file descriptors if they are referenced by a value of type G_VARIANT_TYPE_HANDLE in the body of the message.
| fd_list | A Gio::UnixFDList, or nullptr to clear. |
| guchar * Gio::DBus::Message::to_blob | ( | gsize & | out_size, |
| CapabilityFlags | capabilities = CapabilityFlags::NONE ) |
Serializes message to a blob.
The byte order returned by Gio::DBusMessage::get_byte_order() will be used.
| out_size | Return location for size of generated blob, in bytes. |
| capabilities | Flags describing what protocol features are supported. |
| Gio::Error |
| void Gio::DBus::Message::to_exception | ( | ) |
Encodes the error in message as a Glib::Error.
If message is of type Gio::DBus::MessageType::ERROR, this function calls gio_dbus_error_set_dbus_error() using the information in the Gio::DBus::MessageHeaderField::ERROR_NAME header field of message as well as the first string item in message’s body.
If message is not of type Gio::DBus::MessageType::ERROR, this function does nothing and returns false.
| Glib::Error |
| void Gio::DBus::Message::unset_unix_fd_list | ( | ) |
Clears the existing UNIX file descriptor list.
|
A Glib::wrap() method for this object.
| object | The C instance. |
| take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |