Raven Core  3.0.0
P2P Digital Currency
Classes | Macros | Enumerations | Functions | Variables
net.cpp File Reference
#include "net.h"
#include "addrman.h"
#include "chainparams.h"
#include "clientversion.h"
#include "consensus/consensus.h"
#include "crypto/common.h"
#include "crypto/sha256.h"
#include "hash.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 <string>
#include <iostream>
#include <sstream>
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)
 
int GetnScore (const CService &addr)
 
bool IsPeerAddrLocalGood (CNode *pnode)
 
void AdvertiseLocal (CNode *pnode)
 
bool AddLocal (const CService &addr, int nScore)
 
bool AddLocal (const CNetAddr &addr, int nScore)
 
bool 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 MapPort (bool)
 
void Discover (boost::thread_group &threadGroup)
 
int64_t PoissonNextSend (int64_t nNow, 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 47 of file net.cpp.

◆ FEELER_SLEEP_WINDOW

#define FEELER_SLEEP_WINDOW   1

Definition at line 50 of file net.cpp.

◆ MSG_DONTWAIT

#define MSG_DONTWAIT   0

Definition at line 58 of file net.cpp.

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   0

Definition at line 53 of file net.cpp.

◆ X

#define X (   name)    stats.name = name

Definition at line 671 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 73 of file net.cpp.

Function Documentation

◆ AddLocal() [1/2]

bool AddLocal ( const CService addr,
int  nScore 
)

Definition at line 210 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 236 of file net.cpp.

Here is the call graph for this function:

◆ AdvertiseLocal()

void AdvertiseLocal ( CNode pnode)

Definition at line 187 of file net.cpp.

Here is the call graph for this function:

◆ Discover()

void Discover ( boost::thread_group &  threadGroup)

Definition at line 2177 of file net.cpp.

Here is the call graph for this function:

◆ GetListenPort()

unsigned short GetListenPort ( )

Definition at line 103 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 109 of file net.cpp.

Here is the caller graph for this function:

◆ GetLocalAddress()

CAddress GetLocalAddress ( const CNetAddr paddrPeer,
ServiceFlags  nLocalServices 
)

Definition at line 158 of file net.cpp.

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

◆ GetnScore()

int GetnScore ( const CService addr)

Definition at line 170 of file net.cpp.

Here is the caller graph for this function:

◆ IsLimited() [1/2]

bool IsLimited ( enum Network  net)

Definition at line 258 of file net.cpp.

Here is the caller graph for this function:

◆ IsLimited() [2/2]

bool IsLimited ( const CNetAddr addr)

Definition at line 264 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 283 of file net.cpp.

Here is the caller graph for this function:

◆ IsPeerAddrLocalGood()

bool IsPeerAddrLocalGood ( CNode pnode)

Definition at line 179 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 290 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 297 of file net.cpp.

Here is the call graph for this function:

◆ MapPort()

void MapPort ( bool  )

Definition at line 1572 of file net.cpp.

Here is the caller graph for this function:

◆ PoissonNextSend()

int64_t PoissonNextSend ( int64_t  nNow,
int  average_interval_seconds 
)

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

Definition at line 2924 of file net.cpp.

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

◆ RemoveLocal()

bool RemoveLocal ( const CService addr)

Definition at line 241 of file net.cpp.

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

◆ SeenLocal()

bool SeenLocal ( const CService addr)

vote for a local address

Definition at line 270 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 250 of file net.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ cs_mapLocalHost

CCriticalSection cs_mapLocalHost

Definition at line 90 of file net.cpp.

◆ fDiscover

bool fDiscover = true

Definition at line 87 of file net.cpp.

◆ fListen

bool fListen = true

Definition at line 88 of file net.cpp.

◆ fRelayTxes

bool fRelayTxes = true

Definition at line 89 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 91 of file net.cpp.

◆ strSubVersion

std::string strSubVersion

Subversion as sent to the P2P network in version messages.

Definition at line 93 of file net.cpp.