libktorrent  2.2.0
addressresolver.h
1 /***************************************************************************
2  * Copyright (C) 2011 by Joris Guisson *
3  * joris.guisson@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
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 *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 
22 #ifndef NET_ADDRESSRESOLVER_H
23 #define NET_ADDRESSRESOLVER_H
24 
25 #include <QHostInfo>
26 #include <ktorrent_export.h>
27 #include <net/address.h>
28 
29 namespace net
30 {
31 
36  class KTORRENT_EXPORT AddressResolver : public QObject
37  {
38  Q_OBJECT
39  public:
47  AddressResolver(const QString & host, bt::Uint16 port, QObject* parent, const char* slot);
48  ~AddressResolver() override;
49 
51  bool succeeded() const {return succesfull;}
52 
54  const net::Address & address() const {return result;}
55 
64  static void resolve(const QString & host, bt::Uint16 port, QObject* parent, const char* slot);
65 
72  static net::Address resolve(const QString & host, bt::Uint16 port);
73 
74  Q_SIGNALS:
80 
81  private Q_SLOTS:
82  void hostResolved(const QHostInfo & res);
83 
84  private:
85  int lookup_id;
86  net::Address result;
87  bool succesfull;
88  bool ongoing;
89  };
90 
91 }
92 
93 #endif // NET_ADDRESSRESOLVER_H
net::AddressResolver::AddressResolver
AddressResolver(const QString &host, bt::Uint16 port, QObject *parent, const char *slot)
net::AddressResolver
Definition: addressresolver.h:37
net::Address
Definition: address.h:41
net::AddressResolver::address
const net::Address & address() const
Get the resulting address.
Definition: addressresolver.h:54
net::AddressResolver::resolve
static void resolve(const QString &host, bt::Uint16 port, QObject *parent, const char *slot)
net::AddressResolver::succeeded
bool succeeded() const
Dit the resolver succeed ?
Definition: addressresolver.h:51
net::AddressResolver::resolve
static net::Address resolve(const QString &host, bt::Uint16 port)
net::AddressResolver::resolved
void resolved(net::AddressResolver *ar)