Added Multiple Channels and Event support to RPC system.

* added chan_id parameter to many RPC calls, this allows RPC to support multiple SSH clients.
     - the combination of (chan_id, req_id) rather than req_id, should be unique now  
     		-> TODO inside rpcserver queued requests.
 * Modified SSH server to match the new API. Multiple client support has not been added here yet.
 * Modified Menu System to match these changes too.
 * Added an Registration Framework to RpcQueueService, to enable easy event support.
 
This code has not been throughly tested yet.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5500 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-09-01 19:35:23 +00:00
parent 46c945de96
commit 9c2f7f39e7
17 changed files with 435 additions and 117 deletions

View file

@ -38,7 +38,7 @@ RpcProtoPeers::RpcProtoPeers(uint32_t serviceId)
//RpcProtoPeers::msgsAccepted(std::list<uint32_t> &msgIds); /* not used at the moment */
int RpcProtoPeers::processMsg(uint32_t msg_id, uint32_t req_id, const std::string &msg)
int RpcProtoPeers::processMsg(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
/* check the msgId */
uint8_t topbyte = getRpcMsgIdExtension(msg_id);
@ -83,13 +83,13 @@ int RpcProtoPeers::processMsg(uint32_t msg_id, uint32_t req_id, const std::strin
switch(submsg)
{
case rsctrl::peers::MsgId_RequestPeers:
processRequestPeers(msg_id, req_id, msg);
processRequestPeers(chan_id, msg_id, req_id, msg);
break;
case rsctrl::peers::MsgId_RequestAddPeer:
processAddPeer(msg_id, req_id, msg);
processAddPeer(chan_id, msg_id, req_id, msg);
break;
case rsctrl::peers::MsgId_RequestModifyPeer:
processModifyPeer(msg_id, req_id, msg);
processModifyPeer(chan_id, msg_id, req_id, msg);
break;
default:
std::cerr << "RpcProtoPeers::processMsg() ERROR should never get here";
@ -102,7 +102,7 @@ int RpcProtoPeers::processMsg(uint32_t msg_id, uint32_t req_id, const std::strin
}
int RpcProtoPeers::processAddPeer(uint32_t msg_id, uint32_t req_id, const std::string &msg)
int RpcProtoPeers::processAddPeer(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
std::cerr << "RpcProtoPeers::processAddPeer() NOT FINISHED";
std::cerr << std::endl;
@ -136,13 +136,13 @@ int RpcProtoPeers::processAddPeer(uint32_t msg_id, uint32_t req_id, const std::s
rsctrl::peers::MsgId_ResponseAddPeer, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
queueResponse(chan_id, out_msg_id, req_id, outmsg);
return 1;
}
int RpcProtoPeers::processModifyPeer(uint32_t msg_id, uint32_t req_id, const std::string &msg)
int RpcProtoPeers::processModifyPeer(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
std::cerr << "RpcProtoPeers::processModifyPeer() NOT FINISHED";
std::cerr << std::endl;
@ -177,14 +177,14 @@ int RpcProtoPeers::processModifyPeer(uint32_t msg_id, uint32_t req_id, const std
rsctrl::peers::MsgId_ResponseModifyPeer, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
queueResponse(chan_id, out_msg_id, req_id, outmsg);
return 1;
}
int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const std::string &msg)
int RpcProtoPeers::processRequestPeers(uint32_t chan_id, uint32_t msg_id, uint32_t req_id, const std::string &msg)
{
std::cerr << "RpcProtoPeers::processRequestPeers()";
std::cerr << std::endl;
@ -421,7 +421,7 @@ int RpcProtoPeers::processRequestPeers(uint32_t msg_id, uint32_t req_id, const s
rsctrl::peers::MsgId_ResponsePeerList, true);
// queue it.
queueResponse(out_msg_id, req_id, outmsg);
queueResponse(chan_id, out_msg_id, req_id, outmsg);
return 1;
}