PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Classes | Typedefs | Enumerations | Functions | Variables
net.h File Reference
#include "bloom.h"
#include "compat.h"
#include "hash.h"
#include "fs.h"
#include "limitedmap.h"
#include "netaddress.h"
#include "protocol.h"
#include "random.h"
#include "streams.h"
#include "sync.h"
#include "uint256.h"
#include "utilstrencodings.h"
#include <atomic>
#include <deque>
#include <stdint.h>
#include <arpa/inet.h>
#include <boost/signals2/signal.hpp>
Include dependency graph for net.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CombinerAll
 
struct  CNodeSignals
 
struct  LocalServiceInfo
 
class  CNodeStats
 
class  CNetMessage
 
class  CBanEntry
 
class  CNode
 Information about a peer. More...
 
class  CExplicitNetCleanup
 
class  CAddrDB
 Access to the (IP) address database (peers.dat) More...
 
class  CBanDB
 Access to the banlist database (banlist.dat) More...
 
struct  AddedNodeInfo
 

Typedefs

typedef int64_t NodeId
 
typedef enum BanReason BanReason
 
typedef std::map< CSubNet, CBanEntrybanmap_t
 

Enumerations

enum  {
  LOCAL_NONE, LOCAL_IF, LOCAL_BIND, LOCAL_UPNP,
  LOCAL_MANUAL, LOCAL_MAX
}
 
enum  BanReason { BanReasonUnknown = 0, BanReasonNodeMisbehaving = 1, BanReasonManuallyAdded = 2 }
 

Functions

unsigned int ReceiveFloodSize ()
 
unsigned int SendBufferSize ()
 
void AddOneShot (std::string strDest)
 
void AddressCurrentlyConnected (const CService &addr)
 
CNodeFindNode (const CNetAddr &ip)
 
CNodeFindNode (const CSubNet &subNet)
 
CNodeFindNode (const std::string &addrName)
 
CNodeFindNode (const CService &ip)
 
bool OpenNetworkConnection (const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound=NULL, const char *strDest=NULL, bool fOneShot=false, bool fFeeler=false)
 
void MapPort (bool fUseUPnP)
 
unsigned short GetListenPort ()
 
bool BindListenPort (const CService &bindAddr, std::string &strError, bool fWhitelisted=false)
 
void StartNode (boost::thread_group &threadGroup, CScheduler &scheduler)
 
bool StopNode ()
 
void SocketSendData (CNode *pnode)
 
CNodeSignalsGetNodeSignals ()
 
bool IsPeerAddrLocalGood (CNode *pnode)
 
void AdvertiseLocal (CNode *pnode)
 
void SetLimited (enum Network net, bool fLimited=true)
 Make a particular network entirely off-limits (no automatic connects to it) More...
 
bool IsLimited (enum Network net)
 
bool IsLimited (const CNetAddr &addr)
 
bool AddLocal (const CService &addr, int nScore=LOCAL_NONE)
 
bool AddLocal (const CNetAddr &addr, int nScore=LOCAL_NONE)
 
