Anoncoin  0.9.4
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
CNode Class Reference

Information about a peer. More...

#include <net.h>

Collaboration diagram for CNode:
[legend]

Public Member Functions

 CNode (SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn="", bool fInboundIn=false)
 
 ~CNode ()
 
NodeId GetId () const
 
int GetRefCount ()
 
unsigned int GetTotalRecvSize ()
 
bool ReceiveMsgBytes (const char *pch, unsigned int nBytes)
 
void SetRecvVersion (int nVersionIn)
 
CNodeAddRef ()
 
void Release ()
 
void AddAddressKnown (const CAddress &addr)
 
void PushAddress (const CAddress &addr)
 
void AddInventoryKnown (const CInv &inv)
 
void PushInventory (const CInv &inv)
 
void AskFor (const CInv &inv)
 
void BeginMessage (const char *pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend)
 
void AbortMessage () UNLOCK_FUNCTION(cs_vSend)
 
void EndMessage () UNLOCK_FUNCTION(cs_vSend)
 
void PushVersion ()
 
void PushMessage (const char *pszCommand)
 
template<typename T1 >
void PushMessage (const char *pszCommand, const T1 &a1)
 
template<typename T1 , typename T2 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2)
 
template<typename T1 , typename T2 , typename T3 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7, const T8 &a8)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
void PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7, const T8 &a8, const T9 &a9)
 
bool IsSubscribed (unsigned int nChannel)
 
void Subscribe (unsigned int nChannel, unsigned int nHops=0)
 
void CancelSubscribe (unsigned int nChannel)
 
void CloseSocketDisconnect ()
 
void Cleanup ()
 
void copyStats (CNodeStats &stats)
 

Static Public Member Functions

static void ClearBanned ()
 
static bool IsBanned (CNetAddr ip)
 
static bool Ban (const CNetAddr &ip)
 
static void RecordBytesRecv (uint64_t bytes)
 
static void RecordBytesSent (uint64_t bytes)
 
static uint64_t GetTotalBytesRecv ()
 
static uint64_t GetTotalBytesSent ()
 

Public Attributes

uint64_t nServices
 
SOCKET hSocket
 
CDataStream ssSend
 
size_t nSendSize
 
size_t nSendOffset
 
uint64_t nSendBytes
 
std::deque< CSerializeDatavSendMsg
 
CCriticalSection cs_vSend
 
std::deque< CInvvRecvGetData
 
std::deque< CNetMessagevRecvMsg
 
CCriticalSection cs_vRecvMsg
 
uint64_t nRecvBytes
 
int nRecvVersion
 
int64_t nLastSend
 
int64_t nLastRecv
 
int64_t nTimeConnected
 
CAddress addr
 
std::string addrName
 
CService addrLocal
 
int nVersion
 
std::string strSubVer
 
std::string cleanSubVer
 
bool fOneShot
 
bool fClient
 
bool fInbound
 
bool fNetworkNode
 
bool fSuccessfullyConnected
 
bool fDisconnect
 
bool fRelayTxes
 
CSemaphoreGrant grantOutbound
 
CCriticalSection cs_filter
 
CBloomFilterpfilter
 
int nRefCount
 
NodeId id
 
uint256 hashContinue
 
CBlockIndexpindexLastGetBlocksBegin
 
uint256 hashLastGetBlocksEnd
 
int nStartingHeight
 
bool fStartSync
 
std::vector< CAddressvAddrToSend
 
mruset< CAddresssetAddrKnown
 
bool fGetAddr
 
std::set< uint256setKnown
 
mruset< CInvsetInventoryKnown
 
std::vector< CInvvInventoryToSend
 
CCriticalSection cs_inventory
 
std::multimap< int64_t, CInvmapAskFor
 
uint64_t nPingNonceSent
 
int64_t nPingUsecStart
 
int64_t nPingUsecTime
 
bool fPingQueued
 

Protected Member Functions

void Fuzz (int nChance)
 

Static Protected Attributes

static std::map< CNetAddr, int64_t > setBanned
 
static CCriticalSection cs_setBanned
 

Private Member Functions

 CNode (const CNode &)
 
void operator= (const CNode &)
 

Static Private Attributes

static CCriticalSection cs_totalBytesRecv
 
static CCriticalSection cs_totalBytesSent
 
static uint64_t nTotalBytesRecv = 0
 
static uint64_t nTotalBytesSent = 0
 

Detailed Description

Information about a peer.

Definition at line 223 of file net.h.

Constructor & Destructor Documentation

CNode::CNode ( SOCKET  hSocketIn,
CAddress  addrIn,
std::string  addrNameIn = "",
bool  fInboundIn = false 
)
inline

