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. 10 // 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. 15 // 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 24 // 25 26 #ifndef AMULEIPV4ADDRESS_H 27 #define AMULEIPV4ADDRESS_H 28 29 #include "NetworkFunctions.h" // Needed for Uint32toStringIP 30 31 class amuleIPV4Address 32 { 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); 40 41 virtual bool Hostname(const wxString& name); 42 Hostname(uint32 ip)43 virtual bool Hostname(uint32 ip) 44 { 45 // Some people are sometimes fools. 46 if (!ip) { 47 return false; 48 } 49 50 return Hostname(Uint32toStringIP(ip)); 51 } 52 53 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); 57 58 // Returns the current service. 59 virtual uint16 Service() const; 60 61 // Determines if current address is set to localhost. 62 virtual bool IsLocalHost() const; 63 64 // Returns a wxString containing the IP address. 65 virtual wxString IPAddress() const; 66 67 // Set address to any of the addresses of the current machine. 68 virtual bool AnyAddress(); 69 70 const class CamuleIPV4Endpoint & GetEndpoint() const; 71 class CamuleIPV4Endpoint & GetEndpoint(); 72 73 private: 74 class CamuleIPV4Endpoint * m_endpoint; 75 }; 76 77 #endif // AMULEIPV4ADDRESS_H 78 // File_checked_for_headers 79