WvStreams
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
WvDBusMsg Class Reference
Inheritance diagram for WvDBusMsg:
Inheritance graph
[legend]

Classes

class  Iter
 

Public Member Functions

 WvDBusMsg (WvStringParm busname, WvStringParm objectname, WvStringParm ifc, WvStringParm method)
 Constructs a new WvDBus message. More...
 
 WvDBusMsg (WvDBusMsg &_msg)
 Constructs a new WvDBus message, copying it out of an old one.
 
 WvDBusMsg (DBusMessage *_msg)
 Constructs a new WvDBus message from an existing low-level D-Bus message.
 
 operator DBusMessage * () const
 
void marshal (WvBuf &buf)
 Locks this message, encodes it in DBus binary protocol format, and adds it to the given buffer. More...
 
WvString get_sender () const
 
WvString get_dest () const
 
WvString get_path () const
 
WvString get_interface () const
 
WvString get_member () const
 
WvString get_error () const
 
uint32_t get_serial () const
 
uint32_t get_replyserial () const
 
bool is_reply () const
 
 operator WvString () const
 
void get_arglist (WvStringList &list) const
 
WvString get_argstr () const
 
WvDBusMsgappend (const char *s)
 The following methods are designed to allow appending various arguments to the message.
 
WvDBusMsgappend (bool b)
 
WvDBusMsgappend (signed char c)
 
WvDBusMsgappend (unsigned char c)
 
WvDBusMsgappend (int16_t i)
 
WvDBusMsgappend (uint16_t i)
 
WvDBusMsgappend (int32_t i)
 
WvDBusMsgappend (uint32_t i)
 
WvDBusMsgappend (int64_t i)
 
WvDBusMsgappend (uint64_t i)
 
WvDBusMsgappend (double d)
 
WvDBusMsgvariant_start (WvStringParm element_type)
 Start a variant.
 
WvDBusMsgvariant_end ()
 End a variant.
 
WvDBusMsgstruct_start (WvStringParm element_type)
 Start a struct. More...
 
WvDBusMsgstruct_end ()
 End a struct started with struct_start().
 
WvDBusMsgarray_start (WvStringParm element_type)
 Start an array. More...
 
WvDBusMsgarray_end ()
 End an array started with array_start().
 
WvDBusMsgvarray_start (WvStringParm element_type)
 Start a variant-array. More...
 
WvDBusMsgvarray_end ()
 End an array started with array_start().
 
WvDBusMsg reply ()
 Generate a message that will be a reply to this one.
 
bool iserror () const
 Return true if this message is an error response.
 
void send (WvDBusConn &conn)
 A shortcut for sending this message on the given connection. More...
 

Static Public Member Functions

static WvDBusMsgdemarshal (WvBuf &buf)
 Demarshals a new WvDBusMsg from a buffer containing its binary DBus protocol representation. More...
 
static size_t demarshal_bytes_needed (WvBuf &buf)
 Given a buffer containing what might be the header of a DBus message, checks how many bytes need to be in the buffer in order for it to contain a whole message. More...
 

Protected Attributes

DBusMessage * msg
 
WvList< DBusMessageIter > itlist
 

Detailed Description

Definition at line 28 of file wvdbusmsg.h.

Constructor & Destructor Documentation

◆ WvDBusMsg()

WvDBusMsg::WvDBusMsg ( WvStringParm  busname,
WvStringParm  objectname,
WvStringParm  ifc,
WvStringParm  method 
)

Constructs a new WvDBus message.

If destination is blank, no destination is set; this is appropriate when using D-BUS in a peer-to-peer context (no message bus).

Definition at line 323 of file wvdbusmsg.cc.

References WvList< T >::prepend().

Referenced by demarshal().

Member Function Documentation

◆ demarshal()

WvDBusMsg * WvDBusMsg::demarshal ( WvBuf buf)
static

Demarshals a new WvDBusMsg from a buffer containing its binary DBus protocol representation.

You're responsible for freeing the object when done. Returns NULL if the object can't be extracted from the buffer. (Implementation in wvdbusmarshal.cc)

Definition at line 27 of file wvdbusmarshal.cc.

References WvBufBaseCommonImpl< T >::get(), WvBufBaseCommonImpl< T >::peek(), WvBufBaseCommonImpl< T >::used(), and WvDBusMsg().

◆ demarshal_bytes_needed()

size_t WvDBusMsg::demarshal_bytes_needed ( WvBuf buf)
static

Given a buffer containing what might be the header of a DBus message, checks how many bytes need to be in the buffer in order for it to contain a whole message.

If the return value is <= the number of bytes already in the buffer, then demarshal() will succeed (or the incoming message is corrupt). (Implementation in wvdbusmarshal.cc)

Definition at line 70 of file wvdbusmarshal.cc.

References WvBufBaseCommonImpl< T >::peek(), and WvBufBaseCommonImpl< T >::used().

◆ marshal()

void WvDBusMsg::marshal ( WvBuf buf)

Locks this message, encodes it in DBus binary protocol format, and adds it to the given buffer.

This message becomes locked and can no longer be append()ed to. You can marshal it more than once, however (but it will always have the same serial number!!) (Implementation in wvdbusmarshal.cc)

Definition at line 83 of file wvdbusmarshal.cc.

Referenced by WvDBusConn::send().

◆ struct_start()

WvDBusMsg & WvDBusMsg::struct_start ( WvStringParm  element_type)

Start a struct.

Elements append()ed after this will be inside the struct, and you should be careful that you append the right types in the right order. Finish using struct_end().

Definition at line 580 of file wvdbusmsg.cc.

References WvList< T >::first(), and WvList< T >::prepend().

◆ array_start()

WvDBusMsg & WvDBusMsg::array_start ( WvStringParm  element_type)

Start an array.

Elements append()ed after this will be inside the array. Finish using array_end().

Definition at line 597 of file wvdbusmsg.cc.

References WvList< T >::first(), and WvList< T >::prepend().

Referenced by varray_start().

◆ varray_start()

WvDBusMsg & WvDBusMsg::varray_start ( WvStringParm  element_type)

Start a variant-array.

Elements append()ed after this will be inside the array. Finish using varray_end().

A variant-array is like an array, but is enclosed automatically inside a variant object. This is useful for arrays of arrays, where each inner array is of a different type.

Definition at line 614 of file wvdbusmsg.cc.

References array_start(), and variant_start().

◆ send()

void WvDBusMsg::send ( WvDBusConn conn)

A shortcut for sending this message on the given connection.

Equivalent to conn.send(*this).

Definition at line 641 of file wvdbusmsg.cc.

References WvDBusConn::send().


The documentation for this class was generated from the following files: