#include <ulxr_requester.h>
Collaboration diagram for ulxr::Requester:
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 |
Protocol * | protocol |
unsigned | cntPendingRequests |
Mutex | pendingMutex |
Friends | |
void * | dispatchThreaded (DispatcherData *data) |
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.
ulxr::Requester::Requester | ( | Protocol * | prot, | |
bool | wbxml_mode = false | |||
) |
Constructs a requester.
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] |
MethodResponse ulxr::Requester::call | ( | const MethodCall & | call, | |
const CppString & | resource | |||
) |
Performs a virtual call to the remote method "behind" the connection.
call | the data for the call | |
resource | resource for rpc on remote host |
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.
call | the data for the call | |
resource | resource for rpc on remote host | |
user | user name | |
pass | password |
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.
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.
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.
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.
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.
conn | connection to wait for data | |
wbxml | true: use wbxml mode |
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.
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.
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.
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.
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.
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()
.
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()
.
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()
.
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().
void* dispatchThreaded | ( | DispatcherData * | data | ) | [friend] |
bool ulxr::Requester::wbxml_mode [private] |
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] |
Mutex ulxr::Requester::pendingMutex [private] |
Definition at line 331 of file ulxr_requester.h.