Updated Hungarian translation by GonoszTopi
[amule.git] / src / CorruptionBlackBox.h
blobd2138b825a563831d3876adbe94a2ebf1add6f66
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2008-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2008-2011 Stu Redman ( sturedman@amule.org )
6 // Copyright (C) 2002-2011 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net )
7 //
8 // Any parts of this program derived from the xMule, lMule or eMule project,
9 // or contributed by third-party developers are copyrighted by their
10 // respective authors.
12 // This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #ifndef CORRUPTIONBLACKBOX_H
28 #define CORRUPTIONBLACKBOX_H
30 #include "Types.h"
31 #include <list>
32 #include <map>
34 class CCorruptionBlackBox
36 public:
37 void Free();
38 void TransferredData(uint64 nStartPos, uint64 nEndPos, uint32 senderIP);
39 void VerifiedData(bool ok, uint16 nPart, uint32 nRelStartPos, uint32 nRelEndPos);
40 void EvaluateData();
41 void SetPartFileInfo(const wxString& name, const wxString& nr) { m_fileName = name; m_partNumber = nr; }
42 void DumpAll();
44 private:
45 // downloaded data for each part
46 class CCBBRecord
48 public:
49 CCBBRecord(uint32 nStartPos, uint32 nEndPos, uint32 dwIP);
50 bool Merge(uint32 nStartPos, uint32 nEndPos, uint32 dwIP);
52 // Startpos / Endpos relative to part
53 uint32 m_nStartPos;
54 uint32 m_nEndPos;
55 // IP of client
56 uint32 m_dwIP;
58 typedef std::list<CCBBRecord> CRecordList;
59 std::map<uint16, CRecordList> m_Records;
61 // good/bad data for each client
62 class CCBBClient
64 public:
65 CCBBClient() { m_downloaded = 0; }
66 uint64 m_downloaded;
68 typedef std::map<uint32, CCBBClient> CCBBClientMap;
69 CCBBClientMap m_goodClients, m_badClients;
71 // for debug prints
72 wxString m_fileName;
73 wxString m_partNumber;
76 #endif