Upstream tarball 20080414
[amule.git] / src / AsyncDNS.h
blob59e3c38f40a83466dd7d80d6f78e23b280916e06
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2008 Angel Vidal Veiga - Kry (kry@amule.org)
5 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
6 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 //
8 // Any parts of this program derived from the xMule, lMule or eMule project,
9 // or contributed by third-party developers are copyrighted by their
10 // respective authors.
12 // This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #ifndef ASYNCDNS_H
28 #define ASYNCDNS_H
30 #include <wx/string.h>
31 #include <wx/thread.h>
33 // Implementation of Asynchronous dns resolving using wxThread
34 // and internal wxIPV4address handling of dns
36 class wxEvtHandler;
38 enum DnsSolveType {
39 DNS_UDP,
40 DNS_SOURCE,
41 DNS_SERVER_CONNECT
44 // Time between DNS solving the same address
45 // 30 minutes * 60 s/m * 1000 ms/s
46 #define DNS_SOLVE_TIME 30*60*1000
49 class CAsyncDNS : public wxThread
51 public:
52 /** Note: wxChar* is used to circument the thread-unsafe wxString reference counting. */
53 CAsyncDNS(const wxChar* ipName, DnsSolveType type, wxEvtHandler* handler, void* socket = NULL);
54 virtual ExitCode Entry();
56 private:
57 DnsSolveType m_type;
58 wxString m_ipName;
59 void* m_socket;
60 wxEvtHandler* m_handler;
63 #endif // ASYNCDNS_H
64 // File_checked_for_headers