Finished up Relay Interface code to p3bitdht.

- RelayServers, Relay Parameters & Relay Mode supported.
 - Store configuration via p3config.
 - New interface code in p3bitdht_relay.cc
 - Updated external interface rsdht.cc



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4730 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-12-20 02:07:00 +00:00
parent 52e9a27f7b
commit e232b1d47d
8 changed files with 481 additions and 61 deletions

View file

@ -197,54 +197,6 @@ std::string p3BitDht::getUdpAddressString()
/***********************************************************************************************
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
************************************************************************************************/
/***********************************************************************************************
********** External RsDHT Interface for Dht-Relay Control *************************************
************************************************************************************************/
uint32_t p3BitDht::getRelayMode()
{
return 1;
}
int p3BitDht::setRelayMode(uint32_t mode)
{
return 1;
}
int p3BitDht::getRelayAllowance(int classIdx, uint32_t &count, uint32_t &bandwidth)
{
std::cerr << "p3BitDht::getRelayAllowance(" << classIdx << "): ";
if ((classIdx >= 0) && (classIdx < RSDHT_RELAY_NUM_CLASS))
{
count = mRelay->getRelayClassMax(classIdx);
bandwidth = mRelay->getRelayClassBandwidth(classIdx);
std::cerr << " count: " << count << " bandwidth: " << bandwidth;
std::cerr << std::endl;
return 1;
}
std::cerr << " Invalid classIdx";
std::cerr << std::endl;
return 0;
}
int p3BitDht::setRelayAllowance(int classIdx, uint32_t count, uint32_t bandwidth)
{
std::cerr << "p3BitDht::getRelayAllowance(" << classIdx << ", ";
std::cerr << ", " << count << ", " << bandwidth << ")";
std::cerr << std::endl;
return mRelay->setRelayClassMax(classIdx, count, bandwidth);
}
/***********************************************************************************************
********** External RsDHT Interface for Dht-Relay Control *************************************
************************************************************************************************/
void convertBdPeerToRsDhtPeer(RsDhtPeer &peer, const bdPeer &int_peer)
{