diff --git a/Profiling.cpp b/Profiling.cpp new file mode 100644 index 00000000..269ad773 --- /dev/null +++ b/Profiling.cpp @@ -0,0 +1,19 @@ +#include +#include +#include "Profiling.h" + +namespace i2p +{ +namespace data +{ + RouterProfile::RouterProfile (const IdentHash& identHash): + m_IdentHash (identHash), m_NumTunnelsAgreed (0), m_NumTunnelsDeclined (0) + { + } + + std::shared_ptr GetProfile (const IdentHash& identHash) + { + return std::make_shared (identHash); + } +} +} \ No newline at end of file diff --git a/Profiling.h b/Profiling.h new file mode 100644 index 00000000..c20934a7 --- /dev/null +++ b/Profiling.h @@ -0,0 +1,29 @@ +#ifndef PROFILING_H__ +#define PROFILING_H__ + +#include +#include "Identity.h" + +namespace i2p +{ +namespace data +{ + class RouterProfile + { + public: + + RouterProfile (const IdentHash& identHash); + + private: + + IdentHash m_IdentHash; + // participation + uint32_t m_NumTunnelsAgreed; + uint32_t m_NumTunnelsDeclined; + }; + + std::shared_ptr GetProfile (const IdentHash& identHash); +} +} + +#endif diff --git a/RouterInfo.h b/RouterInfo.h index fb9a6f13..53ddb5ab 100644 --- a/RouterInfo.h +++ b/RouterInfo.h @@ -8,6 +8,7 @@ #include #include #include "Identity.h" +#include "Profiling.h" namespace i2p { @@ -170,6 +171,7 @@ namespace data std::map m_Properties; bool m_IsUpdated, m_IsUnreachable; uint8_t m_SupportedTransports, m_Caps; + std::shared_ptr m_Profile; }; } } diff --git a/Win32/i2pd.vcxproj b/Win32/i2pd.vcxproj index e34ead3d..4fc942ef 100644 --- a/Win32/i2pd.vcxproj +++ b/Win32/i2pd.vcxproj @@ -38,6 +38,7 @@ + @@ -82,6 +83,7 @@ + @@ -284,4 +286,4 @@ - \ No newline at end of file + diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 15eac7d9..1a660f81 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -22,6 +22,7 @@ set (COMMON_SRC "${CMAKE_SOURCE_DIR}/Log.cpp" "${CMAKE_SOURCE_DIR}/NTCPSession.cpp" "${CMAKE_SOURCE_DIR}/NetDb.cpp" + "${CMAKE_SOURCE_DIR}/Profiling.cpp" "${CMAKE_SOURCE_DIR}/Reseed.cpp" "${CMAKE_SOURCE_DIR}/RouterContext.cpp" "${CMAKE_SOURCE_DIR}/RouterInfo.cpp" diff --git a/build/autotools/Makefile.in b/build/autotools/Makefile.in index b28c620d..053ca6a9 100644 --- a/build/autotools/Makefile.in +++ b/build/autotools/Makefile.in @@ -116,7 +116,7 @@ am_i2p_OBJECTS = AddressBook.$(OBJEXT) CryptoConst.$(OBJEXT) \ aes.$(OBJEXT) base64.$(OBJEXT) i2p.$(OBJEXT) util.$(OBJEXT) \ SAM.$(OBJEXT) Destination.$(OBJEXT) ClientContext.$(OBJEXT) \ Datagram.$(OBJEXT) SSUSession.$(OBJEXT) BOB.$(OBJEXT) \ - I2PControl.$(OBJEXT) + I2PControl.$(OBJEXT) Profiling.$(OBJEXT) i2p_OBJECTS = $(am_i2p_OBJECTS) i2p_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) @@ -328,7 +328,7 @@ i2p_SOURCES = AddressBook.cpp CryptoConst.cpp Daemon.cpp \ TunnelGateway.cpp TunnelPool.cpp UPnP.cpp aes.cpp \ base64.cpp i2p.cpp util.cpp SAM.cpp Destination.cpp \ ClientContext.cpp DataFram.cpp SSUSession.cpp BOB.cpp \ - I2PControl.cpp \ + I2PControl.cpp Profiling.cpp \ \ AddressBook.h CryptoConst.h Daemon.h ElGamal.h \ Garlic.h HTTPProxy.h HTTPServer.h I2NPProtocol.h \ @@ -341,7 +341,7 @@ i2p_SOURCES = AddressBook.cpp CryptoConst.cpp Daemon.cpp \ TunnelPool.h UPnP.h aes.h base64.h config.h hmac.h \ util.h version.h Destination.h ClientContext.h \ TransportSession.h Datagram.h SSUSession.h BOB.h \ - I2PControl.h + I2PControl.h Profiling.h AM_LDFLAGS = @BOOST_DATE_TIME_LIB@ @BOOST_FILESYSTEM_LIB@ \ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_REGEX_LIB@ \ diff --git a/filelist.mk b/filelist.mk index a8a3557e..876734c6 100644 --- a/filelist.mk +++ b/filelist.mk @@ -1,6 +1,6 @@ COMMON_SRC = \ - CryptoConst.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp \ - LeaseSet.cpp Log.cpp NTCPSession.cpp NetDb.cpp Reseed.cpp RouterContext.cpp \ + CryptoConst.cpp Datagram.cpp Garlic.cpp I2NPProtocol.cpp LeaseSet.cpp \ + Log.cpp NTCPSession.cpp NetDb.cpp Profiling.cpp Reseed.cpp RouterContext.cpp \ RouterInfo.cpp SSU.cpp SSUSession.cpp SSUData.cpp Streaming.cpp Identity.cpp \ TransitTunnel.cpp Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp \ TunnelGateway.cpp Destination.cpp UPnP.cpp util.cpp aes.cpp base64.cpp