diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 76df0dc906..5a8bd79802 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -2108,10 +2108,16 @@
+
+
+
+
+
+
@@ -2180,6 +2186,8 @@
+
+
@@ -2238,7 +2246,7 @@
-
+
@@ -2258,6 +2266,9 @@
+
+ True
+
True
@@ -2609,19 +2620,32 @@
+
+
+
+
True
+
+ True
+
+
+ True
+
True
True
+
+ True
+
True
@@ -2643,9 +2667,6 @@
True
-
- True
-
True
@@ -2670,6 +2691,9 @@
True
+
+ True
+
True
@@ -2690,6 +2714,8 @@
+
+
@@ -2702,6 +2728,10 @@
+
+
+
+
@@ -2736,12 +2766,19 @@
+
+
+
+ True
+
+
+
@@ -2804,8 +2841,6 @@
-
-
True
@@ -2859,6 +2894,8 @@
True
+
+
True
@@ -2999,9 +3036,6 @@
-
- True
-
True
@@ -3075,6 +3109,9 @@
True
+
+ True
+
@@ -3158,38 +3195,6 @@
-
-
-
-
-
-
-
-
-
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
-
-
-
-
-
-
-
-
-
@@ -3230,8 +3235,6 @@
-
-
..\..\src\leveldb;..\..\src\leveldb\include;..\..\src\snappy\config;..\..\src\snappy\snappy;%(AdditionalIncludeDirectories)
..\..\src\leveldb;..\..\src\leveldb\include;..\..\src\snappy\config;..\..\src\snappy\snappy;%(AdditionalIncludeDirectories)
@@ -3264,8 +3267,6 @@
-
-
@@ -3274,8 +3275,6 @@
..\..\src\snappy\config;..\..\src\snappy\snappy;%(AdditionalIncludeDirectories)
..\..\src\snappy\config;..\..\src\snappy\snappy;%(AdditionalIncludeDirectories)
-
-
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index c4a983b540..9a9a59cb1a 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -403,6 +403,9 @@
{0AFA29AA-2CF8-9A4D-112E-AA1044C005EC}
+
+ {7BA15EDF-461E-A27A-09D1-3309F558AAD0}
+
{7F5082C0-3323-CAC3-1868-CA49C7F63A34}
@@ -433,12 +436,6 @@
{1D95DF26-0788-BD2C-2864-8B038A51FD58}
-
- {29DBD04F-9324-A965-5C79-AA06EC10BA58}
-
-
- {2E700221-055D-6F53-BBDE-3949795A358A}
-
{5DB3CD0B-B361-B301-9562-697CA8A52B68}
@@ -3036,12 +3033,21 @@
ripple\app\websocket
+
+ ripple\basics
+
ripple\basics
ripple\basics
+
+ ripple\basics
+
+
+ ripple\basics
+
ripple\basics
@@ -3123,6 +3129,9 @@
ripple\basics
+
+ ripple\basics
+
ripple\basics
@@ -3201,8 +3210,8 @@
ripple\core
-
- ripple\core
+
+ ripple\crypto
ripple\crypto
@@ -3231,6 +3240,9 @@
ripple\crypto
+
+ ripple\crypto\impl
+
ripple\crypto\impl
@@ -3666,21 +3678,36 @@
ripple\peerfinder
+
+ ripple\protocol
+
ripple\protocol
+
+ ripple\protocol
+
ripple\protocol
ripple\protocol\impl
+
+ ripple\protocol\impl
+
+
+ ripple\protocol\impl
+
ripple\protocol\impl
ripple\protocol\impl
+
+ ripple\protocol\impl
+
ripple\protocol\impl
@@ -3702,9 +3729,6 @@
ripple\protocol\impl
-
- ripple\protocol\impl
-
ripple\protocol\impl
@@ -3729,6 +3753,9 @@
ripple\protocol\impl
+
+ ripple\protocol\impl
+
ripple\protocol\impl
@@ -3750,6 +3777,9 @@
ripple\protocol
+
+ ripple\protocol
+
ripple\protocol
@@ -3768,6 +3798,12 @@
ripple\protocol
+
+ ripple\protocol
+
+
+ ripple\protocol
+
ripple\protocol
@@ -3819,15 +3855,24 @@
ripple\protocol
+
+ ripple\protocol
+
ripple\protocol
+
+ ripple\protocol\tests
+
ripple\protocol
ripple\protocol
+
+ ripple\protocol
+
ripple\protocol
@@ -3897,9 +3942,6 @@
ripple\rpc
-
- ripple\rpc
-
ripple\rpc\handlers
@@ -3954,6 +3996,9 @@
ripple\rpc\handlers
+
+ ripple\rpc\handlers
+
ripple\rpc\handlers
@@ -4098,9 +4143,6 @@
ripple\rpc\impl
-
- ripple\rpc\impl
-
ripple\rpc\impl
@@ -4185,6 +4227,9 @@
ripple\rpc\impl
+
+ ripple\rpc\impl
+
ripple\rpc
@@ -4296,48 +4341,6 @@
ripple\sitefiles
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types\impl
-
-
- ripple\types\impl
-
-
- ripple\types\impl
-
-
- ripple\types\impl
-
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types
-
-
- ripple\types
-
ripple\unity
@@ -4395,9 +4398,6 @@
ripple\unity
-
- ripple\unity
-
ripple\unity
@@ -4437,9 +4437,6 @@
ripple\unity
-
- ripple\unity
-
ripple\unity
@@ -4449,9 +4446,6 @@
ripple\unity
-
- ripple\unity
-
ripple\unity
diff --git a/SConstruct b/SConstruct
index 1f32cb96f9..b1309b67d9 100644
--- a/SConstruct
+++ b/SConstruct
@@ -582,7 +582,6 @@ for toolchain in all_toolchains:
'rpcx.cpp',
'server.cpp',
'sitefiles.cpp',
- 'types.cpp',
'validators.cpp',
'websocket.cpp',
)
diff --git a/src/ripple/app/book/Types.h b/src/ripple/app/book/Types.h
index 6e3b99c167..79a035dd1d 100644
--- a/src/ripple/app/book/Types.h
+++ b/src/ripple/app/book/Types.h
@@ -21,7 +21,7 @@
#define RIPPLE_CORE_TYPES_H_INCLUDED
#include
-#include
+#include
#include
#include
diff --git a/src/ripple/app/consensus/DisputedTx.h b/src/ripple/app/consensus/DisputedTx.h
index 8b187233b0..c517e14445 100644
--- a/src/ripple/app/consensus/DisputedTx.h
+++ b/src/ripple/app/consensus/DisputedTx.h
@@ -22,7 +22,7 @@
#include
#include
-#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/consensus/LedgerConsensus.cpp b/src/ripple/app/consensus/LedgerConsensus.cpp
index 7eefccc157..46e35c7563 100644
--- a/src/ripple/app/consensus/LedgerConsensus.cpp
+++ b/src/ripple/app/consensus/LedgerConsensus.cpp
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/consensus/LedgerConsensus.h b/src/ripple/app/consensus/LedgerConsensus.h
index 682707e322..100e72e3ea 100644
--- a/src/ripple/app/consensus/LedgerConsensus.h
+++ b/src/ripple/app/consensus/LedgerConsensus.h
@@ -26,7 +26,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/src/ripple/app/data/Database.h b/src/ripple/app/data/Database.h
index 4d98a9768d..78071626d7 100644
--- a/src/ripple/app/data/Database.h
+++ b/src/ripple/app/data/Database.h
@@ -20,7 +20,7 @@
#ifndef RIPPLE_DATABASE_H_INCLUDED
#define RIPPLE_DATABASE_H_INCLUDED
-#include
+#include
namespace ripple {
diff --git a/src/ripple/app/ledger/BookListeners.cpp b/src/ripple/app/ledger/BookListeners.cpp
index da9c3761a5..9784c36ccf 100644
--- a/src/ripple/app/ledger/BookListeners.cpp
+++ b/src/ripple/app/ledger/BookListeners.cpp
@@ -17,6 +17,8 @@
*/
//==============================================================================
+#include
+
namespace ripple {
void BookListeners::addSubscriber (InfoSub::ref sub)
diff --git a/src/ripple/app/ledger/InboundLedgers.h b/src/ripple/app/ledger/InboundLedgers.h
index d8a1f41afe..f5a0339193 100644
--- a/src/ripple/app/ledger/InboundLedgers.h
+++ b/src/ripple/app/ledger/InboundLedgers.h
@@ -21,7 +21,7 @@
#define RIPPLE_INBOUNDLEDGERS_H
#include
-#include
+#include
#include
#include //
diff --git a/src/ripple/app/ledger/Ledger.cpp b/src/ripple/app/ledger/Ledger.cpp
index 9e4deee002..13bb0d3256 100644
--- a/src/ripple/app/ledger/Ledger.cpp
+++ b/src/ripple/app/ledger/Ledger.cpp
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/ledger/Ledger.h b/src/ripple/app/ledger/Ledger.h
index dc9d6ac733..6333144bc4 100644
--- a/src/ripple/app/ledger/Ledger.h
+++ b/src/ripple/app/ledger/Ledger.h
@@ -27,7 +27,7 @@
#include
#include
#include
-#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/ledger/LedgerCleaner.h b/src/ripple/app/ledger/LedgerCleaner.h
index 7801d94c47..794f5d188c 100644
--- a/src/ripple/app/ledger/LedgerCleaner.h
+++ b/src/ripple/app/ledger/LedgerCleaner.h
@@ -22,6 +22,7 @@
#include //
#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/ledger/LedgerHistory.h b/src/ripple/app/ledger/LedgerHistory.h
index f8944e5268..061b7aea99 100644
--- a/src/ripple/app/ledger/LedgerHistory.h
+++ b/src/ripple/app/ledger/LedgerHistory.h
@@ -20,7 +20,7 @@
#ifndef RIPPLE_LEDGERHISTORY_H
#define RIPPLE_LEDGERHISTORY_H
-#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/ledger/LedgerMaster.h b/src/ripple/app/ledger/LedgerMaster.h
index 1400a873ab..850d220c7f 100644
--- a/src/ripple/app/ledger/LedgerMaster.h
+++ b/src/ripple/app/ledger/LedgerMaster.h
@@ -21,10 +21,11 @@
#define RIPPLE_LEDGERMASTER_H_INCLUDED
#include
-#include
+#include
#include
#include
#include
+#include
namespace ripple {
diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp
index 38a5316384..49c53ee614 100644
--- a/src/ripple/app/main/Application.cpp
+++ b/src/ripple/app/main/Application.cpp
@@ -19,13 +19,14 @@
#include
#include
+#include
#include
#include
#include
#include
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/main/FullBelowCache.h b/src/ripple/app/main/FullBelowCache.h
index 90840ce361..4c49616f10 100644
--- a/src/ripple/app/main/FullBelowCache.h
+++ b/src/ripple/app/main/FullBelowCache.h
@@ -20,7 +20,7 @@
#ifndef RIPPLE_FULLBELOWCACHE_H_INCLUDED
#define RIPPLE_FULLBELOWCACHE_H_INCLUDED
-#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp
index 2fc6ccddea..44501d095d 100644
--- a/src/ripple/app/main/Main.cpp
+++ b/src/ripple/app/main/Main.cpp
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/misc/CanonicalTXSet.h b/src/ripple/app/misc/CanonicalTXSet.h
index 69edb74684..ec3468dbd6 100644
--- a/src/ripple/app/misc/CanonicalTXSet.h
+++ b/src/ripple/app/misc/CanonicalTXSet.h
@@ -20,7 +20,7 @@
#ifndef RIPPLE_CANONICALTXSET_H
#define RIPPLE_CANONICALTXSET_H
-#include
+#include
namespace ripple {
diff --git a/src/ripple/app/misc/FeeVote.h b/src/ripple/app/misc/FeeVote.h
index 675d8a74f6..d4694ff2b0 100644
--- a/src/ripple/app/misc/FeeVote.h
+++ b/src/ripple/app/misc/FeeVote.h
@@ -21,7 +21,7 @@
#define RIPPLE_APP_FEEVOTE_H_INCLUDED
#include
-#include
+#include
namespace ripple {
diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp
index 486c18b56e..3a3ee9dda2 100644
--- a/src/ripple/app/misc/NetworkOPs.cpp
+++ b/src/ripple/app/misc/NetworkOPs.cpp
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/misc/SHAMapStore.h b/src/ripple/app/misc/SHAMapStore.h
index 9786bc544a..03a2b6478c 100644
--- a/src/ripple/app/misc/SHAMapStore.h
+++ b/src/ripple/app/misc/SHAMapStore.h
@@ -23,7 +23,7 @@
#include
#include
#include
-#include
+#include
namespace ripple {
diff --git a/src/ripple/app/paths/PathRequest.cpp b/src/ripple/app/paths/PathRequest.cpp
index 8227550b67..b1f5f99bf8 100644
--- a/src/ripple/app/paths/PathRequest.cpp
+++ b/src/ripple/app/paths/PathRequest.cpp
@@ -23,7 +23,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/paths/PathState.cpp b/src/ripple/app/paths/PathState.cpp
index 78b7c52767..74c630c505 100644
--- a/src/ripple/app/paths/PathState.cpp
+++ b/src/ripple/app/paths/PathState.cpp
@@ -18,6 +18,7 @@
//==============================================================================
#include
+#include
namespace ripple {
diff --git a/src/ripple/app/paths/Pathfinder.cpp b/src/ripple/app/paths/Pathfinder.cpp
index e541def8b8..66451b496f 100644
--- a/src/ripple/app/paths/Pathfinder.cpp
+++ b/src/ripple/app/paths/Pathfinder.cpp
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
diff --git a/src/ripple/app/paths/Types.h b/src/ripple/app/paths/Types.h
index 72daf6afc1..d0b6605623 100644
--- a/src/ripple/app/paths/Types.h
+++ b/src/ripple/app/paths/Types.h
@@ -17,8 +17,8 @@
*/
//==============================================================================
-#ifndef RIPPLE_TYPES_H
-#define RIPPLE_TYPES_H
+#ifndef RIPPLE_TYPES_H_INCLUDED
+#define RIPPLE_TYPES_H_INCLUDED
namespace ripple {
diff --git a/src/ripple/app/shamap/SHAMapItem.h b/src/ripple/app/shamap/SHAMapItem.h
index 8bb8752b02..3caee35729 100644
--- a/src/ripple/app/shamap/SHAMapItem.h
+++ b/src/ripple/app/shamap/SHAMapItem.h
@@ -22,7 +22,7 @@
#include
#include
-#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/shamap/SHAMapNodeID.h b/src/ripple/app/shamap/SHAMapNodeID.h
index 983234cd97..608bfef39a 100644
--- a/src/ripple/app/shamap/SHAMapNodeID.h
+++ b/src/ripple/app/shamap/SHAMapNodeID.h
@@ -21,7 +21,7 @@
#define RIPPLE_SHAMAPNODEID_H
#include
-#include
+#include
#include
#include
#include
diff --git a/src/ripple/app/transactors/CreateOffer.cpp b/src/ripple/app/transactors/CreateOffer.cpp
index 5c15e55499..444d802ece 100644
--- a/src/ripple/app/transactors/CreateOffer.cpp
+++ b/src/ripple/app/transactors/CreateOffer.cpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
diff --git a/src/ripple/app/tx/TransactionMeta.cpp b/src/ripple/app/tx/TransactionMeta.cpp
index cb3b7b367a..91b111de46 100644
--- a/src/ripple/app/tx/TransactionMeta.cpp
+++ b/src/ripple/app/tx/TransactionMeta.cpp
@@ -17,6 +17,7 @@
*/
//==============================================================================
+#include
#include
namespace ripple {
diff --git a/src/ripple/app/websocket/WSConnection.h b/src/ripple/app/websocket/WSConnection.h
index 696649afed..2ba9ac3145 100644
--- a/src/ripple/app/websocket/WSConnection.h
+++ b/src/ripple/app/websocket/WSConnection.h
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include
#include
diff --git a/src/ripple/app/websocket/WSServerHandler.h b/src/ripple/app/websocket/WSServerHandler.h
index 43591fde38..3224077ec9 100644
--- a/src/ripple/app/websocket/WSServerHandler.h
+++ b/src/ripple/app/websocket/WSServerHandler.h
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include
namespace ripple {
diff --git a/src/ripple/unity/rpcx.h b/src/ripple/basics/Blob.h
similarity index 79%
rename from src/ripple/unity/rpcx.h
rename to src/ripple/basics/Blob.h
index ddf8eb25fd..51e061b96e 100644
--- a/src/ripple/unity/rpcx.h
+++ b/src/ripple/basics/Blob.h
@@ -17,11 +17,18 @@
*/
//==============================================================================
-#ifndef RIPPLE_RPC_H_INCLUDED
-#define RIPPLE_RPC_H_INCLUDED
+#ifndef RIPPLE_BASICS_BLOB_H_INCLUDED
+#define RIPPLE_BASICS_BLOB_H_INCLUDED
-#include
-#include
-#include
+#include
+
+namespace ripple {
+
+/** Storage for linear binary data.
+ Blocks of binary data appear often in various idioms and structures.
+*/
+typedef std::vector Blob;
+
+}
#endif
diff --git a/src/ripple/types/ByteOrder.h b/src/ripple/basics/ByteOrder.h
similarity index 94%
rename from src/ripple/types/ByteOrder.h
rename to src/ripple/basics/ByteOrder.h
index 6a097ac9fe..02a098dabd 100644
--- a/src/ripple/types/ByteOrder.h
+++ b/src/ripple/basics/ByteOrder.h
@@ -17,8 +17,8 @@
*/
//==============================================================================
-#ifndef RIPPLE_TYPES_BYTEORDER_H
-#define RIPPLE_TYPES_BYTEORDER_H
+#ifndef RIPPLE_BASICS_BYTEORDER_H
+#define RIPPLE_BASICS_BYTEORDER_H
#include
@@ -36,6 +36,7 @@
namespace ripple {
+// VFALCO These are all deprecated please use the ones in
// Routines for converting endianness
// Reference: http://www.mail-archive.com/licq-commits@googlegroups.com/msg02334.html
diff --git a/src/ripple/basics/StringUtilities.h b/src/ripple/basics/StringUtilities.h
index 63ed2b6f53..7abdc6be86 100644
--- a/src/ripple/basics/StringUtilities.h
+++ b/src/ripple/basics/StringUtilities.h
@@ -20,9 +20,9 @@
#ifndef RIPPLE_BASICS_STRINGUTILITIES_H_INCLUDED
#define RIPPLE_BASICS_STRINGUTILITIES_H_INCLUDED
-#include
-#include
-#include
+#include
+#include
+#include
#include
#include
#include
diff --git a/src/ripple/basics/base_uint.h b/src/ripple/basics/base_uint.h
new file mode 100644
index 0000000000..11340aace6
--- /dev/null
+++ b/src/ripple/basics/base_uint.h
@@ -0,0 +1,541 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of rippled: https://github.com/ripple/rippled
+ Copyright (c) 2012, 2013 Ripple Labs Inc.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+// 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_PROTOCOL_BASE_UINT_H_INCLUDED
+#define RIPPLE_PROTOCOL_BASE_UINT_H_INCLUDED
+
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+#include
+
+using beast::zero;
+using beast::Zero;
+
+namespace ripple {
+
+// This class stores its values internally in big-endian form
+
+template
+class base_uint
+{
+ static_assert ((Bits % 32) == 0,
+ "The length of a base_uint in bits must be a multiple of 32.");
+
+ static_assert (Bits >= 64,
+ "The length of a base_uint in bits must be at least 64.");
+
+protected:
+ enum { WIDTH = Bits / 32 };
+
+ // This is really big-endian in byte order.
+ // We sometimes use unsigned int for speed.
+
+ // NIKB TODO: migrate to std::array
+ unsigned int pn[WIDTH];
+
+public:
+ //--------------------------------------------------------------------------
+ //
+ // STL Container Interface
+ //
+
+ static std::size_t const bytes = Bits / 8;
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef unsigned char value_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+ typedef value_type const* const_pointer;
+ typedef value_type const& const_reference;
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef std::reverse_iterator
+ reverse_iterator;
+ typedef std::reverse_iterator
+ const_reverse_iterator;
+
+ typedef Tag tag_type;
+
+ pointer data() { return reinterpret_cast(pn); }
+ const_pointer data() const { return reinterpret_cast(pn); }
+
+ iterator begin() { return data(); }
+ iterator end() { return data()+bytes; }
+ const_iterator begin() const { return data(); }
+ const_iterator end() const { return data()+bytes; }
+ const_iterator cbegin() const { return data(); }
+ const_iterator cend() const { return data()+bytes; }
+
+ /** Value hashing function.
+ The seed prevents crafted inputs from causing degenarate parent containers.
+ */
+ typedef beast::hardened_hash <> hasher;
+
+ /** Container equality testing function. */
+ class key_equal
+ {
+ public:
+ bool operator() (base_uint const& lhs, base_uint const& rhs) const
+ {
+ return lhs == rhs;
+ }
+ };
+
+ //--------------------------------------------------------------------------
+
+private:
+ /** Construct from a raw pointer.
+ The buffer pointed to by `data` must be at least Bits/8 bytes.
+
+ @note the structure is used to disambiguate this from the std::uint64_t
+ constructor: something like base_uint(0) is ambiguous.
+ */
+ // NIKB TODO Remove the need for this constructor.
+ struct VoidHelper {};
+
+ explicit base_uint (void const* data, VoidHelper)
+ {
+ memcpy (&pn [0], data, bytes);
+ }
+
+public:
+ base_uint () { *this = beast::zero; }
+
+ explicit base_uint (Blob const& vch)
+ {
+ assert (vch.size () == size ());
+
+ if (vch.size () == size ())
+ memcpy (pn, &vch[0], size ());
+ else
+ *this = beast::zero;
+ }
+
+ explicit base_uint (std::uint64_t b)
+ {
+ *this = b;
+ }
+
+ // NIKB TODO remove the need for this constructor - have a free function
+ // to handle the hex string parsing.
+ explicit base_uint (std::string const& str)
+ {
+ SetHex (str);
+ }
+
+ base_uint (base_uint const& other) = default;
+
+ template
+ void copyFrom (base_uint const& other)
+ {
+ memcpy (&pn [0], other.data(), bytes);
+ }
+
+ /* Construct from a raw pointer.
+ The buffer pointed to by `data` must be at least Bits/8 bytes.
+ */
+ static base_uint
+ fromVoid (void const* data)
+ {
+ return base_uint (data, VoidHelper ());
+ }
+
+ int signum() const
+ {
+ for (int i = 0; i < WIDTH; i++)
+ if (pn[i] != 0)
+ return 1;
+
+ return 0;
+ }
+
+ bool operator! () const
+ {
+ return *this == beast::zero;
+ }
+
+ 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= (const base_uint& b)
+ {
+ for (int i = 0; i < WIDTH; i++)
+ pn[i] = b.pn[i];
+
+ return *this;
+ }
+
+ base_uint& operator= (std::uint64_t uHost)
+ {
+ *this = beast::zero;
+
+ // Put in least significant bits.
+ ((std::uint64_t*) 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)
+ {
+ std::uint32_t 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)
+ {
+ std::uint64_t carry = 0;
+
+ for (int i = WIDTH; i--;)
+ {
+ std::uint64_t n = carry + be32toh (pn[i]) + be32toh (b.pn[i]);
+
+ pn[i] = htobe32 (n & 0xffffffff);
+ carry = n >> 32;
+ }
+
+ return *this;
+ }
+
+ template
+ friend void hash_append(Hasher& h, base_uint const& a) noexcept
+ {
+ using beast::hash_append;
+ hash_append (h, a.pn);
+ }
+
+ bool SetHexExact (const char* psz)
+ {
+ // must be precisely the correct number of hex digits
+ unsigned char* pOut = begin ();
+
+ for (int i = 0; i < sizeof (pn); ++i)
+ {
+ auto cHigh = charUnHex(*psz++);
+ auto cLow = charUnHex(*psz++);
+
+ if (cHigh == -1 || cLow == -1)
+ return false;
+
+ *pOut++ = (cHigh << 4) | cLow;
+ }
+
+ assert (*psz == 0);
+ assert (pOut == end ());
+
+ return true;
+ }
+
+ // 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;
+
+ const unsigned char* pEnd = reinterpret_cast (psz);
+ const unsigned char* pBegin = pEnd;
+
+ // Find end.
+ while (charUnHex(*pEnd) != -1)
+ 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);
+
+ *this = beast::zero;
+
+ if ((pEnd - pBegin) & 1)
+ *pOut++ = charUnHex(*pBegin++);
+
+ while (pBegin != pEnd)
+ {
+ auto cHigh = charUnHex(*pBegin++);
+ auto cLow = pBegin == pEnd
+ ? 0
+ : charUnHex(*pBegin++);
+
+ if (cHigh == -1 || cLow == -1)
+ return false;
+
+ *pOut++ = (cHigh << 4) | cLow;
+ }
+
+ return !*pEnd;
+ }
+
+ bool SetHex (std::string const& str, bool bStrict = false)
+ {
+ return SetHex (str.c_str (), bStrict);
+ }
+
+ void SetHexExact (std::string const& str)
+ {
+ SetHexExact (str.c_str ());
+ }
+
+ unsigned int size () const
+ {
+ return sizeof (pn);
+ }
+
+ base_uint& operator=(Zero)
+ {
+ memset (&pn[0], 0, sizeof (pn));
+ return *this;
+ }
+
+ // Deprecated.
+ bool isZero () const { return *this == beast::zero; }
+ bool isNonZero () const { return *this != beast::zero; }
+ void zero () { *this = beast::zero; }
+};
+
+typedef base_uint<128> uint128;
+typedef base_uint<160> uint160;
+typedef base_uint<256> uint256;
+
+template
+inline int compare (
+ base_uint const& a, base_uint const& b)
+{
+ auto ret = std::mismatch (a.cbegin (), a.cend (), b.cbegin ());
+
+ if (ret.first == a.cend ())
+ return 0;
+
+ // a > b
+ if (*ret.first > *ret.second)
+ return 1;
+
+ // a < b
+ return -1;
+}
+
+template
+inline bool operator< (
+ base_uint const& a, base_uint const& b)
+{
+ return compare (a, b) < 0;
+}
+
+template
+inline bool operator<= (
+ base_uint const& a, base_uint const& b)
+{
+ return compare (a, b) <= 0;
+}
+
+template
+inline bool operator> (
+ base_uint const& a, base_uint const& b)
+{
+ return compare (a, b) > 0;
+}
+
+template
+inline bool operator>= (
+ base_uint const& a, base_uint const& b)
+{
+ return compare (a, b) >= 0;
+}
+
+template
+inline bool operator== (
+ base_uint const& a, base_uint const& b)
+{
+ return compare (a, b) == 0;
+}
+
+template
+inline bool operator!= (
+ base_uint const& a, base_uint const& b)
+{
+ return compare (a, b) != 0;
+}
+
+//------------------------------------------------------------------------------
+template
+inline bool operator== (base_uint const& a, std::uint64_t b)
+{
+ return a == base_uint(b);
+}
+
+template
+inline bool operator!= (base_uint const& a, std::uint64_t b)
+{
+ return !(a == b);
+}
+
+//------------------------------------------------------------------------------
+template
+inline const base_uint operator^ (
+ base_uint const& a, base_uint const& b)
+{
+ return base_uint (a) ^= b;
+}
+
+template
+inline const base_uint operator& (
+ base_uint const& a, base_uint const& b)
+{
+ return base_uint (a) &= b;
+}
+
+template
+inline const base_uint operator| (
+ base_uint const& a, base_uint const& b)
+{
+ return base_uint (a) |= b;
+}
+
+template
+inline const base_uint operator+ (
+ base_uint const& a, base_uint const& b)
+{
+ return base_uint (a) += b;
+}
+
+//------------------------------------------------------------------------------
+template
+inline std::string to_string (base_uint const& a)
+{
+ return strHex (a.begin (), a.size ());
+}
+
+template
+inline std::ostream& operator<< (
+ std::ostream& out, base_uint const& u)
+{
+ return out << to_string (u);
+}
+
+} // rippled
+
+namespace boost
+{
+
+template
+struct hash>
+{
+ using argument_type = ripple::base_uint;
+
+ std::size_t
+ operator()(argument_type const& u) const
+ {
+ return beast::hardened_hash<>{}(u);
+ }
+};
+
+} // boost
+
+#endif
diff --git a/src/ripple/types/strHex.h b/src/ripple/basics/strHex.h
similarity index 96%
rename from src/ripple/types/strHex.h
rename to src/ripple/basics/strHex.h
index 52c92237f8..a8d4776822 100644
--- a/src/ripple/types/strHex.h
+++ b/src/ripple/basics/strHex.h
@@ -22,8 +22,8 @@
// 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
+#ifndef RIPPLE_BASICS_STRHEX_H_INCLUDED
+#define RIPPLE_BASICS_STRHEX_H_INCLUDED
namespace ripple {
diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h
index cb31e89bfd..4d5686d0be 100644
--- a/src/ripple/core/Config.h
+++ b/src/ripple/core/Config.h
@@ -21,9 +21,9 @@
#define RIPPLE_CORE_CONFIG_H_INCLUDED
#include
-#include
+#include
#include
-#include
+#include
#include
#include
#include
diff --git a/src/ripple/core/Job.h b/src/ripple/core/Job.h
index 89b7163c10..fe2f2bf935 100644
--- a/src/ripple/core/Job.h
+++ b/src/ripple/core/Job.h
@@ -22,7 +22,6 @@
#include
#include
-#include
namespace ripple {
diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp
index 40f37532dd..c0afda65c0 100644
--- a/src/ripple/core/impl/Config.cpp
+++ b/src/ripple/core/impl/Config.cpp
@@ -20,7 +20,8 @@
#include
#include
#include
-#include
+#include
+#include