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;
|
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)>;
|
|
|
|
|
|
|
|
void LIB_SYNCTHING_EXPORT setLoggingCallback(const LoggingCallback &callback);
|
|
|
|
void LIB_SYNCTHING_EXPORT setLoggingCallback(LoggingCallback &&callback);
|
2019-07-18 16:38:19 +02:00
|
|
|
std::int64_t LIB_SYNCTHING_EXPORT runSyncthing(const RuntimeOptions &options = RuntimeOptions{});
|
2018-04-15 20:19:14 +02:00
|
|
|
bool LIB_SYNCTHING_EXPORT isSyncthingRunning();
|
2019-07-18 16:38:19 +02:00
|
|
|
std::int64_t LIB_SYNCTHING_EXPORT stopSyncthing();
|
2019-07-17 17:53:36 +02:00
|
|
|
std::string LIB_SYNCTHING_EXPORT ownDeviceId();
|
2018-04-14 23:03:04 +02:00
|
|
|
std::string LIB_SYNCTHING_EXPORT syncthingVersion();
|
|
|
|
std::string LIB_SYNCTHING_EXPORT longSyncthingVersion();
|
2018-04-08 21:36:08 +02:00
|
|
|
|
|
|
|
} // namespace LibSyncthing
|
|
|
|
|
|
|
|
#endif // LIBSYNCTHING_INTERFACE_H
|