/usr/include/libktorrent/net/reverseresolver.h is in libktorrent-dev 1.3.1-5.
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 | /***************************************************************************
* Copyright (C) 2009 by Joris Guisson *
* joris.guisson@gmail.com *
* *
* 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., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef NET_REVERSERESOLVER_H
#define NET_REVERSERESOLVER_H
#include <QObject>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <ktorrent_export.h>
#include <net/address.h>
namespace net
{
class ReverseResolverThread;
/**
Resolve an IP address into a hostname
This should be threated as fire and forget objects, when using them asynchronously.
The worker thread will delete them, when they are done.
*/
class ReverseResolver : public QObject
{
Q_OBJECT
public:
ReverseResolver(QObject* parent = 0);
virtual ~ReverseResolver();
/**
Resolve an ip address asynchronously, uses the worker thread
Connecting to the resolved signal should be done with Qt::QueuedConnection, seeing
that it will be emitted from the worker thread.
@param addr The address
*/
void resolveAsync(const net::Address & addr);
/**
Resolve an ip address synchronously.
*/
QString resolve(const net::Address & addr);
/**
Run the actual resolve and emit the signal when done
*/
void run();
/// Shutdown the worker thread
static void shutdown();
signals:
/// Emitted when the resolution is complete
void resolved(const QString & host);
private:
static ReverseResolverThread* worker;
net::Address addr_to_resolve;
};
class ReverseResolverThread : public QThread
{
Q_OBJECT
public:
ReverseResolverThread();
virtual ~ReverseResolverThread();
/// Add a ReverseResolver to the todo list
void add(ReverseResolver* rr);
/// Run the thread
virtual void run();
/// Stop the thread
void stop();
private:
QMutex mutex;
QWaitCondition more_data;
QList<ReverseResolver*> todo_list;
bool stopped;
};
}
#endif // NET_REVERSERESOLVER_H
|