2018-05-28 16:28:51 -04:00
|
|
|
/*******************************************************************************
|
|
|
|
* libretroshare/src/retroshare: rsiface.h *
|
|
|
|
* *
|
|
|
|
* libretroshare: retroshare core library *
|
|
|
|
* *
|
|
|
|
* Copyright 2004-2006 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/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2018-09-19 15:28:26 -04:00
|
|
|
#pragma once
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2014-01-07 17:51:22 -05:00
|
|
|
#include "retroshare/rsnotify.h"
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "rstypes.h"
|
|
|
|
|
|
|
|
#include <map>
|
2018-09-19 15:28:26 -04:00
|
|
|
#include <functional>
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2014-01-07 17:51:22 -05:00
|
|
|
class RsServer;
|
2007-11-14 22:18:48 -05:00
|
|
|
class RsInit;
|
2018-10-03 13:05:02 -04:00
|
|
|
struct RsPeerCryptoParams;
|
2018-09-19 15:28:26 -04:00
|
|
|
class RsControl;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
/// RsInit -> Configuration Parameters for RetroShare Startup
|
|
|
|
RsInit* InitRsConfig();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2008-06-14 09:22:39 -04:00
|
|
|
/* extract various options for GUI */
|
2007-11-14 22:18:48 -05:00
|
|
|
const char *RsConfigDirectory(RsInit *config);
|
2008-06-14 09:22:39 -04:00
|
|
|
bool RsConfigStartMinimised(RsInit *config);
|
2007-11-14 22:18:48 -05:00
|
|
|
void CleanupRsConfig(RsInit *);
|
|
|
|
|
|
|
|
|
|
|
|
// Called First... (handles comandline options)
|
|
|
|
int InitRetroShare(int argc, char **argv, RsInit *config);
|
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
/**
|
|
|
|
* Pointer to global instance of RsControl needed to expose JSON API
|
|
|
|
* @jsonapi{development}
|
|
|
|
*/
|
|
|
|
extern RsControl* rsControl;
|
|
|
|
|
|
|
|
/** The Main Interface Class - for controlling the server */
|
|
|
|
class RsControl
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
2017-02-25 18:46:02 -05:00
|
|
|
public:
|
|
|
|
/// TODO: This should return a reference instead of a pointer!
|
2018-09-19 15:28:26 -04:00
|
|
|
static RsControl* instance();
|
|
|
|
static void earlyInitNotificationSystem() { rsControl = instance(); }
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2018-08-30 13:06:20 -04:00
|
|
|
/* Real Startup Fn */
|
|
|
|
virtual int StartupRetroShare() = 0;
|
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
/**
|
|
|
|
* @brief Check if core is fully ready, true only after StartupRetroShare()
|
|
|
|
* finish and before rsGlobalShutDown() begin
|
|
|
|
* @jsonapi{development}
|
2018-08-30 13:06:20 -04:00
|
|
|
*/
|
|
|
|
virtual bool isReady() = 0;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
virtual void ConfigFinalSave() = 0;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
/**
|
|
|
|
* @brief Turn off RetroShare
|
|
|
|
* @jsonapi{development,manualwrapper}
|
|
|
|
*/
|
|
|
|
virtual void rsGlobalShutDown() = 0;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
virtual bool getPeerCryptoDetails(
|
|
|
|
const RsPeerId& ssl_id,RsPeerCryptoParams& params ) = 0;
|
|
|
|
virtual void getLibraries(std::list<RsLibraryInfo> &libraries) = 0;
|
2009-02-08 09:30:28 -05:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
/**
|
|
|
|
* @brief Set shutdown callback, useful if main runlop is controlled by
|
|
|
|
* another entity such as QCoreApplication
|
|
|
|
* @param callback function to call when shutdown is almost complete
|
|
|
|
*/
|
|
|
|
virtual void setShutdownCallback(const std::function<void(int)>& callback) = 0;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2018-09-19 15:28:26 -04:00
|
|
|
protected:
|
|
|
|
RsControl() {} // should not be used, hence it's private.
|
2007-11-14 22:18:48 -05:00
|
|
|
};
|
|
|
|
|