/usr/include/eiskaltdcpp/dcpp/DownloadManager.h is in libeiskaltdcpp-dev 2.2.9-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /*
* Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "forward.h"
#include "DownloadManagerListener.h"
#include "UserConnectionListener.h"
#include "QueueItem.h"
#include "TimerManager.h"
#include "Singleton.h"
#include "MerkleTree.h"
#include "Speaker.h"
namespace dcpp {
/**
* Singleton. Use its listener interface to update the download list
* in the user interface.
*/
class DownloadManager : public Speaker<DownloadManagerListener>,
private UserConnectionListener, private TimerManagerListener,
public Singleton<DownloadManager>
{
public:
/** @internal */
void addConnection(UserConnectionPtr conn);
void checkIdle(const UserPtr& user);
/** @return Running average download speed in Bytes/s */
int64_t getRunningAverage();
/** @return Number of downloads. */
size_t getDownloadCount() {
Lock l(cs);
return downloads.size();
}
bool startDownload(QueueItem::Priority prio);
private:
CriticalSection cs;
DownloadList downloads;
UserConnectionList idlers;
void removeConnection(UserConnectionPtr aConn);
void removeDownload(Download* aDown);
void fileNotAvailable(UserConnection* aSource);
void noSlots(UserConnection* aSource);
void logDownload(UserConnection* aSource, Download* d);
int64_t getResumePos(const string& file, const TigerTree& tt, int64_t startPos);
void failDownload(UserConnection* aSource, const string& reason);
friend class Singleton<DownloadManager>;
DownloadManager();
virtual ~DownloadManager();
void checkDownloads(UserConnection* aConn);
void startData(UserConnection* aSource, int64_t start, int64_t newSize, bool z);
void endData(UserConnection* aSource);
void onFailed(UserConnection* aSource, const string& aError);
// UserConnectionListener
virtual void on(Data, UserConnection*, const uint8_t*, size_t) noexcept;
virtual void on(Failed, UserConnection* aSource, const string& aError) noexcept { onFailed(aSource, aError); }
virtual void on(ProtocolError, UserConnection* aSource, const string& aError) noexcept { onFailed(aSource, aError); }
virtual void on(MaxedOut, UserConnection*) noexcept;
virtual void on(FileNotAvailable, UserConnection*) noexcept;
virtual void on(Updated, UserConnection*) noexcept;
virtual void on(AdcCommand::SND, UserConnection*, const AdcCommand&) noexcept;
virtual void on(AdcCommand::STA, UserConnection*, const AdcCommand&) noexcept;
// TimerManagerListener
virtual void on(TimerManagerListener::Second, uint64_t aTick) noexcept;
};
} // namespace dcpp
|