aboutsummaryrefslogtreecommitdiff
path: root/dep/include/sockets/Utility.h
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:35:07 -0700
committermaximius <none@none>2009-10-17 15:35:07 -0700
commit26b5e033ffde3d161382fc9addbfa99738379641 (patch)
treea344f369ca32945f787a02dee35c3dbe342bed7e /dep/include/sockets/Utility.h
parentf21f47005dcb6b76e1abc9f35fbcd03eed191bff (diff)
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
Diffstat (limited to 'dep/include/sockets/Utility.h')
-rw-r--r--dep/include/sockets/Utility.h29
1 files changed, 0 insertions, 29 deletions
diff --git a/dep/include/sockets/Utility.h b/dep/include/sockets/Utility.h
index be0f6a05498..8f1c15ab260 100644
--- a/dep/include/sockets/Utility.h
+++ b/dep/include/sockets/Utility.h
@@ -4,32 +4,26 @@
**/
/*
Copyright (C) 2004-2007 Anders Hedstrom
-
This library is made available under the terms of the GNU GPL.
-
If you would like to use this library in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for the C++ sockets library,
please visit http://www.alhem.net/Sockets/license.html and/or
email license@alhem.net.
-
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_Utility_H
#define _SOCKETS_Utility_H
-
#include "sockets-config.h"
#include <ctype.h>
#include <string.h>
@@ -37,15 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "socket_include.h"
#include <map>
#include <string>
-
#ifdef SOCKETS_NAMESPACE
namespace SOCKETS_NAMESPACE {
#endif
-
#define TWIST_LEN 624
-
class SocketAddress;
-
/** Conversion utilities.
\ingroup util */
class Utility
@@ -57,9 +47,7 @@ class Utility
class Rng {
public:
Rng(unsigned long seed);
-
unsigned long Get();
-
private:
int m_value;
unsigned long m_tmp[TWIST_LEN];
@@ -84,16 +72,13 @@ public:
static unsigned int hex2unsigned(const std::string& str);
static std::string rfc1738_encode(const std::string& src);
static std::string rfc1738_decode(const std::string& src);
-
/** Checks whether a string is a valid ipv4/ipv6 ip number. */
static bool isipv4(const std::string&);
/** Checks whether a string is a valid ipv4/ipv6 ip number. */
static bool isipv6(const std::string&);
-
/** Hostname to ip resolution ipv4, not asynchronous. */
static bool u2ip(const std::string&, ipaddr_t&);
static bool u2ip(const std::string&, struct sockaddr_in& sa, int ai_flags = 0);
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
/** Hostname to ip resolution ipv6, not asynchronous. */
@@ -101,13 +86,10 @@ public:
static bool u2ip(const std::string&, struct sockaddr_in6& sa, int ai_flags = 0);
#endif
#endif
-
/** Reverse lookup of address to hostname */
static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string&, int flags = 0);
static bool reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags = 0);
-
static bool u2service(const std::string& name, int& service, int ai_flags = 0);
-
/** Convert binary ip address to string: ipv4. */
static void l2ip(const ipaddr_t,std::string& );
static void l2ip(const in_addr&,std::string& );
@@ -115,7 +97,6 @@ public:
#ifdef IPPROTO_IPV6
/** Convert binary ip address to string: ipv6. */
static void l2ip(const struct in6_addr&,std::string& ,bool mixed = false);
-
/** ipv6 address compare. */
static int in6_addr_compare(in6_addr,in6_addr);
#endif
@@ -148,22 +129,15 @@ public:
/** Convert sockaddr struct to human readable string.
\param sa Ptr to sockaddr struct */
static std::string Sa2String(struct sockaddr *sa);
-
/** Get current time in sec/microseconds. */
static void GetTime(struct timeval *);
-
static std::auto_ptr<SocketAddress> CreateAddress(struct sockaddr *,socklen_t);
-
static unsigned long ThreadID();
-
static std::string ToLower(const std::string& str);
static std::string ToUpper(const std::string& str);
-
static std::string ToString(double d);
-
/** Returns a random 32-bit integer */
static unsigned long Rnd();
-
private:
static std::string m_host; ///< local hostname
static ipaddr_t m_ip; ///< local ip address
@@ -177,11 +151,8 @@ private:
static bool m_local_resolved; ///< ResolveLocal has been called if true
};
-
#ifdef SOCKETS_NAMESPACE
}
#endif
-
#endif // _SOCKETS_Utility_H
-