retain compatibility to old versions in regards to the server and the old ping messages -> to be removed later on

This commit is contained in:
Volker Fischer 2011-06-12 08:04:14 +00:00
parent dc1ea0d111
commit d48c1ac3b4
6 changed files with 766 additions and 687 deletions

File diff suppressed because it is too large Load diff

View file

@ -124,6 +124,7 @@ public:
void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); }
void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); }
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
void CreatePingMes ( const int iMs ) { Protocol.CreatePingMes ( iMs ); }
void CreateConClientListMes ( const CVector<CChannelShortInfo>& vecChanInfo )
{
@ -194,6 +195,7 @@ signals:
void NameHasChanged();
void ReqChanName();
void ChatTextReceived ( QString strChatText );
void PingReceived ( int iMs );
void ReqNetTranspProps();
void Disconnected();
void DetectedCLMessage ( CVector<uint8_t> vecbyData,

View file

@ -518,6 +518,11 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
bRet = EvaluateChatTextMes ( vecData );
break;
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
case PROTMESSID_PING_MS:
bRet = EvaluatePingMes ( vecData );
break;
case PROTMESSID_NETW_TRANSPORT_PROPS:
bRet = EvaluateNetwTranspPropsMes ( vecData );
break;
@ -914,6 +919,38 @@ bool CProtocol::EvaluateChatTextMes ( const CVector<uint8_t>& vecData )
return false; // no error
}
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
void CProtocol::CreatePingMes ( const int iMs )
{
int iPos = 0; // init position pointer
// build data vector (4 bytes long)
CVector<uint8_t> vecData ( 4 );
// transmit time (4 bytes)
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( iMs ), 4 );
CreateAndSendMessage ( PROTMESSID_PING_MS, vecData );
}
bool CProtocol::EvaluatePingMes ( const CVector<uint8_t>& vecData )
{
int iPos = 0; // init position pointer
// check size
if ( vecData.Size() != 4 )
{
return true; // return error code
}
// invoke message action
emit PingReceived ( static_cast<int> ( GetValFromStream ( vecData, iPos, 4 ) ) );
return false; // no error
}
void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps )
{
int iPos = 0; // init position pointer

View file

@ -47,7 +47,7 @@
#define PROTMESSID_REQ_CONN_CLIENTS_LIST 16 // request connected client list
#define PROTMESSID_CHANNEL_NAME 17 // set channel name for fader tag
#define PROTMESSID_CHAT_TEXT 18 // contains a chat text
#define PROTMESSID_PING_MS 19 // OLD (not used anymore)
#define PROTMESSID_PING_MS 19 // for measuring ping time
#define PROTMESSID_NETW_TRANSPORT_PROPS 20 // properties for network transport
#define PROTMESSID_REQ_NETW_TRANSPORT_PROPS 21 // request properties for network transport
#define PROTMESSID_DISCONNECTION 22 // OLD (not used anymore)
@ -93,6 +93,7 @@ public:
void CreateChanNameMes ( const QString strName );
void CreateReqChanNameMes();
void CreateChatTextMes ( const QString strChatText );
void CreatePingMes ( const int iMs );
void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps );
void CreateReqNetwTranspPropsMes();
@ -203,6 +204,7 @@ protected:
bool EvaluateChanNameMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqChanNameMes();
bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData );
bool EvaluatePingMes ( const CVector<uint8_t>& vecData );
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqNetwTranspPropsMes();
@ -250,6 +252,7 @@ signals:
void ChangeChanName ( QString strName );
void ReqChanName();
void ChatTextReceived ( QString strChatText );
void PingReceived ( int iMs );
void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void ReqNetTranspProps();

View file

@ -412,6 +412,22 @@ CServer::CServer ( const int iNewNumChan,
QObject::connect ( &vecChannels[9], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh9 ( int ) ) );
QObject::connect ( &vecChannels[10], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh10 ( int ) ) );
QObject::connect ( &vecChannels[11], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh11 ( int ) ) );
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
QObject::connect ( &vecChannels[0], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh0 ( int ) ) );
QObject::connect ( &vecChannels[1], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh1 ( int ) ) );
QObject::connect ( &vecChannels[2], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh2 ( int ) ) );
QObject::connect ( &vecChannels[3], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh3 ( int ) ) );
QObject::connect ( &vecChannels[4], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh4 ( int ) ) );
QObject::connect ( &vecChannels[5], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh5 ( int ) ) );
QObject::connect ( &vecChannels[6], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh6 ( int ) ) );
QObject::connect ( &vecChannels[7], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh7 ( int ) ) );
QObject::connect ( &vecChannels[8], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh8 ( int ) ) );
QObject::connect ( &vecChannels[9], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh9 ( int ) ) );
QObject::connect ( &vecChannels[10], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh10 ( int ) ) );
QObject::connect ( &vecChannels[11], SIGNAL ( PingReceived ( int ) ), this, SLOT ( OnPingReceivedCh11 ( int ) ) );
}
void CServer::OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage )

View file

@ -380,6 +380,22 @@ public slots:
void OnServerAutoSockBufSizeChangeCh9 ( int iNNumFra ) { vecChannels[9].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh10 ( int iNNumFra ) { vecChannels[10].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh11 ( int iNNumFra ) { vecChannels[11].CreateJitBufMes ( iNNumFra ); }
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
void OnPingReceivedCh0 ( int iMs ) { vecChannels[0].CreatePingMes ( iMs ); }
void OnPingReceivedCh1 ( int iMs ) { vecChannels[1].CreatePingMes ( iMs ); }
void OnPingReceivedCh2 ( int iMs ) { vecChannels[2].CreatePingMes ( iMs ); }
void OnPingReceivedCh3 ( int iMs ) { vecChannels[3].CreatePingMes ( iMs ); }
void OnPingReceivedCh4 ( int iMs ) { vecChannels[4].CreatePingMes ( iMs ); }
void OnPingReceivedCh5 ( int iMs ) { vecChannels[5].CreatePingMes ( iMs ); }
void OnPingReceivedCh6 ( int iMs ) { vecChannels[6].CreatePingMes ( iMs ); }
void OnPingReceivedCh7 ( int iMs ) { vecChannels[7].CreatePingMes ( iMs ); }
void OnPingReceivedCh8 ( int iMs ) { vecChannels[8].CreatePingMes ( iMs ); }
void OnPingReceivedCh9 ( int iMs ) { vecChannels[9].CreatePingMes ( iMs ); }
void OnPingReceivedCh10 ( int iMs ) { vecChannels[10].CreatePingMes ( iMs ); }
void OnPingReceivedCh11 ( int iMs ) { vecChannels[11].CreatePingMes ( iMs ); }
};
#endif /* !defined ( SERVER_HOIHGE7LOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ ) */