2018-04-08 21:36:08 +02:00
|
|
|
#ifndef LIBSYNCTHING_INTERFACE_H
|
|
|
|
#define LIBSYNCTHING_INTERFACE_H
|
|
|
|
|
|
|
|
#include "./global.h"
|
|
|
|
|
2019-07-18 16:38:19 +02:00
|
|
|
#include <cstdint>
|
2018-04-14 23:03:04 +02:00
|
|
|
#include <functional>
|
2018-04-08 21:36:08 +02:00
|
|
|
#include <string>
|
2018-04-17 23:54:43 +02:00
|
|
|
#include <vector>
|
2018-04-08 21:36:08 +02:00
|
|
|
|
|
|
|
namespace LibSyncthing {
|
|
|
|
|
|
|
|
struct RuntimeOptions {
|
|
|
|
std::string configDir;
|
|
|
|
std::string guiAddress;
|
|
|
|
std::string guiApiKey;
|
|
|
|
bool verbose = false;
|
2019-08-03 16:31:23 +02:00
|
|
|
bool allowNewerConfig = true;
|
|
|
|
bool noDefaultConfig = false;
|
2019-10-13 19:37:32 +02:00
|
|
|
bool ensureConfigDirectoryExists = true;
|
2018-04-08 21:36:08 +02:00
|
|
|
};
|
|
|
|
|
2018-04-14 23:03:04 +02:00
|
|
|
enum class LogLevel : int {
|
|
|
|
Debug,
|
|
|
|
Verbose,
|
|
|
|
Info,
|
|
|
|
Warning,
|
|
|
|
Fatal,
|
|
|
|
};
|
|
|
|
constexpr auto lowestLogLevel = LogLevel::Debug;
|
|
|
|
constexpr auto highestLogLevel = LogLevel::Fatal;
|
|
|
|
|
|
|
|
using LoggingCallback = std::function<void(LogLevel, const char *message, std::size_t messageSize)>;
|
|
|
|
|
2020-01-29 18:51:10 +01:00
|
|
|
LIB_SYNCTHING_EXPORT void setLoggingCallback(const LoggingCallback &callback);
|
|
|
|
LIB_SYNCTHING_EXPORT void setLoggingCallback(LoggingCallback &&callback);
|
|
|
|
LIB_SYNCTHING_EXPORT std::int64_t runSyncthing(const RuntimeOptions &options = RuntimeOptions{});
|
|
|
|
LIB_SYNCTHING_EXPORT bool isSyncthingRunning();
|
|
|
|
LIB_SYNCTHING_EXPORT std::int64_t stopSyncthing();
|
|
|
|
LIB_SYNCTHING_EXPORT std::string ownDeviceId();
|
|
|
|
LIB_SYNCTHING_EXPORT std::string syncthingVersion();
|
|
|
|
LIB_SYNCTHING_EXPORT std::string longSyncthingVersion();
|
2018-04-08 21:36:08 +02:00
|
|
|
|
|
|
|
} // namespace LibSyncthing
|
|
|
|
|
|
|
|
#endif // LIBSYNCTHING_INTERFACE_H
|