#ifndef rpc_h
#define rpc_h
+#include "types.h"
#include <sys/socket.h>
#include <netinet/in.h>
-#include <list>
-#include <map>
-#include <stdio.h>
#include "thr_pool.h"
#include "marshall.h"
#include "connection.h"
-#include "lock.h"
-
-using std::string;
-using std::map;
-using std::list;
class rpc_const {
public:
//manages per rpc info
struct caller {
- caller(int xxid, unmarshall *un);
- ~caller();
+ caller(int _xid, unmarshall *_un) : xid(_xid), un(_un) {}
int xid;
unmarshall *un;
int intret;
- bool done;
+ bool done = false;
mutex m;
cond c;
};
if (intret < 0) return intret;
u >> r;
if (u.okdone() != true) {
- fprintf(stderr, "rpcc::call_m: failed to unmarshall the reply."
- "You are probably calling RPC 0x%x with wrong return "
- "type.\n", proc);
+ cerr << "rpcc::call_m: failed to unmarshall the reply. You are probably " <<
+ "calling RPC 0x" << hex << proc << " with the wrong return type." << endl;
VERIFY(0);
return rpc_const::unmarshal_reply_failure;
}