aboutsummaryrefslogtreecommitdiff
path: root/dep/src/sockets/Utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dep/src/sockets/Utility.cpp')
-rw-r--r--dep/src/sockets/Utility.cpp40
1 files changed, 0 insertions, 40 deletions
diff --git a/dep/src/sockets/Utility.cpp b/dep/src/sockets/Utility.cpp
index 6473f0a2564..7c093fc0832 100644
--- a/dep/src/sockets/Utility.cpp
+++ b/dep/src/sockets/Utility.cpp
@@ -45,7 +45,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
namespace SOCKETS_NAMESPACE {
#endif
-
// defines for the random number generator
#define TWIST_IA 397
#define TWIST_IB (TWIST_LEN - TWIST_IA)
@@ -55,7 +54,6 @@ namespace SOCKETS_NAMESPACE {
#define TWIST(b,i,j) ((b)[i] & UMASK) | ((b)[j] & LMASK)
#define MAGIC_TWIST(s) (((s) & 1) * MATRIX_A)
-
// statics
std::string Utility::m_host;
bool Utility::m_local_resolved = false;
@@ -68,7 +66,6 @@ std::string Utility::m_local_addr6;
#endif
#endif
-
std::string Utility::base64(const std::string& str_in)
{
std::string str;
@@ -77,7 +74,6 @@ std::string Utility::base64(const std::string& str_in)
return str;
}
-
std::string Utility::base64d(const std::string& str_in)
{
std::string str;
@@ -86,7 +82,6 @@ std::string Utility::base64d(const std::string& str_in)
return str;
}
-
std::string Utility::l2string(long l)
{
std::string str;
@@ -96,7 +91,6 @@ std::string Utility::l2string(long l)
return str;
}
-
std::string Utility::bigint2string(uint64_t l)
{
std::string str;
@@ -114,7 +108,6 @@ std::string Utility::bigint2string(uint64_t l)
return str;
}
-
uint64_t Utility::atoi64(const std::string& str)
{
uint64_t l = 0;
@@ -125,7 +118,6 @@ uint64_t Utility::atoi64(const std::string& str)
return l;
}
-
unsigned int Utility::hex2unsigned(const std::string& str)
{
unsigned int r = 0;
@@ -136,7 +128,6 @@ unsigned int Utility::hex2unsigned(const std::string& str)
return r;
}
-
/*
* Encode string per RFC1738 URL encoding rules
* tnx rstaveley
@@ -167,7 +158,6 @@ static char hex[] = "0123456789ABCDEF";
return dst;
} // rfc1738_encode
-
/*
* Decode string per RFC1738 URL encoding rules
* tnx rstaveley
@@ -198,7 +188,6 @@ std::string Utility::rfc1738_decode(const std::string& src)
return dst;
} // rfc1738_decode
-
bool Utility::isipv4(const std::string& str)
{
int dots = 0;
@@ -216,7 +205,6 @@ bool Utility::isipv4(const std::string& str)
return true;
}
-
bool Utility::isipv6(const std::string& str)
{
size_t qc = 0;
@@ -256,7 +244,6 @@ bool Utility::isipv6(const std::string& str)
return true;
}
-
bool Utility::u2ip(const std::string& str, ipaddr_t& l)
{
struct sockaddr_in sa;
@@ -265,7 +252,6 @@ bool Utility::u2ip(const std::string& str, ipaddr_t& l)
return r;
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
bool Utility::u2ip(const std::string& str, struct in6_addr& l)
@@ -278,7 +264,6 @@ bool Utility::u2ip(const std::string& str, struct in6_addr& l)
#endif
#endif
-
void Utility::l2ip(const ipaddr_t ip, std::string& str)
{
struct sockaddr_in sa;
@@ -288,7 +273,6 @@ void Utility::l2ip(const ipaddr_t ip, std::string& str)
Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST);
}
-
void Utility::l2ip(const in_addr& ip, std::string& str)
{
struct sockaddr_in sa;
@@ -298,7 +282,6 @@ void Utility::l2ip(const in_addr& ip, std::string& str)
Utility::reverse( (struct sockaddr *)&sa, sizeof(sa), str, NI_NUMERICHOST);
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
void Utility::l2ip(const struct in6_addr& ip, std::string& str,bool mixed)
@@ -347,7 +330,6 @@ void Utility::l2ip(const struct in6_addr& ip, std::string& str,bool mixed)
str = slask;
}
-
int Utility::in6_addr_compare(in6_addr a,in6_addr b)
{
for (size_t i = 0; i < 16; i++)
@@ -362,7 +344,6 @@ int Utility::in6_addr_compare(in6_addr a,in6_addr b)
#endif
#endif
-
void Utility::ResolveLocal()
{
char h[256];
@@ -391,7 +372,6 @@ void Utility::ResolveLocal()
m_local_resolved = true;
}
-
const std::string& Utility::GetLocalHostname()
{
if (!m_local_resolved)
@@ -401,7 +381,6 @@ const std::string& Utility::GetLocalHostname()
return m_host;
}
-
ipaddr_t Utility::GetLocalIP()
{
if (!m_local_resolved)
@@ -411,7 +390,6 @@ ipaddr_t Utility::GetLocalIP()
return m_ip;
}
-
const std::string& Utility::GetLocalAddress()
{
if (!m_local_resolved)
@@ -421,7 +399,6 @@ const std::string& Utility::GetLocalAddress()
return m_addr;
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
const struct in6_addr& Utility::GetLocalIP6()
@@ -433,7 +410,6 @@ const struct in6_addr& Utility::GetLocalIP6()
return m_local_ip6;
}
-
const std::string& Utility::GetLocalAddress6()
{
if (!m_local_resolved)
@@ -445,7 +421,6 @@ const std::string& Utility::GetLocalAddress6()
#endif
#endif
-
void Utility::SetEnv(const std::string& var,const std::string& value)
{
#if (defined(SOLARIS8) || defined(SOLARIS))
@@ -469,7 +444,6 @@ void Utility::SetEnv(const std::string& var,const std::string& value)
#endif
}
-
std::string Utility::Sa2String(struct sockaddr *sa)
{
#ifdef ENABLE_IPV6
@@ -495,7 +469,6 @@ std::string Utility::Sa2String(struct sockaddr *sa)
return "";
}
-
void Utility::GetTime(struct timeval *p)
{
#ifdef _WIN32
@@ -511,7 +484,6 @@ void Utility::GetTime(struct timeval *p)
#endif
}
-
std::auto_ptr<SocketAddress> Utility::CreateAddress(struct sockaddr *sa,socklen_t sa_len)
{
switch (sa -> sa_family)
@@ -538,7 +510,6 @@ std::auto_ptr<SocketAddress> Utility::CreateAddress(struct sockaddr *sa,socklen_
return std::auto_ptr<SocketAddress>(NULL);
}
-
bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags)
{
memset(&sa, 0, sizeof(sa));
@@ -631,7 +602,6 @@ bool Utility::u2ip(const std::string& host, struct sockaddr_in& sa, int ai_flags
#endif // NO_GETADDRINFO
}
-
#ifdef ENABLE_IPV6
#ifdef IPPROTO_IPV6
bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flags)
@@ -747,14 +717,12 @@ bool Utility::u2ip(const std::string& host, struct sockaddr_in6& sa, int ai_flag
#endif // IPPROTO_IPV6
#endif // ENABLE_IPV6
-
bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, int flags)
{
std::string service;
return Utility::reverse(sa, sa_len, hostname, service, flags);
}
-
bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostname, std::string& service, int flags)
{
hostname = "";
@@ -870,7 +838,6 @@ bool Utility::reverse(struct sockaddr *sa, socklen_t sa_len, std::string& hostna
#endif // NO_GETADDRINFO
}
-
bool Utility::u2service(const std::string& name, int& service, int ai_flags)
{
#ifdef NO_GETADDRINFO
@@ -903,7 +870,6 @@ bool Utility::u2service(const std::string& name, int& service, int ai_flags)
#endif // NO_GETADDRINFO
}
-
unsigned long Utility::ThreadID()
{
#ifdef _WIN32
@@ -913,7 +879,6 @@ unsigned long Utility::ThreadID()
#endif
}
-
std::string Utility::ToLower(const std::string& str)
{
std::string r;
@@ -927,7 +892,6 @@ std::string Utility::ToLower(const std::string& str)
return r;
}
-
std::string Utility::ToUpper(const std::string& str)
{
std::string r;
@@ -941,7 +905,6 @@ std::string Utility::ToUpper(const std::string& str)
return r;
}
-
std::string Utility::ToString(double d)
{
char tmp[100];
@@ -949,14 +912,12 @@ std::string Utility::ToString(double d)
return tmp;
}
-
unsigned long Utility::Rnd()
{
static Utility::Rng generator( (unsigned long)time(NULL) );
return generator.Get();
}
-
Utility::Rng::Rng(unsigned long seed) : m_value( 0 )
{
m_tmp[0]= seed & 0xffffffffUL;
@@ -966,7 +927,6 @@ Utility::Rng::Rng(unsigned long seed) : m_value( 0 )
}
}
-
unsigned long Utility::Rng::Get()
{
unsigned long val = m_tmp[m_value];