From 1462ad50db430a1042516111b758db07a24c07f4 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Wed, 27 May 2020 15:38:36 +0100 Subject: [PATCH 1/2] Implement CLMessReadyForSending in CTestbench. The class had code to generate connectionless messages, but it didn't implement the signal to send them. --- src/testbench.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/testbench.h b/src/testbench.h index 0fb35fbd..fa5d398b 100755 --- a/src/testbench.h +++ b/src/testbench.h @@ -60,9 +60,11 @@ public: iPortIncrement++; } - // connect protocol signal + // connect protocol signals QObject::connect ( &Protocol, SIGNAL ( MessReadyForSending ( CVector ) ), this, SLOT ( OnSendProtMessage ( CVector ) ) ); + QObject::connect ( &Protocol, SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector ) ), + this, SLOT ( OnSendCLMessage ( CHostAddress, CVector ) ) ); // connect and start the timer (testbench heartbeat) QObject::connect ( &Timer, SIGNAL ( timeout() ), @@ -295,4 +297,12 @@ public slots: // send the next message Protocol.Reset(); } + + void OnSendCLMessage ( CHostAddress InetAddr, CVector vecMessage ) + { + // silence unused warning + (void) InetAddr; + + OnSendProtMessage ( vecMessage ); + } }; From a876b265037bbd6ff9cb4577dc1912ac1a957d54 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Thu, 28 May 2020 01:44:15 +0100 Subject: [PATCH 2/2] Add recent message types to CTestbench. The code that generated random messages hadn't been updated for the last few types of messages. --- src/testbench.h | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/testbench.h b/src/testbench.h index fa5d398b..0a7737f0 100755 --- a/src/testbench.h +++ b/src/testbench.h @@ -117,13 +117,15 @@ public slots: CNetworkTransportProps NetTrProps; CServerCoreInfo ServerInfo; CVector vecServerInfo ( 1 ); + CVector vecLevelList ( 1 ); CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort ); CHostAddress CurLocalAddress ( QHostAddress ( sLAddress ), iLPort ); CChannelCoreInfo ChannelCoreInfo; ELicenceType eLicenceType; + ESvrRegResult eSvrRegResult; // generate random protocol message - switch ( GenRandomIntInRange ( 0, 27 ) ) + switch ( GenRandomIntInRange ( 0, 34 ) ) { case 0: // PROTMESSID_JITT_BUF_SIZE Protocol.CreateJitBufMes ( GenRandomIntInRange ( 0, 10 ) ); @@ -280,11 +282,55 @@ public slots: break; case 27: + { // arbitrary "audio" packet (with random sizes) CVector vecMessage ( GenRandomIntInRange ( 1, 1000 ) ); OnSendProtMessage ( vecMessage ); break; } + + case 28: // PROTMESSID_CLM_CONN_CLIENTS_LIST + vecChanInfo[0].iChanID = GenRandomIntInRange ( -2, 20 ); + vecChanInfo[0].iIpAddr = GenRandomIPv4Address().toIPv4Address(); + vecChanInfo[0].strName = GenRandomString(); + + Protocol.CreateCLConnClientsListMes ( CurHostAddress, vecChanInfo ); + break; + + case 29: // PROTMESSID_CLM_REQ_CONN_CLIENTS_LIST + Protocol.CreateCLReqConnClientsListMes ( CurHostAddress ); + break; + + case 30: // PROTMESSID_CLM_CHANNEL_LEVEL_LIST + vecLevelList[0] = GenRandomIntInRange ( 0, 0xF ); + + Protocol.CreateCLChannelLevelListMes ( CurHostAddress, + vecLevelList, + 1 ); + break; + + case 31: // PROTMESSID_CLM_REGISTER_SERVER_RESP + eSvrRegResult = + static_cast ( GenRandomIntInRange ( 0, 1 ) ); + + Protocol.CreateCLRegisterServerResp ( CurHostAddress, + eSvrRegResult ); + break; + + case 32: // PROTMESSID_CHANNEL_PAN + Protocol.CreateChanPanMes ( GenRandomIntInRange ( -2, 20 ), + GenRandomIntInRange ( 0, 32767 ) ); + break; + + case 33: // PROTMESSID_MUTE_STATE_CHANGED + Protocol.CreateMuteStateHasChangedMes ( GenRandomIntInRange ( -2, 20 ), + GenRandomIntInRange ( 0, 1 ) ); + break; + + case 34: // PROTMESSID_CLIENT_ID + Protocol.CreateClientIDMes ( GenRandomIntInRange ( -2, 20 ) ); + break; + } } void OnSendProtMessage ( CVector vecMessage )