1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 #ifndef _GIOMM_DBUSMESSAGE_H
3 #define _GIOMM_DBUSMESSAGE_H
4 
5 #include <giommconfig.h>
6 
7 
8 #include <glibmm/ustring.h>
9 #include <sigc++/sigc++.h>
10 
11 /* Copyright (C) 2010 The giomm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 
28 #include <glibmm/object.h>
29 #include <glibmm/variant.h>
30 #include <glibmm/utility.h>
31 
32 #ifdef G_OS_UNIX
33 # include <giomm/unixfdlist.h>
34 #endif
35 
36 
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 using GDBusMessage = struct _GDBusMessage;
39 using GDBusMessageClass = struct _GDBusMessageClass;
40 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41 
42 
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 namespace Gio
45 {
46 
47 namespace DBus
48 { class GIOMM_API Message_Class; } // namespace DBus
49 
50 } // namespace Gio
51 #endif //DOXYGEN_SHOULD_SKIP_THIS
52 
53 namespace Gio
54 {
55 
56 namespace DBus
57 {
58 
59 /** @addtogroup giommEnums giomm Enums and Flags */
60 
61 /**
62  *  @var MessageType MESSAGE_TYPE_INVALID
63  * Message is of invalid type.
64  *
65  *  @var MessageType MESSAGE_TYPE_METHOD_CALL
66  * Method call.
67  *
68  *  @var MessageType MESSAGE_TYPE_METHOD_RETURN
69  * Method reply.
70  *
71  *  @var MessageType MESSAGE_TYPE_ERROR
72  * Error reply.
73  *
74  *  @var MessageType MESSAGE_TYPE_SIGNAL
75  * Signal emission.
76  *
77  *  @enum MessageType
78  *
79  * Message types used in DBusMessage.
80  *
81  * @newin{2,26}
82  *
83  * @ingroup giommEnums
84  */
85 enum MessageType
86 {
87   MESSAGE_TYPE_INVALID,
88   MESSAGE_TYPE_METHOD_CALL,
89   MESSAGE_TYPE_METHOD_RETURN,
90   MESSAGE_TYPE_ERROR,
91   MESSAGE_TYPE_SIGNAL
92 };
93 
94 
95 /**
96  *  @var MessageFlags MESSAGE_FLAGS_NONE
97  * No flags set.
98  *
99  *  @var MessageFlags MESSAGE_FLAGS_NO_REPLY_EXPECTED
100  * A reply is not expected.
101  *
102  *  @var MessageFlags MESSAGE_FLAGS_NO_AUTO_START
103  * The bus must not launch an
104  * owner for the destination name in response to this message.
105  *
106  *  @var MessageFlags MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION
107  * If set on a method
108  * call, this flag means that the caller is prepared to wait for interactive
109  * authorization. @newin{2,46}
110  *
111  *  @enum MessageFlags
112  *
113  * Message flags used in DBusMessage.
114  *
115  * @newin{2,26}
116  *
117  * @ingroup giommEnums
118  * @par Bitwise operators:
119  * <tt>%MessageFlags operator|(MessageFlags, MessageFlags)</tt><br>
120  * <tt>%MessageFlags operator&(MessageFlags, MessageFlags)</tt><br>
121  * <tt>%MessageFlags operator^(MessageFlags, MessageFlags)</tt><br>
122  * <tt>%MessageFlags operator~(MessageFlags)</tt><br>
123  * <tt>%MessageFlags& operator|=(MessageFlags&, MessageFlags)</tt><br>
124  * <tt>%MessageFlags& operator&=(MessageFlags&, MessageFlags)</tt><br>
125  * <tt>%MessageFlags& operator^=(MessageFlags&, MessageFlags)</tt><br>
126  */
127 enum MessageFlags
128 {
129   MESSAGE_FLAGS_NONE = 0x0,
130   MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0),
131   MESSAGE_FLAGS_NO_AUTO_START = (1<<1),
132   MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION = (1<<2)
133 };
134 
135 /** @ingroup giommEnums */
136 inline MessageFlags operator|(MessageFlags lhs, MessageFlags rhs)
137   { return static_cast<MessageFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
138 
139 /** @ingroup giommEnums */
140 inline MessageFlags operator&(MessageFlags lhs, MessageFlags rhs)
141   { return static_cast<MessageFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
142 
143 /** @ingroup giommEnums */
144 inline MessageFlags operator^(MessageFlags lhs, MessageFlags rhs)
145   { return static_cast<MessageFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
146 
147 /** @ingroup giommEnums */
148 inline MessageFlags operator~(MessageFlags flags)
149   { return static_cast<MessageFlags>(~static_cast<unsigned>(flags)); }
150 
151 /** @ingroup giommEnums */
152 inline MessageFlags& operator|=(MessageFlags& lhs, MessageFlags rhs)
153   { return (lhs = static_cast<MessageFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
154 
155 /** @ingroup giommEnums */
156 inline MessageFlags& operator&=(MessageFlags& lhs, MessageFlags rhs)
157   { return (lhs = static_cast<MessageFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
158 
159 /** @ingroup giommEnums */
160 inline MessageFlags& operator^=(MessageFlags& lhs, MessageFlags rhs)
161   { return (lhs = static_cast<MessageFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
162 
163 
164 /**
165  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_INVALID
166  * Not a valid header field.
167  *
168  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_PATH
169  * The object path.
170  *
171  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_INTERFACE
172  * The interface name.
173  *
174  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_MEMBER
175  * The method or signal name.
176  *
177  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_ERROR_NAME
178  * The name of the error that occurred.
179  *
180  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_REPLY_SERIAL
181  * The serial number the message is a reply to.
182  *
183  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_DESTINATION
184  * The name the message is intended for.
185  *
186  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_SENDER
187  * Unique name of the sender of the message (filled in by the bus).
188  *
189  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_SIGNATURE
190  * The signature of the message body.
191  *
192  *  @var MessageHeaderField MESSAGE_HEADER_FIELD_NUM_UNIX_FDS
193  * The number of UNIX file descriptors that accompany the message.
194  *
195  *  @enum MessageHeaderField
196  *
197  * Header fields used in DBusMessage.
198  *
199  * @newin{2,26}
200  *
201  * @ingroup giommEnums
202  */
203 enum MessageHeaderField
204 {
205   MESSAGE_HEADER_FIELD_INVALID,
206   MESSAGE_HEADER_FIELD_PATH,
207   MESSAGE_HEADER_FIELD_INTERFACE,
208   MESSAGE_HEADER_FIELD_MEMBER,
209   MESSAGE_HEADER_FIELD_ERROR_NAME,
210   MESSAGE_HEADER_FIELD_REPLY_SERIAL,
211   MESSAGE_HEADER_FIELD_DESTINATION,
212   MESSAGE_HEADER_FIELD_SENDER,
213   MESSAGE_HEADER_FIELD_SIGNATURE,
214   MESSAGE_HEADER_FIELD_NUM_UNIX_FDS
215 };
216 
217 
218 /**
219  *  @var CapabilityFlags CAPABILITY_FLAGS_NONE
220  * No flags set.
221  *
222  *  @var CapabilityFlags CAPABILITY_FLAGS_UNIX_FD_PASSING
223  * The connection
224  * supports exchanging UNIX file descriptors with the remote peer.
225  *
226  *  @enum CapabilityFlags
227  *
228  * Capabilities negotiated with the remote peer.
229  *
230  * @newin{2,26}
231  *
232  * @ingroup giommEnums
233  * @par Bitwise operators:
234  * <tt>%CapabilityFlags operator|(CapabilityFlags, CapabilityFlags)</tt><br>
235  * <tt>%CapabilityFlags operator&(CapabilityFlags, CapabilityFlags)</tt><br>
236  * <tt>%CapabilityFlags operator^(CapabilityFlags, CapabilityFlags)</tt><br>
237  * <tt>%CapabilityFlags operator~(CapabilityFlags)</tt><br>
238  * <tt>%CapabilityFlags& operator|=(CapabilityFlags&, CapabilityFlags)</tt><br>
239  * <tt>%CapabilityFlags& operator&=(CapabilityFlags&, CapabilityFlags)</tt><br>
240  * <tt>%CapabilityFlags& operator^=(CapabilityFlags&, CapabilityFlags)</tt><br>
241  */
242 enum CapabilityFlags
243 {
244   CAPABILITY_FLAGS_NONE = 0x0,
245   CAPABILITY_FLAGS_UNIX_FD_PASSING = (1<<0)
246 };
247 
248 /** @ingroup giommEnums */
249 inline CapabilityFlags operator|(CapabilityFlags lhs, CapabilityFlags rhs)
250   { return static_cast<CapabilityFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
251 
252 /** @ingroup giommEnums */
253 inline CapabilityFlags operator&(CapabilityFlags lhs, CapabilityFlags rhs)
254   { return static_cast<CapabilityFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
255 
256 /** @ingroup giommEnums */
257 inline CapabilityFlags operator^(CapabilityFlags lhs, CapabilityFlags rhs)
258   { return static_cast<CapabilityFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
259 
260 /** @ingroup giommEnums */
261 inline CapabilityFlags operator~(CapabilityFlags flags)
262   { return static_cast<CapabilityFlags>(~static_cast<unsigned>(flags)); }
263 
264 /** @ingroup giommEnums */
265 inline CapabilityFlags& operator|=(CapabilityFlags& lhs, CapabilityFlags rhs)
266   { return (lhs = static_cast<CapabilityFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
267 
268 /** @ingroup giommEnums */
269 inline CapabilityFlags& operator&=(CapabilityFlags& lhs, CapabilityFlags rhs)
270   { return (lhs = static_cast<CapabilityFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
271 
272 /** @ingroup giommEnums */
273 inline CapabilityFlags& operator^=(CapabilityFlags& lhs, CapabilityFlags rhs)
274   { return (lhs = static_cast<CapabilityFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
275 
276 } // namespace DBus
277 
278 } // namespace Gio
279 
280 #ifndef DOXYGEN_SHOULD_SKIP_THIS
281 namespace Glib
282 {
283 
284 template <>
285 class Value<Gio::DBus::CapabilityFlags> : public Glib::Value_Flags<Gio::DBus::CapabilityFlags>
286 {
287 public:
288   static GType value_type() G_GNUC_CONST;
289 };
290 
291 } // namespace Glib
292 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
293 
294 namespace Gio
295 {
296 
297 namespace DBus
298 {
299 
300 
301 /** A type for representing D-Bus messages that can be sent or received on a
302  * Connection.
303  *
304  * @newin{2,28}
305  * @ingroup DBus
306  */
307 
308 class GIOMM_API Message : public Glib::Object
309 {
310 
311 #ifndef DOXYGEN_SHOULD_SKIP_THIS
312 
313 public:
314   using CppObjectType = Message;
315   using CppClassType = Message_Class;
316   using BaseObjectType = GDBusMessage;
317   using BaseClassType = GDBusMessageClass;
318 
319   // noncopyable
320   Message(const Message&) = delete;
321   Message& operator=(const Message&) = delete;
322 
323 private:  friend class Message_Class;
324   static CppClassType message_class_;
325 
326 protected:
327   explicit Message(const Glib::ConstructParams& construct_params);
328   explicit Message(GDBusMessage* castitem);
329 
330 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
331 
332 public:
333 
334   Message(Message&& src) noexcept;
335   Message& operator=(Message&& src) noexcept;
336 
337   ~Message() noexcept override;
338 
339   /** Get the GType for this class, for use with the underlying GObject type system.
340    */
341   static GType get_type()      G_GNUC_CONST;
342 
343 #ifndef DOXYGEN_SHOULD_SKIP_THIS
344 
345 
346   static GType get_base_type() G_GNUC_CONST;
347 #endif
348 
349   ///Provides access to the underlying C GObject.
gobj()350   GDBusMessage*       gobj()       { return reinterpret_cast<GDBusMessage*>(gobject_); }
351 
352   ///Provides access to the underlying C GObject.
gobj()353   const GDBusMessage* gobj() const { return reinterpret_cast<GDBusMessage*>(gobject_); }
354 
355   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
356   GDBusMessage* gobj_copy();
357 
358 private:
359 
360 
361 protected:
362   Message();
363 
364 
365 public:
366 
367   /** Creates a new empty DBusMessage.
368    *
369    * @newin{2,26}
370    *
371    * @return A DBusMessage. Free with Glib::object_unref().
372    */
373 
374 
375   static Glib::RefPtr<Message> create();
376 
377 
378   // Note that we can't use _WRAP_CTOR() and _WRAP_CREATE() because the C functions do more than just call g_object_new():
379   // See http://bugzilla.gnome.org/show_bug.cgi?id=624977
380 
381   // See here about whether the parameters should be ustring or std::string:
382   // http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names
383   // They are generally UTF-8 that can only contain the ASCII subset,
384   // so ustring still seems preferrable to std::string, which generally implies an unknown encoding for us.
385 
386   // The parameter name 'interface' can cause compilation errors with MinGW.
387   // See https://bugzilla.gnome.org/show_bug.cgi?id=735137
388   // The parameter name in glib is 'interface_'.
389 
390   /** Creates a new DBusMessage for a signal emission.
391    *
392    * @newin{2,26}
393    *
394    * @param path A valid object path.
395    * @param iface A valid D-Bus interface name.
396    * @param signal A valid signal name.
397    * @return A DBusMessage. Free with Glib::object_unref().
398    */
399   static Glib::RefPtr<Message> create_signal(const Glib::ustring& path, const Glib::ustring& iface, const Glib::ustring& signal);
400 
401   /** Creates a new DBusMessage for a method call.
402    *
403    * @newin{2,26}
404    *
405    * @param name A valid D-Bus name or <tt>nullptr</tt>.
406    * @param path A valid object path.
407    * @param iface A valid D-Bus interface name or <tt>nullptr</tt>.
408    * @param method A valid method name.
409    * @return A DBusMessage. Free with Glib::object_unref().
410    */
411   static Glib::RefPtr<Message> create_method_call(const Glib::ustring& name, const Glib::ustring& path, const Glib::ustring& iface, const Glib::ustring& method);
412 
413   /** Creates a new DBusMessage that is a reply to @a method_call_message.
414    *
415    * @newin{2,26}
416    *
417    * @param method_call_message A message of type DBUS_MESSAGE_TYPE_METHOD_CALL to
418    * create a reply message to.
419    * @return DBusMessage. Free with Glib::object_unref().
420    */
421   static Glib::RefPtr<Message> create_method_reply(const Glib::RefPtr<Message>& method_call_message);
422 
423   /** Creates a new DBusMessage that is an error reply to @a method_call_message.
424    *
425    * @newin{2,26}
426    *
427    * @param method_call_message A message of type DBUS_MESSAGE_TYPE_METHOD_CALL to
428    * create a reply message to.
429    * @param error_name A valid D-Bus error name.
430    * @param error_message The D-Bus error message.
431    * @return A DBusMessage. Free with Glib::object_unref().
432    */
433   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);
434 
435   // Ignore variable argument functions.
436 
437 
438   /** Creates a new DBusMessage from the data stored at @a blob. The byte
439    * order that the message was in can be retrieved using
440    * g_dbus_message_get_byte_order().
441    *
442    * If the @a blob cannot be parsed, contains invalid fields, or contains invalid
443    * headers, IO_ERROR_INVALID_ARGUMENT will be returned.
444    *
445    * @newin{2,26}
446    *
447    * @param blob A blob representing a binary D-Bus message.
448    * @param blob_len The length of @a blob.
449    * @param capabilities A DBusCapabilityFlags describing what protocol features are supported.
450    * @return A new DBusMessage or <tt>nullptr</tt> if @a error is set. Free with
451    * Glib::object_unref().
452    *
453    * @throws Glib::Error
454    */
455   static Glib::RefPtr<Message> create_from_blob(const guchar* blob, gsize blob_len, CapabilityFlags capabilities =  CAPABILITY_FLAGS_NONE);
456 
457 
458   /** Produces a human-readable multi-line description of @a message.
459    *
460    * The contents of the description has no ABI guarantees, the contents
461    * and formatting is subject to change at any time. Typical output
462    * looks something like this:
463    *
464    * [C example ellipted]
465    * or
466    *
467    * [C example ellipted]
468    *
469    * @newin{2,26}
470    *
471    * @param indent Indentation level.
472    * @return A string.
473    */
474   Glib::ustring print(guint indent);
475 
476 
477   /** Checks whether @a message is locked. To monitor changes to this
478    * value, conncet to the Object::signal_notify() signal to listen for changes
479    * on the DBusMessage::property_locked() property.
480    *
481    * @newin{2,26}
482    *
483    * @return <tt>true</tt> if @a message is locked, <tt>false</tt> otherwise.
484    */
485   bool get_locked() const;
486 
487   /** If @a message is locked, does nothing. Otherwise locks the message.
488    *
489    * @newin{2,26}
490    */
491   void lock();
492 
493   /** Copies @a message. The copy is a deep copy and the returned
494    * DBusMessage is completely identical except that it is guaranteed
495    * to not be locked.
496    *
497    * This operation can fail if e.g. @a message contains file descriptors
498    * and the per-process or system-wide open files limit is reached.
499    *
500    * @newin{2,26}
501    *
502    * @return A new DBusMessage or <tt>nullptr</tt> if @a error is set.
503    * Free with Glib::object_unref().
504    *
505    * @throws Glib::Error
506    */
507   Glib::RefPtr<Message> copy() const;
508 
509 
510   /** Gets the type of @a message.
511    *
512    * @newin{2,26}
513    *
514    * @return A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).
515    */
516   MessageType get_message_type() const;
517 
518   /** Sets @a message to be of @a type.
519    *
520    * @newin{2,26}
521    *
522    * @param type A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).
523    */
524   void set_message_type(MessageType type);
525 
526   //gmmproc can't handle the character literals, and this won't be expanded in future,
527   //so we just wrap it by hand.
528   enum ByteOrder
529   {
530     BYTE_ORDER_BIG_ENDIAN    = 'B',
531     BYTE_ORDER_LITTLE_ENDIAN = 'l'
532   };
533 
534 
535   /** Gets the byte order of @a message.
536    *
537    * @return The byte order.
538    */
539   ByteOrder get_byte_order() const;
540 
541   /** Sets the byte order of @a message.
542    *
543    * @param byte_order The byte order.
544    */
545   void set_byte_order(ByteOrder byte_order);
546 
547 
548   /** Gets the serial for @a message.
549    *
550    * @newin{2,26}
551    *
552    * @return A #guint32.
553    */
554   guint32 get_serial() const;
555 
556   /** Sets the serial for @a message.
557    *
558    * @newin{2,26}
559    *
560    * @param serial A #guint32.
561    */
562   void set_serial(guint32 serial);
563 
564 
565   /** Gets the flags for @a message.
566    *
567    * @newin{2,26}
568    *
569    * @return Flags that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).
570    */
571   MessageFlags get_flags() const;
572 
573   /** Sets the flags to set on @a message.
574    *
575    * @newin{2,26}
576    *
577    * @param flags Flags for @a message that are set (typically values from the DBusMessageFlags
578    * enumeration bitwise ORed together).
579    */
580   void set_flags(MessageFlags flags);
581 
582   /** Gets the body of a message.  The body is returned in @a value.
583    * @param value Location in which to store the header.
584    */
585   void get_body(Glib::VariantBase& value) const;
586 
587 
588   /** Sets the body @a message. As a side-effect the
589    * DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the
590    * type string of @a body (or cleared if @a body is <tt>nullptr</tt>).
591    *
592    * If @a body is floating, @a message assumes ownership of @a body.
593    *
594    * @newin{2,26}
595    *
596    * @param body Either <tt>nullptr</tt> or a Variant that is a tuple.
597    */
598   void set_body(const Glib::VariantBase& body);
599 
600 
601 #ifdef  G_OS_UNIX
602 
603   /** Gets the UNIX file descriptors associated with @a message, if any.
604    *
605    * This method is only available on UNIX.
606    *
607    * @newin{2,26}
608    *
609    * @return A UnixFDList or <tt>nullptr</tt> if no file descriptors are
610    * associated. Do not free, this object is owned by @a message.
611    */
612   Glib::RefPtr<UnixFDList> get_unix_fd_list();
613 #endif //  G_OS_UNIX
614 
615 
616 #ifdef  G_OS_UNIX
617 
618   /** Gets the UNIX file descriptors associated with @a message, if any.
619    *
620    * This method is only available on UNIX.
621    *
622    * @newin{2,26}
623    *
624    * @return A UnixFDList or <tt>nullptr</tt> if no file descriptors are
625    * associated. Do not free, this object is owned by @a message.
626    */
627   Glib::RefPtr<const UnixFDList> get_unix_fd_list() const;
628 #endif //  G_OS_UNIX
629 
630 
631 #ifdef  G_OS_UNIX
632 
633   /** Sets the UNIX file descriptors associated with @a message. As a
634    * side-effect the DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header
635    * field is set to the number of fds in @a fd_list (or cleared if
636    *  @a fd_list is <tt>nullptr</tt>).
637    *
638    * This method is only available on UNIX.
639    *
640    * @newin{2,26}
641    *
642    * @param fd_list A UnixFDList or <tt>nullptr</tt>.
643    */
644   void set_unix_fd_list(const Glib::RefPtr<UnixFDList>& fd_list);
645 #endif //  G_OS_UNIX
646 
647 
648 #ifdef G_OS_UNIX
649   /** Clears the existing UNIX file descriptor list.
650    */
651   void unset_unix_fd_list();
652 #endif //G_OS_UNIX
653 
654 
655   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
656    *
657    * @newin{2,26}
658    *
659    * @return The value.
660    */
661   guint32 get_num_unix_fds() const;
662 
663   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
664    *
665    * @newin{2,26}
666    *
667    * @param value The value to set.
668    */
669   void set_num_unix_fds(guint32 value);
670 
671   /** Gets a header field on the message.  The header is returned in @a value.
672    * @param value Location in which to store the header.
673    * @param header_field The header field type.
674    */
675   void get_header(Glib::VariantBase& value, MessageHeaderField header_field) const;
676 
677 
678   /** Sets a header field on @a message.
679    *
680    * If @a value is floating, @a message assumes ownership of @a value.
681    *
682    * @newin{2,26}
683    *
684    * @param header_field A 8-bit unsigned integer (typically a value from the DBusMessageHeaderField enumeration).
685    * @param value A Variant to set the header field or <tt>nullptr</tt> to clear the header field.
686    */
687   void set_header(MessageHeaderField header_field, const Glib::VariantBase& value);
688 
689 
690   /** Gets an array of all header fields on @a message that are set.
691    *
692    * @newin{2,26}
693    *
694    * @return An array of header fields
695    * terminated by DBUS_MESSAGE_HEADER_FIELD_INVALID.  Each element
696    * is a #guchar.
697    */
698   Glib::ArrayHandle<guchar> get_header_fields() const;
699 
700 
701   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
702    *
703    * @newin{2,26}
704    *
705    * @return The value.
706    */
707   Glib::ustring get_destination() const;
708 
709   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
710    *
711    * @newin{2,26}
712    *
713    * @param value The value to set.
714    */
715   void set_destination(const Glib::ustring& value);
716 
717 
718   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
719    *
720    * @newin{2,26}
721    *
722    * @return The value.
723    */
724   Glib::ustring get_error_name() const;
725 
726   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
727    *
728    * @newin{2,26}
729    *
730    * @param value The value to set.
731    */
732   void set_error_name(const Glib::ustring& value);
733 
734 
735   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
736    *
737    * @newin{2,26}
738    *
739    * @return The value.
740    */
741   Glib::ustring get_interface() const;
742 
743   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
744    *
745    * @newin{2,26}
746    *
747    * @param value The value to set.
748    */
749   void set_interface(const Glib::ustring& value);
750 
751 
752   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
753    *
754    * @newin{2,26}
755    *
756    * @return The value.
757    */
758   Glib::ustring get_member() const;
759 
760   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
761    *
762    * @newin{2,26}
763    *
764    * @param value The value to set.
765    */
766   void set_member(const Glib::ustring& value);
767 
768 
769   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_PATH header field.
770    *
771    * @newin{2,26}
772    *
773    * @return The value.
774    */
775   Glib::ustring get_path() const;
776 
777   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_PATH header field.
778    *
779    * @newin{2,26}
780    *
781    * @param value The value to set.
782    */
783   void set_path(const Glib::ustring& value);
784 
785 
786   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
787    *
788    * @newin{2,26}
789    *
790    * @return The value.
791    */
792   guint32 get_reply_serial() const;
793 
794   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
795    *
796    * @newin{2,26}
797    *
798    * @param value The value to set.
799    */
800   void set_reply_serial(guint32 value);
801 
802 
803   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
804    *
805    * @newin{2,26}
806    *
807    * @return The value.
808    */
809   Glib::ustring get_sender() const;
810 
811   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
812    *
813    * @newin{2,26}
814    *
815    * @param value The value to set.
816    */
817   void set_sender(const Glib::ustring& value);
818 
819 
820   /** Convenience getter for the DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
821    *
822    * @newin{2,26}
823    *
824    * @return The value.
825    */
826   Glib::ustring get_signature() const;
827 
828   /** Convenience setter for the DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
829    *
830    * @newin{2,26}
831    *
832    * @param value The value to set.
833    */
834   void set_signature(const Glib::ustring& value);
835 
836 
837   /** Convenience to get the first item in the body of @a message.
838    *
839    * @newin{2,26}
840    *
841    * @return The string item or <tt>nullptr</tt> if the first item in the body of
842    *  @a message is not a string.
843    */
844   Glib::ustring get_arg0() const;
845 
846 
847   /** Utility function to calculate how many bytes are needed to
848    * completely deserialize the D-Bus message stored at @a blob.
849    *
850    * @newin{2,26}
851    *
852    * @param blob A blob representing a binary D-Bus message.
853    * @param blob_len The length of @a blob (must be at least 16).
854    * @return Number of bytes needed or -1 if @a error is set (e.g. if
855    *  @a blob contains invalid data or not enough data is available to
856    * determine the size).
857    *
858    * @throws Glib::Error
859    */
860   static gssize bytes_needed(const guchar* blob, gsize blob_len);
861 
862 
863   /** Serializes @a message to a blob. The byte order returned by
864    * g_dbus_message_get_byte_order() will be used.
865    *
866    * @newin{2,26}
867    *
868    * @param out_size Return location for size of generated blob.
869    * @param capabilities A DBusCapabilityFlags describing what protocol features are supported.
870    * @return A pointer to a
871    * valid binary D-Bus message of @a out_size bytes generated by @a message
872    * or <tt>nullptr</tt> if @a error is set.
873    *
874    * @throws Glib::Error
875    */
876   guchar* to_blob(gsize& out_size, CapabilityFlags capabilities =  CAPABILITY_FLAGS_NONE);
877 
878 
879   /** If @a message is not of type DBUS_MESSAGE_TYPE_ERROR does
880    * nothing and returns <tt>false</tt>.
881    *
882    * Otherwise this method encodes the error in @a message as a Error
883    * using g_dbus_error_set_dbus_error() using the information in the
884    * DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of @a message as
885    * well as the first string item in @a message's body.
886    *
887    * @newin{2,26}
888    *
889    *
890    * @throws Glib::Error
891    */
892   void to_exception();
893 
894   /** Whether the message is locked.
895    *
896    * Default value: <tt>false</tt>
897    *
898    * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
899    * or receive notification when the value of the property changes.
900    */
901   Glib::PropertyProxy_ReadOnly< bool > property_locked() const;
902 
903 
904 public:
905 
906 public:
907   //C++ methods used to invoke GTK+ virtual functions:
908 
909 protected:
910   //GTK+ Virtual Functions (override these to change behaviour):
911 
912   //Default Signal Handlers::
913 
914 
915 };
916 
917 } //namespace DBus
918 
919 } // namespace Gio
920 
921 
922 namespace Glib
923 {
924   /** A Glib::wrap() method for this object.
925    *
926    * @param object The C instance.
927    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
928    * @result A C++ instance that wraps this C instance.
929    *
930    * @relates Gio::DBus::Message
931    */
932   GIOMM_API
933   Glib::RefPtr<Gio::DBus::Message> wrap(GDBusMessage* object, bool take_copy = false);
934 }
935 
936 
937 #endif /* _GIOMM_DBUSMESSAGE_H */
938 
939