diff options
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -30,12 +30,13 @@ extern int nBestHeight; inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 10*1000); } inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 10*1000); } +void AddOneShot(std::string strDest); bool RecvLine(SOCKET hSocket, std::string& strLine); bool GetMyExternalIP(CNetAddr& ipRet); void AddressCurrentlyConnected(const CService& addr); CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const CService& ip); -CNode* ConnectNode(CAddress addrConnect, int64 nTimeout=0); +CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL, int64 nTimeout=0); void MapPort(bool fMapPort); bool BindListenPort(std::string& strError=REF(std::string())); void StartNode(void* parg); @@ -43,6 +44,24 @@ bool StopNode(); enum { + LOCAL_NONE, + LOCAL_IF, + LOCAL_UPNP, + LOCAL_IRC, + LOCAL_HTTP, + LOCAL_MANUAL, + + LOCAL_MAX +}; + +bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE); +bool SeenLocal(const CNetAddr& addr); +bool IsLocal(const CNetAddr& addr); +bool GetLocal(CNetAddr &addr, const CNetAddr *paddrPeer = NULL); +CAddress GetLocalAddress(const CNetAddr *paddrPeer = NULL); + +enum +{ MSG_TX = 1, MSG_BLOCK, }; @@ -83,9 +102,7 @@ enum threadId }; extern bool fClient; -extern bool fAllowDNS; extern uint64 nLocalServices; -extern CAddress addrLocalHost; extern uint64 nLocalHostNonce; extern boost::array<int, THREAD_MAX> vnThreadsRunning; extern CAddrMan addrman; @@ -120,8 +137,11 @@ public: int nHeaderStart; unsigned int nMessageStart; CAddress addr; + std::string addrName; + CNetAddr addrLocal; int nVersion; std::string strSubVer; + bool fOneShot; bool fClient; bool fInbound; bool fNetworkNode; @@ -157,7 +177,7 @@ public: CCriticalSection cs_inventory; std::multimap<int64, CInv> mapAskFor; - CNode(SOCKET hSocketIn, CAddress addrIn, bool fInboundIn=false) : vSend(SER_NETWORK, MIN_PROTO_VERSION), vRecv(SER_NETWORK, MIN_PROTO_VERSION) + CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false) : vSend(SER_NETWORK, MIN_PROTO_VERSION), vRecv(SER_NETWORK, MIN_PROTO_VERSION) { nServices = 0; hSocket = hSocketIn; @@ -168,8 +188,10 @@ public: nHeaderStart = -1; nMessageStart = -1; addr = addrIn; + addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; nVersion = 0; strSubVer = ""; + fOneShot = false; fClient = false; // set by version message fInbound = fInboundIn; fNetworkNode = false; |