Upstream tarball 20080418
[amule.git] / src / amuleIPV4Address.h
blob24faa5ebe9ea5552169bbc7bdb287da123b07896
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2008 Carlo Wood ( carlo@alinoe.com )
5 // Copyright (c) 2004-2008 aMule Team ( admin@amule.org / http://www.amule.org )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #ifndef AMULEIPV4ADDRESS_H
27 #define AMULEIPV4ADDRESS_H
29 #include <wx/object.h> // Needed by wx/sckaddr.h
31 #include "NetworkFunctions.h" // Needed for StringIPtoUint32
34 // This is fscking hard to maintain. wxWidgets 2.5.2 has changed internal
35 // ipaddress structs.
36 // prevent fscking dns queries
37 class amuleIPV4Address : public wxIPV4address
39 public:
40 amuleIPV4Address() {}
41 amuleIPV4Address(const wxIPV4address &a) : wxIPV4address(a) {}
43 virtual bool Hostname(const wxString& name) {
44 // Some people are sometimes fools.
45 if (name.IsEmpty()) {
46 // wxASSERT(0);
47 return false;
50 return Hostname(StringIPtoUint32(name));
53 virtual bool Hostname(uint32 ip) {
54 // Some people are sometimes fools.
55 if (!ip) {
56 // wxASSERT(0);
57 return false;
60 // We have to take care that wxIPV4address's internals changed on 2.5.2
61 return GAddress_INET_SetHostAddress(m_address,wxUINT32_SWAP_ALWAYS(ip))==GSOCK_NOERROR;
65 #endif // AMULEIPV4ADDRESS_H
66 // File_checked_for_headers