Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/nntpchan-daemon/libnntpchan/nntp_server.hpp

63 lines
1.1 KiB
C++
Raw Normal View History

2016-10-15 18:12:01 +05:00
#ifndef NNTPCHAN_NNTP_SERVER_HPP
#define NNTPCHAN_NNTP_SERVER_HPP
#include <uv.h>
#include <string>
2016-10-15 21:37:59 +05:00
#include <deque>
2016-10-18 17:17:40 +05:00
#include "frontend.hpp"
2017-05-03 18:15:06 +05:00
#include "server.hpp"
2016-10-15 18:12:01 +05:00
namespace nntpchan
{
2017-05-03 18:15:06 +05:00
class NNTPServer : public Server
2016-10-15 18:12:01 +05:00
{
public:
2017-05-03 18:15:06 +05:00
NNTPServer(uv_loop_t * loop);
2016-10-15 18:12:01 +05:00
2017-05-03 18:15:06 +05:00
virtual ~NNTPServer();
2016-10-15 18:12:01 +05:00
void SetStoragePath(const std::string & path);
2016-10-15 22:53:35 +05:00
void SetLoginDB(const std::string path);
2016-10-18 17:17:40 +05:00
2017-05-03 22:33:04 +05:00
void SetInstanceName(const std::string & name);
std::string InstanceName() const;
2016-10-18 17:17:40 +05:00
void Close();
2017-05-03 18:15:06 +05:00
virtual IServerConn * CreateConn(uv_stream_t * s);
virtual void OnAcceptError(int status);
void SetFrontend(Frontend * f);
2016-10-15 18:12:01 +05:00
private:
2016-10-15 22:53:35 +05:00
std::string m_logindbpath;
2016-10-15 18:12:01 +05:00
std::string m_storagePath;
2017-05-03 22:33:04 +05:00
std::string m_servername;
2016-10-18 17:17:40 +05:00
Frontend_ptr m_frontend;
2017-05-03 18:15:06 +05:00
2016-10-15 18:12:01 +05:00
};
2017-05-03 18:15:06 +05:00
class NNTPServerConn : public IServerConn
2016-10-15 18:12:01 +05:00
{
public:
2016-10-15 21:37:59 +05:00
2017-05-03 18:15:06 +05:00
NNTPServerConn(uv_loop_t * l, uv_stream_t * s, Server * parent, IConnHandler * h) : IServerConn(l, s, parent, h) {}
virtual bool IsTimedOut() { return false; };
2016-10-15 18:12:01 +05:00
2017-05-03 18:15:06 +05:00
/** @brief send next queued reply */
virtual void SendNextReply();
2016-10-15 18:12:01 +05:00
2017-05-03 18:15:06 +05:00
virtual void Greet();
2016-10-15 21:37:59 +05:00
2016-10-15 18:12:01 +05:00
};
}
#endif