dbus-cxx
DBus::MethodProxyBase Class Reference

Base class for all proxy(remote) methods. More...

#include <methodproxybase.h>

Inheritance diagram for DBus::MethodProxyBase:

Public Member Functions

 ~MethodProxyBase ()
 
InterfaceProxyinterface_name () const
 
const std::string & name () const
 
std::shared_ptr< CallMessagecreate_call_message () const
 
std::shared_ptr< const ReturnMessagecall (std::shared_ptr< const CallMessage >, int timeout_milliseconds=-1) const
 
void enable_interactive_authorization (unsigned int timeout_milliseconds=0)
 Enable interactive authorization for method call. More...
 
void disable_interactive_authorization ()
 Disable interactive authorization for method call. More...
 

Static Public Member Functions

static std::shared_ptr< MethodProxyBasecreate (const std::string &name)
 

Protected Member Functions

 MethodProxyBase (const std::string &name)
 
 MethodProxyBase (const MethodProxyBase &other)
 

Private Member Functions

void set_interface (InterfaceProxy *proxy)
 
 DBUS_CXX_PROPAGATE_CONST (std::unique_ptr< priv_data >) m_priv
 

Friends

class InterfaceProxy
 

Detailed Description

Base class for all proxy(remote) methods.

This class allows remote methods to be used in a generic manner, as the MethodProxy class is templated and thus cannot be used in a generic manner(e.g. stored in a vector).

Author
Rick L Vinyard Jr rviny.nosp@m.ard@.nosp@m.cs.nm.nosp@m.su.e.nosp@m.du

Constructor & Destructor Documentation

◆ MethodProxyBase() [1/2]

DBus::MethodProxyBase::MethodProxyBase ( const std::string &  name)
protected

Referenced by create().

◆ MethodProxyBase() [2/2]

DBus::MethodProxyBase::MethodProxyBase ( const MethodProxyBase other)
protected

◆ ~MethodProxyBase()

DBus::MethodProxyBase::~MethodProxyBase ( )

Member Function Documentation

◆ call()

std::shared_ptr< const ReturnMessage > DBus::MethodProxyBase::call ( std::shared_ptr< const CallMessage call_message,
int  timeout_milliseconds = -1 
) const

◆ create()

std::shared_ptr< MethodProxyBase > DBus::MethodProxyBase::create ( const std::string &  name)
static

References MethodProxyBase(), and name().

◆ create_call_message()

std::shared_ptr< CallMessage > DBus::MethodProxyBase::create_call_message ( ) const

◆ DBUS_CXX_PROPAGATE_CONST()

DBus::MethodProxyBase::DBUS_CXX_PROPAGATE_CONST ( std::unique_ptr< priv_data >  )
private

◆ disable_interactive_authorization()

void DBus::MethodProxyBase::disable_interactive_authorization ( )

Disable interactive authorization for method call.

See enable_interactive_authorization() for more info.

If enable_interactive_authorization() was called already, the timeout set by it is cleared by this function. The timeout_milliseconds argument of call() will no longer be overriden.

◆ enable_interactive_authorization()

void DBus::MethodProxyBase::enable_interactive_authorization ( unsigned int  timeout_milliseconds = 0)

Enable interactive authorization for method call.

To quote the D-Bus specification:

‍This flag may be set on a method call message to inform the receiving side that the caller is prepared to wait for interactive authorization, which might take a considerable time to complete. For instance, if this flag is set, it would be appropriate to query the user for passwords or confirmation via Polkit or a similar framework.

This flag is only useful when unprivileged code calls a more privileged method call, and an authorization framework is deployed that allows possibly interactive authorization. If no such framework is deployed it has no effect. This flag should not be set by default by client implementations. If it is set, the caller should also set a suitably long timeout on the method call to make sure the user interaction may complete. This flag is only valid for method call messages, and shall be ignored otherwise.

If a this flag is not set on a method call, and a service determines that the requested operation is not allowed without interactive authorization, but could be allowed after successful interactive authorization, it may return the DBus::ErrorInteractiveAuthorizationRequired error.

The absence of this flag does not guarantee that interactive authorization will not be applied, since existing services that pre-date this flag might already use interactive authorization. However, existing D-Bus APIs that will use interactive authorization should document that the call may take longer than usual, and new D-Bus APIs should avoid interactive authorization in the absence of this flag.

Disabled by default.

Note
Any call messages created by create_call_message() before this function is called will retain the old behavior. If that is not desirable, call create_call_message() again after this function is called and use the new return value.
Parameters
timeoutTimeout of the request in milliseconds. If set to zero, no timeout is imposed. This timeout overrides the timeout_milliseconds argument of call() (used in MethodProxy).
Exceptions
std::invalid_argumentIf timeout_milliseconds doesn't fit into a signed int.

◆ interface_name()

InterfaceProxy * DBus::MethodProxyBase::interface_name ( ) const

◆ name()

const std::string & DBus::MethodProxyBase::name ( ) const

Referenced by create().

◆ set_interface()

void DBus::MethodProxyBase::set_interface ( InterfaceProxy proxy)
private

Friends And Related Function Documentation

◆ InterfaceProxy

friend class InterfaceProxy
friend

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