![]() |
PIVX Core
5.6.99
P2P Digital Currency
|
#include "netbase.h"#include "sync.h"#include "random.h"#include "tinyformat.h"#include "util/string.h"#include "util/system.h"#include "utilstrencodings.h"#include <atomic>#include <cstdint>#include <limits>#include <fcntl.h>Go to the source code of this file.
Classes | |
| struct | ProxyCredentials |
| Credentials for proxy authentication. More... | |
Enumerations | |
| enum | SOCKSVersion : uint8_t { SOCKS4 = 0x04 , SOCKS5 = 0x05 } |
| SOCKS version. More... | |
| enum | SOCKS5Method : uint8_t { NOAUTH = 0x00 , GSSAPI = 0x01 , USER_PASS = 0x02 , NO_ACCEPTABLE = 0xff } |
| Values defined for METHOD in RFC1928. More... | |
| enum | SOCKS5Command : uint8_t { CONNECT = 0x01 , BIND = 0x02 , UDP_ASSOCIATE = 0x03 } |
| Values defined for CMD in RFC1928. More... | |
| enum | SOCKS5Reply : uint8_t { SUCCEEDED = 0x00 , GENFAILURE = 0x01 , NOTALLOWED = 0x02 , NETUNREACHABLE = 0x03 , HOSTUNREACHABLE = 0x04 , CONNREFUSED = 0x05 , TTLEXPIRED = 0x06 , CMDUNSUPPORTED = 0x07 , ATYPEUNSUPPORTED = 0x08 } |
| Values defined for REP in RFC1928. More... | |
| enum | SOCKS5Atyp : uint8_t { IPV4 = 0x01 , DOMAINNAME = 0x03 , IPV6 = 0x04 } |
| Values defined for ATYPE in RFC1928. More... | |
| enum class | IntrRecvError { OK , Timeout , Disconnected , NetworkError , Interrupted } |
| Status codes that can be returned by InterruptibleRecv. More... | |
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 std::string &name, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup) |
| bool | LookupHost (const std::string &name, CNetAddr &addr, bool fAllowLookup) |
| bool | Lookup (const std::string &name, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions) |
| bool | Lookup (const std::string &name, CService &addr, int portDefault, bool fAllowLookup) |
| CService | LookupNumeric (const std::string &name, int portDefault) |
| struct timeval | MillisToTimeval (int64_t nTimeout) |
| Convert milliseconds to a struct timeval for e.g. More... | |
| SOCKET | CreateSocket (const CService &addrConnect) |
| bool | ConnectSocketDirectly (const CService &addrConnect, const SOCKET &hSocket, int nTimeout, bool manual_connection) |
| 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 | ConnectThroughProxy (const proxyType &proxy, const std::string &strDest, int port, const SOCKET &hSocket, int nTimeout, bool *outProxyConnectionFailed) |
| bool | LookupSubNet (const std::string &strSubnet, 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... | |
| bool | SetSocketNoDelay (SOCKET &hSocket) |
| Set the TCP_NODELAY flag on a socket. More... | |
| void | InterruptSocks5 (bool interrupt) |
Variables | |
| int | nConnectTimeout = DEFAULT_CONNECT_TIMEOUT |
| bool | fNameLookup = false |
|
strong |
Status codes that can be returned by InterruptibleRecv.
| Enumerator | |
|---|---|
| OK | |
| Timeout | |
| Disconnected | |
| NetworkError | |
| Interrupted | |
Definition at line 272 of file netbase.cpp.
| enum SOCKS5Atyp : uint8_t |
Values defined for ATYPE in RFC1928.
| Enumerator | |
|---|---|
| IPV4 | |
| DOMAINNAME | |
| IPV6 | |
Definition at line 265 of file netbase.cpp.
| enum SOCKS5Command : uint8_t |
Values defined for CMD in RFC1928.
| Enumerator | |
|---|---|
| CONNECT | |
| BIND | |
| UDP_ASSOCIATE | |
Definition at line 245 of file netbase.cpp.
| enum SOCKS5Method : uint8_t |
Values defined for METHOD in RFC1928.
| Enumerator | |
|---|---|
| NOAUTH | |
| GSSAPI | No authentication required. |
| USER_PASS | GSSAPI. |
| NO_ACCEPTABLE | Username/password. |
Definition at line 237 of file netbase.cpp.
| enum SOCKS5Reply : uint8_t |
Values defined for REP in RFC1928.
Definition at line 252 of file netbase.cpp.
| enum SOCKSVersion : uint8_t |
| bool CloseSocket | ( | SOCKET & | hSocket | ) |
Close socket and set hSocket to INVALID_SOCKET.
Definition at line 742 of file netbase.cpp.
| bool GetNameProxy | ( | proxyType & | nameProxyOut | ) |
Definition at line 624 of file netbase.cpp.
| std::string GetNetworkName | ( | enum Network | net | ) |
Definition at line 55 of file netbase.cpp.
| bool HaveNameProxy | ( | ) |
Definition at line 633 of file netbase.cpp.
| void InterruptSocks5 | ( | bool | interrupt | ) |
| bool IsProxy | ( | const CNetAddr & | addr | ) |
Definition at line 639 of file netbase.cpp.
| bool Lookup | ( | const std::string & | name, |
| CService & | addr, | ||
| int | portDefault, | ||
| bool | fAllowLookup | ||
| ) |
| bool Lookup | ( | const std::string & | name, |
| std::vector< CService > & | vAddr, | ||
| int | portDefault, | ||
| bool | fAllowLookup, | ||
| unsigned int | nMaxSolutions | ||
| ) |
Definition at line 177 of file netbase.cpp.
| bool LookupHost | ( | const std::string & | name, |
| CNetAddr & | addr, | ||
| bool | fAllowLookup | ||
| ) |
| bool LookupHost | ( | const std::string & | name, |
| std::vector< CNetAddr > & | vIP, | ||
| unsigned int | nMaxSolutions, | ||
| bool | fAllowLookup | ||
| ) |
Definition at line 149 of file netbase.cpp.
| CService LookupNumeric | ( | const std::string & | name, |
| int | portDefault | ||
| ) |
Definition at line 209 of file netbase.cpp.
| bool LookupSubNet | ( | const std::string & | strSubnet, |
| CSubNet & | ret | ||
| ) |
Definition at line 673 of file netbase.cpp.
| struct timeval MillisToTimeval | ( | int64_t | nTimeout | ) |
Convert milliseconds to a struct timeval for e.g.
select.
Definition at line 209 of file netbase.cpp.
| std::string NetworkErrorString | ( | int | err | ) |
Return readable error string for a network error code.
Definition at line 724 of file netbase.cpp.
| enum Network ParseNetwork | ( | std::string | net | ) |
| bool SetNameProxy | ( | const proxyType & | addrProxy | ) |
Definition at line 595 of file netbase.cpp.
| bool SetSocketNoDelay | ( | SOCKET & | hSocket | ) |
Set the TCP_NODELAY flag on a socket.
Definition at line 784 of file netbase.cpp.
| bool SetSocketNonBlocking | ( | SOCKET & | hSocket, |
| bool | fNonBlocking | ||
| ) |
Disable or enable blocking-mode for a socket.
Definition at line 755 of file netbase.cpp.
| void SplitHostPort | ( | std::string | in, |
| int & | portOut, | ||
| std::string & | hostOut | ||
| ) |
Definition at line 71 of file netbase.cpp.
| bool fNameLookup = false |
Definition at line 40 of file netbase.cpp.
| int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT |
Definition at line 39 of file netbase.cpp.