aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2012-05-08 19:43:17 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-05-08 19:43:17 -0400
commit203f9e6c0010893df20fb64c77dc0ac42e396947 (patch)
treea082793b4b3b221b918a7ee2ed229a5526515d71 /src/net.h
parent82ab06b84955f1e4b80b52eea8c089bb67d3de24 (diff)
parent19b6958cfd5c5207ffe8259ef48ebbd24ca89725 (diff)
Merge branch 'tmp-ipv6' into merge-ipv6
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/net.h b/src/net.h
index bad49a9f8f..a00dd1b8cc 100644
--- a/src/net.h
+++ b/src/net.h
@@ -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;