glibmm 2.80.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gio::DBus::Message Class Reference

A type for representing D-Bus messages that can be sent or received on a Connection. More...

#include <giomm/dbusmessage.h>

Inheritance diagram for Gio::DBus::Message:
Inheritance graph
[legend]

Public Types

enum class  ByteOrder {
  ByteOrder::BIG_ENDIAN_ORDER = 'B' ,
  ByteOrder::LITTLE_ENDIAN_ORDER = 'l'
}
 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 Member Functions

 Message (Message && src) noexcept
 
Messageoperator= (Message && src) noexcept
 
 ~Message () noexcept override
 
GDBusMessage * gobj ()
 Provides access to the underlying C GObject. More...
 
const GDBusMessage * gobj () const
 Provides access to the underlying C GObject. More...
 
GDBusMessage * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::ustring print (guint indent)
 Produces a human-readable multi-line description of message. More...
 
bool get_locked () const
 Checks whether message is locked. More...
 
void lock ()
 If message is locked, does nothing. More...
 
Glib::RefPtr< Messagecopy () const
 Copies message. More...
 
MessageType get_message_type () const
 Gets the type of message. More...
 
void set_message_type (MessageType type)
 Sets message to be of type. More...
 
ByteOrder get_byte_order () const
 Gets the byte order of message. More...
 
void set_byte_order (ByteOrder byte_order)
 Sets the byte order of message. More...
 
guint32 get_serial () const
 Gets the serial for message. More...
 
void set_serial (guint32 serial)
 Sets the serial for message. More...
 
MessageFlags get_flags () const
 Gets the flags for message. More...
 
void set_flags (MessageFlags flags)
 Sets the flags to set on message. More...
 
void get_body (Glib::VariantBase & value) const
 Gets the body of a message. More...
 
void set_body (const Glib::VariantBase & body)
 Sets the body message. More...
 
Glib::RefPtr< UnixFDListget_unix_fd_list ()
 Gets the UNIX file descriptors associated with message, if any. More...
 
Glib::RefPtr< const UnixFDListget_unix_fd_list () const
 Gets the UNIX file descriptors associated with message, if any. More...
 
void set_unix_fd_list (const Glib::RefPtr< UnixFDList > & fd_list)
 Sets the UNIX file descriptors associated with message. More...
 
void unset_unix_fd_list ()
 Clears the existing UNIX file descriptor list. More...
 
guint32 get_num_unix_fds () const
 Convenience getter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field. More...
 
void set_num_unix_fds (guint32 value)
 Convenience setter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field. More...
 
void get_header (Glib::VariantBase & value, MessageHeaderField header_field) const
 Gets a header field on the message. More...
 
void set_header (MessageHeaderField header_field, const Glib::VariantBase & value)
 Sets a header field on message. More...
 
std::vector< guchar > get_header_fields () const
 Gets an array of all header fields on message that are set. More...
 
Glib::ustring get_destination () const
 Convenience getter for the Gio::DBus::MessageHeaderField::DESTINATION header field. More...
 
