Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <compat.h>
#include <netaddress.h>
#include <serialize.h>
#include <stdint.h>
#include <string>
#include <vector>
Go to the source code of this file.
Classes | |
class | proxyType |
Functions | |
enum Network | ParseNetwork (std::string net) |
std::string | GetNetworkName (enum Network net) |
bool | SetProxy (enum Network net, const proxyType &addrProxy) |
bool | GetProxy (enum Network net, proxyType &proxyInfoOut) |
bool | IsProxy (const CNetAddr &addr) |
bool | SetNameProxy (const proxyType &addrProxy) |
bool | HaveNameProxy () |
bool | GetNameProxy (proxyType &nameProxyOut) |
bool | LookupHost (const char *pszName, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup) |
bool | LookupHost (const char *pszName, CNetAddr &addr, bool fAllowLookup) |
bool | Lookup (const char *pszName, CService &addr, int portDefault, bool fAllowLookup) |
bool | Lookup (const char *pszName, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions) |
CService | LookupNumeric (const char *pszName, int portDefault=0) |
bool | LookupSubNet (const char *pszName, CSubNet &subnet) |
SOCKET | CreateSocket (const CService &addrConnect) |
bool | ConnectSocketDirectly (const CService &addrConnect, const SOCKET &hSocketRet, int nTimeout) |
bool | ConnectThroughProxy (const proxyType &proxy, const std::string &strDest, int port, const SOCKET &hSocketRet, int nTimeout, bool *outProxyConnectionFailed) |
std::string | NetworkErrorString (int err) |
Return readable error string for a network error code. More... | |
bool | CloseSocket (SOCKET &hSocket) |
Close socket and set hSocket to INVALID_SOCKET. More... | |
bool | SetSocketNonBlocking (const SOCKET &hSocket, bool fNonBlocking) |
Disable or enable blocking-mode for a socket. More... | |
bool | SetSocketNoDelay (const SOCKET &hSocket) |
Set the TCP_NODELAY flag on a socket. More... | |
struct timeval | MillisToTimeval (int64_t nTimeout) |
Convert milliseconds to a struct timeval for e.g. More... | |
void | InterruptSocks5 (bool interrupt) |
Variables | |
int | nConnectTimeout |
bool | fNameLookup |
static const int | DEFAULT_CONNECT_TIMEOUT = 5000 |
-timeout default More... | |
static const int | DEFAULT_NAME_LOOKUP = true |
-dns default More... | |
static const bool | DEFAULT_ALLOWPRIVATENET = false |
Function Documentation
◆ CloseSocket()
bool CloseSocket | ( | SOCKET & | hSocket | ) |
Close socket and set hSocket to INVALID_SOCKET.
Definition at line 690 of file netbase.cpp.
References INVALID_SOCKET, LogPrintf, NetworkErrorString(), SOCKET_ERROR, and WSAGetLastError.
Referenced by CConnman::AcceptConnection(), CConnman::BindListenPort(), CNode::CloseSocketDisconnect(), CConnman::ConnectNode(), CreateSocket(), CActiveMasternodeManager::Init(), CConnman::Stop(), and CNode::~CNode().
◆ ConnectSocketDirectly()
bool ConnectSocketDirectly | ( | const CService & | addrConnect, |
const SOCKET & | hSocketRet, | ||
int | nTimeout | ||
) |
Definition at line 482 of file netbase.cpp.
References CService::GetSockAddr(), INVALID_SOCKET, LogPrint, LogPrintf, MillisToTimeval(), BCLog::NET, NetworkErrorString(), SOCKET_ERROR, CService::ToString(), WSAEINPROGRESS, WSAEINVAL, WSAEWOULDBLOCK, and WSAGetLastError.
Referenced by CConnman::ConnectNode(), ConnectThroughProxy(), and CActiveMasternodeManager::Init().
◆ ConnectThroughProxy()
bool ConnectThroughProxy | ( | const proxyType & | proxy, |
const std::string & | strDest, | ||
int | port, | ||
const SOCKET & | hSocketRet, | ||
int | nTimeout, | ||
bool * | outProxyConnectionFailed | ||
) |
Definition at line 595 of file netbase.cpp.
References ConnectSocketDirectly(), ProxyCredentials::password, proxyType::proxy, proxyType::randomize_credentials, Socks5(), strprintf, and ProxyCredentials::username.
Referenced by CConnman::ConnectNode().
◆ CreateSocket()
Definition at line 446 of file netbase.cpp.
References CloseSocket(), CService::GetSockAddr(), INVALID_SOCKET, IsSelectableSocket(), LogPrintf, NetworkErrorString(), SetSocketNoDelay(), SetSocketNonBlocking(), CService::ToString(), and WSAGetLastError.
Referenced by CConnman::BindListenPort(), CConnman::ConnectNode(), and CActiveMasternodeManager::Init().
◆ GetNameProxy()
bool GetNameProxy | ( | proxyType & | nameProxyOut | ) |
Definition at line 573 of file netbase.cpp.
References cs_proxyInfos, and LOCK.
Referenced by CConnman::ConnectNode().
◆ GetNetworkName()
std::string GetNetworkName | ( | enum Network | net | ) |
Definition at line 50 of file netbase.cpp.
References NET_IPV4, NET_IPV6, and NET_TOR.
Referenced by GetNetworksInfo().
◆ GetProxy()
Definition at line 556 of file netbase.cpp.
References cs_proxyInfos, LOCK, and NET_MAX.
Referenced by CConnman::ConnectNode(), GetNetworksInfo(), OptionsModel::getProxySettings(), and OptionsDialog::updateDefaultProxyNets().
◆ HaveNameProxy()
bool HaveNameProxy | ( | ) |
Definition at line 581 of file netbase.cpp.
References cs_proxyInfos, and LOCK.
Referenced by CConnman::ConnectNode(), and CConnman::ThreadDNSAddressSeed().
◆ InterruptSocks5()
void InterruptSocks5 | ( | bool | interrupt | ) |
Definition at line 740 of file netbase.cpp.
References interruptSocks5Recv().
Referenced by CConnman::Interrupt(), and CConnman::Start().
◆ IsProxy()
bool IsProxy | ( | const CNetAddr & | addr | ) |
Definition at line 586 of file netbase.cpp.
References cs_proxyInfos, LOCK, and NET_MAX.
◆ Lookup() [1/2]
bool Lookup | ( | const char * | pszName, |
CService & | addr, | ||
int | portDefault, | ||
bool | fAllowLookup | ||
) |
Definition at line 158 of file netbase.cpp.
References Lookup().
◆ Lookup() [2/2]
bool Lookup | ( | const char * | pszName, |
std::vector< CService > & | vAddr, | ||
int | portDefault, | ||
bool | fAllowLookup, | ||
unsigned int | nMaxSolutions | ||
) |
Definition at line 140 of file netbase.cpp.
References LookupIntern(), and SplitHostPort().
Referenced by AppInitMain(), CConnman::ConnectNode(), CActiveMasternodeManager::GetLocalAddress(), Lookup(), LookupNumeric(), and masternode_connect().
◆ LookupHost() [1/2]
bool LookupHost | ( | const char * | pszName, |
std::vector< CNetAddr > & | vIP, | ||
unsigned int | nMaxSolutions, | ||
bool | fAllowLookup | ||
) |
Definition at line 117 of file netbase.cpp.
References LookupIntern().
Referenced by Discover(), CActiveMasternodeManager::GetLocalAddress(), InitHTTPAllowList(), LookupHost(), LookupSubNet(), setban(), and CConnman::ThreadDNSAddressSeed().
◆ LookupHost() [2/2]
bool LookupHost | ( | const char * | pszName, |
CNetAddr & | addr, | ||
bool | fAllowLookup | ||
) |
Definition at line 130 of file netbase.cpp.
References LookupHost().
◆ LookupNumeric()
CService LookupNumeric | ( | const char * | pszName, |
int | portDefault = 0 |
||
) |
Definition at line 168 of file netbase.cpp.
References Lookup().
Referenced by TorController::add_onion_cb(), AdvertiseLocal(), TorController::auth_cb(), CConnman::GetAddedNodeInfo(), HTTPRequest::GetPeer(), and ProxyAddressValidator::validate().
◆ LookupSubNet()
bool LookupSubNet | ( | const char * | pszName, |
CSubNet & | subnet | ||
) |
Definition at line 618 of file netbase.cpp.
References CSubNet::IsValid(), LookupHost(), and ParseInt32().
Referenced by AppInitMain(), InitHTTPAllowList(), setban(), and RPCConsole::unbanSelectedNode().
◆ MillisToTimeval()
struct timeval MillisToTimeval | ( | int64_t | nTimeout | ) |
Convert milliseconds to a struct timeval for e.g.
select.
Definition at line 178 of file netbase.cpp.
Referenced by ConnectSocketDirectly(), TorController::disconnected_cb(), and InterruptibleRecv().
◆ NetworkErrorString()
std::string NetworkErrorString | ( | int | err | ) |
Return readable error string for a network error code.
Definition at line 672 of file netbase.cpp.
References strprintf.
Referenced by CConnman::AcceptConnection(), CConnman::BindListenPort(), CloseSocket(), ConnectSocketDirectly(), CreateSocket(), CConnman::RegisterEvents(), CConnman::SocketEventsSelect(), CConnman::SocketRecvData(), CConnman::SocketSendData(), CConnman::Start(), CConnman::Stop(), and CConnman::UnregisterEvents().
◆ ParseNetwork()
enum Network ParseNetwork | ( | std::string | net | ) |
Definition at line 42 of file netbase.cpp.
References NET_IPV4, NET_IPV6, NET_TOR, and NET_UNROUTABLE.
Referenced by AppInitMain().
◆ SetNameProxy()
bool SetNameProxy | ( | const proxyType & | addrProxy | ) |
Definition at line 565 of file netbase.cpp.
References cs_proxyInfos, proxyType::IsValid(), and LOCK.
Referenced by AppInitMain().
◆ SetProxy()
Definition at line 547 of file netbase.cpp.
References cs_proxyInfos, proxyType::IsValid(), LOCK, and NET_MAX.
Referenced by AppInitMain(), and TorController::auth_cb().
◆ SetSocketNoDelay()
bool SetSocketNoDelay | ( | const SOCKET & | hSocket | ) |
Set the TCP_NODELAY flag on a socket.
Definition at line 733 of file netbase.cpp.
Referenced by CConnman::AcceptConnection(), and CreateSocket().
◆ SetSocketNonBlocking()
bool SetSocketNonBlocking | ( | const SOCKET & | hSocket, |
bool | fNonBlocking | ||
) |
Disable or enable blocking-mode for a socket.
Definition at line 706 of file netbase.cpp.
References SOCKET_ERROR.
Referenced by CreateSocket().
Variable Documentation
◆ DEFAULT_ALLOWPRIVATENET
|
static |
Definition at line 27 of file netbase.h.
Referenced by AppInitParameterInteraction(), and HelpMessage().
◆ DEFAULT_CONNECT_TIMEOUT
|
static |
-timeout default
Definition at line 24 of file netbase.h.
Referenced by AppInitParameterInteraction(), and HelpMessage().
◆ DEFAULT_NAME_LOOKUP
|
static |
-dns default
Definition at line 26 of file netbase.h.
Referenced by AppInitMain(), and HelpMessage().
◆ fNameLookup
bool fNameLookup |
Definition at line 36 of file netbase.cpp.
Referenced by AppInitMain(), and CConnman::ConnectNode().
◆ nConnectTimeout
int nConnectTimeout |
Definition at line 35 of file netbase.cpp.
Referenced by AppInitParameterInteraction(), CConnman::ConnectNode(), and CActiveMasternodeManager::Init().