diff options
| author | Treeki <treeki@gmail.com> | 2013-12-25 09:00:59 +0100 | 
|---|---|---|
| committer | Treeki <treeki@gmail.com> | 2013-12-25 09:00:59 +0100 | 
| commit | b7a8b597b00eedde277836eb8530ba742edcad5d (patch) | |
| tree | 1b959fa0eec02ff4e22e168aa4379b2b64575ce3 /server/bouncer.h | |
| download | bounce_qt-master.tar.gz bounce_qt-master.zip  | |
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  | 
