mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 05:22:31 -04:00
Net, Dht and Configuration changes.
* set PortForward in NetStateBox when the Network has been setup. * add GeneralConfig to rsConfig external interface. * enabled ADVANCED configuration option. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4500 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a1e112934d
commit
31ec7a074b
7 changed files with 96 additions and 9 deletions
|
@ -28,13 +28,15 @@
|
|||
RsServerConfig *rsConfig = NULL;
|
||||
|
||||
|
||||
p3ServerConfig::p3ServerConfig(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr, p3NetMgr *netMgr)
|
||||
p3ServerConfig::p3ServerConfig(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr, p3NetMgr *netMgr, p3GeneralConfig *genCfg)
|
||||
:configMtx("p3ServerConfig")
|
||||
{
|
||||
mPeerMgr = peerMgr;
|
||||
mLinkMgr = linkMgr;
|
||||
mNetMgr = netMgr;
|
||||
|
||||
mGeneralConfig = genCfg;
|
||||
|
||||
mUserLevel = RSCONFIG_USER_LEVEL_NEW; /* START LEVEL */
|
||||
|
||||
rsConfig = this;
|
||||
|
@ -46,6 +48,53 @@ p3ServerConfig::~p3ServerConfig()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
#define RS_CONFIG_ADVANCED_STRING "AdvMode"
|
||||
|
||||
bool p3ServerConfig::findConfigurationOption(uint32_t key, std::string &keystr)
|
||||
{
|
||||
bool found = false;
|
||||
switch(key)
|
||||
{
|
||||
case RS_CONFIG_ADVANCED:
|
||||
keystr = RS_CONFIG_ADVANCED_STRING;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
bool p3ServerConfig::getConfigurationOption(uint32_t key, std::string &opt)
|
||||
{
|
||||
std::string strkey;
|
||||
if (!findConfigurationOption(key, strkey))
|
||||
{
|
||||
std::cerr << "p3ServerConfig::getConfigurationOption() OPTION NOT VALID: " << key;
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
opt = mGeneralConfig->getSetting(strkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool p3ServerConfig::setConfigurationOption(uint32_t key, const std::string &opt)
|
||||
{
|
||||
std::string strkey;
|
||||
if (!findConfigurationOption(key, strkey))
|
||||
{
|
||||
std::cerr << "p3ServerConfig::setConfigurationOption() OPTION NOT VALID: " << key;
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
mGeneralConfig->setSetting(strkey, opt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* From RsIface::RsConfig */
|
||||
|
||||
int p3ServerConfig::getConfigNetStatus(RsConfigNetStatus &status)
|
||||
|
|
|
@ -31,12 +31,18 @@
|
|||
#include "pqi/p3peermgr.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "pqi/p3netmgr.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
|
||||
|
||||
#define RS_CONFIG_ADVANCED_STRING "AdvMode"
|
||||
|
||||
|
||||
|
||||
class p3ServerConfig: public RsServerConfig
|
||||
{
|
||||
public:
|
||||
|
||||
p3ServerConfig(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr, p3NetMgr *netMgr);
|
||||
p3ServerConfig(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr, p3NetMgr *netMgr, p3GeneralConfig *genCfg);
|
||||
virtual ~p3ServerConfig();
|
||||
|
||||
/* From RsIface::RsConfig */
|
||||
|
@ -70,13 +76,19 @@ virtual uint32_t getNatTypeMode();
|
|||
virtual uint32_t getNatHoleMode();
|
||||
virtual uint32_t getConnectModes();
|
||||
|
||||
virtual bool getConfigurationOption(uint32_t key, std::string &opt);
|
||||
virtual bool setConfigurationOption(uint32_t key, const std::string &opt);
|
||||
|
||||
/********************* ABOVE is RsConfig Interface *******/
|
||||
|
||||
private:
|
||||
|
||||
bool findConfigurationOption(uint32_t key, std::string &keystr);
|
||||
|
||||
p3PeerMgr *mPeerMgr;
|
||||
p3LinkMgr *mLinkMgr;
|
||||
p3NetMgr *mNetMgr;
|
||||
p3GeneralConfig *mGeneralConfig;
|
||||
|
||||
RsMutex configMtx;
|
||||
uint32_t mUserLevel; // store last one... will later be a config Item too.
|
||||
|
|
|
@ -2302,7 +2302,7 @@ int RsServer::StartupRetroShare()
|
|||
|
||||
rsPeers = new p3Peers(mLinkMgr, mPeerMgr, mNetMgr);
|
||||
rsDisc = new p3Discovery(ad);
|
||||
rsConfig = new p3ServerConfig(mPeerMgr, mLinkMgr, mNetMgr);
|
||||
rsConfig = new p3ServerConfig(mPeerMgr, mLinkMgr, mNetMgr, mGeneralConfig);
|
||||
|
||||
#ifndef MINIMAL_LIBRS
|
||||
rsMsgs = new p3Msgs(msgSrv, chatSrv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue