Fixed some build warnings in release mode
[amule.git] / src / ClientTCPSocket.h
blob63f64aefaae8a7de38b9a537500197f10ad8f232
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 // Handling incoming connections (up or downloadrequests)
30 #ifndef CLIENTTCPSOCKET_H
31 #define CLIENTTCPSOCKET_H
33 #include "EMSocket.h" // Needed for CEMSocket
35 class CProxyData;
37 //------------------------------------------------------------------------------
38 // CClientTCPSocket
39 //------------------------------------------------------------------------------
41 class CUpDownClient;
42 class CPacket;
43 class CTimerWnd;
45 class CClientTCPSocket : public CEMSocket
47 public:
48 CClientTCPSocket(CUpDownClient* in_client = NULL, const CProxyData *ProxyData = NULL);
49 virtual ~CClientTCPSocket();
51 void Disconnect(const wxString& strReason);
53 bool InitNetworkData();
55 bool CheckTimeOut();
57 void Safe_Delete();
58 void Safe_Delete_Client();
60 bool ForDeletion() const { return m_ForDeletion; }
62 void OnConnect(int nErrorCode);
63 void OnSend(int nErrorCode);
64 void OnReceive(int nErrorCode);
66 void OnClose(int nErrorCode);
67 void OnError(int nErrorCode);
69 uint32 GetRemoteIP() const { return m_remoteip; }
71 CUpDownClient* GetClient() { return m_client; }
73 virtual void SendPacket(CPacket* packet, bool delpacket = true, bool controlpacket = true, uint32 actualPayloadSize = 0);
74 virtual SocketSentBytes SendControlData(uint32 maxNumberOfBytesToSend, uint32 overchargeMaxBytesToSend);
75 virtual SocketSentBytes SendFileAndControlData(uint32 maxNumberOfBytesToSend, uint32 overchargeMaxBytesToSend);
77 protected:
78 virtual bool PacketReceived(CPacket* packet);
80 private:
81 CUpDownClient* m_client;
83 bool ProcessPacket(const byte* packet, uint32 size, uint8 opcode);
84 bool ProcessExtPacket(const byte* packet, uint32 size, uint8 opcode);
85 bool ProcessED2Kv2Packet(const byte* packet, uint32 size, uint8 opcode);
86 void ResetTimeOutTimer();
87 void SetClient(CUpDownClient* client);
89 bool m_ForDeletion; // 0.30c (Creteil), set as bool
90 uint32 timeout_timer;
91 uint32 m_remoteip;
94 #endif // CLIENTTCPSOCKET_H
95 // File_checked_for_headers