Release 2.3.3
[amule.git] / src / amuleIPV4Address.h
blobd9f9235c5678c2a851ed71f66d7a4f2965e2130f
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2004-2011 Carlo Wood ( carlo@alinoe.com )
5 // Copyright (c) 2004-2011 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.
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 "NetworkFunctions.h" // Needed for Uint32toStringIP
31 class amuleIPV4Address
33 public:
34 amuleIPV4Address();
35 amuleIPV4Address(const amuleIPV4Address &a);
36 amuleIPV4Address(const class CamuleIPV4Endpoint &ep);
37 virtual ~amuleIPV4Address();
38 amuleIPV4Address& operator=(const amuleIPV4Address &a);
39 amuleIPV4Address& operator=(const class CamuleIPV4Endpoint &a);
41 virtual bool Hostname(const wxString& name);
43 virtual bool Hostname(uint32 ip)
45 // Some people are sometimes fools.
46 if (!ip) {
47 return false;
50 return Hostname(Uint32toStringIP(ip));
54 // Set the port to that corresponding to the specified service.
55 // Returns true on success, false if something goes wrong (invalid service).
56 virtual bool Service(uint16 service);
58 // Returns the current service.
59 virtual uint16 Service() const;
61 // Determines if current address is set to localhost.
62 virtual bool IsLocalHost() const;
64 // Returns a wxString containing the IP address.
65 virtual wxString IPAddress() const;
67 // Set address to any of the addresses of the current machine.
68 virtual bool AnyAddress();
70 const class CamuleIPV4Endpoint & GetEndpoint() const;
71 class CamuleIPV4Endpoint & GetEndpoint();
73 private:
74 class CamuleIPV4Endpoint * m_endpoint;
77 #endif // AMULEIPV4ADDRESS_H
78 // File_checked_for_headers