![]() |
Bitcoin ABC
0.22.12
P2P Digital Currency
|
#include <addrdb.h>
#include <addrman.h>
#include <amount.h>
#include <avalanche/delegation.h>
#include <bloom.h>
#include <chainparams.h>
#include <compat.h>
#include <crypto/siphash.h>
#include <hash.h>
#include <limitedmap.h>
#include <net_permissions.h>
#include <netaddress.h>
#include <protocol.h>
#include <random.h>
#include <streams.h>
#include <sync.h>
#include <threadinterrupt.h>
#include <uint256.h>
#include <validation.h>
#include <atomic>
#include <condition_variable>
#include <cstdint>
#include <deque>
#include <memory>
#include <thread>
#include <arpa/inet.h>
Go to the source code of this file.
Classes | |
struct | AddedNodeInfo |
struct | CSerializedNetMsg |
class | CConnman |
struct | CConnman::Options |
struct | CConnman::ListenSocket |
class | NetEventsInterface |
Interface for message handling. More... | |
struct | LocalServiceInfo |
struct | CNodeStats |
POD that contains various stats about a node. More... | |
class | CNetMessage |
Transport protocol agnostic message container. More... | |
class | TransportDeserializer |
The TransportDeserializer takes care of holding and deserializing the network receive buffer. More... | |
class | V1TransportDeserializer |
class | TransportSerializer |
The TransportSerializer prepares messages for the network transport. More... | |
class | V1TransportSerializer |
class | CNode |
Information about a peer. More... | |
struct | CNode::TxRelay |
struct | CNode::AvalancheState |
Typedefs | |
typedef int64_t | NodeId |
typedef std::map< std::string, uint64_t > | mapMsgCmdSize |
Enumerations | |
enum | ConnectionType { ConnectionType::INBOUND, ConnectionType::OUTBOUND, ConnectionType::MANUAL, ConnectionType::FEELER, ConnectionType::BLOCK_RELAY, ConnectionType::ADDR_FETCH } |
Different types of connections to a peer. More... | |
enum | { LOCAL_NONE, LOCAL_IF, LOCAL_BIND, LOCAL_UPNP, LOCAL_MANUAL, LOCAL_MAX } |
Functions | |
void | Discover () |
void | StartMapPort () |
void | InterruptMapPort () |
void | StopMapPort () |
unsigned short | GetListenPort () |
bool | IsPeerAddrLocalGood (CNode *pnode) |
void | AdvertiseLocal (CNode *pnode) |
void | SetReachable (enum Network net, bool reachable) |
Mark a network as reachable or unreachable (no automatic connects to it) More... | |
bool | IsReachable (enum Network net) |
bool | IsReachable (const CNetAddr &addr) |
bool | AddLocal (const CService &addr, int nScore=LOCAL_NONE) |
bool | AddLocal (const CNetAddr &addr, int nScore=LOCAL_NONE) |
void | RemoveLocal (const CService &addr) |
bool | SeenLocal (const CService &addr) |
vote for a local address More... | |
bool | IsLocal (const CService &addr) |
check whether a given address is potentially local More... | |
bool | GetLocal (CService &addr, const CNetAddr *paddrPeer=nullptr) |
CAddress | GetLocalAddress (const CNetAddr *paddrPeer, ServiceFlags nLocalServices) |
std::map< CNetAddr, LocalServiceInfo > mapLocalHost | GUARDED_BY (cs_mapLocalHost) |
int64_t | PoissonNextSend (int64_t now, int average_interval_seconds) |
Return a timestamp in the future (in microseconds) for exponentially distributed events. More... | |
std::chrono::microseconds | PoissonNextSend (std::chrono::microseconds now, std::chrono::seconds average_interval) |
Wrapper to return mockable type. More... | |
std::string | getSubVersionEB (uint64_t MaxBlockSize) |
This function convert MaxBlockSize from byte to MB with a decimal precision one digit rounded down E.g. More... | |
std::string | userAgent (const Config &config) |
Variables | |
static const bool | DEFAULT_WHITELISTRELAY = true |
Default for -whitelistrelay. More... | |
static const bool | DEFAULT_WHITELISTFORCERELAY = false |
Default for -whitelistforcerelay. More... | |
static const int | TIMEOUT_INTERVAL = 20 * 60 |
Time after which to disconnect, after waiting for a ping response (or inactivity). More... | |
static const int | FEELER_INTERVAL = 120 |
Run the feeler connection loop once every 2 minutes or 120 seconds. More... | |
static const unsigned int | MAX_ADDR_TO_SEND = 1000 |
The maximum number of new addresses to accumulate before announcing. More... | |
static const unsigned int | MAX_SUBVERSION_LENGTH = 256 |
Maximum length of the user agent string in version message. More... | |
static const int | MAX_OUTBOUND_FULL_RELAY_CONNECTIONS = 8 |
Maximum number of automatic outgoing nodes over which we'll relay everything (blocks, tx, addrs, etc) More... | |
static const int | MAX_ADDNODE_CONNECTIONS = 8 |
Maximum number of addnode outgoing nodes. More... | |
static const int | MAX_BLOCKS_ONLY_CONNECTIONS = 2 |
Maximum number of block-relay-only outgoing connections. More... | |
static const bool | DEFAULT_LISTEN = true |
-listen default More... | |
static const bool | DEFAULT_UPNP = false |
-upnp default More... | |
static const unsigned int | DEFAULT_MAX_PEER_CONNECTIONS = 4096 |
The maximum number of peer connections to maintain. More... | |
static const uint64_t | DEFAULT_MAX_UPLOAD_TARGET = 0 |
The default for -maxuploadtarget. More... | |
static const uint64_t | MAX_UPLOAD_TIMEFRAME = 60 * 60 * 24 |
The default timeframe for -maxuploadtarget. More... | |
static const bool | DEFAULT_BLOCKSONLY = false |
Default for blocks only. More... | |
static const int64_t | DEFAULT_PEER_CONNECT_TIMEOUT = 60 |
-peertimeout default More... | |
static const bool | DEFAULT_FORCEDNSSEED = false |
static const size_t | DEFAULT_MAXRECEIVEBUFFER = 5 * 1000 |
static const size_t | DEFAULT_MAXSENDBUFFER = 1 * 1000 |
static constexpr NodeId | NO_NODE = -1 |
Special NodeId that represent no node. More... | |
bool | fDiscover |
bool | fListen |
bool | g_relay_txes |
RecursiveMutex | cs_mapLocalHost |
const std::string | NET_MESSAGE_COMMAND_OTHER |
typedef std::map<std::string, uint64_t> mapMsgCmdSize |
anonymous enum |
|
strong |
Different types of connections to a peer.
This enum encapsulates the information we have available at the time of opening or accepting the connection. Aside from INBOUND, all types are initiated by us.
bool AddLocal | ( | const CService & | addr, |
int | nScore = LOCAL_NONE |
||
) |
bool AddLocal | ( | const CNetAddr & | addr, |
int | nScore = LOCAL_NONE |
||
) |
void AdvertiseLocal | ( | CNode * | pnode | ) |
void Discover | ( | ) |
unsigned short GetListenPort | ( | ) |
CAddress GetLocalAddress | ( | const CNetAddr * | paddrPeer, |
ServiceFlags | nLocalServices | ||
) |
std::string getSubVersionEB | ( | uint64_t | MaxBlockSize | ) |
This function convert MaxBlockSize from byte to MB with a decimal precision one digit rounded down E.g.
1660000 -> 1.6 2010000 -> 2.0 1000000 -> 1.0 230000 -> 0.2 50000 -> 0.0
NB behavior for EB<1MB not standardized yet still the function applies the same algo used for EB greater or equal to 1MB
Definition at line 3150 of file net.cpp.
std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY | ( | cs_mapLocalHost | ) |
void InterruptMapPort | ( | ) |
bool IsLocal | ( | const CService & | addr | ) |
bool IsPeerAddrLocalGood | ( | CNode * | pnode | ) |
bool IsReachable | ( | enum Network | net | ) |
bool IsReachable | ( | const CNetAddr & | addr | ) |
int64_t PoissonNextSend | ( | int64_t | now, |
int | average_interval_seconds | ||
) |
|
inline |
void RemoveLocal | ( | const CService & | addr | ) |
bool SeenLocal | ( | const CService & | addr | ) |
void SetReachable | ( | enum Network | net, |
bool | reachable | ||
) |
void StartMapPort | ( | ) |
void StopMapPort | ( | ) |
std::string userAgent | ( | const Config & | config | ) |
RecursiveMutex cs_mapLocalHost |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |