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.

63 lines
1.1 KiB
C++
Raw Normal View History

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