/usr/include/torrent/http.h is in libtorrent-dev 0.13.2-1.
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | // libTorrent - BitTorrent library
// Copyright (C) 2005-2011, Jari Sundell
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations
// including the two.
//
// You must obey the GNU General Public License in all respects for
// all of the code used other than OpenSSL. If you modify file(s)
// with this exception, you may extend this exception to your version
// of the file(s), but you are not obligated to do so. If you do not
// wish to do so, delete this exception statement from your version.
// If you delete this exception statement from all source files in the
// program, then also delete it here.
//
// Contact: Jari Sundell <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#ifndef LIBTORRENT_HTTP_H
#define LIBTORRENT_HTTP_H
#include <string>
#include <iosfwd>
#include <list>
#include <tr1/functional>
#include <torrent/common.h>
namespace torrent {
// The client should set the user agent to something like
// "CLIENT_NAME/CLIENT_VERSION/LIBRARY_VERSION".
// Keep in mind that these objects get reused.
class LIBTORRENT_EXPORT Http {
public:
typedef std::tr1::function<void ()> slot_void;
typedef std::tr1::function<void (const std::string&)> slot_string;
typedef std::tr1::function<Http* (void)> slot_http;
typedef std::list<slot_void> signal_void;
typedef std::list<slot_string> signal_string;
static const int flag_delete_self = 0x1;
static const int flag_delete_stream = 0x2;
Http() : m_flags(0), m_stream(NULL), m_timeout(0) {}
virtual ~Http();
// Start must never throw on bad input. Calling start/stop on an
// object in the wrong state should throw a torrent::internal_error.
virtual void start() = 0;
virtual void close() = 0;
int flags() const { return m_flags; }
void set_delete_self() { m_flags |= flag_delete_self; }
void set_delete_stream() { m_flags |= flag_delete_stream; }
const std::string& url() const { return m_url; }
void set_url(const std::string& url) { m_url = url; }
// Make sure the output stream does not have any bad/failed bits set.
std::iostream* stream() { return m_stream; }
void set_stream(std::iostream* str) { m_stream = str; }
uint32_t timeout() const { return m_timeout; }
void set_timeout(uint32_t seconds) { m_timeout = seconds; }
// The owner of the Http object must close it as soon as possible
// after receiving the signal, as the implementation may allocate
// limited resources during its lifetime.
signal_void& signal_done() { return m_signal_done; }
signal_string& signal_failed() { return m_signal_failed; }
// Guaranteed to return a valid object or throw a internal_error. The
// caller takes ownership of the returned object.
static slot_http& slot_factory() { return m_factory; }
protected:
void trigger_done();
void trigger_failed(const std::string& message);
int m_flags;
std::string m_url;
std::iostream* m_stream;
uint32_t m_timeout;
signal_void m_signal_done;
signal_string m_signal_failed;
private:
Http(const Http&);
void operator = (const Http&);
static slot_http m_factory;
};
}
#endif
|