21 #ifndef __KGAMENETWORK_H_
22 #define __KGAMENETWORK_H_
24 #include <QtCore/QString>
25 #include <QtCore/QObject>
26 #include "../libkdegamesprivate_export.h"
33 class KGameNetworkPrivate;
66 bool isNetwork()
const;
80 bool isMaster()
const;
99 quint32 gameId()
const;
111 bool offerConnections (quint16 port);
113 void setDiscoveryInfo(
const QString& type,
const QString& name=QString());
123 bool connectToServer(
const QString& host, quint16 port);
131 quint16 port()
const;
138 QString hostName()
const;
144 bool stopServerConnection();
156 void setMaxClients(
int max);
181 bool sendSystemMessage(
const QByteArray& buffer,
int msgid, quint32 receiver=0, quint32 sender=0);
186 bool sendSystemMessage(
int data,
int msgid, quint32 receiver=0, quint32 sender=0);
191 bool sendSystemMessage(
const QDataStream &msg,
int msgid, quint32 receiver=0, quint32 sender=0);
196 bool sendSystemMessage(
const QString& msg,
int msgid, quint32 receiver=0, quint32 sender=0);
209 void sendError(
int error,
const QByteArray& message, quint32 receiver=0, quint32 sender=0);
215 bool isOfferingConnections()
const;
257 bool sendMessage(
const QByteArray& buffer,
int msgid, quint32 receiver=0, quint32 sender=0);
262 bool sendMessage(
const QDataStream &msg,
int msgid, quint32 receiver=0, quint32 sender=0);
267 bool sendMessage(
const QString& msg,
int msgid, quint32 receiver=0, quint32 sender=0);
272 bool sendMessage(
int data,
int msgid, quint32 receiver=0, quint32 sender=0);
279 virtual void networkTransmission(QDataStream&,
int, quint32, quint32, quint32 clientID) = 0;
296 void electAdmin(quint32 clientID);
329 virtual void unlock();
337 void signalNetworkErrorMessage(
int error, QString text);
343 void signalConnectionBroken();
354 void signalClientConnected(quint32 clientID);
367 void signalClientDisconnected(quint32 clientID,
bool broken);
374 void signalAdminStatusChanged(
bool isAdmin);
393 void receiveNetworkTransmission(
const QByteArray& a, quint32 clientID);
399 void slotAdminStatusChanged(
bool isAdmin);
405 void aboutToLoseConnection(quint32
id);
411 void slotResetConnection();
416 void tryStopPublishing();
417 KGameNetworkPrivate*
const d;
A client to connect to a KMessageServer.
This abstract base class represents one end of a message connections between two clients.
A server for message sending and broadcasting, using TCP/IP connections.
The KGameNetwork class is the KGame class with network support.
Base class for IO devices for games.