Fabcoin Core
0.16.2
P2P Digital Currency
|
#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 |
void | SetNetworkActive (bool active) |
bool | 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 () |
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 () |
void | ThreadMessageHandler () |
void | AcceptConnection (const ListenSocket &hListenSocket) |
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 | 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) |
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.
Definition at line 950 of file net.cpp.
|
private |
|
private |
|
private |
|
private |
bool CConnman::CheckIncomingNonce | ( | uint64_t | nonce | ) |
void CConnman::ClearBanned | ( | ) |
|
private |
bool CConnman::DisconnectNode | ( | const std::string & | node | ) |
|
private |
|
private |
|
private |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
bool CConnman::ForNode | ( | NodeId | id, |
std::function< bool(CNode *pnode)> | func | ||
) |
std::vector< AddedNodeInfo > CConnman::GetAddedNodeInfo | ( | ) |
size_t CConnman::GetAddressCount | ( | ) | const |
std::vector< CAddress > CConnman::GetAddresses | ( | ) |
void CConnman::GetBanned | ( | banmap_t & | banmap | ) |
int CConnman::GetBestHeight | ( | ) | const |
CSipHasher CConnman::GetDeterministicRandomizer | ( | uint64_t | id | ) | const |
int CConnman::GetExtraOutboundCount | ( | ) |
ServiceFlags CConnman::GetLocalServices | ( | ) | const |
uint64_t CConnman::GetMaxOutboundTimeLeftInCycle | ( | ) |
|
private |
size_t CConnman::GetNodeCount | ( | NumConnections | num | ) |
void CConnman::GetNodeStats | ( | std::vector< CNodeStats > & | vstats | ) |
uint64_t CConnman::GetOutboundTargetBytesLeft | ( | ) |
unsigned int CConnman::GetReceiveFloodSize | ( | ) | const |
bool CConnman::GetTryNewOutboundPeer | ( | ) |
|
inline |
void CConnman::Interrupt | ( | ) |
bool CConnman::IsBanned | ( | CNetAddr | ip | ) |
bool CConnman::IsBanned | ( | CSubNet | subnet | ) |
|
private |
void CConnman::MarkAddressGood | ( | const CAddress & | addr | ) |
|
staticprivate |
bool 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 | ) |
|
private |
void CConnman::PushMessage | ( | CNode * | pnode, |
CSerializedNetMsg && | msg | ||
) |
|
private |
|
private |
void CConnman::SetBanned | ( | const banmap_t & | banmap | ) |
|
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 |
bool CConnman::Start | ( | CScheduler & | scheduler, |
const Options & | options | ||
) |
void CConnman::Stop | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
bool CConnman::Unban | ( | const CSubNet & | ip | ) |
void CConnman::WakeMessageHandler | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |