aboutsummaryrefslogtreecommitdiff
path: root/dep/include/sockets/Ipv4Address.h
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:51:44 -0700
committermaximius <none@none>2009-10-17 15:51:44 -0700
commite585187b248f48b3c6e9247b49fa07c6565d65e5 (patch)
tree637c5b7ddacf41040bef4ea4f75a97da64c6a9bc /dep/include/sockets/Ipv4Address.h
parent26b5e033ffde3d161382fc9addbfa99738379641 (diff)
*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
Diffstat (limited to 'dep/include/sockets/Ipv4Address.h')
-rw-r--r--dep/include/sockets/Ipv4Address.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/dep/include/sockets/Ipv4Address.h b/dep/include/sockets/Ipv4Address.h
index 5a8d9a6ce20..ba2292425a0 100644
--- a/dep/include/sockets/Ipv4Address.h
+++ b/dep/include/sockets/Ipv4Address.h
@@ -5,27 +5,33 @@
**/
/*
Copyright (C) 2007 Anders Hedstrom
+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SOCKETS_Ipv4Address_H
#define _SOCKETS_Ipv4Address_H
+
#include "sockets-config.h"
#include "SocketAddress.h"
+
#ifdef SOCKETS_NAMESPACE
namespace SOCKETS_NAMESPACE {
#endif
+
/* Ipv4 address implementation.
\ingroup basic */
class Ipv4Address : public SocketAddress
@@ -48,25 +54,33 @@ public:
Ipv4Address(const std::string& host,port_t port);
Ipv4Address(struct sockaddr_in&);
~Ipv4Address();
+
// SocketAddress implementation
+
operator struct sockaddr *();
operator socklen_t();
bool operator==(SocketAddress&);
+
void SetPort(port_t port);
port_t GetPort();
+
void SetAddress(struct sockaddr *sa);
int GetFamily();
+
bool IsValid();
std::auto_ptr<SocketAddress> GetCopy();
+
/** Convert address struct to text. */
std::string Convert(bool include_port = false);
std::string Reverse();
+
/** Resolve hostname. */
static bool Resolve(const std::string& hostname,struct in_addr& a);
/** Reverse resolve (IP to hostname). */
static bool Reverse(struct in_addr& a,std::string& name);
/** Convert address struct to text. */
static std::string Convert(struct in_addr& a);
+
private:
Ipv4Address(const Ipv4Address& ) {} // copy constructor
Ipv4Address& operator=(const Ipv4Address& ) { return *this; } // assignment operator
@@ -75,8 +89,11 @@ private:
};
+
+
#ifdef SOCKETS_NAMESPACE
} // namespace SOCKETS_NAMESPACE {
#endif
#endif // _SOCKETS_Ipv4Address_H
+