PRCYCoin  2.0.0.7rc1
P2P Digital Currency
net.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin developers
3 // Copyright (c) 2015-2018 The PIVX developers
4 // Copyright (c) 2018-2020 The DAPS Project developers
5 // Distributed under the MIT/X11 software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #ifndef BITCOIN_NET_H
9 #define BITCOIN_NET_H
10 
11 #include "bloom.h"
12 #include "compat.h"
13 #include "hash.h"
14 #include "fs.h"
15 #include "limitedmap.h"
16 #include "netaddress.h"
17 #include "protocol.h"
18 #include "random.h"
19 #include "streams.h"
20 #include "sync.h"
21 #include "uint256.h"
22 #include "utilstrencodings.h"
23 
24 #include <atomic>
25 #include <deque>
26 #include <stdint.h>
27 
28 #ifndef WIN32
29 #include <arpa/inet.h>
30 #endif
31 
32 #include <boost/signals2/signal.hpp>
33 
34 class CAddrMan;
35 class CBlockIndex;
36 class CScheduler;
37 class CNode;
38 
39 namespace boost
40 {
41 class thread_group;
42 } // namespace boost
43 
45 static const int PING_INTERVAL = 2 * 60;
47 static const int TIMEOUT_INTERVAL = 20 * 60;
49 static const int FEELER_INTERVAL = 120;
51 static const unsigned int MAX_INV_SZ = 50000;
53 static const unsigned int MAX_LOCATOR_SZ = 101;
55 static const unsigned int MAX_ADDR_TO_SEND = 1000;
57 static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 2 * 1024 * 1024;
59 static const unsigned int MAX_SUBVERSION_LENGTH = 256;
61 static const bool DEFAULT_LISTEN = true;
63 #ifdef USE_UPNP
64 static const bool DEFAULT_UPNP = USE_UPNP;
65 #else
66 static const bool DEFAULT_UPNP = false;
67 #endif
68 
69 static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
71 static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
72 
73 static const ServiceFlags REQUIRED_SERVICES = NODE_NETWORK;
74 
75 unsigned int ReceiveFloodSize();
76 unsigned int SendBufferSize();
77 
78 void AddOneShot(std::string strDest);
79 void AddressCurrentlyConnected(const CService& addr);
80 CNode* FindNode(const CNetAddr& ip);
81 CNode* FindNode(const CSubNet& subNet);
82 CNode* FindNode(const std::string& addrName);
83 CNode* FindNode(const CService& ip);
84 bool OpenNetworkConnection(const CAddress& addrConnect, bool fCountFailure, CSemaphoreGrant* grantOutbound = NULL, const char* strDest = NULL, bool fOneShot = false, bool fFeeler = false);
85 void MapPort(bool fUseUPnP);
86 unsigned short GetListenPort();
87 bool BindListenPort(const CService& bindAddr, std::string& strError, bool fWhitelisted = false);
88 void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler);
89 bool StopNode();
90 void SocketSendData(CNode* pnode);
91 
92 typedef int64_t NodeId;
93 
94 struct CombinerAll {
95  typedef bool result_type;
96 
97  template <typename I>
98  bool operator()(I first, I last) const
99  {
100  while (first != last) {
101  if (!(*first)) return false;
102  ++first;
103  }
104  return true;
105  }
106 };
107 
108 // Signals for message handling
110 {
111  boost::signals2::signal<int ()> GetHeight;
112  boost::signals2::signal<bool (CNode*), CombinerAll> ProcessMessages;
113  boost::signals2::signal<bool (CNode*), CombinerAll> SendMessages;
114  boost::signals2::signal<void (NodeId, const CNode*)> InitializeNode;
115  boost::signals2::signal<void (NodeId)> FinalizeNode;
116 };
117 
118 
120 
121 
122 enum {
123  LOCAL_NONE, // unknown
124  LOCAL_IF, // address a local interface listens on
125  LOCAL_BIND, // address explicit bound to
126  LOCAL_UPNP, // address reported by UPnP
127  LOCAL_MANUAL, // address explicitly specified (-externalip=)
128 
130 };
131 
132 bool IsPeerAddrLocalGood(CNode* pnode);
133 void AdvertiseLocal(CNode* pnode);
134 void SetLimited(enum Network net, bool fLimited = true);
135 bool IsLimited(enum Network net);
136 bool IsLimited(const CNetAddr& addr);
137 bool AddLocal(const CService& addr, int nScore = LOCAL_NONE);
138 bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE);
139 bool RemoveLocal(const CService& addr);
140 bool SeenLocal(const CService& addr);
141 bool IsLocal(const CService& addr);
142 bool GetLocal(CService& addr, const CNetAddr* paddrPeer = NULL);
143 bool IsReachable(enum Network net);
144 bool IsReachable(const CNetAddr& addr);
145 CAddress GetLocalAddress(const CNetAddr* paddrPeer = NULL);
146 bool validateMasternodeIP(const std::string& addrStr); // valid, reachable and routable address
147 
148 
149 extern bool fDiscover;
150 extern bool fListen;
152 extern uint64_t nLocalHostNonce;
153 extern CAddrMan addrman;
154 extern int nMaxConnections;
155 
156 extern std::vector<CNode*> vNodes;
158 extern std::map<CInv, CDataStream> mapRelay;
159 extern std::deque<std::pair<int64_t, CInv> > vRelayExpiration;
162 
163 extern std::vector<std::string> vAddedNodes;
165 
166 extern NodeId nLastNodeId;
168 
170 extern std::string strSubVersion;
171 
173  int nScore;
174  int nPort;
175 };
176 
178 extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
179 
181 {
182 public:
185  int64_t nLastSend;
186  int64_t nLastRecv;
187  int64_t nTimeConnected;
188  int64_t nTimeOffset;
189  std::string addrName;
190  int nVersion;
191  std::string cleanSubVer;
192  bool fInbound;
194  uint64_t nSendBytes;
195  uint64_t nRecvBytes;
197  double dPingTime;
198  double dPingWait;
199  std::string addrLocal;
201 };
202 
203 
205 {
206 public:
207  bool in_data; // parsing header (false) or data (true)
208 
209  CDataStream hdrbuf; // partially received header
210  CMessageHeader hdr; // complete header
211  unsigned int nHdrPos;
212 
213  CDataStream vRecv; // received message data
214  unsigned int nDataPos;
215 
216  int64_t nTime; // time (in microseconds) of message receipt.
217 
218  CNetMessage(int nTypeIn, int nVersionIn) : hdrbuf(nTypeIn, nVersionIn), vRecv(nTypeIn, nVersionIn)
219  {
220  hdrbuf.resize(24);
221  in_data = false;
222  nHdrPos = 0;
223  nDataPos = 0;
224  nTime = 0;
225  }
226 
227  bool complete() const
228  {
229  if (!in_data)
230  return false;
231  return (hdr.nMessageSize == nDataPos);
232  }
233 
234  void SetVersion(int nVersionIn)
235  {
236  hdrbuf.SetVersion(nVersionIn);
237  vRecv.SetVersion(nVersionIn);
238  }
239 
240  int readHeader(const char* pch, unsigned int nBytes);
241  int readData(const char* pch, unsigned int nBytes);
242 };
243 
244 typedef enum BanReason
245 {
249 } BanReason;
250 
252 {
253 public:
254  static const int CURRENT_VERSION=1;
255  int nVersion;
256  int64_t nCreateTime;
257  int64_t nBanUntil;
258  uint8_t banReason;
259 
261  {
262  SetNull();
263  }
264 
265  CBanEntry(int64_t nCreateTimeIn)
266  {
267  SetNull();
268  nCreateTime = nCreateTimeIn;
269  }
270 
272  template <typename Stream, typename Operation>
273  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
274  READWRITE(this->nVersion);
275  nVersion = this->nVersion;
276  READWRITE(nCreateTime);
279  }
280 
281  void SetNull()
282  {
284  nCreateTime = 0;
285  nBanUntil = 0;
287  }
288 
289  std::string banReasonToString()
290  {
291  switch (banReason) {
293  return "node misbehaving";
295  return "manually added";
296  default:
297  return "unknown";
298  }
299  }
300 };
301 
302 typedef std::map<CSubNet, CBanEntry> banmap_t;
303 
304 
306 class CNode
307 {
308 public:
309  // socket
314  size_t nSendSize; // total size of all vSendMsg entries
315  size_t nSendOffset; // offset inside the first vSendMsg already sent
316  uint64_t nSendBytes;
317  std::deque<CSerializeData> vSendMsg;
319 
321 
322  std::deque<CInv> vRecvGetData;
323  std::deque<CNetMessage> vRecvMsg;
325  uint64_t nRecvBytes;
327 
328  int64_t nLastSend;
329  int64_t nLastRecv;
330  int64_t nTimeConnected;
331  int64_t nTimeOffset;
333  std::string addrName;
335  int nVersion;
336  // strSubVer is whatever byte array we read from the wire. However, this field is intended
337  // to be printed out, displayed to humans in various forms and so on. So we sanitize it and
338  // store the sanitized version in cleanSubVer. The original should be used when dealing with
339  // the network or wire types and the cleaned string used when displayed or logged.
340  std::string strSubVer, cleanSubVer;
341  bool fWhitelisted; // This peer can bypass DoS banning.
342  bool fFeeler; // If true this node is being used as a short lived feeler.
343  bool fOneShot;
344  bool fClient;
345  bool fInbound;
348  std::atomic_bool fDisconnect;
349  // We use fRelayTxes for two purposes -
350  // a) it allows us to not relay tx invs before receiving the peer's version message
351  // b) the peer may tell us in their version message that we should not relay tx invs
352  // until they have initialized their bloom filter.
359 
360 protected:
361  // Denial-of-service detection/prevention
362  // Key is IP address, value is banned-until-time
365  static bool setBannedIsDirty;
366 
367  std::vector<std::string> vecRequestsFulfilled; //keep track of what client has asked for
368 
369  // Whitelisted ranges. Any node connecting from these is automatically
370  // whitelisted (as well as those connecting to whitelisted binds).
371  static std::vector<CSubNet> vWhitelistedRange;
373 
374  // Basic fuzz-testing
375  void Fuzz(int nChance); // modifies ssSend
376 
377 public:
380 
381  // flood relay
382  std::vector<CAddress> vAddrToSend;
384  bool fGetAddr;
385  std::set<uint256> setKnown;
386  int64_t nNextAddrSend;
388 
389  // inventory based relay
391  std::vector<CInv> vInventoryToSend;
393  std::multimap<int64_t, CInv> mapAskFor;
394  std::vector<uint256> vBlockRequested;
395  int64_t nNextInvSend;
396 
397  // Ping time measurement:
398  // The pong reply we're expecting, or 0 if no pong expected.
399  uint64_t nPingNonceSent;
400  // Time (in usec) the last ping was sent, or 0 if no ping was ever sent.
401  int64_t nPingUsecStart;
402  // Last measured round-trip time.
403  int64_t nPingUsecTime;
404  // Best measured round-trip time.
406  // Whether a ping is requested.
408 
409  CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn = false);
410  ~CNode();
411 
412 private:
413  // Network usage totals
416  static uint64_t nTotalBytesRecv;
417  static uint64_t nTotalBytesSent;
418 
419  CNode(const CNode&);
420  void operator=(const CNode&);
421 
422 public:
423  NodeId GetId() const
424  {
425  return id;
426  }
427 
429  {
430  assert(nRefCount >= 0);
431  return nRefCount;
432  }
433 
434  // requires LOCK(cs_vRecvMsg)
435  unsigned int GetTotalRecvSize()
436  {
437  unsigned int total = 0;
438  for (const CNetMessage& msg : vRecvMsg)
439  total += msg.vRecv.size() + 24;
440  return total;
441  }
442 
443  // requires LOCK(cs_vRecvMsg)
444  bool ReceiveMsgBytes(const char* pch, unsigned int nBytes);
445 
446  // requires LOCK(cs_vRecvMsg)
447  void SetRecvVersion(int nVersionIn)
448  {
449  nRecvVersion = nVersionIn;
450  for (CNetMessage& msg : vRecvMsg)
451  msg.SetVersion(nVersionIn);
452  }
453 
455  {
456  nRefCount++;
457  return this;
458  }
459 
460  void Release()
461  {
462  nRefCount--;
463  }
464 
465 
467  {
469  }
470 
471  void PushAddress(const CAddress& _addr, FastRandomContext &insecure_rand)
472  {
473  // Known checking here is only to save space from duplicates.
474  // SendMessages will filter it again for knowns that were added
475  // after addresses were pushed.
476  if (_addr.IsValid() && !addrKnown.contains(_addr.GetKey())) {
477  if (vAddrToSend.size() >= MAX_ADDR_TO_SEND) {
478  vAddrToSend[insecure_rand.randrange(vAddrToSend.size())] = _addr;
479  } else {
480  vAddrToSend.push_back(_addr);
481  }
482  }
483  }
484 
485 
486  void AddInventoryKnown(const CInv& inv)
487  {
488  {
491  }
492  }
493 
494  void PushInventory(const CInv& inv)
495  {
496  {
498  if (inv.type == MSG_TX && filterInventoryKnown.contains(inv.hash))
499  return;
500  vInventoryToSend.push_back(inv);
501  }
502  }
503 
504  void AskFor(const CInv& inv, bool fImmediateRetry = false);
505 
506  // TODO: Document the postcondition of this function. Is cs_vSend locked?
507  void BeginMessage(const char* pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend);
508 
509  // TODO: Document the precondition of this function. Is cs_vSend locked?
511 
512  // TODO: Document the precondition of this function. Is cs_vSend locked?
514 
515  void PushVersion();
516 
517 
518  void PushMessage(const char* pszCommand)
519  {
520  try {
521  BeginMessage(pszCommand);
522  EndMessage();
523  } catch (...) {
524  AbortMessage();
525  throw;
526  }
527  }
528 
529  template <typename T1>
530  void PushMessage(const char* pszCommand, const T1& a1)
531  {
532  try {
533  BeginMessage(pszCommand);
534  ssSend << a1;
535  EndMessage();
536  } catch (...) {
537  AbortMessage();
538  throw;
539  }
540  }
541 
542  template <typename T1, typename T2>
543  void PushMessage(const char* pszCommand, const T1& a1, const T2& a2)
544  {
545  try {
546  BeginMessage(pszCommand);
547  ssSend << a1 << a2;
548  EndMessage();
549  } catch (...) {
550  AbortMessage();
551  throw;
552  }
553  }
554 
555  template <typename T1, typename T2, typename T3>
556  void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3)
557  {
558  try {
559  BeginMessage(pszCommand);
560  ssSend << a1 << a2 << a3;
561  EndMessage();
562  } catch (...) {
563  AbortMessage();
564  throw;
565  }
566  }
567 
568  template <typename T1, typename T2, typename T3, typename T4>
569  void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4)
570  {
571  try {
572  BeginMessage(pszCommand);
573  ssSend << a1 << a2 << a3 << a4;
574  EndMessage();
575  } catch (...) {
576  AbortMessage();
577  throw;
578  }
579  }
580 
581  template <typename T1, typename T2, typename T3, typename T4, typename T5>
582  void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5)
583  {
584  try {
585  BeginMessage(pszCommand);
586  ssSend << a1 << a2 << a3 << a4 << a5;
587  EndMessage();
588  } catch (...) {
589  AbortMessage();
590  throw;
591  }
592  }
593 
594  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
595  void PushMessage(const char* pszCommand, const T1& a1, const T2& a2, const T3& a3, const T4& a4, const T5& a5, const T6& a6)
596  {
597  try {
598  BeginMessage(pszCommand);
599  ssSend << a1 << a2 << a3 << a4 << a5 << a6;
600  EndMessage();
601  } catch (...) {
602  AbortMessage();
603  throw;
604  }
605  }
606 
607  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
608  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)
609  {
610  try {
611  BeginMessage(pszCommand);
612  ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7;
613  EndMessage();
614  } catch (...) {
615  AbortMessage();
616  throw;
617  }
618  }
619 
620  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
621  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)
622  {
623  try {
624  BeginMessage(pszCommand);
625  ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8;
626  EndMessage();
627  } catch (...) {
628  AbortMessage();
629  throw;
630  }
631  }
632 
633  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
634  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)
635  {
636  try {
637  BeginMessage(pszCommand);
638  ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9;
639  EndMessage();
640  } catch (...) {
641  AbortMessage();
642  throw;
643  }
644  }
645 
646  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
647  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, const T10& a10)
648  {
649  try {
650  BeginMessage(pszCommand);
651  ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10;
652  EndMessage();
653  } catch (...) {
654  AbortMessage();
655  throw;
656  }
657  }
658 
659  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
660  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, const T10& a10, const T11& a11)
661  {
662  try {
663  BeginMessage(pszCommand);
664  ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10 << a11;
665  EndMessage();
666  } catch (...) {
667  AbortMessage();
668  throw;
669  }
670  }
671 
672  template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
673  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, const T10& a10, const T11& a11, const T12& a12)
674  {
675  try {
676  BeginMessage(pszCommand);
677  ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10 << a11 << a12;
678  EndMessage();
679  } catch (...) {
680  AbortMessage();
681  throw;
682  }
683  }
684 
685  bool HasFulfilledRequest(std::string strRequest)
686  {
687  for (std::string& type : vecRequestsFulfilled) {
688  if (type == strRequest) return true;
689  }
690  return false;
691  }
692 
693  void ClearFulfilledRequest(std::string strRequest)
694  {
695  std::vector<std::string>::iterator it = vecRequestsFulfilled.begin();
696  while (it != vecRequestsFulfilled.end()) {
697  if ((*it) == strRequest) {
698  vecRequestsFulfilled.erase(it);
699  return;
700  }
701  ++it;
702  }
703  }
704 
705  void FulfilledRequest(std::string strRequest)
706  {
707  if (HasFulfilledRequest(strRequest)) return;
708  vecRequestsFulfilled.push_back(strRequest);
709  }
710 
711  bool IsSubscribed(unsigned int nChannel);
712  void Subscribe(unsigned int nChannel, unsigned int nHops = 0);
713  void CancelSubscribe(unsigned int nChannel);
714  void CloseSocketDisconnect();
715  bool DisconnectOldProtocol(int nVersionRequired, std::string strLastCommand = "");
716  bool DisconnectOldVersion(std::string strSubVer, int nHeight, std::string strLastCommand = "");
717 
718  // Denial-of-service detection/prevention
719  // The idea is to detect peers that are behaving
720  // badly and disconnect/ban them, but do it in a
721  // one-coding-mistake-won't-shatter-the-entire-network
722  // way.
723  // IMPORTANT: There should be nothing I can give a
724  // node that it will forward on that will make that
725  // node's peers drop it. If there is, an attacker
726  // can isolate a node and/or try to split the network.
727  // Dropping a node for sending stuff that is invalid
728  // now but might be valid in a later version is also
729  // dangerous, because it can cause a network split
730  // between nodes running old code and nodes running
731  // new code.
732  static void ClearBanned(); // needed for unit testing
733  static bool IsBanned(CNetAddr ip);
734  static bool IsBanned(CSubNet subnet);
735  static void Ban(const CNetAddr &ip, const BanReason &banReason, int64_t bantimeoffset = 0, bool sinceUnixEpoch = false);
736  static void Ban(const CSubNet &subNet, const BanReason &banReason, int64_t bantimeoffset = 0, bool sinceUnixEpoch = false);
737  static bool Unban(const CNetAddr &ip);
738  static bool Unban(const CSubNet &ip);
739  static void GetBanned(banmap_t &banmap);
740  static void SetBanned(const banmap_t &banmap);
742  static bool BannedSetIsDirty();
744  static void SetBannedSetDirty(bool dirty=true);
746  static void SweepBanned();
747  void copyStats(CNodeStats& stats);
748 
749  static bool IsWhitelistedRange(const CNetAddr& ip);
750  static void AddWhitelistedRange(const CSubNet& subnet);
751 
752  // Network stats
753  static void RecordBytesRecv(uint64_t bytes);
754  static void RecordBytesSent(uint64_t bytes);
755 
756  static uint64_t GetTotalBytesRecv();
757  static uint64_t GetTotalBytesSent();
758 };
759 
761 {
762 public:
763  static void callCleanup();
764 };
765 
766 class CTransaction;
767 void RelayTransaction(const CTransaction& tx);
768 void RelayTransaction(const CTransaction& tx, const CDataStream& ss);
769 void RelayTransactionLockReq(const CTransaction& tx, bool relayToAll = false);
770 void RelayInv(CInv& inv);
771 
773 class CAddrDB
774 {
775 private:
776  fs::path pathAddr;
777 
778 public:
779  CAddrDB();
780  bool Write(const CAddrMan& addr);
781  bool Read(CAddrMan& addr);
782  bool Read(CAddrMan& addr, CDataStream& ssPeers);
783 };
784 
786 class CBanDB
787 {
788 private:
789  fs::path pathBanlist;
790 public:
791  CBanDB();
792  bool Write(const banmap_t& banSet);
793  bool Read(banmap_t& banSet);
794 };
795 
797  std::string strAddedNode;
800  bool fInbound;
801 };
802 
803 std::vector<AddedNodeInfo> GetAddedNodeInfo();
804 
806 int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds);
807 
808 #endif // BITCOIN_NET_H
CNetMessage::readData
int readData(const char *pch, unsigned int nBytes)
Definition: net.cpp:745
CNode::HasFulfilledRequest
bool HasFulfilledRequest(std::string strRequest)
Definition: net.h:685
CNode::addrLocal
CService addrLocal
Definition: net.h:334
CNodeStats::addrName
std::string addrName
Definition: net.h:189
NodeId
int64_t NodeId
Definition: net.h:92
CService
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:133
CBanEntry::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: net.h:271
CNode::filterInventoryKnown
CRollingBloomFilter filterInventoryKnown
Definition: net.h:390
BanReason
BanReason
Definition: net.h:244
CBanDB::Read
bool Read(banmap_t &banSet)
Definition: net.cpp:2447
CNetMessage::nDataPos
unsigned int nDataPos
Definition: net.h:214
CExplicitNetCleanup
Definition: net.h:760
CNode::cs_filter
RecursiveMutex cs_filter
Definition: net.h:355
CScheduler
Definition: scheduler.h:37
FindNode
CNode * FindNode(const CNetAddr &ip)
Definition: net.cpp:301
CNodeStats::fInbound
bool fInbound
Definition: net.h:192
CNode::cs_inventory
RecursiveMutex cs_inventory
Definition: net.h:392
BanReasonManuallyAdded
@ BanReasonManuallyAdded
Definition: net.h:248
CNode::fWhitelisted
bool fWhitelisted
Definition: net.h:341
CInv::type
int type
Definition: protocol.h:383
CNode::nRecvVersion
int nRecvVersion
Definition: net.h:326
CNode::PushMessage
void PushMessage(const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4)
Definition: net.h:569
CNode::nSendOffset
size_t nSendOffset
Definition: net.h:315
LOCAL_IF
@ LOCAL_IF
Definition: net.h:124
CNode::GetRefCount
int GetRefCount()
Definition: net.h:428
CBanEntry::CURRENT_VERSION
static const int CURRENT_VERSION
Definition: net.h:254
CBanDB::pathBanlist
fs::path pathBanlist
Definition: net.h:789
vNodes
std::vector< CNode * > vNodes
Definition: net.cpp:85
CNodeStats::addrLocal
std::string addrLocal
Definition: net.h:199
CNode::nServices
ServiceFlags nServices
Definition: net.h:310
CRollingBloomFilter::insert
void insert(const std::vector< unsigned char > &vKey)
Definition: bloom.cpp:220
CNode::GetId
NodeId GetId() const
Definition: net.h:423
CombinerAll
Definition: net.h:94
nLastNodeId
NodeId nLastNodeId
Definition: net.cpp:98
CNode::PushMessage
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, const T10 &a10)
Definition: net.h:647
fs.h
CNode::vSendMsg
std::deque< CSerializeData > vSendMsg
Definition: net.h:317
CNodeStats::nodeid
NodeId nodeid
Definition: net.h:183
CAddrDB::CAddrDB
CAddrDB()
Definition: net.cpp:2144
CNode::SweepBanned
static void SweepBanned()
clean unused entires (if bantime has expired)
Definition: net.cpp:584
CNode::SetBannedSetDirty
static void SetBannedSetDirty(bool dirty=true)
set the "dirty" flag for the banlist
Definition: net.cpp:616
CNode::DisconnectOldProtocol
bool DisconnectOldProtocol(int nVersionRequired, std::string strLastCommand="")
Definition: net.cpp:430
CNodeStats::nVersion
int nVersion
Definition: net.h:190
streams.h
CBloomFilter
BloomFilter is a probabilistic filter which SPV clients provide so that we can filter the transaction...
Definition: bloom.h:43
CNode::addrKnown
CRollingBloomFilter addrKnown
Definition: net.h:383
CNode::vecRequestsFulfilled
std::vector< std::string > vecRequestsFulfilled
Definition: net.h:367
CNode::Release
void Release()
Definition: net.h:460
SendBufferSize
unsigned int SendBufferSize()
Definition: net.cpp:2243
CNode::PushMessage
void PushMessage(const char *pszCommand, const T1 &a1, const T2 &a2)
Definition: net.h:543
CNodeSignals::FinalizeNode
boost::signals2::signal< void(NodeId)> FinalizeNode
Definition: net.h:115
sync.h
EXCLUSIVE_LOCK_FUNCTION
#define EXCLUSIVE_LOCK_FUNCTION(...)
Definition: threadsafety.h:43
CNode::nTotalBytesRecv
static uint64_t nTotalBytesRecv
Definition: net.h:416
CNode::nPingUsecTime
int64_t nPingUsecTime
Definition: net.h:403
UNLOCK_FUNCTION
#define UNLOCK_FUNCTION(...)
Definition: threadsafety.h:47
CNetMessage::nTime
int64_t nTime
Definition: net.h:216
CNode::GetTotalBytesRecv
static uint64_t GetTotalBytesRecv()
Definition: net.cpp:2097
CNode::cs_vWhitelistedRange
static RecursiveMutex cs_vWhitelistedRange
Definition: net.h:372
ReceiveFloodSize
unsigned int ReceiveFloodSize()
Definition: net.cpp:2241
CNode::AddInventoryKnown
void AddInventoryKnown(const CInv &inv)
Definition: net.h:486
CNetAddr
IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96))
Definition: netaddress.h:30
CBanEntry::SetNull
void SetNull()
Definition: net.h:281
LocalServiceInfo::nPort
int nPort
Definition: net.h:174
uint256.h
CNode::setBannedIsDirty
static bool setBannedIsDirty
Definition: net.h:365
AddLocal
bool AddLocal(const CService &addr, int nScore=LOCAL_NONE)
Definition: net.cpp:208
CBanDB::Write
bool Write(const banmap_t &banSet)
Definition: net.cpp:2415
limitedmap
STL-like map container that only keeps the N elements with the highest value.
Definition: limitedmap.h:13
cs_vAddedNodes
RecursiveMutex cs_vAddedNodes
Definition: net.cpp:96
CNode::Fuzz
void Fuzz(int nChance)
Definition: net.cpp:2107
CNode
Information about a peer.
Definition: net.h:306
CNode::addr
CAddress addr
Definition: net.h:332
CBanEntry::CBanEntry
CBanEntry()
Definition: net.h:260
CBanEntry::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: net.h:273
CNode::PushInventory
void PushInventory(const CInv &inv)
Definition: net.h:494
cs_mapRelay
RecursiveMutex cs_mapRelay
Definition: net.cpp:89
CNode::fSuccessfullyConnected
bool fSuccessfullyConnected
Definition: net.h:347
CNode::BeginMessage
void BeginMessage(const char *pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend)
Definition: net.cpp:2351
CNode::nRefCount
int nRefCount
Definition: net.h:357
CNode::AbortMessage
void AbortMessage() UNLOCK_FUNCTION(cs_vSend)
Definition: net.cpp:2358
CNode::PushMessage
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)
Definition: net.h:634
CNode::vInventoryToSend
std::vector< CInv > vInventoryToSend
Definition: net.h:391
CNode::nNextLocalAddrSend
int64_t nNextLocalAddrSend
Definition: net.h:387
AnnotatedMixin< std::recursive_mutex >
CNode::copyStats
void copyStats(CNodeStats &stats)
Definition: net.cpp:641
CNode::nSendBytes
uint64_t nSendBytes
Definition: net.h:316
CNode::setKnown
std::set< uint256 > setKnown
Definition: net.h:385
OpenNetworkConnection
bool OpenNetworkConnection(const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant *grantOutbound=NULL, const char *strDest=NULL, bool fOneShot=false, bool fFeeler=false)
Definition: net.cpp:1670
ServiceFlags
ServiceFlags
nServices flags
Definition: protocol.h:296
CNode::hashContinue
uint256 hashContinue
Definition: net.h:378
CNode::CancelSubscribe
void CancelSubscribe(unsigned int nChannel)
CNode::cs_vSend
RecursiveMutex cs_vSend
Definition: net.h:318
CNode::nTimeOffset
int64_t nTimeOffset
Definition: net.h:331
CNode::Ban
static void Ban(const CNetAddr &ip, const BanReason &banReason, int64_t bantimeoffset=0, bool sinceUnixEpoch=false)
Definition: net.cpp:522
SOCKET
u_int SOCKET
Definition: compat.h:44
LOCAL_BIND
@ LOCAL_BIND
Definition: net.h:125
BindListenPort
bool BindListenPort(const CService &bindAddr, std::string &strError, bool fWhitelisted=false)
Definition: net.cpp:1757
NODE_NETWORK
@ NODE_NETWORK
Definition: protocol.h:302
CNodeStats::nLastRecv
int64_t nLastRecv
Definition: net.h:186
CInv
inv message data
Definition: protocol.h:358
limitedmap.h
CAddrDB::Write
bool Write(const CAddrMan &addr)
Definition: net.cpp:2148
CNode::operator=
void operator=(const CNode &)
Network
Network
Definition: netaddress.h:19
CNodeStats::addr
CAddress addr
Definition: net.h:200
MSG_TX
@ MSG_TX
Definition: protocol.h:388
CNode::PushMessage
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)
Definition: net.h:621
RelayInv
void RelayInv(CInv &inv)
Definition: net.cpp:2077
CNode::vBlockRequested
std::vector< uint256 > vBlockRequested
Definition: net.h:394
CNode::fDisconnect
std::atomic_bool fDisconnect
Definition: net.h:348
CNode::GetTotalRecvSize
unsigned int GetTotalRecvSize()
Definition: net.h:435
CNode::PushMessage
void PushMessage(const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6)
Definition: net.h:595
CNode::ssSend
CDataStream ssSend
Definition: net.h:313
GetLocal
bool GetLocal(CService &addr, const CNetAddr *paddrPeer=NULL)
Definition: net.cpp:119
CNode::cs_totalBytesRecv
static RecursiveMutex cs_totalBytesRecv
Definition: net.h:414
CRollingBloomFilter::contains
bool contains(const std::vector< unsigned char > &vKey) const
Definition: bloom.cpp:240
nLocalServices
ServiceFlags nLocalServices
Definition: net.cpp:73
CNode::PushVersion
void PushVersion()
Definition: net.cpp:461
CNode::PushMessage
void PushMessage(const char *pszCommand)
Definition: net.h:518
AddedNodeInfo::fConnected
bool fConnected
Definition: net.h:799
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:269
mapLocalHost
std::map< CNetAddr, LocalServiceInfo > mapLocalHost
Definition: net.cpp:75
CNetMessage::readHeader
int readHeader(const char *pch, unsigned int nBytes)
Definition: net.cpp:716
addrman
CAddrMan addrman
Definition: net.cpp:80
CNode::nVersion
int nVersion
Definition: net.h:335
CNode::fRelayTxes
bool fRelayTxes
Definition: net.h:353
BanReasonUnknown
@ BanReasonUnknown
Definition: net.h:246
CAddrDB
Access to the (IP) address database (peers.dat)
Definition: net.h:773
CNode::nTimeConnected
int64_t nTimeConnected
Definition: net.h:330
bloom.h
CNode::FulfilledRequest
void FulfilledRequest(std::string strRequest)
Definition: net.h:705
CNode::SetBanned
static void SetBanned(const banmap_t &banmap)
Definition: net.cpp:578
CSemaphoreGrant
RAII-style semaphore lock.
Definition: sync.h:248
CNode::nPingUsecStart
int64_t nPingUsecStart
Definition: net.h:401
protocol.h
CNode::fNetworkNode
bool fNetworkNode
Definition: net.h:346
CNode::pfilter
CBloomFilter * pfilter
Definition: net.h:356
CNodeStats::nTimeConnected
int64_t nTimeConnected
Definition: net.h:187
RemoveLocal
bool RemoveLocal(const CService &addr)
Definition: net.cpp:237
random.h
SeenLocal
bool SeenLocal(const CService &addr)
vote for a local address
Definition: net.cpp:262
CNode::GetBanned
static void GetBanned(banmap_t &banmap)
Definition: net.cpp:573
CNode::fInbound
bool fInbound
Definition: net.h:345
CNode::cs_totalBytesSent
static RecursiveMutex cs_totalBytesSent
Definition: net.h:415
AddOneShot
void AddOneShot(std::string strDest)
Definition: net.cpp:109
CNode::fFeeler
bool fFeeler
Definition: net.h:342
CNode::Unban
static bool Unban(const CNetAddr &ip)
Definition: net.cpp:556
CNode::vRecvGetData
std::deque< CInv > vRecvGetData
Definition: net.h:322
mapAlreadyAskedFor
limitedmap< CInv, int64_t > mapAlreadyAskedFor
CNode::PushMessage
void PushMessage(const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5)
Definition: net.h:582
IsLimited
bool IsLimited(enum Network net)
Definition: net.cpp:252
AddedNodeInfo::strAddedNode
std::string strAddedNode
Definition: net.h:797
CNodeStats::fWhitelisted
bool fWhitelisted
Definition: net.h:196
CNode::AddRef
CNode * AddRef()
Definition: net.h:454
CNetMessage::complete
bool complete() const
Definition: net.h:227
CNode::PushMessage
void PushMessage(const char *pszCommand, const T1 &a1)
Definition: net.h:530
CNode::RecordBytesRecv
static void RecordBytesRecv(uint64_t bytes)
Definition: net.cpp:2087
cs_vNodes
RecursiveMutex cs_vNodes
Definition: net.cpp:86
CNodeStats::dPingTime
double dPingTime
Definition: net.h:197
compat.h
CNode::fGetAddr
bool fGetAddr
Definition: net.h:384
PoissonNextSend
int64_t PoissonNextSend(int64_t nNow, int average_interval_seconds)
Return a timestamp in the future (in microseconds) for exponentially distributed events.
Definition: net.cpp:2503
CNode::IsSubscribed
bool IsSubscribed(unsigned int nChannel)
netaddress.h
AddedNodeInfo::fInbound
bool fInbound
Definition: net.h:800
GetAddedNodeInfo
std::vector< AddedNodeInfo > GetAddedNodeInfo()
Definition: net.cpp:1593
MapPort
void MapPort(bool fUseUPnP)
Definition: net.cpp:1360
AddedNodeInfo
Definition: net.h:796
LOCAL_UPNP
@ LOCAL_UPNP
Definition: net.h:126
CBanEntry::banReason
uint8_t banReason
Definition: net.h:258
CNode::DisconnectOldVersion
bool DisconnectOldVersion(std::string strSubVer, int nHeight, std::string strLastCommand="")
Definition: net.cpp:442
cs_nLastNodeId
RecursiveMutex cs_nLastNodeId
Definition: net.cpp:99
CNode::setBanned
static banmap_t setBanned
Definition: net.h:363
CBanEntry::nVersion
int nVersion
Definition: net.h:255
CNode::Subscribe
void Subscribe(unsigned int nChannel, unsigned int nHops=0)
CNetAddr::IsValid
bool IsValid() const
Definition: netaddress.cpp:188
CSubNet
Definition: netaddress.h:95
CNode::vRecvMsg
std::deque< CNetMessage > vRecvMsg
Definition: net.h:323
CBanEntry::nCreateTime
int64_t nCreateTime
Definition: net.h:256
CNodeStats::cleanSubVer
std::string cleanSubVer
Definition: net.h:191
CNode::AddWhitelistedRange
static void AddWhitelistedRange(const CSubNet &subnet)
Definition: net.cpp:633
mapRelay
std::map< CInv, CDataStream > mapRelay
Definition: net.cpp:87
CNode::RecordBytesSent
static void RecordBytesSent(uint64_t bytes)
Definition: net.cpp:2092
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
SetLimited
void SetLimited(enum Network net, bool fLimited=true)
Make a particular network entirely off-limits (no automatic connects to it)
Definition: net.cpp:245
nLocalHostNonce
uint64_t nLocalHostNonce
Definition: net.cpp:78
banmap_t
std::map< CSubNet, CBanEntry > banmap_t
Definition: net.h:302
CNode::EndMessage
void EndMessage() UNLOCK_FUNCTION(cs_vSend)
Definition: net.cpp:2366
CNode::AskFor
void AskFor(const CInv &inv, bool fImmediateRetry=false)
Definition: net.cpp:2316
cs_mapLocalHost
RecursiveMutex cs_mapLocalHost
Definition: net.cpp:74
CBanDB
Access to the banlist database (banlist.dat)
Definition: net.h:786
RelayTransaction
void RelayTransaction(const CTransaction &tx)
Definition: net.cpp:2028
CNode::PushAddress
void PushAddress(const CAddress &_addr, FastRandomContext &insecure_rand)
Definition: net.h:471
CNode::grantOutbound
CSemaphoreGrant grantOutbound
Definition: net.h:354
CNodeSignals::SendMessages
boost::signals2::signal< bool(CNode *), CombinerAll > SendMessages
Definition: net.h:113
IsReachable
bool IsReachable(enum Network net)
check whether a given network is one we can probably connect to
Definition: net.cpp:280
CDataStream::SetVersion
void SetVersion(int n)
Definition: streams.h:212
CNodeStats::nLastSend
int64_t nLastSend
Definition: net.h:185
CNodeStats::nTimeOffset
int64_t nTimeOffset
Definition: net.h:188
CNode::ClearBanned
static void ClearBanned()
Definition: net.cpp:484
CNode::SetRecvVersion
void SetRecvVersion(int nVersionIn)
Definition: net.h:447
CNetMessage::CNetMessage
CNetMessage(int nTypeIn, int nVersionIn)
Definition: net.h:218
CNode::ReceiveMsgBytes
bool ReceiveMsgBytes(const char *pch, unsigned int nBytes)
Definition: net.cpp:680
fListen
bool fListen
Definition: net.cpp:72
CNode::nRecvBytes
uint64_t nRecvBytes
Definition: net.h:325
CNode::IsWhitelistedRange
static bool IsWhitelistedRange(const CNetAddr &ip)
Definition: net.cpp:624
AddedNodeInfo::resolvedAddress
CService resolvedAddress
Definition: net.h:798
fDiscover
bool fDiscover
Definition: net.cpp:71
CNode::nServicesExpected
ServiceFlags nServicesExpected
Definition: net.h:311
CNodeStats::dPingWait
double dPingWait
Definition: net.h:198
CAddrMan
Stochastical (IP) address manager.
Definition: addrman.h:182
CNetMessage::in_data
bool in_data
Definition: net.h:207
CBanDB::CBanDB
CBanDB()
Definition: net.cpp:2411
CNode::cs_sendProcessing
RecursiveMutex cs_sendProcessing
Definition: net.h:320
LOCAL_MANUAL
@ LOCAL_MANUAL
Definition: net.h:127
LocalServiceInfo::nScore
int nScore
Definition: net.h:173
CNodeStats::nSendBytes
uint64_t nSendBytes
Definition: net.h:194
CAddress
A CService with information about it as peer.
Definition: protocol.h:323
READWRITE
#define READWRITE(obj)
Definition: serialize.h:164
CMessageHeader
Message header.
Definition: protocol.h:29
CInv::hash
uint256 hash
Definition: protocol.h:384
LocalServiceInfo
Definition: net.h:172
CNode::GetTotalBytesSent
static uint64_t GetTotalBytesSent()
Definition: net.cpp:2102
BanReasonNodeMisbehaving
@ BanReasonNodeMisbehaving
Definition: net.h:247
CBanEntry::banReasonToString
std::string banReasonToString()
Definition: net.h:289
CNode::fPingQueued
bool fPingQueued
Definition: net.h:407
LOCK
#define LOCK(cs)
Definition: sync.h:182
CNetMessage::SetVersion
void SetVersion(int nVersionIn)
Definition: net.h:234
CNode::hSocket
SOCKET hSocket
Definition: net.h:312
LOCAL_NONE
@ LOCAL_NONE
Definition: net.h:123
CNodeSignals::ProcessMessages
boost::signals2::signal< bool(CNode *), CombinerAll > ProcessMessages
Definition: net.h:112
CNode::CNode
CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn="", bool fInboundIn=false)
Definition: net.cpp:2245
CNode::CloseSocketDisconnect
void CloseSocketDisconnect()
Definition: net.cpp:417
GetLocalAddress
CAddress GetLocalAddress(const CNetAddr *paddrPeer=NULL)
Definition: net.cpp:164
CNode::nNextInvSend
int64_t nNextInvSend
Definition: net.h:395
AdvertiseLocal
void AdvertiseLocal(CNode *pnode)
Definition: net.cpp:188
CNode::cs_setBanned
static RecursiveMutex cs_setBanned
Definition: net.h:364
CNetMessage
Definition: net.h:204
nMaxConnections
int nMaxConnections
Definition: net.cpp:81
validateMasternodeIP
bool validateMasternodeIP(const std::string &addrStr)
Definition: net.cpp:2493
CBanEntry
Definition: net.h:251
CDataStream::resize
void resize(size_type n, value_type c=0)
Definition: streams.h:122
CNetMessage::vRecv
CDataStream vRecv
Definition: net.h:213
CNode::nPingNonceSent
uint64_t nPingNonceSent
Definition: net.h:399
CBanEntry::nBanUntil
int64_t nBanUntil
Definition: net.h:257
CNetMessage::hdrbuf
CDataStream hdrbuf
Definition: net.h:209
CNode::PushMessage
void PushMessage(const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3)
Definition: net.h:556
CombinerAll::result_type
bool result_type
Definition: net.h:95
CNode::nTotalBytesSent
static uint64_t nTotalBytesSent
Definition: net.h:417
CNode::addrName
std::string addrName
Definition: net.h:333
CAddrDB::Read
bool Read(CAddrMan &addr)
Definition: net.cpp:2180
CNode::fOneShot
bool fOneShot
Definition: net.h:343
hash.h
CDataStream
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:34
CNode::nMinPingUsecTime
int64_t nMinPingUsecTime
Definition: net.h:405
CMessageHeader::nMessageSize
unsigned int nMessageSize
Definition: protocol.h:62
CNode::nNextAddrSend
int64_t nNextAddrSend
Definition: net.h:386
USE_UPNP
#define USE_UPNP
Definition: prcycoin-config.h:370
CNode::nLastSend
int64_t nLastSend
Definition: net.h:328
CNode::id
NodeId id
Definition: net.h:358
CNetMessage::nHdrPos
unsigned int nHdrPos
Definition: net.h:211
CNode::cs_vRecvMsg
RecursiveMutex cs_vRecvMsg
Definition: net.h:324
CombinerAll::operator()
bool operator()(I first, I last) const
Definition: net.h:98
utilstrencodings.h
vAddedNodes
std::vector< std::string > vAddedNodes
Definition: net.cpp:95
CNodeStats::nRecvBytes
uint64_t nRecvBytes
Definition: net.h:195
StartNode
void StartNode(boost::thread_group &threadGroup, CScheduler &scheduler)
Definition: net.cpp:1891
CNode::nLastRecv
int64_t nLastRecv
Definition: net.h:329
CNodeSignals
Definition: net.h:109
CNode::mapAskFor
std::multimap< int64_t, CInv > mapAskFor
Definition: net.h:393
CNode::IsBanned
static bool IsBanned(CNetAddr ip)
Definition: net.cpp:494
RelayTransactionLockReq
void RelayTransactionLockReq(const CTransaction &tx, bool relayToAll=false)
Definition: net.cpp:2063
CNodeSignals::InitializeNode
boost::signals2::signal< void(NodeId, const CNode *)> InitializeNode
Definition: net.h:114
CBanEntry::CBanEntry
CBanEntry(int64_t nCreateTimeIn)
Definition: net.h:265
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:162
CNode::fClient
bool fClient
Definition: net.h:344
CNode::nSendSize
size_t nSendSize
Definition: net.h:314
CNodeStats::nStartingHeight
int nStartingHeight
Definition: net.h:193
CNode::ClearFulfilledRequest
void ClearFulfilledRequest(std::string strRequest)
Definition: net.h:693
CNode::nStartingHeight
int nStartingHeight
Definition: net.h:379
CNode::PushMessage
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, const T10 &a10, const T11 &a11)
Definition: net.h:660
CNode::strSubVer
std::string strSubVer
Definition: net.h:340
StopNode
bool StopNode()
Definition: net.cpp:1972
SocketSendData
void SocketSendData(CNode *pnode)
Definition: net.cpp:762
IsLocal
bool IsLocal(const CService &addr)
check whether a given address is potentially local
Definition: net.cpp:274
CAddrDB::pathAddr
fs::path pathAddr
Definition: net.h:776
CRollingBloomFilter
RollingBloomFilter is a probabilistic "keep track of most recently inserted" set.
Definition: bloom.h:116
CNodeStats::nServices
ServiceFlags nServices
Definition: net.h:184
CNodeSignals::GetHeight
boost::signals2::signal< int()> GetHeight
Definition: net.h:111
CNodeStats
Definition: net.h:180
CExplicitNetCleanup::callCleanup
static void callCleanup()
Definition: net.cpp:2021
strSubVersion
std::string strSubVersion
Subversion as sent to the P2P network in version messages.
Definition: net.cpp:83
CNetMessage::hdr
CMessageHeader hdr
Definition: net.h:210
AddressCurrentlyConnected
void AddressCurrentlyConnected(const CService &addr)
Definition: net.cpp:291
GetListenPort
unsigned short GetListenPort()
Definition: net.cpp:114
FastRandomContext::randrange
uint64_t randrange(uint64_t range)
Generate a random integer in the range [0..range).
Definition: random.h:111
vRelayExpiration
std::deque< std::pair< int64_t, CInv > > vRelayExpiration
Definition: net.cpp:88
CNode::PushMessage
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)
Definition: net.h:608
LOCAL_MAX
@ LOCAL_MAX
Definition: net.h:129
FastRandomContext
Fast randomness source.
Definition: random.h:44
CNode::~CNode
~CNode()
Definition: net.cpp:2307
CNode::PushMessage
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, const T10 &a10, const T11 &a11, const T12 &a12)
Definition: net.h:673
CNode::vAddrToSend
std::vector< CAddress > vAddrToSend
Definition: net.h:382
CNode::vWhitelistedRange
static std::vector< CSubNet > vWhitelistedRange
Definition: net.h:371
CNode::cleanSubVer
std::string cleanSubVer
Definition: net.h:340
CNode::AddAddressKnown
void AddAddressKnown(const CAddress &addr)
Definition: net.h:466
CService::GetKey
std::vector< unsigned char > GetKey() const
Definition: netaddress.cpp:544
IsPeerAddrLocalGood
bool IsPeerAddrLocalGood(CNode *pnode)
Definition: net.cpp:182
CNode::BannedSetIsDirty
static bool BannedSetIsDirty()
check is the banlist has unwritten changes
Definition: net.cpp:611
GetNodeSignals
CNodeSignals & GetNodeSignals()
Definition: net.cpp:107