Upstream tarball 10114
[amule.git] / src / UploadQueue.h
blob320a8c782c6af35d19f269309381ff283782e8fc
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2008 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
26 #ifndef UPLOADQUEUE_H
27 #define UPLOADQUEUE_H
29 #include "MD4Hash.h" // Needed for CMD4Hash
32 class CUpDownClient;
34 class CUploadQueue
36 public:
37 CUploadQueue();
38 ~CUploadQueue();
39 void Process();
40 void AddClientToQueue(CUpDownClient* client);
41 bool RemoveFromUploadQueue(CUpDownClient* client);
42 bool RemoveFromWaitingQueue(CUpDownClient* client);
43 bool IsOnUploadQueue(const CUpDownClient* client) const;
44 bool IsDownloading(CUpDownClient* client) const;
45 bool CheckForTimeOver(CUpDownClient* client);
47 const CClientPtrList& GetWaitingList() const { return m_waitinglist; }
48 const CClientPtrList& GetUploadingList() const { return m_uploadinglist; }
50 CUpDownClient* GetWaitingClientByIP(uint32 dwIP);
51 CUpDownClient* GetWaitingClientByIP_UDP(uint32 dwIP, uint16 nUDPPort, bool bIgnorePortOnUniqueIP, bool* pbMultipleIPs = NULL);
53 uint16 GetWaitingPosition(const CUpDownClient *client) const;
54 uint16 SuspendUpload(const CMD4Hash &);
55 void ResumeUpload(const CMD4Hash &);
57 private:
58 void RemoveFromWaitingQueue(CClientPtrList::iterator pos);
59 uint16 GetMaxSlots() const;
60 void AddUpNextClient(CUpDownClient* directadd = 0);
62 CClientPtrList m_waitinglist;
63 CClientPtrList m_uploadinglist;
65 typedef std::list<CMD4Hash> suspendlist;
66 suspendlist suspended_uploads_list; //list for suspended uploads
67 uint32 m_nLastStartUpload;
68 bool lastupslotHighID; // VQB lowID alternation
69 bool m_allowKicking;
72 #endif // UPLOADQUEUE_H
73 // File_checked_for_headers