From a876b265037bbd6ff9cb4577dc1912ac1a957d54 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Thu, 28 May 2020 01:44:15 +0100 Subject: [PATCH] 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 )