bool RemoveLocal (const CService &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 GetLocal (CService &addr, const CNetAddr *paddrPeer=NULL)
 
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...
 
CAddress GetLocalAddress (const CNetAddr *paddrPeer=NULL)
 
bool validateMasternodeIP (const std::string &addrStr)
 
void RelayTransaction (const CTransaction &tx)
 
void RelayTransaction (const CTransaction &tx, const CDataStream &ss)
 
void RelayTransactionLockReq (const CTransaction &tx, bool relayToAll=false)
 
void RelayInv (CInv &inv)
 
std::vector< AddedNodeInfoGetAddedNodeInfo ()
 
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
 
bool fListen
 
ServiceFlags nLocalServices
 
uint64_t nLocalHostNonce
 
CAddrMan addrman
 
int nMaxConnections
 
std::vector< CNode * > vNodes
 
RecursiveMutex cs_vNodes
 
std::map< CInv, CDataStreammapRelay
 
std::deque< std::pair< int64_t, CInv > > vRelayExpiration
 
RecursiveMutex cs_mapRelay
 
limitedmap< CInv, int64_t > mapAlreadyAskedFor
 
std::vector< std::string > vAddedNodes
 
RecursiveMutex cs_vAddedNodes
 
NodeId nLastNodeId
 
RecursiveMutex cs_nLastNodeId
 
std::string strSubVersion
 Subversion as sent to the P2P network in version messages. More...
 
RecursiveMutex cs_mapLocalHost
 
std::map< CNetAddr, LocalServiceInfomapLocalHost
 

Typedef Documentation

◆ banmap_t

typedef std::map<CSubNet, CBanEntry> banmap_t

Definition at line 302 of file net.h.

◆ BanReason

typedef enum BanReason BanReason

◆ NodeId

typedef int64_t NodeId

Definition at line 92 of file net.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LOCAL_NONE 
LOCAL_IF 
LOCAL_BIND 
LOCAL_UPNP 
LOCAL_MANUAL 
LOCAL_MAX 

Definition at line 122 of file net.h.

◆ BanReason

enum BanReason
Enumerator
BanReasonUnknown 
BanReasonNodeMisbehaving 
BanReasonManuallyAdded 

Definition at line 244 of file net.h.

Function Documentation

◆ AddLocal() [1/2]

bool AddLocal ( const CNetAddr addr,
int  nScore = LOCAL_NONE 
)

Definition at line 233 of file net.cpp.

Here is the call graph for this function:

◆ AddLocal() [2/2]

bool AddLocal ( const CService addr,
int  nScore = LOCAL_NONE 
)

Definition at line 208 of file net.cpp.

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

◆ AddOneShot()

void AddOneShot ( std::string  strDest)

Definition at line 109 of file net.cpp.

Here is the caller graph for this function:

◆ AddressCurrentlyConnected()

void AddressCurrentlyConnected ( const CService addr)

Definition at line 291 of file net.cpp.

Here is the call graph for this function:

◆ AdvertiseLocal()

void AdvertiseLocal ( CNode pnode)

Definition at line 188 of file net.cpp.

Here is the call graph for this function:

◆ BindListenPort()

bool BindListenPort ( const CService bindAddr,
std::string &  strError,
bool  fWhitelisted = false 
)

Definition at line 1757 of file net.cpp.

Here is the call graph for this function:

◆ FindNode() [1/4]

CNode* FindNode ( const CNetAddr ip)

Definition at line 301 of file net.cpp.

Here is the caller graph for this function:

◆ FindNode() [2/4]

CNode* FindNode ( const CService ip)

Definition at line 325 of file net.cpp.

Here is the call graph for this function:

◆ FindNode() [3/4]

CNode* FindNode ( const CSubNet subNet)

Definition at line 309 of file net.cpp.

Here is the call graph for this function:

◆ FindNode() [4/4]

CNode* FindNode ( const std::string &  addrName)

Definition at line 317 of file net.cpp.

◆ GetAddedNodeInfo()

std::vector<AddedNodeInfo> GetAddedNodeInfo ( )

Definition at line 1593 of file net.cpp.

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

◆ GetListenPort()

unsigned short GetListenPort ( )

Definition at line 114 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 = NULL 
)

Definition at line 119 of file net.cpp.

Here is the caller graph for this function:

◆ GetLocalAddress()

CAddress GetLocalAddress ( const CNetAddr paddrPeer = NULL)

Definition at line 164 of file net.cpp.

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

◆ GetNodeSignals()

CNodeSignals& GetNodeSignals ( )

Definition at line 107 of file net.cpp.

Here is the caller graph for this function:

◆ IsLimited() [1/2]

bool IsLimited ( const CNetAddr addr)

Definition at line 257 of file net.cpp.

Here is the call graph for this function:

◆ IsLimited() [2/2]

bool IsLimited ( enum Network  net)

Definition at line 252 of file net.cpp.

Here is the caller graph for this function:

◆ IsLocal()

bool IsLocal ( const CService addr)

check whether a given address is potentially local

Definition at line 274 of file net.cpp.

Here is the caller graph for this function:

◆ IsPeerAddrLocalGood()

bool IsPeerAddrLocalGood ( CNode pnode)

Definition at line 182 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 ( const CNetAddr addr)

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

Definition at line 286 of file net.cpp.

Here is the call graph for this function:

◆ IsReachable() [2/2]

bool IsReachable ( enum Network  net)

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

Definition at line 280 of file net.cpp.

Here is the caller graph for this function:

◆ MapPort()

void MapPort ( bool  fUseUPnP)

Definition at line 1360 of file net.cpp.

