added challenge protocol to securely improve lobby connectivity

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-ChatLobby@4735 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-12-26 14:45:45 +00:00
parent 816a477806
commit d4abb42788
4 changed files with 259 additions and 45 deletions

View file

@ -54,6 +54,7 @@ const uint8_t RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG = 0x05 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_MSG = 0x06 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x07 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_ACCEPT = 0x08 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE = 0x09 ;
// for defining tags themselves and msg tags
const uint8_t RS_PKT_SUBTYPE_MSG_TAG_TYPE = 0x03;
@ -128,6 +129,21 @@ class RsChatLobbyMsgItem: public RsChatMsgItem
ChatLobbyNickName nick ;
};
class RsChatLobbyConnectChallengeItem: public RsChatItem
{
public:
RsChatLobbyConnectChallengeItem() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE) {}
RsChatLobbyConnectChallengeItem(void *data,uint32_t size) ; // deserialization
virtual ~RsChatLobbyConnectChallengeItem() {}
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
uint64_t challenge_code ;
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
};
class RsChatLobbyInviteItem: public RsChatItem
{
public:
@ -140,7 +156,6 @@ class RsChatLobbyInviteItem: public RsChatItem
ChatLobbyId lobby_id ;
std::string lobby_name ;
/// TODO !!!
virtual bool serialise(void *data,uint32_t& size) ; // Isn't it better that items can serialize themselves ?
virtual uint32_t serial_size() ; // deserialise is handled using a constructor
};