#ifndef NETWORK_H
#define NETWORK_H

#include <qobject.h>

#include "config.h"

#ifdef WITH_GGZ
# include <ggzmod.h>
#endif

class QSocketNotifier;

class Network : public QObject
{
	Q_OBJECT
	public:
		Network();
		~Network();

		void connect();
		void disconnect();

		int channel();

		static long generator();

	signals:
		void signalInput(int id);
		void signalError();

	private slots:
		void slotInput(int fd);
		void slotDispatch();

	private:
#ifdef WITH_GGZ
		static void server_input(GGZMod *mod, GGZModEvent e, const void *data);
#endif
		void serverInput(int fd);

#ifdef WITH_GGZ
		GGZMod *mod;
		static Network *self;
#endif
		int m_channel;
		QSocketNotifier *m_sn, *m_dsn;
};

#endif

