Dash Core  0.12.2.1
P2P Digital Currency
netbase.h File Reference
#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)
 
void SplitHostPort (std::string in, int &portOut, std::string &hostOut)
 
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 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)
 
bool ConnectSocket (const CService &addr, SOCKET &hSocketRet, int nTimeout, bool *outProxyConnectionFailed=0)
 
bool ConnectSocketByName (CService &addr, SOCKET &hSocketRet, const char *pszDest, int portDefault, int nTimeout, bool *outProxyConnectionFailed=0)
 
std::string NetworkErrorString (int err)
 
bool CloseSocket (SOCKET &hSocket)
 
bool SetSocketNonBlocking (SOCKET &hSocket, bool fNonBlocking)
 
struct timeval MillisToTimeval (int64_t nTimeout)
 
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...
 

Function Documentation

◆ CloseSocket()

bool CloseSocket ( SOCKET hSocket)

◆ ConnectSocket()

bool ConnectSocket ( const CService addr,
SOCKET hSocketRet,
int  nTimeout,
bool *  outProxyConnectionFailed = 0 
)

Definition at line 600 of file netbase.cpp.

Referenced by CConnman::ConnectNode(), and ConnectSocketByName().

◆ ConnectSocketByName()

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

Definition at line 612 of file netbase.cpp.

Referenced by CConnman::ConnectNode().

◆ GetNetworkName()

std::string GetNetworkName ( enum Network  net)

Definition at line 51 of file netbase.cpp.

Referenced by GetNetworksInfo().

◆ GetProxy()

bool GetProxy ( enum Network  net,
proxyType proxyInfoOut 
)

◆ HaveNameProxy()

bool HaveNameProxy ( )

Definition at line 561 of file netbase.cpp.

Referenced by ConnectSocketByName(), and CConnman::ThreadDNSAddressSeed().

◆ InterruptSocks5()

void InterruptSocks5 ( bool  interrupt)

Definition at line 753 of file netbase.cpp.

Referenced by CConnman::Interrupt(), and CConnman::Start().

◆ IsProxy()

bool IsProxy ( const CNetAddr addr)

Definition at line 566 of file netbase.cpp.

◆ Lookup() [1/2]

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

Definition at line 218 of file netbase.cpp.

◆ 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 190 of file netbase.cpp.

◆ LookupNumeric()

◆ LookupSubNet()

bool LookupSubNet ( const char *  pszName,
CSubNet subnet 
)

Definition at line 640 of file netbase.cpp.

Referenced by AppInit2(), 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 238 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 694 of file netbase.cpp.

Referenced by CConnman::AcceptConnection(), CConnman::BindListenPort(), ConnectSocketDirectly(), CConnman::SocketSendData(), CConnman::Stop(), and CConnman::ThreadSocketHandler().

◆ ParseNetwork()

enum Network ParseNetwork ( std::string  net)

Definition at line 43 of file netbase.cpp.

Referenced by AppInit2().

◆ SetNameProxy()

bool SetNameProxy ( const proxyType addrProxy)

Definition at line 545 of file netbase.cpp.

Referenced by AppInit2().

◆ SetProxy()

bool SetProxy ( enum Network  net,
const proxyType addrProxy 
)

Definition at line 527 of file netbase.cpp.

Referenced by AppInit2(), and TorController::auth_cb().

◆ SetSocketNonBlocking()

bool SetSocketNonBlocking ( SOCKET hSocket,
bool  fNonBlocking 
)

Disable or enable blocking-mode for a socket

Definition at line 724 of file netbase.cpp.

Referenced by CConnman::BindListenPort(), and ConnectSocketDirectly().

◆ SplitHostPort()

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

Variable Documentation

◆ DEFAULT_CONNECT_TIMEOUT

const int DEFAULT_CONNECT_TIMEOUT = 5000
static

-timeout default

Definition at line 24 of file netbase.h.

Referenced by AppInit2(), and HelpMessage().

◆ DEFAULT_NAME_LOOKUP

const int DEFAULT_NAME_LOOKUP = true
static

-dns default

Definition at line 26 of file netbase.h.

Referenced by AppInit2(), and HelpMessage().

◆ fNameLookup

bool fNameLookup

Definition at line 37 of file netbase.cpp.

Referenced by AppInit2(), and ConnectSocketByName().

◆ nConnectTimeout

int nConnectTimeout

Definition at line 36 of file netbase.cpp.

Referenced by AppInit2(), and CConnman::ConnectNode().