X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/eeab3e6cade87c1fe0a5f3d93522e12ccb9ec2ab..f2170465073de34adf89161d4287182b518352c4:/rpc/rpc.h diff --git a/rpc/rpc.h b/rpc/rpc.h index 1348dc8..c0420a5 100644 --- a/rpc/rpc.h +++ b/rpc/rpc.h @@ -36,10 +36,10 @@ class rpcc : public chanmgr { //manages per rpc info struct caller { - caller(unsigned int xxid, unmarshall *un); + caller(int xxid, unmarshall *un); ~caller(); - unsigned int xid; + int xid; unmarshall *un; int intret; bool done; @@ -48,14 +48,14 @@ class rpcc : public chanmgr { }; void get_refconn(connection **ch); - void update_xid_rep(unsigned int xid); + void update_xid_rep(int xid); sockaddr_in dst_; unsigned int clt_nonce_; unsigned int srv_nonce_; bool bind_done_; - unsigned int xid_; + int xid_; int lossytest_; bool retrans_; bool reachable_; @@ -69,7 +69,7 @@ class rpcc : public chanmgr { std::condition_variable destroy_wait_c_; std::map calls_; - std::list xid_rep_window_; + std::list xid_rep_window_; struct request { request() { clear(); } @@ -167,25 +167,25 @@ class rpcs : public chanmgr { // has been sent; in that case buf points to a copy of the reply, // and sz holds the size of the reply. struct reply_t { - reply_t (unsigned int _xid) { + reply_t (int _xid) { xid = _xid; cb_present = false; buf = NULL; sz = 0; } - reply_t (unsigned int _xid, char *_buf, int _sz) { + reply_t (int _xid, char *_buf, size_t _sz) { xid = _xid; cb_present = true; buf = _buf; sz = _sz; } - unsigned int xid; + int xid; bool cb_present; // whether the reply buffer is valid char *buf; // the reply buffer - int sz; // the size of reply buffer + size_t sz; // the size of reply buffer }; - int port_; + unsigned int port_; unsigned int nonce_; // provide at most once semantics by maintaining a window of replies @@ -194,11 +194,11 @@ class rpcs : public chanmgr { std::map > reply_window_; void free_reply_window(void); - void add_reply(unsigned int clt_nonce, unsigned int xid, char *b, int sz); + void add_reply(unsigned int clt_nonce, int xid, char *b, size_t sz); rpcstate_t checkduplicate_and_update(unsigned int clt_nonce, - unsigned int xid, unsigned int rep_xid, - char **b, int *sz); + int xid, int rep_xid, + char **b, size_t *sz); void updatestat(unsigned int proc); @@ -206,15 +206,15 @@ class rpcs : public chanmgr { std::map conns_; // counting - const int counting_; - int curr_counts_; - std::map counts_; + const size_t counting_; + size_t curr_counts_; + std::map counts_; int lossytest_; bool reachable_; // map proc # to function - std::map procs_; + std::map procs_; std::mutex procs_m_; // protect insert/delete to procs[] std::mutex count_m_; //protect modification of counts @@ -225,9 +225,9 @@ class rpcs : public chanmgr { protected: struct djob_t { - djob_t (connection *c, char *b, int bsz):buf(b),sz(bsz),conn(c) {} + djob_t (connection *c, char *b, size_t bsz):buf(b),sz(bsz),conn(c) {} char *buf; - int sz; + size_t sz; connection *conn; }; void dispatch(djob_t *); @@ -239,11 +239,11 @@ class rpcs : public chanmgr { tcpsconn* listener_; public: - rpcs(unsigned int port, int counts=0); + rpcs(unsigned int port, size_t counts=0); ~rpcs(); - inline int port() { return listener_->port(); } + inline unsigned int port() { return listener_->port(); } //RPC handler for clients binding - int rpcbind(int &r, int a); + int rpcbind(unsigned int &r, int a); void set_reachable(bool r) { reachable_ = r; } @@ -262,8 +262,8 @@ template void rpcs::reg(unsigned int proc, F f, C *c) { reg1(proc, marshalled_func::wrap(f, c)); } -void make_sockaddr(const char *hostandport, struct sockaddr_in *dst); -void make_sockaddr(const char *host, const char *port, - struct sockaddr_in *dst); +void make_sockaddr(const std::string &hostandport, struct sockaddr_in *dst); +void make_sockaddr(const std::string &host, const std::string &port, struct + sockaddr_in *dst); #endif