Definition at line 309 of file net.h.

Here is the call graph for this function:

CNode::~CNode ( )
inline

Definition at line 362 of file net.h.

Here is the call graph for this function:

CNode::CNode ( const CNode )
private

Member Function Documentation

void CNode::AbortMessage ( )
inline

Definition at line 525 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::AddAddressKnown ( const CAddress addr)
inline

Definition at line 450 of file net.h.

Here is the call graph for this function:

void CNode::AddInventoryKnown ( const CInv inv)
inline

Definition at line 465 of file net.h.

Here is the call graph for this function:

CNode* CNode::AddRef ( )
inline

Definition at line 437 of file net.h.

Here is the caller graph for this function:

void CNode::AskFor ( const CInv inv)
inline

Definition at line 482 of file net.h.

Here is the call graph for this function:

bool CNode::Ban ( const CNetAddr ip)
static

Definition at line 584 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::BeginMessage ( const char *  pszCommand)
inline

Definition at line 516 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::CancelSubscribe ( unsigned int  nChannel)
void CNode::Cleanup ( )

Definition at line 537 of file net.cpp.

Here is the caller graph for this function:

void CNode::ClearBanned ( )
static

Definition at line 563 of file net.cpp.

void CNode::CloseSocketDisconnect ( )

Definition at line 517 of file net.cpp.

Here is the caller graph for this function:

void CNode::copyStats ( CNodeStats stats)

Definition at line 596 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::EndMessage ( )
inline

Definition at line 535 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::Fuzz ( int  nChance)
protected

Definition at line 2169 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NodeId CNode::GetId ( ) const
inline

Definition at line 407 of file net.h.

Here is the caller graph for this function:

int CNode::GetRefCount ( )
inline

Definition at line 411 of file net.h.

Here is the caller graph for this function:

uint64_t CNode::GetTotalBytesRecv ( )
static

Definition at line 2157 of file net.cpp.

Here is the caller graph for this function:

uint64_t CNode::GetTotalBytesSent ( )
static

Definition at line 2163 of file net.cpp.

Here is the caller graph for this function:

unsigned int CNode::GetTotalRecvSize ( )
inline

Definition at line 418 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNode::IsBanned ( CNetAddr  ip)
static

Definition at line 568 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNode::IsSubscribed ( unsigned int  nChannel)
void CNode::operator= ( const CNode )
private
void CNode::PushAddress ( const CAddress addr)
inline

Definition at line 455 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::PushInventory ( const CInv inv)
inline

Definition at line 473 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::PushMessage ( const char *  pszCommand)
inline

Definition at line 579 of file net.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T1 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1 
)
inline

Definition at line 594 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2 
)
inline

Definition at line 610 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3 
)
inline

Definition at line 626 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 , typename T4 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3,
const T4 &  a4 
)
inline

Definition at line 642 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3,
const T4 &  a4,
const T5 &  a5 
)
inline

Definition at line 658 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3,
const T4 &  a4,
const T5 &  a5,
const T6 &  a6 
)
inline

Definition at line 674 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3,
const T4 &  a4,
const T5 &  a5,
const T6 &  a6,
const T7 &  a7 
)
inline

Definition at line 690 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3,
const T4 &  a4,
const T5 &  a5,
const T6 &  a6,
const T7 &  a7,
const T8 &  a8 
)
inline

Definition at line 706 of file net.h.

Here is the call graph for this function:

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
void CNode::PushMessage ( const char *  pszCommand,
const T1 &  a1,
const T2 &  a2,
const T3 &  a3,
const T4 &  a4,
const T5 &  a5,
const T6 &  a6,
const T7 &  a7,
const T8 &  a8,
const T9 &  a9 
)
inline

Definition at line 722 of file net.h.

Here is the call graph for this function:

void CNode::PushVersion ( )

when NTP implemented, change to just nTime = GetAdjustedTime()

Definition at line 542 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CNode::ReceiveMsgBytes ( const char *  pch,
unsigned int  nBytes 
)

Definition at line 633 of file net.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void CNode::RecordBytesRecv ( uint64_t  bytes)
static

Definition at line 2145 of file net.cpp.

Here is the caller graph for this function:

void CNode::RecordBytesSent ( uint64_t  bytes)
static

Definition at line 2151 of file net.cpp.

Here is the caller graph for this function:

void CNode::Release ( )
inline

Definition at line 443 of file net.h.

Here is the caller graph for this function:

void CNode::SetRecvVersion ( int  nVersionIn)
inline

Definition at line 430 of file net.h.

Here is the call graph for this function:

void CNode::Subscribe ( unsigned int  nChannel,
unsigned int  nHops = 0 
)

Member Data Documentation

