mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-08 17:15:16 -04:00
- Removed RsIface, and moved configuration options to RsServerConfig (rsconfig.h)
- Fixed cipher list to "HIGH:!DSS:!aNULL:!3DES", which should disable the weak ones, no idea how to force it to PFS (which it should use). - fixed void * pointer maths. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6584 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ebbf6d9e26
commit
f93ed1fb6e
12 changed files with 61 additions and 312 deletions
|
@ -66,68 +66,6 @@ int RsServer::ConfigSetBootPrompt( bool /*on*/ )
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::UpdateAllConfig()
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
RsConfig &config = iface.mConfig;
|
||||
|
||||
config.ownId = AuthSSL::getAuthSSL()->OwnId();
|
||||
config.ownName = AuthGPG::getAuthGPG()->getGPGOwnName();
|
||||
peerState pstate;
|
||||
mPeerMgr->getOwnNetStatus(pstate);
|
||||
|
||||
/* ports */
|
||||
config.localAddr = rs_inet_ntoa(pstate.localaddr.sin_addr);
|
||||
config.localPort = ntohs(pstate.localaddr.sin_port);
|
||||
|
||||
config.firewalled = true;
|
||||
config.forwardPort = true;
|
||||
|
||||
config.extAddr = rs_inet_ntoa(pstate.serveraddr.sin_addr);
|
||||
config.extPort = ntohs(pstate.serveraddr.sin_port);
|
||||
config.promptAtBoot = true; /* popup the password prompt */
|
||||
|
||||
/* update network configuration */
|
||||
|
||||
pqiNetStatus status;
|
||||
mNetMgr->getNetStatus(status);
|
||||
|
||||
config.netLocalOk = status.mLocalAddrOk;
|
||||
config.netUpnpOk = status.mUpnpOk;
|
||||
config.netStunOk = false;
|
||||
config.netExtraAddressOk = status.mExtAddrOk;
|
||||
|
||||
config.netDhtOk = status.mDhtOk;
|
||||
config.netDhtNetSize = status.mDhtNetworkSize;
|
||||
config.netDhtRsNetSize = status.mDhtRsNetworkSize;
|
||||
|
||||
/* update DHT/UPnP config */
|
||||
|
||||
config.uPnPState = mNetMgr->getUPnPState();
|
||||
config.uPnPActive = mNetMgr->getUPnPEnabled();
|
||||
config.DHTPeers = 20;
|
||||
config.DHTActive = mNetMgr->getDHTEnabled();
|
||||
|
||||
/* Notify of Changes */
|
||||
// iface.setChanged(RsIface::Config);
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CONFIG, NOTIFY_TYPE_MOD);
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void RsServer::ConfigFinalSave()
|
||||
{
|
||||
/* force saving of transfers TODO */
|
||||
|
|
|
@ -51,8 +51,8 @@ int rsserverzone = 101;
|
|||
#define WARN_BIG_CYCLE_TIME (0.2)
|
||||
|
||||
|
||||
RsServer::RsServer(RsIface &i, NotifyBase &callback)
|
||||
:RsControl(i, callback), coreMutex("RsServer")
|
||||
RsServer::RsServer(NotifyBase &callback)
|
||||
:RsControl(callback), coreMutex("RsServer")
|
||||
{
|
||||
ftserver = NULL;
|
||||
|
||||
|
@ -232,8 +232,6 @@ void RsServer::run()
|
|||
#ifdef DEBUG_TICK
|
||||
std::cerr << "RsServer::run() Updates()" << std::endl;
|
||||
#endif
|
||||
UpdateAllConfig();
|
||||
|
||||
|
||||
mConfigMgr->tick(); /* saves stuff */
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class RsServer: public RsControl, public RsThread
|
|||
/****************************************/
|
||||
/* p3face.cc: main loop / util fns / locking. */
|
||||
|
||||
RsServer(RsIface &i, NotifyBase &callback);
|
||||
RsServer(NotifyBase &callback);
|
||||
virtual ~RsServer();
|
||||
|
||||
/* Thread Fn: Run the Core */
|
||||
|
@ -153,8 +153,6 @@ class RsServer: public RsControl, public RsThread
|
|||
* i.e. releases all held resources and saves current configuration
|
||||
*/
|
||||
virtual void rsGlobalShutDown( );
|
||||
private:
|
||||
int UpdateAllConfig();
|
||||
|
||||
/****************************************/
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#include "rsserver/p3serverconfig.h"
|
||||
#include "services/p3bwctrl.h"
|
||||
|
||||
#include "pqi/authgpg.h"
|
||||
#include "pqi/authssl.h"
|
||||
|
||||
RsServerConfig *rsConfig = NULL;
|
||||
|
||||
static const std::string pqih_ftr("PQIH_FTR");
|
||||
|
@ -137,16 +140,50 @@ bool p3ServerConfig::setConfigurationOption(uint32_t key, const std::string &opt
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* From RsIface::RsConfig */
|
||||
|
||||
int p3ServerConfig::getConfigNetStatus(RsConfigNetStatus &/*status*/)
|
||||
int p3ServerConfig::getConfigNetStatus(RsConfigNetStatus &status)
|
||||
{
|
||||
return 0;
|
||||
status.ownId = AuthSSL::getAuthSSL()->OwnId();
|
||||
status.ownName = AuthGPG::getAuthGPG()->getGPGOwnName();
|
||||
|
||||
// Details from PeerMgr.
|
||||
peerState pstate;
|
||||
mPeerMgr->getOwnNetStatus(pstate);
|
||||
|
||||
status.localAddr = rs_inet_ntoa(pstate.localaddr.sin_addr);
|
||||
status.localPort = ntohs(pstate.localaddr.sin_port);
|
||||
|
||||
status.extAddr = rs_inet_ntoa(pstate.serveraddr.sin_addr);
|
||||
status.extPort = ntohs(pstate.serveraddr.sin_port);
|
||||
status.extDynDns = pstate.dyndns;
|
||||
|
||||
status.firewalled = true;
|
||||
status.forwardPort = true;
|
||||
|
||||
/* update network configuration */
|
||||
pqiNetStatus nstatus;
|
||||
mNetMgr->getNetStatus(nstatus);
|
||||
|
||||
status.netLocalOk = nstatus.mLocalAddrOk;
|
||||
status.netUpnpOk = nstatus.mUpnpOk;
|
||||
status.netStunOk = false;
|
||||
status.netExtAddressOk = nstatus.mExtAddrOk;
|
||||
|
||||
status.netDhtOk = nstatus.mDhtOk;
|
||||
status.netDhtNetSize = nstatus.mDhtNetworkSize;
|
||||
status.netDhtRsNetSize = nstatus.mDhtRsNetworkSize;
|
||||
|
||||
/* update DHT/UPnP status */
|
||||
status.uPnPState = mNetMgr->getUPnPState();
|
||||
status.uPnPActive = mNetMgr->getUPnPEnabled();
|
||||
status.DHTActive = mNetMgr->getDHTEnabled();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int p3ServerConfig::getConfigStartup(RsConfigStartup &/*params*/)
|
||||
{
|
||||
//status.promptAtBoot = true; /* popup the password prompt */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
|
||||
/*
|
||||
* "$Id: rsiface.cc,v 1.6 2007-04-15 18:45:23 rmf24 Exp $"
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2004-2007 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "util/rsdir.h"
|
||||
|
||||
/* global variable */
|
||||
RsIface *rsiface = NULL;
|
||||
|
||||
|
||||
/* set to true */
|
||||
bool RsIface::setChanged(DataFlags set)
|
||||
{
|
||||
if ((int) set < (int) NumOfFlags)
|
||||
{
|
||||
/* go for it */
|
||||
mChanged[(int) set ] = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* leaves it */
|
||||
bool RsIface::getChanged(DataFlags set)
|
||||
{
|
||||
if ((int) set < (int) NumOfFlags)
|
||||
{
|
||||
/* go for it */
|
||||
return mChanged[(int) set ];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* resets it */
|
||||
bool RsIface::hasChanged(DataFlags set)
|
||||
{
|
||||
if ((int) set < (int) NumOfFlags)
|
||||
{
|
||||
/* go for it */
|
||||
if (mChanged[(int) set ])
|
||||
{
|
||||
mChanged[(int) set ] = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*************************** THE REAL RSIFACE (with MUTEXES) *******/
|
||||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
class RsIfaceReal: public RsIface
|
||||
{
|
||||
public:
|
||||
RsIfaceReal(NotifyBase &callback)
|
||||
:RsIface(callback), rsIfaceMutex("RsIface")
|
||||
{ return; }
|
||||
|
||||
virtual void lockData()
|
||||
{
|
||||
return rsIfaceMutex.lock();
|
||||
}
|
||||
|
||||
virtual void unlockData()
|
||||
{
|
||||
return rsIfaceMutex.unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
RsMutex rsIfaceMutex;
|
||||
};
|
||||
|
||||
RsIface *createRsIface(NotifyBase &cb)
|
||||
{
|
||||
rsiface = new RsIfaceReal(cb);
|
||||
return rsiface;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1824,9 +1824,9 @@ RsTurtle *rsTurtle = NULL ;
|
|||
#include "services/p3dsdv.h"
|
||||
|
||||
|
||||
RsControl *createRsControl(RsIface &iface, NotifyBase ¬ify)
|
||||
RsControl *createRsControl(NotifyBase ¬ify)
|
||||
{
|
||||
RsServer *srv = new RsServer(iface, notify);
|
||||
RsServer *srv = new RsServer(notify);
|
||||
rsicontrol = srv;
|
||||
return srv;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue