diff options
Diffstat (limited to '')
-rw-r--r-- | server/bouncer.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/server/bouncer.h b/server/bouncer.h new file mode 100644 index 0000000..b0eb7f9 --- /dev/null +++ b/server/bouncer.h @@ -0,0 +1,47 @@ +#ifndef BOUNCER_H +#define BOUNCER_H + +#include <QObject> +#include <QSet> +#include <QTcpServer> + +struct IRCNetworkConfig; +class IRCNetwork; +class Server; +struct Message; + +class Bouncer : public QObject { + Q_OBJECT + +public: + static Bouncer *instance(); + + QSet<IRCNetwork *> networks; + QSet<Server *> clients; + QTcpServer server; + + void setupBouncer(int port, bool ssl); + void addNetwork(IRCNetworkConfig &config); + + Server *findClientBySessionKey(quint8 *sessionKey) const; + void generateSessionKey(quint8 *output); + Server *authenticate(Server *client, QString &username, QString &password, quint8 *sessionKey) const; + + void removeClient(Server *client); + + void broadcast(const Message &message); + +private slots: + void connectionReceived(); + void connectionFinished(); + +private: + static Bouncer *m_instancePtr; + + bool m_ssl; + + explicit Bouncer(QObject *parent = 0); + +}; + +#endif // BOUNCER_H |