CAddress CNode::addr

Definition at line 245 of file net.h.

CService CNode::addrLocal

Definition at line 247 of file net.h.

std::string CNode::addrName

Definition at line 246 of file net.h.

std::string CNode::cleanSubVer

Definition at line 253 of file net.h.

CCriticalSection CNode::cs_filter

Definition at line 266 of file net.h.

CCriticalSection CNode::cs_inventory

Definition at line 296 of file net.h.

CCriticalSection CNode::cs_setBanned
staticprotected

Definition at line 275 of file net.h.

CCriticalSection CNode::cs_totalBytesRecv
staticprivate

Definition at line 380 of file net.h.

CCriticalSection CNode::cs_totalBytesSent
staticprivate

Definition at line 381 of file net.h.

CCriticalSection CNode::cs_vRecvMsg

Definition at line 238 of file net.h.

CCriticalSection CNode::cs_vSend

Definition at line 234 of file net.h.

bool CNode::fClient

Definition at line 255 of file net.h.

bool CNode::fDisconnect

Definition at line 259 of file net.h.

bool CNode::fGetAddr

Definition at line 290 of file net.h.

bool CNode::fInbound

Definition at line 256 of file net.h.

bool CNode::fNetworkNode

Definition at line 257 of file net.h.

bool CNode::fOneShot

Definition at line 254 of file net.h.

bool CNode::fPingQueued

Definition at line 307 of file net.h.

bool CNode::fRelayTxes

Definition at line 264 of file net.h.

bool CNode::fStartSync

Definition at line 285 of file net.h.

bool CNode::fSuccessfullyConnected

Definition at line 258 of file net.h.

CSemaphoreGrant CNode::grantOutbound

Definition at line 265 of file net.h.

uint256 CNode::hashContinue

Definition at line 281 of file net.h.

uint256 CNode::hashLastGetBlocksEnd

Definition at line 283 of file net.h.

SOCKET CNode::hSocket

Definition at line 228 of file net.h.

NodeId CNode::id

Definition at line 269 of file net.h.

std::multimap<int64_t, CInv> CNode::mapAskFor

Definition at line 297 of file net.h.

int64_t CNode::nLastRecv

Definition at line 243 of file net.h.

int64_t CNode::nLastSend

Definition at line 242 of file net.h.

uint64_t CNode::nPingNonceSent

Definition at line 301 of file net.h.

int64_t CNode::nPingUsecStart

Definition at line 303 of file net.h.

int64_t CNode::nPingUsecTime

Definition at line 305 of file net.h.

uint64_t CNode::nRecvBytes

Definition at line 239 of file net.h.

int CNode::nRecvVersion

Definition at line 240 of file net.h.

int CNode::nRefCount

Definition at line 268 of file net.h.

uint64_t CNode::nSendBytes

Definition at line 232 of file net.h.

size_t CNode::nSendOffset

Definition at line 231 of file net.h.

size_t CNode::nSendSize

Definition at line 230 of file net.h.

uint64_t CNode::nServices

Definition at line 227 of file net.h.

int CNode::nStartingHeight

Definition at line 284 of file net.h.

int64_t CNode::nTimeConnected

Definition at line 244 of file net.h.

uint64_t CNode::nTotalBytesRecv = 0
staticprivate

Definition at line 382 of file net.h.

uint64_t CNode::nTotalBytesSent = 0
staticprivate

Definition at line 383 of file net.h.

int CNode::nVersion

Definition at line 248 of file net.h.

CBloomFilter* CNode::pfilter

Definition at line 267 of file net.h.

CBlockIndex* CNode::pindexLastGetBlocksBegin

Definition at line 282 of file net.h.

mruset<CAddress> CNode::setAddrKnown

Definition at line 289 of file net.h.

std::map< CNetAddr, int64_t > CNode::setBanned
staticprotected

Definition at line 274 of file net.h.

mruset<CInv> CNode::setInventoryKnown

Definition at line 294 of file net.h.

std::set<uint256> CNode::setKnown

Definition at line 291 of file net.h.

CDataStream CNode::ssSend

Definition at line 229 of file net.h.

std::string CNode::strSubVer

Definition at line 253 of file net.h.

std::vector<CAddress> CNode::vAddrToSend

Definition at line 288 of file net.h.

std::vector<CInv> CNode::vInventoryToSend

Definition at line 295 of file net.h.

std::deque<CInv> CNode::vRecvGetData

Definition at line 236 of file net.h.

std::deque<CNetMessage> CNode::vRecvMsg

Definition at line 237 of file net.h.

std::deque<CSerializeData> CNode::vSendMsg

Definition at line 233 of file net.h.


The documentation for this class was generated from the following files: