fixed proper display of crypto params for UDP connections

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6725 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-09-10 19:31:44 +00:00
parent 1af7d88d56
commit 9d8d773c3c
6 changed files with 53 additions and 16 deletions

View File

@ -48,6 +48,8 @@
int getPQIsearchId();
int fixme(char *str, int n);
class RsPeerCryptoParams ;
//! controlling data rates
/*!
* For controlling data rates.
@ -206,6 +208,8 @@ class PQInterface: public RateInterface
return SendItem(item) ;
}
virtual bool getCryptoParams(RsPeerCryptoParams&) { return false ;}
/*!
* Retrieve RsItem from a facility
*/

View File

@ -26,11 +26,13 @@
#include "pqi/pqi.h"
#include "pqi/pqiperson.h"
#include "pqi/pqipersongrp.h"
#include "pqi/pqissl.h"
#include "services/p3disc.h"
const int pqipersonzone = 82371;
#include "util/rsdebug.h"
#include "util/rsstring.h"
#include "retroshare/rspeers.h"
/****
* #define PERSON_DEBUG
@ -468,6 +470,41 @@ int pqiperson::getQueueSize(bool in)
return activepqi -> getQueueSize(in);
}
bool pqiperson::getCryptoParams(RsPeerCryptoParams& params)
{
if(active && activepqi != NULL)
return activepqi->getCryptoParams(params) ;
else
{
params.connexion_state = 0 ;
params.cipher_name.clear() ;
params.cipher_bits_1 = 0 ;
params.cipher_bits_2 = 0 ;
params.cipher_version.clear() ;
return false ;
}
}
bool pqiconnect::getCryptoParams(RsPeerCryptoParams& params)
{
pqissl *ssl = dynamic_cast<pqissl*>(ni) ;
if(ssl != NULL)
{
ssl->getCryptoParams(params) ;
return true ;
}
else
{
params.connexion_state = 0 ;
params.cipher_name.clear() ;
params.cipher_bits_1 = 0 ;
params.cipher_bits_2 = 0 ;
params.cipher_version.clear() ;
return false ;
}
}
float pqiperson::getRate(bool in)
{

View File

@ -34,6 +34,7 @@
#include <list>
class pqiperson;
class RsPeerCryptoParams ;
static const int CONNECT_RECEIVED = 1;
static const int CONNECT_SUCCESS = 2;
@ -63,6 +64,7 @@ public:
}
virtual ~pqiconnect() { return; }
virtual bool getCryptoParams(RsPeerCryptoParams& params) ;
// presents a virtual NetInterface -> passes to ni.
virtual int connect(struct sockaddr_in raddr) { return ni->connect(raddr); }
@ -119,6 +121,8 @@ int receiveHeartbeat();
// add in connection method.
int addChildInterface(uint32_t type, pqiconnect *pqi);
virtual bool getCryptoParams(RsPeerCryptoParams&) ;
// The PQInterface interface.
virtual int SendItem(RsItem *,uint32_t& serialized_size);
virtual int SendItem(RsItem *item)

View File

@ -350,7 +350,14 @@ bool pqipersongrp::getCryptoParams(const std::string& id,RsPeerCryptoParams& par
{
RsStackMutex stack(coreMtx); /******* LOCKED MUTEX **********/
return locked_getCryptoParams(id,params) ;
std::map<std::string, SearchModule *>::iterator it = mods.find(id) ;
if(it == mods.end())
return false ;
return it->second->pqi->getCryptoParams(params) ;
//return locked_getCryptoParams(id,params) ;
}
int pqipersongrp::addPeer(std::string id)

View File

@ -55,17 +55,6 @@ pqilistener * pqisslpersongrp::locked_createListener(struct sockaddr_in laddr)
return listener;
}
bool pqisslpersongrp::locked_getCryptoParams(const std::string& id,RsPeerCryptoParams& params)
{
std::map<std::string, pqissl*>::const_iterator it = ssl_tunnels.find(id) ;
if(it == ssl_tunnels.end())
return false ;
it->second->getCryptoParams(params) ;
return true ;
}
pqiperson * pqisslpersongrp::locked_createPerson(std::string id, pqilistener *listener)
{
pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone, "pqipersongrp::createPerson() PeerId: " + id);
@ -80,8 +69,6 @@ pqiperson * pqisslpersongrp::locked_createPerson(std::string id, pqilistener *li
* * ServiceGeneric
*/
ssl_tunnels[id] = pqis ; // keeps for getting crypt info per peer.
RsSerialiser *rss = new RsSerialiser();
rss->addSerialType(new RsFileItemSerialiser());
rss->addSerialType(new RsCacheItemSerialiser());

View File

@ -40,8 +40,6 @@ class pqisslpersongrp: public pqipersongrp
pqisslpersongrp(SecurityPolicy *pol, unsigned long flags, p3PeerMgr *pm)
:pqipersongrp(pol, flags), mPeerMgr(pm) { return; }
bool locked_getCryptoParams(const std::string&, RsPeerCryptoParams&) ;
protected:
/********* FUNCTIONS to OVERLOAD for specialisation ********/