3131#include < cmath>
3232#include " global.h"
3333#include " util.h"
34+ #include " tcpserver.h"
3435
3536/* Definitions ****************************************************************/
3637// protocol message IDs
@@ -141,15 +142,15 @@ class CProtocol : public QObject
141142 void CreateCLRegisterServerMes ( const CHostAddress& InetAddr, const CHostAddress& LInetAddr, const CServerCoreInfo& ServerInfo );
142143 void CreateCLRegisterServerExMes ( const CHostAddress& InetAddr, const CHostAddress& LInetAddr, const CServerCoreInfo& ServerInfo );
143144 void CreateCLUnregisterServerMes ( const CHostAddress& InetAddr );
144- void CreateCLServerListMes ( const CHostAddress& InetAddr, const CVector<CServerInfo> vecServerInfo );
145+ void CreateCLServerListMes ( const CHostAddress& InetAddr, const CVector<CServerInfo> vecServerInfo, CTcpConnection* pTcpConnection );
145146 void CreateCLRedServerListMes ( const CHostAddress& InetAddr, const CVector<CServerInfo> vecServerInfo );
146147 void CreateCLReqServerListMes ( const CHostAddress& InetAddr );
147148 void CreateCLSendEmptyMesMes ( const CHostAddress& InetAddr, const CHostAddress& TargetInetAddr );
148149 void CreateCLEmptyMes ( const CHostAddress& InetAddr );
149150 void CreateCLDisconnection ( const CHostAddress& InetAddr );
150151 void CreateCLVersionAndOSMes ( const CHostAddress& InetAddr );
151152 void CreateCLReqVersionAndOSMes ( const CHostAddress& InetAddr );
152- void CreateCLConnClientsListMes ( const CHostAddress& InetAddr, const CVector<CChannelInfo>& vecChanInfo );
153+ void CreateCLConnClientsListMes ( const CHostAddress& InetAddr, const CVector<CChannelInfo>& vecChanInfo, CTcpConnection* pTcpConnection );
153154 void CreateCLReqConnClientsListMes ( const CHostAddress& InetAddr );
154155 void CreateCLChannelLevelListMes ( const CHostAddress& InetAddr, const CVector<uint16_t >& vecLevelList, const int iNumClients );
155156 void CreateCLRegisterServerResp ( const CHostAddress& InetAddr, const ESvrRegResult eResult );
@@ -164,7 +165,10 @@ class CProtocol : public QObject
164165
165166 void ParseMessageBody ( const CVector<uint8_t >& vecbyMesBodyData, const int iRecCounter, const int iRecID );
166167
167- void ParseConnectionLessMessageBody ( const CVector<uint8_t >& vecbyMesBodyData, const int iRecID, const CHostAddress& InetAddr );
168+ void ParseConnectionLessMessageBody ( const CVector<uint8_t >& vecbyMesBodyData,
169+ const int iRecID,
170+ const CHostAddress& InetAddr,
171+ CTcpConnection* pTcpConnection );
168172
169173 static bool IsConnectionLessMessageID ( const int iID ) { return ( iID >= 1000 ) && ( iID < 2000 ); }
170174
@@ -243,7 +247,10 @@ class CProtocol : public QObject
243247
244248 void CreateAndSendMessage ( const int iID, const CVector<uint8_t >& vecData );
245249
246- void CreateAndImmSendConLessMessage ( const int iID, const CVector<uint8_t >& vecData, const CHostAddress& InetAddr );
250+ void CreateAndImmSendConLessMessage ( const int iID,
251+ const CVector<uint8_t >& vecData,
252+ const CHostAddress& InetAddr,
253+ CTcpConnection* pTcpConnection = nullptr );
247254
248255 bool EvaluateJitBufMes ( const CVector<uint8_t >& vecData );
249256 bool EvaluateReqJitBufMes ();
@@ -272,13 +279,13 @@ class CProtocol : public QObject
272279 bool EvaluateCLUnregisterServerMes ( const CHostAddress& InetAddr );
273280 bool EvaluateCLServerListMes ( const CHostAddress& InetAddr, const CVector<uint8_t >& vecData );
274281 bool EvaluateCLRedServerListMes ( const CHostAddress& InetAddr, const CVector<uint8_t >& vecData );
275- bool EvaluateCLReqServerListMes ( const CHostAddress& InetAddr );
282+ bool EvaluateCLReqServerListMes ( const CHostAddress& InetAddr, CTcpConnection* pTcpConnection );
276283 bool EvaluateCLSendEmptyMesMes ( const CVector<uint8_t >& vecData );
277284 bool EvaluateCLDisconnectionMes ( const CHostAddress& InetAddr );
278285 bool EvaluateCLVersionAndOSMes ( const CHostAddress& InetAddr, const CVector<uint8_t >& vecData );
279286 bool EvaluateCLReqVersionAndOSMes ( const CHostAddress& InetAddr );
280287 bool EvaluateCLConnClientsListMes ( const CHostAddress& InetAddr, const CVector<uint8_t >& vecData );
281- bool EvaluateCLReqConnClientsListMes ( const CHostAddress& InetAddr );
288+ bool EvaluateCLReqConnClientsListMes ( const CHostAddress& InetAddr, CTcpConnection* pTcpConnection );
282289 bool EvaluateCLChannelLevelListMes ( const CHostAddress& InetAddr, const CVector<uint8_t >& vecData );
283290 bool EvaluateCLRegisterServerResp ( const CHostAddress& InetAddr, const CVector<uint8_t >& vecData );
284291
@@ -303,7 +310,7 @@ public slots:
303310signals:
304311 // transmitting
305312 void MessReadyForSending ( CVector<uint8_t > vecMessage );
306- void CLMessReadyForSending ( CHostAddress InetAddr, CVector<uint8_t > vecMessage );
313+ void CLMessReadyForSending ( CHostAddress InetAddr, CVector<uint8_t > vecMessage, CTcpConnection* pTcpConnection );
307314
308315 // receiving
309316 void ChangeJittBufSize ( int iNewJitBufSize );
@@ -338,13 +345,13 @@ public slots:
338345 void CLUnregisterServerReceived ( CHostAddress InetAddr );
339346 void CLServerListReceived ( CHostAddress InetAddr, CVector<CServerInfo> vecServerInfo );
340347 void CLRedServerListReceived ( CHostAddress InetAddr, CVector<CServerInfo> vecServerInfo );
341- void CLReqServerList ( CHostAddress InetAddr );
348+ void CLReqServerList ( CHostAddress InetAddr, CTcpConnection* pTcpConnection );
342349 void CLSendEmptyMes ( CHostAddress TargetInetAddr );
343350 void CLDisconnection ( CHostAddress InetAddr );
344351 void CLVersionAndOSReceived ( CHostAddress InetAddr, COSUtil::EOpSystemType eOSType, QString strVersion );
345352 void CLReqVersionAndOS ( CHostAddress InetAddr );
346353 void CLConnClientsListMesReceived ( CHostAddress InetAddr, CVector<CChannelInfo> vecChanInfo );
347- void CLReqConnClientsList ( CHostAddress InetAddr );
354+ void CLReqConnClientsList ( CHostAddress InetAddr, CTcpConnection* pTcpConnection );
348355 void CLChannelLevelListReceived ( CHostAddress InetAddr, CVector<uint16_t > vecLevelList );
349356 void CLRegisterServerResp ( CHostAddress InetAddr, ESvrRegResult eStatus );
350357};
0 commit comments