Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Typedefs | Enumerations | Functions | Variables
netbase.h File Reference
#include "compat.h"
#include "serialize.h"
#include <stdint.h>
#include <string>
#include <vector>
+ Include dependency graph for netbase.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CNetAddr
 IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) More...
 
class  CService
 A combination of a network address (CNetAddr) and a (TCP) port. More...
 

Typedefs

typedef std::pair< CService, intproxyType
 

Enumerations

enum  Network {
  NET_UNROUTABLE,
  NET_IPV4,
  NET_IPV6,
  NET_TOR,
  NET_MAX
}
 

Functions

enum Network ParseNetwork (std::string net)
 
void SplitHostPort (std::string in, int &portOut, std::string &hostOut)
 
bool SetProxy (enum Network net, CService addrProxy, int nSocksVersion=5)
 
bool GetProxy (enum Network net, proxyType &proxyInfoOut)
 
bool IsProxy (const CNetAddr &addr)
 
bool SetNameProxy (CService addrProxy, int nSocksVersion=5)
 
bool HaveNameProxy ()
 
bool LookupHost (const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions=0, bool fAllowLookup=true)
 
bool LookupHostNumeric (const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions=0)
 
bool Lookup (const char *pszName, CService &addr, int portDefault=0, bool fAllowLookup=true)
 
bool Lookup (const char *pszName, std::vector< CService > &vAddr, int portDefault=0, bool fAllowLookup=true, unsigned int nMaxSolutions=0)
 
bool LookupNumeric (const char *pszName, CService &addr, int portDefault=0)
 
bool ConnectSocket (const CService &addr, SOCKET &hSocketRet, int nTimeout=nConnectTimeout)
 
bool ConnectSocketByName (CService &addr, SOCKET &hSocketRet, const char *pszDest, int portDefault=0, int nTimeout=nConnectTimeout)
 
std::string NetworkErrorString (int err)
 Return readable error string for a network error code. More...
 

Variables

int nConnectTimeout
 
bool fNameLookup
 

Typedef Documentation

typedef std::pair<CService, int> proxyType

Definition at line 136 of file netbase.h.

Enumeration Type Documentation

enum Network
Enumerator
NET_UNROUTABLE 
NET_IPV4 
NET_IPV6 
NET_TOR 
NET_MAX 

Definition at line 26 of file netbase.h.

Function Documentation

bool ConnectSocket ( const CService addr,
SOCKET hSocketRet,
int  nTimeout = nConnectTimeout 
)

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ConnectSocketByName ( CService addr,
SOCKET hSocketRet,
const char *  pszDest,
int  portDefault = 0,
int  nTimeout = nConnectTimeout 
)

Definition at line 504 of file netbase.cpp.

References closesocket, ConnectSocket(), ConnectSocketDirectly(), fNameLookup, GetNameProxy(), INVALID_SOCKET, CNetAddr::IsValid(), Socks5(), and SplitHostPort().

Referenced by ConnectNode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool GetProxy ( enum Network  net,
proxyType proxyInfoOut 
)

Definition at line 430 of file netbase.cpp.

References LOCK, NET_MAX, and proxyInfo.

Referenced by ConnectSocket(), getblockchaininfo(), getinfo(), getnetworkinfo(), and OptionsModel::getProxySettings().

+ Here is the caller graph for this function:

bool HaveNameProxy ( )

Definition at line 457 of file netbase.cpp.

References LOCK, and nameproxyInfo.

Referenced by ThreadDNSAddressSeed(), and ThreadOpenAddedConnections().

+ Here is the caller graph for this function:

bool IsProxy ( const CNetAddr addr)

Definition at line 462 of file netbase.cpp.

References LOCK, NET_MAX, and proxyInfo.

Referenced by CNode::PushVersion().

+ Here is the caller graph for this function:

bool Lookup ( const char *  pszName,
CService addr,
int  portDefault = 0,
bool  fAllowLookup = true 
)

Definition at line 151 of file netbase.cpp.

References Lookup().

+ Here is the call graph for this function:

bool Lookup ( const char *  pszName,
std::vector< CService > &  vAddr,
int  portDefault = 0,
bool  fAllowLookup = true,
unsigned int  nMaxSolutions = 0 
)

Definition at line 133 of file netbase.cpp.

References LookupIntern(), and SplitHostPort().

Referenced by AppInit2(), CService::CService(), getaddednodeinfo(), Lookup(), LookupNumeric(), and ThreadOpenAddedConnections().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LookupHost ( const char *  pszName,
std::vector< CNetAddr > &  vIP,
unsigned int  nMaxSolutions = 0,
bool  fAllowLookup = true 
)

Definition at line 115 of file netbase.cpp.

References LookupIntern().

Referenced by CNetAddr::CNetAddr(), Discover(), LookupHostNumeric(), and ThreadDNSAddressSeed().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LookupHostNumeric ( const char *  pszName,
std::vector< CNetAddr > &  vIP,
unsigned int  nMaxSolutions = 0 
)

Definition at line 128 of file netbase.cpp.

References LookupHost().

+ Here is the call graph for this function:

bool LookupNumeric ( const char *  pszName,
CService addr,
int  portDefault = 0 
)

Definition at line 161 of file netbase.cpp.

References Lookup().

Referenced by OptionsDialog::doProxyIpChecks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

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().

+ Here is the caller graph for this function:

bool SetNameProxy ( CService  addrProxy,
int  nSocksVersion = 5 
)

Definition at line 439 of file netbase.cpp.

References CNetAddr::IsValid(), LOCK, and nameproxyInfo.

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SetProxy ( enum Network  net,
CService  addrProxy,
int  nSocksVersion = 5 
)

Definition at line 419 of file netbase.cpp.

References CNetAddr::IsValid(), LOCK, NET_MAX, and proxyInfo.

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SplitHostPort ( std::string  in,
int portOut,
std::string &  hostOut 
)

Definition at line 43 of file netbase.cpp.

Referenced by ConnectSocketByName(), and Lookup().

+ Here is the caller graph for this function:

Variable Documentation

bool fNameLookup
int nConnectTimeout

Definition at line 36 of file netbase.h.

Referenced by AppInit2().