Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Classes | Macros | Functions | Variables
net.cpp File Reference
#include "db.h"
#include "net.h"
#include "init.h"
#include "addrman.h"
#include "ui_interface.h"
#include "script.h"
Include dependency graph for net.cpp:

Go to the source code of this file.

Classes

struct  LocalServiceInfo
 
class  CNetCleanup
 

Macros

#define DUMP_ADDRESSES_INTERVAL   900
 
#define X(name)   stats.name = name
 

Functions

bool OpenNetworkConnection (const CAddress &addrConnect, CSemaphoreGrant *grantOutbound=NULL, const char *strDest=NULL, bool fOneShot=false)
 
void AddOneShot (string strDest)
 
unsigned short GetListenPort ()
 
bool GetLocal (CService &addr, const CNetAddr *paddrPeer)
 
CAddress GetLocalAddress (const CNetAddr *paddrPeer)
 
bool RecvLine (SOCKET hSocket, string &strLine)
 
void SetReachable (enum Network net, bool fFlag)
 
bool AddLocal (const CService &addr, int nScore)
 
bool AddLocal (const CNetAddr &addr, int nScore)
 
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 (const CNetAddr &addr)
 check whether a given address is in a network we can probably connect to More...
 
bool GetMyExternalIP2 (const CService &addrConnect, const char *pszGet, const char *pszKeyword, CNetAddr &ipRet)
 
bool GetMyExternalIP (CNetAddr &ipRet)
 
void ThreadGetMyExternalIP (void *parg)
 
void AddressCurrentlyConnected (const CService &addr)
 
CNodeFindNode (const CNetAddr &ip)
 
CNodeFindNode (std::string addrName)
 
CNodeFindNode (const CService &addr)
 
CNodeConnectNode (CAddress addrConnect, const char *pszDest)
 
void SocketSendData (CNode *pnode)
 
void ThreadSocketHandler ()
 
void MapPort (bool)
 
void ThreadDNSAddressSeed ()
 
void DumpAddresses ()
 
void ThreadOpenConnections ()
 
void ThreadOpenAddedConnections ()
 
void ThreadMessageHandler ()
 
bool BindListenPort (const CService &addrBind, string &strError)
 
void StartNode (boost::thread_group &threadGroup)
 
bool StopNode ()
 
void RelayTransaction (const CTransaction &tx, const uint256 &hash)
 
void RelayTransaction (const CTransaction &tx, const uint256 &hash, const CDataStream &ss)
 

Variables

bool fDiscover = true
 
uint64 nLocalServices = NODE_NETWORK
 
uint64 nLocalHostNonce = 0
 
CAddrMan addrman
 
int nMaxConnections = 125
 
vector< CNode * > vNodes
 
CCriticalSection cs_vNodes
 
map< CInv, CDataStreammapRelay
 
deque< pair< int64, CInv > > vRelayExpiration
 
CCriticalSection cs_mapRelay
 
limitedmap< CInv, int64mapAlreadyAskedFor (MAX_INV_SZ)
 
CCriticalSection cs_vOneShots
 
set< CNetAddrsetservAddNodeAddresses
 
CCriticalSection cs_setservAddNodeAddresses
 
vector< std::string > vAddedNodes
 
CCriticalSection cs_vAddedNodes
 
unsigned int pnSeed []
 
class CNetCleanup instance_of_cnetcleanup
 

Macro Definition Documentation

#define DUMP_ADDRESSES_INTERVAL   900

Definition at line 25 of file net.cpp.

#define X (   name)    stats.name = name

Definition at line 606 of file net.cpp.

Function Documentation

bool AddLocal ( const CService addr,
int  nScore 
)

Definition at line 213 of file net.cpp.

bool AddLocal ( const CNetAddr addr,
int  nScore 
)

Definition at line 242 of file net.cpp.

void AddOneShot ( string  strDest)

Definition at line 74 of file net.cpp.

void AddressCurrentlyConnected ( const CService addr)

Definition at line 419 of file net.cpp.

bool BindListenPort ( const CService addrBind,
string &  strError 
)

Definition at line 1615 of file net.cpp.

CNode* ConnectNode ( CAddress  addrConnect,
const char *  pszDest 
)

debug print

debug print

Definition at line 457 of file net.cpp.

void DumpAddresses ( )

Definition at line 1260 of file net.cpp.

CNode* FindNode ( const CNetAddr ip)

Definition at line 430 of file net.cpp.

CNode* FindNode ( std::string  addrName)

Definition at line 439 of file net.cpp.

CNode* FindNode ( const CService addr)

Definition at line 448 of file net.cpp.

unsigned short GetListenPort ( )

Definition at line 80 of file net.cpp.

bool GetLocal ( CService addr,
const CNetAddr paddrPeer 
)

Definition at line 97 of file net.cpp.

CAddress GetLocalAddress ( const CNetAddr paddrPeer)

Definition at line 122 of file net.cpp.

bool GetMyExternalIP ( CNetAddr ipRet)

Definition at line 343 of file net.cpp.

bool GetMyExternalIP2 ( const CService addrConnect,
const char *  pszGet,
const char *  pszKeyword,
CNetAddr ipRet 
)

Definition at line 297 of file net.cpp.

bool IsLimited ( enum Network  net)

Definition at line 256 of file net.cpp.

bool IsLimited ( const CNetAddr addr)

Definition at line 262 of file net.cpp.

bool IsLocal ( const CService addr)

check whether a given address is potentially local

Definition at line 283 of file net.cpp.

bool IsReachable ( const CNetAddr addr)

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

Definition at line 290 of file net.cpp.

void MapPort ( bool  )

Definition at line 1176 of file net.cpp.

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

Definition at line 1472 of file net.cpp.

bool RecvLine ( SOCKET  hSocket,
string &  strLine 
)

Definition at line 135 of file net.cpp.

void RelayTransaction ( const CTransaction tx,
const uint256 hash 
)

Definition at line 1871 of file net.cpp.

void RelayTransaction ( const CTransaction tx,
const uint256 hash,
const CDataStream ss 
)

Definition at line 1879 of file net.cpp.

bool SeenLocal ( const CService addr)

vote for a local address

Definition at line 268 of file net.cpp.

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.

void SetReachable ( enum Network  net,
bool  fFlag 
)

Definition at line 204 of file net.cpp.

void SocketSendData ( CNode pnode)

Definition at line 707 of file net.cpp.

void StartNode ( boost::thread_group &  threadGroup)

Definition at line 1770 of file net.cpp.

bool StopNode ( )

Definition at line 1813 of file net.cpp.

void ThreadDNSAddressSeed ( )

Definition at line 1207 of file net.cpp.

void ThreadGetMyExternalIP ( void *  parg)

Definition at line 402 of file net.cpp.

void ThreadMessageHandler ( )

Definition at line 1538 of file net.cpp.

void ThreadOpenAddedConnections ( )

Definition at line 1399 of file net.cpp.

void ThreadOpenConnections ( )

Definition at line 1289 of file net.cpp.

void ThreadSocketHandler ( )

Definition at line 751 of file net.cpp.

Variable Documentation

CAddrMan addrman

Definition at line 53 of file net.cpp.

CCriticalSection cs_mapRelay

Definition at line 60 of file net.cpp.

CCriticalSection cs_setservAddNodeAddresses

Definition at line 67 of file net.cpp.

CCriticalSection cs_vAddedNodes

Definition at line 70 of file net.cpp.

CCriticalSection cs_vNodes

Definition at line 57 of file net.cpp.

CCriticalSection cs_vOneShots

Definition at line 64 of file net.cpp.

bool fDiscover = true

Definition at line 43 of file net.cpp.

class CNetCleanup instance_of_cnetcleanup
limitedmap<CInv, int64> mapAlreadyAskedFor(MAX_INV_SZ)
map<CInv, CDataStream> mapRelay

Definition at line 58 of file net.cpp.

uint64 nLocalHostNonce = 0

Definition at line 51 of file net.cpp.

uint64 nLocalServices = NODE_NETWORK

Definition at line 44 of file net.cpp.

int nMaxConnections = 125

Definition at line 54 of file net.cpp.

unsigned int pnSeed[]
Initial value:
=
{
0xc49c0ed8, 0x1df9d243, 0xd9b75a40, 0xdc525e46, 0x72c321b1, 0x4eedeeb2, 0x18271787, 0xce725232,
0x892aafc0, 0x979f6751, 0x2210f618, 0xfb529ed8, 0x66a74b3e, 0xef5d132e, 0x3b7a116c, 0x2fe45f55,
0x1df9d243, 0xe41f7c70, 0x8f4cd262, 0xb5c29d62, 0x80f1f3a2, 0x47dc614d, 0x6f458b4e, 0x908caa56,
0x553ef762, 0x5aec0852, 0x629a4f54, 0x6a10e13c, 0x4f41c547, 0x4476fd59, 0xcaedbc5a, 0x9f806dc1,
0x1df9d243, 0xe41f7c70, 0x8f4cd262, 0xb5c29d62, 0x80f1f3a2, 0x47dc614d, 0x6f458b4e, 0x908caa56,
0x553ef762, 0x5aec0852, 0x629a4f54, 0x6a10e13c, 0x4f41c547, 0x4476fd59, 0xcaedbc5a, 0x9f806dc1
}

Definition at line 1250 of file net.cpp.

set<CNetAddr> setservAddNodeAddresses

Definition at line 66 of file net.cpp.

vector<std::string> vAddedNodes

Definition at line 69 of file net.cpp.

vector<CNode*> vNodes

Definition at line 56 of file net.cpp.

deque<pair<int64, CInv> > vRelayExpiration

Definition at line 59 of file net.cpp.