1 /***************************************************************************
3 * Copyright (C) 2007 David Brodsky *
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. *
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. *
15 ***************************************************************************/
17 #ifndef _azdhttracker_azdhttrackermodule_h
18 #define _azdhttracker_azdhttrackermodule_h
20 #include <tairon/core/module.h>
22 using Tairon::Core::String
;
34 }; // namespace Tairon
53 namespace AzDHTTracker
56 /** \brief Implementation of DHT tracker.
58 class AzDHTTrackerModule
: public Tairon::Core::Module
61 /** Constructs an AzDHTTrackerModule object.
65 /** Destroys the object.
67 virtual ~AzDHTTrackerModule();
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.
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.
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
);
102 /** Timer for getting peers in regular intervals.
104 Tairon::Net::Timer
*timer
;
107 }; // namespace AzDHTTracker
109 }; // namespace Tairent
113 // vim: ai sw=4 ts=4 noet fdm=marker