![]() |
BSHA3
0.17.99
P2P Blockchain, based on Bitcoin
|
#include <net.h>
Classes | |
| struct | ListenSocket |
| struct | Options |
Public Types | |
| enum | NumConnections { CONNECTIONS_NONE = 0, CONNECTIONS_IN = (1U << 0), CONNECTIONS_OUT = (1U << 1), CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT) } |
Public Member Functions | |
| void | Init (const Options &connOptions) |
| CConnman (uint64_t seed0, uint64_t seed1) | |
| ~CConnman () | |
| bool | Start (CScheduler &scheduler, const Options &options) |
| void | Stop () |
| void | Interrupt () |
| bool | GetNetworkActive () const |
| bool | GetUseAddrmanOutgoing () const |
| void | SetNetworkActive (bool active) |
| void | OpenNetworkConnection (const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound=nullptr, const char *strDest=nullptr, bool fOneShot=false, bool fFeeler=false, bool manual_connection=false) |
| bool | CheckIncomingNonce (uint64_t nonce) |
| bool | ForNode (NodeId id, std::function< bool(CNode *pnode)> func) |
| void | PushMessage (CNode *pnode, CSerializedNetMsg &&msg) |
| template<typename Callable > | |
| void | ForEachNode (Callable &&func) |
| template<typename Callable > | |
| void | ForEachNode (Callable &&func) const |
| template<typename Callable , typename CallableAfter > | |
| void | ForEachNodeThen (Callable &&pre, CallableAfter &&post) |
| template<typename Callable , typename CallableAfter > | |
| void | ForEachNodeThen (Callable &&pre, CallableAfter &&post) const |
| size_t | GetAddressCount () const |
| void | SetServices (const CService &addr, ServiceFlags nServices) |
| void | MarkAddressGood (const CAddress &addr) |
| void | AddNewAddresses (const std::vector< CAddress > &vAddr, const CAddress &addrFrom, int64_t nTimePenalty=0) |
| std::vector< CAddress > | GetAddresses () |
| void | Ban (const CNetAddr &netAddr, const BanReason &reason, int64_t bantimeoffset=0, bool sinceUnixEpoch=false) |
| void | Ban (const CSubNet &subNet, const BanReason &reason, int64_t bantimeoffset=0, bool sinceUnixEpoch=false) |
| void | ClearBanned () |
| bool | IsBanned (CNetAddr ip) |
| bool | IsBanned (CSubNet subnet) |
| bool | Unban (const CNetAddr &ip) |
| bool | Unban (const CSubNet &ip) |
| void | GetBanned (banmap_t &banmap) |
| void | SetBanned (const banmap_t &banmap) |
| void | SetTryNewOutboundPeer (bool flag) |
| bool | GetTryNewOutboundPeer () |
| int | GetExtraOutboundCount () |
| bool | AddNode (const std::string &node) |
| bool | RemoveAddedNode (const std::string &node) |
| std::vector< AddedNodeInfo > | GetAddedNodeInfo () |
| size_t | GetNodeCount (NumConnections num) |
| void | GetNodeStats (std::vector< CNodeStats > &vstats) |
| bool | DisconnectNode (const std::string &node) |
| bool | DisconnectNode (NodeId id) |
| ServiceFlags | GetLocalServices () const |
| void | SetMaxOutboundTarget (uint64_t limit) |
| set the max outbound target in bytes More... | |
| uint64_t | GetMaxOutboundTarget () |
| void | SetMaxOutboundTimeframe (uint64_t timeframe) |
| set the timeframe for the max outbound target More... | |
| uint64_t | GetMaxOutboundTimeframe () |
| bool | OutboundTargetReached (bool historicalBlockServingLimit) |
| check if the outbound target is reached More... | |
| uint64_t | GetOutboundTargetBytesLeft () |
| response the bytes left in the current max outbound cycle More... | |
| uint64_t | GetMaxOutboundTimeLeftInCycle () |
| response the time in second left in the current max outbound cycle More... | |
| uint64_t | GetTotalBytesRecv () |
| uint64_t | GetTotalBytesSent () |
| void | SetBestHeight (int height) |
| int | GetBestHeight () const |
| CSipHasher | GetDeterministicRandomizer (uint64_t id) const |
| Get a unique deterministic randomizer. More... | |
| unsigned int | GetReceiveFloodSize () const |
| void | WakeMessageHandler () |
| int64_t | PoissonNextSendInbound (int64_t now, int average_interval_seconds) |
| Attempts to obfuscate tx time through exponentially distributed emitting. More... | |
Private Member Functions | |
| bool | BindListenPort (const CService &bindAddr, std::string &strError, bool fWhitelisted=false) |
| bool | Bind (const CService &addr, unsigned int flags) |
| bool | InitBinds (const std::vector< CService > &binds, const std::vector< CService > &whiteBinds) |
| void | ThreadOpenAddedConnections () |
| void | AddOneShot (const std::string &strDest) |
| void | ProcessOneShot () |
| void | ThreadOpenConnections (std::vector< std::string > connect) |
| void | ThreadMessageHandler () |
| void | AcceptConnection (const ListenSocket &hListenSocket) |
| void | DisconnectNodes () |
| void | NotifyNumConnectionsChanged () |
| void | InactivityCheck (CNode *pnode) |
| void | SocketHandler () |
| void | ThreadSocketHandler () |
| void | ThreadDNSAddressSeed () |
| uint64_t | CalculateKeyedNetGroup (const CAddress &ad) const |
| CNode * | FindNode (const CNetAddr &ip) |
| CNode * | FindNode (const CSubNet &subNet) |
| CNode * | FindNode (const std::string &addrName) |
| CNode * | FindNode (const CService &addr) |
| bool | AttemptToEvictConnection () |
| Try to find a connection to evict when the node is full. More... | |
| CNode * | ConnectNode (CAddress addrConnect, const char *pszDest, bool fCountFailure, bool manual_connection) |
| bool | IsWhitelistedRange (const CNetAddr &addr) |
| void | DeleteNode (CNode *pnode) |
| NodeId | GetNewNodeId () |
| size_t | SocketSendData (CNode *pnode) const |
| bool | BannedSetIsDirty () |
| check is the banlist has unwritten changes More... | |
| void | SetBannedSetDirty (bool dirty=true) |
| set the "dirty" flag for the banlist More... | |
| void | SweepBanned () |
| clean unused entries (if bantime has expired) More... | |
| void | DumpAddresses () |
| void | DumpData () |
| void | DumpBanlist () |
| void | RecordBytesRecv (uint64_t bytes) |
| void | RecordBytesSent (uint64_t bytes) |
| uint64_t nTotalBytesRecv | GUARDED_BY (cs_totalBytesRecv) |
| uint64_t nTotalBytesSent | GUARDED_BY (cs_totalBytesSent) |
| uint64_t nMaxOutboundTotalBytesSentInCycle | GUARDED_BY (cs_totalBytesSent) |
| uint64_t nMaxOutboundCycleStartTime | GUARDED_BY (cs_totalBytesSent) |
| uint64_t nMaxOutboundLimit | GUARDED_BY (cs_totalBytesSent) |
| uint64_t nMaxOutboundTimeframe | GUARDED_BY (cs_totalBytesSent) |
| std::vector< std::string > vAddedNodes | GUARDED_BY (cs_vAddedNodes) |
Static Private Member Functions | |
| static bool | NodeFullyConnected (const CNode *pnode) |
Friends | |
| struct | CConnmanTest |
| CConnman::CConnman | ( | uint64_t | seed0, |
| uint64_t | seed1 | ||
| ) |
| CConnman::~CConnman | ( | ) |
|
private |
|
private |
|
private |
Try to find a connection to evict when the node is full.
Extreme care must be taken to avoid opening the node to attacker triggered network partitioning. The strategy used here is to protect a small number of peers for each of several distinct characteristics which are difficult to forge. In order to partition a node the attacker must be simultaneously better at all of them than honest peers.
|
private |
|
private |
|
private |
|
private |
| void CConnman::ClearBanned | ( | ) |
|
private |
| bool CConnman::DisconnectNode | ( | const std::string & | node | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
| std::vector< AddedNodeInfo > CConnman::GetAddedNodeInfo | ( | ) |
| size_t CConnman::GetAddressCount | ( | ) | const |
| std::vector< CAddress > CConnman::GetAddresses | ( | ) |
| void CConnman::GetBanned | ( | banmap_t & | banmap | ) |
| CSipHasher CConnman::GetDeterministicRandomizer | ( | uint64_t | id | ) | const |
| int CConnman::GetExtraOutboundCount | ( | ) |
| ServiceFlags CConnman::GetLocalServices | ( | ) | const |
| uint64_t CConnman::GetMaxOutboundTimeLeftInCycle | ( | ) |
|
inline |
| size_t CConnman::GetNodeCount | ( | NumConnections | num | ) |
| void CConnman::GetNodeStats | ( | std::vector< CNodeStats > & | vstats | ) |
| uint64_t CConnman::GetOutboundTargetBytesLeft | ( | ) |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
| void CConnman::Interrupt | ( | ) |
| bool CConnman::IsBanned | ( | CNetAddr | ip | ) |
| bool CConnman::IsBanned | ( | CSubNet | subnet | ) |
|
private |
| void CConnman::MarkAddressGood | ( | const CAddress & | addr | ) |
|
staticprivate |
|
private |
| void CConnman::OpenNetworkConnection | ( | const CAddress & | addrConnect, |
| bool | fCountFailure, | ||
| CSemaphoreGrant * | grantOutbound = nullptr, |
||
| const char * | strDest = nullptr, |
||
| bool | fOneShot = false, |
||
| bool | fFeeler = false, |
||
| bool | manual_connection = false |
||
| ) |
| bool CConnman::OutboundTargetReached | ( | bool | historicalBlockServingLimit | ) |
| int64_t CConnman::PoissonNextSendInbound | ( | int64_t | now, |
| int | average_interval_seconds | ||
| ) |
|
private |
| void CConnman::PushMessage | ( | CNode * | pnode, |
| CSerializedNetMsg && | msg | ||
| ) |
|
private |
|
private |
| void CConnman::SetBestHeight | ( | int | height | ) |
| void CConnman::SetMaxOutboundTarget | ( | uint64_t | limit | ) |
| void CConnman::SetMaxOutboundTimeframe | ( | uint64_t | timeframe | ) |
| void CConnman::SetServices | ( | const CService & | addr, |
| ServiceFlags | nServices | ||
| ) |
| void CConnman::SetTryNewOutboundPeer | ( | bool | flag | ) |
|
private |
|
private |
| bool CConnman::Start | ( | CScheduler & | scheduler, |
| const Options & | options | ||
| ) |
| void CConnman::Stop | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| bool CConnman::Unban | ( | const CSubNet & | ip | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.14