Add missing #include to src/main/torrentclient.h.
[tairent.git] / src / azdhttracker / azdhttrackermodule.h
blobcc2fb62a9ac24d04d342fd4d285d89561c37ffb4
1 /***************************************************************************
2 * *
3 * Copyright (C) 2007 David Brodsky *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation and appearing *
8 * in the file LICENSE.GPL included in the packaging of this file. *
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 GNU *
13 * General Public License for more details. *
14 * *
15 ***************************************************************************/
17 #ifndef _azdhttracker_azdhttrackermodule_h
18 #define _azdhttracker_azdhttrackermodule_h
20 #include <tairon/core/module.h>
22 using Tairon::Core::String;
24 namespace Tairon
27 namespace Net
30 class Timer;
32 }; // namespace Net
34 }; // namespace Tairon
36 namespace Tairent
39 namespace Core
42 class BEncode;
44 }; // namespace Core
46 namespace Main
49 struct TorrentStruct;
51 }; // namespace Main
53 namespace AzDHTTracker
56 /** \brief Implementation of DHT tracker.
58 class AzDHTTrackerModule : public Tairon::Core::Module
60 public:
61 /** Constructs an AzDHTTrackerModule object.
63 AzDHTTrackerModule();
65 /** Destroys the object.
67 virtual ~AzDHTTrackerModule();
69 private:
70 /** Calls given method for all served torrents.
72 void forAllTorrents(void (AzDHTTrackerModule::*method)(const String &, Tairent::Main::TorrentStruct *));
74 /** Requests list of peers from the DHT.
76 void getPeers(const String &infoHash, Tairent::Main::TorrentStruct *torrent);
78 /** Registers our torrents in the DHT and requests peers.
80 void init();
82 /** Registers torrent in the DHT.
84 void registerTorrent(const String &infoHash, Tairent::Main::TorrentStruct *torrent);
86 /** Removes torrent's announce from the DHT.
88 void removeTorrent(const String &infoHash, Tairent::Main::TorrentStruct *torrent);
90 /** Requests list of peers for all served torrents.
92 void timeout();
94 /** Processes list of values supplied by the DHT.
96 * \param key The key for which the values were requested.
97 * \param values Usually list of values.
99 void valuesRead(const String &key, const Tairent::Core::BEncode &values);
101 private:
102 /** Timer for getting peers in regular intervals.
104 Tairon::Net::Timer *timer;
107 }; // namespace AzDHTTracker
109 }; // namespace Tairent
111 #endif
113 // vim: ai sw=4 ts=4 noet fdm=marker