void set_destination (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::DESTINATION header field. More...
 
Glib::ustring get_error_name () const
 Convenience getter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field. More...
 
void set_error_name (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field. More...
 
Glib::ustring get_interface () const
 Convenience getter for the Gio::DBus::MessageHeaderField::INTERFACE header field. More...
 
void set_interface (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::INTERFACE header field. More...
 
Glib::ustring get_member () const
 Convenience getter for the Gio::DBus::MessageHeaderField::MEMBER header field. More...
 
void set_member (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::MEMBER header field. More...
 
Glib::ustring get_path () const
 Convenience getter for the Gio::DBus::MessageHeaderField::PATH header field. More...
 
void set_path (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::PATH header field. More...
 
guint32 get_reply_serial () const
 Convenience getter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field. More...
 
void set_reply_serial (guint32 value)
 Convenience setter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field. More...
 
Glib::ustring get_sender () const
 Convenience getter for the Gio::DBus::MessageHeaderField::SENDER header field. More...
 
void set_sender (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::SENDER header field. More...
 
Glib::ustring get_signature () const
 Convenience getter for the Gio::DBus::MessageHeaderField::SIGNATURE header field. More...
 
void set_signature (const Glib::ustring & value)
 Convenience setter for the Gio::DBus::MessageHeaderField::SIGNATURE header field. More...
 
Glib::ustring get_arg0 () const
 Convenience to get the first item in the body of message. More...
 
Glib::DBusObjectPathString get_arg0_path () const
 Convenience to get the first item in the body of message. More...
 
guchar * to_blob (gsize & out_size, CapabilityFlags capabilities=CapabilityFlags::NONE)
 Serializes message to a blob. More...
 
void to_exception ()
 If message is not of type Gio::DBus::MessageType::ERROR does nothing and returns false. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_locked () const
 Default value: false More...
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object && src) noexcept
 
Objectoperator= (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. More...
 
void remove_data (const QueryQuark & quark)
 
void * steal_data (const QueryQuark & quark)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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. More...
 
void get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
 You probably want to use a specific property_*() accessor method instead. More...
 
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. More...
 
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. More...
 
template<class PropertyType >
PropertyType get_property (const Glib::ustring & property_name) const
 You probably want to use a specific property_*() accessor method instead. More...
 
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. More...
 
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. More...
 
void freeze_notify ()
 Increases the freeze count on object. More...
 
void thaw_notify ()
 Reverts the effect of a previous call to freeze_notify(). More...
 
virtual void reference () const
 Increment the reference count for this object. More...
 
virtual void unreference () const
 Decrement the reference count for this object. More...
 
GObject * gobj ()
 Provides access to the underlying C GObject. More...
 
const GObject * gobj () const
 Provides access to the underlying C GObject. More...
 
GObject * gobj_copy () const
 Give a ref-ed copy to someone. Use for direct struct access. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< Messagecreate ()
 Creates a new empty Gio::DBus::Message. More...
 
static Glib::RefPtr< Messagecreate_signal (const Glib::ustring & path, const Glib::ustring & iface, const Glib::ustring & signal)
 Creates a new Gio::DBus::Message for a signal emission. More...
 
static Glib::RefPtr< Messagecreate_method_call (const Glib::ustring & name, const Glib::ustring & path, const Glib::ustring & iface, const Glib::ustring & method)
 Creates a new Gio::DBus::Message for a method call. More...
 
static Glib::RefPtr< Messagecreate_method_reply (const Glib::RefPtr< Message > & method_call_message)
 Creates a new Gio::DBus::Message that is a reply to method_call_message. More...
 
static Glib::RefPtr< Messagecreate_method_error_literal (const Glib::RefPtr< const Message > & method_call_message, const Glib::ustring & error_name, const Glib::ustring & error_message)
 Creates a new Gio::DBus::Message that is an error reply to method_call_message. More...
 
static Glib::RefPtr< Messagecreate_from_blob (const guchar * blob, gsize blob_len, CapabilityFlags capabilities=CapabilityFlags::NONE)
 Creates a new Gio::DBus::Message from the data stored at blob. More...
 
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. More...
 

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. More...
 
 ObjectBase (const char * custom_type_name)
 A derived constructor always overrides this choice. More...
 
 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. More...
 
 ObjectBase (ObjectBase && src) noexcept
 
ObjectBaseoperator= (ObjectBase && src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject * castitem)
 
void initialize_move (GObject * castitem, Glib::ObjectBase * previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gio::DBus::Messagewrap (GDBusMessage * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

A type for representing D-Bus messages that can be sent or received on a Connection.

Since glibmm 2.28:

Constructor & Destructor Documentation

◆ Message() [1/2]

Gio::DBus::Message::Message ( Message &&  src)
noexcept

◆ ~Message()

Gio::DBus::Message::~Message ( )
overridenoexcept

◆ Message() [2/2]

Gio::DBus::Message::Message ( )
protected

Member Function Documentation

◆ bytes_needed()

static gssize Gio::DBus::Message::bytes_needed ( const guchar *  blob,
gsize  blob_len 
)
static

Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at blob.

Since glibmm 2.26:
Parameters
blobA blob representing a binary D-Bus message.
blob_lenThe length of blob (must be at least 16).
Returns
Number of bytes needed or -1 if error is set (e.g. if blob contains invalid data or not enough data is available to determine the size).
Exceptions
Gio::Error

◆ copy()

Glib::RefPtr< Message > Gio::DBus::Message::copy ( ) const

Copies message.

The copy is a deep copy and the returned Gio::DBus::Message is completely identical except that it is guaranteed to not be locked.

This operation can fail if e.g. message contains file descriptors and the per-process or system-wide open files limit is reached.

Since glibmm 2.26:
Returns
A new Gio::DBus::Message or nullptr if error is set. Free with Glib::object_unref().
Exceptions
Gio::Error

◆ create()

static Glib::RefPtr< Message > Gio::DBus::Message::create ( )
static

Creates a new empty Gio::DBus::Message.

Since glibmm 2.26:
Returns
A Gio::DBus::Message. Free with Glib::object_unref().

◆ create_from_blob()

static Glib::RefPtr< Message > Gio::DBus::Message::create_from_blob ( const guchar *  blob,
gsize  blob_len,
CapabilityFlags  capabilities = CapabilityFlags::NONE 
)
static

Creates a new Gio::DBus::Message from the data stored at blob.

The byte order that the message was in can be retrieved using g_dbus_message_get_byte_order().

If the blob cannot be parsed, contains invalid fields, or contains invalid headers, Gio::Error::INVALID_ARGUMENT will be returned.

Since glibmm 2.26:
Parameters
blobA blob representing a binary D-Bus message.
blob_lenThe length of blob.
capabilitiesA DBusCapabilityFlags describing what protocol features are supported.
Returns
A new Gio::DBus::Message or nullptr if error is set. Free with Glib::object_unref().
Exceptions
Gio::Error

◆ create_method_call()

static Glib::RefPtr< Message > Gio::DBus::Message::create_method_call ( const Glib::ustring name,
const Glib::ustring path,
const Glib::ustring iface,
const Glib::ustring method 
)
static

Creates a new Gio::DBus::Message for a method call.

Since glibmm 2.26:
Parameters
nameA valid D-Bus name or nullptr.
pathA valid object path.
ifaceA valid D-Bus interface name or nullptr.
methodA valid method name.
Returns
A Gio::DBus::Message. Free with Glib::object_unref().

◆ create_method_error_literal()

static Glib::RefPtr< Message > Gio::DBus::Message::create_method_error_literal ( const Glib::RefPtr< const Message > &  method_call_message,
const Glib::ustring error_name,
const Glib::ustring error_message 
)
static

Creates a new Gio::DBus::Message that is an error reply to method_call_message.

Since glibmm 2.26:
Parameters
method_call_messageA message of type Gio::DBus::MessageType::METHOD_CALL to create a reply message to.
error_nameA valid D-Bus error name.
error_messageThe D-Bus error message.
Returns
A Gio::DBus::Message. Free with Glib::object_unref().

◆ create_method_reply()

static Glib::RefPtr< Message > Gio::DBus::Message::create_method_reply ( const Glib::RefPtr< Message > &  method_call_message)
static

Creates a new Gio::DBus::Message that is a reply to method_call_message.

Since glibmm 2.26:
Parameters
method_call_messageA message of type Gio::DBus::MessageType::METHOD_CALL to create a reply message to.
Returns
Gio::DBus::Message. Free with Glib::object_unref().

◆ create_signal()

static Glib::RefPtr< Message > Gio::DBus::Message::create_signal ( const Glib::ustring path,
const Glib::ustring iface,
const Glib::ustring signal 
)
static

Creates a new Gio::DBus::Message for a signal emission.

Since glibmm 2.26:
Parameters
pathA valid object path.
ifaceA valid D-Bus interface name.
signalA valid signal name.
Returns
A Gio::DBus::Message. Free with Glib::object_unref().

◆ get_arg0()

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.

Since glibmm 2.26:
Returns
The string item or nullptr if the first item in the body of message is not a string.

◆ get_arg0_path()

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.

Since glibmm 2.80:
Returns
The object path item or nullptr if the first item in the body of message is not an object path.

◆ get_body()

void Gio::DBus::Message::get_body ( Glib::VariantBase value) const

Gets the body of a message.

The body is returned in value.

Parameters
valueLocation in which to store the header.

◆ get_byte_order()

ByteOrder Gio::DBus::Message::get_byte_order ( ) const

Gets the byte order of message.

Returns
The byte order.

◆ get_destination()

Glib::ustring Gio::DBus::Message::get_destination ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::DESTINATION header field.

Since glibmm 2.26:
Returns
The value.

◆ get_error_name()

Glib::ustring Gio::DBus::Message::get_error_name ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field.

Since glibmm 2.26:
Returns
The value.

◆ get_flags()

MessageFlags Gio::DBus::Message::get_flags ( ) const

Gets the flags for message.

Since glibmm 2.26:
Returns
Flags that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).

◆ get_header()

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.

Parameters
valueLocation in which to store the header.
header_fieldThe header field type.

◆ get_header_fields()

std::vector< guchar > Gio::DBus::Message::get_header_fields ( ) const

Gets an array of all header fields on message that are set.

Since glibmm 2.26:
Returns
An array of header fields terminated by Gio::DBus::MessageHeaderField::INVALID. Each element is a #guchar.

◆ get_interface()

Glib::ustring Gio::DBus::Message::get_interface ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::INTERFACE header field.

Since glibmm 2.26:
Returns
The value.

◆ get_locked()

bool Gio::DBus::Message::get_locked ( ) const

Checks whether message is locked.

To monitor changes to this value, conncet to the Object::signal_notify() signal to listen for changes on the Gio::DBus::Message::property_locked() property.

Since glibmm 2.26:
Returns
true if message is locked, false otherwise.

◆ get_member()

Glib::ustring Gio::DBus::Message::get_member ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::MEMBER header field.

Since glibmm 2.26:
Returns
The value.

◆ get_message_type()

MessageType Gio::DBus::Message::get_message_type ( ) const

Gets the type of message.

Since glibmm 2.26:
Returns
A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).

◆ get_num_unix_fds()

guint32 Gio::DBus::Message::get_num_unix_fds ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field.

Since glibmm 2.26:
Returns
The value.

◆ get_path()

Glib::ustring Gio::DBus::Message::get_path ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::PATH header field.

Since glibmm 2.26:
Returns
The value.

◆ get_reply_serial()

guint32 Gio::DBus::Message::get_reply_serial ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field.

Since glibmm 2.26:
Returns
The value.

◆ get_sender()

Glib::ustring Gio::DBus::Message::get_sender ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::SENDER header field.

Since glibmm 2.26:
Returns
The value.

◆ get_serial()

guint32 Gio::DBus::Message::get_serial ( ) const

Gets the serial for message.

Since glibmm 2.26:
Returns
A #guint32.

◆ get_signature()

Glib::ustring Gio::DBus::Message::get_signature ( ) const

Convenience getter for the Gio::DBus::MessageHeaderField::SIGNATURE header field.

This will always be non-nullptr, but may be an empty string.

Since glibmm 2.26:
Returns
The value.

◆ get_type()

static GType Gio::DBus::Message::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_unix_fd_list() [1/2]

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, ...).

Since glibmm 2.26:
Returns
A UnixFDList or nullptr if no file descriptors are associated. Do not free, this object is owned by message.

◆ get_unix_fd_list() [2/2]

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, ...).

Since glibmm 2.26:
Returns
A UnixFDList or nullptr if no file descriptors are associated. Do not free, this object is owned by message.

◆ gobj() [1/2]

GDBusMessage * Gio::DBus::Message::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GDBusMessage * Gio::DBus::Message::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

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.

◆ lock()

void Gio::DBus::Message::lock ( )

If message is locked, does nothing.

Otherwise locks the message.

Since glibmm 2.26:

◆ operator=()

Message & Gio::DBus::Message::operator= ( Message &&  src)
noexcept

◆ print()

Glib::ustring Gio::DBus::Message::print ( guint  indent)

Produces a human-readable multi-line description of message.

The contents of the description has no ABI guarantees, the contents and formatting is subject to change at any time. Typical output looks something like this:

Type: method-call
Flags: none
Version: 0
Serial: 4
Headers:
path -> objectpath '/org/gtk/GDBus/TestObject'
interface -> 'org.gtk.GDBus.TestInterface'
member -> 'GimmeStdout'
destination -> ':1.146'
Body: ()
UNIX File Descriptors:
(none)
File and directory handling.
Definition: file.h:224
@ UNIX
The UNIX domain family.

or

Type: method-return
Flags: no-reply-expected
Version: 0
Serial: 477
Headers:
reply-serial -> uint32 4
destination -> ':1.159'
sender -> ':1.146'
num-unix-fds -> uint32 1
Body: ()
UNIX File Descriptors:
fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635
valarray< size_t > size() const
Since glibmm 2.26:
Parameters
indentIndentation level.
Returns
A string that should be freed with glib_free().

◆ property_locked()

Glib::PropertyProxy_ReadOnly< bool > Gio::DBus::Message::property_locked ( ) const

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_body()

void Gio::DBus::Message::set_body ( const Glib::VariantBase body)

Sets the body 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.

Since glibmm 2.26:
Parameters
bodyEither nullptr or a Variant that is a tuple.

◆ set_byte_order()

void Gio::DBus::Message::set_byte_order ( ByteOrder  byte_order)

Sets the byte order of message.

Parameters
byte_orderThe byte order.

◆ set_destination()

void Gio::DBus::Message::set_destination ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::DESTINATION header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_error_name()

void Gio::DBus::Message::set_error_name ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::ERROR_NAME header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_flags()

void Gio::DBus::Message::set_flags ( MessageFlags  flags)

Sets the flags to set on message.

Since glibmm 2.26:
Parameters
flagsFlags for message that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).

◆ set_header()

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.

Since glibmm 2.26:
Parameters
header_fieldA 8-bit unsigned integer (typically a value from the DBusMessageHeaderField enumeration).
valueA Variant to set the header field or nullptr to clear the header field.

◆ set_interface()

void Gio::DBus::Message::set_interface ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::INTERFACE header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_member()

void Gio::DBus::Message::set_member ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::MEMBER header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_message_type()

void Gio::DBus::Message::set_message_type ( MessageType  type)

Sets message to be of type.

Since glibmm 2.26:
Parameters
typeA 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).

◆ set_num_unix_fds()

void Gio::DBus::Message::set_num_unix_fds ( guint32  value)

Convenience setter for the Gio::DBus::MessageHeaderField::NUM_UNIX_FDS header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_path()

void Gio::DBus::Message::set_path ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::PATH header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_reply_serial()

void Gio::DBus::Message::set_reply_serial ( guint32  value)

Convenience setter for the Gio::DBus::MessageHeaderField::REPLY_SERIAL header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_sender()

void Gio::DBus::Message::set_sender ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::SENDER header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_serial()

void Gio::DBus::Message::set_serial ( guint32  serial)

Sets the serial for message.

Since glibmm 2.26:
Parameters
serialA #guint32.

◆ set_signature()

void Gio::DBus::Message::set_signature ( const Glib::ustring value)

Convenience setter for the Gio::DBus::MessageHeaderField::SIGNATURE header field.

Since glibmm 2.26:
Parameters
valueThe value to set.

◆ set_unix_fd_list()

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.

Since glibmm 2.26:
Parameters
fd_listA UnixFDList or nullptr.

◆ to_blob()

guchar * Gio::DBus::Message::to_blob ( gsize &  out_size,
CapabilityFlags  capabilities = CapabilityFlags::NONE 
)

Serializes message to a blob.

The byte order returned by g_dbus_message_get_byte_order() will be used.

Since glibmm 2.26:
Parameters
out_sizeReturn location for size of generated blob.
capabilitiesA DBusCapabilityFlags describing what protocol features are supported.
Returns
A pointer to a valid binary D-Bus message of out_size bytes generated by message or nullptr if error is set.
Exceptions
Gio::Error

◆ to_exception()

void Gio::DBus::Message::to_exception ( )

If message is not of type Gio::DBus::MessageType::ERROR does nothing and returns false.

Otherwise this method encodes the error in message as a Error using g_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.

Since glibmm 2.26:
Exceptions
Glib::Error

◆ unset_unix_fd_list()

void Gio::DBus::Message::unset_unix_fd_list ( )

Clears the existing UNIX file descriptor list.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gio::DBus::Message > wrap ( GDBusMessage *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.