Dogecoin Core  1.14.2
P2P Digital Currency
Classes | Enumerations | Functions | Variables
netbase.cpp File Reference
#include "netbase.h"
#include "hash.h"
#include "sync.h"
#include "uint256.h"
#include "random.h"
#include "util.h"
#include "utilstrencodings.h"
#include <atomic>
#include <fcntl.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
Include dependency graph for netbase.cpp:

Go to the source code of this file.

Classes

struct  ProxyCredentials
 

Enumerations

enum class  IntrRecvError {
  OK , Timeout , Disconnected , NetworkError ,
  Interrupted
}
 

Functions

enum Network ParseNetwork (std::string net)
 
std::string GetNetworkName (enum Network net)
 
void SplitHostPort (std::string in, int &portOut, std::string &hostOut)
 
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, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
 
bool Lookup (const char *pszName, CService &addr, int portDefault, bool fAllowLookup)
 
CService LookupNumeric (const char *pszName, int portDefault)
 
struct timeval MillisToTimeval (int64_t nTimeout)
 Convert milliseconds to a struct timeval for e.g. More...
 
std::string Socks5ErrorString (int err)
 
bool SetProxy (enum Network net, const proxyType &addrProxy)
 
bool GetProxy (enum Network net, proxyType &proxyInfoOut)
 
bool SetNameProxy (const proxyType &addrProxy)
 
bool GetNameProxy (proxyType &nameProxyOut)
 
bool HaveNameProxy ()
 
bool IsProxy (const CNetAddr &addr)
 
bool ConnectSocket (const CService &addrDest, SOCKET &hSocketRet, int nTimeout, bool *outProxyConnectionFailed)
 
bool ConnectSocketByName (CService &addr, SOCKET &hSocketRet, const char *pszDest, int portDefault, int nTimeout, bool *outProxyConnectionFailed)
 
bool LookupSubNet (const char *pszName, CSubNet &ret)
 
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 (SOCKET &hSocket, bool fNonBlocking)
 Disable or enable blocking-mode for a socket. More...
 
void InterruptSocks5 (bool interrupt)
 

Variables

int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT
 
bool fNameLookup = DEFAULT_NAME_LOOKUP
 

Enumeration Type Documentation

◆ IntrRecvError

enum IntrRecvError
strong
Enumerator
OK 
Timeout 
Disconnected 
NetworkError 
Interrupted 

Definition at line 201 of file netbase.cpp.

Function Documentation

◆ CloseSocket()

bool CloseSocket ( SOCKET hSocket)

Close socket and set hSocket to INVALID_SOCKET.

Definition at line 689 of file netbase.cpp.

Here is the caller graph for this function:

◆ ConnectSocket()

bool ConnectSocket ( const CService addrDest,
SOCKET hSocketRet,
int  nTimeout,
bool *  outProxyConnectionFailed 
)

Definition at line 578 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConnectSocketByName()

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

Definition at line 590 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNameProxy()

bool GetNameProxy ( proxyType nameProxyOut)

Definition at line 531 of file netbase.cpp.

Here is the caller graph for this function:

◆ GetNetworkName()

std::string GetNetworkName ( enum Network  net)

Definition at line 51 of file netbase.cpp.

◆ GetProxy()

bool GetProxy ( enum Network  net,
proxyType proxyInfoOut 
)

Definition at line 514 of file netbase.cpp.

Here is the caller graph for this function:

◆ HaveNameProxy()

bool HaveNameProxy ( )

Definition at line 539 of file netbase.cpp.

Here is the caller graph for this function:

◆ InterruptSocks5()

void InterruptSocks5 ( bool  interrupt)

Definition at line 731 of file netbase.cpp.

Here is the caller graph for this function:

◆ IsProxy()

bool IsProxy ( const CNetAddr addr)

Definition at line 544 of file netbase.cpp.

◆ Lookup() [1/2]

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

Definition at line 173 of file netbase.cpp.

Here is the call graph for this function:

◆ Lookup() [2/2]

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

Definition at line 155 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LookupHost() [1/2]

bool LookupHost ( const char *  pszName,
CNetAddr addr,
bool  fAllowLookup 
)

Definition at line 145 of file netbase.cpp.

Here is the call graph for this function:

◆ LookupHost() [2/2]

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

Definition at line 132 of file netbase.cpp.

Here is the caller graph for this function:

◆ LookupNumeric()

CService LookupNumeric ( const char *  pszName,
int  portDefault 
)

Definition at line 183 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LookupSubNet()

bool LookupSubNet ( const char *  pszName,
CSubNet ret 
)

Definition at line 618 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MillisToTimeval()

struct timeval MillisToTimeval ( int64_t  nTimeout)

Convert milliseconds to a struct timeval for e.g.

select.

Definition at line 183 of file netbase.cpp.

Here is the caller graph for this function:

◆ NetworkErrorString()

std::string NetworkErrorString ( int  err)

Return readable error string for a network error code.

Definition at line 672 of file netbase.cpp.

Here is the caller graph for this function:

◆ ParseNetwork()

enum Network ParseNetwork ( std::string  net)

Definition at line 41 of file netbase.cpp.

◆ SetNameProxy()

bool SetNameProxy ( const proxyType addrProxy)

Definition at line 523 of file netbase.cpp.

Here is the call graph for this function:

◆ SetProxy()

bool SetProxy ( enum Network  net,
const proxyType addrProxy 
)

Definition at line 505 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetSocketNonBlocking()

bool SetSocketNonBlocking ( SOCKET hSocket,
bool  fNonBlocking 
)

Disable or enable blocking-mode for a socket.

Definition at line 702 of file netbase.cpp.

Here is the call graph for this function:

◆ Socks5ErrorString()

std::string Socks5ErrorString ( int  err)

Definition at line 265 of file netbase.cpp.

◆ SplitHostPort()

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

Definition at line 61 of file netbase.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ fNameLookup

bool fNameLookup = DEFAULT_NAME_LOOKUP

Definition at line 37 of file netbase.cpp.

◆ nConnectTimeout

int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT

Definition at line 36 of file netbase.cpp.