BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
Classes | Macros | Enumerations | Functions | Variables
net.cpp File Reference
#include <net.h>
#include <chainparams.h>
#include <clientversion.h>
#include <consensus/consensus.h>
#include <crypto/common.h>
#include <crypto/sha256.h>
#include <primitives/transaction.h>
#include <netbase.h>
#include <scheduler.h>
#include <ui_interface.h>
#include <utilstrencodings.h>
#include <fcntl.h>
#include <math.h>
Include dependency graph for net.cpp:

Go to the source code of this file.

Classes

struct  NodeEvictionCandidate
 
class  CNetCleanup
 

Macros

#define DUMP_ADDRESSES_INTERVAL   900
 
#define FEELER_SLEEP_WINDOW   1
 
#define MSG_NOSIGNAL   0
 
#define MSG_DONTWAIT   0
 
#define X(name)   stats.name = name
 

Enumerations

enum  BindFlags { BF_NONE = 0, BF_EXPLICIT = (1U << 0), BF_REPORT_ERROR = (1U << 1), BF_WHITELIST = (1U << 2) }
 Used to pass flags to the Bind() function. More...
 

Functions

unsigned short GetListenPort ()
 
bool GetLocal (CService &addr, const CNetAddr *paddrPeer)
 
CAddress GetLocalAddress (const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
 
bool IsPeerAddrLocalGood (CNode *pnode)
 
void AdvertiseLocal (CNode *pnode)
 
bool AddLocal (const CService &addr, int nScore)
 
bool AddLocal (const CNetAddr &addr, int nScore)
 
void RemoveLocal (const CService &addr)
 
void SetLimited (enum Network net, bool fLimited)
 Make a particular network entirely off-limits (no automatic connects to it) More...
 
bool IsLimited (enum Network net)
 
bool IsLimited (const CNetAddr &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 IsReachable (enum Network net)
 check whether a given network is one we can probably connect to More...
 
bool IsReachable (const CNetAddr &addr)
 check whether a given address is in a network we can probably connect to More...
 
void StartMapPort ()
 
void InterruptMapPort ()
 
void StopMapPort ()
 
void Discover ()
 
int64_t PoissonNextSend (int64_t now, int average_interval_seconds)
 Return a timestamp in the future (in microseconds) for exponentially distributed events. More...
 

Variables

bool fDiscover = true
 
bool fListen = true
 
bool fRelayTxes = true
 
CCriticalSection cs_mapLocalHost
 
std::map< CNetAddr, LocalServiceInfomapLocalHost
 
std::string strSubVersion
 Subversion as sent to the P2P network in version messages. More...
 
limitedmap< uint256, int64_t > mapAlreadyAskedFor (MAX_INV_SZ)
 
class CNetCleanup instance_of_cnetcleanup
 

Macro Definition Documentation

◆ DUMP_ADDRESSES_INTERVAL

#define DUMP_ADDRESSES_INTERVAL   900

Definition at line 41 of file net.cpp.

◆ FEELER_SLEEP_WINDOW

#define FEELER_SLEEP_WINDOW   1

Definition at line 44 of file net.cpp.

◆ MSG_DONTWAIT

#define MSG_DONTWAIT   0

Definition at line 53 of file net.cpp.

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   0

Definition at line 48 of file net.cpp.

◆ X

#define X (   name)    stats.name = name

Definition at line 685 of file net.cpp.

Enumeration Type Documentation

◆ BindFlags

enum BindFlags

Used to pass flags to the Bind() function.

Enumerator
BF_NONE 
BF_EXPLICIT 
BF_REPORT_ERROR 
BF_WHITELIST 

Definition at line 68 of file net.cpp.

Function Documentation

◆ AddLocal() [1/2]

bool AddLocal ( const CService addr,
int  nScore 
)

Definition at line 209 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddLocal() [2/2]

bool AddLocal ( const CNetAddr addr,
int  nScore 
)

Definition at line 235 of file net.cpp.

Here is the call graph for this function:

◆ AdvertiseLocal()

void AdvertiseLocal ( CNode pnode)

Definition at line 182 of file net.cpp.

Here is the call graph for this function:

◆ Discover()

void Discover ( )

Definition at line 2164 of file net.cpp.

Here is the call graph for this function:

◆ GetListenPort()

unsigned short GetListenPort ( )

Definition at line 99 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLocal()

bool GetLocal ( CService addr,
const CNetAddr paddrPeer 
)

Definition at line 105 of file net.cpp.

Here is the caller graph for this function:

◆ GetLocalAddress()

CAddress GetLocalAddress ( const CNetAddr paddrPeer,
ServiceFlags  nLocalServices 
)

Definition at line 153 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InterruptMapPort()

void InterruptMapPort ( )

Definition at line 1603 of file net.cpp.

Here is the caller graph for this function:

◆ IsLimited() [1/2]

bool IsLimited ( enum Network  net)

Definition at line 256 of file net.cpp.

Here is the caller graph for this function:

◆ IsLimited() [2/2]

bool IsLimited ( const CNetAddr addr)

Definition at line 262 of file net.cpp.

Here is the call graph for this function:

◆ IsLocal()

bool IsLocal ( const CService addr)

check whether a given address is potentially local

Definition at line 281 of file net.cpp.

Here is the caller graph for this function:

◆ IsPeerAddrLocalGood()

bool IsPeerAddrLocalGood ( CNode pnode)

Definition at line 174 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsReachable() [1/2]

bool IsReachable ( enum Network  net)

check whether a given network is one we can probably connect to

Definition at line 288 of file net.cpp.

Here is the caller graph for this function:

◆ IsReachable() [2/2]

bool IsReachable ( const CNetAddr addr)

check whether a given address is in a network we can probably connect to

Definition at line 295 of file net.cpp.

Here is the call graph for this function:

◆ PoissonNextSend()

int64_t PoissonNextSend ( int64_t  now,
int  average_interval_seconds 
)

Return a timestamp in the future (in microseconds) for exponentially distributed events.

Definition at line 2900 of file net.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveLocal()

void RemoveLocal ( const CService addr)

Definition at line 240 of file net.cpp.

Here is the caller graph for this function:

◆ SeenLocal()

bool SeenLocal ( const CService addr)

vote for a local address

Definition at line 268 of file net.cpp.

◆ SetLimited()

void SetLimited ( enum Network  net,
bool  fLimited 
)

Make a particular network entirely off-limits (no automatic connects to it)

Definition at line 248 of file net.cpp.

◆ StartMapPort()

void StartMapPort ( )

Definition at line 1599 of file net.cpp.

◆ StopMapPort()

void StopMapPort ( )

Definition at line 1607 of file net.cpp.

Variable Documentation

◆ cs_mapLocalHost

CCriticalSection cs_mapLocalHost

Definition at line 86 of file net.cpp.

◆ fDiscover

bool fDiscover = true

Definition at line 83 of file net.cpp.

◆ fListen

bool fListen = true

Definition at line 84 of file net.cpp.

◆ fRelayTxes

bool fRelayTxes = true

Definition at line 85 of file net.cpp.

◆ instance_of_cnetcleanup

class CNetCleanup instance_of_cnetcleanup

◆ mapAlreadyAskedFor

limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ)

◆ mapLocalHost

std::map<CNetAddr, LocalServiceInfo> mapLocalHost

Definition at line 87 of file net.cpp.

◆ strSubVersion

std::string strSubVersion

Subversion as sent to the P2P network in version messages.

Definition at line 89 of file net.cpp.