libktorrent  2.2.0
peersourcemanager.h
1 /***************************************************************************
2  * Copyright (C) 2005 by Joris Guisson *
3  * joris.guisson@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef BTPEERSOURCEMANAGER_H
21 #define BTPEERSOURCEMANAGER_H
22 
23 
24 #include <util/constants.h>
25 #include <util/waitjob.h>
26 #include <tracker/tracker.h>
27 #include <tracker/trackermanager.h>
28 #include <interfaces/torrentinterface.h>
29 
30 
31 
32 namespace dht
33 {
34  class DHTPeerSource;
35 }
36 
37 namespace bt
38 {
39  class Torrent;
40  class TorrentControl;
41  class PeerSource;
42 
49  {
50  Q_OBJECT
51 
52  QList<PeerSource*> additional;
53  dht::DHTPeerSource* m_dht;
54 
55  public:
57  ~PeerSourceManager() override;
58 
59 
67 
73 
77  bool isStarted() const {return started;}
78 
79 
80  void start() override;
81  void stop(WaitJob* wjob = 0) override;
82  void completed() override;
83  void manualUpdate() override;
84 
86  void addDHT();
88  void removeDHT();
90  bool dhtStarted();
91  };
92 
93 }
94 
95 #endif
bt::PeerSourceManager::manualUpdate
void manualUpdate() override
bt::PeerSourceManager::addDHT
void addDHT()
Adds DHT as PeerSource for this torrent.
bt::PeerSourceManager::stop
void stop(WaitJob *wjob=0) override
bt::PeerSourceManager::removePeerSource
void removePeerSource(PeerSource *ps)
bt::PeerSourceManager::removeDHT
void removeDHT()
Removes DHT from PeerSourceManager for this torrent.
bt::PeerSourceManager
Definition: peersourcemanager.h:49
bt::PeerSourceManager::isStarted
bool isStarted() const
Definition: peersourcemanager.h:77
bt::WaitJob
Definition: waitjob.h:39
bt::PeerManager
Manages all the Peers.
Definition: peermanager.h:67
bt::PeerSource
Definition: peersource.h:42
bt::PeerSourceManager::addPeerSource
void addPeerSource(PeerSource *ps)
bt::PeerSourceManager::dhtStarted
bool dhtStarted()
Checks if DHT is enabled.
bt::TrackerManager
Definition: trackermanager.h:43
bt::TorrentControl
Controls just about everything.
Definition: torrentcontrol.h:69
bt::PeerSourceManager::completed
void completed() override
bt::PeerSourceManager::start
void start() override
dht::DHTPeerSource
Definition: dhtpeersource.h:46