summaryrefslogtreecommitdiff
path: root/server/bouncer.h
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-12-25 09:00:59 +0100
committerTreeki <treeki@gmail.com>2013-12-25 09:00:59 +0100
commitb7a8b597b00eedde277836eb8530ba742edcad5d (patch)
tree1b959fa0eec02ff4e22e168aa4379b2b64575ce3 /server/bouncer.h
downloadbounce_qt-master.tar.gz
bounce_qt-master.zip
commit initial bitsHEADmaster
Diffstat (limited to '')
-rw-r--r--server/bouncer.h47
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