├── .gitignore ├── CMakeLists.txt ├── CTestCustom.cmake ├── LICENSE ├── README.md ├── cmake ├── test-static-assert.c └── test-static-assert.cpp ├── external ├── CMakeLists.txt ├── google │ ├── dense_hash_map │ ├── dense_hash_set │ ├── sparse_hash_map │ ├── sparse_hash_set │ ├── sparsehash │ │ ├── densehashtable.h │ │ ├── hashtable-common.h │ │ ├── libc_allocator_with_realloc.h │ │ ├── os_config.h │ │ ├── sparseconfig.h │ │ ├── sparseconfig_win.h │ │ └── sparsehashtable.h │ ├── sparsetable │ └── type_traits.h ├── gtest │ ├── CHANGES │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── Makefile.am │ ├── README │ ├── aclocal.m4 │ ├── build-aux │ │ ├── config.guess │ │ ├── config.h.in │ │ ├── config.sub │ │ ├── depcomp │ │ ├── install-sh │ │ ├── ltmain.sh │ │ └── missing │ ├── cmake │ │ └── internal_utils.cmake │ ├── codegear │ │ ├── gtest.cbproj │ │ ├── gtest.groupproj │ │ ├── gtest_all.cc │ │ ├── gtest_link.cc │ │ ├── gtest_main.cbproj │ │ └── gtest_unittest.cbproj │ ├── configure │ ├── configure.ac │ ├── fused-src │ │ └── gtest │ │ │ ├── gtest-all.cc │ │ │ ├── gtest.h │ │ │ └── gtest_main.cc │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── m4 │ │ ├── acx_pthread.m4 │ │ ├── gtest.m4 │ │ ├── libtool.m4 │ │ ├── ltoptions.m4 │ │ ├── ltsugar.m4 │ │ ├── ltversion.m4 │ │ └── lt~obsolete.m4 │ ├── make │ │ └── Makefile │ ├── msvc │ │ ├── gtest-md.sln │ │ ├── gtest-md.vcproj │ │ ├── gtest.sln │ │ ├── gtest.vcproj │ │ ├── gtest_main-md.vcproj │ │ ├── gtest_main.vcproj │ │ ├── gtest_prod_test-md.vcproj │ │ ├── gtest_prod_test.vcproj │ │ ├── gtest_unittest-md.vcproj │ │ └── gtest_unittest.vcproj │ ├── samples │ │ ├── prime_tables.h │ │ ├── sample1.cc │ │ ├── sample1.h │ │ ├── sample10_unittest.cc │ │ ├── sample1_unittest.cc │ │ ├── sample2.cc │ │ ├── sample2.h │ │ ├── sample2_unittest.cc │ │ ├── sample3-inl.h │ │ ├── sample3_unittest.cc │ │ ├── sample4.cc │ │ ├── sample4.h │ │ ├── sample4_unittest.cc │ │ ├── sample5_unittest.cc │ │ ├── sample6_unittest.cc │ │ ├── sample7_unittest.cc │ │ ├── sample8_unittest.cc │ │ └── sample9_unittest.cc │ ├── scripts │ │ ├── fuse_gtest_files.py │ │ ├── gen_gtest_pred_impl.py │ │ ├── gtest-config.in │ │ ├── pump.py │ │ └── test │ │ │ └── Makefile │ ├── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ ├── test │ │ ├── gtest-death-test_ex_test.cc │ │ ├── gtest-death-test_test.cc │ │ ├── gtest-filepath_test.cc │ │ ├── gtest-linked_ptr_test.cc │ │ ├── gtest-listener_test.cc │ │ ├── gtest-message_test.cc │ │ ├── gtest-options_test.cc │ │ ├── gtest-param-test2_test.cc │ │ ├── gtest-param-test_test.cc │ │ ├── gtest-param-test_test.h │ │ ├── gtest-port_test.cc │ │ ├── gtest-printers_test.cc │ │ ├── gtest-test-part_test.cc │ │ ├── gtest-tuple_test.cc │ │ ├── gtest-typed-test2_test.cc │ │ ├── gtest-typed-test_test.cc │ │ ├── gtest-typed-test_test.h │ │ ├── gtest-unittest-api_test.cc │ │ ├── gtest_all_test.cc │ │ ├── gtest_break_on_failure_unittest.py │ │ ├── gtest_break_on_failure_unittest_.cc │ │ ├── gtest_catch_exceptions_test.py │ │ ├── gtest_catch_exceptions_test_.cc │ │ ├── gtest_color_test.py │ │ ├── gtest_color_test_.cc │ │ ├── gtest_env_var_test.py │ │ ├── gtest_env_var_test_.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_filter_unittest.py │ │ ├── gtest_filter_unittest_.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_list_tests_unittest.py │ │ ├── gtest_list_tests_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_output_test.py │ │ ├── gtest_output_test_.cc │ │ ├── gtest_output_test_golden_lin.txt │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_premature_exit_test.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_shuffle_test.py │ │ ├── gtest_shuffle_test_.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ ├── gtest_throw_on_failure_test.py │ │ ├── gtest_throw_on_failure_test_.cc │ │ ├── gtest_uninitialized_test.py │ │ ├── gtest_uninitialized_test_.cc │ │ ├── gtest_unittest.cc │ │ ├── gtest_xml_outfile1_test_.cc │ │ ├── gtest_xml_outfile2_test_.cc │ │ ├── gtest_xml_outfiles_test.py │ │ ├── gtest_xml_output_unittest.py │ │ ├── gtest_xml_output_unittest_.cc │ │ ├── gtest_xml_test_utils.py │ │ ├── production.cc │ │ └── production.h │ └── xcode │ │ ├── Config │ │ ├── DebugProject.xcconfig │ │ ├── FrameworkTarget.xcconfig │ │ ├── General.xcconfig │ │ ├── ReleaseProject.xcconfig │ │ ├── StaticLibraryTarget.xcconfig │ │ └── TestTarget.xcconfig │ │ ├── Resources │ │ └── Info.plist │ │ ├── Samples │ │ └── FrameworkSample │ │ │ ├── Info.plist │ │ │ ├── WidgetFramework.xcodeproj │ │ │ └── project.pbxproj │ │ │ ├── runtests.sh │ │ │ ├── widget.cc │ │ │ ├── widget.h │ │ │ └── widget_test.cc │ │ ├── Scripts │ │ ├── runtests.sh │ │ └── versiongenerate.py │ │ └── gtest.xcodeproj │ │ └── project.pbxproj └── miniupnpc │ ├── CMakeLists.txt │ ├── Changelog.txt │ ├── LICENSE │ ├── MANIFEST.in │ ├── Makefile.mingw │ ├── README │ ├── VERSION │ ├── apiversions.txt │ ├── bsdqueue.h │ ├── codelength.h │ ├── connecthostport.c │ ├── connecthostport.h │ ├── declspec.h │ ├── external-ip.sh │ ├── igd_desc_parse.c │ ├── igd_desc_parse.h │ ├── java │ ├── JavaBridgeTest.java │ ├── testjava.bat │ └── testjava.sh │ ├── man3 │ └── miniupnpc.3 │ ├── mingw32make.bat │ ├── minihttptestserver.c │ ├── minisoap.c │ ├── minisoap.h │ ├── minissdpc.c │ ├── minissdpc.h │ ├── miniupnpc.c │ ├── miniupnpc.def │ ├── miniupnpc.h │ ├── miniupnpcmodule.c │ ├── miniupnpcstrings.h.cmake │ ├── miniupnpcstrings.h.in │ ├── miniupnpctypes.h │ ├── miniwget.c │ ├── miniwget.h │ ├── minixml.c │ ├── minixml.h │ ├── minixmlvalid.c │ ├── msvc │ ├── miniupnpc.sln │ ├── miniupnpc.vcproj │ └── upnpc-static.vcproj │ ├── portlistingparse.c │ ├── portlistingparse.h │ ├── pymoduletest.py │ ├── receivedata.c │ ├── receivedata.h │ ├── setup.py │ ├── setupmingw32.py │ ├── testigddescparse.c │ ├── testminiwget.c │ ├── testminiwget.sh │ ├── testminixml.c │ ├── testreplyparse │ ├── DeletePortMapping.namevalue │ ├── DeletePortMapping.xml │ ├── GetExternalIPAddress.namevalue │ ├── GetExternalIPAddress.xml │ ├── GetSpecificPortMappingEntryReq.namevalue │ ├── GetSpecificPortMappingEntryReq.xml │ ├── GetSpecificPortMappingEntryResp.namevalue │ ├── GetSpecificPortMappingEntryResp.xml │ ├── SetDefaultConnectionService.namevalue │ ├── SetDefaultConnectionService.xml │ └── readme.txt │ ├── testupnpigd.py │ ├── testupnpreplyparse.c │ ├── testupnpreplyparse.sh │ ├── updateminiupnpcstrings.sh │ ├── upnpc.c │ ├── upnpcommands.c │ ├── upnpcommands.h │ ├── upnperrors.c │ ├── upnperrors.h │ ├── upnpreplyparse.c │ ├── upnpreplyparse.h │ └── wingenminiupnpcstrings.c ├── include ├── BlockchainExplorerData.h ├── CryptoNote.h ├── CryptoTypes.h ├── IBlockchainExplorer.h ├── INode.h ├── IObservable.h ├── IStreamSerializable.h ├── ITransaction.h ├── ITransfersContainer.h ├── ITransfersSynchronizer.h ├── IWallet.h └── IWalletLegacy.h ├── src ├── BlockchainExplorer │ ├── BlockchainExplorer.cpp │ ├── BlockchainExplorer.h │ ├── BlockchainExplorerDataBuilder.cpp │ ├── BlockchainExplorerDataBuilder.h │ ├── BlockchainExplorerErrors.cpp │ └── BlockchainExplorerErrors.h ├── CMakeLists.txt ├── Common │ ├── ArrayRef.h │ ├── ArrayView.h │ ├── Base58.cpp │ ├── Base58.h │ ├── BlockingQueue.cpp │ ├── BlockingQueue.h │ ├── CommandLine.cpp │ ├── CommandLine.h │ ├── ConsoleHandler.cpp │ ├── ConsoleHandler.h │ ├── ConsoleTools.cpp │ ├── ConsoleTools.h │ ├── FileMappedVector.cpp │ ├── FileMappedVector.h │ ├── IInputStream.cpp │ ├── IInputStream.h │ ├── IOutputStream.cpp │ ├── IOutputStream.h │ ├── JsonValue.cpp │ ├── JsonValue.h │ ├── Math.cpp │ ├── Math.h │ ├── MemoryInputStream.cpp │ ├── MemoryInputStream.h │ ├── ObserverManager.h │ ├── PathTools.cpp │ ├── PathTools.h │ ├── ScopeExit.cpp │ ├── ScopeExit.h │ ├── ShuffleGenerator.h │ ├── SignalHandler.cpp │ ├── SignalHandler.h │ ├── StdInputStream.cpp │ ├── StdInputStream.h │ ├── StdOutputStream.cpp │ ├── StdOutputStream.h │ ├── StreamTools.cpp │ ├── StreamTools.h │ ├── StringBuffer.h │ ├── StringInputStream.cpp │ ├── StringInputStream.h │ ├── StringOutputStream.cpp │ ├── StringOutputStream.h │ ├── StringTools.cpp │ ├── StringTools.h │ ├── StringView.cpp │ ├── StringView.h │ ├── Util.cpp │ ├── Util.h │ ├── Varint.h │ ├── VectorOutputStream.cpp │ ├── VectorOutputStream.h │ ├── int-util.h │ ├── pod-class.h │ └── static_assert.h ├── ConnectivityTool │ └── ConnectivityTool.cpp ├── CryptoNoteConfig.h ├── CryptoNoteCore │ ├── Account.cpp │ ├── Account.h │ ├── BlockIndex.cpp │ ├── BlockIndex.h │ ├── Blockchain.cpp │ ├── Blockchain.h │ ├── BlockchainIndices.cpp │ ├── BlockchainIndices.h │ ├── BlockchainMessages.cpp │ ├── BlockchainMessages.h │ ├── Checkpoints.cpp │ ├── Checkpoints.h │ ├── Core.cpp │ ├── Core.h │ ├── CoreConfig.cpp │ ├── CoreConfig.h │ ├── CryptoNoteBasic.cpp │ ├── CryptoNoteBasic.h │ ├── CryptoNoteBasicImpl.cpp │ ├── CryptoNoteBasicImpl.h │ ├── CryptoNoteFormatUtils.cpp │ ├── CryptoNoteFormatUtils.h │ ├── CryptoNoteSerialization.cpp │ ├── CryptoNoteSerialization.h │ ├── CryptoNoteStatInfo.h │ ├── CryptoNoteTools.cpp │ ├── CryptoNoteTools.h │ ├── Currency.cpp │ ├── Currency.h │ ├── Difficulty.cpp │ ├── Difficulty.h │ ├── IBlock.cpp │ ├── IBlock.h │ ├── IBlockchainStorageObserver.h │ ├── ICore.h │ ├── ICoreObserver.h │ ├── IMinerHandler.h │ ├── ITimeProvider.cpp │ ├── ITimeProvider.h │ ├── ITransactionValidator.h │ ├── ITxPoolObserver.h │ ├── IntrusiveLinkedList.h │ ├── MessageQueue.h │ ├── Miner.cpp │ ├── Miner.h │ ├── MinerConfig.cpp │ ├── MinerConfig.h │ ├── OnceInInterval.h │ ├── SwappedMap.cpp │ ├── SwappedMap.h │ ├── SwappedVector.cpp │ ├── SwappedVector.h │ ├── Transaction.cpp │ ├── TransactionApi.h │ ├── TransactionApiExtra.h │ ├── TransactionExtra.cpp │ ├── TransactionExtra.h │ ├── TransactionPool.cpp │ ├── TransactionPool.h │ ├── TransactionPrefixImpl.cpp │ ├── TransactionUtils.cpp │ ├── TransactionUtils.h │ ├── UpgradeDetector.cpp │ ├── UpgradeDetector.h │ └── VerificationContext.h ├── CryptoNoteProtocol │ ├── CryptoNoteProtocolDefinitions.h │ ├── CryptoNoteProtocolHandler.cpp │ ├── CryptoNoteProtocolHandler.h │ ├── CryptoNoteProtocolHandlerCommon.h │ ├── ICryptoNoteProtocolObserver.h │ └── ICryptoNoteProtocolQuery.h ├── Daemon │ ├── Daemon.cpp │ ├── DaemonCommandsHandler.cpp │ └── DaemonCommandsHandler.h ├── HTTP │ ├── HttpParser.cpp │ ├── HttpParser.h │ ├── HttpParserErrorCodes.cpp │ ├── HttpParserErrorCodes.h │ ├── HttpRequest.cpp │ ├── HttpRequest.h │ ├── HttpResponse.cpp │ └── HttpResponse.h ├── HashTester │ └── hashtester.cpp ├── InProcessNode │ ├── InProcessNode.cpp │ ├── InProcessNode.h │ ├── InProcessNodeErrors.cpp │ └── InProcessNodeErrors.h ├── JsonRpcServer │ ├── JsonRpcServer.cpp │ └── JsonRpcServer.h ├── Logging │ ├── CommonLogger.cpp │ ├── CommonLogger.h │ ├── ConsoleLogger.cpp │ ├── ConsoleLogger.h │ ├── FileLogger.cpp │ ├── FileLogger.h │ ├── ILogger.cpp │ ├── ILogger.h │ ├── LoggerGroup.cpp │ ├── LoggerGroup.h │ ├── LoggerManager.cpp │ ├── LoggerManager.h │ ├── LoggerMessage.cpp │ ├── LoggerMessage.h │ ├── LoggerRef.cpp │ ├── LoggerRef.h │ ├── StreamLogger.cpp │ └── StreamLogger.h ├── Miner │ ├── BlockchainMonitor.cpp │ ├── BlockchainMonitor.h │ ├── Miner.cpp │ ├── Miner.h │ ├── MinerEvent.h │ ├── MinerManager.cpp │ ├── MinerManager.h │ ├── MiningConfig.cpp │ ├── MiningConfig.h │ └── main.cpp ├── NodeRpcProxy │ ├── NodeErrors.cpp │ ├── NodeErrors.h │ ├── NodeRpcProxy.cpp │ └── NodeRpcProxy.h ├── P2p │ ├── ConnectionContext.h │ ├── IP2pNodeInternal.cpp │ ├── IP2pNodeInternal.h │ ├── LevinProtocol.cpp │ ├── LevinProtocol.h │ ├── NetNode.cpp │ ├── NetNode.h │ ├── NetNodeCommon.h │ ├── NetNodeConfig.cpp │ ├── NetNodeConfig.h │ ├── P2pConnectionProxy.cpp │ ├── P2pConnectionProxy.h │ ├── P2pContext.cpp │ ├── P2pContext.h │ ├── P2pContextOwner.cpp │ ├── P2pContextOwner.h │ ├── P2pInterfaces.cpp │ ├── P2pInterfaces.h │ ├── P2pNetworks.h │ ├── P2pNode.cpp │ ├── P2pNode.h │ ├── P2pNodeConfig.cpp │ ├── P2pNodeConfig.h │ ├── P2pProtocolDefinitions.h │ ├── P2pProtocolTypes.h │ ├── PeerListManager.cpp │ └── PeerListManager.h ├── PaymentGate │ ├── NodeFactory.cpp │ ├── NodeFactory.h │ ├── PaymentServiceJsonRpcMessages.cpp │ ├── PaymentServiceJsonRpcMessages.h │ ├── PaymentServiceJsonRpcServer.cpp │ ├── PaymentServiceJsonRpcServer.h │ ├── WalletService.cpp │ ├── WalletService.h │ ├── WalletServiceErrorCategory.cpp │ └── WalletServiceErrorCategory.h ├── PaymentGateService │ ├── ConfigurationManager.cpp │ ├── ConfigurationManager.h │ ├── PaymentGateService.cpp │ ├── PaymentGateService.h │ ├── PaymentServiceConfiguration.cpp │ ├── PaymentServiceConfiguration.h │ ├── RpcNodeConfiguration.cpp │ ├── RpcNodeConfiguration.h │ └── main.cpp ├── Platform │ ├── Linux │ │ └── System │ │ │ ├── Dispatcher.cpp │ │ │ ├── Dispatcher.h │ │ │ ├── ErrorMessage.cpp │ │ │ ├── ErrorMessage.h │ │ │ ├── Future.h │ │ │ ├── Ipv4Resolver.cpp │ │ │ ├── Ipv4Resolver.h │ │ │ ├── TcpConnection.cpp │ │ │ ├── TcpConnection.h │ │ │ ├── TcpConnector.cpp │ │ │ ├── TcpConnector.h │ │ │ ├── TcpListener.cpp │ │ │ ├── TcpListener.h │ │ │ ├── Timer.cpp │ │ │ └── Timer.h │ ├── OSX │ │ └── System │ │ │ ├── Context.c │ │ │ ├── Context.h │ │ │ ├── Dispatcher.cpp │ │ │ ├── Dispatcher.h │ │ │ ├── ErrorMessage.cpp │ │ │ ├── ErrorMessage.h │ │ │ ├── Future.h │ │ │ ├── Ipv4Resolver.cpp │ │ │ ├── Ipv4Resolver.h │ │ │ ├── TcpConnection.cpp │ │ │ ├── TcpConnection.h │ │ │ ├── TcpConnector.cpp │ │ │ ├── TcpConnector.h │ │ │ ├── TcpListener.cpp │ │ │ ├── TcpListener.h │ │ │ ├── Timer.cpp │ │ │ ├── Timer.h │ │ │ └── asm.s │ ├── Posix │ │ └── System │ │ │ ├── MemoryMappedFile.cpp │ │ │ └── MemoryMappedFile.h │ ├── Windows │ │ └── System │ │ │ ├── Dispatcher.cpp │ │ │ ├── Dispatcher.h │ │ │ ├── ErrorMessage.cpp │ │ │ ├── ErrorMessage.h │ │ │ ├── Future.h │ │ │ ├── Ipv4Resolver.cpp │ │ │ ├── Ipv4Resolver.h │ │ │ ├── MemoryMappedFile.cpp │ │ │ ├── MemoryMappedFile.h │ │ │ ├── TcpConnection.cpp │ │ │ ├── TcpConnection.h │ │ │ ├── TcpConnector.cpp │ │ │ ├── TcpConnector.h │ │ │ ├── TcpListener.cpp │ │ │ ├── TcpListener.h │ │ │ ├── Timer.cpp │ │ │ └── Timer.h │ ├── mingw │ │ └── alloca.h │ └── msc │ │ ├── alloca.h │ │ ├── stdbool.h │ │ └── sys │ │ └── param.h ├── Rpc │ ├── CoreRpcServerCommandsDefinitions.h │ ├── CoreRpcServerErrorCodes.h │ ├── HttpClient.cpp │ ├── HttpClient.h │ ├── HttpServer.cpp │ ├── HttpServer.h │ ├── JsonRpc.cpp │ ├── JsonRpc.h │ ├── RpcServer.cpp │ ├── RpcServer.h │ ├── RpcServerConfig.cpp │ └── RpcServerConfig.h ├── Serialization │ ├── BinaryInputStreamSerializer.cpp │ ├── BinaryInputStreamSerializer.h │ ├── BinaryOutputStreamSerializer.cpp │ ├── BinaryOutputStreamSerializer.h │ ├── BinarySerializationTools.h │ ├── ISerializer.h │ ├── IStream.h │ ├── JsonInputStreamSerializer.cpp │ ├── JsonInputStreamSerializer.h │ ├── JsonInputValueSerializer.cpp │ ├── JsonInputValueSerializer.h │ ├── JsonOutputStreamSerializer.cpp │ ├── JsonOutputStreamSerializer.h │ ├── KVBinaryCommon.h │ ├── KVBinaryInputStreamSerializer.cpp │ ├── KVBinaryInputStreamSerializer.h │ ├── KVBinaryOutputStreamSerializer.cpp │ ├── KVBinaryOutputStreamSerializer.h │ ├── MemoryStream.cpp │ ├── MemoryStream.h │ ├── SerializationOverloads.cpp │ ├── SerializationOverloads.h │ └── SerializationTools.h ├── SimpleWallet │ ├── PasswordContainer.cpp │ ├── PasswordContainer.h │ ├── SimpleWallet.cpp │ └── SimpleWallet.h ├── System │ ├── Context.h │ ├── ContextGroup.cpp │ ├── ContextGroup.h │ ├── ContextGroupTimeout.cpp │ ├── ContextGroupTimeout.h │ ├── Event.cpp │ ├── Event.h │ ├── EventLock.cpp │ ├── EventLock.h │ ├── InterruptedException.cpp │ ├── InterruptedException.h │ ├── Ipv4Address.cpp │ ├── Ipv4Address.h │ ├── OperationTimeout.h │ ├── RemoteContext.h │ ├── RemoteEventLock.cpp │ ├── RemoteEventLock.h │ ├── TcpStream.cpp │ └── TcpStream.h ├── Transfers │ ├── BlockchainSynchronizer.cpp │ ├── BlockchainSynchronizer.h │ ├── CommonTypes.h │ ├── IBlockchainSynchronizer.h │ ├── IObservableImpl.h │ ├── SynchronizationState.cpp │ ├── SynchronizationState.h │ ├── TransfersConsumer.cpp │ ├── TransfersConsumer.h │ ├── TransfersContainer.cpp │ ├── TransfersContainer.h │ ├── TransfersSubscription.cpp │ ├── TransfersSubscription.h │ ├── TransfersSynchronizer.cpp │ ├── TransfersSynchronizer.h │ └── TypeHelpers.h ├── Wallet │ ├── IFusionManager.h │ ├── LegacyKeysImporter.cpp │ ├── LegacyKeysImporter.h │ ├── WalletAsyncContextCounter.cpp │ ├── WalletAsyncContextCounter.h │ ├── WalletErrors.cpp │ ├── WalletErrors.h │ ├── WalletGreen.cpp │ ├── WalletGreen.h │ ├── WalletIndices.h │ ├── WalletRpcServer.cpp │ ├── WalletRpcServer.h │ ├── WalletRpcServerCommandsDefinitions.h │ ├── WalletRpcServerErrorCodes.h │ ├── WalletSerializationV1.cpp │ ├── WalletSerializationV1.h │ ├── WalletSerializationV2.cpp │ ├── WalletSerializationV2.h │ ├── WalletUtils.cpp │ └── WalletUtils.h ├── WalletLegacy │ ├── KeysStorage.cpp │ ├── KeysStorage.h │ ├── WalletHelper.cpp │ ├── WalletHelper.h │ ├── WalletLegacy.cpp │ ├── WalletLegacy.h │ ├── WalletLegacyEvent.h │ ├── WalletLegacySerialization.cpp │ ├── WalletLegacySerialization.h │ ├── WalletLegacySerializer.cpp │ ├── WalletLegacySerializer.h │ ├── WalletRequest.h │ ├── WalletSendTransactionContext.h │ ├── WalletTransactionSender.cpp │ ├── WalletTransactionSender.h │ ├── WalletUnconfirmedTransactions.cpp │ ├── WalletUnconfirmedTransactions.h │ ├── WalletUserTransactionsCache.cpp │ ├── WalletUserTransactionsCache.h │ └── WalletUtils.h ├── crypto │ ├── aesb.h │ ├── blake256.c │ ├── blake256.h │ ├── chacha8.c │ ├── chacha8.h │ ├── crypto-ops-data.c │ ├── crypto-ops.c │ ├── crypto-ops.h │ ├── crypto.cpp │ ├── crypto.h │ ├── generic-ops.h │ ├── groestl.c │ ├── groestl.h │ ├── groestl_tables.h │ ├── hash-extra-blake.c │ ├── hash-extra-groestl.c │ ├── hash-extra-jh.c │ ├── hash-extra-skein.c │ ├── hash-ops.h │ ├── hash.c │ ├── hash.h │ ├── initializer.h │ ├── jh.c │ ├── jh.h │ ├── keccak.c │ ├── keccak.h │ ├── oaes_config.h │ ├── oaes_lib.c │ ├── oaes_lib.h │ ├── random.c │ ├── random.h │ ├── skein.c │ ├── skein.h │ ├── skein_port.h │ ├── slow-hash.c │ ├── slow-hash.cpp │ ├── slow-hash.inl │ └── tree-hash.c ├── mnemonics │ ├── chinese_simplified.h │ ├── dutch.h │ ├── electrum-words.cpp │ ├── electrum-words.h │ ├── english.h │ ├── french.h │ ├── german.h │ ├── italian.h │ ├── japanese.h │ ├── language_base.h │ ├── polish.h │ ├── portuguese.h │ ├── russian.h │ ├── singleton.h │ ├── spanish.h │ └── ukrainian.h ├── version.cmake └── version.h.in └── utils ├── .gitignore └── munin_plugins ├── alt_blocks_count ├── difficulty ├── grey_peerlist_size ├── height ├── incoming_connections_count ├── outgoing_connections_count ├── tx_count ├── tx_pool_size └── white_peerlist_size /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | /win_build 34 | -------------------------------------------------------------------------------- /CTestCustom.cmake: -------------------------------------------------------------------------------- 1 | set(CTEST_CUSTOM_TESTS_IGNORE 2 | CoreTests 3 | IntegrationTestLibrary 4 | TestGenerator 5 | CryptoTests 6 | IntegrationTests 7 | NodeRpcProxyTests 8 | PerformanceTests 9 | TransfersTests 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /external/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library") 2 | set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library") 3 | set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables") 4 | 5 | add_subdirectory(miniupnpc) 6 | add_subdirectory(gtest) 7 | 8 | set_property(TARGET upnpc-static gtest gtest_main PROPERTY FOLDER "external") 9 | 10 | if(MSVC) 11 | set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267") 12 | elseif(NOT MSVC) 13 | set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value") 14 | endif() 15 | -------------------------------------------------------------------------------- /external/google/sparsehash/os_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _MSC_VER 2 | //non-win version 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_INTTYPES_H 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_STDINT_H 1 9 | 10 | /* Define to 1 if the system has the type `uint16_t'. */ 11 | #define HAVE_UINT16_T 1 12 | 13 | /* Define to 1 if the system has the type `u_int16_t'. */ 14 | #define HAVE_U_INT16_T 1 15 | 16 | /* Define to 1 if the system has the type `__uint16'. */ 17 | /* #undef HAVE___UINT16 */ 18 | 19 | #else 20 | //win version 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #undef HAVE_INTTYPES_H 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #undef HAVE_STDINT_H 27 | 28 | /* Define to 1 if the system has the type `uint16_t'. */ 29 | #undef HAVE_UINT16_T 30 | 31 | /* Define to 1 if the system has the type `u_int16_t'. */ 32 | #undef HAVE_U_INT16_T 33 | 34 | /* Define to 1 if the system has the type `__uint16'. */ 35 | #define HAVE___UINT16 1 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /external/google/sparsehash/sparseconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE: This file is for internal use only. 3 | * Do not use these #defines in your own program! 4 | */ 5 | 6 | /* Namespace for Google classes */ 7 | #define GOOGLE_NAMESPACE ::google 8 | 9 | /* the location of the header defining hash functions */ 10 | #define HASH_FUN_H 11 | 12 | /* the namespace of the hash<> function */ 13 | #define HASH_NAMESPACE std 14 | 15 | /* Define to 1 if the system has the type `long long'. */ 16 | #define HAVE_LONG_LONG 1 17 | 18 | /* Define to 1 if you have the `memcpy' function. */ 19 | #define HAVE_MEMCPY 1 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #define HAVE_SYS_TYPES_H 1 23 | 24 | /* The system-provided hash function including the namespace. */ 25 | #define SPARSEHASH_HASH HASH_NAMESPACE::hash 26 | 27 | /* The system-provided hash function, in namespace HASH_NAMESPACE. */ 28 | #define SPARSEHASH_HASH_NO_NAMESPACE hash 29 | 30 | /* the namespace where STL code like vector<> is defined */ 31 | #define STL_NAMESPACE std 32 | 33 | /* Stops putting the code inside the Google namespace */ 34 | #define _END_GOOGLE_NAMESPACE_ } 35 | 36 | /* Puts following code inside the Google namespace */ 37 | #define _START_GOOGLE_NAMESPACE_ namespace google { 38 | 39 | #include "os_config.h" 40 | -------------------------------------------------------------------------------- /external/google/sparsehash/sparseconfig_win.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE: This file is for internal use only. 3 | * Do not use these #defines in your own program! 4 | */ 5 | 6 | /* Namespace for Google classes */ 7 | #define GOOGLE_NAMESPACE ::google 8 | 9 | /* the location of the header defining hash functions */ 10 | #define HASH_FUN_H 11 | 12 | /* the namespace of the hash<> function */ 13 | #define HASH_NAMESPACE std 14 | 15 | /* Define to 1 if the system has the type `long long'. */ 16 | #define HAVE_LONG_LONG 1 17 | 18 | /* Define to 1 if you have the `memcpy' function. */ 19 | #define HAVE_MEMCPY 1 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #define HAVE_SYS_TYPES_H 1 23 | 24 | /* The system-provided hash function including the namespace. */ 25 | #define SPARSEHASH_HASH HASH_NAMESPACE::hash 26 | 27 | /* The system-provided hash function, in namespace HASH_NAMESPACE. */ 28 | #define SPARSEHASH_HASH_NO_NAMESPACE hash 29 | 30 | /* the namespace where STL code like vector<> is defined */ 31 | #define STL_NAMESPACE std 32 | 33 | /* Stops putting the code inside the Google namespace */ 34 | #define _END_GOOGLE_NAMESPACE_ } 35 | 36 | /* Puts following code inside the Google namespace */ 37 | #define _START_GOOGLE_NAMESPACE_ namespace google { 38 | -------------------------------------------------------------------------------- /external/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /external/gtest/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /external/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /external/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /external/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /external/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /external/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /external/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /external/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /external/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /external/miniupnpc/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README 2 | include miniupnpcmodule.c 3 | include setup.py 4 | include *.h 5 | include libminiupnpc.a 6 | -------------------------------------------------------------------------------- /external/miniupnpc/VERSION: -------------------------------------------------------------------------------- 1 | 1.9 2 | -------------------------------------------------------------------------------- /external/miniupnpc/codelength.h: -------------------------------------------------------------------------------- 1 | /* $Id: codelength.h,v 1.4 2012/09/27 15:40:29 nanard Exp $ */ 2 | /* Project : miniupnp 3 | * Author : Thomas BERNARD 4 | * copyright (c) 2005-2011 Thomas Bernard 5 | * This software is subjet to the conditions detailed in the 6 | * provided LICENCE file. */ 7 | #ifndef CODELENGTH_H_INCLUDED 8 | #define CODELENGTH_H_INCLUDED 9 | 10 | /* Encode length by using 7bit per Byte : 11 | * Most significant bit of each byte specifies that the 12 | * following byte is part of the code */ 13 | #define DECODELENGTH(n, p) n = 0; \ 14 | do { n = (n << 7) | (*p & 0x7f); } \ 15 | while((*(p++)&0x80) && (n<(1<<25))); 16 | 17 | #define DECODELENGTH_CHECKLIMIT(n, p, p_limit) \ 18 | n = 0; \ 19 | do { \ 20 | if((p) >= (p_limit)) break; \ 21 | n = (n << 7) | (*(p) & 0x7f); \ 22 | } while((*((p)++)&0x80) && (n<(1<<25))); 23 | 24 | #define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \ 25 | if(n>=2097152) *(p++) = (n >> 21) | 0x80; \ 26 | if(n>=16384) *(p++) = (n >> 14) | 0x80; \ 27 | if(n>=128) *(p++) = (n >> 7) | 0x80; \ 28 | *(p++) = n & 0x7f; 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /external/miniupnpc/connecthostport.h: -------------------------------------------------------------------------------- 1 | /* $Id: connecthostport.h,v 1.3 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* Project: miniupnp 3 | * http://miniupnp.free.fr/ 4 | * Author: Thomas Bernard 5 | * Copyright (c) 2010-2012 Thomas Bernard 6 | * This software is subjects to the conditions detailed 7 | * in the LICENCE file provided within this distribution */ 8 | #ifndef CONNECTHOSTPORT_H_INCLUDED 9 | #define CONNECTHOSTPORT_H_INCLUDED 10 | 11 | /* connecthostport() 12 | * return a socket connected (TCP) to the host and port 13 | * or -1 in case of error */ 14 | int connecthostport(const char * host, unsigned short port, 15 | unsigned int scope_id); 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /external/miniupnpc/declspec.h: -------------------------------------------------------------------------------- 1 | #ifndef DECLSPEC_H_INCLUDED 2 | #define DECLSPEC_H_INCLUDED 3 | 4 | #if defined(_WIN32) && !defined(STATICLIB) 5 | /* for windows dll */ 6 | #ifdef MINIUPNP_EXPORTS 7 | #define LIBSPEC __declspec(dllexport) 8 | #else 9 | #define LIBSPEC __declspec(dllimport) 10 | #endif 11 | #else 12 | #if defined(__GNUC__) && __GNUC__ >= 4 13 | /* fix dynlib for OS X 10.9.2 and Apple LLVM version 5.0 */ 14 | #define LIBSPEC __attribute__ ((visibility ("default"))) 15 | #else 16 | #define LIBSPEC 17 | #endif 18 | #endif 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /external/miniupnpc/external-ip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # $Id: external-ip.sh,v 1.1 2010/08/05 12:57:41 nanard Exp $ 3 | # (c) 2010 Reuben Hawkins 4 | upnpc -s | grep ExternalIPAddress | sed 's/[^0-9\.]//g' 5 | -------------------------------------------------------------------------------- /external/miniupnpc/java/testjava.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set JAVA=java 3 | set JAVAC=javac 4 | REM notice the semicolon for Windows. Write once, run ... oh nevermind 5 | set CP=miniupnpc_win32.jar;. 6 | 7 | %JAVAC% -cp "%CP%" JavaBridgeTest.java || exit 1 8 | %JAVA% -cp "%CP%" JavaBridgeTest 12345 UDP || exit 1 9 | -------------------------------------------------------------------------------- /external/miniupnpc/java/testjava.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JAVA=java 4 | JAVAC=javac 5 | CP=$(for i in *.jar; do echo -n $i:; done). 6 | 7 | $JAVAC -cp $CP JavaBridgeTest.java || exit 1 8 | $JAVA -cp $CP JavaBridgeTest 12345 UDP || exit 1 9 | -------------------------------------------------------------------------------- /external/miniupnpc/mingw32make.bat: -------------------------------------------------------------------------------- 1 | @mingw32-make -f Makefile.mingw %1 2 | @if errorlevel 1 goto end 3 | @if not exist upnpc-static.exe goto end 4 | @strip upnpc-static.exe 5 | @upx --best upnpc-static.exe 6 | @strip upnpc-shared.exe 7 | @upx --best upnpc-shared.exe 8 | :end 9 | -------------------------------------------------------------------------------- /external/miniupnpc/minisoap.h: -------------------------------------------------------------------------------- 1 | /* $Id: minisoap.h,v 1.5 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* Project : miniupnp 3 | * Author : Thomas Bernard 4 | * Copyright (c) 2005 Thomas Bernard 5 | * This software is subject to the conditions detailed in the 6 | * LICENCE file provided in this distribution. */ 7 | #ifndef MINISOAP_H_INCLUDED 8 | #define MINISOAP_H_INCLUDED 9 | 10 | /*int httpWrite(int, const char *, int, const char *);*/ 11 | int soapPostSubmit(int, const char *, const char *, unsigned short, 12 | const char *, const char *, const char *); 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /external/miniupnpc/minissdpc.h: -------------------------------------------------------------------------------- 1 | /* $Id: minissdpc.h,v 1.2 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* Project: miniupnp 3 | * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 4 | * Author: Thomas Bernard 5 | * Copyright (c) 2005-2007 Thomas Bernard 6 | * This software is subjects to the conditions detailed 7 | * in the LICENCE file provided within this distribution */ 8 | #ifndef MINISSDPC_H_INCLUDED 9 | #define MINISSDPC_H_INCLUDED 10 | 11 | struct UPNPDev * 12 | getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath); 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /external/miniupnpc/miniupnpc.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | ; miniupnpc library 3 | miniupnpc 4 | 5 | EXPORTS 6 | ; miniupnpc 7 | upnpDiscover 8 | freeUPNPDevlist 9 | parserootdesc 10 | UPNP_GetValidIGD 11 | UPNP_GetIGDFromUrl 12 | GetUPNPUrls 13 | FreeUPNPUrls 14 | ; miniwget 15 | miniwget 16 | miniwget_getaddr 17 | ; upnpcommands 18 | UPNP_GetTotalBytesSent 19 | UPNP_GetTotalBytesReceived 20 | UPNP_GetTotalPacketsSent 21 | UPNP_GetTotalPacketsReceived 22 | UPNP_GetStatusInfo 23 | UPNP_GetConnectionTypeInfo 24 | UPNP_GetExternalIPAddress 25 | UPNP_GetLinkLayerMaxBitRates 26 | UPNP_AddPortMapping 27 | UPNP_DeletePortMapping 28 | UPNP_GetPortMappingNumberOfEntries 29 | UPNP_GetSpecificPortMappingEntry 30 | UPNP_GetGenericPortMappingEntry 31 | UPNP_GetListOfPortMappings 32 | UPNP_AddPinhole 33 | UPNP_CheckPinholeWorking 34 | UPNP_UpdatePinhole 35 | UPNP_GetPinholePackets 36 | UPNP_DeletePinhole 37 | UPNP_GetFirewallStatus 38 | UPNP_GetOutboundPinholeTimeout 39 | ; upnperrors 40 | strupnperror 41 | ; portlistingparse 42 | ParsePortListing 43 | FreePortListing 44 | -------------------------------------------------------------------------------- /external/miniupnpc/miniupnpcstrings.h.cmake: -------------------------------------------------------------------------------- 1 | #ifndef MINIUPNPCSTRINGS_H_INCLUDED 2 | #define MINIUPNPCSTRINGS_H_INCLUDED 3 | 4 | #define OS_STRING "${CMAKE_SYSTEM_NAME}" 5 | #define MINIUPNPC_VERSION_STRING "${MINIUPNPC_VERSION}" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /external/miniupnpc/miniupnpcstrings.h.in: -------------------------------------------------------------------------------- 1 | /* $Id: miniupnpcstrings.h.in,v 1.5 2012/10/16 16:48:26 nanard Exp $ */ 2 | /* Project: miniupnp 3 | * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 4 | * Author: Thomas Bernard 5 | * Copyright (c) 2005-2011 Thomas Bernard 6 | * This software is subjects to the conditions detailed 7 | * in the LICENCE file provided within this distribution */ 8 | #ifndef MINIUPNPCSTRINGS_H_INCLUDED 9 | #define MINIUPNPCSTRINGS_H_INCLUDED 10 | 11 | #define OS_STRING "OS/version" 12 | #define MINIUPNPC_VERSION_STRING "version" 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /external/miniupnpc/miniupnpctypes.h: -------------------------------------------------------------------------------- 1 | /* $Id: miniupnpctypes.h,v 1.2 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org 3 | * Author : Thomas Bernard 4 | * Copyright (c) 2011 Thomas Bernard 5 | * This software is subject to the conditions detailed in the 6 | * LICENCE file provided within this distribution */ 7 | #ifndef MINIUPNPCTYPES_H_INCLUDED 8 | #define MINIUPNPCTYPES_H_INCLUDED 9 | 10 | #if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) 11 | #define UNSIGNED_INTEGER unsigned long long 12 | #define STRTOUI strtoull 13 | #else 14 | #define UNSIGNED_INTEGER unsigned int 15 | #define STRTOUI strtoul 16 | #endif 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /external/miniupnpc/miniwget.h: -------------------------------------------------------------------------------- 1 | /* $Id: miniwget.h,v 1.8 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* Project : miniupnp 3 | * Author : Thomas Bernard 4 | * Copyright (c) 2005-2012 Thomas Bernard 5 | * This software is subject to the conditions detailed in the 6 | * LICENCE file provided in this distribution. 7 | * */ 8 | #ifndef MINIWGET_H_INCLUDED 9 | #define MINIWGET_H_INCLUDED 10 | 11 | #include "declspec.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | LIBSPEC void * getHTTPResponse(int s, int * size); 18 | 19 | LIBSPEC void * miniwget(const char *, int *, unsigned int); 20 | 21 | LIBSPEC void * miniwget_getaddr(const char *, int *, char *, int, unsigned int); 22 | 23 | int parseURL(const char *, char *, unsigned short *, char * *, unsigned int *); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /external/miniupnpc/minixml.h: -------------------------------------------------------------------------------- 1 | /* $Id: minixml.h,v 1.7 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* minimal xml parser 3 | * 4 | * Project : miniupnp 5 | * Website : http://miniupnp.free.fr/ 6 | * Author : Thomas Bernard 7 | * Copyright (c) 2005 Thomas Bernard 8 | * This software is subject to the conditions detailed in the 9 | * LICENCE file provided in this distribution. 10 | * */ 11 | #ifndef MINIXML_H_INCLUDED 12 | #define MINIXML_H_INCLUDED 13 | #define IS_WHITE_SPACE(c) ((c==' ') || (c=='\t') || (c=='\r') || (c=='\n')) 14 | 15 | /* if a callback function pointer is set to NULL, 16 | * the function is not called */ 17 | struct xmlparser { 18 | const char *xmlstart; 19 | const char *xmlend; 20 | const char *xml; /* pointer to current character */ 21 | int xmlsize; 22 | void * data; 23 | void (*starteltfunc) (void *, const char *, int); 24 | void (*endeltfunc) (void *, const char *, int); 25 | void (*datafunc) (void *, const char *, int); 26 | void (*attfunc) (void *, const char *, int, const char *, int); 27 | }; 28 | 29 | /* parsexml() 30 | * the xmlparser structure must be initialized before the call 31 | * the following structure members have to be initialized : 32 | * xmlstart, xmlsize, data, *func 33 | * xml is for internal usage, xmlend is computed automatically */ 34 | void parsexml(struct xmlparser *); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /external/miniupnpc/msvc/miniupnpc.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipbc-dev/bittube-old/5caa532cad1ff750dbb34add52aa1f5bef534dc5/external/miniupnpc/msvc/miniupnpc.vcproj -------------------------------------------------------------------------------- /external/miniupnpc/msvc/upnpc-static.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipbc-dev/bittube-old/5caa532cad1ff750dbb34add52aa1f5bef534dc5/external/miniupnpc/msvc/upnpc-static.vcproj -------------------------------------------------------------------------------- /external/miniupnpc/receivedata.h: -------------------------------------------------------------------------------- 1 | /* $Id: receivedata.h,v 1.4 2012/09/27 15:42:10 nanard Exp $ */ 2 | /* Project: miniupnp 3 | * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 4 | * Author: Thomas Bernard 5 | * Copyright (c) 2011-2012 Thomas Bernard 6 | * This software is subjects to the conditions detailed 7 | * in the LICENCE file provided within this distribution */ 8 | #ifndef RECEIVEDATA_H_INCLUDED 9 | #define RECEIVEDATA_H_INCLUDED 10 | 11 | /* Reads data from the specified socket. 12 | * Returns the number of bytes read if successful, zero if no bytes were 13 | * read or if we timed out. Returns negative if there was an error. */ 14 | int receivedata(int socket, 15 | char * data, int length, 16 | int timeout, unsigned int * scope_id); 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /external/miniupnpc/setup.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | # $Id: setup.py,v 1.9 2012/05/23 08:50:10 nanard Exp $ 3 | # the MiniUPnP Project (c) 2007-2012 Thomas Bernard 4 | # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ 5 | # 6 | # python script to build the miniupnpc module under unix 7 | # 8 | # replace libminiupnpc.a by libminiupnpc.so for shared library usage 9 | from distutils.core import setup, Extension 10 | from distutils import sysconfig 11 | sysconfig.get_config_vars()["OPT"] = '' 12 | sysconfig.get_config_vars()["CFLAGS"] = '' 13 | setup(name="miniupnpc", version="1.7", 14 | ext_modules=[ 15 | Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], 16 | extra_objects=["libminiupnpc.a"]) 17 | ]) 18 | 19 | -------------------------------------------------------------------------------- /external/miniupnpc/setupmingw32.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | # $Id: setupmingw32.py,v 1.8 2012/05/23 08:50:10 nanard Exp $ 3 | # the MiniUPnP Project (c) 2007-2012 Thomas Bernard 4 | # http://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ 5 | # 6 | # python script to build the miniupnpc module under windows (using mingw32) 7 | # 8 | from distutils.core import setup, Extension 9 | from distutils import sysconfig 10 | sysconfig.get_config_vars()["OPT"] = '' 11 | sysconfig.get_config_vars()["CFLAGS"] = '' 12 | setup(name="miniupnpc", version="1.7", 13 | ext_modules=[ 14 | Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], 15 | libraries=["ws2_32", "iphlpapi"], 16 | extra_objects=["libminiupnpc.a"]) 17 | ]) 18 | 19 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/DeletePortMapping.namevalue: -------------------------------------------------------------------------------- 1 | NewRemoteHost= 2 | NewExternalPort=123 3 | NewProtocol=TCP 4 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/DeletePortMapping.xml: -------------------------------------------------------------------------------- 1 | 2 | 123 3 | TCP 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/GetExternalIPAddress.namevalue: -------------------------------------------------------------------------------- 1 | NewExternalIPAddress=1.2.3.4 2 | 3 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/GetExternalIPAddress.xml: -------------------------------------------------------------------------------- 1 | 1.2.3.4 2 | 3 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/GetSpecificPortMappingEntryReq.namevalue: -------------------------------------------------------------------------------- 1 | NewProtocol=UDP 2 | NewExternalPort=12345 3 | NewRemoteHost= 4 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/GetSpecificPortMappingEntryReq.xml: -------------------------------------------------------------------------------- 1 | 2 | 12345UDP 3 | 4 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/GetSpecificPortMappingEntryResp.namevalue: -------------------------------------------------------------------------------- 1 | NewInternalPort=12345 2 | NewInternalClient=192.168.10.110 3 | NewEnabled=1 4 | NewPortMappingDescription=libminiupnpc 5 | NewLeaseDuration=0 6 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/GetSpecificPortMappingEntryResp.xml: -------------------------------------------------------------------------------- 1 | 12345192.168.10.1101libminiupnpc0 2 | 3 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/SetDefaultConnectionService.namevalue: -------------------------------------------------------------------------------- 1 | NewDefaultConnectionService=uuid:c6c05a33-f704-48df-9910-e099b3471d81:WANConnectionDevice:1,INVALID_SERVICE_ID 2 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/SetDefaultConnectionService.xml: -------------------------------------------------------------------------------- 1 | uuid:c6c05a33-f704-48df-9910-e099b3471d81:WANConnectionDevice:1,INVALID_SERVICE_ID 2 | -------------------------------------------------------------------------------- /external/miniupnpc/testreplyparse/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains files used for validation of upnpreplyparse.c code. 2 | 3 | Each .xml file to parse should give the results which are in the .namevalue 4 | file. 5 | 6 | A .namevalue file contain name=value lines. 7 | 8 | -------------------------------------------------------------------------------- /external/miniupnpc/testupnpreplyparse.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for f in testreplyparse/*.xml ; do 4 | bf="`dirname $f`/`basename $f .xml`" 5 | if ./testupnpreplyparse $f $bf.namevalue ; then 6 | echo "$f : passed" 7 | else 8 | echo "$f : FAILED" 9 | exit 1 10 | fi 11 | done 12 | 13 | exit 0 14 | 15 | -------------------------------------------------------------------------------- /external/miniupnpc/upnperrors.h: -------------------------------------------------------------------------------- 1 | /* $Id: upnperrors.h,v 1.4 2012/09/27 15:42:11 nanard Exp $ */ 2 | /* (c) 2007 Thomas Bernard 3 | * All rights reserved. 4 | * MiniUPnP Project. 5 | * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ 6 | * This software is subjet to the conditions detailed in the 7 | * provided LICENCE file. */ 8 | #ifndef UPNPERRORS_H_INCLUDED 9 | #define UPNPERRORS_H_INCLUDED 10 | 11 | #include "declspec.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* strupnperror() 18 | * Return a string description of the UPnP error code 19 | * or NULL for undefinded errors */ 20 | LIBSPEC const char * strupnperror(int err); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/CryptoTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Crypto { 23 | 24 | struct Hash { 25 | uint8_t data[32]; 26 | }; 27 | 28 | struct PublicKey { 29 | uint8_t data[32]; 30 | }; 31 | 32 | struct SecretKey { 33 | uint8_t data[32]; 34 | }; 35 | 36 | struct KeyDerivation { 37 | uint8_t data[32]; 38 | }; 39 | 40 | struct KeyImage { 41 | uint8_t data[32]; 42 | }; 43 | 44 | struct Signature { 45 | uint8_t data[64]; 46 | }; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /include/IObservable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace CryptoNote { 21 | 22 | template 23 | class IObservable { 24 | public: 25 | virtual void addObserver(T* observer) = 0; 26 | virtual void removeObserver(T* observer) = 0; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /include/IStreamSerializable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace CryptoNote { 23 | 24 | class IStreamSerializable { 25 | public: 26 | virtual void save(std::ostream& os) = 0; 27 | virtual void load(std::istream& in) = 0; 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/BlockchainExplorer/BlockchainExplorerErrors.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "BlockchainExplorerErrors.h" 19 | 20 | namespace CryptoNote { 21 | namespace error { 22 | 23 | BlockchainExplorerErrorCategory BlockchainExplorerErrorCategory::INSTANCE; 24 | 25 | } //namespace error 26 | } //namespace CryptoNote 27 | 28 | -------------------------------------------------------------------------------- /src/Common/Base58.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace Tools 24 | { 25 | namespace Base58 26 | { 27 | std::string encode(const std::string& data); 28 | bool decode(const std::string& enc, std::string& data); 29 | 30 | std::string encode_addr(uint64_t tag, const std::string& data); 31 | bool decode_addr(std::string addr, uint64_t& tag, std::string& data); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Common/BlockingQueue.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "BlockingQueue.h" 19 | 20 | namespace { 21 | char suppressMSVCWarningLNK4221; 22 | } 23 | -------------------------------------------------------------------------------- /src/Common/CommandLine.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "CommandLine.h" 19 | 20 | namespace command_line 21 | { 22 | const arg_descriptor arg_help = {"help", "Produce help message"}; 23 | const arg_descriptor arg_version = {"version", "Output version information"}; 24 | const arg_descriptor arg_data_dir = {"data-dir", "Specify data directory"}; 25 | } 26 | -------------------------------------------------------------------------------- /src/Common/ConsoleTools.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Common { namespace Console { 23 | 24 | enum class Color : uint8_t { 25 | Default, 26 | 27 | Blue, 28 | Green, 29 | Red, 30 | Yellow, 31 | White, 32 | Cyan, 33 | Magenta, 34 | 35 | BrightBlue, 36 | BrightGreen, 37 | BrightRed, 38 | BrightYellow, 39 | BrightWhite, 40 | BrightCyan, 41 | BrightMagenta 42 | }; 43 | 44 | void setTextColor(Color color); 45 | bool isConsoleTty(); 46 | 47 | }} 48 | -------------------------------------------------------------------------------- /src/Common/FileMappedVector.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "FileMappedVector.h" 19 | 20 | namespace { 21 | char suppressMSVCWarningLNK4221; 22 | } 23 | -------------------------------------------------------------------------------- /src/Common/IInputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "IInputStream.h" 19 | -------------------------------------------------------------------------------- /src/Common/IInputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Common { 23 | 24 | class IInputStream { 25 | public: 26 | virtual ~IInputStream() { } 27 | virtual size_t readSome(void* data, size_t size) = 0; 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Common/IOutputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "IOutputStream.h" 19 | -------------------------------------------------------------------------------- /src/Common/IOutputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Common { 23 | 24 | class IOutputStream { 25 | public: 26 | virtual ~IOutputStream() { } 27 | virtual size_t writeSome(const void* data, size_t size) = 0; 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Common/Math.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "Math.h" 19 | 20 | namespace { 21 | char suppressMSVCWarningLNK4221; 22 | } 23 | -------------------------------------------------------------------------------- /src/Common/Math.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace Common { 24 | 25 | template 26 | T medianValue(std::vector &v) { 27 | if (v.empty()) 28 | return T(); 29 | 30 | if (v.size() == 1) 31 | return v[0]; 32 | 33 | auto n = (v.size()) / 2; 34 | std::sort(v.begin(), v.end()); 35 | //nth_element(v.begin(), v.begin()+n-1, v.end()); 36 | if (v.size() % 2) { //1, 3, 5... 37 | return v[n]; 38 | } else { //2, 4, 6... 39 | return (v[n - 1] + v[n]) / 2; 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/Common/MemoryInputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "IInputStream.h" 21 | 22 | namespace Common { 23 | 24 | class MemoryInputStream : public IInputStream { 25 | public: 26 | MemoryInputStream(const void* buffer, size_t bufferSize); 27 | size_t getPosition() const; 28 | bool endOfStream() const; 29 | 30 | // IInputStream 31 | virtual size_t readSome(void* data, size_t size) override; 32 | 33 | private: 34 | const char* buffer; 35 | size_t bufferSize; 36 | size_t position; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /src/Common/PathTools.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Common { 23 | 24 | std::string NativePathToGeneric(const std::string& nativePath); 25 | 26 | std::string GetPathDirectory(const std::string& path); 27 | std::string GetPathFilename(const std::string& path); 28 | void SplitPath(const std::string& path, std::string& directory, std::string& filename); 29 | 30 | std::string CombinePath(const std::string& path1, const std::string& path2); 31 | std::string GetExtension(const std::string& path); 32 | std::string RemoveExtension(const std::string& path); 33 | std::string ReplaceExtenstion(const std::string& path, const std::string& extension); 34 | bool HasParentPath(const std::string& path); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Common/ScopeExit.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "ScopeExit.h" 19 | 20 | namespace Tools { 21 | 22 | ScopeExit::ScopeExit(std::function&& handler) : 23 | m_handler(std::move(handler)), 24 | m_cancelled(false) { 25 | } 26 | 27 | ScopeExit::~ScopeExit() { 28 | if (!m_cancelled) { 29 | m_handler(); 30 | } 31 | } 32 | 33 | void ScopeExit::cancel() { 34 | m_cancelled = true; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/Common/ScopeExit.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Tools { 23 | 24 | class ScopeExit { 25 | public: 26 | ScopeExit(std::function&& handler); 27 | ~ScopeExit(); 28 | 29 | ScopeExit(const ScopeExit&) = delete; 30 | ScopeExit(ScopeExit&&) = delete; 31 | ScopeExit& operator=(const ScopeExit&) = delete; 32 | ScopeExit& operator=(ScopeExit&&) = delete; 33 | 34 | void cancel(); 35 | 36 | private: 37 | std::function m_handler; 38 | bool m_cancelled; 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Common/SignalHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace Tools { 23 | 24 | class SignalHandler 25 | { 26 | public: 27 | static bool install(std::function t); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /src/Common/StdInputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "StdInputStream.h" 19 | 20 | namespace Common { 21 | 22 | StdInputStream::StdInputStream(std::istream& in) : in(in) { 23 | } 24 | 25 | size_t StdInputStream::readSome(void* data, size_t size) { 26 | in.read(static_cast(data), size); 27 | return in.gcount(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Common/StdInputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "IInputStream.h" 22 | 23 | namespace Common { 24 | 25 | class StdInputStream : public IInputStream { 26 | public: 27 | StdInputStream(std::istream& in); 28 | StdInputStream& operator=(const StdInputStream&) = delete; 29 | size_t readSome(void* data, size_t size) override; 30 | 31 | private: 32 | std::istream& in; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Common/StdOutputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "StdOutputStream.h" 19 | 20 | namespace Common { 21 | 22 | StdOutputStream::StdOutputStream(std::ostream& out) : out(out) { 23 | } 24 | 25 | size_t StdOutputStream::writeSome(const void* data, size_t size) { 26 | out.write(static_cast(data), size); 27 | if (out.bad()) { 28 | return 0; 29 | } 30 | 31 | return size; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Common/StdOutputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "IOutputStream.h" 22 | 23 | namespace Common { 24 | 25 | class StdOutputStream : public IOutputStream { 26 | public: 27 | StdOutputStream(std::ostream& out); 28 | StdOutputStream& operator=(const StdOutputStream&) = delete; 29 | size_t writeSome(const void* data, size_t size) override; 30 | 31 | private: 32 | std::ostream& out; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Common/StringInputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "StringInputStream.h" 19 | #include 20 | 21 | namespace Common { 22 | 23 | StringInputStream::StringInputStream(const std::string& in) : in(in), offset(0) { 24 | } 25 | 26 | size_t StringInputStream::readSome(void* data, size_t size) { 27 | if (size > in.size() - offset) { 28 | size = in.size() - offset; 29 | } 30 | 31 | memcpy(data, in.data() + offset, size); 32 | offset += size; 33 | return size; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Common/StringInputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "IInputStream.h" 22 | 23 | namespace Common { 24 | 25 | class StringInputStream : public IInputStream { 26 | public: 27 | StringInputStream(const std::string& in); 28 | size_t readSome(void* data, size_t size) override; 29 | 30 | private: 31 | const std::string& in; 32 | size_t offset; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Common/StringOutputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "StringOutputStream.h" 19 | 20 | namespace Common { 21 | 22 | StringOutputStream::StringOutputStream(std::string& out) : out(out) { 23 | } 24 | 25 | size_t StringOutputStream::writeSome(const void* data, size_t size) { 26 | out.append(static_cast(data), size); 27 | return size; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Common/StringOutputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "IOutputStream.h" 22 | 23 | namespace Common { 24 | 25 | class StringOutputStream : public IOutputStream { 26 | public: 27 | StringOutputStream(std::string& out); 28 | size_t writeSome(const void* data, size_t size) override; 29 | 30 | private: 31 | std::string& out; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Common/Util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace Tools 24 | { 25 | std::string getDefaultDataDirectory(); 26 | std::string get_os_version_string(); 27 | bool create_directories_if_necessary(const std::string& path); 28 | std::error_code replace_file(const std::string& replacement_name, const std::string& replaced_name); 29 | bool directoryExists(const std::string& path); 30 | } 31 | -------------------------------------------------------------------------------- /src/Common/VectorOutputStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "VectorOutputStream.h" 19 | 20 | namespace Common { 21 | 22 | VectorOutputStream::VectorOutputStream(std::vector& out) : out(out) { 23 | } 24 | 25 | size_t VectorOutputStream::writeSome(const void* data, size_t size) { 26 | out.insert(out.end(), static_cast(data), static_cast(data) + size); 27 | return size; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Common/VectorOutputStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include "IOutputStream.h" 23 | 24 | namespace Common { 25 | 26 | class VectorOutputStream : public IOutputStream { 27 | public: 28 | VectorOutputStream(std::vector& out); 29 | VectorOutputStream& operator=(const VectorOutputStream&) = delete; 30 | size_t writeSome(const void* data, size_t size) override; 31 | 32 | private: 33 | std::vector& out; 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Common/pod-class.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #if defined(_MSC_VER) 21 | #define POD_CLASS struct 22 | #else 23 | #define POD_CLASS class 24 | #endif 25 | -------------------------------------------------------------------------------- /src/Common/static_assert.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #ifndef __cplusplus 21 | #ifdef __clang__ 22 | 23 | #define static_assert _Static_assert 24 | 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/CoreConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | #include 23 | 24 | namespace CryptoNote { 25 | 26 | class CoreConfig { 27 | public: 28 | CoreConfig(); 29 | 30 | static void initOptions(boost::program_options::options_description& desc); 31 | void init(const boost::program_options::variables_map& options); 32 | 33 | std::string configFolder; 34 | bool configFolderDefaulted = true; 35 | }; 36 | 37 | } //namespace CryptoNote 38 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/CryptoNoteBasic.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "CryptoNoteBasic.h" 19 | #include "crypto/crypto.h" 20 | 21 | namespace CryptoNote { 22 | 23 | KeyPair generateKeyPair() { 24 | KeyPair k; 25 | Crypto::generate_keys(k.publicKey, k.secretKey); 26 | return k; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/CryptoNoteStatInfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "Serialization/ISerializer.h" 21 | 22 | namespace CryptoNote 23 | { 24 | struct core_stat_info 25 | { 26 | uint64_t tx_pool_size; 27 | uint64_t blockchain_height; 28 | uint64_t mining_speed; 29 | uint64_t alternative_blocks; 30 | std::string top_block_id_str; 31 | 32 | void serialize(ISerializer& s) { 33 | KV_MEMBER(tx_pool_size) 34 | KV_MEMBER(blockchain_height) 35 | KV_MEMBER(mining_speed) 36 | KV_MEMBER(alternative_blocks) 37 | KV_MEMBER(top_block_id_str) 38 | } 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/Difficulty.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | #include "crypto/hash.h" 24 | 25 | namespace CryptoNote 26 | { 27 | typedef std::uint64_t difficulty_type; 28 | 29 | bool check_hash(const Crypto::Hash &hash, difficulty_type difficulty); 30 | } 31 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/IBlock.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "IBlock.h" 19 | 20 | namespace CryptoNote { 21 | IBlock::~IBlock() { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/IBlock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "CryptoNote.h" 21 | 22 | namespace CryptoNote { 23 | class IBlock { 24 | public: 25 | virtual ~IBlock(); 26 | 27 | virtual const Block& getBlock() const = 0; 28 | virtual size_t getTransactionCount() const = 0; 29 | virtual const Transaction& getTransaction(size_t index) const = 0; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/IBlockchainStorageObserver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace CryptoNote { 21 | class IBlockchainStorageObserver { 22 | public: 23 | virtual ~IBlockchainStorageObserver() { 24 | } 25 | 26 | virtual void blockchainUpdated() = 0; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/ICoreObserver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace CryptoNote { 21 | 22 | class ICoreObserver { 23 | public: 24 | virtual ~ICoreObserver() {}; 25 | virtual void blockchainUpdated() {}; 26 | virtual void poolUpdated() {}; 27 | }; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/IMinerHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "CryptoNoteCore/CryptoNoteBasic.h" 21 | #include "CryptoNoteCore/Difficulty.h" 22 | 23 | namespace CryptoNote { 24 | struct IMinerHandler { 25 | virtual bool handle_block_found(Block& b) = 0; 26 | virtual bool get_block_template(Block& b, const AccountPublicAddress& adr, difficulty_type& diffic, uint32_t& height, const BinaryArray& ex_nonce) = 0; 27 | 28 | protected: 29 | ~IMinerHandler(){}; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/ITimeProvider.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "ITimeProvider.h" 19 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/ITimeProvider.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace CryptoNote { 23 | 24 | struct ITimeProvider { 25 | virtual time_t now() = 0; 26 | virtual ~ITimeProvider() {} 27 | }; 28 | 29 | struct RealTimeProvider : public ITimeProvider { 30 | virtual time_t now() override { 31 | return time(nullptr); 32 | } 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/ITxPoolObserver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace CryptoNote { 21 | class ITxPoolObserver { 22 | public: 23 | virtual ~ITxPoolObserver() { 24 | } 25 | 26 | virtual void txDeletedFromPool() = 0; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/MinerConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | namespace CryptoNote { 26 | 27 | class MinerConfig { 28 | public: 29 | MinerConfig(); 30 | 31 | static void initOptions(boost::program_options::options_description& desc); 32 | void init(const boost::program_options::variables_map& options); 33 | 34 | std::string extraMessages; 35 | std::string startMining; 36 | uint32_t miningThreads; 37 | }; 38 | 39 | } //namespace CryptoNote 40 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/OnceInInterval.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace CryptoNote 23 | { 24 | 25 | class OnceInInterval { 26 | public: 27 | 28 | OnceInInterval(unsigned interval, bool startNow = true) 29 | : m_interval(interval), m_lastCalled(startNow ? 0 : time(nullptr)) {} 30 | 31 | template 32 | bool call(F func) { 33 | time_t currentTime = time(nullptr); 34 | 35 | if (currentTime - m_lastCalled > m_interval) { 36 | bool res = func(); 37 | time(&m_lastCalled); 38 | return res; 39 | } 40 | 41 | return true; 42 | } 43 | 44 | private: 45 | time_t m_lastCalled; 46 | time_t m_interval; 47 | }; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/SwappedMap.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "SwappedMap.h" 19 | 20 | namespace { 21 | char suppressMSVCWarningLNK4221; 22 | } 23 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/SwappedVector.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "SwappedVector.h" 19 | 20 | namespace { 21 | char suppressMSVCWarningLNK4221; 22 | } 23 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/TransactionApi.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "ITransaction.h" 22 | 23 | namespace CryptoNote { 24 | std::unique_ptr createTransaction(); 25 | std::unique_ptr createTransaction(const BinaryArray& transactionBlob); 26 | std::unique_ptr createTransaction(const Transaction& tx); 27 | 28 | std::unique_ptr createTransactionPrefix(const TransactionPrefix& prefix, const Crypto::Hash& transactionHash); 29 | std::unique_ptr createTransactionPrefix(const Transaction& fullTransaction); 30 | } 31 | -------------------------------------------------------------------------------- /src/CryptoNoteCore/UpgradeDetector.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "UpgradeDetector.h" 19 | -------------------------------------------------------------------------------- /src/CryptoNoteProtocol/ICryptoNoteProtocolObserver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace CryptoNote { 25 | 26 | class ICryptoNoteProtocolObserver { 27 | public: 28 | virtual void peerCountUpdated(size_t count) {} 29 | virtual void lastKnownBlockHeightUpdated(uint32_t height) {} 30 | virtual void blockchainSynchronized(uint32_t topHeight) {} 31 | }; 32 | 33 | } //namespace CryptoNote 34 | -------------------------------------------------------------------------------- /src/CryptoNoteProtocol/ICryptoNoteProtocolQuery.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | class ICryptoNoteProtocolObserver; 25 | 26 | class ICryptoNoteProtocolQuery { 27 | public: 28 | virtual bool addObserver(ICryptoNoteProtocolObserver* observer) = 0; 29 | virtual bool removeObserver(ICryptoNoteProtocolObserver* observer) = 0; 30 | 31 | virtual uint32_t getObservedHeight() const = 0; 32 | virtual size_t getPeerCount() const = 0; 33 | virtual bool isSynchronized() const = 0; 34 | }; 35 | 36 | } //namespace CryptoNote 37 | -------------------------------------------------------------------------------- /src/HTTP/HttpParserErrorCodes.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "HttpParserErrorCodes.h" 19 | 20 | namespace CryptoNote { 21 | namespace error { 22 | 23 | HttpParserErrorCategory HttpParserErrorCategory::INSTANCE; 24 | 25 | } //namespace error 26 | } //namespace CryptoNote 27 | -------------------------------------------------------------------------------- /src/InProcessNode/InProcessNodeErrors.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "InProcessNodeErrors.h" 19 | 20 | namespace CryptoNote { 21 | namespace error { 22 | 23 | InProcessNodeErrorCategory InProcessNodeErrorCategory::INSTANCE; 24 | 25 | } //namespace error 26 | } //namespace CryptoNote 27 | -------------------------------------------------------------------------------- /src/Logging/ConsoleLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "CommonLogger.h" 22 | 23 | namespace Logging { 24 | 25 | class ConsoleLogger : public CommonLogger { 26 | public: 27 | ConsoleLogger(Level level = DEBUGGING); 28 | 29 | protected: 30 | virtual void doLogString(const std::string& message) override; 31 | 32 | private: 33 | std::mutex mutex; 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Logging/FileLogger.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "FileLogger.h" 19 | 20 | namespace Logging { 21 | 22 | FileLogger::FileLogger(Level level) : StreamLogger(level) { 23 | } 24 | 25 | void FileLogger::init(const std::string& fileName) { 26 | fileStream.open(fileName, std::ios::app); 27 | StreamLogger::attachToStream(fileStream); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/Logging/FileLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "StreamLogger.h" 22 | 23 | namespace Logging { 24 | 25 | class FileLogger : public StreamLogger { 26 | public: 27 | FileLogger(Level level = DEBUGGING); 28 | void init(const std::string& filename); 29 | 30 | private: 31 | std::ofstream fileStream; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Logging/LoggerGroup.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "CommonLogger.h" 22 | 23 | namespace Logging { 24 | 25 | class LoggerGroup : public CommonLogger { 26 | public: 27 | LoggerGroup(Level level = DEBUGGING); 28 | 29 | void addLogger(ILogger& logger); 30 | void removeLogger(ILogger& logger); 31 | virtual void operator()(const std::string& category, Level level, boost::posix_time::ptime time, const std::string& body) override; 32 | 33 | protected: 34 | std::vector loggers; 35 | }; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/Logging/LoggerManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include "../Common/JsonValue.h" 24 | #include "LoggerGroup.h" 25 | 26 | namespace Logging { 27 | 28 | class LoggerManager : public LoggerGroup { 29 | public: 30 | LoggerManager(); 31 | void configure(const Common::JsonValue& val); 32 | virtual void operator()(const std::string& category, Level level, boost::posix_time::ptime time, const std::string& body) override; 33 | 34 | private: 35 | std::vector> loggers; 36 | std::mutex reconfigureLock; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/Logging/LoggerRef.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "LoggerRef.h" 19 | 20 | namespace Logging { 21 | 22 | LoggerRef::LoggerRef(ILogger& logger, const std::string& category) : logger(&logger), category(category) { 23 | } 24 | 25 | LoggerMessage LoggerRef::operator()(Level level, const std::string& color) const { 26 | return LoggerMessage(*logger, category, level, color); 27 | } 28 | 29 | ILogger& LoggerRef::getLogger() const { 30 | return *logger; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/Logging/LoggerRef.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "ILogger.h" 21 | #include "LoggerMessage.h" 22 | 23 | namespace Logging { 24 | 25 | class LoggerRef { 26 | public: 27 | LoggerRef(ILogger& logger, const std::string& category); 28 | LoggerMessage operator()(Level level = INFO, const std::string& color = DEFAULT) const; 29 | ILogger& getLogger() const; 30 | 31 | private: 32 | ILogger* logger; 33 | std::string category; 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/Logging/StreamLogger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "CommonLogger.h" 22 | 23 | namespace Logging { 24 | 25 | class StreamLogger : public CommonLogger { 26 | public: 27 | StreamLogger(Level level = DEBUGGING); 28 | StreamLogger(std::ostream& stream, Level level = DEBUGGING); 29 | void attachToStream(std::ostream& stream); 30 | 31 | protected: 32 | virtual void doLogString(const std::string& message) override; 33 | 34 | protected: 35 | std::ostream* stream; 36 | 37 | private: 38 | std::mutex mutex; 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Miner/MinerEvent.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace Miner { 21 | 22 | enum class MinerEventType: uint8_t { 23 | BLOCK_MINED, 24 | BLOCKCHAIN_UPDATED, 25 | }; 26 | 27 | struct MinerEvent { 28 | MinerEventType type; 29 | }; 30 | 31 | } //namespace Miner 32 | -------------------------------------------------------------------------------- /src/Miner/MiningConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | 25 | struct MiningConfig { 26 | MiningConfig(); 27 | 28 | void parse(int argc, char** argv); 29 | void printHelp(); 30 | 31 | std::string miningAddress; 32 | std::string daemonHost; 33 | uint16_t daemonPort; 34 | size_t threadCount; 35 | size_t scanPeriod; 36 | uint8_t logLevel; 37 | size_t blocksLimit; 38 | uint64_t firstBlockTimestamp; 39 | int64_t blockTimestampInterval; 40 | bool help; 41 | }; 42 | 43 | } //namespace CryptoNote 44 | -------------------------------------------------------------------------------- /src/NodeRpcProxy/NodeErrors.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "NodeErrors.h" 19 | 20 | namespace CryptoNote { 21 | namespace error { 22 | 23 | NodeErrorCategory NodeErrorCategory::INSTANCE; 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/P2p/IP2pNodeInternal.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "IP2pNodeInternal.h" 19 | -------------------------------------------------------------------------------- /src/P2p/IP2pNodeInternal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "P2pProtocolDefinitions.h" 22 | 23 | namespace CryptoNote { 24 | 25 | class P2pContext; 26 | 27 | class IP2pNodeInternal { 28 | public: 29 | virtual const CORE_SYNC_DATA& getGenesisPayload() const = 0; 30 | virtual std::list getLocalPeerList() const = 0; 31 | virtual basic_node_data getNodeData() const = 0; 32 | virtual PeerIdType getPeerId() const = 0; 33 | 34 | virtual void handleNodeData(const basic_node_data& node, P2pContext& ctx) = 0; 35 | virtual bool handleRemotePeerList(const std::list& peerlist, time_t local_time) = 0; 36 | virtual void tryPing(P2pContext& ctx) = 0; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/P2p/P2pContextOwner.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | 25 | class P2pContext; 26 | 27 | class P2pContextOwner { 28 | public: 29 | 30 | typedef std::list> ContextList; 31 | 32 | P2pContextOwner(P2pContext* ctx, ContextList& contextList); 33 | P2pContextOwner(P2pContextOwner&& other); 34 | P2pContextOwner(const P2pContextOwner& other) = delete; 35 | ~P2pContextOwner(); 36 | 37 | P2pContext& get(); 38 | P2pContext* operator -> (); 39 | 40 | private: 41 | 42 | ContextList& contextList; 43 | ContextList::iterator contextIterator; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/P2p/P2pInterfaces.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "P2pInterfaces.h" 19 | 20 | namespace CryptoNote { 21 | 22 | IP2pConnection::~IP2pConnection() { 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/P2p/P2pInterfaces.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | namespace CryptoNote { 26 | 27 | struct P2pMessage { 28 | uint32_t type; 29 | BinaryArray data; 30 | }; 31 | 32 | class IP2pConnection { 33 | public: 34 | virtual ~IP2pConnection(); 35 | virtual void read(P2pMessage &message) = 0; 36 | virtual void write(const P2pMessage &message) = 0; 37 | virtual void ban() = 0; 38 | virtual void stop() = 0; 39 | }; 40 | 41 | class IP2pNode { 42 | public: 43 | virtual std::unique_ptr receiveConnection() = 0; 44 | virtual void stop() = 0; 45 | }; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/P2p/P2pNetworks.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers, The Karbowanec developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include 20 | #include 21 | #include "../CryptoNoteConfig.h" 22 | 23 | #pragma once 24 | 25 | namespace CryptoNote 26 | { 27 | namespace 28 | { 29 | boost::uuids::uuid name; 30 | boost::uuids::name_generator gen(name); 31 | boost::uuids::uuid u = gen(GENESIS_COINBASE_TX_HEX); 32 | } 33 | const static boost::uuids::uuid BYTECOIN_NETWORK = { { 0x78, 0x18, 0x3A, 0x89, 0x15, 0xA5, 0x92, 0xB4, 0x67, 0x12, 0x29, 0x49, 0x19, 0xA1, 0x41, 0x78 } }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/PaymentGate/NodeFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "INode.h" 21 | 22 | #include 23 | 24 | namespace PaymentService { 25 | 26 | class NodeFactory { 27 | public: 28 | static CryptoNote::INode* createNode(const std::string& daemonAddress, uint16_t daemonPort); 29 | static CryptoNote::INode* createNodeStub(); 30 | private: 31 | NodeFactory(); 32 | ~NodeFactory(); 33 | 34 | CryptoNote::INode* getNode(const std::string& daemonAddress, uint16_t daemonPort); 35 | 36 | static NodeFactory factory; 37 | }; 38 | 39 | } //namespace PaymentService 40 | -------------------------------------------------------------------------------- /src/PaymentGate/WalletServiceErrorCategory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "WalletServiceErrorCategory.h" 19 | 20 | namespace CryptoNote { 21 | namespace error { 22 | 23 | WalletServiceErrorCategory WalletServiceErrorCategory::INSTANCE; 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/PaymentGateService/ConfigurationManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "CryptoNoteCore/CoreConfig.h" 21 | #include "PaymentServiceConfiguration.h" 22 | #include "P2p/NetNodeConfig.h" 23 | #include "RpcNodeConfiguration.h" 24 | 25 | namespace PaymentService { 26 | 27 | class ConfigurationManager { 28 | public: 29 | ConfigurationManager(); 30 | bool init(int argc, char** argv); 31 | 32 | bool startInprocess; 33 | Configuration gateConfiguration; 34 | CryptoNote::NetNodeConfig netNodeConfig; 35 | CryptoNote::CoreConfig coreConfig; 36 | RpcNodeConfiguration remoteNodeConfig; 37 | }; 38 | 39 | } //namespace PaymentService 40 | -------------------------------------------------------------------------------- /src/PaymentGateService/RpcNodeConfiguration.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace PaymentService { 24 | 25 | class RpcNodeConfiguration { 26 | public: 27 | RpcNodeConfiguration(); 28 | 29 | static void initOptions(boost::program_options::options_description& desc); 30 | void init(const boost::program_options::variables_map& options); 31 | 32 | std::string daemonHost; 33 | uint16_t daemonPort; 34 | }; 35 | 36 | } //namespace PaymentService 37 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/ErrorMessage.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "ErrorMessage.h" 19 | #include 20 | #include 21 | 22 | namespace System { 23 | 24 | std::string lastErrorMessage() { 25 | return errorMessage(errno); 26 | } 27 | 28 | std::string errorMessage(int err) { 29 | return "result=" + std::to_string(err) + ", " + std::strerror(err); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/ErrorMessage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | std::string lastErrorMessage(); 24 | std::string errorMessage(int); 25 | } 26 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/Future.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | namespace Detail { 25 | 26 | template using Future = std::future; 27 | 28 | template Future async(std::function&& operation) { 29 | return std::async(std::launch::async, std::move(operation)); 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/Ipv4Resolver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class Dispatcher; 25 | class Ipv4Address; 26 | 27 | class Ipv4Resolver { 28 | public: 29 | Ipv4Resolver(); 30 | explicit Ipv4Resolver(Dispatcher& dispatcher); 31 | Ipv4Resolver(const Ipv4Resolver&) = delete; 32 | Ipv4Resolver(Ipv4Resolver&& other); 33 | ~Ipv4Resolver(); 34 | Ipv4Resolver& operator=(const Ipv4Resolver&) = delete; 35 | Ipv4Resolver& operator=(Ipv4Resolver&& other); 36 | Ipv4Address resolve(const std::string& host); 37 | 38 | private: 39 | Dispatcher* dispatcher; 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/TcpConnector.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Dispatcher; 26 | class Ipv4Address; 27 | class TcpConnection; 28 | 29 | class TcpConnector { 30 | public: 31 | TcpConnector(); 32 | TcpConnector(Dispatcher& dispatcher); 33 | TcpConnector(const TcpConnector&) = delete; 34 | TcpConnector(TcpConnector&& other); 35 | ~TcpConnector(); 36 | TcpConnector& operator=(const TcpConnector&) = delete; 37 | TcpConnector& operator=(TcpConnector&& other); 38 | TcpConnection connect(const Ipv4Address& address, uint16_t port); 39 | 40 | private: 41 | void* context; 42 | Dispatcher* dispatcher; 43 | }; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/TcpListener.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Dispatcher; 26 | class Ipv4Address; 27 | class TcpConnection; 28 | 29 | class TcpListener { 30 | public: 31 | TcpListener(); 32 | TcpListener(Dispatcher& dispatcher, const Ipv4Address& address, uint16_t port); 33 | TcpListener(const TcpListener&) = delete; 34 | TcpListener(TcpListener&& other); 35 | ~TcpListener(); 36 | TcpListener& operator=(const TcpListener&) = delete; 37 | TcpListener& operator=(TcpListener&& other); 38 | TcpConnection accept(); 39 | 40 | private: 41 | Dispatcher* dispatcher; 42 | void* context; 43 | int listener; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Platform/Linux/System/Timer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class Dispatcher; 25 | 26 | class Timer { 27 | public: 28 | Timer(); 29 | explicit Timer(Dispatcher& dispatcher); 30 | Timer(const Timer&) = delete; 31 | Timer(Timer&& other); 32 | ~Timer(); 33 | Timer& operator=(const Timer&) = delete; 34 | Timer& operator=(Timer&& other); 35 | void sleep(std::chrono::nanoseconds duration); 36 | 37 | private: 38 | Dispatcher* dispatcher; 39 | void* context; 40 | int timer; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/Context.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include "Context.h" 20 | 21 | void 22 | makecontext(uctx *ucp, void (*func)(void), intptr_t arg) 23 | { 24 | long *sp; 25 | 26 | memset(&ucp->uc_mcontext, 0, sizeof ucp->uc_mcontext); 27 | ucp->uc_mcontext.mc_rdi = (long)arg; 28 | sp = (long*)ucp->uc_stack.ss_sp+ucp->uc_stack.ss_size/sizeof(long); 29 | sp -= 1; 30 | sp = (void*)((uintptr_t)sp - (uintptr_t)sp%16); /* 16-align for OS X */ 31 | *--sp = 0; /* return address */ 32 | ucp->uc_mcontext.mc_rip = (long)func; 33 | ucp->uc_mcontext.mc_rsp = (long)sp; 34 | } 35 | 36 | int 37 | swapcontext(uctx *oucp, const uctx *ucp) 38 | { 39 | if(getcontext(oucp) == 0) 40 | setcontext(ucp); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/ErrorMessage.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "ErrorMessage.h" 19 | #include 20 | #include 21 | 22 | namespace System { 23 | 24 | std::string lastErrorMessage() { 25 | return errorMessage(errno); 26 | } 27 | 28 | std::string errorMessage(int err) { 29 | return "result=" + std::to_string(err) + ", " + std::strerror(err); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/ErrorMessage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | std::string lastErrorMessage(); 24 | std::string errorMessage(int); 25 | } 26 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/Ipv4Resolver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class Dispatcher; 25 | class Ipv4Address; 26 | 27 | class Ipv4Resolver { 28 | public: 29 | Ipv4Resolver(); 30 | explicit Ipv4Resolver(Dispatcher& dispatcher); 31 | Ipv4Resolver(const Ipv4Resolver&) = delete; 32 | Ipv4Resolver(Ipv4Resolver&& other); 33 | ~Ipv4Resolver(); 34 | Ipv4Resolver& operator=(const Ipv4Resolver&) = delete; 35 | Ipv4Resolver& operator=(Ipv4Resolver&& other); 36 | Ipv4Address resolve(const std::string& host); 37 | 38 | private: 39 | Dispatcher* dispatcher; 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/TcpConnector.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Dispatcher; 26 | class Ipv4Address; 27 | class TcpConnection; 28 | 29 | class TcpConnector { 30 | public: 31 | TcpConnector(); 32 | TcpConnector(Dispatcher& dispatcher); 33 | TcpConnector(const TcpConnector&) = delete; 34 | TcpConnector(TcpConnector&& other); 35 | ~TcpConnector(); 36 | TcpConnector& operator=(const TcpConnector&) = delete; 37 | TcpConnector& operator=(TcpConnector&& other); 38 | TcpConnection connect(const Ipv4Address& address, uint16_t port); 39 | 40 | private: 41 | void* context; 42 | Dispatcher* dispatcher; 43 | }; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/TcpListener.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Dispatcher; 26 | class Ipv4Address; 27 | class TcpConnection; 28 | 29 | class TcpListener { 30 | public: 31 | TcpListener(); 32 | TcpListener(Dispatcher& dispatcher, const Ipv4Address& address, uint16_t port); 33 | TcpListener(const TcpListener&) = delete; 34 | TcpListener(TcpListener&& other); 35 | ~TcpListener(); 36 | TcpListener& operator=(const TcpListener&) = delete; 37 | TcpListener& operator=(TcpListener&& other); 38 | TcpConnection accept(); 39 | 40 | private: 41 | Dispatcher* dispatcher; 42 | int listener; 43 | void* context; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/Timer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class Dispatcher; 25 | 26 | class Timer { 27 | public: 28 | Timer(); 29 | explicit Timer(Dispatcher& dispatcher); 30 | Timer(const Timer&) = delete; 31 | Timer(Timer&& other); 32 | ~Timer(); 33 | Timer& operator=(const Timer&) = delete; 34 | Timer& operator=(Timer&& other); 35 | void sleep(std::chrono::nanoseconds duration); 36 | 37 | private: 38 | Dispatcher* dispatcher; 39 | int timer; 40 | void* context; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/Platform/OSX/System/asm.s: -------------------------------------------------------------------------------- 1 | .globl _setmcontext 2 | _setmcontext: 3 | movq 16(%rdi), %rsi 4 | movq 24(%rdi), %rdx 5 | movq 32(%rdi), %rcx 6 | movq 40(%rdi), %r8 7 | movq 48(%rdi), %r9 8 | movq 56(%rdi), %rax 9 | movq 64(%rdi), %rbx 10 | movq 72(%rdi), %rbp 11 | movq 80(%rdi), %r10 12 | movq 88(%rdi), %r11 13 | movq 96(%rdi), %r12 14 | movq 104(%rdi), %r13 15 | movq 112(%rdi), %r14 16 | movq 120(%rdi), %r15 17 | movq 184(%rdi), %rsp 18 | pushq 160(%rdi) /* new %eip */ 19 | movq 8(%rdi), %rdi 20 | ret 21 | 22 | .globl _getmcontext 23 | _getmcontext: 24 | movq %rdi, 8(%rdi) 25 | movq %rsi, 16(%rdi) 26 | movq %rdx, 24(%rdi) 27 | movq %rcx, 32(%rdi) 28 | movq %r8, 40(%rdi) 29 | movq %r9, 48(%rdi) 30 | movq $1, 56(%rdi) /* %rax */ 31 | movq %rbx, 64(%rdi) 32 | movq %rbp, 72(%rdi) 33 | movq %r10, 80(%rdi) 34 | movq %r11, 88(%rdi) 35 | movq %r12, 96(%rdi) 36 | movq %r13, 104(%rdi) 37 | movq %r14, 112(%rdi) 38 | movq %r15, 120(%rdi) 39 | 40 | movq (%rsp), %rcx /* %rip */ 41 | movq %rcx, 160(%rdi) 42 | leaq 8(%rsp), %rcx /* %rsp */ 43 | movq %rcx, 184(%rdi) 44 | 45 | movq 32(%rdi), %rcx /* restore %rcx */ 46 | movq $0, %rax 47 | ret -------------------------------------------------------------------------------- /src/Platform/Windows/System/ErrorMessage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | std::string lastErrorMessage(); 25 | std::string errorMessage(int); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/Platform/Windows/System/Future.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | namespace Detail { 25 | 26 | template using Future = std::future; 27 | 28 | template Future async(std::function&& operation) { 29 | return std::async(std::launch::async, std::move(operation)); 30 | } 31 | 32 | } 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Platform/Windows/System/Ipv4Resolver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class Dispatcher; 25 | class Ipv4Address; 26 | 27 | class Ipv4Resolver { 28 | public: 29 | Ipv4Resolver(); 30 | explicit Ipv4Resolver(Dispatcher& dispatcher); 31 | Ipv4Resolver(const Ipv4Resolver&) = delete; 32 | Ipv4Resolver(Ipv4Resolver&& other); 33 | ~Ipv4Resolver(); 34 | Ipv4Resolver& operator=(const Ipv4Resolver&) = delete; 35 | Ipv4Resolver& operator=(Ipv4Resolver&& other); 36 | Ipv4Address resolve(const std::string& host); 37 | 38 | private: 39 | Dispatcher* dispatcher; 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/Platform/Windows/System/TcpConnector.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Dispatcher; 26 | class Ipv4Address; 27 | class TcpConnection; 28 | 29 | class TcpConnector { 30 | public: 31 | TcpConnector(); 32 | explicit TcpConnector(Dispatcher& dispatcher); 33 | TcpConnector(const TcpConnector&) = delete; 34 | TcpConnector(TcpConnector&& other); 35 | ~TcpConnector(); 36 | TcpConnector& operator=(const TcpConnector&) = delete; 37 | TcpConnector& operator=(TcpConnector&& other); 38 | TcpConnection connect(const Ipv4Address& address, uint16_t port); 39 | 40 | private: 41 | Dispatcher* dispatcher; 42 | void* context; 43 | }; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/Platform/Windows/System/TcpListener.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Dispatcher; 26 | class Ipv4Address; 27 | class TcpConnection; 28 | 29 | class TcpListener { 30 | public: 31 | TcpListener(); 32 | TcpListener(Dispatcher& dispatcher, const Ipv4Address& address, uint16_t port); 33 | TcpListener(const TcpListener&) = delete; 34 | TcpListener(TcpListener&& other); 35 | ~TcpListener(); 36 | TcpListener& operator=(const TcpListener&) = delete; 37 | TcpListener& operator=(TcpListener&& other); 38 | TcpConnection accept(); 39 | 40 | private: 41 | Dispatcher* dispatcher; 42 | size_t listener; 43 | void* context; 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/Platform/Windows/System/Timer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class Dispatcher; 25 | 26 | class Timer { 27 | public: 28 | Timer(); 29 | explicit Timer(Dispatcher& dispatcher); 30 | Timer(const Timer&) = delete; 31 | Timer(Timer&& other); 32 | ~Timer(); 33 | Timer& operator=(const Timer&) = delete; 34 | Timer& operator=(Timer&& other); 35 | void sleep(std::chrono::nanoseconds duration); 36 | 37 | private: 38 | Dispatcher* dispatcher; 39 | void* context; 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/Platform/mingw/alloca.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | -------------------------------------------------------------------------------- /src/Platform/msc/alloca.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #ifndef __cplusplus 21 | #define alloca(size) _alloca(size) 22 | #endif 23 | -------------------------------------------------------------------------------- /src/Platform/msc/stdbool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #if !defined(__cplusplus) 21 | 22 | typedef int bool; 23 | #define true 1 24 | #define false 0 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/Platform/msc/sys/param.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #define LITTLE_ENDIAN 1234 21 | #define BIG_ENDIAN 4321 22 | #define PDP_ENDIAN 3412 23 | #define BYTE_ORDER LITTLE_ENDIAN 24 | -------------------------------------------------------------------------------- /src/Rpc/CoreRpcServerErrorCodes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | 21 | #define CORE_RPC_ERROR_CODE_WRONG_PARAM -1 22 | #define CORE_RPC_ERROR_CODE_TOO_BIG_HEIGHT -2 23 | #define CORE_RPC_ERROR_CODE_TOO_BIG_RESERVE_SIZE -3 24 | #define CORE_RPC_ERROR_CODE_WRONG_WALLET_ADDRESS -4 25 | #define CORE_RPC_ERROR_CODE_INTERNAL_ERROR -5 26 | #define CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB -6 27 | #define CORE_RPC_ERROR_CODE_BLOCK_NOT_ACCEPTED -7 28 | #define CORE_RPC_ERROR_CODE_CORE_BUSY -9 29 | -------------------------------------------------------------------------------- /src/Rpc/RpcServerConfig.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace CryptoNote { 23 | 24 | class RpcServerConfig { 25 | public: 26 | 27 | RpcServerConfig(); 28 | 29 | static void initOptions(boost::program_options::options_description& desc); 30 | void init(const boost::program_options::variables_map& options); 31 | 32 | std::string getBindAddress() const; 33 | 34 | std::string bindIp; 35 | uint16_t bindPort; 36 | }; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/Serialization/IStream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | 25 | class IInputStream { 26 | public: 27 | virtual size_t read(char* data, size_t size) = 0; 28 | }; 29 | 30 | class IOutputStream { 31 | public: 32 | virtual void write(const char* data, size_t size) = 0; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Serialization/JsonInputStreamSerializer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "Serialization/JsonInputStreamSerializer.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | 25 | namespace { 26 | 27 | Common::JsonValue getJsonValueFromStreamHelper(std::istream& stream) { 28 | Common::JsonValue value; 29 | stream >> value; 30 | return value; 31 | } 32 | 33 | } 34 | 35 | JsonInputStreamSerializer::JsonInputStreamSerializer(std::istream& stream) : JsonInputValueSerializer(getJsonValueFromStreamHelper(stream)) { 36 | } 37 | 38 | JsonInputStreamSerializer::~JsonInputStreamSerializer() { 39 | } 40 | 41 | } //namespace CryptoNote 42 | -------------------------------------------------------------------------------- /src/Serialization/JsonInputStreamSerializer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | #include "../Common/JsonValue.h" 24 | #include "JsonInputValueSerializer.h" 25 | 26 | namespace CryptoNote { 27 | 28 | //deserialization 29 | class JsonInputStreamSerializer : public JsonInputValueSerializer { 30 | public: 31 | JsonInputStreamSerializer(std::istream& stream); 32 | virtual ~JsonInputStreamSerializer(); 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Serialization/KVBinaryInputStreamSerializer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include "ISerializer.h" 22 | #include "JsonInputValueSerializer.h" 23 | 24 | namespace CryptoNote { 25 | 26 | class KVBinaryInputStreamSerializer : public JsonInputValueSerializer { 27 | public: 28 | KVBinaryInputStreamSerializer(Common::IInputStream& strm); 29 | 30 | virtual bool binary(void* value, size_t size, Common::StringView name) override; 31 | virtual bool binary(std::string& value, Common::StringView name) override; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/Serialization/MemoryStream.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "MemoryStream.h" 19 | -------------------------------------------------------------------------------- /src/System/ContextGroup.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class ContextGroup { 25 | public: 26 | explicit ContextGroup(Dispatcher& dispatcher); 27 | ContextGroup(const ContextGroup&) = delete; 28 | ContextGroup(ContextGroup&& other); 29 | ~ContextGroup(); 30 | ContextGroup& operator=(const ContextGroup&) = delete; 31 | ContextGroup& operator=(ContextGroup&& other); 32 | void interrupt(); 33 | void spawn(std::function&& procedure); 34 | void wait(); 35 | 36 | private: 37 | Dispatcher* dispatcher; 38 | NativeContextGroup contextGroup; 39 | }; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/System/ContextGroupTimeout.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "ContextGroupTimeout.h" 19 | #include 20 | 21 | using namespace System; 22 | 23 | ContextGroupTimeout::ContextGroupTimeout(Dispatcher& dispatcher, ContextGroup& contextGroup, std::chrono::nanoseconds timeout) : 24 | workingContextGroup(dispatcher), 25 | timeoutTimer(dispatcher) { 26 | workingContextGroup.spawn([&, timeout] { 27 | try { 28 | timeoutTimer.sleep(timeout); 29 | contextGroup.interrupt(); 30 | } catch (InterruptedException&) { 31 | } 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /src/System/ContextGroupTimeout.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | #include 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class ContextGroupTimeout { 26 | public: 27 | ContextGroupTimeout(Dispatcher&, ContextGroup&, std::chrono::nanoseconds); 28 | 29 | private: 30 | Timer timeoutTimer; 31 | ContextGroup workingContextGroup; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/System/Event.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace System { 21 | 22 | class Dispatcher; 23 | 24 | class Event { 25 | public: 26 | Event(); 27 | explicit Event(Dispatcher& dispatcher); 28 | Event(const Event&) = delete; 29 | Event(Event&& other); 30 | ~Event(); 31 | Event& operator=(const Event&) = delete; 32 | Event& operator=(Event&& other); 33 | bool get() const; 34 | void clear(); 35 | void set(); 36 | void wait(); 37 | 38 | private: 39 | Dispatcher* dispatcher; 40 | bool state; 41 | void* first; 42 | void* last; 43 | }; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/System/EventLock.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "EventLock.h" 19 | #include 20 | 21 | namespace System { 22 | 23 | EventLock::EventLock(Event& event) : event(event) { 24 | while (!event.get()) { 25 | event.wait(); 26 | } 27 | 28 | event.clear(); 29 | } 30 | 31 | EventLock::~EventLock() { 32 | event.set(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/System/EventLock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace System { 21 | 22 | class Event; 23 | 24 | class EventLock { 25 | public: 26 | explicit EventLock(Event& event); 27 | ~EventLock(); 28 | EventLock& operator=(const EventLock&) = delete; 29 | 30 | private: 31 | Event& event; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/System/InterruptedException.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "InterruptedException.h" 19 | 20 | namespace { 21 | char suppressMSVCWarningLNK4221; 22 | } 23 | -------------------------------------------------------------------------------- /src/System/InterruptedException.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace System { 23 | 24 | class InterruptedException : public std::exception { 25 | public: 26 | virtual const char* what() const throw() override { 27 | return "interrupted"; 28 | } 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/System/Ipv4Address.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace System { 24 | 25 | class Ipv4Address { 26 | public: 27 | explicit Ipv4Address(uint32_t value); 28 | explicit Ipv4Address(const std::string& dottedDecimal); 29 | bool operator!=(const Ipv4Address& other) const; 30 | bool operator==(const Ipv4Address& other) const; 31 | uint32_t getValue() const; 32 | bool isLoopback() const; 33 | bool isPrivate() const; 34 | std::string toDottedDecimal() const; 35 | 36 | private: 37 | uint32_t value; 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/System/RemoteEventLock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | namespace System { 21 | 22 | class Dispatcher; 23 | class Event; 24 | 25 | class RemoteEventLock { 26 | public: 27 | RemoteEventLock(Dispatcher& dispatcher, Event& event); 28 | ~RemoteEventLock(); 29 | 30 | private: 31 | Dispatcher& dispatcher; 32 | Event& event; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Transfers/CommonTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "INode.h" 27 | #include "ITransaction.h" 28 | 29 | namespace CryptoNote { 30 | 31 | struct BlockchainInterval { 32 | uint32_t startHeight; 33 | std::vector blocks; 34 | }; 35 | 36 | struct CompleteBlock { 37 | Crypto::Hash blockHash; 38 | boost::optional block; 39 | // first transaction is always coinbase 40 | std::list> transactions; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/Transfers/IObservableImpl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "Common/ObserverManager.h" 21 | 22 | namespace CryptoNote { 23 | 24 | template 25 | class IObservableImpl : public Base { 26 | public: 27 | 28 | virtual void addObserver(Observer* observer) override { 29 | m_observerManager.add(observer); 30 | } 31 | 32 | virtual void removeObserver(Observer* observer) override { 33 | m_observerManager.remove(observer); 34 | } 35 | 36 | protected: 37 | Tools::ObserverManager m_observerManager; 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/Transfers/TypeHelpers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "ITransaction.h" 21 | #include 22 | #include 23 | 24 | namespace CryptoNote { 25 | 26 | inline bool operator==(const AccountPublicAddress &_v1, const AccountPublicAddress &_v2) { 27 | return memcmp(&_v1, &_v2, sizeof(AccountPublicAddress)) == 0; 28 | } 29 | 30 | } 31 | 32 | namespace std { 33 | 34 | template<> 35 | struct hash < CryptoNote::AccountPublicAddress > { 36 | size_t operator()(const CryptoNote::AccountPublicAddress& val) const { 37 | size_t spend = *(reinterpret_cast(&val.spendPublicKey)); 38 | size_t view = *(reinterpret_cast(&val.viewPublicKey)); 39 | return spend ^ view; 40 | } 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/Wallet/IFusionManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | 25 | class IFusionManager { 26 | public: 27 | struct EstimateResult { 28 | size_t fusionReadyCount; 29 | size_t totalOutputCount; 30 | }; 31 | 32 | virtual ~IFusionManager() {} 33 | 34 | virtual size_t createFusionTransaction(uint64_t threshold, uint64_t mixin, 35 | const std::vector& sourceAddresses = {}, const std::string& destinationAddress = "") = 0; 36 | virtual bool isFusionTransaction(size_t transactionId) const = 0; 37 | virtual EstimateResult estimate(uint64_t threshold, const std::vector& sourceAddresses = {}) const = 0; 38 | }; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/Wallet/LegacyKeysImporter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | 23 | namespace CryptoNote { 24 | 25 | void importLegacyKeys(const std::string& legacyKeysFilename, const std::string& password, std::ostream& destination); 26 | 27 | } //namespace CryptoNote 28 | -------------------------------------------------------------------------------- /src/Wallet/WalletAsyncContextCounter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "WalletAsyncContextCounter.h" 19 | 20 | namespace CryptoNote { 21 | 22 | void WalletAsyncContextCounter::addAsyncContext() { 23 | std::unique_lock lock(m_mutex); 24 | m_asyncContexts++; 25 | } 26 | 27 | void WalletAsyncContextCounter::delAsyncContext() { 28 | std::unique_lock lock(m_mutex); 29 | m_asyncContexts--; 30 | 31 | if (!m_asyncContexts) m_cv.notify_one(); 32 | } 33 | 34 | void WalletAsyncContextCounter::waitAsyncContextsFinish() { 35 | std::unique_lock lock(m_mutex); 36 | while (m_asyncContexts > 0) 37 | m_cv.wait(lock); 38 | } 39 | 40 | } //namespace CryptoNote 41 | -------------------------------------------------------------------------------- /src/Wallet/WalletAsyncContextCounter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace CryptoNote { 25 | 26 | class WalletAsyncContextCounter 27 | { 28 | public: 29 | WalletAsyncContextCounter() : m_asyncContexts(0) {} 30 | 31 | void addAsyncContext(); 32 | void delAsyncContext(); 33 | 34 | //returns true if contexts are finished before timeout 35 | void waitAsyncContextsFinish(); 36 | 37 | private: 38 | uint32_t m_asyncContexts; 39 | std::condition_variable m_cv; 40 | std::mutex m_mutex; 41 | }; 42 | 43 | } //namespace CryptoNote 44 | -------------------------------------------------------------------------------- /src/Wallet/WalletErrors.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include "WalletErrors.h" 19 | 20 | namespace CryptoNote { 21 | namespace error { 22 | 23 | WalletErrorCategory WalletErrorCategory::INSTANCE; 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Wallet/WalletRpcServerErrorCodes.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | 21 | #define WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR -1 22 | #define WALLET_RPC_ERROR_CODE_WRONG_ADDRESS -2 23 | #define WALLET_RPC_ERROR_CODE_DAEMON_IS_BUSY -3 24 | #define WALLET_RPC_ERROR_CODE_GENERIC_TRANSFER_ERROR -4 25 | #define WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID -5 26 | -------------------------------------------------------------------------------- /src/WalletLegacy/KeysStorage.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include "crypto/crypto.h" 21 | 22 | #include 23 | 24 | namespace CryptoNote { 25 | 26 | class ISerializer; 27 | 28 | //This is DTO structure. Do not change it. 29 | struct KeysStorage { 30 | uint64_t creationTimestamp; 31 | 32 | Crypto::PublicKey spendPublicKey; 33 | Crypto::SecretKey spendSecretKey; 34 | 35 | Crypto::PublicKey viewPublicKey; 36 | Crypto::SecretKey viewSecretKey; 37 | 38 | void serialize(ISerializer& serializer, const std::string& name); 39 | }; 40 | 41 | } //namespace CryptoNote 42 | -------------------------------------------------------------------------------- /src/WalletLegacy/WalletLegacySerialization.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "IWalletLegacy.h" 25 | 26 | namespace CryptoNote { 27 | class ISerializer; 28 | 29 | struct UnconfirmedTransferDetails; 30 | struct WalletLegacyTransaction; 31 | struct WalletLegacyTransfer; 32 | 33 | void serialize(UnconfirmedTransferDetails& utd, ISerializer& serializer); 34 | void serialize(WalletLegacyTransaction& txi, ISerializer& serializer); 35 | void serialize(WalletLegacyTransfer& tr, ISerializer& serializer); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/crypto/blake256.h: -------------------------------------------------------------------------------- 1 | #ifndef _BLAKE256_H_ 2 | #define _BLAKE256_H_ 3 | 4 | #include 5 | 6 | typedef struct { 7 | uint32_t h[8], s[4], t[2]; 8 | int buflen, nullt; 9 | uint8_t buf[64]; 10 | } state; 11 | 12 | typedef struct { 13 | state inner; 14 | state outer; 15 | } hmac_state; 16 | 17 | void blake256_init(state *); 18 | void blake224_init(state *); 19 | 20 | void blake256_update(state *, const uint8_t *, uint64_t); 21 | void blake224_update(state *, const uint8_t *, uint64_t); 22 | 23 | void blake256_final(state *, uint8_t *); 24 | void blake224_final(state *, uint8_t *); 25 | 26 | void blake256_hash(uint8_t *, const uint8_t *, uint64_t); 27 | void blake224_hash(uint8_t *, const uint8_t *, uint64_t); 28 | 29 | /* HMAC functions: */ 30 | 31 | void hmac_blake256_init(hmac_state *, const uint8_t *, uint64_t); 32 | void hmac_blake224_init(hmac_state *, const uint8_t *, uint64_t); 33 | 34 | void hmac_blake256_update(hmac_state *, const uint8_t *, uint64_t); 35 | void hmac_blake224_update(hmac_state *, const uint8_t *, uint64_t); 36 | 37 | void hmac_blake256_final(hmac_state *, uint8_t *); 38 | void hmac_blake224_final(hmac_state *, uint8_t *); 39 | 40 | void hmac_blake256_hash(uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint64_t); 41 | void hmac_blake224_hash(uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint64_t); 42 | 43 | #endif /* _BLAKE256_H_ */ 44 | -------------------------------------------------------------------------------- /src/crypto/hash-extra-blake.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include 20 | 21 | #include "blake256.h" 22 | 23 | void hash_extra_blake(const void *data, size_t length, char *hash) { 24 | blake256_hash((uint8_t*)hash, data, length); 25 | } 26 | -------------------------------------------------------------------------------- /src/crypto/hash-extra-groestl.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include 20 | 21 | #include "groestl.h" 22 | 23 | void hash_extra_groestl(const void *data, size_t length, char *hash) { 24 | groestl(data, length * 8, (uint8_t*)hash); 25 | } 26 | -------------------------------------------------------------------------------- /src/crypto/hash-extra-jh.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "jh.h" 24 | #include "hash-ops.h" 25 | 26 | void hash_extra_jh(const void *data, size_t length, char *hash) { 27 | int r = jh_hash(HASH_SIZE * 8, data, 8 * length, (uint8_t*)hash); 28 | assert(SUCCESS == r); 29 | } 30 | -------------------------------------------------------------------------------- /src/crypto/hash-extra-skein.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include 20 | 21 | #include "hash-ops.h" 22 | #include "skein.h" 23 | 24 | void hash_extra_skein(const void *data, size_t length, char *hash) { 25 | int r = skein_hash(8 * HASH_SIZE, data, 8 * length, (uint8_t*)hash); 26 | assert(SKEIN_SUCCESS == r); 27 | } 28 | -------------------------------------------------------------------------------- /src/crypto/hash.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "hash-ops.h" 23 | #include "keccak.h" 24 | 25 | void hash_permutation(union hash_state *state) { 26 | keccakf((uint64_t*)state, 24); 27 | } 28 | 29 | void hash_process(union hash_state *state, const uint8_t *buf, size_t count) { 30 | keccak1600(buf, (int)count, (uint8_t*)state); 31 | } 32 | 33 | void cn_fast_hash(const void *data, size_t length, char *hash) { 34 | union hash_state state; 35 | hash_process(&state, data, length); 36 | memcpy(hash, &state, HASH_SIZE); 37 | } 38 | -------------------------------------------------------------------------------- /src/crypto/jh.h: -------------------------------------------------------------------------------- 1 | /*This program gives the 64-bit optimized bitslice implementation of JH using ANSI C 2 | 3 | -------------------------------- 4 | Performance 5 | 6 | Microprocessor: Intel CORE 2 processor (Core 2 Duo Mobile T6600 2.2GHz) 7 | Operating System: 64-bit Ubuntu 10.04 (Linux kernel 2.6.32-22-generic) 8 | Speed for long message: 9 | 1) 45.8 cycles/byte compiler: Intel C++ Compiler 11.1 compilation option: icc -O2 10 | 2) 56.8 cycles/byte compiler: gcc 4.4.3 compilation option: gcc -O3 11 | 12 | -------------------------------- 13 | Last Modified: January 16, 2011 14 | */ 15 | #pragma once 16 | 17 | typedef unsigned char BitSequence; 18 | typedef unsigned long long DataLength; 19 | typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn; 20 | 21 | HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval); 22 | -------------------------------------------------------------------------------- /src/crypto/keccak.h: -------------------------------------------------------------------------------- 1 | // keccak.h 2 | // 19-Nov-11 Markku-Juhani O. Saarinen 3 | 4 | #ifndef KECCAK_H 5 | #define KECCAK_H 6 | 7 | #include 8 | #include 9 | 10 | #ifndef KECCAK_ROUNDS 11 | #define KECCAK_ROUNDS 24 12 | #endif 13 | 14 | #ifndef ROTL64 15 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) 16 | #endif 17 | 18 | // compute a keccak hash (md) of given byte length from "in" 19 | int keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen); 20 | 21 | // update the state 22 | void keccakf(uint64_t st[25], int norounds); 23 | 24 | void keccak1600(const uint8_t *in, int inlen, uint8_t *md); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/crypto/random.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2016, The CryptoNote developers, The Bytecoin developers 2 | // 3 | // This file is part of Bytecoin. 4 | // 5 | // Bytecoin is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Lesser General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // Bytecoin is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Lesser General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Lesser General Public License 16 | // along with Bytecoin. If not, see . 17 | 18 | #pragma once 19 | 20 | #if !defined(__cplusplus) 21 | #include 22 | #endif 23 | 24 | void generate_random_bytes(size_t n, void *result); 25 | -------------------------------------------------------------------------------- /src/version.cmake: -------------------------------------------------------------------------------- 1 | execute_process(COMMAND "${GIT}" describe --always --dirty --match "v*" RESULT_VARIABLE RET OUTPUT_VARIABLE DESCRIPTION OUTPUT_STRIP_TRAILING_WHITESPACE) 2 | if(RET) 3 | message(WARNING "Cannot determine current revision. Make sure that you are building either from a Git working tree or from a source archive.") 4 | set(VERSION "${COMMIT}") 5 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in" "${TO}") 6 | else() 7 | string(REGEX MATCH "([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f])?(-dirty)? $" COMMIT "${DESCRIPTION} ") 8 | string(STRIP "${COMMIT}" COMMIT) 9 | set(VERSION "${COMMIT}") 10 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in" "${TO}") 11 | endif() -------------------------------------------------------------------------------- /src/version.h.in: -------------------------------------------------------------------------------- 1 | #define BUILD_COMMIT_ID "@VERSION@" 2 | #define PROJECT_VERSION "1.4.7" 3 | #define PROJECT_VERSION_BUILD_NO "1" 4 | #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO " (" BUILD_COMMIT_ID ")" 5 | -------------------------------------------------------------------------------- /utils/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea -------------------------------------------------------------------------------- /utils/munin_plugins/alt_blocks_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title alt_blocks_count 7 | graph_vlabel alt_blocks_count 8 | graph_category bytecoin 9 | alt_blocks_count.label alt_blocks_count 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "alt_blocks_count.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep alt_blocks_count | cut -d ' ' -f2 16 | -------------------------------------------------------------------------------- /utils/munin_plugins/difficulty: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title difficulty 7 | graph_vlabel difficulty 8 | graph_category bytecoin 9 | difficulty.label difficulty 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "difficulty.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep difficulty | cut -d ' ' -f2 16 | -------------------------------------------------------------------------------- /utils/munin_plugins/grey_peerlist_size: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title grey_peerlist_size 7 | graph_vlabel grey_peerlist_size 8 | graph_category bytecoin 9 | grey_peerlist_size.label grey_peerlist_size 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "grey_peerlist_size.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep grey_peerlist_size | cut -d ' ' -f2 16 | -------------------------------------------------------------------------------- /utils/munin_plugins/height: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title Height 7 | graph_vlabel height 8 | graph_category bytecoin 9 | height.label height 10 | height.type COUNTER 11 | EOM 12 | exit 0;; 13 | esac 14 | 15 | printf "height.value " 16 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep height | cut -d ' ' -f2 17 | -------------------------------------------------------------------------------- /utils/munin_plugins/incoming_connections_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title incoming_connections_count 7 | graph_vlabel incoming_connections_count 8 | graph_category bytecoin 9 | incoming_connections_count.label incoming_connections_count 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "incoming_connections_count.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep incoming_connections_count | cut -d ' ' -f2 16 | -------------------------------------------------------------------------------- /utils/munin_plugins/outgoing_connections_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title outgoing_connections_count 7 | graph_vlabel outgoing_connections_count 8 | graph_category bytecoin 9 | outgoing_connections_count.label outgoing_connections_count 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "outgoing_connections_count.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep outgoing_connections_count | cut -d ' ' -f2 16 | -------------------------------------------------------------------------------- /utils/munin_plugins/tx_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title tx_count 7 | graph_vlabel tx_count 8 | graph_category bytecoin 9 | tx_count.label tx_count 10 | tx_count.type COUNTER 11 | EOM 12 | exit 0;; 13 | esac 14 | 15 | printf "tx_count.value " 16 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep tx_count| cut -d ' ' -f2 17 | -------------------------------------------------------------------------------- /utils/munin_plugins/tx_pool_size: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title tx_pool_size 7 | graph_vlabel tx_pool_size 8 | graph_category bytecoin 9 | tx_pool_size.label tx_pool_size 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "tx_pool_size.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep tx_pool_size| cut -d ' ' -f2 16 | -------------------------------------------------------------------------------- /utils/munin_plugins/white_peerlist_size: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | case $1 in 4 | config) 5 | cat <<'EOM' 6 | graph_title white_peerlist_size 7 | graph_vlabel white_peerlist_size 8 | graph_category bytecoin 9 | white_peerlist_size.label white_peerlist_size 10 | EOM 11 | exit 0;; 12 | esac 13 | 14 | printf "white_peerlist_size.value " 15 | /home/user/bytecoin_bin/connectivity_tool --ip=127.0.0.1 --rpc_port=8081 --timeout=1000 --rpc_get_daemon_info | grep white_peerlist_size | cut -d ' ' -f2 16 | --------------------------------------------------------------------------------