we need more server list classes with slightly different properties
This commit is contained in:
parent
5ca224af19
commit
53e8cabdbe
4 changed files with 96 additions and 58 deletions
|
@ -555,16 +555,8 @@ bool CProtocol::ParseConnectionLessMessage ( const CVector<uint8_t>& vecbyData,
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROTMESSID_CLM_EMPTY_MESSAGE:
|
|
||||||
// TODO
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROTMESSID_CLM_REGISTER_SERVER:
|
case PROTMESSID_CLM_REGISTER_SERVER:
|
||||||
// TODO
|
bRet = EvaluateCLRegisterServerMes ( InetAddr, vecData );
|
||||||
break;
|
|
||||||
|
|
||||||
case PROTMESSID_CLM_UNREGISTER_SERVER:
|
|
||||||
// TODO
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1122,7 @@ bool CProtocol::EvaluateCLServerFullMes()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProtocol::CreateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
void CProtocol::CreateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
||||||
const CServerInfo& ServerInfo )
|
const CServerCoreInfo& ServerInfo )
|
||||||
{
|
{
|
||||||
int iPos = 0; // init position pointer
|
int iPos = 0; // init position pointer
|
||||||
|
|
||||||
|
@ -1187,7 +1179,7 @@ bool CProtocol::EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
||||||
{
|
{
|
||||||
int iPos = 0; // init position pointer
|
int iPos = 0; // init position pointer
|
||||||
const int iDataLen = vecData.Size();
|
const int iDataLen = vecData.Size();
|
||||||
CServerInfo RecServerInfo;
|
CServerCoreInfo RecServerInfo;
|
||||||
|
|
||||||
// check size (the first 5 bytes)
|
// check size (the first 5 bytes)
|
||||||
if ( iDataLen < 5 )
|
if ( iDataLen < 5 )
|
||||||
|
@ -1250,6 +1242,21 @@ bool CProtocol::EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CProtocol::CreateCLServerListMes ( const CHostAddress& InetAddr,
|
||||||
|
const CVector<CServerInfo> vecServerInfo )
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
bool CProtocol::EvaluateCLServerListMes ( const CHostAddress& InetAddr,
|
||||||
|
const CVector<uint8_t>& vecData )
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Message generation and parsing *
|
* Message generation and parsing *
|
||||||
\******************************************************************************/
|
\******************************************************************************/
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
#define PROTMESSID_CLM_SEND_EMPTY_MESSAGE 1005 // an empty message shall be send
|
#define PROTMESSID_CLM_SEND_EMPTY_MESSAGE 1005 // an empty message shall be send
|
||||||
#define PROTMESSID_CLM_EMPTY_MESSAGE 1006 // empty message
|
#define PROTMESSID_CLM_EMPTY_MESSAGE 1006 // empty message
|
||||||
#define PROTMESSID_CLM_REGISTER_SERVER 1007 // register server
|
#define PROTMESSID_CLM_REGISTER_SERVER 1007 // register server
|
||||||
#define PROTMESSID_CLM_UNREGISTER_SERVER 1008 // unregister server
|
#define PROTMESSID_CLM_UNREGISTER_SERVER 1008 // unregister server -> TODO
|
||||||
|
|
||||||
|
|
||||||
// lengths of message as defined in protocol.cpp file
|
// lengths of message as defined in protocol.cpp file
|
||||||
|
@ -98,7 +98,9 @@ public:
|
||||||
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs );
|
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs );
|
||||||
void CreateCLServerFullMes ( const CHostAddress& InetAddr );
|
void CreateCLServerFullMes ( const CHostAddress& InetAddr );
|
||||||
void CreateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
void CreateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
||||||
const CServerInfo& ServerInfo );
|
const CServerCoreInfo& ServerInfo );
|
||||||
|
void CreateCLServerListMes ( const CHostAddress& InetAddr,
|
||||||
|
const CVector<CServerInfo> vecServerInfo );
|
||||||
|
|
||||||
void CreateAndImmSendDisconnectionMes();
|
void CreateAndImmSendDisconnectionMes();
|
||||||
void CreateAndImmSendAcknMess ( const int& iID,
|
void CreateAndImmSendAcknMess ( const int& iID,
|
||||||
|
@ -238,7 +240,8 @@ signals:
|
||||||
void Disconnection();
|
void Disconnection();
|
||||||
|
|
||||||
void CLPingReceived ( CHostAddress InetAddr, int iMs );
|
void CLPingReceived ( CHostAddress InetAddr, int iMs );
|
||||||
void CLRegisterServerReceived ( CHostAddress InetAddr, CServerInfo ServerInfo );
|
void CLRegisterServerReceived ( CHostAddress InetAddr,
|
||||||
|
CServerCoreInfo ServerInfo );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */
|
#endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */
|
||||||
|
|
|
@ -70,11 +70,12 @@ private network.
|
||||||
|
|
||||||
|
|
||||||
/* Classes ********************************************************************/
|
/* Classes ********************************************************************/
|
||||||
class CServerListProperties
|
class CServerListEntry : public CServerInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CServerListProperties() :
|
CServerListEntry() :
|
||||||
ServerInfo ( "",
|
CServerInfo ( CHostAddress(),
|
||||||
|
"",
|
||||||
"",
|
"",
|
||||||
QLocale::AnyCountry,
|
QLocale::AnyCountry,
|
||||||
"",
|
"",
|
||||||
|
@ -82,7 +83,7 @@ public:
|
||||||
0,
|
0,
|
||||||
false ) { RegisterTime.start(); }
|
false ) { RegisterTime.start(); }
|
||||||
|
|
||||||
CServerListProperties ( const CHostAddress& NIAddr,
|
CServerListEntry ( const CHostAddress& NIAddr,
|
||||||
const QString& NsName,
|
const QString& NsName,
|
||||||
const QString& NsTopic,
|
const QString& NsTopic,
|
||||||
const QLocale::Country& NeCountry,
|
const QLocale::Country& NeCountry,
|
||||||
|
@ -90,27 +91,20 @@ public:
|
||||||
const int NiNumClients,
|
const int NiNumClients,
|
||||||
const int NiMaxNumClients,
|
const int NiMaxNumClients,
|
||||||
const bool NbPermOnline)
|
const bool NbPermOnline)
|
||||||
: InetAddr ( NIAddr ), ServerInfo ( NsName,
|
: CServerInfo ( NIAddr,
|
||||||
|
NsName,
|
||||||
NsTopic,
|
NsTopic,
|
||||||
NeCountry,
|
NeCountry,
|
||||||
NsCity,
|
NsCity,
|
||||||
NiNumClients,
|
NiNumClients,
|
||||||
NiMaxNumClients,
|
NiMaxNumClients,
|
||||||
NbPermOnline )
|
NbPermOnline ) { RegisterTime.start(); }
|
||||||
{ RegisterTime.start(); }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// time on which the entry was registered
|
// time on which the entry was registered
|
||||||
QTime RegisterTime;
|
QTime RegisterTime;
|
||||||
|
|
||||||
// internet address of the server
|
|
||||||
CHostAddress InetAddr;
|
|
||||||
|
|
||||||
// infos of the server
|
|
||||||
CServerInfo ServerInfo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CServerListManager : public QObject
|
class CServerListManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -121,7 +115,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
QTimer TimerPollList;
|
QTimer TimerPollList;
|
||||||
QMutex Mutex;
|
QMutex Mutex;
|
||||||
QList<CServerListProperties> ServerList;
|
QList<CServerListEntry> ServerList;
|
||||||
bool bEnabled;
|
bool bEnabled;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
40
src/util.h
40
src/util.h
|
@ -452,10 +452,10 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Server info -----------------------------------------------------------------
|
// Server info -----------------------------------------------------------------
|
||||||
class CServerInfo
|
class CServerCoreInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CServerInfo() :
|
CServerCoreInfo() :
|
||||||
strName ( "" ),
|
strName ( "" ),
|
||||||
strTopic ( "" ),
|
strTopic ( "" ),
|
||||||
eCountry ( QLocale::AnyCountry ),
|
eCountry ( QLocale::AnyCountry ),
|
||||||
|
@ -464,7 +464,7 @@ public:
|
||||||
iMaxNumClients ( 0 ),
|
iMaxNumClients ( 0 ),
|
||||||
bPermanentOnline ( false ) {}
|
bPermanentOnline ( false ) {}
|
||||||
|
|
||||||
CServerInfo (
|
CServerCoreInfo (
|
||||||
const QString& NsName,
|
const QString& NsName,
|
||||||
const QString& NsTopic,
|
const QString& NsTopic,
|
||||||
const QLocale::Country& NeCountry,
|
const QLocale::Country& NeCountry,
|
||||||
|
@ -504,6 +504,40 @@ public:
|
||||||
bool bPermanentOnline;
|
bool bPermanentOnline;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CServerInfo : public CServerCoreInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CServerInfo() :
|
||||||
|
CServerCoreInfo ( "",
|
||||||
|
"",
|
||||||
|
QLocale::AnyCountry,
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
false ), InetAddr ( CHostAddress() ) {}
|
||||||
|
|
||||||
|
CServerInfo (
|
||||||
|
const CHostAddress& NIAddr,
|
||||||
|
const QString& NsName,
|
||||||
|
const QString& NsTopic,
|
||||||
|
const QLocale::Country& NeCountry,
|
||||||
|
const QString& NsCity,
|
||||||
|
const int NiNumClients,
|
||||||
|
const int NiMaxNumClients,
|
||||||
|
const bool NbPermOnline) :
|
||||||
|
CServerCoreInfo ( NsName,
|
||||||
|
NsTopic,
|
||||||
|
NeCountry,
|
||||||
|
NsCity,
|
||||||
|
NiNumClients,
|
||||||
|
NiMaxNumClients,
|
||||||
|
NbPermOnline ), InetAddr ( NIAddr ) {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
// internet address of the server
|
||||||
|
CHostAddress InetAddr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Audio compression type enum -------------------------------------------------
|
// Audio compression type enum -------------------------------------------------
|
||||||
enum EAudComprType
|
enum EAudComprType
|
||||||
|
|
Loading…
Reference in a new issue