Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

netbase.h File Reference
#include <compat.h>
#include <netaddress.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  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()

◆ ConnectSocketDirectly()

◆ ConnectThroughProxy()

bool ConnectThroughProxy ( const proxyType proxy,
const std::string &  strDest,
int  port,
const SOCKET hSocketRet,
int  nTimeout,
bool *  outProxyConnectionFailed 
)

◆ CreateSocket()

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

bool GetProxy ( enum Network  net,
proxyType proxyInfoOut 
)

◆ 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 
)

◆ LookupHost() [1/2]

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

◆ 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 
)

◆ LookupSubNet()

bool LookupSubNet ( const char *  pszName,
CSubNet subnet 
)

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

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

bool SetProxy ( enum Network  net,
const proxyType addrProxy 
)

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

const bool DEFAULT_ALLOWPRIVATENET = false
static

Definition at line 27 of file netbase.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ DEFAULT_CONNECT_TIMEOUT

const int DEFAULT_CONNECT_TIMEOUT = 5000
static

-timeout default

Definition at line 24 of file netbase.h.

Referenced by AppInitParameterInteraction(), and HelpMessage().

◆ DEFAULT_NAME_LOOKUP

const int DEFAULT_NAME_LOOKUP = true
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
Released under the MIT license