mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.6 KiB
74 lines
1.6 KiB
11 years ago
|
#pragma once
|
||
11 years ago
|
#include <string>
|
||
11 years ago
|
|
||
11 years ago
|
#ifdef _WIN32
|
||
|
#define Daemon i2p::util::DaemonWin32::Instance()
|
||
|
#else
|
||
|
#define Daemon i2p::util::DaemonLinux::Instance()
|
||
|
#endif
|
||
11 years ago
|
|
||
|
namespace i2p
|
||
|
{
|
||
9 years ago
|
namespace util
|
||
|
{
|
||
|
class Daemon_Singleton_Private;
|
||
|
class Daemon_Singleton
|
||
|
{
|
||
|
public:
|
||
|
virtual bool init(int argc, char* argv[]);
|
||
|
virtual bool start();
|
||
|
virtual bool stop();
|
||
11 years ago
|
|
||
9 years ago
|
int isLogging;
|
||
|
int isDaemon;
|
||
|
|
||
|
int running;
|
||
11 years ago
|
|
||
9 years ago
|
protected:
|
||
|
Daemon_Singleton();
|
||
|
virtual ~Daemon_Singleton();
|
||
11 years ago
|
|
||
9 years ago
|
bool IsService () const;
|
||
10 years ago
|
|
||
9 years ago
|
// d-pointer for httpServer, httpProxy, etc.
|
||
|
class Daemon_Singleton_Private;
|
||
|
Daemon_Singleton_Private &d;
|
||
|
};
|
||
11 years ago
|
|
||
|
#ifdef _WIN32
|
||
9 years ago
|
class DaemonWin32 : public Daemon_Singleton
|
||
|
{
|
||
|
public:
|
||
|
static DaemonWin32& Instance()
|
||
|
{
|
||
|
static DaemonWin32 instance;
|
||
|
return instance;
|
||
|
}
|
||
11 years ago
|
|
||
9 years ago
|
virtual bool init(int argc, char* argv[]);
|
||
|
virtual bool start();
|
||
|
virtual bool stop();
|
||
|
};
|
||
11 years ago
|
#else
|
||
9 years ago
|
class DaemonLinux : public Daemon_Singleton
|
||
|
{
|
||
|
public:
|
||
|
DaemonLinux() = default;
|
||
9 years ago
|
|
||
9 years ago
|
static DaemonLinux& Instance()
|
||
|
{
|
||
|
static DaemonLinux instance;
|
||
|
return instance;
|
||
|
}
|
||
11 years ago
|
|
||
9 years ago
|
virtual bool start();
|
||
|
virtual bool stop();
|
||
9 years ago
|
private:
|
||
|
std::string pidfile;
|
||
|
int pidFilehandle;
|
||
11 years ago
|
|
||
9 years ago
|
};
|
||
11 years ago
|
#endif
|
||
9 years ago
|
}
|
||
11 years ago
|
}
|