2016-10-15 09:12:01 -04:00
|
|
|
#ifndef NNTPCHAN_NNTP_SERVER_HPP
|
|
|
|
#define NNTPCHAN_NNTP_SERVER_HPP
|
2016-10-18 08:17:40 -04:00
|
|
|
#include "frontend.hpp"
|
2017-05-03 09:15:06 -04:00
|
|
|
#include "server.hpp"
|
2017-10-17 10:29:56 -04:00
|
|
|
#include <deque>
|
|
|
|
#include <string>
|
2016-10-15 09:12:01 -04:00
|
|
|
|
|
|
|
namespace nntpchan
|
|
|
|
{
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
class NNTPServer : public Server
|
|
|
|
{
|
|
|
|
public:
|
2018-05-04 08:17:49 -04:00
|
|
|
NNTPServer(ev::Loop * loop);
|
2016-10-18 08:17:40 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
virtual ~NNTPServer();
|
2017-05-03 13:33:04 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
void SetStoragePath(const std::string &path);
|
2017-05-03 13:33:04 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
void SetLoginDB(const std::string path);
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
void SetInstanceName(const std::string &name);
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
std::string InstanceName() const;
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2018-05-03 11:47:20 -04:00
|
|
|
virtual IServerConn *CreateConn(int fd);
|
2016-10-18 08:17:40 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
virtual void OnAcceptError(int status);
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
void SetFrontend(Frontend *f);
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
private:
|
|
|
|
std::string m_logindbpath;
|
|
|
|
std::string m_storagePath;
|
|
|
|
std::string m_servername;
|
2016-10-15 12:37:59 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
Frontend_ptr m_frontend;
|
|
|
|
};
|
2017-05-03 09:15:06 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
class NNTPServerConn : public IServerConn
|
|
|
|
{
|
|
|
|
public:
|
2018-05-03 11:47:20 -04:00
|
|
|
NNTPServerConn(int fd, Server *parent, IConnHandler *h) : IServerConn(fd, parent, h) {}
|
2016-10-15 09:12:01 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
virtual bool IsTimedOut() { return false; };
|
2016-10-15 09:12:01 -04:00
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
virtual void Greet();
|
|
|
|
};
|
2016-10-15 09:12:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|