-template<class R, class A1>
-int rsm_client::call(unsigned int proc, const A1 & a1, R & r) {
- marshall m;
- m << a1;
- return call_m(proc, m, r);
-}
-
-template<class R, class A1, class A2>
-int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, R & r) {
- marshall m;
- m << a1;
- m << a2;
- return call_m(proc, m, r);
-}
-
-template<class R, class A1, class A2, class A3>
-int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, R & r) {
- marshall m;
- std::string rep;
- std::string res;
- m << a1;
- m << a2;
- m << a3;
- return call_m(proc, m, r);
-}
-
-template<class R, class A1, class A2, class A3, class A4>
-int rsm_client::call(unsigned int proc, const A1 & a1, const A2 & a2, const A3 & a3, const A4 & a4, R & r) {
- marshall m;
- std::string rep;
- std::string res;
- m << a1;
- m << a2;
- m << a3;
- m << a4;
- return call_m(proc, m, r);
+template<class R>
+int rsm_client::call_m(unsigned int proc, R & r, const marshall & req) {
+ string rep;
+ string res;
+ int intret = invoke(proc, rep, req.content());
+ VERIFY( intret == rsm_client_protocol::OK );
+ unmarshall u(rep, false);
+ u >> intret;
+ if (intret < 0) return intret;
+ u >> res;
+ if (!u.okdone()) {
+ LOG("failed to unmarshall the reply.");
+ LOG("You probably forgot to set the reply string in " <<
+ "rsm::client_invoke, or you may have called RPC " <<
+ "0x" << hex << proc << " with the wrong return type");
+ LOG("here's what I got: \"" << hexify(rep) << "\"");
+ VERIFY(0);
+ return rpc_const::unmarshal_reply_failure;
+ }
+ unmarshall u1(res, false);
+ u1 >> r;
+ if(!u1.okdone()) {
+ LOG("failed to unmarshall the reply.");
+ LOG("You are probably calling RPC 0x" << hex << proc <<
+ " with the wrong return type.");
+ LOG("here's what I got: \"" << hexify(res) << "\"");
+ VERIFY(0);
+ return rpc_const::unmarshal_reply_failure;
+ }
+ return intret;