mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Reorganize source files and modules
This commit is contained in:
@@ -69,7 +69,9 @@ SOURCES += \
|
||||
../../src/ripple/json/ripple_json.cpp \
|
||||
../../src/ripple/rpc/ripple_rpc.cpp \
|
||||
../../src/ripple/sophia/ripple_sophia.c \
|
||||
../../src/ripple/sslutil/ripple_sslutil.cpp \
|
||||
../../src/ripple/testoverlay/ripple_testoverlay.cpp \
|
||||
../../src/ripple/types/ripple_types.cpp \
|
||||
../../src/ripple/validators/ripple_validators.cpp
|
||||
|
||||
# ---------
|
||||
|
||||
@@ -86,6 +86,25 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\rpc\ripple_rpc.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\sophia\ripple_sophia.c" />
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\impl\CBigNum.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\impl\DHUtil.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\impl\HashUtilities.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\ripple_sslutil.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\testoverlay\impl\TestOverlay.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -93,6 +112,49 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\testoverlay\ripple_testoverlay.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\Base58.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\ByteOrder.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\RandomNumbers.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\strHex.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UInt128.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UInt160.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UInt256.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\ripple_types.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple\validators\impl\Manager.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -466,6 +528,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_app\peers\PackedMessage.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_app\peers\PeerDoor.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -768,42 +836,18 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\ripple_basics.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple_basics\types\UInt256.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\ByteOrder.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\CountedObject.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\DiffieHellmanUtil.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\IniFile.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\RandomNumbers.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\StringUtilities.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -979,24 +1023,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_core\ripple_core.cpp" />
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\Base58.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\Base58Data.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\CBigNum.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\CKey.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1039,12 +1071,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\protocol\PackedMessage.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\protocol\RippleAddress.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1561,6 +1587,12 @@
|
||||
<ClInclude Include="..\..\src\ripple\rpc\impl\ManagerImpl.h" />
|
||||
<ClInclude Include="..\..\src\ripple\rpc\ripple_rpc.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sophia\ripple_sophia.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\bignum_error.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\CAutoBN_CTX.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\CBigNum.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\DHUtil.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\HashUtilities.h" />
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\ripple_sslutil.h" />
|
||||
<ClInclude Include="..\..\src\ripple\testoverlay\api\ConfigType.h" />
|
||||
<ClInclude Include="..\..\src\ripple\testoverlay\api\ConnectionType.h" />
|
||||
<ClInclude Include="..\..\src\ripple\testoverlay\api\InitPolicy.h" />
|
||||
@@ -1572,6 +1604,17 @@
|
||||
<ClInclude Include="..\..\src\ripple\testoverlay\api\SimplePayload.h" />
|
||||
<ClInclude Include="..\..\src\ripple\testoverlay\api\StateBase.h" />
|
||||
<ClInclude Include="..\..\src\ripple\testoverlay\ripple_testoverlay.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\Base58.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\base_uint.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\Blob.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\HashMaps.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\strHex.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\UInt128.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\UInt160.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\api\UInt256.h" />
|
||||
<ClInclude Include="..\..\src\ripple\types\ripple_types.h" />
|
||||
<ClInclude Include="..\..\src\ripple\validators\api\Source.h" />
|
||||
<ClInclude Include="..\..\src\ripple\validators\api\Types.h" />
|
||||
<ClInclude Include="..\..\src\ripple\validators\api\Manager.h" />
|
||||
@@ -1641,6 +1684,7 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\paths\RippleCalc.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\paths\RippleLineCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\paths\RippleState.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\peers\PackedMessage.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\peers\PeerDoor.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\peers\ClusterNodeStatus.h" />
|
||||
<ClInclude Include="..\..\src\ripple_app\peers\Peers.h" />
|
||||
@@ -1679,7 +1723,6 @@
|
||||
<ClInclude Include="..\..\src\ripple_app\websocket\WSServerHandler.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\KeyCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\RangeSet.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\SecureAllocator.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\TaggedCache.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\Log.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\LogFile.h" />
|
||||
@@ -1690,18 +1733,12 @@
|
||||
<ClInclude Include="..\..\src\ripple_basics\log\LogSink.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\ripple_basics.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\BoostIncludes.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\OpenSSLIncludes.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\StandardIncludes.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\BasicTypes.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\HashMaps.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\UInt256.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\ByteOrder.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\RipplePublicKey.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\RipplePublicKeyHash.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\CountedObject.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\DiffieHellmanUtil.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\HashUtilities.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\IniFile.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\PlatformMacros.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\RandomNumbers.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\StringUtilities.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\Sustain.h" />
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\ThreadName.h" />
|
||||
@@ -1742,16 +1779,13 @@
|
||||
<ClInclude Include="..\..\src\ripple_core\nodestore\tests\TestBase.h" />
|
||||
<ClInclude Include="..\..\src\ripple_core\peerfinder\PeerFinder.h" />
|
||||
<ClInclude Include="..\..\src\ripple_core\ripple_core.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\Base58.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\Base58Data.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\CBigNum.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\CKey.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\RFC1751.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\BuildInfo.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\FieldNames.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\HashPrefix.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\LedgerFormats.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\PackedMessage.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\KnownFormats.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\Protocol.h" />
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\RippleAddress.h" />
|
||||
|
||||
@@ -214,6 +214,24 @@
|
||||
<Filter Include="[1] Ripple\rpc\impl">
|
||||
<UniqueIdentifier>{95c93134-7e8d-47ec-9649-4a8d5d97ce12}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\types">
|
||||
<UniqueIdentifier>{a3a2d1ec-d731-42df-9397-40a561c6809a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\types\api">
|
||||
<UniqueIdentifier>{1bfc2af7-9750-4f5b-b2a2-15d7997c4d59}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\types\impl">
|
||||
<UniqueIdentifier>{e7342119-7a16-49cd-80b5-fdb21c154f0c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\sslutil">
|
||||
<UniqueIdentifier>{7d0d63f0-edc6-4f86-a6ba-f33c32615457}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\sslutil\api">
|
||||
<UniqueIdentifier>{96a1206f-7ad0-4829-a09d-64660c2ede0e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\sslutil\impl">
|
||||
<UniqueIdentifier>{794194cf-e641-4838-ba78-82482c6e87c0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\RangeSet.cpp">
|
||||
@@ -222,24 +240,12 @@
|
||||
<ClCompile Include="..\..\src\ripple_basics\containers\TaggedCache.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\types\UInt256.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\ByteOrder.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\CountedObject.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\DiffieHellmanUtil.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\IniFile.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\RandomNumbers.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_basics\utility\StringUtilities.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClCompile>
|
||||
@@ -270,15 +276,9 @@
|
||||
<ClCompile Include="..\..\src\ripple_core\functional\LoadMonitor.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_core\functional</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\Base58.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\Base58Data.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\CBigNum.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\crypto\CKey.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClCompile>
|
||||
@@ -294,9 +294,6 @@
|
||||
<ClCompile Include="..\..\src\ripple_data\protocol\FieldNames.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\protocol\PackedMessage.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_data\protocol\RippleAddress.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
|
||||
</ClCompile>
|
||||
@@ -1020,6 +1017,45 @@
|
||||
<ClCompile Include="..\..\src\ripple\http\impl\ServerImpl.cpp">
|
||||
<Filter>[1] Ripple\http\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\ripple_types.cpp">
|
||||
<Filter>[1] Ripple\types</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\Base58.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\ripple_sslutil.cpp">
|
||||
<Filter>[1] Ripple\sslutil</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\impl\CBigNum.cpp">
|
||||
<Filter>[1] Ripple\sslutil\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UInt256.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UInt128.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\ByteOrder.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\UInt160.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\RandomNumbers.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\types\impl\strHex.cpp">
|
||||
<Filter>[1] Ripple\types\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\impl\HashUtilities.cpp">
|
||||
<Filter>[1] Ripple\sslutil\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\sslutil\impl\DHUtil.cpp">
|
||||
<Filter>[1] Ripple\sslutil\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple_app\peers\PackedMessage.cpp">
|
||||
<Filter>[2] Old Ripple\ripple_app\peers</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\KeyCache.h">
|
||||
@@ -1028,51 +1064,24 @@
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\RangeSet.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\SecureAllocator.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\containers\TaggedCache.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\BoostIncludes.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\system</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\OpenSSLIncludes.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\system</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\system\StandardIncludes.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\system</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\BasicTypes.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\HashMaps.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\UInt256.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\ByteOrder.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\CountedObject.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\DiffieHellmanUtil.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\HashUtilities.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\IniFile.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\PlatformMacros.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\RandomNumbers.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\utility\StringUtilities.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\utility</Filter>
|
||||
</ClInclude>
|
||||
@@ -1106,15 +1115,9 @@
|
||||
<ClInclude Include="..\..\src\ripple_core\functional\LoadMonitor.h">
|
||||
<Filter>[2] Old Ripple\ripple_core\functional</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\Base58.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\Base58Data.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\CBigNum.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_data\crypto\CKey.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\crypto</Filter>
|
||||
</ClInclude>
|
||||
@@ -1127,9 +1130,6 @@
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\HashPrefix.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\PackedMessage.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_data\protocol\Protocol.h">
|
||||
<Filter>[2] Old Ripple\ripple_data\protocol</Filter>
|
||||
</ClInclude>
|
||||
@@ -2022,6 +2022,66 @@
|
||||
<ClInclude Include="..\..\src\ripple\rpc\impl\ManagerImpl.h">
|
||||
<Filter>[1] Ripple\rpc\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\RipplePublicKey.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_basics\types\RipplePublicKeyHash.h">
|
||||
<Filter>[2] Old Ripple\ripple_basics\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\ripple_types.h">
|
||||
<Filter>[1] Ripple\types</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\Base58.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\Blob.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\ripple_sslutil.h">
|
||||
<Filter>[1] Ripple\sslutil</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\CBigNum.h">
|
||||
<Filter>[1] Ripple\sslutil\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\CAutoBN_CTX.h">
|
||||
<Filter>[1] Ripple\sslutil\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\bignum_error.h">
|
||||
<Filter>[1] Ripple\sslutil\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\UInt256.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\base_uint.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\UInt128.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\UInt160.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\HashMaps.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\types\api\strHex.h">
|
||||
<Filter>[1] Ripple\types\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\HashUtilities.h">
|
||||
<Filter>[1] Ripple\sslutil\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\api\DHUtil.h">
|
||||
<Filter>[1] Ripple\sslutil\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple_app\peers\PackedMessage.h">
|
||||
<Filter>[2] Old Ripple\ripple_app\peers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\src\ripple_data\protocol\ripple.proto">
|
||||
|
||||
@@ -150,7 +150,9 @@ COMPILED_FILES.extend([
|
||||
'src/ripple/json/ripple_json.cpp',
|
||||
'src/ripple/rpc/ripple_rpc.cpp',
|
||||
'src/ripple/sophia/ripple_sophia.c',
|
||||
'src/ripple/sslutil/ripple_sslutil.cpp',
|
||||
'src/ripple/testoverlay/ripple_testoverlay.cpp',
|
||||
'src/ripple/types/ripple_types.cpp',
|
||||
'src/ripple/validators/ripple_validators.cpp'
|
||||
])
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "../ripple_net/ripple_net.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "ripple_rpc.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
# include "impl/ManagerImpl.h"
|
||||
|
||||
64
src/ripple/sslutil/api/CAutoBN_CTX.h
Normal file
64
src/ripple/sslutil/api/CAutoBN_CTX.h
Normal file
@@ -0,0 +1,64 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_SSLUTIL_CAUTOBN_CTX_H_INCLUDED
|
||||
#define RIPPLE_SSLUTIL_CAUTOBN_CTX_H_INCLUDED
|
||||
|
||||
#include "bignum_error.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class CAutoBN_CTX : public Uncopyable
|
||||
{
|
||||
protected:
|
||||
BN_CTX* pctx;
|
||||
CAutoBN_CTX& operator= (BN_CTX* pnew)
|
||||
{
|
||||
pctx = pnew;
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
CAutoBN_CTX ()
|
||||
{
|
||||
pctx = BN_CTX_new ();
|
||||
|
||||
if (pctx == nullptr)
|
||||
throw bignum_error ("CAutoBN_CTX : BN_CTX_new() returned nullptr");
|
||||
}
|
||||
|
||||
~CAutoBN_CTX ()
|
||||
{
|
||||
if (pctx != nullptr)
|
||||
BN_CTX_free (pctx);
|
||||
}
|
||||
|
||||
operator BN_CTX* ()
|
||||
{
|
||||
return pctx;
|
||||
}
|
||||
BN_CTX& operator* ()
|
||||
{
|
||||
return *pctx;
|
||||
}
|
||||
BN_CTX** operator& ()
|
||||
{
|
||||
return &pctx;
|
||||
}
|
||||
bool operator! ()
|
||||
{
|
||||
return (pctx == nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -9,67 +9,12 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_CBIGNUM_H
|
||||
#define RIPPLE_CBIGNUM_H
|
||||
#ifndef RIPPLE_SSLUTIL_CBIGNUM_H_INCLUDED
|
||||
#define RIPPLE_SSLUTIL_CBIGNUM_H_INCLUDED
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
namespace ripple {
|
||||
|
||||
class bignum_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bignum_error (const std::string& str) : std::runtime_error (str) {}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class CAutoBN_CTX
|
||||
{
|
||||
private:
|
||||
CAutoBN_CTX (const CAutoBN_CTX&); // no implementation
|
||||
CAutoBN_CTX& operator= (const CAutoBN_CTX&); // no implementation
|
||||
|
||||
protected:
|
||||
BN_CTX* pctx;
|
||||
CAutoBN_CTX& operator= (BN_CTX* pnew)
|
||||
{
|
||||
pctx = pnew;
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
CAutoBN_CTX ()
|
||||
{
|
||||
pctx = BN_CTX_new ();
|
||||
|
||||
if (pctx == NULL)
|
||||
throw bignum_error ("CAutoBN_CTX : BN_CTX_new() returned NULL");
|
||||
}
|
||||
|
||||
~CAutoBN_CTX ()
|
||||
{
|
||||
if (pctx != NULL)
|
||||
BN_CTX_free (pctx);
|
||||
}
|
||||
|
||||
operator BN_CTX* ()
|
||||
{
|
||||
return pctx;
|
||||
}
|
||||
BN_CTX& operator* ()
|
||||
{
|
||||
return *pctx;
|
||||
}
|
||||
BN_CTX** operator& ()
|
||||
{
|
||||
return &pctx;
|
||||
}
|
||||
bool operator! ()
|
||||
{
|
||||
return (pctx == NULL);
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class uint256;
|
||||
|
||||
// VFALCO TODO figure out a way to remove the dependency on openssl in the
|
||||
// header. Maybe rewrite this to use cryptopp.
|
||||
@@ -150,22 +95,12 @@ bool operator> (const CBigNum& a, const CBigNum& b);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO NOTE this seems as good a place as any for this.
|
||||
|
||||
// Here's the old implementation using macros, in case something broke
|
||||
//#if (ULONG_MAX > UINT_MAX)
|
||||
//#define BN_add_word64(bn, word) BN_add_word(bn, word)
|
||||
//#define BN_sub_word64(bn, word) BN_sub_word(bn, word)
|
||||
//#define BN_mul_word64(bn, word) BN_mul_word(bn, word)
|
||||
//#define BN_div_word64(bn, word) BN_div_word(bn, word)
|
||||
//#endif
|
||||
|
||||
// VFALCO I believe only STAmount uses these
|
||||
extern int BN_add_word64 (BIGNUM* a, uint64 w);
|
||||
extern int BN_sub_word64 (BIGNUM* a, uint64 w);
|
||||
extern int BN_mul_word64 (BIGNUM* a, uint64 w);
|
||||
extern uint64 BN_div_word64 (BIGNUM* a, uint64 w);
|
||||
int BN_add_word64 (BIGNUM* a, uint64 w);
|
||||
int BN_sub_word64 (BIGNUM* a, uint64 w);
|
||||
int BN_mul_word64 (BIGNUM* a, uint64 w);
|
||||
uint64 BN_div_word64 (BIGNUM* a, uint64 w);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
@@ -4,12 +4,14 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_DIFFIEHELLMANUTIL_H
|
||||
#define RIPPLE_DIFFIEHELLMANUTIL_H
|
||||
#ifndef RIPPLE_SSLUTIL_DHUTIL_H_INCLUDED
|
||||
#define RIPPLE_SSLUTIL_DHUTIL_H_INCLUDED
|
||||
|
||||
extern DH* DH_der_load (const std::string& strDer);
|
||||
extern std::string DH_der_gen (int iKeyLength);
|
||||
namespace ripple {
|
||||
|
||||
DH* DH_der_load (const std::string& strDer);
|
||||
std::string DH_der_gen (int iKeyLength);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
@@ -4,8 +4,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_HASHUTILITIES_H
|
||||
#define RIPPLE_HASHUTILITIES_H
|
||||
#ifndef RIPPLE_SSLUTIL_HASHUTILITIES_H_INCLUDED
|
||||
#define RIPPLE_SSLUTIL_HASHUTILITIES_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// VFALCO NOTE these came from BitcoinUtil.h
|
||||
|
||||
@@ -13,7 +15,7 @@
|
||||
// then define these in a .cpp so they are no longer inline.
|
||||
//
|
||||
template<typename T1>
|
||||
inline uint256 SHA256Hash (const T1 pbegin, const T1 pend)
|
||||
uint256 SHA256Hash (const T1 pbegin, const T1 pend)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
uint256 hash1;
|
||||
@@ -24,7 +26,7 @@ inline uint256 SHA256Hash (const T1 pbegin, const T1 pend)
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
inline uint256 SHA256Hash (const T1 p1begin, const T1 p1end,
|
||||
uint256 SHA256Hash (const T1 p1begin, const T1 p1end,
|
||||
const T2 p2begin, const T2 p2end)
|
||||
{
|
||||
static unsigned char pblank[1];
|
||||
@@ -40,7 +42,7 @@ inline uint256 SHA256Hash (const T1 p1begin, const T1 p1end,
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline uint256 SHA256Hash (const T1 p1begin, const T1 p1end,
|
||||
uint256 SHA256Hash (const T1 p1begin, const T1 p1end,
|
||||
const T2 p2begin, const T2 p2end,
|
||||
const T3 p3begin, const T3 p3end)
|
||||
{
|
||||
@@ -57,39 +59,8 @@ inline uint256 SHA256Hash (const T1 p1begin, const T1 p1end,
|
||||
return hash2;
|
||||
}
|
||||
|
||||
inline uint160 Hash160 (Blob const& vch)
|
||||
{
|
||||
uint256 hash1;
|
||||
SHA256 (&vch[0], vch.size (), (unsigned char*)&hash1);
|
||||
uint160 hash2;
|
||||
RIPEMD160 ((unsigned char*)&hash1, sizeof (hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
uint160 Hash160 (Blob const& vch);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
#if BEAST_WIN32
|
||||
// This is used to attempt to keep keying material out of swap
|
||||
// Note that VirtualLock does not provide this as a guarantee on Windows,
|
||||
// but, in practice, memory that has been VirtualLock'd almost never gets written to
|
||||
// the pagefile except in rare circumstances where memory is extremely low.
|
||||
#include <windows.h>
|
||||
#define mlock(p, n) VirtualLock((p), (n));
|
||||
#define munlock(p, n) VirtualUnlock((p), (n));
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#include <limits.h>
|
||||
// This comes from limits.h if it's not defined there set a sane default
|
||||
#ifndef PAGESIZE
|
||||
#include <unistd.h>
|
||||
#define PAGESIZE sysconf(_SC_PAGESIZE)
|
||||
#endif
|
||||
#define mlock(a,b) \
|
||||
mlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
|
||||
(((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
|
||||
#define munlock(a,b) \
|
||||
munlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
|
||||
(((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
30
src/ripple/sslutil/api/bignum_error.h
Normal file
30
src/ripple/sslutil/api/bignum_error.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_SSLUTIL_BIGNUM_ERROR_H_INCLUDED
|
||||
#define RIPPLE_SSLUTIL_BIGNUM_ERROR_H_INCLUDED
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class bignum_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bignum_error (std::string const& str)
|
||||
: std::runtime_error (str)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -9,6 +9,8 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
namespace ripple {
|
||||
|
||||
CBigNum::CBigNum ()
|
||||
{
|
||||
BN_init (this);
|
||||
@@ -641,3 +643,5 @@ uint64 BN_div_word64 (BIGNUM* a, uint64 w)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::string DH_der_gen (int iKeyLength)
|
||||
{
|
||||
DH* dh = 0;
|
||||
@@ -12,13 +14,13 @@ std::string DH_der_gen (int iKeyLength)
|
||||
|
||||
do
|
||||
{
|
||||
dh = DH_generate_parameters (iKeyLength, DH_GENERATOR_5, NULL, NULL);
|
||||
dh = DH_generate_parameters (iKeyLength, DH_GENERATOR_5, nullptr, nullptr);
|
||||
iCodes = 0;
|
||||
DH_check (dh, &iCodes);
|
||||
}
|
||||
while (iCodes & (DH_CHECK_P_NOT_PRIME | DH_CHECK_P_NOT_SAFE_PRIME | DH_UNABLE_TO_CHECK_GENERATOR | DH_NOT_SUITABLE_GENERATOR));
|
||||
|
||||
strDer.resize (i2d_DHparams (dh, NULL));
|
||||
strDer.resize (i2d_DHparams (dh, nullptr));
|
||||
|
||||
unsigned char* next = reinterpret_cast<unsigned char*> (&strDer[0]);
|
||||
|
||||
@@ -31,7 +33,7 @@ DH* DH_der_load (const std::string& strDer)
|
||||
{
|
||||
const unsigned char* pbuf = reinterpret_cast<const unsigned char*> (&strDer[0]);
|
||||
|
||||
return d2i_DHparams (NULL, &pbuf, strDer.size ());
|
||||
return d2i_DHparams (nullptr, &pbuf, strDer.size ());
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
}
|
||||
44
src/ripple/sslutil/impl/HashUtilities.cpp
Normal file
44
src/ripple/sslutil/impl/HashUtilities.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
uint160 Hash160 (Blob const& vch)
|
||||
{
|
||||
uint256 hash1;
|
||||
SHA256 (&vch[0], vch.size (), (unsigned char*)&hash1);
|
||||
uint160 hash2;
|
||||
RIPEMD160 ((unsigned char*)&hash1, sizeof (hash1), (unsigned char*)&hash2);
|
||||
return hash2;
|
||||
}
|
||||
|
||||
/*
|
||||
#if BEAST_WIN32
|
||||
// This is used to attempt to keep keying material out of swap
|
||||
// Note that VirtualLock does not provide this as a guarantee on Windows,
|
||||
// but, in practice, memory that has been VirtualLock'd almost never gets written to
|
||||
// the pagefile except in rare circumstances where memory is extremely low.
|
||||
#include <windows.h>
|
||||
#define mlock(p, n) VirtualLock((p), (n));
|
||||
#define munlock(p, n) VirtualUnlock((p), (n));
|
||||
#else
|
||||
#include <sys/mman.h>
|
||||
#include <limits.h>
|
||||
// This comes from limits.h if it's not defined there set a sane default
|
||||
#ifndef PAGESIZE
|
||||
#include <unistd.h>
|
||||
#define PAGESIZE sysconf(_SC_PAGESIZE)
|
||||
#endif
|
||||
#define mlock(a,b) \
|
||||
mlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
|
||||
(((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
|
||||
#define munlock(a,b) \
|
||||
munlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
|
||||
(((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
|
||||
#endif
|
||||
*/
|
||||
|
||||
}
|
||||
13
src/ripple/sslutil/ripple_sslutil.cpp
Normal file
13
src/ripple/sslutil/ripple_sslutil.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "ripple_sslutil.h"
|
||||
|
||||
#include "impl/CBigNum.cpp"
|
||||
#include "impl/DHUtil.cpp"
|
||||
#include "impl/HashUtilities.cpp"
|
||||
29
src/ripple/sslutil/ripple_sslutil.h
Normal file
29
src/ripple/sslutil/ripple_sslutil.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SSLUTIL_H_INCLUDED
|
||||
#define RIPPLE_SSLUTIL_H_INCLUDED
|
||||
|
||||
#include "beast/modules/beast_core/beast_core.h"
|
||||
|
||||
#include "../types/ripple_types.h"
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/ripemd.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
namespace ripple {
|
||||
using namespace beast;
|
||||
}
|
||||
|
||||
# include "api/bignum_error.h"
|
||||
#include "api/CAutoBN_CTX.h"
|
||||
#include "api/CBigNum.h"
|
||||
#include "api/DHUtil.h"
|
||||
#include "api/HashUtilities.h"
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef RIPPLE_TESTOVERLAY_H_INCLUDED
|
||||
#define RIPPLE_TESTOVERLAY_H_INCLUDED
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include "beast/modules/beast_core/beast_core.h"
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
// - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
|
||||
//
|
||||
#ifndef RIPPLE_BASE58_H
|
||||
#define RIPPLE_BASE58_H
|
||||
#ifndef RIPPLE_TYPES_BASE58_H
|
||||
#define RIPPLE_TYPES_BASE58_H
|
||||
|
||||
/** Performs Base 58 encoding and decoding.
|
||||
*/
|
||||
#include "Blob.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Performs Base 58 encoding and decoding. */
|
||||
class Base58
|
||||
{
|
||||
public:
|
||||
@@ -32,6 +35,12 @@ public:
|
||||
static char const* getRippleAlphabet ();
|
||||
static char const* getTestnetAlphabet ();
|
||||
|
||||
static std::string encode (
|
||||
const unsigned char* pbegin,
|
||||
const unsigned char* pend,
|
||||
char const* alphabet,
|
||||
bool withCheck);
|
||||
|
||||
static std::string encode (const unsigned char* pbegin, const unsigned char* pend);
|
||||
static std::string encode (Blob const& vch);
|
||||
static std::string encodeWithCheck (Blob const& vchIn);
|
||||
@@ -45,5 +54,6 @@ private:
|
||||
static char const* s_currentAlphabet;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
21
src/ripple/types/api/Blob.h
Normal file
21
src/ripple/types/api/Blob.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_TYPES_BLOB_H_INCLUDED
|
||||
#define RIPPLE_TYPES_BLOB_H_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Storage for linear binary data.
|
||||
Blocks of binary data appear often in various idioms and structures.
|
||||
*/
|
||||
typedef std::vector <unsigned char> Blob;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,8 +4,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_BYTEORDER_H
|
||||
#define RIPPLE_BYTEORDER_H
|
||||
#ifndef RIPPLE_TYPES_BYTEORDER_H
|
||||
#define RIPPLE_TYPES_BYTEORDER_H
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// Routines for converting endianness
|
||||
|
||||
@@ -42,4 +44,6 @@ extern uint32_t be32toh (uint32_t value);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,8 +4,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_HASHMAPS_H
|
||||
#define RIPPLE_HASHMAPS_H
|
||||
#ifndef RIPPLE_TYPES_HASHMAPS_H_INCLUDED
|
||||
#define RIPPLE_TYPES_HASHMAPS_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Management helper of hash functions used in hash map containers.
|
||||
|
||||
@@ -116,4 +118,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,8 +4,10 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_RANDOMNUMBERS_H
|
||||
#define RIPPLE_RANDOMNUMBERS_H
|
||||
#ifndef RIPPLE_TYPES_RANDOMNUMBERS_H
|
||||
#define RIPPLE_TYPES_RANDOMNUMBERS_H
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Cryptographically secure random number source.
|
||||
*/
|
||||
@@ -24,7 +26,7 @@ public:
|
||||
|
||||
@return `true` if enough entropy could be retrieved.
|
||||
*/
|
||||
bool initialize ();
|
||||
bool initialize (Journal::Stream stream = Journal::Stream());
|
||||
|
||||
/** Generate secure random numbers.
|
||||
|
||||
@@ -62,7 +64,7 @@ private:
|
||||
|
||||
~RandomNumbers ();
|
||||
|
||||
bool platformAddEntropy ();
|
||||
bool platformAddEntropy (Journal::Stream stream);
|
||||
|
||||
void platformAddPerformanceMonitorEntropy ();
|
||||
|
||||
@@ -70,4 +72,6 @@ private:
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
63
src/ripple/types/api/UInt128.h
Normal file
63
src/ripple/types/api/UInt128.h
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_TYPES_UINT128_H_INCLUDED
|
||||
#define RIPPLE_TYPES_UINT128_H_INCLUDED
|
||||
|
||||
#include "base_uint.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class uint128 : public base_uint128
|
||||
{
|
||||
public:
|
||||
typedef base_uint128 basetype;
|
||||
|
||||
uint128 ()
|
||||
{
|
||||
zero ();
|
||||
}
|
||||
|
||||
uint128 (const basetype& b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint128& operator= (const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// VFALCO NOTE This looks dangerous and wouldn't be obvious at call
|
||||
// sites what is being performed here.
|
||||
//
|
||||
explicit uint128 (const base_uint256& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
}
|
||||
|
||||
explicit uint128 (Blob const& vch)
|
||||
{
|
||||
if (vch.size () == size ())
|
||||
memcpy (pn, &vch[0], size ());
|
||||
else
|
||||
zero ();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
180
src/ripple/types/api/UInt160.h
Normal file
180
src/ripple/types/api/UInt160.h
Normal file
@@ -0,0 +1,180 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_TYPES_UINT160_H_INCLUDED
|
||||
#define RIPPLE_TYPES_UINT160_H_INCLUDED
|
||||
|
||||
#include "base_uint.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class uint160 : public base_uint160
|
||||
{
|
||||
public:
|
||||
typedef base_uint160 basetype;
|
||||
|
||||
uint160 ()
|
||||
{
|
||||
zero ();
|
||||
}
|
||||
|
||||
uint160 (const basetype& b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint160& operator= (const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint160 (uint64 b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint160& operator= (uint64 uHost)
|
||||
{
|
||||
zero ();
|
||||
|
||||
// Put in least significant bits.
|
||||
((uint64*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint160 (const std::string& str)
|
||||
{
|
||||
SetHex (str);
|
||||
}
|
||||
|
||||
explicit uint160 (Blob const& vch)
|
||||
{
|
||||
if (vch.size () == sizeof (pn))
|
||||
memcpy (pn, &vch[0], sizeof (pn));
|
||||
else
|
||||
zero ();
|
||||
}
|
||||
|
||||
base_uint256 to256 () const;
|
||||
};
|
||||
|
||||
inline bool operator== (const uint160& a, uint64 b)
|
||||
{
|
||||
return (base_uint160)a == b;
|
||||
}
|
||||
|
||||
inline bool operator!= (const uint160& a, uint64 b)
|
||||
{
|
||||
return (base_uint160)a != b;
|
||||
}
|
||||
|
||||
inline const uint160 operator^ (const base_uint160& a, const base_uint160& b)
|
||||
{
|
||||
return uint160 (a) ^= b;
|
||||
}
|
||||
|
||||
inline const uint160 operator& (const base_uint160& a, const base_uint160& b)
|
||||
{
|
||||
return uint160 (a) &= b;
|
||||
}
|
||||
|
||||
inline const uint160 operator| (const base_uint160& a, const base_uint160& b)
|
||||
{
|
||||
return uint160 (a) |= b;
|
||||
}
|
||||
|
||||
inline bool operator== (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a == (base_uint160)b;
|
||||
}
|
||||
|
||||
inline bool operator!= (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a != (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator^ (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a ^ (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator& (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a & (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator| (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a | (base_uint160)b;
|
||||
}
|
||||
|
||||
inline bool operator== (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a == (base_uint160)b;
|
||||
}
|
||||
inline bool operator!= (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a != (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator^ (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a ^ (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator& (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a & (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator| (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a | (base_uint160)b;
|
||||
}
|
||||
|
||||
inline bool operator== (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a == (base_uint160)b;
|
||||
}
|
||||
|
||||
inline bool operator!= (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a != (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator^ (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a ^ (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator& (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a & (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const uint160 operator| (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a | (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const std::string strHex (const uint160& ui)
|
||||
{
|
||||
return strHex (ui.begin (), ui.size ());
|
||||
}
|
||||
|
||||
extern std::size_t hash_value (const uint160&);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
333
src/ripple/types/api/UInt256.h
Normal file
333
src/ripple/types/api/UInt256.h
Normal file
@@ -0,0 +1,333 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_TYPES_UINT256_H_INCLUDED
|
||||
#define RIPPLE_TYPES_UINT256_H_INCLUDED
|
||||
|
||||
#include "base_uint.h"
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class uint256 : public base_uint256
|
||||
{
|
||||
public:
|
||||
typedef base_uint256 basetype;
|
||||
|
||||
uint256 ()
|
||||
{
|
||||
zero ();
|
||||
}
|
||||
|
||||
uint256 (const basetype& b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint256& operator= (const basetype& b)
|
||||
{
|
||||
if (pn != b.pn)
|
||||
memcpy (pn, b.pn, sizeof (pn));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint256 (uint64 b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
private:
|
||||
uint256 (void const* data, FromVoid)
|
||||
: base_uint256 (data, FromVoid ())
|
||||
{
|
||||
}
|
||||
public:
|
||||
static uint256 fromVoid (void const* data)
|
||||
{
|
||||
return uint256 (data, FromVoid ());
|
||||
}
|
||||
|
||||
uint256& operator= (uint64 uHost)
|
||||
{
|
||||
zero ();
|
||||
|
||||
// Put in least significant bits.
|
||||
((uint64*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint256 (const std::string& str)
|
||||
{
|
||||
SetHex (str);
|
||||
}
|
||||
|
||||
explicit uint256 (Blob const& vch)
|
||||
{
|
||||
if (vch.size () == sizeof (pn))
|
||||
memcpy (pn, &vch[0], sizeof (pn));
|
||||
else
|
||||
{
|
||||
assert (false);
|
||||
zero ();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator== (uint256 const& a, uint64 b)
|
||||
{
|
||||
return (base_uint256)a == b;
|
||||
}
|
||||
|
||||
inline bool operator!= (uint256 const& a, uint64 b)
|
||||
{
|
||||
return (base_uint256)a != b;
|
||||
}
|
||||
|
||||
inline const uint256 operator^ (const base_uint256& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) ^= b;
|
||||
}
|
||||
|
||||
inline const uint256 operator& (const base_uint256& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) &= b;
|
||||
}
|
||||
|
||||
inline const uint256 operator| (const base_uint256& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) |= b;
|
||||
}
|
||||
|
||||
inline bool operator== (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a == (base_uint256)b;
|
||||
}
|
||||
|
||||
inline bool operator!= (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a != (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator^ (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a ^ (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator& (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a & (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator| (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a | (base_uint256)b;
|
||||
}
|
||||
|
||||
inline bool operator== (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a == (base_uint256)b;
|
||||
}
|
||||
|
||||
inline bool operator!= (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a != (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator^ (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a ^ (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator& (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) &= b;
|
||||
}
|
||||
|
||||
inline const uint256 operator| (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a | (base_uint256)b;
|
||||
}
|
||||
|
||||
inline bool operator== (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a == (base_uint256)b;
|
||||
}
|
||||
|
||||
inline bool operator!= (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a != (base_uint256)b;
|
||||
|
||||
}
|
||||
|
||||
inline const uint256 operator^ (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a ^ (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator& (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a & (base_uint256)b;
|
||||
}
|
||||
|
||||
inline const uint256 operator| (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a | (base_uint256)b;
|
||||
}
|
||||
|
||||
inline int Testuint256AdHoc (std::vector<std::string> vArg)
|
||||
{
|
||||
uint256 g (uint64 (0));
|
||||
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
--g;
|
||||
printf ("--g\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
g--;
|
||||
printf ("g--\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
g++;
|
||||
printf ("g++\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
++g;
|
||||
printf ("++g\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
g++;
|
||||
printf ("g++\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
++g;
|
||||
printf ("++g\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
|
||||
|
||||
|
||||
uint256 a (7);
|
||||
printf ("a=7\n");
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
|
||||
uint256 b;
|
||||
printf ("b undefined\n");
|
||||
printf ("%s\n", b.ToString ().c_str ());
|
||||
int c = 3;
|
||||
|
||||
a = c;
|
||||
a.pn[3] = 15;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
uint256 k (c);
|
||||
|
||||
a = 5;
|
||||
a.pn[3] = 15;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
b = 1;
|
||||
// b <<= 52;
|
||||
|
||||
a |= b;
|
||||
|
||||
// a ^= 0x500;
|
||||
|
||||
printf ("a %s\n", a.ToString ().c_str ());
|
||||
|
||||
a = a | b | (uint256)0x1000;
|
||||
|
||||
|
||||
printf ("a %s\n", a.ToString ().c_str ());
|
||||
printf ("b %s\n", b.ToString ().c_str ());
|
||||
|
||||
a = 0xfffffffe;
|
||||
a.pn[4] = 9;
|
||||
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
uint256 d = a--;
|
||||
printf ("%s\n", d.ToString ().c_str ());
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
|
||||
d = a;
|
||||
|
||||
printf ("%s\n", d.ToString ().c_str ());
|
||||
|
||||
for (int i = uint256::WIDTH - 1; i >= 0; i--) printf ("%08x", d.pn[i]);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
uint256 neg = d;
|
||||
neg = ~neg;
|
||||
printf ("%s\n", neg.ToString ().c_str ());
|
||||
|
||||
|
||||
uint256 e = uint256 ("0xABCDEF123abcdef12345678909832180000011111111");
|
||||
printf ("\n");
|
||||
printf ("%s\n", e.ToString ().c_str ());
|
||||
|
||||
|
||||
printf ("\n");
|
||||
uint256 x1 = uint256 ("0xABCDEF123abcdef12345678909832180000011111111");
|
||||
uint256 x2;
|
||||
printf ("%s\n", x1.ToString ().c_str ());
|
||||
|
||||
for (int i = 0; i < 270; i += 4)
|
||||
{
|
||||
// x2 = x1 << i;
|
||||
printf ("%s\n", x2.ToString ().c_str ());
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", x1.ToString ().c_str ());
|
||||
|
||||
for (int i = 0; i < 270; i += 4)
|
||||
{
|
||||
x2 = x1;
|
||||
// x2 >>= i;
|
||||
printf ("%s\n", x2.ToString ().c_str ());
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
uint256 k = (~uint256 (0) >> i);
|
||||
printf ("%s\n", k.ToString ().c_str ());
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
uint256 k = (~uint256 (0) << i);
|
||||
printf ("%s\n", k.ToString ().c_str ());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern std::size_t hash_value (uint256 const& );
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
442
src/ripple/types/api/base_uint.h
Normal file
442
src/ripple/types/api/base_uint.h
Normal file
@@ -0,0 +1,442 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_TYPES_BASE_UINT_H_INCLUDED
|
||||
#define RIPPLE_TYPES_BASE_UINT_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class uint128;
|
||||
class uint160;
|
||||
class uint256;
|
||||
inline int Testuint256AdHoc (std::vector<std::string> vArg);
|
||||
|
||||
// This class stores its values internally in big-endian form
|
||||
|
||||
// We have to keep a separate base class without constructors
|
||||
// so the compiler will let us use it in a union
|
||||
//
|
||||
// VFALCO NOTE This class produces undefined behavior when
|
||||
// BITS is not a multiple of 32!!!
|
||||
//
|
||||
template<unsigned int BITS>
|
||||
class base_uint
|
||||
{
|
||||
protected:
|
||||
enum { WIDTH = BITS / 32 };
|
||||
|
||||
// This is really big-endian in byte order.
|
||||
// We sometimes use unsigned int for speed.
|
||||
unsigned int pn[WIDTH];
|
||||
|
||||
public:
|
||||
base_uint ()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
// This is to disambiguate from other 1 parameter ctors
|
||||
struct FromVoid { };
|
||||
|
||||
/** Construct from a raw pointer.
|
||||
|
||||
The buffer pointed to by `data` must be at least 32 bytes.
|
||||
*/
|
||||
base_uint (void const* data, FromVoid)
|
||||
{
|
||||
// BITS must be a multiple of 32
|
||||
static_bassert ((BITS % 32) == 0);
|
||||
|
||||
memcpy (&pn [0], data, BITS / 8);
|
||||
}
|
||||
public:
|
||||
|
||||
bool isZero () const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
if (pn[i] != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isNonZero () const
|
||||
{
|
||||
return !isZero ();
|
||||
}
|
||||
|
||||
bool operator! () const
|
||||
{
|
||||
return isZero ();
|
||||
}
|
||||
|
||||
const base_uint operator~ () const
|
||||
{
|
||||
base_uint ret;
|
||||
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
ret.pn[i] = ~pn[i];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator= (uint64 uHost)
|
||||
{
|
||||
zero ();
|
||||
|
||||
// Put in least significant bits.
|
||||
((uint64*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator^= (const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] ^= b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator&= (const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] &= b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator|= (const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] |= b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator++ ()
|
||||
{
|
||||
// prefix operator
|
||||
for (int i = WIDTH - 1; i >= 0; --i)
|
||||
{
|
||||
pn[i] = htobe32 (be32toh (pn[i]) + 1);
|
||||
|
||||
if (pn[i] != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
const base_uint operator++ (int)
|
||||
{
|
||||
// postfix operator
|
||||
const base_uint ret = *this;
|
||||
++ (*this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator-- ()
|
||||
{
|
||||
for (int i = WIDTH - 1; i >= 0; --i)
|
||||
{
|
||||
uint32 prev = pn[i];
|
||||
pn[i] = htobe32 (be32toh (pn[i]) - 1);
|
||||
|
||||
if (prev != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
const base_uint operator-- (int)
|
||||
{
|
||||
// postfix operator
|
||||
const base_uint ret = *this;
|
||||
-- (*this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator+= (const base_uint& b)
|
||||
{
|
||||
uint64 carry = 0;
|
||||
|
||||
for (int i = WIDTH; i--;)
|
||||
{
|
||||
uint64 n = carry + be32toh (pn[i]) + be32toh (b.pn[i]);
|
||||
|
||||
pn[i] = htobe32 (n & 0xffffffff);
|
||||
carry = n >> 32;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::size_t hash_combine (std::size_t& seed) const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; ++i)
|
||||
boost::hash_combine (seed, pn[i]);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
friend inline int compare (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
const unsigned char* pA = a.begin ();
|
||||
const unsigned char* pAEnd = a.end ();
|
||||
const unsigned char* pB = b.begin ();
|
||||
|
||||
while (*pA == *pB)
|
||||
{
|
||||
if (++pA == pAEnd)
|
||||
return 0;
|
||||
|
||||
++pB;
|
||||
}
|
||||
|
||||
return (*pA < *pB) ? -1 : 1;
|
||||
}
|
||||
|
||||
friend inline bool operator< (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) < 0;
|
||||
}
|
||||
|
||||
friend inline bool operator<= (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) <= 0;
|
||||
}
|
||||
|
||||
friend inline bool operator> (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) > 0;
|
||||
}
|
||||
|
||||
friend inline bool operator>= (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) >= 0;
|
||||
}
|
||||
|
||||
friend inline bool operator== (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return memcmp (a.pn, b.pn, sizeof (a.pn)) == 0;
|
||||
}
|
||||
|
||||
friend inline bool operator!= (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return memcmp (a.pn, b.pn, sizeof (a.pn)) != 0;
|
||||
}
|
||||
|
||||
std::string GetHex () const
|
||||
{
|
||||
return strHex (begin (), size ());
|
||||
}
|
||||
|
||||
void SetHexExact (const char* psz)
|
||||
{
|
||||
// must be precisely the correct number of hex digits
|
||||
static signed char phexdigit[256] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
char* pOut = reinterpret_cast<char*> (pn);
|
||||
|
||||
for (int i = 0; i < sizeof (pn); ++i)
|
||||
{
|
||||
*pOut = phexdigit[*psz++] << 4;
|
||||
*pOut++ |= phexdigit[*psz++];
|
||||
}
|
||||
|
||||
assert (*psz == 0);
|
||||
assert (pOut == reinterpret_cast<char*> (end ()));
|
||||
}
|
||||
|
||||
// Allow leading whitespace.
|
||||
// Allow leading "0x".
|
||||
// To be valid must be '\0' terminated.
|
||||
bool SetHex (const char* psz, bool bStrict = false)
|
||||
{
|
||||
// skip leading spaces
|
||||
if (!bStrict)
|
||||
while (isspace (*psz))
|
||||
psz++;
|
||||
|
||||
// skip 0x
|
||||
if (!bStrict && psz[0] == '0' && tolower (psz[1]) == 'x')
|
||||
psz += 2;
|
||||
|
||||
// hex char to int
|
||||
static signed char phexdigit[256] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
const unsigned char* pEnd = reinterpret_cast<const unsigned char*> (psz);
|
||||
const unsigned char* pBegin = pEnd;
|
||||
|
||||
// Find end.
|
||||
while (phexdigit[*pEnd] >= 0)
|
||||
pEnd++;
|
||||
|
||||
// Take only last digits of over long string.
|
||||
if ((unsigned int) (pEnd - pBegin) > 2 * size ())
|
||||
pBegin = pEnd - 2 * size ();
|
||||
|
||||
unsigned char* pOut = end () - ((pEnd - pBegin + 1) / 2);
|
||||
|
||||
zero ();
|
||||
|
||||
if ((pEnd - pBegin) & 1)
|
||||
*pOut++ = phexdigit[*pBegin++];
|
||||
|
||||
while (pBegin != pEnd)
|
||||
{
|
||||
unsigned char cHigh = phexdigit[*pBegin++] << 4;
|
||||
unsigned char cLow = pBegin == pEnd
|
||||
? 0
|
||||
: phexdigit[*pBegin++];
|
||||
*pOut++ = cHigh | cLow;
|
||||
}
|
||||
|
||||
return !*pEnd;
|
||||
}
|
||||
|
||||
bool SetHex (const std::string& str, bool bStrict = false)
|
||||
{
|
||||
return SetHex (str.c_str (), bStrict);
|
||||
}
|
||||
|
||||
void SetHexExact (const std::string& str)
|
||||
{
|
||||
SetHexExact (str.c_str ());
|
||||
}
|
||||
|
||||
std::string ToString () const
|
||||
{
|
||||
return GetHex ();
|
||||
}
|
||||
|
||||
unsigned char* begin ()
|
||||
{
|
||||
return reinterpret_cast<unsigned char*> (pn);
|
||||
}
|
||||
|
||||
unsigned char* end ()
|
||||
{
|
||||
return reinterpret_cast<unsigned char*> (pn + WIDTH);
|
||||
}
|
||||
|
||||
unsigned char const* cbegin () const noexcept
|
||||
{
|
||||
return reinterpret_cast <unsigned char const*> (pn);
|
||||
}
|
||||
|
||||
unsigned char const* cend () const noexcept
|
||||
{
|
||||
return reinterpret_cast<unsigned char const*> (pn + WIDTH);
|
||||
}
|
||||
|
||||
const unsigned char* begin () const noexcept
|
||||
{
|
||||
return cbegin ();
|
||||
}
|
||||
|
||||
const unsigned char* end () const noexcept
|
||||
{
|
||||
return cend ();
|
||||
}
|
||||
|
||||
unsigned int size () const
|
||||
{
|
||||
return sizeof (pn);
|
||||
}
|
||||
|
||||
void zero ()
|
||||
{
|
||||
memset (&pn[0], 0, sizeof (pn));
|
||||
}
|
||||
|
||||
unsigned int GetSerializeSize (int nType = 0) const
|
||||
{
|
||||
return sizeof (pn);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize (Stream& s, int nType = 0) const
|
||||
{
|
||||
s.write ((char*)pn, sizeof (pn));
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize (Stream& s, int nType = 0)
|
||||
{
|
||||
s.read ((char*)pn, sizeof (pn));
|
||||
}
|
||||
|
||||
friend class uint128;
|
||||
friend class uint160;
|
||||
friend class uint256;
|
||||
friend inline int Testuint256AdHoc (std::vector<std::string> vArg);
|
||||
};
|
||||
|
||||
typedef base_uint<128> base_uint128;
|
||||
typedef base_uint<160> base_uint160;
|
||||
typedef base_uint<256> base_uint256;
|
||||
|
||||
template<unsigned int BITS>
|
||||
std::ostream& operator<< (std::ostream& out, const base_uint<BITS>& u)
|
||||
{
|
||||
return out << u.GetHex ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
39
src/ripple/types/api/strHex.h
Normal file
39
src/ripple/types/api/strHex.h
Normal file
@@ -0,0 +1,39 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_TYPES_STRHEX_H_INCLUDED
|
||||
#define RIPPLE_TYPES_STRHEX_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
|
||||
char charHex (int iDigit);
|
||||
|
||||
template<class Iterator>
|
||||
std::string strHex (Iterator first, int iSize)
|
||||
{
|
||||
std::string strDst;
|
||||
|
||||
strDst.resize (iSize * 2);
|
||||
|
||||
for (int i = 0; i < iSize; i++)
|
||||
{
|
||||
unsigned char c = *first++;
|
||||
|
||||
strDst[i * 2] = charHex (c >> 4);
|
||||
strDst[i * 2 + 1] = charHex (c & 15);
|
||||
}
|
||||
|
||||
return strDst;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -9,6 +9,8 @@
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
namespace ripple {
|
||||
|
||||
char const* Base58::s_currentAlphabet = Base58::getRippleAlphabet ();
|
||||
|
||||
char const* Base58::getCurrentAlphabet ()
|
||||
@@ -185,4 +187,5 @@ bool Base58::decodeWithCheck (const std::string& str, Blob& vchRet, const char*
|
||||
return decodeWithCheck (str.c_str (), vchRet, pAlphabet);
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
#if BEAST_WIN32
|
||||
|
||||
// from: http://stackoverflow.com/questions/3022552/is-there-any-standard-htonl-like-function-for-64-bits-integers-in-c
|
||||
@@ -42,3 +44,5 @@ uint32_t be32toh (uint32_t value)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -4,6 +4,27 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// VFALCO TODO Replace OpenSSL randomness with a dependency-free implementation
|
||||
// Perhaps Schneier's Fortuna or a variant. Abstract the collection of
|
||||
// entropy and provide OS-specific implementation. We can re-use the
|
||||
// BearShare source code for this.
|
||||
//
|
||||
// Add Random number generation to beast
|
||||
//
|
||||
#include <openssl/rand.h>
|
||||
#if BEAST_WIN32
|
||||
# include <windows.h>
|
||||
# include <wincrypt.h>
|
||||
#endif
|
||||
#if BEAST_LINUX
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <time.h>
|
||||
#endif
|
||||
#include <fstream>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
RandomNumbers::RandomNumbers ()
|
||||
: m_initialized (false)
|
||||
{
|
||||
@@ -13,11 +34,11 @@ RandomNumbers::~RandomNumbers ()
|
||||
{
|
||||
}
|
||||
|
||||
bool RandomNumbers::initialize ()
|
||||
bool RandomNumbers::initialize (Journal::Stream stream)
|
||||
{
|
||||
assert (!m_initialized);
|
||||
|
||||
bool success = platformAddEntropy ();
|
||||
bool success = platformAddEntropy (stream);
|
||||
|
||||
if (success)
|
||||
m_initialized = true;
|
||||
@@ -37,7 +58,6 @@ void RandomNumbers::fillBytes (void* destinationBuffer, int numberOfBytes)
|
||||
if (! initialize ())
|
||||
{
|
||||
char const* message = "Unable to add system entropy";
|
||||
Log::out() << message;
|
||||
throw std::runtime_error (message);
|
||||
}
|
||||
}
|
||||
@@ -66,7 +86,7 @@ RandomNumbers& RandomNumbers::getInstance ()
|
||||
#if BEAST_WIN32
|
||||
|
||||
// Get entropy from the Windows crypto provider
|
||||
bool RandomNumbers::platformAddEntropy ()
|
||||
bool RandomNumbers::platformAddEntropy (Journal::Stream stream)
|
||||
{
|
||||
char name[512], rand[128];
|
||||
DWORD count = 500;
|
||||
@@ -74,25 +94,19 @@ bool RandomNumbers::platformAddEntropy ()
|
||||
|
||||
if (!CryptGetDefaultProviderA (PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, name, &count))
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
Log::out() << "Unable to get default crypto provider";
|
||||
#endif
|
||||
stream << "Unable to get default crypto provider";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CryptAcquireContextA (&cryptoHandle, NULL, name, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
Log::out() << "Unable to acquire crypto provider";
|
||||
#endif
|
||||
stream << "Unable to acquire crypto provider";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CryptGenRandom (cryptoHandle, 128, reinterpret_cast<BYTE*> (rand)))
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
Log::out() << "Unable to get entropy from crypto provider";
|
||||
#endif
|
||||
stream << "Unable to get entropy from crypto provider";
|
||||
CryptReleaseContext (cryptoHandle, 0);
|
||||
return false;
|
||||
}
|
||||
@@ -105,7 +119,7 @@ bool RandomNumbers::platformAddEntropy ()
|
||||
|
||||
#else
|
||||
|
||||
bool RandomNumbers::platformAddEntropy ()
|
||||
bool RandomNumbers::platformAddEntropy (Journal::Stream stream)
|
||||
{
|
||||
char rand[128];
|
||||
std::ifstream reader;
|
||||
@@ -115,7 +129,7 @@ bool RandomNumbers::platformAddEntropy ()
|
||||
if (!reader.is_open ())
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
Log::out() << "Unable to open random source";
|
||||
stream << "Unable to open random source";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -127,7 +141,7 @@ bool RandomNumbers::platformAddEntropy ()
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
#ifdef BEAST_DEBUG
|
||||
Log::out() << "Unable to read from random source";
|
||||
stream << "Unable to read from random source";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -215,3 +229,5 @@ void RandomNumbers::platformAddPerformanceMonitorEntropy ()
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
16
src/ripple/types/impl/UInt128.cpp
Normal file
16
src/ripple/types/impl/UInt128.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::size_t hash_value (const uint160& u)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <std::size_t> ();
|
||||
|
||||
return u.hash_combine (seed);
|
||||
}
|
||||
|
||||
}
|
||||
16
src/ripple/types/impl/UInt160.cpp
Normal file
16
src/ripple/types/impl/UInt160.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
base_uint256 uint160::to256 () const
|
||||
{
|
||||
uint256 m;
|
||||
memcpy (m.begin (), begin (), size ());
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
std::size_t hash_value (uint256 const& u)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <size_t> ();
|
||||
@@ -11,10 +13,4 @@ std::size_t hash_value (uint256 const& u)
|
||||
return u.hash_combine (seed);
|
||||
}
|
||||
|
||||
std::size_t hash_value (const uint160& u)
|
||||
{
|
||||
std::size_t seed = HashMaps::getInstance ().getNonce <size_t> ();
|
||||
|
||||
return u.hash_combine (seed);
|
||||
}
|
||||
|
||||
14
src/ripple/types/impl/strHex.cpp
Normal file
14
src/ripple/types/impl/strHex.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
namespace ripple {
|
||||
|
||||
char charHex (int iDigit)
|
||||
{
|
||||
return iDigit < 10 ? '0' + iDigit : 'A' - 10 + iDigit;
|
||||
}
|
||||
|
||||
}
|
||||
26
src/ripple/types/ripple_types.cpp
Normal file
26
src/ripple/types/ripple_types.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "ripple_types.h"
|
||||
#include "../ripple/sslutil/ripple_sslutil.h"
|
||||
|
||||
#ifdef BEAST_WIN32
|
||||
# include <Winsock2.h> // for ByteOrder.cpp
|
||||
// <Winsock2.h> defines 'max' and does other stupid things
|
||||
# ifdef max
|
||||
# undef max
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "impl/Base58.cpp"
|
||||
#include "impl/ByteOrder.cpp"
|
||||
#include "impl/RandomNumbers.cpp"
|
||||
#include "impl/strHex.cpp"
|
||||
#include "impl/UInt128.cpp"
|
||||
#include "impl/UInt160.cpp"
|
||||
#include "impl/UInt256.cpp"
|
||||
40
src/ripple/types/ripple_types.h
Normal file
40
src/ripple/types/ripple_types.h
Normal file
@@ -0,0 +1,40 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_TYPES_H_INCLUDED
|
||||
#define RIPPLE_TYPES_H_INCLUDED
|
||||
|
||||
#include "beast/modules/beast_core/beast_core.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
// For ByteOrder
|
||||
#if BEAST_WIN32
|
||||
// (nothing)
|
||||
#elif __APPLE__
|
||||
# include <libkern/OSByteOrder.h>
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
# include <sys/endian.h>
|
||||
#elif defined(__OpenBSD__)
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
namespace ripple {
|
||||
using namespace beast;
|
||||
}
|
||||
|
||||
# include "api/Blob.h"
|
||||
# include "api/Base58.h"
|
||||
# include "api/ByteOrder.h"
|
||||
# include "api/strHex.h"
|
||||
# include "api/UInt128.h"
|
||||
# include "api/UInt160.h"
|
||||
# include "api/UInt256.h"
|
||||
# include "api/RandomNumbers.h"
|
||||
#include "api/HashMaps.h"
|
||||
|
||||
#endif
|
||||
@@ -312,6 +312,8 @@ public:
|
||||
|
||||
Json::Value entries (Json::arrayValue);
|
||||
ChosenList::Ptr list (m_chosenList);
|
||||
if (list != nullptr)
|
||||
{
|
||||
for (ChosenList::MapType::const_iterator iter (list->map().begin());
|
||||
iter != list->map().end(); ++iter)
|
||||
{
|
||||
@@ -324,6 +326,7 @@ public:
|
||||
*/
|
||||
entries.append (entry);
|
||||
}
|
||||
}
|
||||
result ["chosen_list"] = entries;
|
||||
|
||||
return result;
|
||||
@@ -343,6 +346,17 @@ public:
|
||||
SourceDesc const& desc (*iter);
|
||||
entry ["name"] = desc.source->name();
|
||||
entry ["param"] = desc.source->createParam();
|
||||
|
||||
Json::Value results (Json::arrayValue);
|
||||
for (int i = 0; i < desc.result.list.size(); ++i)
|
||||
{
|
||||
Json::Value info (Json::objectValue);
|
||||
info ["key"] = "publicKey";
|
||||
info ["label"] = desc.result.list[i].label;
|
||||
results.append (info);
|
||||
}
|
||||
entry ["result"] = results;
|
||||
|
||||
entries.append (entry);
|
||||
}
|
||||
result ["sources"] = entries;
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
|
||||
Json::Value rpcRebuild (Json::Value const& args)
|
||||
{
|
||||
m_thread.call (&Logic::dirtyChosen, &m_logic);
|
||||
m_thread.call (&Logic::buildChosen, &m_logic);
|
||||
Json::Value result;
|
||||
result ["chosen_list"] = "rebuilding";
|
||||
return result;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "ripple_validators.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_DATABASE_RIPPLEHEADER
|
||||
#define RIPPLE_DATABASE_RIPPLEHEADER
|
||||
#ifndef RIPPLE_DATABASE_H_INCLUDED
|
||||
#define RIPPLE_DATABASE_H_INCLUDED
|
||||
|
||||
// VFALCO Get rid of these macros
|
||||
//
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SQLITEDATABASE_RIPPLEHEADER
|
||||
#define RIPPLE_SQLITEDATABASE_RIPPLEHEADER
|
||||
#ifndef RIPPLE_SQLITEDATABASE_H_INCLUDED
|
||||
#define RIPPLE_SQLITEDATABASE_H_INCLUDED
|
||||
|
||||
class SqliteDatabase
|
||||
: public Database
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_HASHROUTER_RIPPLEHEADER
|
||||
#define RIPPLE_HASHROUTER_RIPPLEHEADER
|
||||
#ifndef RIPPLE_HASHROUTER_H_INCLUDED
|
||||
#define RIPPLE_HASHROUTER_H_INCLUDED
|
||||
|
||||
// VFALCO NOTE Are these the flags?? Why aren't we using a packed struct?
|
||||
// VFALCO TODO convert these macros to int constants
|
||||
|
||||
@@ -3,13 +3,21 @@
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
//
|
||||
|
||||
#ifndef RIPPLE_PACKEDMESSAGE_H_INCLUDED
|
||||
#define RIPPLE_PACKEDMESSAGE_H_INCLUDED
|
||||
|
||||
#include "ripple.pb.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// packaging of messages into length/type-prepended buffers
|
||||
// ready for transmission.
|
||||
|
||||
#ifndef RIPPLE_PACKEDMESSAGE_H
|
||||
#define RIPPLE_PACKEDMESSAGE_H
|
||||
|
||||
//
|
||||
// PackedMessage implements simple "packing" of protocol buffers Messages into
|
||||
// a string prepended by a header specifying the message length.
|
||||
// MessageType should be a Message class generated by the protobuf compiler.
|
||||
@@ -56,5 +64,8 @@ private:
|
||||
std::vector <uint8_t> mBuffer;
|
||||
};
|
||||
|
||||
#endif /* PACKEDMESSAGE_H */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/bimap.hpp>
|
||||
#include <boost/bimap/list_of.hpp>
|
||||
#include <boost/bimap/multiset_of.hpp>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
// purely abstract and move implementation into .cpp files.
|
||||
//
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/asio/read_until.hpp>
|
||||
@@ -42,6 +42,12 @@
|
||||
#include "beast/modules/beast_sqdb/beast_sqdb.h"
|
||||
#include "beast/modules/beast_sqlite/beast_sqlite.h"
|
||||
|
||||
// VFALCO NOTE If we forward declare PackedMessage and write out shared_ptr
|
||||
// instead of using the in-class typedef, we can remove the entire
|
||||
// ripple.pb.h from the main headers.
|
||||
//
|
||||
#include "peers/PackedMessage.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/bimap.hpp>
|
||||
#include <boost/bimap/multiset_of.hpp>
|
||||
#include <boost/bimap/unordered_set_of.hpp>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "../ripple_net/ripple_net.h"
|
||||
|
||||
#include <fstream> // for UniqueNodeList.cpp
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
|
||||
@@ -25,5 +25,6 @@ namespace ripple
|
||||
# include "misc/ProofOfWork.h"
|
||||
# include "misc/ProofOfWorkFactory.h"
|
||||
#include "peers/Peer.cpp"
|
||||
#include "peers/PackedMessage.cpp"
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_WSDOOR_RIPPLEHEADER
|
||||
#define RIPPLE_WSDOOR_RIPPLEHEADER
|
||||
#ifndef RIPPLE_WSDOOR_H_INCLUDED
|
||||
#define RIPPLE_WSDOOR_H_INCLUDED
|
||||
|
||||
/** Handles accepting incoming WebSocket connections. */
|
||||
class WSDoor : public Stoppable
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
#define RIPPLE_KEYCACHE_H_INCLUDED
|
||||
|
||||
// This tag is for helping track the locks
|
||||
struct KeyCacheBase
|
||||
{
|
||||
};
|
||||
struct KeyCacheBase { };
|
||||
|
||||
/** Maintains a cache of keys with no associated data.
|
||||
|
||||
@@ -23,8 +21,6 @@ struct KeyCacheBase
|
||||
@code
|
||||
static int getElapsedSeconds ();
|
||||
@endcode
|
||||
|
||||
@ingroup ripple_basics
|
||||
*/
|
||||
template <class Key, class Timer>
|
||||
class KeyCache : public KeyCacheBase
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SECUREALLOCATOR_H_INCLUDED
|
||||
#define RIPPLE_SECUREALLOCATOR_H_INCLUDED
|
||||
|
||||
//
|
||||
// Allocator that locks its contents from being paged
|
||||
// out of memory and clears its contents before deletion.
|
||||
//
|
||||
template<typename T>
|
||||
struct secure_allocator : public std::allocator<T>
|
||||
{
|
||||
// MSVC8 default copy constructor is broken
|
||||
typedef std::allocator<T> base;
|
||||
typedef typename base::size_type size_type;
|
||||
typedef typename base::difference_type difference_type;
|
||||
typedef typename base::pointer pointer;
|
||||
typedef typename base::const_pointer const_pointer;
|
||||
typedef typename base::reference reference;
|
||||
typedef typename base::const_reference const_reference;
|
||||
typedef typename base::value_type value_type;
|
||||
secure_allocator () throw () {}
|
||||
secure_allocator (const secure_allocator& a) throw () : base (a) {}
|
||||
template <typename U>
|
||||
secure_allocator (const secure_allocator<U>& a) throw () : base (a) {}
|
||||
~secure_allocator () throw () {}
|
||||
template<typename _Other> struct rebind
|
||||
{
|
||||
typedef secure_allocator<_Other> other;
|
||||
};
|
||||
|
||||
T* allocate (std::size_t n, const void* hint = 0)
|
||||
{
|
||||
T* p;
|
||||
p = std::allocator<T>::allocate (n, hint);
|
||||
|
||||
if (p != NULL)
|
||||
mlock (p, sizeof (T) * n);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void deallocate (T* p, std::size_t n)
|
||||
{
|
||||
if (p != NULL)
|
||||
{
|
||||
memset (p, 0, sizeof (T) * n);
|
||||
munlock (p, sizeof (T) * n);
|
||||
}
|
||||
|
||||
std::allocator<T>::deallocate (p, n);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,16 +4,15 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
/** Add this to get the @ref ripple_basics module.
|
||||
|
||||
@file ripple_basics.cpp
|
||||
@ingroup ripple_basics
|
||||
*/
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "ripple_basics.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/asio.hpp> // For StringUtilities.cpp
|
||||
|
||||
#include <fstream> // for Log files
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// For Sustain Linux variants
|
||||
@@ -31,29 +30,6 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// For random numbers
|
||||
//
|
||||
// VFALCO TODO Replace OpenSSL randomness with a dependency-free implementation
|
||||
// Perhaps Schneier's Fortuna or a variant. Abstract the collection of
|
||||
// entropy and provide OS-specific implementation. We can re-use the
|
||||
// BearShare source code for this.
|
||||
//
|
||||
// Add Random number generation to beast
|
||||
//
|
||||
#include <openssl/rand.h> // Because of ripple_RandomNumbers.cpp
|
||||
|
||||
#ifdef BEAST_WIN32
|
||||
# include <windows.h> // for ripple_RandomNumbers.cpp
|
||||
# include <wincrypt.h> // for ripple_RandomNumbers.cpp
|
||||
# include <Winsock2.h> // for ripple_ByteOrder.cpp
|
||||
// <Winsock2.h> defines 'max' and does other stupid things
|
||||
# ifdef max
|
||||
# undef max
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
@@ -66,9 +42,7 @@ namespace ripple
|
||||
#include "log/LogPartition.cpp"
|
||||
#include "log/LogSink.cpp"
|
||||
|
||||
#include "utility/ByteOrder.cpp"
|
||||
#include "utility/CountedObject.cpp"
|
||||
#include "utility/DiffieHellmanUtil.cpp"
|
||||
#include "utility/IniFile.cpp"
|
||||
#include "utility/StringUtilities.cpp"
|
||||
#include "utility/Sustain.cpp"
|
||||
@@ -76,8 +50,4 @@ namespace ripple
|
||||
#include "utility/Time.cpp"
|
||||
#include "utility/UptimeTimer.cpp"
|
||||
|
||||
#include "utility/RandomNumbers.cpp" // has Win32/Posix dependencies
|
||||
|
||||
#include "types/UInt256.cpp"
|
||||
|
||||
}
|
||||
|
||||
@@ -4,33 +4,15 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
/** Include this to get the @ref ripple_basics module.
|
||||
|
||||
@file ripple_basics.h
|
||||
@ingroup ripple_basics
|
||||
*/
|
||||
|
||||
/** Basic classes.
|
||||
|
||||
This module provides utility classes and types used in the Ripple system.
|
||||
|
||||
@defgroup ripple_basics
|
||||
*/
|
||||
|
||||
#ifndef RIPPLE_BASICS_RIPPLEHEADER
|
||||
#define RIPPLE_BASICS_RIPPLEHEADER
|
||||
|
||||
#include "system/StandardIncludes.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "system/BoostIncludes.h"
|
||||
|
||||
#include "system/OpenSSLIncludes.h"
|
||||
#ifndef RIPPLE_BASICS_H_INCLUDED
|
||||
#define RIPPLE_BASICS_H_INCLUDED
|
||||
|
||||
#include "beast/modules/beast_core/beast_core.h"
|
||||
#include "beast/modules/beast_crypto/beast_crypto.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include "system/BoostIncludes.h"
|
||||
|
||||
#include "../../beast/beast/Utility.h"
|
||||
|
||||
#ifndef RIPPLE_TRACK_MUTEXES
|
||||
@@ -59,20 +41,7 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// ByteOrder
|
||||
#if BEAST_WIN32
|
||||
// (nothing)
|
||||
#elif __APPLE__
|
||||
# include <libkern/OSByteOrder.h>
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
# include <sys/endian.h>
|
||||
#elif defined(__OpenBSD__)
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "beast/modules/beast_core/beast_core.h"
|
||||
#include "../ripple/types/ripple_types.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
@@ -80,6 +49,8 @@ namespace ripple
|
||||
using namespace beast;
|
||||
|
||||
#include "types/BasicTypes.h"
|
||||
#include "types/RipplePublicKey.h"
|
||||
#include "types/RipplePublicKeyHash.h"
|
||||
|
||||
# include "log/LogSeverity.h"
|
||||
# include "log/LogFile.h"
|
||||
@@ -89,25 +60,17 @@ using namespace beast;
|
||||
#include "log/LogJournal.h"
|
||||
#include "log/LoggedTimings.h"
|
||||
|
||||
#include "utility/ByteOrder.h"
|
||||
#include "utility/CountedObject.h"
|
||||
#include "utility/DiffieHellmanUtil.h"
|
||||
#include "utility/IniFile.h"
|
||||
#include "utility/PlatformMacros.h"
|
||||
#include "utility/RandomNumbers.h"
|
||||
#include "utility/StringUtilities.h"
|
||||
#include "utility/Sustain.h"
|
||||
#include "utility/ThreadName.h"
|
||||
#include "utility/Time.h"
|
||||
#include "utility/UptimeTimer.h"
|
||||
|
||||
#include "types/UInt256.h"
|
||||
#include "utility/HashUtilities.h" // requires UInt256
|
||||
#include "types/HashMaps.h"
|
||||
|
||||
#include "containers/KeyCache.h"
|
||||
#include "containers/RangeSet.h"
|
||||
#include "containers/SecureAllocator.h"
|
||||
#include "containers/TaggedCache.h"
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_BOOSTINCLUDES_RIPPLEHEADER
|
||||
#define RIPPLE_BOOSTINCLUDES_RIPPLEHEADER
|
||||
#ifndef RIPPLE_BOOSTINCLUDES_H_INCLUDED
|
||||
#define RIPPLE_BOOSTINCLUDES_H_INCLUDED
|
||||
|
||||
// All Boost includes used throughout Ripple.
|
||||
//
|
||||
@@ -27,17 +27,13 @@
|
||||
#define BOOST_FILESYSTEM_NO_DEPRECATED
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/ptr_container/ptr_vector.hpp> // VFALCO NOTE this looks like junk
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_OPENSSLINCLUDES_RIPPLEHEADER
|
||||
#define RIPPLE_OPENSSLINCLUDES_RIPPLEHEADER
|
||||
|
||||
// All OpenSSL includes we need
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/ripemd.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_STANDARDINCLUDES_RIPPLEHEADER
|
||||
#define RIPPLE_STANDARDINCLUDES_RIPPLEHEADER
|
||||
|
||||
// All required Standard C++ Library includes
|
||||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <deque>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#endif
|
||||
@@ -7,12 +7,6 @@
|
||||
#ifndef RIPPLE_BASICTYPES_H
|
||||
#define RIPPLE_BASICTYPES_H
|
||||
|
||||
/** Storage for linear binary data.
|
||||
|
||||
Blocks of binary data appear often in various idioms and structures.
|
||||
*/
|
||||
typedef std::vector <unsigned char> Blob;
|
||||
|
||||
/** Synchronization primitives.
|
||||
This lets us switch between tracked and untracked mutexes.
|
||||
*/
|
||||
@@ -29,12 +23,6 @@ typedef DeprecatedRecursiveMutex::scoped_lock DeprecatedScopedLock;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** A container used to hold a public key in binary format. */
|
||||
typedef UnsignedInteger <33> RipplePublicKey;
|
||||
|
||||
/** A container holding the hash of a public key in binary format. */
|
||||
typedef UnsignedInteger <20> RipplePublicKeyHash;
|
||||
|
||||
/** A callback used to check for canceling an operation. */
|
||||
typedef SharedFunction <bool(void)> CancelCallback;
|
||||
|
||||
|
||||
80
src/ripple_basics/types/RipplePublicKey.h
Normal file
80
src/ripple_basics/types/RipplePublicKey.h
Normal file
@@ -0,0 +1,80 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_BASICS_RIPPLEPUBLICKEY_H_INCLUDED
|
||||
#define RIPPLE_BASICS_RIPPLEPUBLICKEY_H_INCLUDED
|
||||
|
||||
/** A container used to hold a public key in binary format. */
|
||||
typedef UnsignedInteger <33> RipplePublicKey;
|
||||
#if 0
|
||||
class RipplePublicKey
|
||||
{
|
||||
private:
|
||||
typedef UnsignedInteger <33> integer_type;
|
||||
|
||||
public:
|
||||
enum
|
||||
{
|
||||
size = integer_type::sizeInBytes
|
||||
};
|
||||
|
||||
typedef integer_type::value_type value_type;
|
||||
typedef integer_type::iterator iterator;
|
||||
typedef integer_type::const_iterator const_iterator;
|
||||
|
||||
class HashFunction
|
||||
{
|
||||
public:
|
||||
HashFunction (HashValue seedToUse = Random::getSystemRandom().nextInt())
|
||||
: m_hash (seedToUse)
|
||||
{
|
||||
}
|
||||
|
||||
HashValue operator() (RipplePublicKey const& value) const
|
||||
{
|
||||
return m_hash (value);
|
||||
}
|
||||
|
||||
private:
|
||||
integer_type::HashFunction m_hash;
|
||||
};
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return m_value.begin();
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return m_value.end();
|
||||
}
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
return m_value.begin();
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return m_value.end();
|
||||
}
|
||||
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return m_value.cbegin();
|
||||
}
|
||||
|
||||
const_iterator cend() const
|
||||
{
|
||||
return m_value.cend();
|
||||
}
|
||||
|
||||
private:
|
||||
integer_type m_value;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
13
src/ripple_basics/types/RipplePublicKeyHash.h
Normal file
13
src/ripple_basics/types/RipplePublicKeyHash.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_BASICS_RIPPLEPUBLICKEYHASH_H_INCLUDED
|
||||
#define RIPPLE_BASICS_RIPPLEPUBLICKEYHASH_H_INCLUDED
|
||||
|
||||
/** A container holding the hash of a public key in binary format. */
|
||||
typedef UnsignedInteger <20> RipplePublicKeyHash;
|
||||
|
||||
#endif
|
||||
@@ -1,942 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2011 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef RIPPLE_UINT256_H
|
||||
#define RIPPLE_UINT256_H
|
||||
|
||||
// These classes all store their values internally
|
||||
// in big-endian form
|
||||
|
||||
inline int Testuint256AdHoc (std::vector<std::string> vArg);
|
||||
|
||||
// We have to keep a separate base class without constructors
|
||||
// so the compiler will let us use it in a union
|
||||
//
|
||||
// VFALCO NOTE This class produces undefined behavior when
|
||||
// BITS is not a multiple of 32!!!
|
||||
//
|
||||
template<unsigned int BITS>
|
||||
class base_uint
|
||||
{
|
||||
protected:
|
||||
enum { WIDTH = BITS / 32 };
|
||||
|
||||
// This is really big-endian in byte order.
|
||||
// We sometimes use unsigned int for speed.
|
||||
unsigned int pn[WIDTH];
|
||||
|
||||
public:
|
||||
base_uint ()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
// This is to disambiguate from other 1 parameter ctors
|
||||
struct FromVoid { };
|
||||
|
||||
/** Construct from a raw pointer.
|
||||
|
||||
The buffer pointed to by `data` must be at least 32 bytes.
|
||||
*/
|
||||
base_uint (void const* data, FromVoid)
|
||||
{
|
||||
// BITS must be a multiple of 32
|
||||
static_bassert ((BITS % 32) == 0);
|
||||
|
||||
memcpy (&pn [0], data, BITS / 8);
|
||||
}
|
||||
public:
|
||||
|
||||
bool isZero () const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
if (pn[i] != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isNonZero () const
|
||||
{
|
||||
return !isZero ();
|
||||
}
|
||||
|
||||
bool operator! () const
|
||||
{
|
||||
return isZero ();
|
||||
}
|
||||
|
||||
const base_uint operator~ () const
|
||||
{
|
||||
base_uint ret;
|
||||
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
ret.pn[i] = ~pn[i];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator= (uint64 uHost)
|
||||
{
|
||||
zero ();
|
||||
|
||||
// Put in least significant bits.
|
||||
((uint64*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator^= (const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] ^= b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator&= (const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] &= b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator|= (const base_uint& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] |= b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
base_uint& operator++ ()
|
||||
{
|
||||
// prefix operator
|
||||
for (int i = WIDTH - 1; i >= 0; --i)
|
||||
{
|
||||
pn[i] = htobe32 (be32toh (pn[i]) + 1);
|
||||
|
||||
if (pn[i] != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
const base_uint operator++ (int)
|
||||
{
|
||||
// postfix operator
|
||||
const base_uint ret = *this;
|
||||
++ (*this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator-- ()
|
||||
{
|
||||
for (int i = WIDTH - 1; i >= 0; --i)
|
||||
{
|
||||
uint32 prev = pn[i];
|
||||
pn[i] = htobe32 (be32toh (pn[i]) - 1);
|
||||
|
||||
if (prev != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
const base_uint operator-- (int)
|
||||
{
|
||||
// postfix operator
|
||||
const base_uint ret = *this;
|
||||
-- (*this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
base_uint& operator+= (const base_uint& b)
|
||||
{
|
||||
uint64 carry = 0;
|
||||
|
||||
for (int i = WIDTH; i--;)
|
||||
{
|
||||
uint64 n = carry + be32toh (pn[i]) + be32toh (b.pn[i]);
|
||||
|
||||
pn[i] = htobe32 (n & 0xffffffff);
|
||||
carry = n >> 32;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::size_t hash_combine (std::size_t& seed) const
|
||||
{
|
||||
for (int i = 0; i < WIDTH; ++i)
|
||||
boost::hash_combine (seed, pn[i]);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
friend inline int compare (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
const unsigned char* pA = a.begin ();
|
||||
const unsigned char* pAEnd = a.end ();
|
||||
const unsigned char* pB = b.begin ();
|
||||
|
||||
while (*pA == *pB)
|
||||
{
|
||||
if (++pA == pAEnd)
|
||||
return 0;
|
||||
|
||||
++pB;
|
||||
}
|
||||
|
||||
return (*pA < *pB) ? -1 : 1;
|
||||
}
|
||||
|
||||
friend inline bool operator< (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) < 0;
|
||||
}
|
||||
|
||||
friend inline bool operator<= (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) <= 0;
|
||||
}
|
||||
|
||||
friend inline bool operator> (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) > 0;
|
||||
}
|
||||
|
||||
friend inline bool operator>= (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return compare (a, b) >= 0;
|
||||
}
|
||||
|
||||
friend inline bool operator== (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return memcmp (a.pn, b.pn, sizeof (a.pn)) == 0;
|
||||
}
|
||||
|
||||
friend inline bool operator!= (const base_uint& a, const base_uint& b)
|
||||
{
|
||||
return memcmp (a.pn, b.pn, sizeof (a.pn)) != 0;
|
||||
}
|
||||
|
||||
std::string GetHex () const
|
||||
{
|
||||
return strHex (begin (), size ());
|
||||
}
|
||||
|
||||
void SetHexExact (const char* psz)
|
||||
{
|
||||
// must be precisely the correct number of hex digits
|
||||
static signed char phexdigit[256] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
char* pOut = reinterpret_cast<char*> (pn);
|
||||
|
||||
for (int i = 0; i < sizeof (pn); ++i)
|
||||
{
|
||||
*pOut = phexdigit[*psz++] << 4;
|
||||
*pOut++ |= phexdigit[*psz++];
|
||||
}
|
||||
|
||||
assert (*psz == 0);
|
||||
assert (pOut == reinterpret_cast<char*> (end ()));
|
||||
}
|
||||
|
||||
// Allow leading whitespace.
|
||||
// Allow leading "0x".
|
||||
// To be valid must be '\0' terminated.
|
||||
bool SetHex (const char* psz, bool bStrict = false)
|
||||
{
|
||||
// skip leading spaces
|
||||
if (!bStrict)
|
||||
while (isspace (*psz))
|
||||
psz++;
|
||||
|
||||
// skip 0x
|
||||
if (!bStrict && psz[0] == '0' && tolower (psz[1]) == 'x')
|
||||
psz += 2;
|
||||
|
||||
// hex char to int
|
||||
static signed char phexdigit[256] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
const unsigned char* pEnd = reinterpret_cast<const unsigned char*> (psz);
|
||||
const unsigned char* pBegin = pEnd;
|
||||
|
||||
// Find end.
|
||||
while (phexdigit[*pEnd] >= 0)
|
||||
pEnd++;
|
||||
|
||||
// Take only last digits of over long string.
|
||||
if ((unsigned int) (pEnd - pBegin) > 2 * size ())
|
||||
pBegin = pEnd - 2 * size ();
|
||||
|
||||
unsigned char* pOut = end () - ((pEnd - pBegin + 1) / 2);
|
||||
|
||||
zero ();
|
||||
|
||||
if ((pEnd - pBegin) & 1)
|
||||
*pOut++ = phexdigit[*pBegin++];
|
||||
|
||||
while (pBegin != pEnd)
|
||||
{
|
||||
unsigned char cHigh = phexdigit[*pBegin++] << 4;
|
||||
unsigned char cLow = pBegin == pEnd
|
||||
? 0
|
||||
: phexdigit[*pBegin++];
|
||||
*pOut++ = cHigh | cLow;
|
||||
}
|
||||
|
||||
return !*pEnd;
|
||||
}
|
||||
|
||||
bool SetHex (const std::string& str, bool bStrict = false)
|
||||
{
|
||||
return SetHex (str.c_str (), bStrict);
|
||||
}
|
||||
|
||||
void SetHexExact (const std::string& str)
|
||||
{
|
||||
SetHexExact (str.c_str ());
|
||||
}
|
||||
|
||||
std::string ToString () const
|
||||
{
|
||||
return GetHex ();
|
||||
}
|
||||
|
||||
unsigned char* begin ()
|
||||
{
|
||||
return reinterpret_cast<unsigned char*> (pn);
|
||||
}
|
||||
|
||||
unsigned char* end ()
|
||||
{
|
||||
return reinterpret_cast<unsigned char*> (pn + WIDTH);
|
||||
}
|
||||
|
||||
unsigned char const* cbegin () const noexcept
|
||||
{
|
||||
return reinterpret_cast <unsigned char const*> (pn);
|
||||
}
|
||||
|
||||
unsigned char const* cend () const noexcept
|
||||
{
|
||||
return reinterpret_cast<unsigned char const*> (pn + WIDTH);
|
||||
}
|
||||
|
||||
const unsigned char* begin () const noexcept
|
||||
{
|
||||
return cbegin ();
|
||||
}
|
||||
|
||||
const unsigned char* end () const noexcept
|
||||
{
|
||||
return cend ();
|
||||
}
|
||||
|
||||
unsigned int size () const
|
||||
{
|
||||
return sizeof (pn);
|
||||
}
|
||||
|
||||
void zero ()
|
||||
{
|
||||
memset (&pn[0], 0, sizeof (pn));
|
||||
}
|
||||
|
||||
unsigned int GetSerializeSize (int nType = 0) const
|
||||
{
|
||||
return sizeof (pn);
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Serialize (Stream& s, int nType = 0) const
|
||||
{
|
||||
s.write ((char*)pn, sizeof (pn));
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
void Unserialize (Stream& s, int nType = 0)
|
||||
{
|
||||
s.read ((char*)pn, sizeof (pn));
|
||||
}
|
||||
|
||||
friend class uint128;
|
||||
friend class uint160;
|
||||
friend class uint256;
|
||||
friend inline int Testuint256AdHoc (std::vector<std::string> vArg);
|
||||
};
|
||||
|
||||
typedef base_uint<128> base_uint128;
|
||||
typedef base_uint<160> base_uint160;
|
||||
typedef base_uint<256> base_uint256;
|
||||
|
||||
//
|
||||
// uint128, uint160, & uint256 could be implemented as templates, but to keep
|
||||
// compile errors and debugging cleaner, they're copy and pasted.
|
||||
//
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// uint128
|
||||
//
|
||||
|
||||
class uint128 : public base_uint128
|
||||
{
|
||||
public:
|
||||
typedef base_uint128 basetype;
|
||||
|
||||
uint128 ()
|
||||
{
|
||||
zero ();
|
||||
}
|
||||
|
||||
uint128 (const basetype& b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint128& operator= (const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint128 (const base_uint256& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
}
|
||||
|
||||
explicit uint128 (Blob const& vch)
|
||||
{
|
||||
if (vch.size () == size ())
|
||||
memcpy (pn, &vch[0], size ());
|
||||
else
|
||||
zero ();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// uint256
|
||||
//
|
||||
|
||||
class uint256 : public base_uint256
|
||||
{
|
||||
public:
|
||||
typedef base_uint256 basetype;
|
||||
|
||||
uint256 ()
|
||||
{
|
||||
zero ();
|
||||
}
|
||||
|
||||
uint256 (const basetype& b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint256& operator= (const basetype& b)
|
||||
{
|
||||
if (pn != b.pn)
|
||||
memcpy (pn, b.pn, sizeof (pn));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint256 (uint64 b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
private:
|
||||
uint256 (void const* data, FromVoid)
|
||||
: base_uint256 (data, FromVoid ())
|
||||
{
|
||||
}
|
||||
public:
|
||||
static uint256 fromVoid (void const* data)
|
||||
{
|
||||
return uint256 (data, FromVoid ());
|
||||
}
|
||||
|
||||
uint256& operator= (uint64 uHost)
|
||||
{
|
||||
zero ();
|
||||
|
||||
// Put in least significant bits.
|
||||
((uint64*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint256 (const std::string& str)
|
||||
{
|
||||
SetHex (str);
|
||||
}
|
||||
|
||||
explicit uint256 (Blob const& vch)
|
||||
{
|
||||
if (vch.size () == sizeof (pn))
|
||||
memcpy (pn, &vch[0], sizeof (pn));
|
||||
else
|
||||
{
|
||||
assert (false);
|
||||
zero ();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline bool operator== (uint256 const& a, uint64 b)
|
||||
{
|
||||
return (base_uint256)a == b;
|
||||
}
|
||||
inline bool operator!= (uint256 const& a, uint64 b)
|
||||
{
|
||||
return (base_uint256)a != b;
|
||||
}
|
||||
inline const uint256 operator^ (const base_uint256& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) ^= b;
|
||||
}
|
||||
inline const uint256 operator& (const base_uint256& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) &= b;
|
||||
}
|
||||
inline const uint256 operator| (const base_uint256& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) |= b;
|
||||
}
|
||||
inline bool operator== (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a == (base_uint256)b;
|
||||
}
|
||||
inline bool operator!= (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a != (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator^ (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a ^ (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator& (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a & (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator| (const base_uint256& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a | (base_uint256)b;
|
||||
}
|
||||
inline bool operator== (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a == (base_uint256)b;
|
||||
}
|
||||
inline bool operator!= (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a != (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator^ (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a ^ (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator& (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return uint256 (a) &= b;
|
||||
}
|
||||
inline const uint256 operator| (uint256 const& a, const base_uint256& b)
|
||||
{
|
||||
return (base_uint256)a | (base_uint256)b;
|
||||
}
|
||||
inline bool operator== (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a == (base_uint256)b;
|
||||
}
|
||||
inline bool operator!= (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a != (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator^ (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a ^ (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator& (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a & (base_uint256)b;
|
||||
}
|
||||
inline const uint256 operator| (uint256 const& a, uint256 const& b)
|
||||
{
|
||||
return (base_uint256)a | (base_uint256)b;
|
||||
}
|
||||
|
||||
template<unsigned int BITS> inline std::ostream& operator<< (std::ostream& out, const base_uint<BITS>& u)
|
||||
{
|
||||
return out << u.GetHex ();
|
||||
}
|
||||
|
||||
inline int Testuint256AdHoc (std::vector<std::string> vArg)
|
||||
{
|
||||
uint256 g (uint64 (0));
|
||||
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
--g;
|
||||
printf ("--g\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
g--;
|
||||
printf ("g--\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
g++;
|
||||
printf ("g++\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
++g;
|
||||
printf ("++g\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
g++;
|
||||
printf ("g++\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
++g;
|
||||
printf ("++g\n");
|
||||
printf ("%s\n", g.ToString ().c_str ());
|
||||
|
||||
|
||||
|
||||
uint256 a (7);
|
||||
printf ("a=7\n");
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
|
||||
uint256 b;
|
||||
printf ("b undefined\n");
|
||||
printf ("%s\n", b.ToString ().c_str ());
|
||||
int c = 3;
|
||||
|
||||
a = c;
|
||||
a.pn[3] = 15;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
uint256 k (c);
|
||||
|
||||
a = 5;
|
||||
a.pn[3] = 15;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
b = 1;
|
||||
// b <<= 52;
|
||||
|
||||
a |= b;
|
||||
|
||||
// a ^= 0x500;
|
||||
|
||||
printf ("a %s\n", a.ToString ().c_str ());
|
||||
|
||||
a = a | b | (uint256)0x1000;
|
||||
|
||||
|
||||
printf ("a %s\n", a.ToString ().c_str ());
|
||||
printf ("b %s\n", b.ToString ().c_str ());
|
||||
|
||||
a = 0xfffffffe;
|
||||
a.pn[4] = 9;
|
||||
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a++;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
uint256 d = a--;
|
||||
printf ("%s\n", d.ToString ().c_str ());
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
a--;
|
||||
printf ("%s\n", a.ToString ().c_str ());
|
||||
|
||||
d = a;
|
||||
|
||||
printf ("%s\n", d.ToString ().c_str ());
|
||||
|
||||
for (int i = uint256::WIDTH - 1; i >= 0; i--) printf ("%08x", d.pn[i]);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
uint256 neg = d;
|
||||
neg = ~neg;
|
||||
printf ("%s\n", neg.ToString ().c_str ());
|
||||
|
||||
|
||||
uint256 e = uint256 ("0xABCDEF123abcdef12345678909832180000011111111");
|
||||
printf ("\n");
|
||||
printf ("%s\n", e.ToString ().c_str ());
|
||||
|
||||
|
||||
printf ("\n");
|
||||
uint256 x1 = uint256 ("0xABCDEF123abcdef12345678909832180000011111111");
|
||||
uint256 x2;
|
||||
printf ("%s\n", x1.ToString ().c_str ());
|
||||
|
||||
for (int i = 0; i < 270; i += 4)
|
||||
{
|
||||
// x2 = x1 << i;
|
||||
printf ("%s\n", x2.ToString ().c_str ());
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", x1.ToString ().c_str ());
|
||||
|
||||
for (int i = 0; i < 270; i += 4)
|
||||
{
|
||||
x2 = x1;
|
||||
// x2 >>= i;
|
||||
printf ("%s\n", x2.ToString ().c_str ());
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
uint256 k = (~uint256 (0) >> i);
|
||||
printf ("%s\n", k.ToString ().c_str ());
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
uint256 k = (~uint256 (0) << i);
|
||||
printf ("%s\n", k.ToString ().c_str ());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// uint160
|
||||
//
|
||||
|
||||
class uint160 : public base_uint160
|
||||
{
|
||||
public:
|
||||
typedef base_uint160 basetype;
|
||||
|
||||
uint160 ()
|
||||
{
|
||||
zero ();
|
||||
}
|
||||
|
||||
uint160 (const basetype& b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint160& operator= (const basetype& b)
|
||||
{
|
||||
for (int i = 0; i < WIDTH; i++)
|
||||
pn[i] = b.pn[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
uint160 (uint64 b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
|
||||
uint160& operator= (uint64 uHost)
|
||||
{
|
||||
zero ();
|
||||
|
||||
// Put in least significant bits.
|
||||
((uint64*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit uint160 (const std::string& str)
|
||||
{
|
||||
SetHex (str);
|
||||
}
|
||||
|
||||
explicit uint160 (Blob const& vch)
|
||||
{
|
||||
if (vch.size () == sizeof (pn))
|
||||
memcpy (pn, &vch[0], sizeof (pn));
|
||||
else
|
||||
zero ();
|
||||
}
|
||||
|
||||
base_uint256 to256 () const
|
||||
{
|
||||
uint256 m;
|
||||
memcpy (m.begin (), begin (), size ());
|
||||
return m;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline bool operator== (const uint160& a, uint64 b)
|
||||
{
|
||||
return (base_uint160)a == b;
|
||||
}
|
||||
inline bool operator!= (const uint160& a, uint64 b)
|
||||
{
|
||||
return (base_uint160)a != b;
|
||||
}
|
||||
|
||||
inline const uint160 operator^ (const base_uint160& a, const base_uint160& b)
|
||||
{
|
||||
return uint160 (a) ^= b;
|
||||
}
|
||||
inline const uint160 operator& (const base_uint160& a, const base_uint160& b)
|
||||
{
|
||||
return uint160 (a) &= b;
|
||||
}
|
||||
inline const uint160 operator| (const base_uint160& a, const base_uint160& b)
|
||||
{
|
||||
return uint160 (a) |= b;
|
||||
}
|
||||
|
||||
inline bool operator== (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a == (base_uint160)b;
|
||||
}
|
||||
inline bool operator!= (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a != (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator^ (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a ^ (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator& (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a & (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator| (const base_uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a | (base_uint160)b;
|
||||
}
|
||||
|
||||
inline bool operator== (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a == (base_uint160)b;
|
||||
}
|
||||
inline bool operator!= (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a != (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator^ (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a ^ (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator& (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a & (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator| (const uint160& a, const base_uint160& b)
|
||||
{
|
||||
return (base_uint160)a | (base_uint160)b;
|
||||
}
|
||||
inline bool operator== (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a == (base_uint160)b;
|
||||
}
|
||||
inline bool operator!= (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a != (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator^ (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a ^ (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator& (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a & (base_uint160)b;
|
||||
}
|
||||
inline const uint160 operator| (const uint160& a, const uint160& b)
|
||||
{
|
||||
return (base_uint160)a | (base_uint160)b;
|
||||
}
|
||||
|
||||
inline const std::string strHex (const uint160& ui)
|
||||
{
|
||||
return strHex (ui.begin (), ui.size ());
|
||||
}
|
||||
|
||||
extern std::size_t hash_value (const uint160&);
|
||||
|
||||
extern std::size_t hash_value (uint256 const& );
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
// vim:ts=4
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_COUNTEDOBJECT_RIPPLEHEADER
|
||||
#define RIPPLE_COUNTEDOBJECT_RIPPLEHEADER
|
||||
#ifndef RIPPLE_COUNTEDOBJECT_H_INCLUDED
|
||||
#define RIPPLE_COUNTEDOBJECT_H_INCLUDED
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_INIFILE_RIPPLEHEADER
|
||||
#define RIPPLE_INIFILE_RIPPLEHEADER
|
||||
#ifndef RIPPLE_INIFILE_H_INCLUDED
|
||||
#define RIPPLE_INIFILE_H_INCLUDED
|
||||
|
||||
// VFALCO TODO Rename to IniFile and clean up
|
||||
typedef std::map <const std::string, std::vector<std::string> > Section;
|
||||
|
||||
@@ -45,11 +45,6 @@ std::string strprintf (const char* format, ...)
|
||||
return str;
|
||||
}
|
||||
|
||||
char charHex (int iDigit)
|
||||
{
|
||||
return iDigit < 10 ? '0' + iDigit : 'A' - 10 + iDigit;
|
||||
}
|
||||
|
||||
int charUnHex (char cDigit)
|
||||
{
|
||||
return cDigit >= '0' && cDigit <= '9'
|
||||
|
||||
@@ -81,26 +81,6 @@ std::string strJoin (Iterator first, Iterator last, std::string strSeperator)
|
||||
return ossValues.str ();
|
||||
}
|
||||
|
||||
char charHex (int iDigit);
|
||||
|
||||
template<class Iterator>
|
||||
std::string strHex (Iterator first, int iSize)
|
||||
{
|
||||
std::string strDst;
|
||||
|
||||
strDst.resize (iSize * 2);
|
||||
|
||||
for (int i = 0; i < iSize; i++)
|
||||
{
|
||||
unsigned char c = *first++;
|
||||
|
||||
strDst[i * 2] = charHex (c >> 4);
|
||||
strDst[i * 2 + 1] = charHex (c & 15);
|
||||
}
|
||||
|
||||
return strDst;
|
||||
}
|
||||
|
||||
inline const std::string strHex (const std::string& strSrc)
|
||||
{
|
||||
return strHex (strSrc.begin (), strSrc.size ());
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_ILOADFEETRACK_RIPPLEHEADER
|
||||
#define RIPPLE_ILOADFEETRACK_RIPPLEHEADER
|
||||
#ifndef RIPPLE_ILOADFEETRACK_H_INCLUDED
|
||||
#define RIPPLE_ILOADFEETRACK_H_INCLUDED
|
||||
|
||||
/** Manages the current fee schedule.
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_LOADFEETRACK_RIPPLEHEADER
|
||||
#define RIPPLE_LOADFEETRACK_RIPPLEHEADER
|
||||
#ifndef RIPPLE_LOADFEETRACK_H_INCLUDED
|
||||
#define RIPPLE_LOADFEETRACK_H_INCLUDED
|
||||
|
||||
// PRIVATE HEADER
|
||||
class LoadManager;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_LOADMONITOR_RIPPLEHEADER
|
||||
#define RIPPLE_LOADMONITOR_RIPPLEHEADER
|
||||
#ifndef RIPPLE_LOADMONITOR_H_INCLUDED
|
||||
#define RIPPLE_LOADMONITOR_H_INCLUDED
|
||||
|
||||
// Monitors load levels and response times
|
||||
|
||||
|
||||
@@ -8,19 +8,16 @@
|
||||
|
||||
#include "ripple_core.h"
|
||||
|
||||
// Needed for InputParser
|
||||
#include "beast/modules/beast_asio/beast_asio.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
|
||||
|
||||
#include "nodestore/NodeStore.cpp"
|
||||
|
||||
namespace ripple
|
||||
|
||||
@@ -210,4 +210,3 @@ public:
|
||||
};
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
//#include <cmath>
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
@@ -28,9 +28,10 @@
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/hmac.h>
|
||||
//#include <openssl/rand.h> // includes <windows.h> and causes errors due to #define GetMessage
|
||||
#include <openssl/err.h>
|
||||
|
||||
#include "../ripple/sslutil/ripple_sslutil.h"
|
||||
|
||||
// VFALCO TODO fix these warnings!
|
||||
#if BEAST_MSVC
|
||||
#pragma warning (push)
|
||||
@@ -44,22 +45,18 @@
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
#include "crypto/Base58.h" // for RippleAddress
|
||||
#include "crypto/CKey.h" // needs RippleAddress VFALCO TODO remove this dependency cycle
|
||||
#include "crypto/RFC1751.h"
|
||||
|
||||
#include "crypto/CBigNum.cpp"
|
||||
#include "crypto/CKey.cpp"
|
||||
#include "crypto/CKeyDeterministic.cpp"
|
||||
#include "crypto/CKeyECIES.cpp"
|
||||
#include "crypto/Base58.cpp"
|
||||
#include "crypto/Base58Data.cpp"
|
||||
#include "crypto/RFC1751.cpp"
|
||||
|
||||
#include "protocol/BuildInfo.cpp"
|
||||
#include "protocol/FieldNames.cpp"
|
||||
#include "protocol/LedgerFormats.cpp"
|
||||
#include "protocol/PackedMessage.cpp"
|
||||
#include "protocol/RippleAddress.cpp"
|
||||
#include "protocol/SerializedTypes.cpp"
|
||||
#include "protocol/Serializer.cpp"
|
||||
|
||||
@@ -4,43 +4,23 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
/** Include this to get the @ref ripple_data module.
|
||||
#ifndef RIPPLE_DATA_H_INCLUDED
|
||||
#define RIPPLE_DATA_H_INCLUDED
|
||||
|
||||
@file ripple_data.h
|
||||
@ingroup ripple_data
|
||||
*/
|
||||
|
||||
/** Ripple specific data representation and manipulation.
|
||||
|
||||
These form the building blocks of Ripple data.
|
||||
|
||||
@defgroup ripple_data
|
||||
*/
|
||||
|
||||
#ifndef RIPPLE_DATA_RIPPLEHEADER
|
||||
#define RIPPLE_DATA_RIPPLEHEADER
|
||||
|
||||
// VFALCO TODO try to reduce these dependencies
|
||||
#include "../ripple_basics/ripple_basics.h"
|
||||
|
||||
// VFALCO TODO figure out a good place for this file, perhaps give it some
|
||||
// additional hierarchy via directories.
|
||||
#include "ripple.pb.h"
|
||||
|
||||
#include "../ripple/json/ripple_json.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
struct bignum_st;
|
||||
typedef struct bignum_st BIGNUM;
|
||||
|
||||
namespace ripple {
|
||||
|
||||
#include "crypto/CBigNum.h"
|
||||
#include "crypto/Base58.h" // VFALCO TODO Can be moved to .cpp if we clean up setAlphabet stuff
|
||||
#include "crypto/Base58Data.h"
|
||||
#include "crypto/RFC1751.h"
|
||||
|
||||
#include "protocol/BuildInfo.h"
|
||||
#include "protocol/FieldNames.h"
|
||||
#include "protocol/HashPrefix.h"
|
||||
#include "protocol/PackedMessage.h"
|
||||
#include "protocol/Protocol.h"
|
||||
#include "protocol/RippleAddress.h"
|
||||
#include "protocol/RippleSystem.h"
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_HYPERLEVELDB_RIPPLEHEADER
|
||||
#define RIPPLE_HYPERLEVELDB_RIPPLEHEADER
|
||||
#ifndef RIPPLE_HYPERLEVELDB_H_INCLUDED
|
||||
#define RIPPLE_HYPERLEVELDB_H_INCLUDED
|
||||
|
||||
#include "beast/beast/Config.h"
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_LEVELDB_RIPPLEHEADER
|
||||
#define RIPPLE_LEVELDB_RIPPLEHEADER
|
||||
#ifndef RIPPLE_LEVELDB_H_INCLUDED
|
||||
#define RIPPLE_LEVELDB_H_INCLUDED
|
||||
|
||||
#include "leveldb/cache.h"
|
||||
#include "leveldb/filter_policy.h"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef RIPPLE_NET_H_INCLUDED
|
||||
#define RIPPLE_NET_H_INCLUDED
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/unordered_set.hpp> // For InfoSub
|
||||
|
||||
#include "beast/modules/beast_asio/beast_asio.h"
|
||||
|
||||
@@ -4,43 +4,23 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_WEBSOCKET_RIPPLEHEADER
|
||||
#define RIPPLE_WEBSOCKET_RIPPLEHEADER
|
||||
|
||||
/** Include this to get the @ref ripple_websocket module.
|
||||
|
||||
This module provides support for websockets. It requires both
|
||||
boost::asio and OpenSSL. It is a fork of the original websocketpp project
|
||||
written in C++.
|
||||
|
||||
@note This code contains bugs including one known deadlock. It's a terrible
|
||||
mess and it needs to be replaced.
|
||||
|
||||
@file ripple_websocket.h
|
||||
@ingroup ripple_websocket
|
||||
@deprecated
|
||||
*/
|
||||
#ifndef RIPPLE_WEBSOCKET_H_INCLUDED
|
||||
#define RIPPLE_WEBSOCKET_H_INCLUDED
|
||||
|
||||
// needed before inclusion of stdint.h for INT32_MIN/INT32_MAX macros
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
|
||||
// VFALCO NOTE Log dependencies have wormed their way into websocketpp,
|
||||
// which needs the ripple_basic module to compile.
|
||||
//
|
||||
// TODO Remove the dependency on ripple_basics and Log.
|
||||
// Perhaps by using an adapter.
|
||||
//
|
||||
#include "../ripple_basics/ripple_basics.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h"
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
|
||||
#include "websocket/src/common.hpp"
|
||||
#include "websocket/src/sockets/socket_base.hpp"
|
||||
|
||||
#include "autosocket/AutoSocket.h" // must come before autotls.hp
|
||||
|
||||
#include "autosocket/AutoSocket.h" // must come before autotls.hpp
|
||||
#include "websocket/src/sockets/autotls.hpp"
|
||||
#include "websocket/src/websocketpp.hpp"
|
||||
#include "websocket/src/logger/logger.hpp"
|
||||
|
||||
Reference in New Issue
Block a user