Send correct informations to a http tracker.
[tairent.git] / src / httptrackerclient / client.h
blobd0d4d8d63370039c0d66b1824d96f8fb942c6a19
1 /***************************************************************************
2 * *
3 * Copyright (C) 2006 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 _httptracker_client_client_h
18 #define _httptracker_client_client_h
20 #include "main/trackerclient.h"
22 namespace Tairon
25 namespace Net
28 class HTTPClient;
29 class Timer;
31 }; // namespace Net
33 }; // namespace Tairon
35 namespace Tairent
38 namespace TrackerClient
41 /** \brief Tracker client for http protocol.
43 class HTTPTrackerClient : public Tairent::Main::TrackerClient
45 public:
46 /** Creates a tracker client object.
48 * \param c Torrent that uses this tracker.
50 HTTPTrackerClient(Tairent::Main::TorrentClient *c);
52 /** Destroys the object.
54 virtual ~HTTPTrackerClient();
56 /** Gets peers from the tracker and passes it to the client.
58 virtual void getPeers();
60 /** Sends to the tracker that this client is no longer available.
62 virtual void stop();
64 private:
65 /** Called when there are data available from the tracker.
67 void dataRead(Tairon::Net::HTTPClient *);
69 /** Called when an error occurs.
71 void error(Tairon::Net::HTTPClient *, const char *msg, int err);
73 /** Called when an error occurs during stopping.
75 void errorWhileStopping(Tairon::Net::HTTPClient *, const char *, int);
77 /** Called when the client is stopped.
79 void stopped(Tairon::Net::HTTPClient *);
81 /** Called when an interval timeout occurs.
83 void timeout();
85 private:
86 /** HTTP client used to get data from the tracker.
88 Tairon::Net::HTTPClient *httpclient;
90 /** Timer used for rerequests.
92 Tairon::Net::Timer *timer;
94 /** URI of the tracker.
96 String uri;
99 }; // namespace TrackerClient
101 }; // namespace HTTPTrackerClienti
103 #endif
105 // vim: ai sw=4 ts=4 noet fdm=marker