From fcc559b76856adb733fe8a3273eec939081532d5 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Thu, 4 Feb 2016 14:58:56 +0000 Subject: [PATCH] Show Kad ID in the Kademlia status window --- .svn-revision | 2 +- docs/Changelog | 1 + src/ECSpecialCoreTags.cpp | 4 +++ src/Makefile.am | 6 ++--- src/Makefile.in | 46 +++++++++++++++++----------------- src/ServerWnd.cpp | 3 +++ src/amule-remote-gui.cpp | 1 + src/amule-remote-gui.h | 5 +++- src/amule.cpp | 5 ++++ src/amule.h | 8 +++++- src/kademlia/kademlia/Kademlia.cpp | 2 ++ src/kademlia/kademlia/Kademlia.h | 4 +++ src/libs/ec/abstracts/ECCodes.abstract | 1 + src/libs/ec/cpp/ECCodes.h | 2 ++ src/libs/ec/cpp/ECSpecialTags.h | 1 + src/libs/ec/java/ECCodes.java | 1 + 16 files changed, 63 insertions(+), 29 deletions(-) diff --git a/.svn-revision b/.svn-revision index 0778817e..71d820ef 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10902 +10903 diff --git a/docs/Changelog b/docs/Changelog index 1b53b405..1dedb12b 100644 --- a/docs/Changelog +++ b/docs/Changelog @@ -25,6 +25,7 @@ Version 2.4.0 - The river knows. the locale has been set * Fix Crypto++ detection routine happily using build library for host when cross-compiling + * Fix bug #1711: Kad Info tab should display my own user ID iz0bbz: * Fix WinSock library version detection with MinGW-w64 diff --git a/src/ECSpecialCoreTags.cpp b/src/ECSpecialCoreTags.cpp index fc378ef1..e7bc3d4b 100644 --- a/src/ECSpecialCoreTags.cpp +++ b/src/ECSpecialCoreTags.cpp @@ -148,6 +148,10 @@ CEC_ConnState_Tag::CEC_ConnState_Tag(EC_DETAIL_LEVEL detail_level) : CECTag(EC_T } AddTag(CECTag(EC_TAG_CLIENT_ID, theApp->GetID())); + + if (Kademlia::CKademlia::IsRunning()) { + AddTag(CECTag(EC_TAG_KAD_ID, Kademlia::CKademlia::GetKadID())); + } } CEC_PartFile_Tag::CEC_PartFile_Tag(const CPartFile *file, EC_DETAIL_LEVEL detail_level, CValueMap *valuemap) diff --git a/src/Makefile.am b/src/Makefile.am index ad907998..934fa4ea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -86,7 +86,8 @@ libmuleappcommon_a_SOURCES = \ SHA.cpp \ Tag.cpp \ TerminationProcess.cpp \ - Timer.cpp + Timer.cpp \ + kademlia/utils/UInt128.cpp libmuleappcommon_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS) @@ -112,8 +113,7 @@ libmuleappcore_a_SOURCES = \ kademlia/kademlia/Entry.cpp \ kademlia/kademlia/Indexed.cpp \ kademlia/kademlia/SearchManager.cpp \ - kademlia/routing/RoutingBin.cpp \ - kademlia/utils/UInt128.cpp + kademlia/routing/RoutingBin.cpp libmuleappcore_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS) diff --git a/src/Makefile.in b/src/Makefile.in index 51da1b57..72ba823a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -111,7 +111,8 @@ am_libmuleappcommon_a_OBJECTS = libmuleappcommon_a-CFile.$(OBJEXT) \ libmuleappcommon_a-SHA.$(OBJEXT) \ libmuleappcommon_a-Tag.$(OBJEXT) \ libmuleappcommon_a-TerminationProcess.$(OBJEXT) \ - libmuleappcommon_a-Timer.$(OBJEXT) + libmuleappcommon_a-Timer.$(OBJEXT) \ + libmuleappcommon_a-UInt128.$(OBJEXT) libmuleappcommon_a_OBJECTS = $(am_libmuleappcommon_a_OBJECTS) libmuleappcore_a_AR = $(AR) $(ARFLAGS) libmuleappcore_a_LIBADD = @@ -133,8 +134,7 @@ am_libmuleappcore_a_OBJECTS = libmuleappcore_a-AsyncDNS.$(OBJEXT) \ libmuleappcore_a-Entry.$(OBJEXT) \ libmuleappcore_a-Indexed.$(OBJEXT) \ libmuleappcore_a-SearchManager.$(OBJEXT) \ - libmuleappcore_a-RoutingBin.$(OBJEXT) \ - libmuleappcore_a-UInt128.$(OBJEXT) + libmuleappcore_a-RoutingBin.$(OBJEXT) libmuleappcore_a_OBJECTS = $(am_libmuleappcore_a_OBJECTS) libmuleappgui_a_AR = $(AR) $(ARFLAGS) libmuleappgui_a_LIBADD = @@ -661,7 +661,8 @@ libmuleappcommon_a_SOURCES = \ SHA.cpp \ Tag.cpp \ TerminationProcess.cpp \ - Timer.cpp + Timer.cpp \ + kademlia/utils/UInt128.cpp libmuleappcommon_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS) @@ -685,8 +686,7 @@ libmuleappcore_a_SOURCES = \ kademlia/kademlia/Entry.cpp \ kademlia/kademlia/Indexed.cpp \ kademlia/kademlia/SearchManager.cpp \ - kademlia/routing/RoutingBin.cpp \ - kademlia/utils/UInt128.cpp + kademlia/routing/RoutingBin.cpp libmuleappcore_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS) @@ -1351,6 +1351,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcommon_a-Tag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcommon_a-TerminationProcess.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcommon_a-Timer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcommon_a-UInt128.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-AsyncDNS.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-CanceledFileList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-DeadSourceList.Po@am__quote@ @@ -1369,7 +1370,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-StateMachine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-TerminationProcessAmuleweb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-ThreadScheduler.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-UInt128.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappcore_a-UPnPBase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappgui_a-BarShader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmuleappgui_a-ColorFrameCtrl.Po@am__quote@ @@ -1674,6 +1674,22 @@ libmuleappcommon_a-Timer.obj: Timer.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmuleappcommon_a-Timer.obj `if test -f 'Timer.cpp'; then $(CYGPATH_W) 'Timer.cpp'; else $(CYGPATH_W) '$(srcdir)/Timer.cpp'; fi` +libmuleappcommon_a-UInt128.o: kademlia/utils/UInt128.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmuleappcommon_a-UInt128.o -MD -MP -MF $(DEPDIR)/libmuleappcommon_a-UInt128.Tpo -c -o libmuleappcommon_a-UInt128.o `test -f 'kademlia/utils/UInt128.cpp' || echo '$(srcdir)/'`kademlia/utils/UInt128.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmuleappcommon_a-UInt128.Tpo $(DEPDIR)/libmuleappcommon_a-UInt128.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='kademlia/utils/UInt128.cpp' object='libmuleappcommon_a-UInt128.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmuleappcommon_a-UInt128.o `test -f 'kademlia/utils/UInt128.cpp' || echo '$(srcdir)/'`kademlia/utils/UInt128.cpp + +libmuleappcommon_a-UInt128.obj: kademlia/utils/UInt128.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmuleappcommon_a-UInt128.obj -MD -MP -MF $(DEPDIR)/libmuleappcommon_a-UInt128.Tpo -c -o libmuleappcommon_a-UInt128.obj `if test -f 'kademlia/utils/UInt128.cpp'; then $(CYGPATH_W) 'kademlia/utils/UInt128.cpp'; else $(CYGPATH_W) '$(srcdir)/kademlia/utils/UInt128.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmuleappcommon_a-UInt128.Tpo $(DEPDIR)/libmuleappcommon_a-UInt128.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='kademlia/utils/UInt128.cpp' object='libmuleappcommon_a-UInt128.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmuleappcommon_a-UInt128.obj `if test -f 'kademlia/utils/UInt128.cpp'; then $(CYGPATH_W) 'kademlia/utils/UInt128.cpp'; else $(CYGPATH_W) '$(srcdir)/kademlia/utils/UInt128.cpp'; fi` + libmuleappcore_a-AsyncDNS.o: AsyncDNS.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcore_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmuleappcore_a-AsyncDNS.o -MD -MP -MF $(DEPDIR)/libmuleappcore_a-AsyncDNS.Tpo -c -o libmuleappcore_a-AsyncDNS.o `test -f 'AsyncDNS.cpp' || echo '$(srcdir)/'`AsyncDNS.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmuleappcore_a-AsyncDNS.Tpo $(DEPDIR)/libmuleappcore_a-AsyncDNS.Po @@ -1978,22 +1994,6 @@ libmuleappcore_a-RoutingBin.obj: kademlia/routing/RoutingBin.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcore_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmuleappcore_a-RoutingBin.obj `if test -f 'kademlia/routing/RoutingBin.cpp'; then $(CYGPATH_W) 'kademlia/routing/RoutingBin.cpp'; else $(CYGPATH_W) '$(srcdir)/kademlia/routing/RoutingBin.cpp'; fi` -libmuleappcore_a-UInt128.o: kademlia/utils/UInt128.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcore_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmuleappcore_a-UInt128.o -MD -MP -MF $(DEPDIR)/libmuleappcore_a-UInt128.Tpo -c -o libmuleappcore_a-UInt128.o `test -f 'kademlia/utils/UInt128.cpp' || echo '$(srcdir)/'`kademlia/utils/UInt128.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmuleappcore_a-UInt128.Tpo $(DEPDIR)/libmuleappcore_a-UInt128.Po -@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='kademlia/utils/UInt128.cpp' object='libmuleappcore_a-UInt128.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcore_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmuleappcore_a-UInt128.o `test -f 'kademlia/utils/UInt128.cpp' || echo '$(srcdir)/'`kademlia/utils/UInt128.cpp - -libmuleappcore_a-UInt128.obj: kademlia/utils/UInt128.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcore_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmuleappcore_a-UInt128.obj -MD -MP -MF $(DEPDIR)/libmuleappcore_a-UInt128.Tpo -c -o libmuleappcore_a-UInt128.obj `if test -f 'kademlia/utils/UInt128.cpp'; then $(CYGPATH_W) 'kademlia/utils/UInt128.cpp'; else $(CYGPATH_W) '$(srcdir)/kademlia/utils/UInt128.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmuleappcore_a-UInt128.Tpo $(DEPDIR)/libmuleappcore_a-UInt128.Po -@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='kademlia/utils/UInt128.cpp' object='libmuleappcore_a-UInt128.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappcore_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libmuleappcore_a-UInt128.obj `if test -f 'kademlia/utils/UInt128.cpp'; then $(CYGPATH_W) 'kademlia/utils/UInt128.cpp'; else $(CYGPATH_W) '$(srcdir)/kademlia/utils/UInt128.cpp'; fi` - libmuleappgui_a-BarShader.o: BarShader.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmuleappgui_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libmuleappgui_a-BarShader.o -MD -MP -MF $(DEPDIR)/libmuleappgui_a-BarShader.Tpo -c -o libmuleappgui_a-BarShader.o `test -f 'BarShader.cpp' || echo '$(srcdir)/'`BarShader.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmuleappgui_a-BarShader.Tpo $(DEPDIR)/libmuleappgui_a-BarShader.Po diff --git a/src/ServerWnd.cpp b/src/ServerWnd.cpp index d9e4a98e..1ee24e75 100644 --- a/src/ServerWnd.cpp +++ b/src/ServerWnd.cpp @@ -34,6 +34,7 @@ #include "amuleDlg.h" // Needed for CamuleDlg #include "amule.h" // Needed for theApp #include "Logger.h" +#include "kademlia/utils/UInt128.h" #include "ClientList.h" @@ -206,6 +207,8 @@ void CServerWnd::UpdateKadInfo() KadInfoList->SetItem(next_row++, 1, (theApp->IsKadRunningInLanMode() ? _("Running in LAN mode") : _("Running"))); // Connection data + KadInfoList->InsertItem(next_row, _("Kademlia client ID:")); + KadInfoList->SetItem(next_row++, 1, theApp->GetKadID().ToHexString()); KadInfoList->InsertItem(next_row, _("Status:")); KadInfoList->SetItem(next_row++, 1, theApp->IsConnectedKad() ? _("Connected"): _("Disconnected")); if (theApp->IsConnectedKad()) { diff --git a/src/amule-remote-gui.cpp b/src/amule-remote-gui.cpp index f8c174ac..1af561aa 100644 --- a/src/amule-remote-gui.cpp +++ b/src/amule-remote-gui.cpp @@ -758,6 +758,7 @@ void CServerConnectRem::HandlePacket(const CECPacket *packet) CServer *server; m_ID = tag->GetEd2kId(); theApp->m_clientID = tag->GetClientId(); + tag->GetKadID(theApp->m_kadID); if (tag->IsConnectedED2K()) { const CECTag *srvtag = tag->GetTagByName(EC_TAG_SERVER); diff --git a/src/amule-remote-gui.h b/src/amule-remote-gui.h index 3f0786ad..26bc1e3a 100644 --- a/src/amule-remote-gui.h +++ b/src/amule-remote-gui.h @@ -34,7 +34,7 @@ #include "Statistics.h" #include "RLE.h" #include "SearchList.h" // Needed for CSearchFile - +#include "kademlia/utils/UInt128.h" // Needed for CUInt128 class CED2KFileLink; class CServer; @@ -711,6 +711,7 @@ public: uint32 GetKadIndexedKeywords() const{ return theStats::GetKadIndexedKeywords(); } uint32 GetKadIndexedNotes() const { return theStats::GetKadIndexedNotes(); } uint32 GetKadIndexedLoad() const { return theStats::GetKadIndexedLoad(); } + const CUInt128& GetKadID() const { return m_kadID; } // True IP of machine uint32 GetKadIPAdress() const { return theStats::GetKadIPAdress(); } // Buddy status @@ -741,6 +742,8 @@ public: // This KnownFile collects all currently uploading clients for display in the upload list control CKnownFile * m_allUploadingKnownFile; + CUInt128 m_kadID; + DECLARE_EVENT_TABLE() }; diff --git a/src/amule.cpp b/src/amule.cpp index 30c3ab41..397bc742 100644 --- a/src/amule.cpp +++ b/src/amule.cpp @@ -1749,6 +1749,11 @@ uint32 CamuleApp::GetBuddyPort() const return clientlist->GetBuddyPort(); } +const Kademlia::CUInt128& CamuleApp::GetKadID() const +{ + return Kademlia::CKademlia::GetKadID(); +} + bool CamuleApp::CanDoCallback(uint32 clientServerIP, uint16 clientServerPort) { if (Kademlia::CKademlia::IsConnected()) { diff --git a/src/amule.h b/src/amule.h index d56eaeb2..c12841e5 100644 --- a/src/amule.h +++ b/src/amule.h @@ -95,10 +95,14 @@ namespace MuleNotify { class CMuleGUIEvent; } - using MuleNotify::CMuleGUIEvent; +namespace Kademlia { + class CUInt128; +} + + #ifdef AMULE_DAEMON #define AMULE_APP_BASE wxAppConsole #define CORE_TIMER_PERIOD 300 @@ -228,6 +232,8 @@ public: uint8 GetBuddyStatus() const; uint32 GetBuddyIP() const; uint32 GetBuddyPort() const; + // Kad ID + const Kademlia::CUInt128& GetKadID() const; // Check if we should callback this client bool CanDoCallback(uint32 clientServerIP, uint16 clientServerPort); diff --git a/src/kademlia/kademlia/Kademlia.cpp b/src/kademlia/kademlia/Kademlia.cpp index f08d735d..050cbc8a 100644 --- a/src/kademlia/kademlia/Kademlia.cpp +++ b/src/kademlia/kademlia/Kademlia.cpp @@ -54,6 +54,8 @@ there client on the eMule forum.. #pragma warning(disable:4996) #endif +const CUInt128 Kademlia::s_nullUInt128(false); + //////////////////////////////////////// using namespace Kademlia; //////////////////////////////////////// diff --git a/src/kademlia/kademlia/Kademlia.h b/src/kademlia/kademlia/Kademlia.h index 035fd3a7..5f64a200 100644 --- a/src/kademlia/kademlia/Kademlia.h +++ b/src/kademlia/kademlia/Kademlia.h @@ -59,6 +59,8 @@ class CKadClientSearcher; typedef std::map EventMap; +extern const CUInt128 s_nullUInt128; + class CKademlia { public: @@ -84,6 +86,8 @@ public: static uint32_t GetTotalFile() throw() { return instance && instance->m_prefs ? instance->m_prefs->GetTotalFile() : 0; } static bool GetPublish() throw() { return instance && instance->m_prefs ? instance->m_prefs->GetPublish() : false; } static uint32_t GetIPAddress() throw() { return instance && instance->m_prefs ? instance->m_prefs->GetIPAddress() : 0; } + static const CUInt128& GetKadID() throw() { return instance && instance->m_prefs ? instance->m_prefs->GetKadID() : s_nullUInt128; } + static void Bootstrap(uint32_t ip, uint16_t port) { time_t now = time(NULL); diff --git a/src/libs/ec/abstracts/ECCodes.abstract b/src/libs/ec/abstracts/ECCodes.abstract index 3f07f7b2..37a498d5 100644 --- a/src/libs/ec/abstracts/ECCodes.abstract +++ b/src/libs/ec/abstracts/ECCodes.abstract @@ -171,6 +171,7 @@ EC_TAG_CAN_ZLIB 0x000C EC_TAG_CAN_UTF8_NUMBERS 0x000D EC_TAG_CAN_NOTIFY 0x000E EC_TAG_ECID 0x000F +EC_TAG_KAD_ID 0x0010 EC_TAG_CLIENT_NAME 0x0100 diff --git a/src/libs/ec/cpp/ECCodes.h b/src/libs/ec/cpp/ECCodes.h index 7b44ba5c..9de696c1 100644 --- a/src/libs/ec/cpp/ECCodes.h +++ b/src/libs/ec/cpp/ECCodes.h @@ -141,6 +141,7 @@ enum ECTagNames { EC_TAG_CAN_UTF8_NUMBERS = 0x000D, EC_TAG_CAN_NOTIFY = 0x000E, EC_TAG_ECID = 0x000F, + EC_TAG_KAD_ID = 0x0010, EC_TAG_CLIENT_NAME = 0x0100, EC_TAG_CLIENT_VERSION = 0x0101, EC_TAG_CLIENT_MOD = 0x0102, @@ -577,6 +578,7 @@ wxString GetDebugNameECTagNames(uint16 arg) case 0x000D: return wxT("EC_TAG_CAN_UTF8_NUMBERS"); case 0x000E: return wxT("EC_TAG_CAN_NOTIFY"); case 0x000F: return wxT("EC_TAG_ECID"); + case 0x0010: return wxT("EC_TAG_KAD_ID"); case 0x0100: return wxT("EC_TAG_CLIENT_NAME"); case 0x0101: return wxT("EC_TAG_CLIENT_VERSION"); case 0x0102: return wxT("EC_TAG_CLIENT_MOD"); diff --git a/src/libs/ec/cpp/ECSpecialTags.h b/src/libs/ec/cpp/ECSpecialTags.h index 8413bb65..e07cf3b8 100644 --- a/src/libs/ec/cpp/ECSpecialTags.h +++ b/src/libs/ec/cpp/ECSpecialTags.h @@ -208,6 +208,7 @@ class CEC_ConnState_Tag : public CECTag { bool IsConnectedKademlia() const { return (GetInt() & 0x04) != 0; } bool IsKadFirewalled() const { return (GetInt() & 0x08) != 0; } bool IsKadRunning() const { return (GetInt() & 0x10) != 0; } + bool GetKadID(CUInt128& target) const { return AssignIfExist(EC_TAG_KAD_ID, target); } }; class CEC_SharedFile_Tag : public CECTag { diff --git a/src/libs/ec/java/ECCodes.java b/src/libs/ec/java/ECCodes.java index 7851959a..ccf41e54 100644 --- a/src/libs/ec/java/ECCodes.java +++ b/src/libs/ec/java/ECCodes.java @@ -129,6 +129,7 @@ public final static short EC_TAG_CAN_ZLIB = 0x000C; public final static short EC_TAG_CAN_UTF8_NUMBERS = 0x000D; public final static short EC_TAG_CAN_NOTIFY = 0x000E; public final static short EC_TAG_ECID = 0x000F; +public final static short EC_TAG_KAD_ID = 0x0010; public final static short EC_TAG_CLIENT_NAME = 0x0100; public final static short EC_TAG_CLIENT_VERSION = 0x0101; public final static short EC_TAG_CLIENT_MOD = 0x0102; -- 2.11.4.GIT