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. More...
 
 WvDBusMsg (DBusMessage *_msg)
 Constructs a new WvDBus message from an existing low-level D-Bus message. More...
 
 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. More...
 
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. More...
 
WvDBusMsgvariant_end ()
 End a variant. More...
 
WvDBusMsgstruct_start (WvStringParm element_type)
 Start a struct. More...
 
WvDBusMsgstruct_end ()
 End a struct started with struct_start(). More...
 
WvDBusMsgarray_start (WvStringParm element_type)
 Start an array. More...
 
WvDBusMsgarray_end ()
 End an array started with array_start(). More...
 
WvDBusMsgvarray_start (WvStringParm element_type)
 Start a variant-array. More...
 
WvDBusMsgvarray_end ()
 End an array started with array_start(). More...
 
WvDBusMsg reply ()
 Generate a message that will be a reply to this one. More...
 
bool iserror () const
 Return true if this message is an error response. More...
 
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() [1/3]

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

◆ WvDBusMsg() [2/3]

WvDBusMsg::WvDBusMsg ( WvDBusMsg _msg)

Constructs a new WvDBus message, copying it out of an old one.

Definition at line 331 of file wvdbusmsg.cc.

References WvList< T >::prepend().

◆ WvDBusMsg() [3/3]

WvDBusMsg::WvDBusMsg ( DBusMessage *  _msg)

Constructs a new WvDBus message from an existing low-level D-Bus message.

Definition at line 339 of file wvdbusmsg.cc.

References WvList< T >::prepend().

◆ ~WvDBusMsg()

WvDBusMsg::~WvDBusMsg ( )
virtual

Definition at line 347 of file wvdbusmsg.cc.

Member Function Documentation

◆ operator DBusMessage *()

WvDBusMsg::operator DBusMessage * ( ) const

Definition at line 353 of file wvdbusmsg.cc.

◆ 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().

◆ get_sender()

WvString WvDBusMsg::get_sender ( ) const

Definition at line 359 of file wvdbusmsg.cc.

◆ get_dest()

WvString WvDBusMsg::get_dest ( ) const

Definition at line 365 of file wvdbusmsg.cc.

◆ get_path()

WvString WvDBusMsg::get_path ( ) const

Definition at line 371 of file wvdbusmsg.cc.

◆ get_interface()

WvString WvDBusMsg::get_interface ( ) const

Definition at line 377 of file wvdbusmsg.cc.

◆ get_member()

WvString WvDBusMsg::get_member ( ) const

Definition at line 383 of file wvdbusmsg.cc.

◆ get_error()

WvString WvDBusMsg::get_error ( ) const

Definition at line 389 of file wvdbusmsg.cc.

◆ get_serial()

uint32_t WvDBusMsg::get_serial ( ) const

Definition at line 406 of file wvdbusmsg.cc.

◆ get_replyserial()

uint32_t WvDBusMsg::get_replyserial ( ) const

Definition at line 412 of file wvdbusmsg.cc.

◆ is_reply()

bool WvDBusMsg::is_reply ( ) const

Definition at line 397 of file wvdbusmsg.cc.

◆ operator WvString()

WvDBusMsg::operator WvString ( ) const

Definition at line 430 of file wvdbusmsg.cc.

◆ get_arglist()

void WvDBusMsg::get_arglist ( WvStringList list) const

Definition at line 418 of file wvdbusmsg.cc.

◆ get_argstr()

WvString WvDBusMsg::get_argstr ( ) const

Definition at line 424 of file wvdbusmsg.cc.

◆ append() [1/11]

WvDBusMsg & WvDBusMsg::append ( const char *  s)

The following methods are designed to allow appending various arguments to the message.

Definition at line 461 of file wvdbusmsg.cc.

References WvList< T >::first().

Referenced by WvDBusConn::request_name().

◆ append() [2/11]

WvDBusMsg & WvDBusMsg::append ( bool  b)

Definition at line 470 of file wvdbusmsg.cc.

◆ append() [3/11]

WvDBusMsg & WvDBusMsg::append ( signed char  c)

Definition at line 479 of file wvdbusmsg.cc.

◆ append() [4/11]

WvDBusMsg & WvDBusMsg::append ( unsigned char  c)

Definition at line 488 of file wvdbusmsg.cc.

◆ append() [5/11]

WvDBusMsg & WvDBusMsg::append ( int16_t  i)

Definition at line 497 of file wvdbusmsg.cc.

◆ append() [6/11]

WvDBusMsg & WvDBusMsg::append ( uint16_t  i)

Definition at line 505 of file wvdbusmsg.cc.

◆ append() [7/11]

WvDBusMsg & WvDBusMsg::append ( int32_t  i)

Definition at line 513 of file wvdbusmsg.cc.

◆ append() [8/11]

WvDBusMsg & WvDBusMsg::append ( uint32_t  i)

Definition at line 521 of file wvdbusmsg.cc.

◆ append() [9/11]

WvDBusMsg & WvDBusMsg::append ( int64_t  i)

Definition at line 529 of file wvdbusmsg.cc.

◆ append() [10/11]

WvDBusMsg & WvDBusMsg::append ( uint64_t  i)

Definition at line 537 of file wvdbusmsg.cc.

◆ append() [11/11]

WvDBusMsg & WvDBusMsg::append ( double  d)

Definition at line 545 of file wvdbusmsg.cc.

◆ variant_start()

WvDBusMsg & WvDBusMsg::variant_start ( WvStringParm  element_type)

Start a variant.

Definition at line 553 of file wvdbusmsg.cc.

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

Referenced by varray_start().

◆ variant_end()

WvDBusMsg & WvDBusMsg::variant_end ( )

End a variant.

Definition at line 564 of file wvdbusmsg.cc.

References WvListBase::count(), and WvList< T >::unlink_first().

Referenced by array_end(), and varray_end().

◆ 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().

◆ struct_end()

WvDBusMsg & WvDBusMsg::struct_end ( )

End a struct started with struct_start().

Definition at line 591 of file wvdbusmsg.cc.

References array_end().

◆ 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().

◆ array_end()

WvDBusMsg & WvDBusMsg::array_end ( )

End an array started with array_start().

Definition at line 608 of file wvdbusmsg.cc.

References variant_end().

Referenced by struct_end(), and varray_end().

◆ 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().

◆ varray_end()

WvDBusMsg & WvDBusMsg::varray_end ( )

End an array started with array_start().

Definition at line 621 of file wvdbusmsg.cc.

References array_end(), WvListBase::count(), and variant_end().

◆ reply()

WvDBusMsg WvDBusMsg::reply ( )

Generate a message that will be a reply to this one.

Definition at line 629 of file wvdbusmsg.cc.

◆ iserror()

bool WvDBusMsg::iserror ( ) const

Return true if this message is an error response.

Definition at line 635 of file wvdbusmsg.cc.

◆ 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().

Member Data Documentation

◆ msg

DBusMessage* WvDBusMsg::msg
mutableprotected

Definition at line 286 of file wvdbusmsg.h.

◆ itlist

WvList<DBusMessageIter> WvDBusMsg::itlist
protected

Definition at line 287 of file wvdbusmsg.h.


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