2018-05-29 21:08:17 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/rsserver: p3serverconfig.h *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2011-2011 by Robert Fernie <retroshare@lunamutt.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program 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 Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2011-07-11 18:48:56 +00:00
|
|
|
#ifndef LIBRETROSHARE_CONFIG_IMPLEMENTATION_H
|
|
|
|
#define LIBRETROSHARE_CONFIG_IMPLEMENTATION_H
|
|
|
|
|
|
|
|
#include "retroshare/rsconfig.h"
|
|
|
|
#include "pqi/p3peermgr.h"
|
|
|
|
#include "pqi/p3linkmgr.h"
|
|
|
|
#include "pqi/p3netmgr.h"
|
2011-07-30 16:57:40 +00:00
|
|
|
#include "pqi/p3cfgmgr.h"
|
2012-11-25 20:25:34 +00:00
|
|
|
#include "pqi/pqihandler.h"
|
2011-07-30 16:57:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define RS_CONFIG_ADVANCED_STRING "AdvMode"
|
|
|
|
|
|
|
|
|
2011-07-11 18:48:56 +00:00
|
|
|
|
|
|
|
class p3ServerConfig: public RsServerConfig
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2012-11-25 20:25:34 +00:00
|
|
|
p3ServerConfig(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr, p3NetMgr *netMgr, pqihandler *pqih, p3GeneralConfig *genCfg);
|
2011-07-11 18:48:56 +00:00
|
|
|
virtual ~p3ServerConfig();
|
|
|
|
|
2012-11-25 20:25:34 +00:00
|
|
|
void load_config();
|
|
|
|
|
2011-07-11 18:48:56 +00:00
|
|
|
/* From RsIface::RsConfig */
|
|
|
|
|
|
|
|
virtual int getConfigNetStatus(RsConfigNetStatus &status);
|
|
|
|
virtual int getConfigStartup(RsConfigStartup ¶ms);
|
2012-06-21 23:23:46 +00:00
|
|
|
//virtual int getConfigDataRates(RsConfigDataRates ¶ms);
|
|
|
|
|
|
|
|
/***** for RsConfig -> p3BandwidthControl ****/
|
|
|
|
|
|
|
|
virtual int getTotalBandwidthRates(RsConfigDataRates &rates);
|
2014-03-17 20:56:06 +00:00
|
|
|
virtual int getAllBandwidthRates(std::map<RsPeerId, RsConfigDataRates> &ratemap);
|
2015-07-12 04:04:18 +00:00
|
|
|
virtual int getTrafficInfo(std::list<RSTrafficClue>& out_lst, std::list<RSTrafficClue> &in_lst) ;
|
2011-07-11 18:48:56 +00:00
|
|
|
|
|
|
|
/* From RsInit */
|
|
|
|
|
|
|
|
virtual std::string RsConfigDirectory();
|
|
|
|
virtual std::string RsConfigKeysDirectory();
|
|
|
|
|
|
|
|
virtual std::string RsProfileConfigDirectory();
|
|
|
|
virtual bool getStartMinimised();
|
|
|
|
virtual std::string getRetroShareLink();
|
|
|
|
|
|
|
|
virtual bool getAutoLogin();
|
|
|
|
virtual void setAutoLogin(bool autoLogin);
|
|
|
|
virtual bool RsClearAutoLogin();
|
|
|
|
|
|
|
|
virtual std::string getRetroshareDataDirectory();
|
|
|
|
|
|
|
|
/* New Stuff */
|
|
|
|
|
|
|
|
virtual uint32_t getUserLevel();
|
|
|
|
|
|
|
|
virtual uint32_t getNetState();
|
|
|
|
virtual uint32_t getNetworkMode();
|
|
|
|
virtual uint32_t getNatTypeMode();
|
|
|
|
virtual uint32_t getNatHoleMode();
|
|
|
|
virtual uint32_t getConnectModes();
|
|
|
|
|
2011-07-30 16:57:40 +00:00
|
|
|
virtual bool getConfigurationOption(uint32_t key, std::string &opt);
|
|
|
|
virtual bool setConfigurationOption(uint32_t key, const std::string &opt);
|
|
|
|
|
2012-11-25 14:59:42 +00:00
|
|
|
/* Operating Mode */
|
|
|
|
virtual uint32_t getOperatingMode();
|
|
|
|
virtual bool setOperatingMode(uint32_t opMode);
|
2016-08-13 14:34:31 +02:00
|
|
|
virtual bool setOperatingMode(const std::string &opModeStr);
|
2012-11-25 14:59:42 +00:00
|
|
|
|
2012-11-25 20:25:34 +00:00
|
|
|
virtual int SetMaxDataRates( int downKb, int upKb );
|
|
|
|
virtual int GetMaxDataRates( int &downKb, int &upKb );
|
|
|
|
virtual int GetCurrentDataRates( float &inKb, float &outKb );
|
2019-04-03 17:29:13 +03:00
|
|
|
virtual int GetTrafficSum( uint64_t &inb, uint64_t &outb );
|
2012-11-25 14:59:42 +00:00
|
|
|
|
2011-07-11 18:48:56 +00:00
|
|
|
/********************* ABOVE is RsConfig Interface *******/
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2012-11-25 14:59:42 +00:00
|
|
|
bool switchToOperatingMode(uint32_t opMode);
|
|
|
|
|
2011-07-30 16:57:40 +00:00
|
|
|
bool findConfigurationOption(uint32_t key, std::string &keystr);
|
|
|
|
|
2011-07-11 18:48:56 +00:00
|
|
|
p3PeerMgr *mPeerMgr;
|
|
|
|
p3LinkMgr *mLinkMgr;
|
|
|
|
p3NetMgr *mNetMgr;
|
2012-11-25 20:25:34 +00:00
|
|
|
pqihandler *mPqiHandler;
|
2011-07-30 16:57:40 +00:00
|
|
|
p3GeneralConfig *mGeneralConfig;
|
2011-07-11 18:48:56 +00:00
|
|
|
|
|
|
|
RsMutex configMtx;
|
|
|
|
uint32_t mUserLevel; // store last one... will later be a config Item too.
|
2012-11-25 20:25:34 +00:00
|
|
|
float mRateDownload;
|
|
|
|
float mRateUpload;
|
2011-07-11 18:48:56 +00:00
|
|
|
|
2012-11-25 22:49:00 +00:00
|
|
|
uint32_t mOpMode;
|
2011-07-11 18:48:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|