ulxr::Requester Class Reference
[XML-RPC handling]

XML RPC Requester (rpc client). More...

#include <ulxr_requester.h>

Collaboration diagram for ulxr::Requester:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Requester (Protocol *prot, bool wbxml_mode=false)
 Constructs a requester.
virtual ~Requester ()
 Destroys the requester.
MethodResponse call (const MethodCall &call, const CppString &resource)
 Performs a virtual call to the remote method "behind" the connection.
MethodResponse call (const MethodCall &call, const CppString &resource, const CppString &user, const CppString &pass)
 Performs a virtual call to the remote method "behind" the connection.
void call (const MethodCall &call, const CppString &resource, hidden::Receiver_t recv)
 Performs a virtual call to the remote method "behind" the connection and passes handling of result to a worker function in multitasking mode.
void call (const MethodCall &call, const CppString &resource, const CppString &user, const CppString &pass, hidden::Receiver_t recv)
 Performs a virtual call to the remote method "behind" the connection and passes handling of result to a worker function in multitasking mode.
void transmit (const MethodCall &call, const CppString &resource)
 Performs a virtual call to the remote method without waiting for (or accepting) a reply.
void transmit (const MethodCall &call, const CppString &resource, const CppString &user, const CppString &pass)
 Performs a virtual call to the remote method without waiting for (or accepting) a reply.
unsigned numPendingRequests () const
 Returns the number of pending requests.
bool isWbXml () const
 Returns true is wbxml is to be used.

Static Public Member Functions

static MethodResponse waitForResponse (Protocol *conn, bool wbxml)
 Waits for the response from the remote server.

Protected Member Functions

void send_call (const MethodCall &call, const CppString &resource)
 Sends the call data to the remote method.
MethodResponse waitForResponse ()
 Waits for the response from the remote server.
void startDispatch (const MethodCall &call, const CppString &resource, hidden::Receiver_t recv)
 Waits for the response and dispatches it in multitasked mode.

Private Member Functions

virtual void forwardException ()
 Forwards an unknown exception from dispatchThreaded().
virtual void forwardException (const Exception &ex)
 Forwards an ulxr::Exception from dispatchThreaded().
virtual void forwardException (const std::exception &ex)
 Forwards a std::exception from dispatchThreaded().
void incPending ()
 Increments the number of pending requests.
void decPending ()
 Decrements the number of pending requests.

Private Attributes

bool wbxml_mode
Protocolprotocol
unsigned cntPendingRequests
Mutex pendingMutex

Friends

void * dispatchThreaded (DispatcherData *data)

Detailed Description

XML RPC Requester (rpc client).

The requester takes the MethodCall, converts it to xml and sends it over the connection. It then waits for the response which must be further processes by the caller.

Definition at line 152 of file ulxr_requester.h.


Constructor & Destructor Documentation

ulxr::Requester::Requester ( Protocol prot,
bool  wbxml_mode = false 
)

Constructs a requester.

Parameters:
prot pointer to an existing Connection
wbxml_mode true: data is sent as wbxml

Definition at line 65 of file ulxr_requester.cpp.

References cntPendingRequests, protocol, and wbxml_mode.

ulxr::Requester::~Requester (  )  [virtual]

Destroys the requester.

Definition at line 73 of file ulxr_requester.cpp.


Member Function Documentation

MethodResponse ulxr::Requester::call ( const MethodCall call,
const CppString resource 
)

Performs a virtual call to the remote method "behind" the connection.

Parameters:
call the data for the call
resource resource for rpc on remote host
Returns:
the methods response

Definition at line 219 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

MethodResponse ulxr::Requester::call ( const MethodCall call,
const CppString resource,
const CppString user,
const CppString pass 
)

Performs a virtual call to the remote method "behind" the connection.

Parameters:
call the data for the call
resource resource for rpc on remote host
user user name
pass password
Returns:
the methods response

Definition at line 208 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

void ulxr::Requester::call ( const MethodCall call,
const CppString resource,
hidden::Receiver_t  recv 
)

Performs a virtual call to the remote method "behind" the connection and passes handling of result to a worker function in multitasking mode.

This method itself returns immediately.

Attention:
the dispatcher object itself is not thread-safe!
Parameters:
call the data for the call
resource resource for rpc on remote host
recv receiver function

Definition at line 430 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

void ulxr::Requester::call ( const MethodCall call,
const CppString resource,
const CppString user,
const CppString pass,
hidden::Receiver_t  recv 
)

Performs a virtual call to the remote method "behind" the connection and passes handling of result to a worker function in multitasking mode.

This method itself returns immediately.

Attention:
the dispatcher object itself is not thread-safe!
Parameters:
call the data for the call
resource resource for rpc on remote host
user user name
pass password
recv receiver function

Definition at line 417 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

void ulxr::Requester::transmit ( const MethodCall call,
const CppString resource 
)

Performs a virtual call to the remote method without waiting for (or accepting) a reply.

Parameters:
call the data for the call
resource resource for rpc on remote host

Definition at line 452 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

void ulxr::Requester::transmit ( const MethodCall call,
const CppString resource,
const CppString user,
const CppString pass 
)

Performs a virtual call to the remote method without waiting for (or accepting) a reply.

Parameters:
call the data for the call
resource resource for rpc on remote host
user user name
pass password

Definition at line 441 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

MethodResponse ulxr::Requester::waitForResponse ( Protocol conn,
bool  wbxml 
) [static]

Waits for the response from the remote server.

Parameters:
conn connection to wait for data
wbxml true: use wbxml mode
Returns:
methode response

Definition at line 103 of file ulxr_requester.cpp.

References ulxr::binaryDebugOutput(), ulxr::Protocol::ConnBody, ulxr::Protocol::ConnError, ulxr::Protocol::ConnSwitchToBody, ulxr::MethodResponseParserBase::getMethodResponse(), ulxr::NotConformingError, ulxr::TransportError, ULXR_DOUT_READ, ULXR_DOUT_XML, ULXR_GET_STRING, ulxr_i18n, ULXR_PCHAR, ULXR_RECV_BUFFER_SIZE, and ULXR_TRACE.

unsigned ulxr::Requester::numPendingRequests (  )  const

Returns the number of pending requests.

Returns:
number of still pending requests in threads

Definition at line 463 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

bool ulxr::Requester::isWbXml (  )  const

Returns true is wbxml is to be used.

Returns:
tre when in wbxmlmode

Definition at line 504 of file ulxr_requester.cpp.

Referenced by ulxr::dispatchThreaded().

void ulxr::Requester::send_call ( const MethodCall call,
const CppString resource 
) [protected]

Sends the call data to the remote method.

Parameters:
call the data for the call
resource resource for rpc on remote host

Definition at line 78 of file ulxr_requester.cpp.

References ulxr::MethodCall::getMethodName(), ulxr::Protocol::isOpen(), ulxr::Protocol::open(), protocol, ulxr::Protocol::resetConnection(), ulxr::Protocol::sendRpcCall(), ulxr::Protocol::setPersistent(), ULXR_PCHAR, ULXR_TRACE, and wbxml_mode.

Referenced by startDispatch().

MethodResponse ulxr::Requester::waitForResponse (  )  [protected]

Waits for the response from the remote server.

Returns:
methode response

Definition at line 95 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

Referenced by ulxr::dispatchThreaded().

void ulxr::Requester::startDispatch ( const MethodCall call,
const CppString resource,
hidden::Receiver_t  recv 
) [protected]

Waits for the response and dispatches it in multitasked mode.

Attention:
the dispatcher object itself is not thread-safe but your reciever function has to!
Parameters:
call the data for the call
resource resource for rpc on remote host
recv receiver method

Definition at line 346 of file ulxr_requester.cpp.

References ulxr::Protocol::detach(), dispatchThreaded, ulxr::Protocol::getConnection(), ulxr::Connection::getLastError(), ulxr::getLastErrorString(), protocol, send_call(), ulxr::SystemError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.

void ulxr::Requester::forwardException (  )  [private, virtual]

Forwards an unknown exception from dispatchThreaded().

Note:
This function must return to free resources and return an error value afterwards.

Definition at line 487 of file ulxr_requester.cpp.

Referenced by ulxr::dispatchThreaded().

void ulxr::Requester::forwardException ( const Exception ex  )  [private, virtual]

Forwards an ulxr::Exception from dispatchThreaded().

Note:
This function must return to free resources and return an error value afterwards.
Parameters:
ex Exception

Definition at line 497 of file ulxr_requester.cpp.

void ulxr::Requester::forwardException ( const std::exception &  ex  )  [private, virtual]

Forwards a std::exception from dispatchThreaded().

Note:
This function must return to free resources and return an error value afterwards.
Parameters:
ex Exception

Definition at line 492 of file ulxr_requester.cpp.

void ulxr::Requester::incPending (  )  [private]

Increments the number of pending requests.

Definition at line 470 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

Referenced by ulxr::dispatchThreaded().

void ulxr::Requester::decPending (  )  [private]

Decrements the number of pending requests.

Definition at line 478 of file ulxr_requester.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

Referenced by ulxr::dispatchThreaded().


Friends And Related Function Documentation

void* dispatchThreaded ( DispatcherData data  )  [friend]

Definition at line 296 of file ulxr_requester.cpp.

Referenced by startDispatch().


Member Data Documentation

bool ulxr::Requester::wbxml_mode [private]

Definition at line 328 of file ulxr_requester.h.

Referenced by Requester(), and send_call().

Protocol* ulxr::Requester::protocol [private]

Definition at line 329 of file ulxr_requester.h.

Referenced by Requester(), send_call(), and startDispatch().

unsigned ulxr::Requester::cntPendingRequests [private]

Definition at line 330 of file ulxr_requester.h.

Referenced by Requester().

Mutex ulxr::Requester::pendingMutex [private]

Definition at line 331 of file ulxr_requester.h.


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 20:09:07 2007 for ulxmlrpcpp by  doxygen 1.5.1