![]() |
Bitcoin Core
0.21.1
P2P Digital Currency
|
#include <addrdb.h>#include <addrman.h>#include <amount.h>#include <bloom.h>#include <chainparams.h>#include <compat.h>#include <crypto/siphash.h>#include <hash.h>#include <net_permissions.h>#include <netaddress.h>#include <optional.h>#include <policy/feerate.h>#include <protocol.h>#include <random.h>#include <streams.h>#include <sync.h>#include <threadinterrupt.h>#include <uint256.h>#include <atomic>#include <cstdint>#include <deque>#include <map>#include <thread>#include <memory>#include <condition_variable>#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 |
| struct | CConnman::CachedAddrResponse |
| Cache responses to addr requests to minimize privacy leak. More... | |
| class | NetEventsInterface |
| Interface for message handling. More... | |
| struct | LocalServiceInfo |
| class | CNodeStats |
| 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 |
Typedefs | |
| typedef int64_t | NodeId |
| typedef std::map< std::string, uint64_t > | mapMsgCmdSize |
Enumerations | |
| enum | ConnectionType { ConnectionType::INBOUND, ConnectionType::OUTBOUND_FULL_RELAY, 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 () |
| uint16_t | 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) |
| bool | IsLocal (const CService &addr) |
| 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... | |
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 constexpr size_t | MAX_ADDR_TO_SEND = 1000 |
| The maximum number of addresses from our addrman to return in response to a getaddr message. More... | |
| static const unsigned int | MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1000 * 1000 |
| Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). 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_BLOCK_RELAY_ONLY_CONNECTIONS = 2 |
| Maximum number of block-relay-only outgoing connections. More... | |
| static const int | MAX_FEELER_CONNECTIONS = 1 |
| Maximum number of feeler connections. More... | |
| static const bool | DEFAULT_LISTEN = true |
| -listen default More... | |
| static const bool | DEFAULT_UPNP = USE_UPNP |
| -upnp default More... | |
| static const unsigned int | DEFAULT_MAX_PEER_CONNECTIONS = 125 |
| 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 |
| bool | fDiscover |
| bool | fListen |
| bool | g_relay_txes |
| std::string | strSubVersion |
Subversion as sent to the P2P network in version messages. More... | |
| 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.
If adding or removing types, please update CONNECTION_TYPE_DOC in src/rpc/net.cpp.
| bool AddLocal | ( | const CService & | addr, |
| int | nScore = LOCAL_NONE |
||
| ) |
| bool AddLocal | ( | const CNetAddr & | addr, |
| int | nScore = LOCAL_NONE |
||
| ) |
| void AdvertiseLocal | ( | CNode * | pnode | ) |
| void Discover | ( | ) |
| uint16_t GetListenPort | ( | ) |
| CAddress GetLocalAddress | ( | const CNetAddr * | paddrPeer, |
| ServiceFlags | nLocalServices | ||
| ) |
| 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 | ||
| ) |
Return a timestamp in the future (in microseconds) for exponentially distributed events.
|
inline |
| void RemoveLocal | ( | const CService & | addr | ) |
| bool SeenLocal | ( | const CService & | addr | ) |
| void SetReachable | ( | enum Network | net, |
| bool | reachable | ||
| ) |
Mark a network as reachable or unreachable (no automatic connects to it)
| void StartMapPort | ( | ) |
| void StopMapPort | ( | ) |
| RecursiveMutex cs_mapLocalHost |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| bool fDiscover |
|
static |
| bool fListen |
| bool g_relay_txes |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| const std::string NET_MESSAGE_COMMAND_OTHER |
| std::string strSubVersion |
Subversion as sent to the P2P network in version messages.
1.8.8