![]() |
Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
#include "netbase.h"
#include "hash.h"
#include "sync.h"
#include "uint256.h"
#include "util.h"
#include <fcntl.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
Go to the source code of this file.
Functions | |
enum Network | ParseNetwork (std::string net) |
void | SplitHostPort (std::string in, int &portOut, std::string &hostOut) |
static bool | LookupIntern (const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup) |
bool | LookupHost (const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup) |
bool | LookupHostNumeric (const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions) |
bool | Lookup (const char *pszName, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions) |
bool | Lookup (const char *pszName, CService &addr, int portDefault, bool fAllowLookup) |
bool | LookupNumeric (const char *pszName, CService &addr, int portDefault) |
static bool | Socks4 (const CService &addrDest, SOCKET &hSocket) |
static bool | Socks5 (string strDest, int port, SOCKET &hSocket) |
static bool | ConnectSocketDirectly (const CService &addrConnect, SOCKET &hSocketRet, int nTimeout) |
bool | SetProxy (enum Network net, CService addrProxy, int nSocksVersion) |
bool | GetProxy (enum Network net, proxyType &proxyInfoOut) |
bool | SetNameProxy (CService addrProxy, int nSocksVersion) |
bool | GetNameProxy (proxyType &nameproxyInfoOut) |
bool | HaveNameProxy () |
bool | IsProxy (const CNetAddr &addr) |
bool | ConnectSocket (const CService &addrDest, SOCKET &hSocketRet, int nTimeout) |
bool | ConnectSocketByName (CService &addr, SOCKET &hSocketRet, const char *pszDest, int portDefault, int nTimeout) |
bool | operator== (const CNetAddr &a, const CNetAddr &b) |
bool | operator!= (const CNetAddr &a, const CNetAddr &b) |
bool | operator< (const CNetAddr &a, const CNetAddr &b) |
static int | GetExtNetwork (const CNetAddr *addr) |
bool | operator== (const CService &a, const CService &b) |
bool | operator!= (const CService &a, const CService &b) |
bool | operator< (const CService &a, const CService &b) |
std::string | NetworkErrorString (int err) |
Return readable error string for a network error code. More... | |
Variables | |
static proxyType | proxyInfo [NET_MAX] |
static proxyType | nameproxyInfo |
static CCriticalSection | cs_proxyInfos |
int | nConnectTimeout = 5000 |
bool | fNameLookup = false |
static const unsigned char | pchIPv4 [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff } |
static const unsigned char | pchOnionCat [] = {0xFD,0x87,0xD8,0x7E,0xEB,0x43} |
static const int | NET_UNKNOWN = NET_MAX + 0 |
static const int | NET_TEREDO = NET_MAX + 1 |
Definition at line 471 of file netbase.cpp.
References closesocket, ConnectSocketDirectly(), CNetAddr::GetNetwork(), CService::GetPort(), GetProxy(), INVALID_SOCKET, Socks4(), Socks5(), and CNetAddr::ToStringIP().
Referenced by ConnectNode(), ConnectSocketByName(), and GetMyExternalIP2().
bool ConnectSocketByName | ( | CService & | addr, |
SOCKET & | hSocketRet, | ||
const char * | pszDest, | ||
int | portDefault, | ||
int | nTimeout | ||
) |
Definition at line 504 of file netbase.cpp.
References closesocket, ConnectSocket(), ConnectSocketDirectly(), fNameLookup, GetNameProxy(), INVALID_SOCKET, CNetAddr::IsValid(), Socks5(), and SplitHostPort().
Referenced by ConnectNode().
|
static |
Definition at line 314 of file netbase.cpp.
References closesocket, CService::GetSockAddr(), INVALID_SOCKET, LogPrint(), LogPrintf, NetworkErrorString(), SOCKET_ERROR, CService::ToString(), WSAEINPROGRESS, WSAEINVAL, WSAEWOULDBLOCK, and WSAGetLastError.
Referenced by ConnectSocket(), and ConnectSocketByName().
Definition at line 892 of file netbase.cpp.
References CNetAddr::GetNetwork(), CNetAddr::IsRFC4380(), and NET_UNKNOWN.
Referenced by CNetAddr::GetReachabilityFrom().
bool GetNameProxy | ( | proxyType & | nameproxyInfoOut | ) |
Definition at line 449 of file netbase.cpp.
References LOCK, and nameproxyInfo.
Referenced by ConnectSocketByName().
Definition at line 430 of file netbase.cpp.
References LOCK, NET_MAX, and proxyInfo.
Referenced by ConnectSocket(), getblockchaininfo(), getinfo(), getnetworkinfo(), and OptionsModel::getProxySettings().
bool HaveNameProxy | ( | ) |
Definition at line 457 of file netbase.cpp.
References LOCK, and nameproxyInfo.
Referenced by ThreadDNSAddressSeed(), and ThreadOpenAddedConnections().
bool IsProxy | ( | const CNetAddr & | addr | ) |
Definition at line 462 of file netbase.cpp.
References LOCK, NET_MAX, and proxyInfo.
Referenced by CNode::PushVersion().
bool Lookup | ( | const char * | pszName, |
std::vector< CService > & | vAddr, | ||
int | portDefault, | ||
bool | fAllowLookup, | ||
unsigned int | nMaxSolutions | ||
) |
Definition at line 133 of file netbase.cpp.
References LookupIntern(), and SplitHostPort().
Referenced by AppInit2(), CService::CService(), getaddednodeinfo(), Lookup(), LookupNumeric(), and ThreadOpenAddedConnections().
Definition at line 151 of file netbase.cpp.
References Lookup().
bool LookupHost | ( | const char * | pszName, |
std::vector< CNetAddr > & | vIP, | ||
unsigned int | nMaxSolutions, | ||
bool | fAllowLookup | ||
) |
Definition at line 115 of file netbase.cpp.
References LookupIntern().
Referenced by CNetAddr::CNetAddr(), Discover(), LookupHostNumeric(), and ThreadDNSAddressSeed().
bool LookupHostNumeric | ( | const char * | pszName, |
std::vector< CNetAddr > & | vIP, | ||
unsigned int | nMaxSolutions | ||
) |
Definition at line 128 of file netbase.cpp.
References LookupHost().
|
static |
Definition at line 64 of file netbase.cpp.
References CNetAddr::SetSpecial().
Referenced by Lookup(), and LookupHost().
Definition at line 161 of file netbase.cpp.
References Lookup().
Referenced by OptionsDialog::doProxyIpChecks().
std::string NetworkErrorString | ( | int | err | ) |
Return readable error string for a network error code.
Definition at line 1143 of file netbase.cpp.
References strprintf.
Referenced by BindListenPort(), ConnectNode(), ConnectSocketDirectly(), RecvLine(), SocketSendData(), ThreadSocketHandler(), and CNetCleanup::~CNetCleanup().
Definition at line 782 of file netbase.cpp.
References CNetAddr::ip.
Definition at line 1048 of file netbase.cpp.
References CService::port.
Definition at line 787 of file netbase.cpp.
References CNetAddr::ip.
Definition at line 1053 of file netbase.cpp.
References CService::port.
Definition at line 777 of file netbase.cpp.
References CNetAddr::ip.
Definition at line 1043 of file netbase.cpp.
References CService::port.
enum Network ParseNetwork | ( | std::string | net | ) |
Definition at line 35 of file netbase.cpp.
References NET_IPV4, NET_IPV6, NET_TOR, and NET_UNROUTABLE.
Referenced by AppInit2().
Definition at line 439 of file netbase.cpp.
References CNetAddr::IsValid(), LOCK, and nameproxyInfo.
Referenced by AppInit2().
Definition at line 419 of file netbase.cpp.
References CNetAddr::IsValid(), LOCK, NET_MAX, and proxyInfo.
Referenced by AppInit2().
Definition at line 166 of file netbase.cpp.
References closesocket, error(), CService::GetSockAddr(), CNetAddr::IsIPv4(), LogPrintf, memcpy(), MSG_NOSIGNAL, and CService::ToString().
Referenced by ConnectSocket().
Definition at line 210 of file netbase.cpp.
References closesocket, error(), LogPrintf, and MSG_NOSIGNAL.
Referenced by ConnectSocket(), and ConnectSocketByName().
void SplitHostPort | ( | std::string | in, |
int & | portOut, | ||
std::string & | hostOut | ||
) |
Definition at line 43 of file netbase.cpp.
Referenced by ConnectSocketByName(), and Lookup().
|
static |
Definition at line 29 of file netbase.cpp.
bool fNameLookup = false |
Definition at line 31 of file netbase.cpp.
Referenced by AppInit2(), ConnectSocketByName(), getaddednodeinfo(), and ThreadOpenAddedConnections().
|
static |
Definition at line 28 of file netbase.cpp.
Referenced by GetNameProxy(), HaveNameProxy(), and SetNameProxy().
int nConnectTimeout = 5000 |
Definition at line 30 of file netbase.cpp.
Referenced by AppInit2().
Definition at line 891 of file netbase.cpp.
Definition at line 890 of file netbase.cpp.
Referenced by GetExtNetwork().
|
static |
Definition at line 33 of file netbase.cpp.
Referenced by CNetAddr::CNetAddr(), CNetAddr::IsIPv4(), and CNetAddr::IsValid().
|
static |
Definition at line 551 of file netbase.cpp.
Referenced by CNetAddr::IsTor(), and CNetAddr::SetSpecial().
Definition at line 27 of file netbase.cpp.
Referenced by GetProxy(), IsProxy(), and SetProxy().