Here is the caller graph for this function:

◆ OpenNetworkConnection()

bool OpenNetworkConnection ( const CAddress addrConnect,
bool  fCountFailure,
CSemaphoreGrant grantOutbound = NULL,
const char *  strDest = NULL,
bool  fOneShot = false,
bool  fFeeler = false 
)

Definition at line 1670 of file net.cpp.

Here is the call graph for this function:
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 2503 of file net.cpp.

Here is the call graph for this function:

◆ ReceiveFloodSize()

unsigned int ReceiveFloodSize ( )

Definition at line 2241 of file net.cpp.

Here is the call graph for this function:

◆ RelayInv()

void RelayInv ( CInv inv)

Definition at line 2077 of file net.cpp.

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

◆ RelayTransaction() [1/2]

void RelayTransaction ( const CTransaction tx)

Definition at line 2028 of file net.cpp.

Here is the caller graph for this function:

◆ RelayTransaction() [2/2]

void RelayTransaction ( const CTransaction tx,
const CDataStream ss 
)

Definition at line 2035 of file net.cpp.

Here is the call graph for this function:

◆ RelayTransactionLockReq()

void RelayTransactionLockReq ( const CTransaction tx,
bool  relayToAll = false 
)

Definition at line 2063 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 237 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 262 of file net.cpp.

◆ SendBufferSize()

unsigned int SendBufferSize ( )

Definition at line 2243 of file net.cpp.

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

◆ SetLimited()

void SetLimited ( enum Network  net,
bool  fLimited = true 
)

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

Definition at line 245 of file net.cpp.

Here is the caller graph for this function:

◆ SocketSendData()

void SocketSendData ( CNode pnode)

Definition at line 762 of file net.cpp.

◆ StartNode()

void StartNode ( boost::thread_group &  threadGroup,
CScheduler scheduler 
)

Definition at line 1891 of file net.cpp.

◆ StopNode()

bool StopNode ( )

Definition at line 1972 of file net.cpp.

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

◆ validateMasternodeIP()

bool validateMasternodeIP ( const std::string &  addrStr)

Definition at line 2493 of file net.cpp.

Here is the call graph for this function:

Variable Documentation

◆ addrman

CAddrMan addrman

Definition at line 80 of file net.cpp.

◆ cs_mapLocalHost

RecursiveMutex cs_mapLocalHost

Definition at line 74 of file net.cpp.

◆ cs_mapRelay

RecursiveMutex cs_mapRelay

Definition at line 89 of file net.cpp.

◆ cs_nLastNodeId

RecursiveMutex cs_nLastNodeId

Definition at line 99 of file net.cpp.

◆ cs_vAddedNodes

RecursiveMutex cs_vAddedNodes

Definition at line 96 of file net.cpp.

◆ cs_vNodes

RecursiveMutex cs_vNodes

Definition at line 86 of file net.cpp.

◆ fDiscover

bool fDiscover

Definition at line 71 of file net.cpp.

◆ fListen

bool fListen

Definition at line 72 of file net.cpp.

◆ mapAlreadyAskedFor

limitedmap<CInv, int64_t> mapAlreadyAskedFor

◆ mapLocalHost

std::map<CNetAddr, LocalServiceInfo> mapLocalHost

Definition at line 75 of file net.cpp.

◆ mapRelay

std::map<CInv, CDataStream> mapRelay

Definition at line 87 of file net.cpp.

◆ nLastNodeId

NodeId nLastNodeId

Definition at line 98 of file net.cpp.

◆ nLocalHostNonce

uint64_t nLocalHostNonce

Definition at line 78 of file net.cpp.

◆ nLocalServices

ServiceFlags nLocalServices

Definition at line 73 of file net.cpp.

◆ nMaxConnections

int nMaxConnections

Definition at line 81 of file net.cpp.

◆ strSubVersion

std::string strSubVersion

Subversion as sent to the P2P network in version messages.

Definition at line 83 of file net.cpp.

◆ vAddedNodes

std::vector<std::string> vAddedNodes

Definition at line 95 of file net.cpp.

◆ vNodes

std::vector<CNode*> vNodes

Definition at line 85 of file net.cpp.

◆ vRelayExpiration

std::deque<std::pair<int64_t, CInv> > vRelayExpiration

Definition at line 88 of file net.cpp.