Compare commits

...

1429 Commits

Author SHA1 Message Date
Nik Bougalis
77999579b5 Set version to 0.50.0 2017-01-26 21:57:49 -08:00
Nik Bougalis
d24bb65639 Set version to 0.50.0-rc2 2017-01-26 12:12:21 -08:00
Nik Bougalis
d810f29e99 Merge release (0.40.1) into develop (0.50.0-rc1) 2017-01-26 12:11:24 -08:00
Nik Bougalis
6e3e717876 Set version to 0.50.0-rc1 2017-01-17 17:20:52 -08:00
Nik Bougalis
2c87739d6c Harden default TLS configuration (RIPD-1332, RIPD-1333, RIPD-1334):
The existing configuration includes 512 and 1024 bit DH
parameters and supports ciphers such as RC4 and 3DES and
hash algorithms like SHA-1 which are no longer considered
secure.

Going forward, use only 2048-bit DH parameters and define
a new default set of modern ciphers to use:

    HIGH:!aNULL:!MD5:!DSS:!SHA1:!3DES:!RC4:!EXPORT:!DSS

Additionally, allow administrators who wish to have different
settings to configure custom global and per-port ciphers suites
in the configuration file using the `ssl_ciphers` directive.
2017-01-17 17:19:58 -08:00
Nik Bougalis
b00b81a861 Require at least OpenSSL 1.0.1g or 1.0.2j and later (RIPD-1331) 2017-01-17 17:19:58 -08:00
Vinnie Falco
a0a4eedc27 Set version to 0.50.0-b6 2017-01-17 15:28:44 -05:00
Vinnie Falco
c0e9e3df49 Update Beast subtree to 1.0.0-b23:
Merge commit '7028579170d83cb81a97478b620f3cb15a2fd693' into develop
2017-01-17 15:27:51 -05:00
Vinnie Falco
7028579170 Squashed 'src/beast/' changes from 1ab7a2f..c00cd37
c00cd37 Set version to 1.0.0-b23
f662e36 Travis CI improvements:
b05fa33 Fix message constructor and special members
b4722cc Add copy special members
420d1c7 Better logging in async echo server
149e3a2 Add file and line number to thrown exceptions
3e88b83 Tune websocket echo server for performance

git-subtree-dir: src/beast
git-subtree-split: c00cd37b8a441a92755658014fdde97d515ec7ed
2017-01-17 14:50:38 -05:00
Nik Bougalis
84ada74d53 Set version to 0.50.0-b5 2017-01-13 15:01:35 -08:00
Mike Ellery
be0fb67d8d Add ledger save/load test (RIPD-1378)
Provide unit test to invoke ledger load at startup.
2017-01-13 15:01:20 -08:00
Brad Chase
fb60cc9b5b Cleanup unit test support code (RIPD-1380):
* Remove `src/test/support/mao`
* Flatten `src/test/support/jtx` to `src/test/jtx`
2017-01-13 15:01:20 -08:00
Brad Chase
3c4d3b10c1 Update RPC handler role/usage (RIPD-557):
* Properly use the RPC method to determine required role for HTTP/S RPC calls.
* Charge for malformed RPC calls over HTTP/S
2017-01-13 15:01:20 -08:00
Edward Hennis
d9ef5ef98f Fix broken Intellisense (MSVC):
* MSVC Intellisense will ignore all file-level static_asserts.
2017-01-13 15:01:20 -08:00
Scott Schurr
be9c955506 Convert Workers to std::thread (RIPD-1189) 2017-01-13 15:01:20 -08:00
Edward Hennis
1989b1028f Add ledger_current_index to fee RPC result (RIPD-1300) 2017-01-13 15:01:20 -08:00
Mike Ellery
0d577d9349 Remove unused websocket files (RIPD-1293) 2017-01-13 15:01:20 -08:00
Mike Ellery
7536c53a48 Eliminate ledger data setup in test (RIPD-1372):
Change ledger-data json test fixture to simple jtx/Env setup.
2017-01-13 15:01:20 -08:00
Mike Ellery
e3ff30657c Eliminate npm tests (RIPD-1369)
Remove mention of npm tests in developer docs. Eliminate `npm test` from
automation and ci scripts.
2017-01-13 15:01:20 -08:00
Mike Ellery
698ea58b39 Improve setup for account_tx paging test (RIPD-1371):
Remove dependency on external fixture data by creating a ledger state
using jtx Env.
2017-01-13 10:38:21 -08:00
MarkusTeufelberger
a5500721db Don't consider function for ASAN
ge25519_scalarmult_base_choose_niels leads to errors (#1668) when compiled with address sanitizer.
2017-01-13 10:38:21 -08:00
Vinnie Falco
fd4ad29418 Set version to 0.50.0-b4 2017-01-11 16:53:13 -05:00
Vinnie Falco
905c627043 Check error on HTTP request in server 2017-01-11 16:52:45 -05:00
Vinnie Falco
8d8907e340 Update for Beast changes 2017-01-11 16:52:39 -05:00
Vinnie Falco
6724a63230 Update .vcxproj 2017-01-11 16:52:31 -05:00
Vinnie Falco
af4fe24939 Squashed 'src/beast/' changes from 2f9a844..1ab7a2f
1ab7a2f Set version to 1.0.0-b22
2eb4b0c Fix code sample in websocket.qbk
58802f4 Fix typos in design.qbk
19dc4bb Update documentation examples
10dbc5b Disable Boost.Coroutine deprecation warning
01c76c7 Fix websocket stream read documentation
d152c96 Update README.md example programs
995d86f Avoid copies in handler_alloc
851cb62 Add handler helpers
114175c Implement asio dealloc-before-invoke guarantee:
681db2e Add missing include
7db3c6e Fix broken Intellisense (MSVC)
09c183d Set version to 1.0.0-b21
1cb01fe Remove extraneous includes
62e65ed Set version to 1.0.0-b20
45eaa8c Increase utf8 checker code coverage
9ff1a27 Add zlib module:
a0a3359 Refactor HTTP identifier names (API Change):
79be7f8 Set version to 1.0.0-b19
eda1120 Tidy up internal name
4130ad4 Better buffer_cat:
f94f21d Fix consuming_buffers value_type (API Change):
2c524b4 prepared_buffers is private (API Change)
df2a108 Fix prepare_buffers value_type:
a4af9d6 Use boost::lexical_cast instead of std::to_string
62d670b Fix with_body example:
a63bd84 Increase code coverage
84a6775 Boost library min/max guidance:
02feea5 Add read, async_read for message_headers:
f224585 Add write, async_write, operator<< for message_headers:
ea48bcf Make chunk_encode public:
f6dd744 Refactor message and message_headers declarations:
9fd8aed Move sync_ostream to core/detail
c98b2d3 Optimize mask operations
d4dfc1a Optimize utf8 validation
7b4de4b Set version to 1.0.0-b18
feb5204 Add websocket::stream pong and async_pong
d4ffde5 Close connection during async_read on close frame:
644d518 Move clamp to core
427ba38 Fix write_frame masking and auto-fragment handling
54a51b1 Write buffer option does not change capacity
591dbc0 Meet DynamicBuffer requirements for static_streambuf
46d5e72 Reorganize source files and definitions
efa4b8f Override incremental link flags:
eef6e86 Higher optimization settings for MSVC builds
b6f3a36 Check invariants in parse_op:
47b0fa6 Remove unused field in test
8b8e57e unit_test improvements:
e907252 Clean up message docs
1e3543f Set version to 1.0.0-b17
de97a69 Trim unused code
796b484 Doc fixes
95c37e2 Fix unused parameter warnings and missing includes:
8b0d285 Refactor read_size_helper
97a9dcb Improve websocket example in README.md
236caef Engaged invokable is destructible:
d107ba1 Add headers_parser:
2f90627 Fix handling of body_what::pause in basic_parser_v1
9353d04 Add basic_parser_v1::reset
658e03c Add on_body_what parser callback (API Change):
50bd446 Fix parser traits detection (API Change):
df8d306 Tidy up documentation:
47105f8 Tidy up basic_headers for documentation
ada1f60 Refine message class hierarchy:
cf43f51 Rework HTTP concepts (API Change):
8a261ca HTTP Reader (API Change):
183055a Parser callbacks may not throw (API Change)
ebebe52 Add basic_streambuf::alloc_size
c9cd171 Fix basic_streambuf::capacity
0eb0e48 Tidying:
c5c436d Change implicit_value to default_value
01f939d Set version to 1.0.0-b16
206d0a9 Fix websocket failure tests
6b4fb28 Fix Writer exemplar in docs
4224a3a Relax ForwardIterator requirements in FieldSequence
14d7f8d Refactor base_parser_v1 callback traits:
d812344 Add pause option to on_headers interface:
c59bd53 Improve first line serialization
78ff20b Constrain parser_v1 constructor
2765a67 Refine Parser concept:
c329d33 Fix on_headers called twice from basic_parser_v1
55c4c93 Put back missing Design section in docs
90cec54 Make auto_fragment a boolean option
03642fb Rename to write_buffer_size
0ca8964 Frame processing routines are member functions
d99dfb3 Make value optional in param-list
325f579 Set version to 1.0.0-b15
c54762a Fix handling empty HTTP headers in parser_v1.hpp
c39cc06 Regression test for empty headers
60e637b Tidy up error types:
d54d597 Tidy up DynamicBuffer requirements
707fb5e Fix doc reference section
38af0f7 Fix message_v1 constructor
027c4e8 Add Secure WebSocket example
5baaa49 Add HTTPS example
076456b rfc7230 section 3.3.2 compliance
a09a044 Use bin/sh
1ff192d Update README.md for CppCon 2016 presentation
70b8555 Set version to 1.0.0-b14
b4a8342 Update and tidy documentation
8607af5 Update README.md
4abb43e Use BOOST_ASSERT
b5bffee Don't rely on undefined behavior
8ee7a21 Better WebSocket decorator:
38f0d95 Update build scripts for MSVC, MinGW
2a5b116 Fix error handling in server examples
4c7065a Add missing rebind to handler_alloc

git-subtree-dir: src/beast
git-subtree-split: 1ab7a2f04ca9a0b35f2032877cab78d94e96ebad
2017-01-11 16:50:38 -05:00
Vinnie Falco
c1c80dfc52 Merge commit 'af4fe2493925bc57c5c3343c383719fa72dea262' into b4.2 2017-01-11 16:50:38 -05:00
Vinnie Falco
87273e21d8 Set version to 0.50.0-b3 2017-01-10 12:44:52 -05:00
Nik Bougalis
610e51a162 Increase sqlite database limits 2017-01-10 12:43:55 -05:00
Nik Bougalis
e91aacc9a3 Set version to 0.40.1 2017-01-05 09:38:28 -08:00
Nik Bougalis
6e54461f4b Increase sqlite database limits 2017-01-05 09:32:17 -08:00
Brad Chase
ef23d72562 Set version to 0.50.0-b2 2016-12-29 13:53:19 -05:00
Edward Hennis
a1c0d15a1f Provide BOOST_ROOT to CMake docs target (RIPD-1364):
* Should make building docs with CMake incrementally easier and more
reliable.
* Wrap makeqbk in explicit bash shell (if available).
2016-12-29 13:50:57 -05:00
Brad Chase
b6a01ea41c Move support test code to src/test/support (RIPD-1313) 2016-12-23 20:39:02 -05:00
Nik Bougalis
8425e4558a Set version to 0.50.0-b1 2016-12-23 14:43:54 -08:00
Nik Bougalis
5a688f9236 Correct a check during RsaSha256 fulfillment loading:
The specification requires that we verify that the
signature and modulus of an RSA-SHA256 fulfillment
are both the same length (specifically that they
have "the same number of octets") referring to the
encoded length.

We were, instead, checking the number of bytes that
the signature and modulus had after decoding.
2016-12-23 14:43:53 -08:00
Miguel Portilla
effd8c9737 Fix scons 64bit OS detection 2016-12-23 14:36:11 -08:00
Miguel Portilla
a7c4d682d2 Ledger header RPC enhancements (RIPD-692):
This combines two enhancements to the ledger_data RPC
command and related commands.

The ledger_data RPC command will now return the ledger header
in the first query (the one with no marker specified).

Also, ledger_data and related commands will now provide the
ledger header in binary if binary output is specified.

Modified existing ledgerdata unit test to cover new functionality.
2016-12-23 14:36:11 -08:00
JoelKatz
e00a6b0e5a Enable amendments in genesis ledger (RIPD-1281)
When started with "--start", put all known, non-vetoed
amendments in the genesis ledger. This avoids the need
to wait 256 ledgers before amendments are enabled when
testing with a fresh ledger.
2016-12-23 14:36:11 -08:00
JoelKatz
dc3571184a Add a flag to the ledger for SHAMapV2
This will allow code that looks at the ledger header to know what version the
SHAMap uses. This is helpful for code that rebuilds ledger binary structures
from the leaves.
2016-12-23 14:36:11 -08:00
JoelKatz
22a375a5f4 Add support for tick sizes (RIPD-1363):
Add an amendment to allow gateways to set a "tick size"
for assets they issue. There are no changes unless the
amendment is enabled (since the tick size option cannot
be set).

With the amendment enabled:

AccountSet transactions may set a "TickSize" parameter.
Legal values are 0 and 3-15 inclusive. Zero removes the
setting. 3-15 allow that many decimal digits of precision
in the pricing of offers for assets issued by this account.

For asset pairs with XRP, the tick size imposed, if any,
is the tick size of the issuer of the non-XRP asset. For
asset pairs without XRP, the tick size imposed, if any,
is the smaller of the two issuer's configured tick sizes.

The tick size is imposed by rounding the offer quality
down to nearest tick and recomputing the non-critical
side of the offer. For a buy, the amount offered is
rounded down. For a sell, the amount charged is rounded up.

Gateways must enable a TickSize on their account for this
feature to benefit them.

The primary expected benefit is the elimination of bots
fighting over the tip of the order book. This means:

- Quicker price discovery as outpricing someone by a
  microscopic amount is made impossible. Currently
  bots can spend hours outbidding each other with no
  significant price movement.

- A reduction in offer creation and cancellation spam.

- More offers left on the books as priority means
  something when you can't outbid by a microscopic amount.
2016-12-23 14:36:11 -08:00
Scott Schurr
3337d17fdd Convert DeadlineTimer to std::thread (RIPD-1189) 2016-12-23 14:36:11 -08:00
Scott Schurr
8ab2236cdd Convert DeadlineTimer to chrono (RIPD-1189) 2016-12-23 14:36:10 -08:00
Rome Reginelli
0cb6a0f961 Correct PaymentChannelClaim flag names in comment 2016-12-23 14:36:10 -08:00
Mike Ellery
28ae522ea2 Migrate freeze-test to cpp (RIPD-1154):
Port all active tests in freeze-test.coffee to c++.
2016-12-23 14:36:10 -08:00
Mike Ellery
c0cf7bd3c1 Port discrepancy-test.coffee to c++ (RIPD-1352):
Add jtx unit test that verifies a transaction net balance against the
reported fee.
2016-12-23 14:36:10 -08:00
Mike Ellery
fd7a2835e4 Migrate path tests to cpp (RIPD-1155):
Implement the existing declarative-path-test in jtx framework.
2016-12-23 14:36:10 -08:00
Mike Ellery
3d0314c621 Remove websocketpp support (RIPD-1293) 2016-12-23 14:36:10 -08:00
Mike Ellery
8d83aa5c07 Add server/connection tests (RIPD-1336):
Migrate tests in uniport-test.js to cpp/jtx. Handle exceptions in
WSClient and JSONRPClient constructors. Use shorter timeout
for HTTP and WS Peers when client is localhost. Add missing call to
start_timer in HTTP Peer. Add incomplete WS Upgrade request test
to prove that server timeout is working.
2016-12-23 14:36:10 -08:00
Lieefu Way
7ff243ade9 Remove redundant call to clearNeedNetworkLedger 2016-12-23 14:36:10 -08:00
Howard Hinnant
2fd0540ed4 Recognize ripplerpc 2.0 requests and respond in kind:
* Force jtx to request/receive the 2.0 API
* Force the JSON and WebSocket tests to use 2.0 API
*  This specifically allows the Websocket to create 2.0 json/ripple
   and get back a 2.0 response.
* Add test for malformed json2
* Add check for parse failure
* Add check for params to be in array form.
* Correct type-o discovered in tests due to stricter checking.
* Add API version to the WSClient & JSONRPCClient test
* Update source.dox with more headers
2016-12-23 14:36:10 -08:00
wilsonianb
cdf470e68d Forward manifests from new peer (RIPD-1325):
Previously, manifests sent to new peers were marked as history so that
they would not be forwarded. However, this prevented a starting up
node's new manifest from being forwarded beyond its directly connected
peers. Stale or invalid manifests are still not forwarded.
2016-12-23 14:36:10 -08:00
Nik Bougalis
7fc780dd70 Set version to 0.40.0 2016-12-20 09:20:17 -08:00
seelabs
4d7b1a3b61 Set version to 0.40.0-rc3 2016-12-07 11:52:51 -05:00
seelabs
9a9dffa4ff Merge release into develop 2016-12-07 11:51:56 -05:00
seelabs
51e7f595bb Set version to 0.40.0-rc2 2016-12-06 21:38:13 -05:00
seelabs
293e520efc Set unfunded offers fix switch date 2016-12-06 21:38:10 -05:00
Nik Bougalis
9e960ff6b8 Set version to 0.40.0-rc1 2016-11-21 09:27:12 -08:00
Brad Chase
0a8e690917 Remove duplicate translation unit names 2016-11-21 09:22:43 -08:00
Brad Chase
cf60d4c30e Improve dependency installation during CI builds. 2016-11-21 09:21:55 -08:00
Nik Bougalis
8f2480225b Set version to 0.40.0-b11 2016-11-18 12:17:36 -08:00
Nik Bougalis
44167a6bcb Cleanup code identified in code review 2016-11-18 12:17:30 -08:00
seelabs
db95808206 Set unfunded offers fix switch date 2016-11-18 12:17:29 -08:00
Edward Hennis
fd901f8081 Support parallel 64- and 32-bit boost binaries (RIPD-1317):
* CMake and scons
* Update Visual Studio build docs
* Cache Appveyor PIP downloads for scons builds
* Rename the CMakeFuncs `find_` functions to `use_`
2016-11-18 12:17:29 -08:00
Mike Ellery
b6ce0aa75a Add build instructions for macOS:
Update existing wiki build instructions for macOS and migrate to
in-repo markdown file.
2016-11-18 12:17:29 -08:00
Mike Ellery
b712125bc0 Add TrustAndBalance Tests (RIPD-1153):
Migrate tests in send-test.js to cpp/jtx.
2016-11-18 12:17:29 -08:00
Nik Bougalis
d69b16895c Conditional Suspended Payments (RIPD-1140):
A conditional suspended payment is a suspended payment where
completion of the payment is contingent upon the fulfillment
of a condition defined by the sender during creation of the
suspended payment.

This commit also introduces the "CryptoConditions" amendment
which controls whether cryptoconditions will be supported
in suspended payments. The existing "SusPay" amendment can
be used to enable suspended payments without enabling the
cryptoconditions code.
2016-11-18 12:17:28 -08:00
Nik Bougalis
d198b439fd Cryptoconditions: RSA-SHA-256 (RIPD-1213) 2016-11-18 12:17:27 -08:00
Nik Bougalis
83aa5517c0 Cryptoconditions: PREFIX-SHA-256 (RIPD-1211) 2016-11-18 12:17:26 -08:00
Nik Bougalis
5711e7caa9 Cryptoconditions: ED25519 (RIPD-1214) 2016-11-15 21:42:31 -08:00
Nik Bougalis
8d0c93691d Cryptoconditions: PREIMAGE-SHA-256 (RIPD-1210) 2016-11-15 21:41:48 -08:00
Nik Bougalis
d8d0cb17ba Cryptoconditions Framework (RIPD-1139):
Cryptoconditions provide a mechanism to describe a signed message such
that multiple actors in a distributed system can all verify the same
signed message and agree on whether it matches the description. This
provides a useful primitive for event-based systems that are distributed
on the Internet since we can describe events in a standard deterministic
manner (represented by signed messages) and therefore define generic
authenticated event handlers.

The cryptoconditions specification implemented is available at:
    https://tools.ietf.org/html/draft-thomas-crypto-conditions-01
2016-11-15 21:41:25 -08:00
Nik Bougalis
47a919faf0 Set version to 0.40.0-b10 2016-11-09 13:58:53 -08:00
Nik Bougalis
d572de769b Improve peer iteration in overlay 2016-11-09 13:58:04 -08:00
seelabs
810a6b0f30 Add pthread flag 2016-11-09 13:58:04 -08:00
seelabs
665ad180cb Set unfunded offers fix switch date 2016-11-09 13:58:04 -08:00
Edward Hennis
361917e902 CMake unity and nonunity builds per project (RIPD-1326):
* Still respects "-Dtarget" unity/nonunity selection. Still defaults to
  unity.
* Adds a new target (rippled_classic or rippled_unity) depending on
  unity/nonunity selection.
* New target does not build by default.
  eg. Use `cmake --build . -target rippled_classic`
* Copy all config variables (Debug/Release to DebugClassic/ReleaseClassic) for nonunity builds
* CI uses the more generic "cmake --build" command
2016-11-09 13:58:04 -08:00
Miguel Portilla
4b261b12a4 Prevent misuse of JobQueue header files:
* Move `JobCoro` to `JobQueue::Coro` and remove separate JobCoro.h
2016-11-09 13:58:04 -08:00
wilsonianb
afd4b45036 Fix overlay README.md (RIPD-1330) 2016-11-09 13:58:04 -08:00
wilsonianb
47adc728db Add Linux instructions to docs/README.md 2016-11-09 13:58:04 -08:00
Mike Ellery
7e39d645b9 Add Ticket Tests (RIPD-1328):
Migrate ticket-test.js to cpp. Add coverage for Change/Cancel ticket
handlers.
2016-11-09 13:58:03 -08:00
Mike Ellery
35504f1723 Add Ledger RPC Tests (RIPD-1297):
Migrate tests in remote-test.js to cpp/jtx. Add coverage for
ledger_entry RPC request.
2016-11-09 13:58:03 -08:00
Brad Chase
61d9dda4e0 Expand unit test coverage of SetTrust:
* Unit test malformed/tem responses
* Update free trust line test to cover the case where creation is actually adding the opposite trust direction to an existing account lines ledger entry
* Add unit tests for setting and removing quality on trust lines.
2016-11-09 13:58:03 -08:00
Brad Chase
38ca9d4a97 Set version to 0.40.0-b9 2016-10-27 15:18:37 -04:00
Edward Hennis
f37aa1d6c8 Improve CMake find_boost compatibility:
* Put all the relevant calls together.
* Sensibly handle stage vs. stage64 lib directories.
* Unable to move target_link_libraries acur_project not defined in new location, so breaks non-win builds
2016-10-27 15:17:21 -04:00
Scott Schurr
db13ddf844 Fix unused variable warning from clang 2016-10-27 12:45:01 -04:00
Miguel Portilla
bf642404c7 Use ws2 as default in unit tests 2016-10-27 12:43:14 -04:00
S. Matthew English
d53d5cfc42 Fix typos/style issues in documentation 2016-10-27 12:41:11 -04:00
wilsonianb
bbf52056f9 Publish new manifest signature 2016-10-27 12:39:20 -04:00
Brad Chase
b8cae2dfaf Unit test for free trust lines (RIPD-911) 2016-10-27 12:36:01 -04:00
Scott Schurr
795ee8bb5e Add MacOS documentation to docs/README.md 2016-10-27 12:33:48 -04:00
Mike Ellery
cfcd618aa6 Add Offer tests (RIPD-938):
Migrate tests in offer-test.js to cpp/jtx. Minimally reformat existing
test code. Augment self-cross test to include partner account as well as bridged and
direct crossing.
2016-10-27 12:30:54 -04:00
Miguel Portilla
19258cf980 Remove application dependency from SyncFilters 2016-10-27 12:19:26 -04:00
seelabs
cdaafeb4b6 Improve openssl directory finding 2016-10-18 14:18:41 -04:00
Edward Hennis
7688a97d95 Set version to 0.40.0-b8 2016-10-17 15:32:34 -04:00
Nik Bougalis
027b289c91 Remove an unused argument from ripple::verify 2016-10-17 15:28:21 -04:00
wilsonianb
b55edfa8f0 Sign manifest with ephemeral and master keys (RIPD-1083) 2016-10-17 15:28:12 -04:00
Edward Hennis
7d46d153c6 Add CMake target for docs:
* Includes docs/ files in VC and xcode projects.
* Does NOT build automatically, so will not affect systems without the
  build toolchain.
2016-10-17 15:25:39 -04:00
Edward Hennis
96b17749af Setup instructions for doc toolchain for Windows 2016-10-17 15:18:49 -04:00
Vinnie Falco
f27348c4d5 Add HTML documentation framework 2016-10-17 15:18:40 -04:00
seelabs
c6923dcf88 Report error if OS is not 64-bit 2016-10-17 15:10:19 -04:00
David Schwartz
f456355da2 Begin consensus refactor (RIPD-1011):
* New RCLCx* classes
* Refactor consensus positions
* Refactor proposed transaction sets
* Refactor disputed transactions
* Refactor position broadcast/replay
2016-10-17 15:02:36 -04:00
JoelKatz
97806b42c4 Consensus refactor preliminary changes (RIPD-1011):
* Remove extraneous passing of transaction set hashes
* Remove recentPositions_. InboundTXs does the job now
* Move responsibility for sending "have TX set" out of consensus
2016-10-17 15:01:33 -04:00
JoelKatz
ed02b0717e Snapshotting an unbacked SHAMap should yield an unbacked SHAMap 2016-10-17 15:01:24 -04:00
Edward Hennis
2963e91752 Improve CI / cmake for ripple-libpp support (RIPD-1255):
* Simplify Travis APT config.
* Automatically retry Travis build and test script. Will result in fewer
  false negatives.
* Travis install scripts use absolute paths.
* Build a library of cmake functions for reuse.
* Disallow cmake builds in project root.
* Disallow cmake default 32-bit Visual Studio builds.
* Add several missing nonunity / header files, including all unit tests to
  cmake.
* Change gcc.debug.nounity Travis build to use cmake, instead of adding
  builds.
* Change Appveyor build to cmake. Eliminates most spurious failures, which
  are caused by python or scons failing to download.
2016-10-03 12:04:46 -04:00
Nik Bougalis
aa11effdd6 Set version to 0.40.0-b7 2016-10-01 19:10:17 -07:00
Nik Bougalis
6e9c15af92 Correctly parse multi-buffer JSON messages (RIPD-1306):
When attempting to parse a BufferSequence as a JSON object,
if the sequence contained more than buffer, the JSON parser
would incorrectly attempt to decode each buffer as a separate
JSON object, instead of one complete object.
2016-10-01 19:10:16 -07:00
Edward Hennis
0ddeb29c35 Add regression test for multi-buffer JSON message parsing (RIPD-1306) 2016-10-01 19:10:06 -07:00
Vinnie Falco
98f878cf10 Set version to 0.33.0-hf1 2016-10-01 12:36:40 -04:00
Nik Bougalis
69b47890e6 Correctly parse multi-buffer JSON messages (RIPD-1306):
When attempting to parse a BufferSequence as a JSON object,
if the sequence contained more than buffer, the JSON parser
would incorrectly attempt to decode each buffer as a separate
JSON object, instead of one complete object.
2016-10-01 12:36:37 -04:00
Edward Hennis
41851022d3 Add regression test for multi-buffer JSON message parsing (RIPD-1306) 2016-10-01 12:36:37 -04:00
Nik Bougalis
a7630aaa55 Set version to 0.40.0-b6 2016-09-30 08:46:47 -07:00
Nik Bougalis
1d15af6afd Merge master into develop 2016-09-30 08:46:07 -07:00
Nik Bougalis
dd0075f2b8 Set version to 0.40.0-b5 2016-09-29 16:28:37 -07:00
Nik Bougalis
4b0d8b630c Improve Buffer and Slice:
* Make Buffer constructible from a Slice
* Fix self-move-assignment in Buffer
* Add unit tests
2016-09-29 16:28:37 -07:00
Howard Hinnant
b421559a47 Prepare for boost 1.62
These changes are compatible with previous boost releases.
2016-09-29 19:24:49 -04:00
Mike Ellery
05e7373086 Add book_offers RPC tests (RIPD-1283):
Migrate orderbook-test.js to cpp tests. Provide
coverage for error conditions in book_offers
RPC method.
2016-09-29 19:24:49 -04:00
seelabs
bb0b97f46b Fix unfunded offer not removed (RIPD-1298):
If the mantissas of two non-native amounts differ by less than 10, then
subtracting them leaves a result of zero. This can cause situations
where `a>b`, yet `a-b == 0`.

One consequence of this is unfunded offers were incorrectly left in
order books. The code would check if the offer would be
consumed (`amount in offer > amount needed`), assume it wouldn't be,
yet when `amount needed` was subtracted from `amount in offer` the
result was zero and the offer was unfunded. This unfunded offer
incorrectly remained on the order book.

This patch fixes this bug.
2016-09-29 19:24:49 -04:00
Vinnie Falco
3b639afac2 Integrate NuDB 2016-09-29 19:24:15 -04:00
Vinnie Falco
bd93ecbd6b Merge commit '79159ffd87bf86e92ab5af6fffd5cc93c205a630' as 'src/nudb' 2016-09-29 19:24:13 -04:00
Vinnie Falco
79159ffd87 Squashed 'src/nudb/' content from commit 00adc6a
git-subtree-dir: src/nudb
git-subtree-split: 00adc6a4f16679a376f40c967f77dfa544c179c1
2016-09-29 19:24:12 -04:00
Nik Bougalis
f05321d501 Set version to 0.33.0 2016-09-29 12:02:57 -07:00
johannakate
8734458cfb add the getInfoRippled.sh support script:
The script can be used to quickly and easily retrieve
information to assess the health of a rippled server
2016-09-29 12:02:47 -07:00
Nik Bougalis
bdbb3caf47 Set version to 0.33.0-rc3 2016-09-21 12:11:44 -07:00
seelabs
076658e0f6 Set issuer fix switch date 2016-09-21 11:40:53 -07:00
Miguel Portilla
b2499c8fa0 Add Status page:
* Make HTTP(S) requests on websocket ports reply with Status page
* Fix isWebsocketUpgrade to compare case insensitive
* Make websocket upgrades with no websocket protocols configured report error
* Create unit test for unauthorized requets and the status page
2016-09-21 14:17:32 -04:00
Nik Bougalis
231a5ae6fb Set version to 0.40.0-b4 2016-09-21 11:02:54 -07:00
seelabs
45249e8746 Set issuer fix switch date 2016-09-21 09:03:55 -07:00
Miguel Portilla
e6ed9ae4d8 Add Status page:
* Make HTTP(S) requests on websocket ports reply with Status page
* Fix isWebsocketUpgrade to compare case insensitive
* Make websocket upgrades with no websocket protocols configured report error
* Create unit test for unauthorized requests and the status page
2016-09-21 09:03:55 -07:00
Aishraj Dahal
aca6db5601 Fix typo 2016-09-21 09:03:54 -07:00
Vinnie Falco
8e9f9599b8 Set version to 0.40.0-b3 2016-09-15 17:05:41 -04:00
Vinnie Falco
71d7d87bf3 Update for Beast 1.0.0-b13 2016-09-15 17:05:08 -04:00
Vinnie Falco
7ffef30f1c Add 'src/beast/' from commit '2f9a8440c2432d8a196571d6300404cb76314125'
git-subtree-dir: src/beast
git-subtree-mainline: 7c90b9ef88
git-subtree-split: 2f9a8440c2
2016-09-15 15:07:45 -04:00
Vinnie Falco
7c90b9ef88 Remove Beast subtree in preparation for git-subtree add 2016-09-15 15:07:34 -04:00
Vinnie Falco
4bb74196c0 Merge commit '2f9a8440c2432d8a196571d6300404cb76314125' into develop 2016-09-15 14:21:55 -04:00
seelabs
35fa20a110 Set version to 0.40.0-b2 2016-09-13 18:53:50 -04:00
seelabs
ddaeae2855 Set version to 0.33.0-rc2 2016-09-13 18:33:40 -04:00
seelabs
9c8e3776de Set issuer fix switch date 2016-09-13 18:31:47 -04:00
seelabs
633cf86ad8 Set issuer fix switch date 2016-09-13 18:18:58 -04:00
Nik Bougalis
66ce8779e8 Set version to 0.40.0-b1 2016-09-12 09:23:42 -07:00
Nik Bougalis
a9b3042d7e Remove unused tables from wallet.db 2016-09-12 09:23:41 -07:00
Nik Bougalis
4df24c0e8e Upgrade SQLite to 3.14.1 2016-09-12 09:23:40 -07:00
Nik Bougalis
9a988963e9 Refactor STObject, STLedgerEntry:
* Normalize names
* Remove unused and deprecated members
2016-09-12 09:23:39 -07:00
Nik Bougalis
5be33a650d Report ledger information in account_lines RPC (RIPD-1276) 2016-09-12 09:23:38 -07:00
Will
5b09dc731f Add jtx cpp test for noripple flag (RIPD-1259):
- Set and clear noripple flag
 - DefaultRipple on account
 - Set noripple on trustline with -ve balance
 - Pairwise noripple
2016-09-12 09:23:30 -07:00
Mike Ellery
51d7e7336f Improve multisign tests (RIPD-1273):
* Migrate some error case tests from js into jTx.
* Create test that invokes sign_for and submit_multisigned rpc methods.
2016-09-12 09:23:29 -07:00
Mike Ellery
ad9be4dbf6 Add LedgerClosed test (RIPD-1272)
Migrate the logic in monitor-test.js to a new jtx test
that covers the ledger_closed RPC method.
2016-09-11 14:01:36 -07:00
seelabs
87756b9324 Set version to 0.33.0-rc1 2016-09-07 16:56:37 -04:00
seelabs
e611a7a0f8 Set issuer fix switch date 2016-09-07 14:35:37 -04:00
Vinnie Falco
2f9a8440c2 Set version to 1.0.0-b13 2016-09-02 16:56:33 -04:00
Vinnie Falco
a40dd2690a Better dstream:
* non-Windows dstream is a simple reference alias
* dstream constructor takes a target ostream argument
* dstream inherits the unitbuf setting of the target stream
2016-09-02 16:56:19 -04:00
Vinnie Falco
802c2395c1 Set version to 0.33.0-b8 2016-09-02 15:31:19 -04:00
Brad Chase
8f97889176 Don't include unit test sources in code coverage (RIPD-1132):
Most files containing unit test code are moved to
src/test. JTx and the test client code are not yet moved.
2016-09-02 15:26:16 -04:00
Vinnie Falco
104f12a9e2 Tidy up CMakeLists 2016-09-02 10:38:43 -04:00
Vinnie Falco
e499743cdd Remove bin and bin64 directories:
These directories are removed, to make it easier for developers
to delete the entire directory contents when rebuilding CMake targets
after a configuration change.
2016-09-02 10:01:32 -04:00
Vinnie Falco
241795cd73 Set version to 1.0.0-b12 2016-08-29 15:07:23 -04:00
Vinnie Falco
411b2534ed Use -p to print suites from unit test main 2016-08-29 15:07:15 -04:00
Vinnie Falco
253f138aff Add BEAST_EXPECTS test failure macro:
New overloads of suite::expect take the file and line number
as individual parameters, cleaning up the file name output
by showing only the filename part (to not leak the full path,
which might contain sensitive information).

A new macro BEAST_EXPECTS allows an additional reason
string as well as reporting the file and line. Typical usage:

    ```
    error_code ec;
    ...
    if(! BEAST_EXPECTS(! ec, ec.message()))
        return;
    ```
2016-08-29 13:46:31 -04:00
Vinnie Falco
dadbab4c0f Fix unit test runner to output all case names:
Also fixes a bug where suite::log was incorrectly flushed.
2016-08-29 11:48:45 -04:00
Vinnie Falco
d9017a3f76 Tidy up whitespace 2016-08-29 11:47:01 -04:00
Vinnie Falco
aedfaab93d Update README, rename CHANGELOG 2016-08-29 10:29:07 -04:00
Nik Bougalis
8687f64429 Set version to 0.33.0-b7 2016-08-27 18:00:05 -07:00
Nik Bougalis
1d08075c43 Simplify Beast code:
- Use std instead of custom Beast classes
- Remove Beast heap block allocator
- Remove function call timer
2016-08-27 18:00:00 -07:00
Howard Hinnant
8a6c7f9208 Move varint out of NuDB
varint is no longer used by NuDB.  It is now only used by codec.h in
nodestore and so has been moved there.
2016-08-27 17:59:36 -07:00
Mike Ellery
fd061bba8a Augment LedgerRequestRPC tests (RIPD-1270):
Add basic ledger_request validation tests to replace the existing
ledger.js tests. Provide tests that trigger some error conditions
in RPC handling code.
2016-08-27 17:59:36 -07:00
Mike Ellery
8f41817cb9 Add ledger_data RPC tests (RIPD-1260):
Migrate ledger-data-test.js to cpp tests. Provide coverage for
paging limits and input error cases.
2016-08-27 17:59:27 -07:00
seelabs
cf8b6be494 Set issuer in balanceHook 2016-08-26 16:08:30 -07:00
Vinnie Falco
d263d4d449 Set version to 1.0.0-b11 2016-08-26 13:06:51 -04:00
Keaton Okkonen
b39e4817e5 Update README.md (fix #62) 2016-08-26 13:06:44 -04:00
Vinnie Falco
4dfa250a34 Rename websocket echo servers (fix #46) 2016-08-26 13:06:44 -04:00
Vinnie Falco
8a6908c072 Rename to DynamicBuffer (fix #47) 2016-08-26 13:06:43 -04:00
Vinnie Falco
d8fe737ad7 Number error codes from 1 (fix #54) 2016-08-26 13:06:43 -04:00
Vinnie Falco
61023c3f4a Update HTTP documentation (fix #61, #60, #59) 2016-08-26 13:06:42 -04:00
Vinnie Falco
b607d47bd3 Restyle sources 2016-08-26 13:06:42 -04:00
Vinnie Falco
878c0f2a19 Set URI in generated WebSocket Upgrade requests (fix #64):
The 'resource' parameter in the call to stream::handshake is
used when building the HTTP request to perform the upgrade.
2016-08-26 13:06:42 -04:00
Vinnie Falco
19dd983d2b Fix integer warnings in 64-bit Windows build 2016-08-26 13:06:41 -04:00
Vinnie Falco
c15751ced6 Update documentation and images 2016-08-26 13:06:41 -04:00
Vinnie Falco
a55d9aa4c3 Tidy up 32 and 64 bit build support (fix #49):
This fixes up support for building both 32 and 64 bit targets, especially on Windows.
2016-08-26 13:06:39 -04:00
Nik Bougalis
037d52114a Print the testcase header prior to logging (fix #56) 2016-08-26 07:33:43 -07:00
seelabs
68e123a8d6 Set version to 0.33.0-b6 2016-08-18 11:34:59 -04:00
seelabs
b92a7d415e Use deferred credits in XRPEndpointStep:
The XRPEndpointStep bypassed the logic in deferred credits and
incorrectly counted funds acquired during a payment as available for
use in the payment. It also incorrectly used the current ownerCount when
calculating the reserve instead of the owner count as it was at the
beginning of the payment (reducing the owner count is analogous to
acquiring funds during a payment.)
2016-08-18 11:34:12 -04:00
JoelKatz
fc73fbd050 Remove old-style pathfinding code
All cases that still used the old RPF code now use new-style pathfinding.
This includes unit tests, RPF requests with a ledger specified, and RPF
requests in standalone mode.
2016-08-18 11:34:12 -04:00
seelabs
ab45c490d7 Require empty string for empty peer account on account_lines:
A recent commit (0d0227e744) broke the
parser for the rpc command `account_lines` such that an empty
string ("") was no longer required for the second parameter. This commit
fixes that bug.

Note the empty peer field string requirement only applies to the rippled
command line. It can be comitted with a ledger via HTTP or WebSocket.
2016-08-16 08:29:01 -04:00
Nik Bougalis
d8b85c00e8 Set version to 0.33.0-b5 2016-08-15 11:21:27 -07:00
Howard Hinnant
e453c14b0a Add SHAMapV2 to supportedAmendments 2016-08-15 11:21:10 -07:00
Mike Ellery
1c6e32ccc2 Migrate SetRegularKey unit tests (RIPD-1258):
Create SetRegularKey test to replace existing js test. Copy and simplify
some existing test logic from Env_test.cpp and MultiSign.test.cpp. Add
coverage for tfUniversalMask tx flag error case.
2016-08-15 11:18:40 -07:00
Mike Ellery
c4e581179c Migrate AccountSet unit tests (RIPD-1249):
Move existing functionality of account_set-tests.js into a native
unit test. Improve coverage by testing more cases.
2016-08-15 11:15:35 -07:00
Mike Ellery
0d803e0fa2 Refactor uses of strCopy (RIPD-1256)
Replace the sparsely used strCopy function with Slice. Change some of
the SHAMap interface to use Slice instead of Blob, which should
eliminate a copy.
2016-08-15 11:09:45 -07:00
Edward Hennis
c1b8efb7af Clear queue for account with high fee tx (RIPD-1246):
* If an account has any transactions in the transaction queue, submitting
  a transaction that covers the differences to the open ledger fee level
  for prior queued transactions plus itself will cause all those
  transactions to be applied to the open ledger.
* tel failures in `TxQ::accept` will leave tx in the queue to retry later.
2016-08-15 11:09:18 -07:00
seelabs
b0704b47e8 Remove _FORTIFY_SOURCES from build:
This option is silently ignorned at -O0
2016-08-15 11:08:38 -07:00
seelabs
2fa84e95b9 Add test for path with offer that changes issuer only 2016-08-15 11:08:21 -07:00
seelabs
b02ec47b4f Fix signed comparison bug in range_check_cast 2016-08-15 11:07:58 -07:00
Vinnie Falco
3ff56eb071 Set version to 1.0.0-b10 2016-08-12 21:02:44 -04:00
Vinnie Falco
9e8a5a5765 Update README.md for CppCon 2016 2016-08-12 21:02:40 -04:00
Vinnie Falco
461a8ea846 Add WebSocket implementation comparison doc 2016-08-12 21:02:40 -04:00
Vinnie Falco
8d9c0daa9d Add BEAST_EXPECT macro:
This macro is used in the unit test framework to assist in
reporting the file and line number of test failures.
2016-08-12 21:02:40 -04:00
Ties Jan Hefting
1537527927 Fix warnings 2016-08-12 21:02:39 -04:00
seelabs
d51a2785ee Set version to 0.33.0-b4 2016-08-08 12:25:57 -04:00
Nik Bougalis
e8a7ad4748 Prevent concurrent write operations in websockets 2016-08-07 13:15:19 -07:00
seelabs
2ca18670d2 Set version to 0.33.0-b3 2016-08-05 11:13:59 -04:00
seelabs
d4a56f223a Payment Channels (RIPD-1224):
Payment channels permit off-ledger checkpoints of XRP payments flowing
in a single direction. A channel sequesters the owner's XRP in its own
ledger entry. The owner can authorize the recipient to claim up to a
give balance by giving the receiver a signed message (off-ledger). The
recipient can use this signed message to claim any unpaid balance while
the channel remains open. The owner can top off the line as needed. If
the channel has not paid out all its funds, the owner must wait out a
delay to close the channel to give the recipient a chance to supply any
claims. The recipient can close the channel at any time. Any transaction
that touches the channel after the expiration time will close the
channel. The total amount paid increases monotonically as newer claims
are issued. When the channel is closed any remaining balance is returned
to the owner. Channels are intended to permit intermittent off-ledger
settlement of ILP trust lines as balances get substantial. For
bidirectional channels, a payment channel can be used in each direction.
2016-08-05 11:13:57 -04:00
seelabs
2e7f5502bf Fix RPC parsing bug 2016-08-05 11:13:57 -04:00
seelabs
4483079181 Remove extra path separator from CMAKE_SOURCE_DIR 2016-08-05 11:13:57 -04:00
Nik Bougalis
2f0b3bd427 Set version to 0.33.0-b2 2016-08-02 15:13:11 -07:00
Edward Hennis
d1ce07ef5d Minor refactor of LoadFeeTrack (RIPD-956):
* Load scaling functions are free, and take `Fees`.
* Move LoadFeeTrack to app/misc.
* Update naming convention.
2016-08-02 18:05:08 -04:00
Edward Hennis
a252fefede Report escalated ledger fee in load_factor (RIPD-1207):
* Updates both server_info and server_state
* Adds "load_factor_server", which reports the server-only portion of the
  load (if appropriate) so clients can decide an appropriate fee to pay if
  the open ledger fee is higher than they're willing to pay.

=== Release Notes ===
==== Updated Features ====

Both `server_info` and `server_state` report the escalated ledger fee in
the `load_factor` result parameter. If appropriate, `load_factor_server`
reports the server-only portion of the load so clients can submit a fee
between those two values to get into the queue.
2016-08-02 18:04:47 -04:00
Edward Hennis
e762d09e7e Tx queue enhancements and RPC info (RIPD-1205, RIPD-1206):
* Account-related queue stats (RIPD-1205). Boolean "queue" parameter to
  account_info only if requesting the open ledger.
* Account for the TxQ when autofilling sequence in sign-and-submit (RIPD-1206)
* Tweak TxQ::accept edge case when choosing which tx to try next.
* Labels for experimental "x_" submit parameters use correct separator.

=== Release Notes ===
==== New features ====

When requesting `account_info` for the open ledger, include the `queue :
true` to get extra information about any queued transactions for this
account. (RIPD-1205).

==== Bug fixes ====

When using sign-and-submit mode to autofill a transaction's sequence
number, the logic will not reuse a sequence number that is in the queue
for this account. (RIPD-1206).

Labels for experimental "x_queue_okay" and "x_assume_tx" parameters to
`sign` and `submit` updated to use correct separator.
2016-08-02 18:03:53 -04:00
Will
348e65074e fix bug in error propagation for account badSeed (RIPD-1248) 2016-08-02 13:25:48 -07:00
Will
64f2576fc8 Add jtx cpp test for account_objects RPC (RIPD-1230)
port of js test, account_objects-test.js
- bob account setup and rpc invoke
- error tests; no account, non-existant account, bad seed, validation
- combined unstepped testcase then stepped with limit/marker
2016-08-02 13:25:48 -07:00
Mike Ellery
9926d3188a Add jtx test for account_offers RPC (RIPD-1236)
Details
 -------

  * covers existing account_offers-test.js
  * adds new coverage for results limiting and some
    negative tests (bad input)
  * fix bug in json value copying logic for bad seed/account error
    case
  * using new BEAST_EXPECT macros
2016-08-02 13:25:48 -07:00
seelabs
cc8671b8b2 Add OwnerPays to supportedAmendments 2016-08-02 13:25:48 -07:00
wilsonianb
f5fcdd0b80 Update pywin32 version in appveyor 2016-08-02 13:25:48 -07:00
Miguel Portilla
71a30a57cb Fix scons vcxproj in OS X 2016-08-02 13:25:48 -07:00
Miguel Portilla
f9fe2ef90f Fix inbound ledger add peers logic 2016-08-02 13:25:48 -07:00
Scott Schurr
6c8673c7c3 Remove unused member variable in ApplyBaseView 2016-08-02 13:25:48 -07:00
JoelKatz
11b64e049c Report frozen lines in gateway_balances(RIPD-1217):
* Report lines frozen by the gateway separately
* Add unit test for gateway_balances
* Clean up some existing code
2016-08-02 13:25:48 -07:00
JoelKatz
33f153fc9a Consensus refactor preliminary changes (RIPD-1011):
* Standardize names of LedgerConsensusImp members
* Rework visitStoredProposals
* Clean up mapComplete
* Move status helpers out of LedgerConsensusImp
* Move applyTransaction out of LedgerConsensusUmp
* Clean up applyTransactions
2016-08-02 13:25:48 -07:00
JoelKatz
4758050444 SHAMap fixups:
* Change state_ to Invalid if inner node types mismatch
* flushDirty before unsharing to ensure modified nodes get written
* Remove unnecessary code
* Fix updateHash for V2 inner nodes
* In descend, call isInconsistentNode only if node is found
* getMissingNodes could request duplicates in some cases
* An invalid node with the right hash is useful, it proves the map invalid
2016-08-02 13:25:48 -07:00
Nik Bougalis
a5589dcec6 Set version to 0.33.0-b1 2016-07-29 17:58:26 -07:00
Nik Bougalis
08ea245101 Hoist version string to namespace level 2016-07-29 17:58:24 -07:00
seelabs
3b58e36621 Add CMake support:
cmake support in rippled. Currently supports:

 * unity/nounity debug/release
 * running protobuf
 * sanitizer builds
 * optional release build with assert turned on
 * `target` variable to easily set compiler/debug/unity
    (i.e. -Dtarget=gcc.debug.nounity)
 * gcc/clang/visual studio/xcode
 * linux/mac/win
 * gcc 4 ABI, when needed
 * ninja builds
 * check openssl for acceptably recent release
 * static builds

TBD:
 * jemalloc support
 * count

Notes:
 * Use the -G"Visual Studio 14 2015 Win64" generator on Windows. Without
   this a 32-bit project will be created. There is no way to set the
   generator or force a 64-bit build in CMakeLists.txt (setting
   CMAKE_GENERATOR_PLATFORM won't work). The best solution may be to
   wrap cmake with a script.

 * It is not possible to generate a visual studio project on linux or
   mac. The visual studio generator is only available on windows.

 * The visual studio project can be _either_ unity or
   non-unity (selected at generation time).  It does not appear possible
   to disable compilation based on configuration.

 * Language is _much_ worse than python, poor documentation and "quirky"
   language support (for example, generator expressions can only be used
   in limited contexts and seem to work differently based on
   context (set_property can set multiple values, add_compile_options
   can not/or is buggy)

 * Could not call out to `sed` because cmake messed with the regular
   expression before calling the external command. I did not see a way
   around this.

 * Makefile generators want to be single target. It wants a separate
   directory for each target type. I saw some mentions on the web for
   ways around this bug haven't look into it. The visual studio project
   does support debug/release configurations in the same project (but
   not unity/non-unity).
2016-07-29 17:57:50 -07:00
Miguel Portilla
b343b0468a Use lock_guard over unique_lock 2016-07-29 17:57:49 -07:00
Will
69b91065c5 Remove OpenSSL Base64 encoding dependency (RIPD-1238) 2016-07-29 17:57:49 -07:00
Vinnie Falco
e39316882e Add BEAST_EXPECT, replace calls to expect 2016-07-29 17:46:56 -07:00
Nik Bougalis
1ff972fbd3 Set version to 0.32.1 2016-07-29 12:52:26 -07:00
Vinnie Falco
8204d9524e Set version to 1.0.0-b9 2016-07-22 11:57:13 -04:00
wilsonianb
07bf106cd3 Handle undefined VARIANT in cmake 2016-07-22 11:56:40 -04:00
Vinnie Falco
225b5a1204 Set version to 1.0.0-b8 2016-07-21 17:03:54 -04:00
Vinnie Falco
054d5de877 Fix rfc2616 Section 4.2 compliance:
basic_headers no longer combines fields with the same name by appending
a comma and concatenating the two values together. This was breaking
certain header fields which expect each value to be distinct, such as
the "Set-Cookie" header.

Now the container behaves more like a multi set with respect to insertion
of multiple values with the same field name. Additional member functions
are provided to provide extra functionality.
2016-07-21 17:03:19 -04:00
Vinnie Falco
5349bcc1c5 Update Example code in documentation 2016-07-21 17:03:18 -04:00
Jack Bond-Preston
17fd2ef2e2 Fix to_string.hpp include path in example code 2016-07-21 17:03:18 -04:00
wilsonianb
e199c0555c Build coverage and usan Travis CI targets with CMake 2016-07-21 17:03:18 -04:00
seelabs
42557b800c Add cmake and clang build to travis 2016-07-21 17:03:18 -04:00
Casey Bodley
ef2330d477 Use Threads::Threads interface library in cmake
in addition to passing ${CMAKE_THREAD_LIBS_INIT} to the linker, this
interface library will also add -pthread to the compile options when
supported

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2016-07-21 17:03:17 -04:00
Nik Bougalis
cb7d0b508d Set version to 0.32.1-rc1 2016-07-14 17:31:32 -07:00
Nik Bougalis
cf72d70eca Clarify owner reserve requirements for trust lines (DOC-456) 2016-07-12 13:35:27 -07:00
seelabs
cf9d65f973 Set version to 0.32.1-b4 2016-07-07 14:45:17 -04:00
seelabs
dd2feb8d1f Use boost::thread_specific_ptr instead of thread_local:
`thread_local` causes deployment problems with CentOS 7
2016-07-07 14:45:15 -04:00
seelabs
d790c3b671 Set version to 0.32.1-b3 2016-07-06 14:09:41 -04:00
seelabs
a56c43f3b3 Rename file to avoid duplicate object file name 2016-07-06 14:08:31 -04:00
seelabs
6f3a35e8be Better unhandled exception handling:
Log thread name and exception type on unhandled exceptions and use a
terminate handler to get a stack trace that includes the function that
thows the exception.
2016-07-06 14:07:57 -04:00
seelabs
c9d8fa9e96 Rename reportUncaughtExceptions to threadEntry 2016-07-06 14:07:57 -04:00
wilsonianb
b72724a4a4 Ignore empty CONFIG_DIR for validators file (RIPD-1221) 2016-07-06 14:06:56 -04:00
Vinnie Falco
f8a1ec0348 Set Beast version to 1.0.0-b7 2016-07-06 13:37:28 -04:00
Vinnie Falco
8375ae647e Add skip_body parser option 2016-07-06 13:36:15 -04:00
Vinnie Falco
69da298aa7 Remove extraneous header file status.hpp 2016-07-06 13:36:15 -04:00
Vinnie Falco
6765507cc4 Add usage example to rfc7230 javadocs 2016-07-06 13:36:14 -04:00
Vinnie Falco
e2c67a1666 Fixes and documentation for teardown and use with SSL:
This solves a problem where clang and gcc locate the deleted
version of teardown and async_teardown instead of the overloaded
version. It requires overloads to add `teardown_tag` into the signature
so that the rules for argument dependent lookup can find the
right function. Improve documentation of teardown requirements

The documentation is updated to clearly explain the need for including
<beast/websocket/ssl.hpp> to use SSL streams with WebSocket.

The default implementations of teardown and async_teardown now use
static_assert to alert the user of improper usage, with comments
providing guidance for resolving the error.
2016-07-06 13:36:14 -04:00
Vinnie Falco
6397025435 Remove deprecated example http::stream wrapper 2016-07-06 13:36:12 -04:00
Vinnie Falco
2a448065da Simplify HTTP crawler example 2016-07-06 13:36:00 -04:00
Vinnie Falco
5c7130e4fd Fixes and simplifications to HTTP example server:
The example HTTP server is updated to provide the correct MIME-type.
It no longer uses the now-deprecated http::stream class, since that
implementation does not provide flow control. A new example async_write
function is provided in the asynchronous server for managing the
lifetime of a message sent asynchronously.

The logging is thread-safe, and a bug causing connections to
malfunction is fixed.
2016-07-06 13:36:00 -04:00
Vinnie Falco
bbad20c66f Qualify some calls:
This fixes a problem where a call to read() is ambiguous because
the argument list contains objects from both boost::asio and
beast::http.

Users invoking read may need to do so fully qualified, by writing:
    beast::http::read(...);
2016-07-06 13:35:57 -04:00
seelabs
e29163e922 Set version to 0.32.1-b2 2016-07-01 17:14:37 -04:00
JoelKatz
2633949d5b Fix access to obsolete reference in PathRequest (RIPD-1219):
* Don't access jvArray if newStatus is replaced
* Remove iLastLevel and use just iLevel
2016-07-01 17:13:16 -04:00
Nik Bougalis
16a38f3979 Catch unhandled exceptions in I/O service threads (RIPD-1166) 2016-07-01 17:13:16 -04:00
Scott Schurr
c4f8b38148 Remove undesirable Journal::Stream constructor:
Constructing a Stream from a Sink would elide specifying the
Severity level of the Stream.  That constructor is removed so
if a Stream is constructed from a Sink the Severity must be
specified.
2016-07-01 17:13:16 -04:00
Scott Schurr
40678e9a78 Make debugLog() return a beast::Journal (RIPD-1209):
Previously, writes using debugLog() tagged every entry with
"TRC:".  Now users of debugLog() must specify the severity
level they want their information logged at.
2016-07-01 17:13:16 -04:00
Miguel Portilla
8f5449dafb Fix BaseHTTPPeer::write strand thread context 2016-07-01 17:13:16 -04:00
Nik Bougalis
8c90ef810a Catch exception from websocketpp 2016-07-01 17:13:16 -04:00
Edward Hennis
177a52473a Improve TxQ edge-case handling logic (RIPD-1200):
* HashRouter: Track relay expiration separately from item lifespan.
** Renamed `swapSet` to `shouldRelay`.
** Cleaned up `HashRouter` member names and removed unused code.
** Remove `SF_RELAYED` flag.
* Fix TxQ edge case replacing dropped transactions.
* Fix TxQ bug in maximumTxnPerAccount check.
2016-07-01 17:13:11 -04:00
Miguel Portilla
a22fa21ce4 Set version to 0.32.1-b1 2016-06-28 14:54:04 -04:00
Miguel Portilla
beb9883705 Remove incompatible OS X switches in Test.py 2016-06-28 14:53:49 -04:00
Edward Hennis
654772a860 Autofill with x-queue-okay uses mult_max fee (RIPD-1194):
* Only relevant if escalated fee is larger than mult_max.
* Will improved queue position, giving tx more chance to succeed.
2016-06-28 14:53:49 -04:00
Edward Hennis
9cc80b7cb6 Test.py exit code accurate in all cases (RIPD-1193):
* Also remove some redundant output.
2016-06-28 14:53:48 -04:00
seelabs
d46c21cc5f Travis install clang from tar file:
The llvm apt repos are offline. This is a workaround to install clang
directly from a tar file.
2016-06-28 14:53:48 -04:00
seelabs
da18f7c053 Fix V2 line-quality bugs 2016-06-28 14:53:47 -04:00
Scott Schurr
0952ebfc1d Add jtx support for trust line quality (RIPD-1094) 2016-06-28 14:53:47 -04:00
Nik Bougalis
a698104c55 Use Rate to represent transfer rates (RIPD-201, RIPD-983):
The Ripple protocol represent transfer rates and trust line
qualities as fractions of one billion. For example, a transfer
rate of 1% is represented as 1010000000.

Previously, such rates where represented either as std::uint32_t
or std::uint64_t. Other, nominally related types, also used an
integral representation and could be unintentionally substituted.

The new Rate class addresses this by providing a simple, type
safe alternative which also helps make the code self-documenting
since arithmetic operations now can be clearly understood to
involve the scaling of an amount by a rate.
2016-06-28 14:53:46 -04:00
Edward Hennis
f060820f3b Sign-and-submit: Test escalated fee autofill (RIPD-1188) 2016-06-28 14:53:46 -04:00
Edward Hennis
119d5c1e47 JTx sign-and-submit mode support 2016-06-28 14:53:45 -04:00
seelabs
2d53ee4051 Add FlowV2 to supportedAmendments 2016-06-28 14:53:45 -04:00
seelabs
66f0caa309 Use protobuf int64 type 2016-06-28 14:53:45 -04:00
Howard Hinnant
d88b63d4c8 Complete SHAMap V2 cutover 2016-06-28 14:53:44 -04:00
Miguel Portilla
63a5522406 Add custom define to disable uncaught exception logging. 2016-06-27 14:35:21 -04:00
seelabs
d22eb0caa2 Set version to 0.32.0 2016-06-24 14:12:17 -04:00
seelabs
138cadc01c Set version to 0.32.0-rc2 2016-06-23 18:29:59 -04:00
seelabs
b590e2c96f Change RIPD-1141 Switchover date 2016-06-23 18:20:15 -04:00
Vinnie Falco
c4c8a620c8 Initialize Writer in prepare:
Writer requires a call to Writer::init to call content_length. This
changes prepare to correctly call init. A consequences is that
prepare can now throw unexpectedly for user-defined writers that
can fail their initialization.
2016-06-20 11:12:26 -04:00
seelabs
5dd8f28290 Set version to 0.32.0-rc1 2016-06-07 13:26:29 -04:00
seelabs
078436212c Resolve warning 2016-06-07 13:26:27 -04:00
Miguel Portilla
10521de2fc Remove obsolete Internal command (RIPD-888) 2016-06-07 13:00:55 -04:00
Edward Hennis
7d11471619 clang: Allow Travis CI builds to succeed 2016-06-07 13:00:53 -04:00
seelabs
434855f500 Fix sendMax path bug 2016-06-07 10:36:13 -04:00
seelabs
11c4ca00d5 Put flowV2 on an amendment only 2016-06-06 20:01:58 -04:00
seelabs
f16d701a2c Add FlowDebugInfo to easily compare diffs between flow V1 and V2 2016-06-06 20:01:53 -04:00
seelabs
34d590d93a Add balanceChanges to PaymentSandbox
fold
2016-06-06 20:01:53 -04:00
seelabs
a87f56448a Prefer paths with more liquidity when qualities are equal 2016-06-06 19:52:25 -04:00
Nik Bougalis
bb61ad2afe Set version to 0.32.0-b18 2016-06-06 07:28:38 -07:00
Nik Bougalis
57b8eb6ccd Merge remote-tracking branch 'upstream/release' into develop 2016-06-06 07:27:30 -07:00
Edward Hennis
7f52249e40 Change fee escalation algorithms (RIPD-1177):
* Minimum factor 256*500, don't multiply by base fee
* Change autofill fee behavior to pay the open ledger fee.
** Experimental options: x-assume-tx - assume <int> more transactions in
   the open queue when computing escalated fee, x-queue-okay - if true
   and escalated fee is over limit, try with load fee.
* Port of 75af4ed.
2016-06-06 07:24:56 -07:00
Nik Bougalis
321e2a94fe Revert "Increase minimum local fee":
The code is no longer necessary, as the fee is now dynamically
adjusted using the new fee escalation logic.

This reverts commit 57625e06ed.
2016-06-06 07:24:56 -07:00
Nik Bougalis
ceb01fb6a3 Correctly handle validations with no LedgerSequence 2016-06-06 07:24:54 -07:00
Nik Bougalis
2206d0ef65 Remove unused functions & cleanup code:
* Remove superseded ECDSA key functions
* Remove unused string helper functions
* Remove beast::FatalError
* Cleanup SSL context generation
* Improve parsing of RPC commands during startup
2016-06-06 07:24:52 -07:00
Nik Bougalis
279c2a6f82 Simplify PeerSet, InboundLedger and TransactionAcquire:
* Use std::mutex instead of std::recursive_mutex
* Remove unnecessary type alias
* Use std::set instead of ripple::hash_map
* Don't reinvent virtual functions
2016-06-06 07:24:50 -07:00
Nik Bougalis
d1200224e2 Update Release Notes 2016-06-06 07:24:48 -07:00
Scott Schurr
fdd1f2ec36 Log uncaught exceptions at the top of threads (RIPD-1166) 2016-06-06 07:10:36 -07:00
Edward Hennis
7295d7f4bb RPC fee command checks open ledger rules (RIPD-1183):
* Matches internal getMetric() to avoid races.
2016-06-06 07:10:36 -07:00
wilsonianb
05d98f4380 Generate master validator public key from master secret 2016-06-06 07:10:36 -07:00
wilsonianb
a187750b32 Include config manifest in server_info admin response (RIPD-1172) 2016-06-03 18:24:11 -07:00
MarkusTeufelberger
55377c12d3 Add build_all script to Builds:
This script will compile rippled, run unit tests and then delete all build
artifacts in many possible configurations (in Linux).

The script will automatically use all available cores to improve compile
speed. All commands are chained via &&, so if any of them fail, the script
will stop at the error.
2016-06-03 16:29:04 -07:00
Vinnie Falco
cd11f3755e Set version to 0.32.0-b17 2016-06-03 18:16:22 -04:00
Vinnie Falco
289c8c9f09 Refactor Server (RIPD-1120):
* Make Handler a template argument
2016-06-03 18:16:18 -04:00
Vinnie Falco
80a9a2bf5d Changes for Beast 1.0.0-b6 2016-06-03 17:54:29 -04:00
Vinnie Falco
1b0b8d7043 Merge subtree Beast 1.0.0-b6:
Merge commit '999e2fa0318b5982736d3ea01a418770ea802671'
2016-06-03 17:05:45 -04:00
Nik Bougalis
b81ec3545f Set version to 0.31.2 2016-06-03 09:05:22 -07:00
Vinnie Falco
999e2fa031 Set Beast version to 1.0.0-b6 2016-06-03 11:49:43 -04:00
Vinnie Falco
c060d08767 rfc7230 compliance, limits, and tests for basic_parser_v1:
New parser set_option function for controlling independent size limits
on headers and body. By default request and response parsers are set up
with reasonable limits to prevent resource exhaustion attacks.

* Parser adheres strictly to rfc7230
* Increased test coverage
* Headers and body maximum size limit options
2016-06-03 11:49:11 -04:00
The Gitter Badger
27ca1b2698 Add Gitter badge 2016-06-03 11:43:56 -04:00
Edward Hennis
75af4ed9b5 Change fee escalation algorithms (RIPD-1177):
* Minimum factor 256*500, don't multiply by base fee
* Change autofill fee behavior to pay the open ledger fee.
** Experimental options: x-assume-tx - assume <int> more transactions in
   the open queue when computing escalated fee, x-queue-okay - if true
   and escalated fee is over limit, try with load fee.
2016-06-02 15:50:17 -07:00
Nik Bougalis
1edc5e5ee0 Revert "Increase minimum local fee":
The code is no longer necessary, as the fee is now dynamically
adjusted using the new fee escalation logic.

This reverts commit 57625e06ed.
2016-06-01 14:52:50 -07:00
Nik Bougalis
28f90d17ac Set version to 0.31.1 2016-05-31 18:10:49 -07:00
Vinnie Falco
50b5dab5df Rename concept to DynamicBuffer (API change):
Conform to the Networking TS by renaming the Streambuf concept
to DynamicBuffer in all places. Values of types meeting the
requirements of DynamicBuffer are renamed to dynabuf.

See:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html#requirements.dynamic_buffers

* Headers renamed
* Formal parameter names renamed
* Template argument types renamed
* Documentation updated
2016-05-28 18:39:18 -04:00
Vinnie Falco
8afdcb9e9f Add message swap members and free functions 2016-05-28 18:39:18 -04:00
Vinnie Falco
7e8f5401b2 Add HTTP field value parsers:
ext_list:
    Iterable container of comma separated extensions, where each extension
    is a token followed an optional list of semicolon delimited parameters,
    with each parameter consisting of a name / value pair. The value can
    be a token or quoted-string.

param_list:
    Iterable container of semicolon delimited parameters, where each parameter
    is a name / value pair. The value can be a token or quoted-string.

token_list
    Iterable container of comma delimited tokens.

* Remove obsolete rfc2616 functions

* Refactor and consolidate case-insensitive string helpers
2016-05-28 18:39:17 -04:00
Vinnie Falco
5a0a47cbae Tidy up use of GENERATING_DOCS 2016-05-28 07:59:34 -04:00
Vinnie Falco
bc2642f423 Use beast::error_code instead of nested types 2016-05-28 07:59:19 -04:00
Vinnie Falco
cd41a0decd Use SFINAE on return values 2016-05-28 07:59:17 -04:00
Vinnie Falco
803d145a5e Add CHANGELOG 2016-05-28 07:59:03 -04:00
Nicholas Dudfield
8303266430 Travis CI updates:
* Run autobahn/valgrind tests when target branch in {master, develop}
* Add coveralls
* Show full stacktrace for usan (RIPD-1150)
* Manual launch of coverage (RIPD-1152)
* Use lldb on Darwin (RIPD-1152)
* Set defaults if not CI (RIPD-1152)
* Add autobahn result parser (RIPD-1147)
2016-05-28 07:16:31 -04:00
seelabs
44e33121c7 Set version to 0.32.0-b16 2016-05-26 12:41:45 -04:00
seelabs
8a6ff4803c Set flowV2 switchover time 2016-05-26 12:41:43 -04:00
Miguel Portilla
abbf4b82b0 Consolidate RPC utility functions (RIPD-947) 2016-05-26 12:41:43 -04:00
Edward Hennis
9752268308 Standalone mode uses temp DB files by default (RIPD-1129):
* If a [database_path] is configured, it will always be used, and tables
  will be upgraded on startup.
2016-05-26 12:31:46 -04:00
Vinnie Falco
1fe983948f Set version to 0.32.0-b15 2016-05-25 15:08:52 -04:00
Nik Bougalis
39829a09cb Update test logging text for change in newlines 2016-05-25 15:05:32 -04:00
Vinnie Falco
3de738429f Changes for beast logging 2016-05-25 15:05:20 -04:00
Vinnie Falco
fa0ef25ffb Merge subtree Beast 1.0.0-b5
Merge commit 'a9e507da9b636d394bb43d6bf8002d013530f57a' into develop
2016-05-25 14:49:07 -04:00
Vinnie Falco
a9e507da9b Set Beast version to 1.0.0-b5 2016-05-25 12:00:25 -04:00
Vinnie Falco
20dfecd2b6 HTTP improvements:
* Increased code coverage

* New Body concepts:
    is_Body
    is_ReadableBody
    is_WritableBody
2016-05-25 12:00:14 -04:00
Vinnie Falco
eb7bd6a2f1 WebSocket ping, fixes, coverage:
* Improve test coverage
* tests for invokable in composed ops

* Update documentation
* Add License badge to README
* Target Windows 7 SDK and later
* Make role_type private
* Remove extra unused masking functions
* Allow stream reuse / reconnect after failure
* Restructure logic of composed operations
* Allow 0 for read_message_max meaning no limit
* Respect keep alive when building HTTP responses
* Check version in upgrade request
* Response with 426 status on unsupported WebSocket version
* Remove unnecessary Sec-WebSocket-Key in HTTP responses
* Rename to mask_buffer_size

* Remove maybe_throw
* Add ping, async_ping, async_on_pong
* Add ping_op
* Add pong_op
* Fix crash in accept_op
* Fix suspend in close_op
* Fix read_frame_op logic
* Fix crash in read_op
* Fix races in echo sync and async echo servers
2016-05-25 12:00:14 -04:00
Vinnie Falco
a570b74038 Fix parser off by one accessing buffer bug:
This fixed a bug where in some cases the parser could dereference
past the end of the caller provided buffer. The unit test is
improved to allocate memory in separate pieces for the split-buffer
matrix test, to give address-sanitizer more to work with.
2016-05-25 12:00:13 -04:00
Vinnie Falco
18c82465b2 Always flush reporter output stream on log 2016-05-25 12:00:13 -04:00
Vinnie Falco
d46db18a31 Update documentation:
* http parse functions
* Parser concept
* More detail on concepts
* Better hyperlinking
2016-05-25 12:00:13 -04:00
Vinnie Falco
5cf4f4a5e2 Fix resume of invokables in websocket composed operations:
When a suspended composed operation is resumed, the operation
now posts to the io_service to get in the correct context. Previously,
invokables resumed in the context of a different completion handler.

* asio_handler_invoke for any resumed invokable will return `true`.
2016-05-25 12:00:12 -04:00
seelabs
e3ee23bcfd Do not run coverage until all jobs have finished:
Sometimes lcov would report negative counts. This may be related to lcov
running while the job it was collecting counts for was also running.
This patch makes two changes: Do not run the coverage build under
gdb, and wait for all jobs to finish before running lcov.
2016-05-25 12:00:12 -04:00
Nik Bougalis
846cbf8c78 Set version to 0.32.0-b14 2016-05-24 12:44:06 -07:00
Miguel Portilla
b14555c742 Improve websocket send performance (RIPD-1158) 2016-05-24 12:40:27 -07:00
Miguel Portilla
154e90b1ca Fix StreambufWSMsg prepare (RIPD-1144).
Return value was set incorrect in some cases.
The buffer was not being prepared.
Add websocket log support.
2016-05-24 12:40:23 -07:00
Nik Bougalis
97c89168f7 Improve exception handling:
* Self-document the code by renaming Throw to Rethrow.
* Write a message to the debug log when we throw or
  rethrow an exception.
2016-05-24 12:37:46 -07:00
Nik Bougalis
a039e7593a Serialize access to the debug journal 2016-05-24 12:37:46 -07:00
Nik Bougalis
acebbf58eb Use only requested amount of aligned_storage 2016-05-24 12:37:46 -07:00
Nik Bougalis
84e3184106 Stricter validation of JSON input (RIPD-1100):
Passing in objects, arrays or non-string objects previously generated
nondescript errors. Improve the error messages returned to clients.

Add unit tests to ensure that incorrect inputs are reliably detected
and generate descriptive and accurate errors.
2016-05-24 12:29:00 -07:00
Scott Schurr
3a1fa4a552 Add "seed" to JSONRPC unit tests (RIPD-1099):
There was a bug in version 0.30.1 where signing with an ed25519
key and a corrupt seed would cause the "sign" and "sign_for"
commands to return an unexpected error.  That bug was fixed in
the 0.31.0 release.

These unit tests verify the fix.  The error message for a corrupt
seed is also slightly improved.
2016-05-24 12:29:00 -07:00
seelabs
1cf518e82c Set version to 0.32.0-b13 2016-05-24 12:36:41 -04:00
Nik Bougalis
951f479a1b Update README.md file (#1656) 2016-05-24 12:36:38 -04:00
Edward Hennis
a6e408510a Update ter documentation:
* terQUEUED txns can be forwarded.
2016-05-24 12:29:23 -04:00
wilsonianb
f2f195f43e Use sys.exit() in Manifests.py to run as program 2016-05-24 12:29:23 -04:00
seelabs
21c563f83a Fix false dry and other payment bugs:
The Owner count could decrease while evaluating a strand, causing
different behavior in forward passes and reverses passes. The fix treats
a decreased owner count like a deferred credit.

In some situations, deferred credits could cause an XRP balance to be
calculated as negative, triggering some asserts.

When XRP is used as a bridge currency, a path could be falsely marked as
dry. This happens when the XRP/XXX offer recursively checks the XXX/XRP
offer and the XXX/XRP offer could not satisfy the request in a single
call.

With a single strand and limit quality the old payment code incorrectly
computed with multiquailty set to true. This could cause the total
quality to go below the requested quality even if there was liquidity
available above the requested quality value.
2016-05-24 12:29:23 -04:00
seelabs
67b1acbf78 Resolve warnings:
Add boost to system path when compiling with clang.
Remove check for null for a var that can never be null.
2016-05-24 12:29:23 -04:00
wilsonianb
4ed6cbdd5b Get quorum and trusted master validator keys from validators.txt:
* Load specified [validators_file] relative to config dir
* Add default [validators_file] to rippled-example.cfg
* Remove [validators] and [validation_quorum] from rippled-example.cfg
* Add [validation_quorum] to validators-example.txt
* Allow validators.txt to be a symlink
* Throw for invalid [validators_file] instead of logging
* Trust own master public key from configured manifest
* Do not load untrusted manifests from database

Trusted validators are loaded from [validators] and [validator_keys]
sections from both rippled.cfg and validators.txt

Quorum is loaded from [validation_quorum] section in validators.txt
only if it is not configured in rippled.cfg
2016-05-24 12:29:23 -04:00
Edward Hennis
7e3dbce3d2 Access base_uint through public members (RIPD-898):
* Updates many (but probably not all) locations that access base_uint
  private storage.
* More calls to access base_uint through members.
* Use an iterator to write Serializer collections.
2016-05-24 10:37:01 -04:00
Edward Hennis
e38f01d1f4 Additional base_uint and stVector256 serialization tests 2016-05-24 10:36:54 -04:00
Nik Bougalis
32a01df0e1 Improve directory creation (RIPD-928):
* Simplify quality describer
* Use keylet instead of naked uint256
2016-05-24 10:29:17 -04:00
Nik Bougalis
814a8258fd Simplify Ledger fetching and construction:
* Remove single-use functions
2016-05-24 10:16:52 -04:00
Nicholas Dudfield
f3b2153ba7 Travis CI updates:
* Use clang 3.8
* Add msan/usan variants
* Build only gcc.coverage and clang.{asan,usan,msan}
* Make sure (correct) llvm-symbolizer is on PATH
2016-05-23 07:30:37 -04:00
Vinnie Falco
651fb45598 Refactor unit_test logging:
The log member is changed to derive from std::ostream. A new
class dstream is derived from std::ostream to support redirection
to the Visual Studio Output Window if a debugger is attached.

Obsolete classes abstract_ostream and its derived variants are
removed.
2016-05-23 07:30:37 -04:00
Vinnie Falco
b5dc8eb9ce Add dstream 2016-05-23 07:30:37 -04:00
Vinnie Falco
b12d1570a7 Set version to 0.32.0-b12 2016-05-12 19:26:21 -04:00
Vinnie Falco
cd38492ceb Changes for Beast 2016-05-12 19:24:35 -04:00
Vinnie Falco
411a12693d Merge subtree Beast 1.0.0-b4:
Merge commit 'c0952e54db7bd519440dc0611db7347cb048296d' into
2016-05-12 19:24:11 -04:00
Vinnie Falco
c0952e54db Set Beast version to 1.0.0-b4 2016-05-12 19:22:59 -04:00
seelabs
09c566a6eb Tidying and fix warnings 2016-05-12 19:22:00 -04:00
seelabs
97b1ac6eab Update CMakeLists for non-Windows platforms 2016-05-12 19:20:57 -04:00
Vinnie Falco
2a8de0fd6b Parser concept, fixes:
A new concept Parser is introduced with routines to read from a stream
into the parser. This solves a problem with the old read interface where
messages must be default constructible and move assignable.

Parser fixes:

* Fix detect invalid reason-phrase octets
* Fix write_eof to set the 'complete' state on success
* Fix consider parse complete if eof received on empty body

WebSocket:

* Increase coverage
2016-05-12 19:20:57 -04:00
Vinnie Falco
8921da91b8 Fixes, fail testing:
Core:

* Test buffer_cat iterator move members

HTTP:

* Fixed yield / resume in writer
* Fixed message serialization with chunked encoding

* Test yield / resume in writer
* Test all conditional branches during message serialization
* Test chunked encoding
* Increase coverage on parse_error
* Add parse_error::general

WebSocket:

* Add error::general
* Increase coverage in error
2016-05-12 19:20:57 -04:00
Vinnie Falco
2b69831f49 New constructors for message:
The message class now behaves like a pair with respect to the construction
of the body and headers. Additional constructors allow construction of
just the body portion from a tuple, leaving the headers default
constructed.

Previous constructors are removed as they were a notational convenience
for assembling HTTP/1 requests and responses. They are not necessary
as this library aims at library writers and not end users.
2016-05-12 19:20:55 -04:00
Howard Hinnant
e9f924ca31 Set version to 0.32.0-b11 2016-05-10 18:16:25 -04:00
Howard Hinnant
595912f82d Remove unused GenericScopedLock and GenericScopedTryLock.
* Update documentation of GenericScopedUnlock.
2016-05-10 17:38:38 -04:00
wilsonianb
ec1ffa2945 Publish all validation fields for signature verification:
Publish own validations to subscription stream
2016-05-10 17:38:38 -04:00
JoelKatz
45ff08b6aa Fix advisory delete affect on history acquisition (RIPD-1112):
* Revert 0efb929898
* Advisory delete setting of 0 (never) does not affect history fetching

The previous commit addressing RIPD-1112 could interact with
advisory delete and cause some history not to be acquired even
configured to acquire. This reverts that commit and provides
a better fix.

The advisory delete setting protects ledgers from being
removed by online delete by exempting them until they are
approved for purge by administrative command. However, not
connecting this with history acquisition could cause new
ledgers in the protected range not to be acquired if the
server loses sync.

With this change, the default advisory delete setting, zero (never)
causes the regular server history setting to control the acquisition
of history. Setting advisory delete to a value greater than zero,
if advisory delete is enabled, will cause the server to fetch and
maintain history back to that point.

This should produce sane behavior across server restarts, losses of
sync, and so on. You can no longer use the "hack" of setting
advisory delete to zero to tell the server to fetch and keep as much
history as possible, but you can achieve the same effect by setting
it to one.
2016-05-10 17:38:38 -04:00
Nik Bougalis
ab9e0c06b8 Log when number of available FDs is insufficient (RIPD-1125) 2016-05-10 17:38:38 -04:00
seelabs
c549c9dff0 Transfer fee changes:
An offer owner pays the transfer fee and only change a transfer fee
when transfering an IOU (as the old code does).
2016-05-10 17:38:37 -04:00
Miguel Portilla
d7a778ce6a Add support for Beast Websockets (RIPD-1097) 2016-05-10 17:38:37 -04:00
Nik Bougalis
f45e279e06 Run CircleCI unit tests under gdb 2016-05-10 17:38:37 -04:00
Nik Bougalis
4d19b8be07 Reject invalid MessageKey in SetAccount handler (RIPD-308, RIPD-990) 2016-05-10 17:38:37 -04:00
Nik Bougalis
2ae68923cc Remove unused legacy endpoint reporting 2016-05-10 17:38:36 -04:00
Nik Bougalis
d197c9780a Remove obsolete sendGetPeers support (RIPD-164) 2016-05-10 17:38:36 -04:00
Nik Bougalis
3d063edb72 Remove unused ECIES routines 2016-05-10 17:38:36 -04:00
Nik Bougalis
f081e80c28 Remove legacy arbitrary precision integer support:
The CBigNum class is a wrapper around OpenSSL's BIGNUM implementation
to make use simpler.

Replacing the implementation with boost::multiprecision helps reduce
the size of the codebase and improves performance (benchmarks show
the new boost-based implementation is ~7x faster).
2016-05-10 17:38:36 -04:00
Howard Hinnant
1c3ee48146 Install SHAMapInnerNodeV2
* Inner node optimization.
2016-05-10 17:38:35 -04:00
MarkusTeufelberger
e499e908d2 CI: get lcov from github
...instead of sourceforge.com (which seems to be in its final breaths)
2016-05-10 17:38:35 -04:00
Vinnie Falco
e0956c36c1 Tidy up core sources:
The core headers are moved to their own directory (but remain in
the same namespace).
2016-05-10 13:41:28 -04:00
Vinnie Falco
2893f8c82a Improvements to code coverage:
More tests and test cases are added to bring up
the percentage of library code covered by tests.
2016-05-10 13:41:27 -04:00
Vinnie Falco
036c3098f3 Tidy up test sources:
Test support classes are moved to beast/extras/test.
2016-05-10 13:41:26 -04:00
seelabs
24612eba4c Fix invalid access after async initiation 2016-05-10 13:41:26 -04:00
Vinnie Falco
6512b8894a Refactor extras:
A new directory extras/ is added, and code not part of the official
public Beast interface is moved there.
2016-05-10 13:41:26 -04:00
Vinnie Falco
1b44c9a3df Improvements to increase code coverage:
* Don't include the test code in coverage reports
* Add test code for missing coverage

Other:

* Improve the README.md
* Fix warning in sha1_context
* Tidy up the examples use of namespaces
* Various fixes to documentation and javadocs
2016-05-10 13:41:25 -04:00
Vinnie Falco
8499cc9767 websocket::stream fail testing 2016-05-10 13:41:25 -04:00
Vinnie Falco
d49faa0f5c Put echo peer logging on toggle, default to off 2016-05-10 13:41:25 -04:00
Vinnie Falco
258cd2cb87 Tidy up declarations and files:
* Adjust formatting
* Fix inline namespace warning in main.cpp
* Fix streambuf op ambiguous variadic constructor
* Rename variables for clarity
2016-05-10 13:41:24 -04:00
Vinnie Falco
7eed701682 Don't perform an extra clear 2016-05-10 13:41:24 -04:00
Vinnie Falco
e62b9dc4c1 Fix SHA1 calculation 2016-05-06 15:23:52 -04:00
Vinnie Falco
36ac1124f4 Set version to 0.32.0-b10 2016-05-06 14:53:33 -04:00
Vinnie Falco
ddb34f1ed1 Update for beast changes:
* Use simplified http::headers
* Use new beast::http::message:
  - Call beast::http::prepare
  - message::method is now a string
* Remove deprecated_http
2016-05-06 14:53:24 -04:00
Nicholas Dudfield
76b761d8e2 Adjustments to code coverage reports:
* src/beast is removed since it has its own coverage and CI integration.
2016-05-06 14:53:16 -04:00
Vinnie Falco
92b3cdb6f8 Merge subtree Beast 1.0.0-b3
Merge commit '47eb7fcc2f30df883b0036d97aac6a0fa90b0e9f'
2016-05-06 14:52:21 -04:00
Vinnie Falco
47eb7fcc2f Set Beast version to 1.0.0-b3 2016-05-06 14:51:41 -04:00
Vinnie Falco
6d8c73cc52 Tidy up tests, build scripts, and documentation:
* Concepts split up into individual files
* Function definitions moved to .ipp files
* Add more tests to fill gaps in coverage
* Fix documentation Xsl
2016-05-06 12:58:10 -04:00
Vinnie Falco
9e5e16c18d Distinguish HTTP/1 messages from general HTTP messages:
The version field is moved into message_v1, all public interfaces
are reworked to identify HTTP/1 wire format operations (suffix "_v1")
versus general HTTP.
2016-05-06 12:58:09 -04:00
Nicholas Dudfield
3af4cf0a28 Travis-CI additions:
* Address sanitizer target
* Code coverage target
* Results for codecov.io
2016-05-06 12:58:09 -04:00
seelabs
d6903efc0c Fix invokable order of invocation:
The call to the final handler in a composed operation MUST be
the last thing performed, as the handler may cause the end of
object lifetimes before it returns.
2016-05-05 11:22:13 -04:00
Vinnie Falco
9390eb016c WebSocket refactoring and tests:
websocket:

* Move echo server to test/
* Fix warnings
* Fix maskgen being uncopyable
* Simplify utf8_checker special member declarations
* Fix stream move assignable when owning the next layer
* Add javadocs for stream special members
* Add stream unit tests
* Move throwing member definitions to the .ipp file
* Use get_lowest_layer in stream declaration
* Perform type checks at each call site instead of constructor
* Demote close_code to a non-class enum:
    Otherwise, application specific close codes
    cannot be assigned without using static_cast.

core:

* Add streambuf_readstream special members tests
* Add move assignment operator to streambuf_readstream
* Add detail/get_lowest_layer trait
* Add static_string tests
* Move static_string from websocket to core
2016-05-05 11:22:13 -04:00
Vinnie Falco
47dc31d8c2 Refactor beast core, http, tests, and examples:
* Fix warnings
* Port cmake scripts to linux
* Add command line options for running test suites
* Add examples to CMakeLists
* Return std::uint64_t from writer::content_length
* basic_parser::write takes asio::const_buffer instead of pointer and size
* Turn message test back on now that it passes
* Rename to http::headers, use std::allocator, remove http_headers
* http::message::method is now a string
* Refactor to_string for ConstBufferSequence
* Remove chunk_encode from the public interface
* Initialize members for default constructed iterators
* Disallow default construction for dependent buffer sequences

Refactor http::message serialization:

* Serialization no longer creates a copy of the
  headers and modifies them
* New function prepare(), sets Connection, Transfer-Encoding,
  Content-Length based on the body attributes and caller options.
  Callers can use prepare() to have the fields set automatically,
  or they can set the fields manually.
* Use write for operator<<
* Tests for serialization
2016-05-05 11:22:12 -04:00
seelabs
f3c3e0bfff Fix destruction of basic_headers elements:
* Add missing call to destroy
* Use traits to destroy the element
2016-05-04 15:12:16 -04:00
Vinnie Falco
fbb5a753b1 Set version to 0.32.0-b9 2016-05-03 13:52:25 -04:00
Miguel Portilla
a1951aff02 Fix buffer to string conversion escaping vertical white space 2016-05-03 13:52:17 -04:00
Nik Bougalis
c28d36b500 Always run unit tests under gdb 2016-05-03 13:52:16 -04:00
JoelKatz
0efb929898 Fix history acquire check (RIPD-1112)
The various history acquire conditions were not combined
properly, resulting in historical ledgers being acquired
in cases where they should not be.
2016-05-03 13:52:16 -04:00
mDuo13
3f84dd8cf9 Add historical release notes through 0.30.1 2016-05-03 13:52:16 -04:00
Howard Hinnant
5d9e53a37d Migrate off of posix_time and most uses of C time_t. 2016-05-03 13:52:15 -04:00
Edward Hennis
2e2a7509cd Multiple transactions per account in TxQ (RIPD-1048):
* Tweak account XRP balance and sequence if needed before preclaim.
* Limit total fees in flight to minimum reserve / account balance.
* LastLedgerSequence must be at least 2 more than the current ledger to be queued.
* Limit 10 transactions per account in the queue at a time.
* Limit queuing multiple transactions after transactions that affect authentication.
* Zero base fee transactions are treated as having a fixed fee level of 256000 instead of infinite.
* Full queue: new txn can only kick out a tx if the fee is higher than that account's average fee.
* Queued tx retry limit prevents indefinitely stuck txns.
* Return escalation factors in server_info and _state when escalated.
* Update documentation.
* Update experimental config to only include the % increase.
* Convert TxQ metric magic numbers to experimental config.
2016-05-03 13:52:15 -04:00
Vinnie Falco
7f97b7bc05 Remove unused directory 2016-05-01 10:55:28 -04:00
Vinnie Falco
073ccf2705 Set version to 0.32.0-b8 2016-04-29 08:51:16 -04:00
Vinnie Falco
6d8b25fdf8 Use new beast::http::message: 2016-04-29 08:51:00 -04:00
Vinnie Falco
22f62af9be Merge subtree Beast 1.0.0-b2:
Merge commit '6c8b4b2f8dde72b01507e4ac7fde4ffea57ebc99'
2016-04-29 05:24:45 -04:00
Vinnie Falco
2a014df60d Merge Beast subtree:
Merge commit 'ba7031cb3b4840c1135515eccd77b002f2ceae9f'
2016-04-29 05:24:18 -04:00
Vinnie Falco
6c8b4b2f8d Set Beast version to 1.0.0-b2 2016-04-29 05:22:59 -04:00
Vinnie Falco
8dad543671 Add CMake scripts 2016-04-29 05:22:59 -04:00
Miguel Portilla
cf0cea38fd Add UTF8_checker unit test 2016-04-29 05:17:59 -04:00
Vinnie Falco
db7b65ed42 Various fixes, warnings:
* Fix sig_wait
* Fix websocket strict aliasing warning
* Fix invokable strict aliasing
* Silence fread warning in examples
* Silence integer conversion warnings
* Build parser-bench as test
* Disable unused variable warning for asio:
    Caused by static variables declared in <boost/asio/error.hpp>
    No known workaround.
2016-04-29 05:17:59 -04:00
Vinnie Falco
61a8f7f078 New header-only basic_parser:
The basic_parser is rewritten to be header-only. The nodejs parser is
removed from the include subtree and placed into the test directory.
Other changes:

* Parser specific error codes in parse_error.hpp
* Add parser-bench performance testing, nodejs vs beast
* New random message generator for fuzz tests
* Test for header-only parser using random message generator
* Augmented some existing message tests to check more cases
2016-04-29 05:17:59 -04:00
Nik Bougalis
e4f0b36f61 Set version to 0.32.0-b7 2016-04-26 18:00:58 -07:00
Nik Bougalis
b7c34d8a96 Improve validation of JSON-formatted ledgers during load 2016-04-26 17:59:29 -07:00
Nik Bougalis
b5dbd7942f Correctly handle connections that fail security checks (RIPD-1114):
* Return error code 400 to the peer along with a descriptive message
* Release the slot and decrement IP connection counters.
2016-04-26 17:59:28 -07:00
wilsonianb
5e5d5fdee4 Make wallet_propose seed generation consistent:
Allow 'seed' or 'seed_hex' if 'key_type' is not specified.
Use legacy passphrase seed generation if 'key_type' is specified.
2016-04-26 17:59:09 -07:00
Miguel Portilla
89c05efe22 Remove UTF8_checker from WSClient unit test. 2016-04-26 17:57:20 -07:00
Edward Hennis
e5bf824c3b Stricter checking on integer json inputs. 2016-04-26 17:57:20 -07:00
Edward Hennis
b509263ef5 Make fee command public (RIPD-1113) 2016-04-26 17:57:19 -07:00
seelabs
13ec104154 Update dependency scripts for Ubuntu 16.04 2016-04-26 17:57:19 -07:00
Vinnie Falco
4cfa1d5cd3 Add streambuf write():
This function performs serialization of a variable list of arguments
to a streambuf. It accepts a wide variety of argument types, using
boost::asio::buffer and boost::lexical_cast where possible.
2016-04-26 18:38:02 -04:00
Nik Bougalis
48396aebd1 Correctly handle validations with no LedgerSequence 2016-04-25 18:04:15 -07:00
Vinnie Falco
7cfdab936c Beast documentation work 2016-04-25 05:08:47 -04:00
Vinnie Falco
010444d77a Add WebSocket tests 2016-04-22 15:01:37 -04:00
Vinnie Falco
1c8c3207fe Set version to 0.32.0-b6 2016-04-22 12:56:22 -04:00
Vinnie Falco
ba7031cb3b Complete examples in beast html documentation 2016-04-22 12:49:02 -04:00
Vinnie Falco
7e88fdd0f1 Complete examples in beast html documentation 2016-04-22 12:49:02 -04:00
Vinnie Falco
af3d721f82 Reduce requirements to C++11 only 2016-04-22 11:59:03 -04:00
Vinnie Falco
e09249abad Reduce requirements to C++11 only 2016-04-22 11:59:03 -04:00
sublimator
0061f03cef Add Travis support 2016-04-22 11:38:11 -04:00
sublimator
53c82d54ea Add Travis support 2016-04-22 11:38:11 -04:00
Vinnie Falco
5602a24b22 Fix basic_streambuf:
prepare() is rewritten to operate more simply; the state of
the container is always consistent even between internal operations.
2016-04-21 15:17:04 -04:00
Vinnie Falco
f4cbb9d8e9 Fix basic_streambuf:
prepare() is rewritten to operate more simply; the state of
the container is always consistent even between internal operations.
2016-04-21 15:17:04 -04:00
Howard Hinnant
df82a734af Fix includes, remove unused type checks 2016-04-21 11:22:06 -04:00
Howard Hinnant
2179ea85f8 Fix includes, remove unused type checks 2016-04-21 11:22:06 -04:00
Vinnie Falco
f5299209d4 Set version to 0.32.0-b5 2016-04-20 13:15:00 -04:00
Vinnie Falco
ca2384f230 beast doc/test work 2016-04-20 12:01:26 -04:00
Vinnie Falco
9c88f76338 beast doc/test work 2016-04-20 12:01:26 -04:00
Vinnie Falco
f07cd8ceb4 Reorganize source files 2016-04-20 12:01:25 -04:00
Vinnie Falco
4469ff4b9a Reorganize source files 2016-04-20 12:01:25 -04:00
Vinnie Falco
54f6f0ceba Beast.WebSocket:
Beast.WebSocket provides developers with a robust WebSocket
implementation built on Boost.Asio with a consistent asynchronous
model using a modern C++ approach.
2016-04-20 12:01:24 -04:00
Vinnie Falco
2cb3834bbb Beast.WebSocket:
Beast.WebSocket provides developers with a robust WebSocket
implementation built on Boost.Asio with a consistent asynchronous
model using a modern C++ approach.
2016-04-20 12:01:24 -04:00
Vinnie Falco
2e302a43aa Add SHA1 algorithm 2016-04-20 12:01:23 -04:00
Vinnie Falco
5e8d028da2 Add SHA1 algorithm 2016-04-20 12:01:23 -04:00
Vinnie Falco
8b62c23ab6 Beast.HTTP:
New classes are introduced to represent HTTP messages and their
associated bodies. The parser interface is reworked to use CRTP,
error codes, and trait checks.

New classes:

* basic_headers

  Models field/value pairs in a HTTP message.

* message

  Models a HTTP message, body behavior defined by template argument.
  Parsed message carries metadata generated during parsing.

* parser

  Produces parsed messages.

* empty_body, string_body, basic_streambuf_body

  Classes used to represent content bodies in various ways.

New functions:

* read, async_read, write, async_write

  Read and write HTTP messages on a socket.

New concepts:

* Body: Represents the HTTP Content-Body.
* Field: A HTTP header field.
* FieldSequence: A forward sequence of fields.
* Reader: Parses a Body from a stream of bytes.
* Writer: Serializes a Body to buffers.

basic_parser changes:

* add write methods which throw exceptions instead
* error_code passed via parameter instead of return value
* fold private member calls into existing callbacks
* basic_parser uses CRTP instead of virtual members
* add documentation on Derived requirements for CRTP

impl/http-parser changes:

* joyent renamed to nodejs to reflect upstream changes
2016-04-20 12:01:15 -04:00
Vinnie Falco
bcbe22c780 Beast.HTTP:
New classes are introduced to represent HTTP messages and their
associated bodies. The parser interface is reworked to use CRTP,
error codes, and trait checks.

New classes:

* basic_headers

  Models field/value pairs in a HTTP message.

* message

  Models a HTTP message, body behavior defined by template argument.
  Parsed message carries metadata generated during parsing.

* parser

  Produces parsed messages.

* empty_body, string_body, basic_streambuf_body

  Classes used to represent content bodies in various ways.

New functions:

* read, async_read, write, async_write

  Read and write HTTP messages on a socket.

New concepts:

* Body: Represents the HTTP Content-Body.
* Field: A HTTP header field.
* FieldSequence: A forward sequence of fields.
* Reader: Parses a Body from a stream of bytes.
* Writer: Serializes a Body to buffers.

basic_parser changes:

* add write methods which throw exceptions instead
* error_code passed via parameter instead of return value
* fold private member calls into existing callbacks
* basic_parser uses CRTP instead of virtual members
* add documentation on Derived requirements for CRTP

impl/http-parser changes:

* joyent renamed to nodejs to reflect upstream changes
2016-04-20 12:01:15 -04:00
Vinnie Falco
3461bafaa2 Beast.Asio:
New classes:

  class async_completion:
    Helper class for implementing asynchronous initiation functions.
    See n3964:
        Library Foundations for Asynchronous Operations, Revision 1
        http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3964.pdf

  class basic_streambuf:
    Meets the requirements of Streambuf.

  class buffered_readstream:
    Buffers a ReadStream with a ConstBufferSequence.

  class consuming_buffers:
    Adapts a BufferSequence which wraps the underlying buffer
    sequence and presents fewer bytes, with the retained bytes
    occurring at the end of the sequence.

  class handler_alloc:
    A C++ Allocator the uses asio handler allocation hooks.

  class static_streambuf:
    An implementation of the Streambuf concept that uses a
    fixed size buffer with size determined at compile-time.

  class streambuf_readstream:
    Buffers a ReadStream with a Streambuf.

New functions:

  append_buffers()
    Returns a new BufferSequence which efficiently concatenates
    two or more buffer sequences together.

  prepare_buffers()
    Shortens a buffer sequence. The bytes excluded are at the
    end of the underlying buffer sequence.

  boost::asio::read_until()
    A copy of boost::asio::read_until overloads, modified to work
    with a beast::asio::basic_streambuf.

Debugging:

  buffers_to_string()

    Convert a ConstBufferSequence to a human readable string
    suitable for diagnostics.

type_check.h:

  Metafunctions for checking asio concepts:
    AsyncReadStream, AsyncWriteStream
    SyncReadStream, SyncWriteStream
    ConstBufferSequence, MutableBufferSequence
    Streambuf
    Handler

Changes:

* All symbols moved up a namespace level.
* streambuf provides all move and copy special members,
  behavior of moved from objects is well-defined.

Fixes:

* Fix basic_streambuf iterator category.
2016-04-20 05:16:38 -04:00
Vinnie Falco
f25b448a49 Beast.Asio:
New classes:

  class async_completion:
    Helper class for implementing asynchronous initiation functions.
    See n3964:
        Library Foundations for Asynchronous Operations, Revision 1
        http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3964.pdf

  class basic_streambuf:
    Meets the requirements of Streambuf.

  class buffered_readstream:
    Buffers a ReadStream with a ConstBufferSequence.

  class consuming_buffers:
    Adapts a BufferSequence which wraps the underlying buffer
    sequence and presents fewer bytes, with the retained bytes
    occurring at the end of the sequence.

  class handler_alloc:
    A C++ Allocator the uses asio handler allocation hooks.

  class static_streambuf:
    An implementation of the Streambuf concept that uses a
    fixed size buffer with size determined at compile-time.

  class streambuf_readstream:
    Buffers a ReadStream with a Streambuf.

New functions:

  append_buffers()
    Returns a new BufferSequence which efficiently concatenates
    two or more buffer sequences together.

  prepare_buffers()
    Shortens a buffer sequence. The bytes excluded are at the
    end of the underlying buffer sequence.

  boost::asio::read_until()
    A copy of boost::asio::read_until overloads, modified to work
    with a beast::asio::basic_streambuf.

Debugging:

  buffers_to_string()

    Convert a ConstBufferSequence to a human readable string
    suitable for diagnostics.

type_check.h:

  Metafunctions for checking asio concepts:
    AsyncReadStream, AsyncWriteStream
    SyncReadStream, SyncWriteStream
    ConstBufferSequence, MutableBufferSequence
    Streambuf
    Handler

Changes:

* All symbols moved up a namespace level.
* streambuf provides all move and copy special members,
  behavior of moved from objects is well-defined.

Fixes:

* Fix basic_streambuf iterator category.
2016-04-20 05:16:38 -04:00
Vinnie Falco
874bbd0b8a C++17 compatibility:
* std::void_t
* std::bool_constant
2016-04-20 05:16:37 -04:00
Vinnie Falco
73ddda4651 C++17 compatibility:
* std::void_t
* std::bool_constant
2016-04-20 05:16:37 -04:00
Vinnie Falco
a433804ee6 unit_test::suite fix warning 2016-04-20 05:16:33 -04:00
Vinnie Falco
08171dad5e unit_test::suite fix warning 2016-04-20 05:16:33 -04:00
Vinnie Falco
f60eeaf08c unit_test::thread fixes:
* Fail on exception in unit_test::thread
* Add unit_test:🧵:detach()
2016-04-20 05:16:32 -04:00
Vinnie Falco
7b3550c46e unit_test::thread fixes:
* Fail on exception in unit_test::thread
* Add unit_test:🧵:detach()
2016-04-20 05:16:32 -04:00
Vinnie Falco
db8fb177b8 Remove unused or obsolete classes and files 2016-04-20 05:16:32 -04:00
Vinnie Falco
203739f7a4 Remove unused or obsolete classes and files 2016-04-20 05:16:32 -04:00
Nik Bougalis
735c341fae Set version to 0.32.0-b4 2016-04-19 17:17:46 -07:00
Edward Hennis
7bb9264c3d Update Travis to Boost 1.60 2016-04-19 17:17:32 -07:00
seelabs
4b8d227922 Better numerical stability for deferred credits:
Before this change, the deferred credits algorithm took the current
balance and subtracted the recorded credits. Conceptually, this is the
same as taking the original balance, adding all the credits,
subtracting all the debits, and subtracting all the credits. The new
algorithm records the original balance and subtracts the debits. This
prevents errors that occur when the original balance and the recorded
credits have large differences in magnitude.

Additionally, XRP credits were recorded incorrectly in the deferred
credits table (the line was between the sender and receiver, rather than
the root account).
2016-04-19 17:17:23 -07:00
Nik Bougalis
4124850481 Merge remote-tracking branch 'upstream/release' into develop 2016-04-19 17:17:08 -07:00
Nik Bougalis
637fee5ecc Set version to 0.31.0 2016-04-19 17:01:48 -07:00
Nik Bougalis
47eb4da080 Check file handle limit on startup (RIPD-442, RIPD-1024):
Calculate the number of file descriptors that are needed during
execution based on the configuration file, with a hard floor
of 1024, adjusting the limit if possible. Refuse to run if enough
fds are not available.

Additionally, allow administrators to limit the number of incoming
connections a configured port will accept. By default no limit is
imposed.
2016-04-19 17:01:33 -07:00
Nik Bougalis
79ca82c078 Improve watchdog start logic 2016-04-19 17:01:25 -07:00
Miguel Portilla
d2a787805a Fix secured Websocket closing.
Websocketpp was incorrectly handling close before or during protocol negotiation. This issue addresses lingering CLOSE_WAIT file descriptors.
2016-04-19 17:01:15 -07:00
David Schwartz
d2071b7ea7 Small Websocket cleanups. 2016-04-19 17:01:09 -07:00
Edward Hennis
61ba1743ef Lock Appveyor CI build to scons 2.5.0
* Workaround for misbehaving 2.5.0.post1, and can be reverted if the next version works better.
2016-04-19 16:53:07 -04:00
Vinnie Falco
d60426a19f .gitignore: VS Update 2 database files 2016-04-19 16:50:44 -04:00
Vinnie Falco
a88bc564ee .gitignore: VS Update 2 database files 2016-04-19 16:50:44 -04:00
Nik Bougalis
a5d5856638 Set version to 0.31.0 2016-04-18 14:23:18 -07:00
Nik Bougalis
4e64e3f1dd Check file handle limit on startup (RIPD-442, RIPD-1024):
Calculate the number of file descriptors that are needed during
execution based on the configuration file, with a hard floor
of 1024, adjusting the limit if possible. Refuse to run if enough
fds are not available.

Additionally, allow administrators to limit the number of incoming
connections a configured port will accept. By default no limit is
imposed.
2016-04-18 14:23:18 -07:00
Nik Bougalis
51850ded05 Improve watchdog start logic 2016-04-18 14:23:17 -07:00
Miguel Portilla
76d7c1c01a Fix secured Websocket closing.
Websocketpp was incorrectly handling close before or during protocol negotiation. This issue addresses lingering CLOSE_WAIT file descriptors.
2016-04-18 14:23:00 -07:00
David Schwartz
dabc5567f7 Small Websocket cleanups. 2016-04-18 14:23:00 -07:00
Nik Bougalis
5c5ee6f763 Set version to 0.31.0-rc2 2016-04-01 14:32:00 -07:00
Nik Bougalis
06bfcad671 Validate the tx_json field in sign_for (RIPD-1100) 2016-04-01 14:31:40 -07:00
Nik Bougalis
73e48e6595 Only object instances can have members (RIPD-1100) 2016-04-01 14:31:34 -07:00
Nik Bougalis
64a005565d Set version to 0.32.0-b3 2016-04-01 10:51:07 -07:00
Nik Bougalis
aa5098866c Remove unused HTTPRequest class 2016-04-01 10:18:07 -07:00
Nik Bougalis
60ff83f280 Validate the tx_json field in sign_for (RIPD-1100) 2016-04-01 10:18:07 -07:00
Nik Bougalis
8dbad62153 Only object instances can have members (RIPD-1100) 2016-04-01 10:18:07 -07:00
Nik Bougalis
4a78b343d9 Annotate Throw functions as noreturn 2016-04-01 10:18:07 -07:00
Nik Bougalis
ab8102f927 Warn if a low-entropy passphrase is used to create a wallet 2016-04-01 10:18:07 -07:00
wilsonianb
fa02409c92 Include amendments in validations subscription 2016-04-01 10:18:07 -07:00
wilsonianb
3a45ef0e65 Test on CircleCI with Boost 1.60:
* Run on Ubuntu 14.04
* Do not build Docker images
2016-04-01 10:18:07 -07:00
Edward Hennis
f2cdeb7d9a Simplify Transaction ordering unit test 2016-03-31 18:46:21 -07:00
JoelKatz
ff7a2c63f2 Remove unused fields
These fields were likely added in error. They are
needed in the corresponding transaction formats but
not in the ledger formats.
2016-03-31 18:44:33 -07:00
Miguel Portilla
efe4c9cae3 Convert throws to Throws. 2016-03-31 18:43:49 -07:00
Miguel Portilla
c37261858a Normalize WSClient JSON output (RIPD-1095):
JSON returned from the WSClient is normalized to resemble JSON-RPC
output, to make unit tests agnostic to the transport used.
2016-03-31 18:43:13 -07:00
seelabs
ef3dc5bb58 Return unfunded and expired offers when flow fails:
Payments do not remove unfunded and expired offers when a payment
fails. However, offer crossing is now using the payment engine and needs
to know what offers were found in a removable state, even on failure.
2016-03-31 18:42:55 -07:00
seelabs
968327d577 Set version to 0.32.0-b2 2016-03-23 15:32:29 -04:00
Vinnie Falco
eedf724ccd Fix streambuf::prepare:
In some edge cases, calling prepare could leave the output
sequence with the incorrect size. This happens when out_end_
is non-zero and the call to prepare should leave out_end_ at 0.
2016-03-23 15:32:26 -04:00
Vinnie Falco
bf3f33f8cb Fix streambuf::prepare:
In some edge cases, calling prepare could leave the output
sequence with the incorrect size. This happens when out_end_
is non-zero and the call to prepare should leave out_end_ at 0.
2016-03-23 15:32:26 -04:00
seelabs
271feb02b8 Add command-line switch to enable asserts 2016-03-23 15:32:26 -04:00
seelabs
f254ebb4ca Improve BookStep precision:
A computation like: `amount_remaining = amount_wanted - amount_got`, can
leave `amount_remaining == 0` without `amount_wanted == amount_got`.
This happens if the amounts differ by less than the smallest
representable value. Fix BookStep to handle this case.
2016-03-23 15:32:26 -04:00
Scott Schurr
c9f1966e08 Remove Env::disable_testing() stub 2016-03-23 15:32:26 -04:00
wilsonianb
095f85f159 List all trusted validator keys under single config section:
Trusted master public keys can be listed under either [validators] or
[validator_keys] config sections. All keys listed under [validators] are
added to permanent trusted keys list regardless of key type.

A master public key is moved from permanent key list to manifest cache
when one of its manifests is received. This allows rippled operators to
list all trusted keys under the [validators] config section.
2016-03-23 15:30:56 -04:00
Howard Hinnant
fdd2740f8b Align mutex and condition_variable 2016-03-23 15:24:15 -04:00
Edward Hennis
8268162cac Fix SHAMapStore test timing consistency 2016-03-18 15:01:32 -04:00
seelabs
30eff2b520 Set version to 0.32.0-b1 2016-03-17 17:36:30 -04:00
wilsonianb
d3962718aa Mark validations as full or partial:
Set kFullFlag in STValidation constructor and include validation
type (full or partial) in subscription stream.
2016-03-17 17:35:39 -04:00
Scott Schurr
388fd1262a Access Journal::Stream using member functions (RIPD-1087):
Replace Journal public data members with member function accessors
in order to make Journal lighter weight.  The change makes a
Journal cheaper to pass by value.

Also add missing stream checks (e.g., calls to JLOG) to avoid
text processing that ultimately will not be stored in the log.
2016-03-17 17:35:06 -04:00
Scott Schurr
7a4bd2278d Access Journal::Stream using member functions (RIPD-1087):
Replace Journal public data members with member function accessors
in order to make Journal lighter weight.  The change makes a
Journal cheaper to pass by value.

Also add missing stream checks (e.g., calls to JLOG) to avoid
text processing that ultimately will not be stored in the log.
2016-03-17 17:35:06 -04:00
Miguel Portilla
b3f5986c83 Charge pathfinding consumers per source currency (RIPD-1019):
The IP address used to perform pathfinding operations is now charged an
additional resource increment for each source currency in the path set.

* NOTE: This charge is a local resource charge, not a transaction fee
  charge.
2016-03-17 17:35:06 -04:00
Miguel Portilla
48d28826d0 Pathfinding cleanup 2016-03-17 17:35:06 -04:00
seelabs
122a5cdf89 Add V2 implementation of payments:
Add a new algorithm for finding the liquidity in a payment path. There
is still a reverse and forward pass, but the forward pass starts at the
limiting step rather than the payment source. This insures the limiting
step is completely consumed rather than potentially leaving a 'dust'
amount in the forward pass.

Each step in a payment is either a book step, a direct step (account to
account step), or an xrp endpoint. Each step in the existing
implementation is a triple, where each element in the triple is either
an account of a book, for a total of eight step types.

Since accounts are considered in pairs, rather than triples, transfer
fees are handled differently. In V1 of payments, in the payment path
A -> gw ->B, if A redeems to gw, and gw issues to B, a transfer fee is
changed. In the new code, a transfer fee is changed even if A issues to
gw.
2016-03-17 17:34:37 -04:00
seelabs
f3e93bbbeb Add operator!= to STPathElement 2016-03-17 17:34:24 -04:00
seelabs
6d2f7e46dd Add IOU/XRP Amount support to Offers 2016-03-17 17:34:08 -04:00
seelabs
3d9589f010 Add IOU and XRP Amounts 2016-03-17 17:31:47 -04:00
Miguel Portilla
906ef761ba Set version to 0.31.0-rc1 2016-03-15 15:12:35 -04:00
Miguel Portilla
6b87a67592 Merge remote-tracking branch 'upstream/release' into develop 2016-03-15 15:10:05 -04:00
Edward Hennis
e16361826e Set version to 0.31.0-b14 2016-03-10 15:02:04 -05:00
Edward Hennis
a327cecee6 Create new Validations columns properly:
* Thread-safe preparation of Validations cleanup query
* Followup to RIPD-870
2016-03-10 14:57:59 -05:00
Vinnie Falco
64d9f7c23e Set version to 0.31.0-b13 2016-03-09 17:48:58 -05:00
Vinnie Falco
4f16a1cee9 Disable SHAMapStore test:
The test depends on an asynchronous operation completing
in a certain time, failing periodically due to timing.
2016-03-09 17:47:37 -05:00
Miguel Portilla
8f83f69325 RPC robust transaction unit test (RIPD-1079) 2016-03-09 16:23:26 -05:00
Miguel Portilla
1d0ca51c88 RPC book unit test (RIPD-1077) 2016-03-09 16:23:25 -05:00
Miguel Portilla
ca70f4fab1 RPC subscribe unit test (RIPD-1076) 2016-03-09 16:23:25 -05:00
Miguel Portilla
72cdf3f555 Improve held transaction submission:
Removed redundant validity checks for held transactions in NetworkOPsImp::apply.
2016-03-09 16:23:24 -05:00
Miguel Portilla
1c68fddad7 Subscribe cleanup 2016-03-09 16:23:24 -05:00
Miguel Portilla
2f3b5f6d0a Log websocket received messages 2016-03-09 16:23:24 -05:00
Miguel Portilla
5663c45a0d Add jtx::json string constructor 2016-03-09 16:23:23 -05:00
Miguel Portilla
172356d299 Add JobCoro destructor completion assert
Make JobCoro non copyable
2016-03-09 16:23:23 -05:00
Vinnie Falco
2323ea4493 Add WSClient 2016-03-09 16:23:23 -05:00
Vinnie Falco
d6a666f4e0 Add wsproto 2016-03-09 16:23:22 -05:00
Vinnie Falco
6e70a6c6f5 Remove 'skip on stop' job attribute 2016-03-09 16:23:22 -05:00
Vinnie Falco
b82be0a9b0 Skip websocket commands on stop 2016-03-09 16:23:22 -05:00
Vinnie Falco
94a47569d6 Check suspended coros for JobQueue stop condition 2016-03-09 16:23:21 -05:00
Vinnie Falco
73df97f2d0 Add JobQueue::rendezvous 2016-03-09 16:23:21 -05:00
Vinnie Falco
e8b75b80c2 Remove obsolete JobQueue thread tracking 2016-03-09 16:23:21 -05:00
Vinnie Falco
f6bec473d5 Reduce the runtime of nudb.recover test 2016-03-09 16:23:20 -05:00
Vinnie Falco
9ab5611c65 Fix destructor race in Job 2016-03-09 16:23:20 -05:00
Vinnie Falco
92391332d7 Reduce the runtime of nudb.recover test 2016-03-09 16:23:20 -05:00
Vinnie Falco
8e26b187be Set TCP_NODELAY on plain, loopback JSONRPC clients 2016-03-09 16:23:20 -05:00
Vinnie Falco
79ce5901f3 Improved write buffering in JSONRPC client 2016-03-09 16:23:19 -05:00
Vinnie Falco
29a4849024 Improve socket writes in BaseHTTPPeer 2016-03-09 16:23:19 -05:00
Nik Bougalis
0a1731c4c9 Assign non-default Rules correctly 2016-03-09 13:48:12 -05:00
Nik Bougalis
5cac2befb0 Avoid deriving a known PublicKey 2016-03-09 13:32:16 -05:00
Vinnie Falco
be60348f8f Update parser for http-parser:
* Remove unused raw_parser
* C++ parser wrapper is updated
2016-03-08 12:01:41 -05:00
Vinnie Falco
e6d4436e9d Update parser for http-parser:
* Remove unused raw_parser
* C++ parser wrapper is updated
2016-03-08 12:01:41 -05:00
Vinnie Falco
c4e9a464e7 Update http-parser subtree:
Source: https://github.com/nodejs/http-parser/commits/master
Commit: fd65b0fbbdb405425a14d0e49f5366667550b1c2
Merge commit '404d58d77c3ecbea68e0bd4fa1e7ff4b7c000fc5' into parser
2016-03-04 12:27:24 -05:00
Vinnie Falco
16b1adfa86 Update http-parser subtree:
Source: https://github.com/nodejs/http-parser/commits/master
Commit: fd65b0fbbdb405425a14d0e49f5366667550b1c2
Merge commit '404d58d77c3ecbea68e0bd4fa1e7ff4b7c000fc5' into parser
2016-03-04 12:27:24 -05:00
Vinnie Falco
404d58d77c Squashed 'src/beast/beast/http/impl/http-parser/' changes from cba704c..fd65b0f
fd65b0f src: refactor method parsing
678a9e2 test: Assert against correct error messages
e2e467b Update http-parser to 2.6.1
4e382f9 readme: fix build status badge
bee4817 Bump version to 2.6.0
777ba4e src: introduce `http_parser_url_init`
483eca7 doc: updated README.md to include multi-threading example
e557b62 src: support LINK/UNLINK (RFC 2068, draft-snell-link-method)
e01811e src: fixed compile error C2143 for vs2012
b36c2a9 header: treat Wine like MinGW
eb5e992 src: support ACL (WebDAV, RFC3744, Section 8.1).
4f69be2 readme: update WebSocket link to RFC6455
b5bcca8 test: `SEARCH`, `PURGE` and `MKCALENDAR`
8b1d652 src: support BIND/REBIND/UNBIND (WebDAV, RFC5842)
7d75dd7 src: support IPv6 Zone ID as per RFC 6874
ab0b162 src: use ARRAY_SIZE instead of sizeof()
39ff097 src: remove double check
f6f436a src: fix invalid memory access in http_parse_host
2896229 make: fix dynamic library extension for OS X
39c2c1e Bump version to 2.5.0
dff604d src: support body in Upgrade requests
d767545 src: callbacks chunk boundaries: header/complete
2872cb7 test: regression test for incomplete/corrupted hdr
5d414fc makefile: add un/install targets
d547f3b url_parser: remove mixed declarations
7ecf775 src: partially revert 959f4cb to fix nread value
7ba3123 header: fix field sizes
53063b7 Add function to initialize http_parser_settings
1b31580 Bump version to 2.4.2
59569f2 src: skip lws between `connection` values
36f107f Bump version to 2.4.1
280af69 src: fix build on MSVC
956c8a0 Bump version to 2.4.0
167dcdf readme: fix typo
3f7ef50 src: annotate with likely/unlikely
265f9d0 bench: add chunked bytes
091ebb8 src: simple Connection header multi-value parsing
959f4cb src: remove reexecute goto
0097de5 src: use memchr() in h_general header value
c6097e1 src: faster general header value loop
2630060 src: less loads in header_value loop
0cb0ee6 src: tighten header field/value loops
6132d1f src: save progress
3f1a05a benchmark: initial
94a55d1 send travis irc notifications to #node-ci
5fd51fd Fix warning on test suite found by Clang Analyzer
0b43367 http_parser: Follow RFC-7230 Sec 3.2.4
11ecb42 Docs fix
7bbb774 doc: add very basic docs for `http_parser_execute`
17ed7de header: typo fix in a comment
5b951d7 src: fix clang warning
1317eec Added support for MKCALENDAR
08a2cc3 very minor spelling/grammar changes in README.md
158dd3b signing the CLA is no longer a requirement
8d9e5db fix typo in README comment
d19e129 contrib: fixed resource leak in parsertrace
24e2d2d Allow HTTP_MAX_HEADER_SIZE to be defined externally
56f7ad0 Bump version to 2.3.0
76f0f16 Fix issues around multi-line headers
5d9c382 Include separating ws when folding header values

git-subtree-dir: src/beast/beast/http/impl/http-parser
git-subtree-split: fd65b0fbbdb405425a14d0e49f5366667550b1c2
2016-03-04 12:26:41 -05:00
Nik Bougalis
6c712ff2df Set version to 0.31.0-b12 2016-03-03 13:16:06 -08:00
Scott Schurr
e3414bf042 Test how beast::is_call_possible<> handles const-ness. 2016-03-03 13:16:02 -08:00
Scott Schurr
308aaa6f78 Test how beast::is_call_possible<> handles const-ness. 2016-03-03 13:16:02 -08:00
Edward Hennis
eb62959216 Clear old Validations during online delete (RIPD-870):
* Add Validations.LedgerSeq and .InitialSeq fields.
* Clean up logging.
* Lower online delete minimum for standalone mode.
* Unit tests of online_delete.
2016-03-03 13:16:02 -08:00
JoelKatz
70d5c4eca7 Avoid passing SHAMapNodeID's to sync filters 2016-03-03 13:10:28 -08:00
Nik Bougalis
a025d365b8 Verify that returned RPC codes are known 2016-03-03 13:05:11 -08:00
Nik Bougalis
89fa10b40b Add description of rpcSENDMAX_MALFORMED error 2016-03-03 13:05:04 -08:00
Nik Bougalis
34e85ccb62 Refactor treatment of Ledger:
All handling of Ledger in shared_ptr is modified to
use a const managed object when the context requires
immutable semantics.
2016-03-03 13:02:13 -08:00
Nik Bougalis
77a4218a9e Set version to 0.31.0-b11 2016-02-29 13:46:37 -05:00
seelabs
93bcdf5318 Chrono fixes for VS Update 2 2016-02-29 13:42:55 -05:00
seelabs
d8ee487c19 Fix underflow issue for XRP:
In some cases multiplying or dividing STAmounts gave incorrect results.

This happens when:

1) The result should be rounded up
2) The STAmount represents a native value (XRP)
3) The rounded up value was less than one drop

In this case, the result was zero, instead of one drop. This could
cause funded offers to be removed as unfunded.
2016-02-29 13:42:55 -05:00
Nik Bougalis
bac303273f Report slow stop times only in release builds 2016-02-29 13:42:55 -05:00
seelabs
3605bf1f60 Chrono fixes for VS Update 2 2016-02-29 13:42:55 -05:00
Scott Schurr
7c2e5f3ac8 Cleanups in beast::Journal:
The Journal API is affected.  There are two uses for the
Journal::Severity enum:

 o It is used to declare a threshold which log messages must meet
   in order to be logged.

 o It declares the current logging level which will be compared
   to the threshold.

Those uses that affect the threshold are now named threshold()
rather than severity() to make the uses easier to distinguish.

Additionally, Journal no longer carries a Severity variable.
All handling of the threshold() is now delegated to the
Journal::Sink.

Sinks are no longer constructed with a default threshold of
kWarning; their threshold must be passed in on construction.
2016-02-29 13:42:55 -05:00
Nik Bougalis
d3b43bfa37 Report slow stop times only in release builds 2016-02-29 13:42:55 -05:00
Nik Bougalis
bf6079797f Simplify logging:
* Construct Logs with the correct severity
* Remove deprecatedLogs and log squelching support
* Use debugJournal for AutoSocket logging
2016-02-29 13:42:55 -05:00
Scott Schurr
6366f62f11 Cleanups in beast::Journal:
The Journal API is affected.  There are two uses for the
Journal::Severity enum:

 o It is used to declare a threshold which log messages must meet
   in order to be logged.

 o It declares the current logging level which will be compared
   to the threshold.

Those uses that affect the threshold are now named threshold()
rather than severity() to make the uses easier to distinguish.

Additionally, Journal no longer carries a Severity variable.
All handling of the threshold() is now delegated to the
Journal::Sink.

Sinks are no longer constructed with a default threshold of
kWarning; their threshold must be passed in on construction.
2016-02-29 13:42:55 -05:00
Nik Bougalis
427c33dbd7 Set version to 0.30.1-hf2 2016-02-26 15:58:09 -08:00
seelabs
675cbb72a6 Fix underflow issue for XRP:
When specifying that a result should be rounded up,
the code rounded up to a value suitable for a non-xrp
amount. When called with an xrp amount, if that rounded-up
value was less than one drop, the code rounded down to zero.

This could cause funded offers to be removed as unfunded.
2016-02-26 15:57:39 -08:00
Vinnie Falco
f846b1a88f Set version to 0.31.0-b10 2016-02-25 13:57:10 -05:00
Vinnie Falco
4bfcd12897 Disable Rules assignment in Ledger::setup:
This is a temporary fix for a thread-unsafe access.
2016-02-25 13:57:04 -05:00
Nik Bougalis
d736232142 Pathfinding cleanup:
* Remove unused code
* Do not use `pointer` and `ref` type aliases
* Misc. cleanups
2016-02-25 13:38:46 -05:00
Scott Schurr
9cb02028ed Increase JLOG usage. 2016-02-25 13:38:45 -05:00
Scott Schurr
0703441ee7 Extend View.cpp unit test coverage. 2016-02-25 13:34:58 -05:00
Vinnie Falco
2c3128d9ba Ignore error on socket shutdown 2016-02-25 13:34:57 -05:00
Vinnie Falco
7837eed21b Disable Rules assignment in Ledger::setup:
This is a temporary fix for a thread-unsafe access.
2016-02-22 14:40:44 -05:00
Nik Bougalis
db092449f9 Set version to 0.31.0-b9 2016-02-18 13:54:15 -08:00
Nik Bougalis
d321b446db Remove tracking by public key in Overlay 2016-02-18 13:54:10 -08:00
Nik Bougalis
78ce7a08c0 Return correct error code during unfunded offer cross (RIPD-1082):
When placing an offer that sells XRP, if the account's balance was
low enough that paying the transaction fee would drop the balance
below the reserve, the transaction should return tecUNFUNDED_OFFER.

The existing implementation returned a tesSUCCESS instead. Although
the net result is the same as far as the transaction's effects are
concerned (the offer is not placed on the books and the transaction
fee is charged) the incorrect result code makes deciphering metadata
difficult.

Add unit test that verifies the new behavior.
2016-02-18 13:54:10 -08:00
Nik Bougalis
15adb73a13 Unit tests for offer creation:
* Test whether offers which either already below the reserve (or
  would go below during processing) can execute if they cross.
* Test the "Fill or Kill" and "Immediate or Cancel" flags.
2016-02-18 13:54:10 -08:00
Scott Schurr
f15cc6c4f6 Document feature RPC command in --help. 2016-02-17 16:33:02 -08:00
seelabs
61e6e5694c Add virtual destructor to Logs 2016-02-17 16:33:02 -08:00
Edward Hennis
66bc0bb424 Copy rules from parent ledger 2016-02-17 16:33:02 -08:00
David Schwartz
25589bacea Ensure fee change transactions have a unique transaction ID
Include the ledger sequence number in fee change transactions to ensure
each such transaction has a unique transaction ID.

We tolerate the absence of a ledger sequence in fee change transactions so
that past fee change transactions remain parseable. Since no live amendment
transactions have yet happened, there is no need to tolerate an absent
ledger sequence there.
2016-02-17 16:33:02 -08:00
JoelKatz
d721d35a2d Update SQLite from 3.8.11.1 to 3.11.0 2016-02-17 16:29:00 -08:00
Vinnie Falco
ba84fc2c77 Set version to 0.31.0-b8 2016-02-11 18:43:06 -05:00
Vinnie Falco
0f7dbc7bc0 Fix Server race conditions:
Class io_list manages children that perform asynchronous
I/O operations. The treatment of close and destruction is
refactored to fix race conditions during exit.
2016-02-11 18:42:34 -05:00
Vinnie Falco
137dd351b8 Refactor Server:
* Remove HTTP namespace
* Rename connection classes
* Mark Server test automatic
* Build server sources in classic
2016-02-11 18:42:33 -05:00
Vinnie Falco
ba38bfad9d Server deadlock fixes 2016-02-11 18:42:33 -05:00
Vinnie Falco
be71e8afa2 Get X-Forwarded-For from Session request 2016-02-11 18:42:33 -05:00
Vinnie Falco
076a061997 Add suite::this_suite 2016-02-11 18:42:32 -05:00
Vinnie Falco
de416adadd Disable WebSocket logging 2016-02-11 18:42:32 -05:00
Vinnie Falco
1fda99ba82 Add suite::this_suite 2016-02-11 18:42:32 -05:00
Vinnie Falco
9f5b58c8ab Fix short_read test race/deadlock 2016-02-11 18:42:31 -05:00
Vinnie Falco
a5131515ec Increase severity on Stoppable logging 2016-02-11 18:42:30 -05:00
Vinnie Falco
8c11d24454 Reinforce Env Application log severity 2016-02-11 18:42:30 -05:00
Vinnie Falco
924b6b663e Increase severity on Stoppable logging 2016-02-11 18:42:30 -05:00
Nik Bougalis
688452d971 Fix OptionalProxy<T> equality comparison 2016-02-11 18:41:42 -05:00
Scott Schurr
2f94e16359 Add SignerList to account_info response (RIPD-1061):
The caller of the account_info RPC command can optionally
specify that they want the account's SignerList returned by
adding the argument:

"signer_lists": "true"

The returned SignerList is in an array.  This leaves us room to
support multiple signer lists on an account in the future without
changing the syntax of the result.

The command-line version of account_info does not support the new
option.
2016-02-11 18:41:03 -05:00
Miguel Portilla
fbf736f169 Improved reporting for delivered_amount:
* Determine tx success from metadata result.
* Report delivered_amount for legacy account_tx queries.
2016-02-11 18:39:12 -05:00
Nik Bougalis
1e92ac3cf5 Set version to 0.31.0-b7 2016-02-08 15:50:12 -08:00
Scott Schurr
acaf91a2f7 Add AccountLinesRPC unit tests. 2016-02-08 15:50:02 -08:00
seelabs
41125a0a34 Support for clang specific boost and protobuf dirs:
Clang does not understand gcc 5's new ABI. On linux systems
that default to the new ABI (such as ubuntu 15.10), building
with clang requires using C++ libraries built with the the old
gcc ABI.

When building with the clang protobuf lib, a common error is to
load the gcc protobuf library at run time. When set, PROTOBUF_ROOT
is added to rpath to make sure the correct lib is loaded.

Adds a script to install clang and download and build boost and
protobuf with boost.
2016-02-08 15:50:02 -08:00
Nik Bougalis
35ed095dbf Cleanup ledger fetching 2016-02-08 15:50:02 -08:00
Nik Bougalis
ce31e26f58 Enable amendment support 2016-02-08 15:47:57 -08:00
Nik Bougalis
2b640532f2 Merge remote-tracking branch 'upstream/release' into develop 2016-02-08 15:45:10 -08:00
Nik Bougalis
94ed5b3a53 Set version to 0.31.0-b6 2016-02-01 21:07:52 -08:00
Scott Schurr
2eaf211e9b Improve error message when signing fails (RIPD-1066):
With the addition of multisigning there are a variety of reasons
a signature may fail.  We now return a more descriptive message
for the reason certain signature checks fail.
2016-02-01 21:07:41 -08:00
Miguel Portilla
ed9f5639a8 Throws, explicits and trivial cleanups 2016-02-01 21:07:41 -08:00
Edward Hennis
8e842b5893 Disable tx sig checking at the Application level:
* Only skip sig checking on the RPC/Websocket interface.
* Used by Env tests which submit unsigned transactions.
2016-02-01 21:07:41 -08:00
JoelKatz
1b378172b6 Clean up some consensus edge cases:
* Ensure sufficient time for proposals before increasing avalanche threshold
* Only validators should count themselves towards 80% needed for consensus
2016-02-01 21:07:41 -08:00
Markus Teufelberger
0dc911c091 Do not show progess bar on npm install on CI
See https://github.com/npm/npm/issues/11283 for more discussion on this.
2016-02-01 21:07:41 -08:00
Vinnie Falco
2be11874e3 Improved unit test logging:
Logging from the Application object in the Env is
redirected to the suite::log, with the severity level
set to error and above.
2016-02-01 21:07:41 -08:00
Nik Bougalis
5ac744ff66 Implement a debug Journal 2016-02-01 21:06:56 -08:00
Nik Bougalis
57d6ab091c Cleanups:
* Use Throw instead of directly throwing an exception
2016-02-01 21:06:56 -08:00
Nik Bougalis
f13668371e Amendment RPC enhancements:
* RPC command to veto/unveto
* Store votes
* Add vote information to JSON
* Add ledger majority information to JSON
* Config section for vetos
2016-02-01 21:06:56 -08:00
Nik Bougalis
c9486863c3 Set version to 0.31.0-b5 2016-01-28 12:05:08 -08:00
Nik Bougalis
e9e0277b7c Improve manifest loading 2016-01-28 12:05:00 -08:00
Miguel Portilla
b69f0356ec Convert PathRequest to use std::chrono (RIPD-1069) 2016-01-28 12:05:00 -08:00
Edward Hennis
4d72fc225a Unit test of RPC ledger_request 2016-01-28 12:04:58 -08:00
Edward Hennis
9786e432f8 ledger_request index must be positive 2016-01-28 12:04:57 -08:00
Vinnie Falco
040d7ebb46 Refactor Env for AbstractClient:
Env is changed to use the AbstractClient interface,
which generalizes the transport for submitting client
requests to the Env server instance.

The JSONRPCClient implementation is added, supporting
a simple, synchronous interface. Env is changed to
use the JSONRPCClient implementation instead of the
built in JSON-RPC client.
2016-01-28 12:04:57 -08:00
Scott Schurr
f9f2b8124d Add cmdLineToJSONRPC (RIPD-1074) 2016-01-28 12:04:55 -08:00
Vinnie Falco
dd5d938aa3 Make ParsedPort public 2016-01-28 12:04:55 -08:00
Edward Hennis
7c82adcc84 Avoid missing node errors on genesis ledger creation 2016-01-28 12:04:53 -08:00
Howard Hinnant
bdb1966573 Remove lvalue overload of SHAMap::addItem:
This overload was mistakenly used, but not needed
in the Ledger logic.  Removing this overload turns
this performance bug into a compile time error.
2016-01-28 09:39:30 -08:00
Howard Hinnant
a1582c610e Consolidate getStack into walkTowardsKey:
*  This removes duplicate functionality.
2016-01-28 09:39:30 -08:00
Howard Hinnant
2f9f217c11 Remove NodeStack:
*  This gets all parts of SHAMap using a single type of stack.
*  This paves the way for more code sharing.
2016-01-28 09:39:30 -08:00
seelabs
278f679bb1 Enable underflow fix after specified date 2016-01-28 09:39:30 -08:00
seelabs
96bc727fcb Enforce no-ripple constraints 2016-01-27 17:05:31 -05:00
seelabs
7d2809eb27 Unit test for enforcing no ripple 2016-01-27 17:05:31 -05:00
Nik Bougalis
9b8133f65f Set version to 0.31.0-b4 2016-01-25 10:35:56 -08:00
Vinnie Falco
77c0236cae Serialize Application start up:
These changes ensure the caller can block until the
Application object can be fully prepared (especially
listening sockets). Solves the problem where tests
can attempt connections before the server sockets are
ready.

* WebSocket blocks until listening
* Application setup blocks until prepared and started
2016-01-25 10:35:54 -08:00
seelabs
07c4262392 Fix websocket deadlock:
A copy of the connection list is made on stop so it
can be iterated without holding the endpoint lock.
2016-01-25 10:35:54 -08:00
Vinnie Falco
10a5421987 Remove unused websocket04 2016-01-25 10:35:54 -08:00
Scott Schurr
06beddcee6 Convert fast manual unit tests to automatic 2016-01-25 10:35:53 -08:00
Scott Schurr
48f0e1f51d CBigNum unit tests 2016-01-25 10:35:53 -08:00
seelabs
6701b7f1d0 Do not destroy objects until all threads exit in Stoppable test
Objects of class `A` could be destroyed before all their member
functions finished running.
2016-01-25 10:35:53 -08:00
Scott Schurr
9063953ee7 Convert fast manual unit tests to automatic 2016-01-25 10:35:53 -08:00
seelabs
7315d9c300 Do not destroy objects until all threads exit in Stoppable test
Objects of class `A` could be destroyed before all their member
functions finished running.
2016-01-25 10:35:53 -08:00
wilsonianb
05c248f297 Include ledger_index in validations subscription stream 2016-01-25 10:35:53 -08:00
wilsonianb
b92a58d11e Allow random seed with specified wallet_propose key_type (RIPD-1030) 2016-01-25 10:35:53 -08:00
Nik Bougalis
767d253593 Improve manifest public key loading 2016-01-25 10:35:53 -08:00
Nik Bougalis
046a8f443d Add unit tests for Endpoint string parsing 2016-01-25 09:07:41 -08:00
Nik Bougalis
78e59191ed Add unit tests for Endpoint string parsing 2016-01-25 09:07:41 -08:00
Nik Bougalis
958b3a1dc0 Simplify Beast:
* Remove asio HTTP classes
 * Remove beast::File, beast::String, beast::Stream, beast::Array,
   beast::MemoryBlock, beast::CriticalSection and other unused
   classes.
 * Remove unused platform-specific code.
 * Reduce Beast custom assert and debugging helper macros.
2016-01-25 09:07:41 -08:00
Nik Bougalis
de4d872b7a Simplify Beast:
* Remove asio HTTP classes
 * Remove beast::File, beast::String, beast::Stream, beast::Array,
   beast::MemoryBlock, beast::CriticalSection and other unused
   classes.
 * Remove unused platform-specific code.
 * Reduce Beast custom assert and debugging helper macros.
2016-01-25 09:07:41 -08:00
Nik Bougalis
921b34eafd Use boost::filesystem instead of beast::File 2016-01-25 09:07:41 -08:00
Nik Bougalis
77955c74bc Use boost::filesystem instead of beast::File 2016-01-25 09:07:41 -08:00
Nik Bougalis
555cd59a59 Cleanups:
* Reduce Beast dependencies
* Remove unnecessary includes
* Don't use deprecated bassert macros
* Don't use beast::String in Json::Value
2016-01-25 09:07:41 -08:00
Edward Hennis
b4f8dc7abf Set version to 0.31.0-b3 2016-01-20 22:46:38 -05:00
Miguel Portilla
14dde47173 Convert STAmount switchovers to tls (RIPD-1068) 2016-01-20 22:46:09 -05:00
Miguel Portilla
4fb6bf3e67 Add coroutine thread specific storage 2016-01-20 22:46:07 -05:00
Miguel Portilla
f73c55a922 Add JobCoro::join 2016-01-20 22:46:06 -05:00
Vinnie Falco
49c86768e6 Peer to peer network simulator:
* Refine the Peer concept
* Remove incremental consensus simulations (coverage)
* Add unit test (coverage)
* Fix BasicNetwork::remove
2016-01-20 22:46:04 -05:00
Scott Schurr
0fca91c6c1 Remove tapENABLE_TESTING. 2016-01-20 22:46:02 -05:00
wilsonianb
749b4adc7c Add manifests subscriptions
Add verify method to manifest script to check signature
2016-01-20 22:46:00 -05:00
Edward Hennis
a67e4ab9f1 Port test/transaction_ordering_test.js to C++ 2016-01-20 22:45:58 -05:00
Edward Hennis
e0b2a26805 TxQ unit tests account for localTx. 2016-01-20 22:45:56 -05:00
Edward Hennis
6c5b23b317 OpenLedger::accept, flip order of modifier and locals:
* And call in to the TxQ if enabled.
2016-01-20 22:45:55 -05:00
Edward Hennis
8da2a724fb Close/advance Env ledgers through RPC interface 2016-01-20 22:45:54 -05:00
Vinnie Falco
d5363d1a85 Submit Env transactions through RPC interface 2016-01-20 22:45:53 -05:00
seelabs
8f74ee1d96 Add sanitize build support 2016-01-20 22:45:52 -05:00
Miguel Portilla
796ee8e3de Path find source currency limits (RIPD-1062) 2016-01-20 22:45:50 -05:00
Nik Bougalis
25f611d0ec Delete unfunded offers in predictable order 2016-01-20 22:45:49 -05:00
Nik Bougalis
08e518af73 Correctly interrogate child process status 2016-01-20 22:36:57 -05:00
Nik Bougalis
27673c1c3f Set version to 0.31.0-b2 2016-01-19 15:43:13 -08:00
Miguel Portilla
3394129894 Remove unused declaration 2016-01-19 15:43:03 -08:00
Nik Bougalis
57625e06ed Increase minimum local fee 2016-01-14 14:11:20 -08:00
Nik Bougalis
d7935192dd Set version to 0.31.0-b1 2016-01-12 18:50:58 -08:00
Howard Hinnant
dd3e170e08 Correct handling of comparators in boost::intrusive:
This facilitates the port of rippled to boost 1.60 while
maintaining compatibility with previous versions of boost.
2016-01-12 18:50:53 -08:00
Howard Hinnant
97d5325468 Correct handling of comparators in boost::intrusive:
This facilitates the port of rippled to boost 1.60 while
maintaining compatibility with previous versions of boost.
2016-01-12 18:50:53 -08:00
Scott Schurr
8433851652 Add SignerList support to account_objects (RIPD-1061):
Return just SignerList objects on an account using the
account_objects RPC command with "type":"signer_list".
2016-01-12 18:45:36 -08:00
Edward Hennis
f7b2b84ece Integration test for transaction ordering. 2016-01-12 18:45:36 -08:00
Edward Hennis
8be67c1766 Speed up out of order transaction processing (RIPD-239):
* After successfully applying a transaction to the open ledger, resubmit any held transactions from the same account.
* All held transactions will continue to be retried after consensus round.
2016-01-12 18:45:36 -08:00
Edward Hennis
4d2e7ed404 LedgerMaster hash lookups return boost::optional. 2016-01-12 18:45:36 -08:00
Edward Hennis
e1018546ac Devirtualize LedgerMaster. 2016-01-12 18:45:36 -08:00
JoelKatz
44fcab1081 SHAMap improvements:
* Run key SHAMap unit tests on both backed and unbacked maps
* Remove obsolete version of SHAMapTree::addRootNode
* Our position maps should be unbacked and immutable
* Minimize hash operations for unbacked SHAMaps
  Not setting the sequence numbers to zero in
  SHAMap::walkSubTree causes extra hashes to be
  performed on subsequent operations
2016-01-12 18:45:36 -08:00
JoelKatz
6dab1657b1 Some pathfinding cleanups and optimizations:
* Reduce the log level of an expensive debug message
* Don't hold the request lock while pathfinding
2016-01-12 18:45:36 -08:00
Nik Bougalis
60ad21ae0d Pathfinding cleanups:
* Return std::pair instead of returning by reference
* Use std algorithms when possible
* Use auto and C++14 lambdas
2016-01-12 18:45:36 -08:00
Nik Bougalis
3974ddd8f7 Remove RippleAddress:
The RippleAddress class was used to represent a number of fundamentally
different types: account public keys, account secret keys, node public
keys, node secret keys, seeds and generators.

The class is replaced by the following types:
* PublicKey for account and node public keys
* SecretKey for account and node private keys
* Generator for generating secp256k1 accounts
* Seed for account, node and generator seeds
2016-01-12 18:45:36 -08:00
Nik Bougalis
8064e82774 Simplify Beast:
* Remove obsolete RNG facilities
* Flatten directory structure
* Use std::recursive_mutex instead of beast::RecursiveMutex
2016-01-12 18:45:35 -08:00
Nik Bougalis
e0af6ec567 Streamlined UNL/validator list:
The new code removes the ability to specify domain names
in the [validators] configuration block, and no longer
supports the [validators_site] option.

More details on the supported configurations are available
under doc/rippled-example.cfg.
2016-01-12 18:45:35 -08:00
Nik Bougalis
0a96f3a249 Simplify Beast:
* Remove obsolete RNG facilities
* Flatten directory structure
* Use std::recursive_mutex instead of beast::RecursiveMutex
2016-01-12 18:45:35 -08:00
Nik Bougalis
40363f96a9 Generic PRNG framework:
* A new, unified interface for generating random numbers and
  filling buffers supporting any engine that fits the
  UniformRandomNumberGenerator concept;
* Automatically seeded replacement for rand using the fast
  xorshift+ PRNG engine;
* A CSPRNG engine that can be used with the new framework
  when needing to to generate cryptographically secure
  randomness.
* Unit test cleanups to work with new engine.
2016-01-12 18:45:35 -08:00
Nik Bougalis
1c9577a1ac Simplify blob encoding 2016-01-12 16:06:18 -08:00
Nik Bougalis
a7a30396be Define NOMINMAX for Windows 2016-01-12 16:06:18 -08:00
Nik Bougalis
fee19390f5 Improve watchdog restart logic:
Stop attempting to restart the server after five consecutive
restarts fail to remain operational for at least ten seconds.
2016-01-12 16:06:18 -08:00
Vinnie Falco
3c6534dc91 Add Stoppable::alertable_sleep_for 2015-12-23 11:58:38 -05:00
Vinnie Falco
95dcdf7ddc Log slow calls to Stoppable::onStop 2015-12-23 11:58:36 -05:00
Howard Hinnant
5423fa25d4 Change the use of integrals to chrono types as appropriate 2015-12-16 11:35:59 -08:00
seelabs
8db0094c73 Remove cxx14 compatibility layer from beast 2015-10-20 09:52:25 -04:00
Nik Bougalis
7373a26333 Use more C++11 features:
* Remove beast::static_initializer
* Remove noexcept VS2013 workaround
* Use [[noreturn]] attribute
2015-10-13 17:15:45 -07:00
Nik Bougalis
d4c4a03e42 Remove beast::SharedData 2015-10-13 17:15:45 -07:00
JoelKatz
206cd3b529 IPAddressV4 fixes:
* Loopback addresses are not publicly routable
* The Internet is not classful
2015-09-28 17:24:04 -07:00
Howard Hinnant
37bf76692d Add override keyword on all derived functions:
This silences warnings on latest clang compiler.
2015-09-18 11:50:33 -04:00
Edward Hennis
26fc812e21 Changes to support VS2015 2015-09-07 14:04:53 -07:00
Vinnie Falco
4e345b1c8a Make suite::log_t public 2015-09-03 13:27:16 -07:00
Tom Ritchford
641ab8ddaf Replace tabs with spaces. 2015-08-04 13:51:02 -07:00
Tom Ritchford
b783e353c4 Remove trailing spaces. 2015-07-31 17:39:03 -07:00
Vinnie Falco
1883b40083 Add except, unexcept in suite 2015-07-29 11:56:01 -04:00
Vinnie Falco
5063839ce5 Remove deprecated abstract_clock::elapsed 2015-07-23 14:23:12 -07:00
Vinnie Falco
95eaf254c9 Tidy up abstract_clock:
* Add clock_type
* Make elapsed() const
2015-07-02 15:09:09 -07:00
Tom Ritchford
874b685a83 Remove duplicate and shadow variables. 2015-06-25 11:17:09 -07:00
Vinnie Falco
ea5fe35b54 Add SHA256 and RIPEMD-160:
* Renamed files to reflect digest family names
* Add SHA256 to SHA2
* Add RIPEMD-160 to RIPEMD
* Reduce duplicated code
2015-06-24 16:28:35 -07:00
Tom Ritchford
3ed1382bbe Fix warning 2015-06-18 13:56:15 -07:00
Vinnie Falco
b3749e4d95 Fix MSVC link 2015-06-15 19:43:02 -07:00
Vinnie Falco
237b5e704f Convert to bool in suite::expect 2015-06-13 21:02:51 -07:00
Vinnie Falco
0fcd3da046 Add is_call_possible 2015-06-13 21:02:50 -07:00
Nik Bougalis
9930b12d9d Beast clean up:
* Remove binding, dispatch handling and exit hooks in favor
  of std alternatives; remove crash-handling infrastructure,
  error message framework, system-specific process handling
  and Objective-C interop helpers.
* Simplify Beast function profiling
* Simplify beast::Time interface
* Simplify beast::String interface
* Simplify beast::File interface
2015-06-13 11:55:03 -07:00
Howard Hinnant
9cdc06ce43 C++14 readiness 2015-06-08 15:38:19 -07:00
Vinnie Falco
7382a0c142 Refactor Serializer, SerialIter, SHAMapItem, NodeObject:
* Make LessThan private
* Make NodeObject::isSame private
* Remove hotTRANSACTION
* Remove some Serializer members
* Remove unused SHAMapItem::getRaw
* Remove unused STLedgerEntry::getOwners
* Remove Serializer constructors
* Remove unused Serializer members
* Remove SerialIter ctor
2015-06-02 12:55:07 -07:00
Vinnie Falco
360e3fb81e Add SHA512 hasher:
* Remove unused SHA256
2015-06-02 12:49:30 -07:00
Vinnie Falco
d11510c34c Update hash_append to latest draft specification 2015-06-02 12:49:30 -07:00
Howard Hinnant
845c9f8a51 Change typedef to using.
Conflicts:
	src/ripple/app/TODO.md
	src/ripple/app/ledger/Ledger.h
	src/ripple/protocol/Protocol.h
2015-05-22 11:09:50 -07:00
Vinnie Falco
9ad5644a8c Reduce thread count in static_initializer test (RIPD-864) 2015-05-20 13:24:13 -07:00
Vinnie Falco
ef1604a729 Tidy up aged container declarations 2015-04-29 14:34:53 -04:00
seelabs
1185103a3d Fix ownership of memory buffers in StatsDCollector (RIPD-756):
* Ownership of buffer memory in StatsDCollector is passed to the
boost::asio callback function. Before this, the memory may have been
freed before async_send was finished with the memory.
2015-04-23 16:47:20 -04:00
seelabs
006020aef2 Support for boost 1.58 2015-04-20 15:55:48 -07:00
Vinnie Falco
22d08b70ec Fix beast::ci_equal 2015-04-20 15:52:16 -07:00
seelabs
ab77e36c70 Add workaround include for Windows.h NOMINMAX 2015-04-10 19:00:45 -07:00
seelabs
a2530de06a Safer macro restoration using MSVC extensions 2015-04-10 19:00:34 -07:00
Vinnie Falco
c7c7084423 NuDB: Enforce pool_thresh minimum of 1:
pool_thresh is prevented from going to zero. This solves a problem when
using callgrind where the CPU is monopolized, causing operations that
should complete quickly to take days.
2015-03-31 21:50:42 -04:00
Howard Hinnant
30121de963 Change several uses of std::list to alternative containers:
*  Performance motivated.
*  Several of these called size() which is O(N) in gcc-4.8.
*  Remove container copy from LedgerConsensusImp::playbackProposals().
*  Addresses RIPD-284.
2015-03-26 12:38:33 -04:00
Howard Hinnant
fbf9c86c5c Remove unnecessary allocation/deallocation from masterLock
* Add make_lock.
* Rename Application::LockType to Application::MutexType:
* Rename getMasterLock to getMasterMutex.
* Use getMasterMutex and make_lock.
* Remove unused code.
2015-03-26 12:38:33 -04:00
Miguel Portilla
233127393f Better admin IP management in .cfg (RIPD-820):
* Deprecate rpc_admin_allow section from configuration file
* New port-specific setting 'admin':
  * Comma-separated list of IP addresses that are allowed administrative
    privileges (subject to username & password authentication if configured)
  * 127.0.0.1 is no longer a default admin IP.
  * 0.0.0.0 may be specified to indicate "any IP" but cannot be combined
    with other IP addresses.
2015-03-18 19:39:30 -07:00
seelabs
4a47ba9b35 Remove beast's sqdb module.
Conflicts:
	src/beast/beast/module/sqdb/api/backend.h
	src/beast/beast/module/sqdb/api/blob.h
	src/beast/beast/module/sqdb/api/into.h
	src/beast/beast/module/sqdb/api/session.h
	src/beast/beast/module/sqdb/api/statement.h
	src/beast/beast/module/sqdb/api/transaction.h
	src/beast/beast/module/sqdb/api/type_conversion_traits.h
	src/beast/beast/module/sqdb/api/use.h
	src/beast/beast/module/sqdb/detail/error_codes.h
	src/beast/beast/module/sqdb/detail/exchange_traits.h
	src/beast/beast/module/sqdb/detail/into_type.h
	src/beast/beast/module/sqdb/detail/once_temp_type.h
	src/beast/beast/module/sqdb/detail/prepare_temp_type.h
	src/beast/beast/module/sqdb/detail/ref_counted_prepare_info.h
	src/beast/beast/module/sqdb/detail/ref_counted_statement.h
	src/beast/beast/module/sqdb/detail/statement_imp.h
	src/beast/beast/module/sqdb/detail/type_conversion.h
	src/beast/beast/module/sqdb/detail/type_ptr.h
	src/beast/beast/module/sqdb/detail/use_type.h
	src/beast/beast/module/sqdb/sqdb.h
2015-03-18 19:37:08 -07:00
seelabs
44932b170f Update sqlite3 to 3.8.8.2. 2015-03-18 19:37:03 -07:00
Vinnie Falco
0675c2b374 Fix gentex usage in nudb 2015-03-09 17:49:37 -04:00
Vinnie Falco
bc5fcbbc88 Tidy up nudb:
* Define WIN32_LEAN_AND_MEAN before including Windows.h
* Remove unnecessary template argument
* Rename to identity
* Make identity default api codec
2015-03-09 17:49:37 -04:00
Vinnie Falco
da21c77ae3 Support per-target ExcludeFromBuild in VSProject 2015-02-26 21:02:35 -05:00
Vinnie Falco
49673c33b4 Use all parts of suite name to detect duplicates 2015-02-24 12:33:59 -05:00
Miguel Portilla
c489975015 Display human readable SSL error codes 2015-02-24 12:33:59 -05:00
Vinnie Falco
9bbcbd546b Fix streambuf bug:
The buffers_type::iterator could hold a pointer to a buffers_type that
was destroyed. This changes buffers_type::iterator to point to the
original streambuf instead, which always outlives the iterator.
2015-02-18 13:31:18 -05:00
Tom Ritchford
7aa6b6b21d Update nudb comments. 2015-02-18 13:31:18 -05:00
Howard Hinnant
0a0795328f Add missing includes. 2015-02-11 20:42:38 -05:00
Vinnie Falco
df89999891 Remove obsolete classes:
Legacy workarounds for Visual Studio non thread-safe initialization
of function local objects with static storage duration are removed:

* Remove LeakChecked
* Remove StaticObject
* Remove SharedSingleton
2015-02-11 20:42:38 -05:00
Vinnie Falco
11c472d701 Speed up some unit tests:
A few of the slowest unit tests are modified to process a smaller data
set size, to reduce the time required to run all unit tests.
2015-02-11 20:14:44 -05:00
Vinnie Falco
e81d35c4db Add elapsed time report for unit test runner:
When unit tests are complete, the longest running tests if any are logged.
2015-02-11 20:14:44 -05:00
Vinnie Falco
33c5f98824 NuDB: Performance improvements (RIPD-793,796):
This introduces changes in nudb to improve speed, reduce database size,
and enhance correctness. The most significant change is to store hashes
rather than entire keys in the key file. The output of the hash function
is reduced to 48 bits, and stored directly in buckets.

The API is also modified to introduce a Codec parameter allowing for
compression and decompression to be supported in the implementation
itself rather than callers.

THe data file no longer contains a salt, as the salt is applicable
only to the key and log files. This allows a data file to have multiple
key files with different salt values. To distinguish physical files
belonging to the same logical database, a new field UID is introduced.
The UID is a 64-bit random value generated once on creation and stored
in all three files.

Buckets are zero filled to the end of each block, this is a security
measure to prevent unintended contents of memory getting stored to
disk. NuDB offers the varint integer type, this is identical to
the varint described by Google.

* Add varint
* Add Codec template argument
* Add "api" convenience traits
* Store hash in buckets
* istream can throw short read errors
* Support std::uint8_t format in streams
* Make file classes part of the public interface
* Remove buffers pessimization, replace with buffer
* Consolidate creation utility functions to the same header
* Zero fill unused areas of buckets on disk
* More coverage and improvements to the recover test
* Fix file read/write to loop until all bytes processed
* Add verify_fast, faster verify for large databases

The database version number is incremented to 2; older databases can
no longer be opened and should be deleted.
2015-02-11 14:41:31 -08:00
Vinnie Falco
b70cd27bda Add general delimiter split() to rfc2616 2015-02-07 15:19:55 -08:00
seelabs
70a27b900a Add missing include:
* Compile previously failed on Mac with clang
2015-02-03 12:56:32 -08:00
Vinnie Falco
18c63a75fb NuDB: limit size of mempool (RIPD-787):
Insert now blocks when the size of the memory pool exceeds a predefined
threshold. This solves the problem where sustained insertions cause the
memory pool to grow without bound.
2015-02-02 17:01:19 -08:00
Vinnie Falco
d9aec19c87 Add missing include 2015-02-02 17:01:18 -08:00
Tom Ritchford
bff5212386 Fix C++ guards in beast. 2015-02-02 17:01:18 -08:00
Vinnie Falco
3c32d0fbc3 Remove buffer_view 2015-01-28 16:34:33 -08:00
Nik Bougalis
4699b17508 Invoke correct deleter 2015-01-23 17:34:30 -08:00
Scott Determan
b8c716a918 VSProject: Handle tuples in CPPDEFINES:
The VSProject generator now handles tuples in addition to strings and
dicts when converting environment variables such as CPPDEFINES.
2015-01-21 15:20:06 -08:00
Vinnie Falco
34f0f9dcf1 Fix Journal::Stream::active to return the correct value 2015-01-21 10:48:32 -08:00
Vinnie Falco
8d1cfaabe7 Add NuDB: A Key/Value Store For Decentralized Systems
NuDB is a high performance key/value database optimized for insert-only
workloads, with these features:

* Low memory footprint
* Values are immutable
* Value sizes from 1 2^48 bytes (281TB)
* All keys are the same size
* Performance independent of growth
* Optimized for concurrent fetch
* Key file can be rebuilt if needed
* Inserts are atomic and consistent
* Data file may be iterated, index rebuilt.
* Key and data files may be on different volumes
* Hardened against algorithmic complexity attacks
* Header-only, nothing to build or link
2015-01-21 10:48:30 -08:00
Nik Bougalis
f78269b02d Ensure that hash_append will never throw
Conflicts:
	src/beast/beast/net/IPAddress.h
2015-01-20 16:45:03 -08:00
Vinnie Falco
e8c07717fc Tidy up container hash functions:
* Add xxhasher
* Move fnv1a, siphash, spookyto hash/
* Move hash_append, uhash to hash/
* Move hash_speed_test to hash/
* Move hash classes to individual header files
* Remove hardened_hash
2015-01-20 16:45:01 -08:00
Vinnie Falco
9ca6740db3 Add rngfill 2015-01-20 16:45:01 -08:00
Vinnie Falco
92c9ebb0d6 Optimize calls to unit_test::suite::expect:
This changes expect and unexpected to receive the reason text as a
template argument, allowing the std::string conversion of char const*
parameters to take place only if the condition evaluates to false. This
cuts all calls to malloc and free on tests that pass.
2015-01-20 16:45:00 -08:00
Vinnie Falco
8432b9e29a Improve streambuf unit test 2015-01-20 16:45:00 -08:00
Vinnie Falco
faf91d6697 Improved support for exceptions in threads spawned by unit tests:
Unit tests that wish to spawn threads for testing concurrency may now do so
by using unit_test::thread as a replacement for std::thread. These threads
propagate unhandled exceptions to the unit test, and work with the abort on
failure feature.
2015-01-12 17:17:09 -05:00
Vinnie Falco
adc69e72df Add xor_shift_engine 2015-01-12 17:17:07 -05:00
Vinnie Falco
c8ae3d1751 Levelize SHAMap:
The SHAMap class is refactored into a separate module where each translation
unit compiles separate without errors. Dependencies on higher level business
logic are removed. SHAMap now depends only on basics, crypto, nodestore,
and protocol:

* Inject NodeStore::Database& to SHAMap
* Move sync filter instances to app/ledger/
* Move shamap to its own module
* Move FullBelowCache to shamap/
* Move private code to shamap/impl/
* Refactor SHAMap treatment of missing node handler
* Inject and use Journal for logging in SHAMap
2015-01-05 11:46:11 -08:00
Vinnie Falco
79f9cc534d Don't leak track StringPairArray 2015-01-05 11:44:15 -08:00
Howard Hinnant
5100eadf12 Fix undefined behavior 2014-12-31 01:55:10 -08:00
Nik Bougalis
1d6721d345 Reduce Beast dependencies by leveraging C++11 features:
* Remove beast::Atomic (RIPD-728):
  * Use std-provided alternatives
  * Eliminate atomic variables where possible

* Cleanup beast::Thread interface:
  * Use std::string instead of beast::String
  * Remove unused functions and parameters

* Remove unused code:
  * beast::ThreadLocalValue
  * beast::ServiceQueue
2014-12-31 01:55:10 -08:00
Vinnie Falco
c01b4e6baa Tidy up usage of std::begin, std::end 2014-12-19 11:55:43 -08:00
Vinnie Falco
16021591b2 Add waitable_executor 2014-12-18 10:26:55 -08:00
Tom Ritchford
a237f9d28c Make beast::detail::chunk_encoded_buffers::to_hex() static 2014-12-01 11:12:59 -05:00
Tom Ritchford
f1eb9d4f89 Remove unused BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES. 2014-12-01 10:56:03 -05:00
Vinnie Falco
1da5e090d5 Fixes to beast::asio::streambuf:
* Fix to_string conversion
* Fix assert on debug invariant checks
* Fix the treatment of the output position when the entire output is committed.
* Add unit test
2014-11-26 12:22:55 -08:00
Vinnie Falco
5cde522d5e Remove unused chrono::time_point stream conversions 2014-11-25 19:19:56 -08:00
Vinnie Falco
8aa4a027bb Template abstract_clock on Clock:
The abstract_clock is now templated on a type meeting the requirements of
the Clock concept. It inherits the nested types of the Clock on which it
is based. This resolves a problem with the original design which broke the
type-safety of time_point from different abstract clocks.
2014-11-25 19:19:56 -08:00
Vinnie Falco
d9c49386cb Add WrappedSink:
This class puts a configured string prefix in front of
each line of Journal output.
2014-11-21 16:46:57 -08:00
Vinnie Falco
cd98d1c1f9 Fix unit_test suite matching with full names 2014-11-21 12:59:32 -08:00
Nik Bougalis
756ac603db Simplify the Beast fatal error reporting framework:
* Reduce interface to a single function which reports error details
* Remove unused functions
2014-11-21 12:59:32 -08:00
Vinnie Falco
933a98b97c Add http::chunk_encode:
This transforms a ConstBufferSequence into a new ConstBufferSequence whose
data is encoded according to the Content transfer encoding rules of RFC2616.
The implementation does not copy any memory.
2014-11-20 20:15:29 -08:00
Donovan Hide
b14751aad9 Use asio signal handling in Application (RIPD-140):
* Use signal_set as cross platform way of handling SIGINT
* Remove polling on main thread for shutdown.
* Add extra logging for received signal.
* Clean up exit handling on error in setup routines.
* Reuse isStopped() from Stoppable for status (could be isStopping() instead).
* Ctrl-C should now work for standalone mode as well on Windows.

Also small fixes to Resolver:
* Add Resolver prefix to logging.
* Fix AsyncObject::removeReference() logic.
* Fix work remaining logic.
2014-11-20 20:15:29 -08:00
Vinnie Falco
f3ebd508d6 Accept generic arguments in ci_equal 2014-11-14 11:10:11 -08:00
Vinnie Falco
5d33ce352e Tidy up split_commas function and use it in Server
Conflicts:
	src/ripple/server/impl/ServerHandlerImp.cpp
2014-11-14 11:10:11 -08:00
Tom Ritchford
c1e070c042 Add missing header needed for boost 1.57 compatibility. 2014-11-10 23:23:53 -05:00
Nik Bougalis
ade26e2c86 Make Stoppable unit tests manual 2014-11-10 23:23:53 -05:00
Nik Bougalis
b668b79341 Remove MurmurHash from Beast 2014-11-10 14:00:54 -08:00
Vinnie Falco
7bc26c5ea0 Add WrappedSink 2014-11-10 12:52:57 -08:00
Vinnie Falco
5ece1fa568 Add operator<< for basic_streambuf 2014-11-10 12:52:43 -08:00
Vinnie Falco
98ea17f7fc Make ci_equal a function 2014-11-10 12:52:42 -08:00
Vinnie Falco
8d25cc3c92 Add rfc2616::parse_csv 2014-11-10 12:52:42 -08:00
Vinnie Falco
15c1055ff4 Fix weak_fn unit test. 2014-11-09 20:27:05 -08:00
Vinnie Falco
c930151a95 Remove obsolete get_pointer 2014-11-08 14:36:44 -08:00
Vinnie Falco
3d7c6f831c Add weak_fn 2014-11-08 14:36:44 -08:00
David Schwartz
ef57b3954c Add missing include needed for std::bad_cast in LexicalCast.h 2014-11-07 15:23:43 -08:00
Vinnie Falco
878070084e Refactor the structure of source files:
* New src/ripple/crypto and src/ripple/protocol directories
* Merged src/ripple/common into src/ripple/basics
* Move resource/api files up a level
* Add headers for "include what you use"
* Normalized include guards
* Renamed to JsonFields.h
* Remove obsolete files
* Remove net.h unity header
* Remove resource.h unity header
* Removed some deprecated unity includes
2014-11-07 13:40:43 -08:00
Vinnie Falco
ef5adc507a Add missing includes. 2014-11-07 12:24:02 -08:00
Vinnie Falco
ea7013a34d Improved beast::http::message:
* Add headers::erase
* Set http::message version with std::pair
* Use std::pair for headers::value_type
2014-11-03 16:40:57 -08:00
Howard Hinnant
eb64a4387d Refactor Stoppable:
The Stoppable interface aids in the enforcement of invariants needed to
successful start and stop a multi-threaded application composed of classes
that depend on each other in complex ways.
* Test written to confirm the current behavior.
* Comments updated to reflect the current behavior.
* Public API reduced to what is currently in use.
* Protected data members made private.
* volatile bool members changed to std::atomic<bool>.
* std::atomic<int> members changed to std::atomic<bool>.
* Name storage uses std::string
2014-10-31 21:29:16 -07:00
Tom Ritchford
68fe1a7c8f New class TempDirectory in UnitTestUtilities. 2014-10-31 21:21:54 -07:00
Vinnie Falco
320897bad6 Add streambuf to_string function 2014-10-31 13:27:38 -07:00
Vinnie Falco
0b692080cd Add shared_ptr<boost::asio::ssl::context> to ssl_bundle:
This gives the ssl_bundle shared ownership of the underlying ssl context
so that ownership of the bundle may be transferred to other classes without
introduce lifetime issues.
2014-10-30 13:55:00 -07:00
Vinnie Falco
eaa021c2e2 Make streambuf buffers_type iterators default constructible 2014-10-30 13:55:00 -07:00
Edward Hennis
d352a744a5 Enable std::array overloads for boost::asio on clang:
* Remove Boost config option from beast config.
* Define from compiler, or let Boost figure out itself.
2014-10-30 13:55:00 -07:00
Vinnie Falco
14b439ce43 Separate beast::http::body from beast::http::message (RIPD-660):
This changes the http::message object to no longer contain a body. It modifies
the parser to store the body in a separate object, or to pass the body data
to a functor. This allows the body to be stored in more flexible ways. For
example, in HTTP responses the body can be generated procedurally instead
of being required to exist entirely in memory at once.
2014-10-29 19:23:53 -07:00
Vinnie Falco
9e4c4ad8e5 Add beast::asio::basic_streambuf (RIPD-661):
This is class whose interface is identical to the boost::asio::basic_streambuf,
and uses an implementation that stores the data in multiple discontiguous
linear buffers, expanding and shrinking as needed.
2014-10-29 19:23:53 -07:00
Vinnie Falco
f5941041d4 Improvements to beast::unit_test framework:
* Some runner member functions are now thread-safe.
* De-inline and tidy up declarations and definitions.
* arg() interface allows command lines to be passed to suites.
2014-10-28 10:41:10 -07:00
Vinnie Falco
9ab4f7bcc6 Update SQLite to 3.8.7:
sha1: 3e23079f062fc06705eead4db108ee429878b532
2014-10-27 11:04:46 -07:00
Nik Bougalis
186ca9c235 Reduce Beast public interface and eliminate unused code:
Beast includes a lot of code for encapsulating cross-platform differences
which are not used or needed by rippled. Additionally, a lot of that code
implements functionality that is available from the standard library.

This moves away from custom implementations of features that the standard
library provides and reduces the number of platform-specific interfaces
andfeatures that Beast makes available.

Highlights include:
* Use std:: instead of beast implementations when possible
* Reduce the use of beast::String in public interfaces
* Remove Windows-specific COM and Registry code
* Reduce the public interface of beast::File
* Reduce the public interface of beast::SystemStats
* Remove unused sysctl/getsysinfo functions
* Remove beast::Logger
2014-10-27 09:55:43 -07:00
Vinnie Falco
fefdb32d08 Remove unused and obsolete classes and tidy up:
Many classes required to support type-erasure of handlers and boost::asio
types are now obsolete, so these classes and files are removed:
HTTPClientType, FixedInputBuffer, PeerRole, socket_wrapper,
client_session, basic_url, abstract_socket, buffer_sequence, memory_buffer,
enable_wait_for_async, shared_handler, wrap_handler, streambuf,
ContentBodyBuffer, SSLContext, completion-handler based handshake detectors.
These structural changes are made:
* Some missing includes added to headers
* asio module directory flattened
2014-10-26 08:40:52 -07:00
Vinnie Falco
3cd391daa6 Return error_code from beast::http::basic_parser:
This changes the HTTP parser interface to return an error_code instead
of a bool. This eliminates the need for the error() member function and
simplifies calling code.
2014-10-22 19:36:28 -07:00
Vinnie Falco
88cb0a1f7a Add beast::asio::ssl_bundle workaround:
This works around the limitation that 1.56 boost::asio::ssl::stream objects
do not support r-value move or construction. It is required when the stream
does not own the socket.
2014-10-22 19:36:28 -07:00
Howard Hinnant
f0f082d3e3 Fix OS X version parsing/error related to OS X 10.10 update. 2014-10-22 19:29:28 -07:00
Vinnie Falco
4a8555b3bf Workaround for MSVC move special members. 2014-10-18 08:16:12 -07:00
Nik Bougalis
9d33e4bd7b Fix URL compositing in Beast (RIPD-636). 2014-10-16 21:44:36 -04:00
Howard Hinnant
75c8d7aa57 Detab beast 2014-10-15 19:39:30 -04:00
Mark Travis
f034b02b92 Disable SSLv3 2014-10-15 19:37:25 -04:00
Howard Hinnant
96a3a34fa4 Gracefully cast from std:🧵:hardware_concurrency 2014-10-14 12:35:17 -04:00
Howard Hinnant
e965b7c0da Guarantee C locale
*  Remove all calls to setlocale to ensure that the global
   locale is always C.

*  Also replace beast::SystemStats::getNumCpus() with
   std:🧵:hardware_concurrency()
2014-10-14 12:35:17 -04:00
Vinnie Falco
7847ac3144 Add pending_handlers 2014-10-10 13:26:08 -07:00
Vinnie Falco
6708311a66 Add missing include in beast header 2014-10-10 13:26:08 -07:00
Tom Ritchford
af7f0b5074 Fix compiler warnings under gcc. 2014-10-01 08:47:55 -07:00
Nik Bougalis
78dfb6bcf5 Allow beast::lexicalCast to parse 'true' & 'false' into a bool 2014-10-01 08:47:54 -07:00
Nik Bougalis
4640079f55 Use namespaces instead of static-only classes 2014-10-01 08:47:52 -07:00
Nik Bougalis
60330da25c Use deleted members to prevent copying in Beast (RIPD-268) 2014-10-01 08:47:52 -07:00
Vinnie Falco
cd97b5beec Remove obsolete SharedArg 2014-09-29 07:18:51 -07:00
Nik Bougalis
30eb927ad4 Templetize and improve beast string-to-integer conversions:
* Properly handle numbers at the edge of precision
* Improve and expand unit test coverage
2014-09-18 12:46:16 -07:00
Vinnie Falco
579b1e6f79 Add missing includes and tidy up 2014-09-16 14:03:50 -07:00
Howard Hinnant
b5384cc964 Fix beast::http::headers move members 2014-09-15 16:03:36 -07:00
Vinnie Falco
146d706343 Add base64 conversions and tests 2014-09-15 14:52:42 -07:00
Vinnie Falco
b69ecfe75c Use transform_iterator in http::headers 2014-09-15 14:52:42 -07:00
Vinnie Falco
02d834e9bb Add is_short_read() 2014-09-12 14:10:33 -07:00
Nik Bougalis
e4ecc762c6 Refactor string-to-integer conversions 2014-09-09 21:38:09 -07:00
sublimator
4f515adafe Normalize sort paths in Visual Studio project generator 2014-09-08 11:17:40 -07:00
Nik Bougalis
4f0a20ec68 Handle whitespace separating an 'ip port' correctly (RIPD-552) 2014-09-04 12:26:27 -07:00
Vinnie Falco
b12676f701 Fix special members for http classes 2014-08-28 12:38:03 -07:00
Vinnie Falco
b968821cc1 HTTP message and parser improvements:
* streambuf wrapper supports rvalue move
* message class holds a complete HTTP message
* body class holds the HTTP content body
* headers class holds RFC-compliant HTTP headers
* basic_parser provides class interface to joyent's http-parser
* parser class parses into a message object
* Remove unused http get client free function
* unit test for parsing malformed messages
2014-08-27 18:06:30 -04:00
Edward Hennis
d81154bf6c Add enable_if_lvalue 2014-08-27 17:10:24 -04:00
Tom Ritchford
c7c9a725b8 Compile git tags now include name and branch. (RIPD-493) 2014-08-22 18:10:17 -04:00
Vinnie Falco
83add658f9 Fix warnings and compile errors 2014-08-20 17:44:00 -07:00
Scott Schurr
cb0e91c602 Use aged containers in Validators module (RIPD-349) 2014-08-20 16:09:51 -07:00
Vinnie Falco
97d87dff09 Fix exception safety in aged containers 2014-08-20 16:09:50 -07:00
Howard Hinnant
fe9d77734f Fix move constructor of aged_unordered_container (RIPD-490) 2014-08-20 16:08:59 -07:00
Tom Ritchford
8b59a2f6b6 Add the git tag to the compile (RIPD-238) 2014-08-08 19:16:33 -07:00
Nik Bougalis
0857c6350d Refactor beast::SemanticVersion (RIPD-199) 2014-08-08 14:57:39 -07:00
Vinnie Falco
bf403a6142 Fix missing return values in headers_t 2014-08-05 16:43:13 -07:00
Vinnie Falco
5b8bb822ba HTTP support improvements:
* RFC2616 compliance
* Case insensitive equality, inequality operators for strings
* Improvements to http::parser
* Tidy up HTTP method enumeration
2014-08-05 13:17:01 -07:00
Scott Schurr
df32f27762 Improvements to aged_containers (RIPD-363)
- Added unit tests for element erase
- Added unit tests for range erase
- Added unit tests for touch
- Added unit tests for iterators and reverse_iterators
- Un-inlined operator== for unordered containers
- Fixed minor problems with ordered_container erase()
- Made ordered_container...
  - erase (reverse_iterator pos) not compile
  - erase (reverse_iterator first, reverse_iterator last) not compile
  - touch (reverse iterator pos) not compile
- Verified that ordered container...
  - insert() already rejects reverse_iterator
  - emplace_hint() already rejects reverse_iterator
- Made set/multiset iterators const

Regarding the set/multiset iterators, see section 1.5 of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf
as pointed out by Vinnie.
2014-08-04 15:25:30 -07:00
evhub
ee570a49d0 More fixes to VSProject sorting algorithm 2014-07-30 08:56:54 -07:00
Howard Hinnant
6a1071ccd3 Tidy up hardened_hash:
* Added siphash as a HashAlgorithm
* Refactored class responsibilities
2014-07-28 09:06:22 -07:00
Vinnie Falco
11d667c830 Fix intrinsic calls in static_initializer 2014-07-28 09:04:41 -07:00
Vinnie Falco
cc11b498cc Add HTTPHeaders::build_map 2014-07-24 20:18:51 -07:00
Vinnie Falco
ca71f18a6d Make bind_handler variadic ctor explicit 2014-07-24 20:18:51 -07:00
Tom Ritchford
6b79b5fc74 Fix build warnings and .gitignore.
* Comment out unused local function for both clang and g++.
* Get rid of numerous Boost warnings for clang.
* Remove some unused local variables.
* Put TAGS into the .gitignore.
2014-07-24 20:18:51 -07:00
Miguel Portilla
df24ae0fbb Workaround gcc bug with static_initializer default ctor 2014-07-17 18:00:43 -07:00
Vinnie Falco
b74cdb2f9d Fix static_initializer: …
* Prevents double construction, invalid access
* Unit test works on MSVC and non MSVC
2014-07-16 16:43:17 -07:00
Vinnie Falco
bb730c00e9 Support stream composition of testcase names 2014-07-15 18:23:01 -07:00
evhub
7a92ac91d0 Fix VSProject item sorting (again)
Conflicts:
	src/beast/site_scons/site_tools/VSProject.py
2014-07-15 12:51:57 -07:00
evhub
e68b989af5 Fix VSProject item sorting:
* Use object type in the sort key
* Call _key recursively over containers
* Prevent passing of iterators to xsorted
* Fix VSProject generator with new sorting
2014-07-14 10:04:07 -07:00
Tom Ritchford
fd27bcd7ee Various tidying:
* Fix unused variable warnings.
* Clean unused items from TER.
* Improvement to LES use of shared_ptr.
2014-07-10 15:11:33 -07:00
Howard Hinnant
f5eb22253d Remove boost::hash_value() overloads.
This addresses https://ripplelabs.atlassian.net/browse/RIPD-102
2014-07-02 15:33:11 -07:00
Vinnie Falco
0c5c901222 Improvements to HTTP parsing 2014-06-26 17:41:12 -07:00
Miguel Portilla
0a93f8db22 Add ASIO strand to StatsDCollector 2014-06-26 12:03:51 -07:00
Vinnie Falco
875f4c87ff Fix bug in VSProject when no LIBPATH in env 2014-06-26 12:03:51 -07:00
Howard Hinnant
7b4c705a3f Improve Journal logging framework:
* Allow partition log levels to be adjusted
* Cleanups
2014-06-23 20:19:53 -07:00
Vinnie Falco
b11e857148 Fix case-sensitivity for NOLOGO in booltable 2014-06-18 17:04:31 -07:00
evhub
0568a40d8d Fixes to VSProject generator:
* Canonical sorting for all platforms
* Fix incorrect path separator
* Filter predefined duplicate environment switches
2014-06-18 16:38:26 -07:00
Vinnie Falco
94dea7c06f Add missing beast includes 2014-06-18 14:07:18 -07:00
evhub
8cd2ba48fc Process switches with regex in VSProject generator:
* Handles "DisableSpecificWarnings" switches
2014-06-16 19:01:28 -07:00
Vinnie Falco
9d819b95bf Fix MSVC workaround in basic_seconds_clock 2014-06-16 16:18:09 -07:00
Vinnie Falco
d26dadd9d8 Add static_initializer 2014-06-16 16:18:09 -07:00
Vinnie Falco
55ca9fb090 Remove ScopedPointer, ContainerDeletePolicy 2014-06-15 18:35:12 -07:00
Vinnie Falco
58ec5d5afe Tidy up includes:
* Replace boost with std equivalents:
  - bind, ref, cref, function, placeholders
* More "include what you use"
* Remove unnecessary includes
2014-06-15 18:26:50 -07:00
Vinnie Falco
c00a976ff6 Add missing beast includes 2014-06-15 12:37:52 -07:00
Miguel Portilla
97a1af43ed Fix VSProject.py extra dot 2014-06-05 17:47:46 -07:00
Vinnie Falco
558b914c64 Reorganize source file hierarchy:
* Rename unity files
* Move some modules to new subdirectories
* Remove obsolete Visual Studio project files
* Remove obsolete coding style and TODO list
2014-06-03 21:43:59 -07:00
Tom Ritchford
dda5fd7390 Check for openSSL version in SConstruct.
* Uses the platform specific openssl binary to detect the current version.
2014-06-02 10:56:21 -07:00
Vinnie Falco
ce8f56727e Make all include paths relative to a root directory:
* Better include path support in the VSProject scons tool.
* Various manual fixes to include paths.
2014-06-02 09:16:28 -07:00
Vinnie Falco
d9755d33d0 Fix VSProject generator item sort 2014-05-28 16:35:02 -07:00
Tom Ritchford
48d4fccc22 Fix a few warnings 2014-05-28 09:28:50 -07:00
Vinnie Falco
bfa8dec6f6 New http::client_session for making requests:
- Add 10,000 popular URL data set for unit tests
2014-05-28 08:31:45 -07:00
Vinnie Falco
6e8230e1fb Add ci_char_traits 2014-05-28 07:30:02 -07:00
Vinnie Falco
587a379b43 Tidy up includes 2014-05-28 07:29:59 -07:00
Vinnie Falco
93021a054b Improved SConstruct:
* Automatic source list built via directory iteration
* Build multiple toolchains and flavors simulaneously:
    - Toolchains: gcc, clang, msvc
    - Flavors: debug, release
* Documentation on aliases (top of the SConstruct file)
2014-05-27 15:23:50 -07:00
Vinnie Falco
bf4dd0cbde Beast SCons tools:
* Add VSProject SCons Builder
* Add Protoc SCons Builder
* Add Beast build utilities python module
2014-05-27 15:23:49 -07:00
Vinnie Falco
4ccc380a7b Tidy up some source filenames:
* Add .unity suffix to mark unity sources
* Fix some relative include paths
2014-05-27 15:23:48 -07:00
Nik Bougalis
9efac86bb7 Convert a unit test to manual 2014-05-26 15:29:48 -07:00
Vinnie Falco
8be17cd60d Use std::string in lexicalCast 2014-05-15 11:11:15 -07:00
Vinnie Falco
caf5f7579e Fix vs2013 availability of make_reverse_iterator 2014-05-13 08:38:02 -07:00
Nik Bougalis
191f4496a7 Implement C++14 std::make_reverse_iterator 2014-05-09 11:45:10 -07:00
Vinnie Falco
df3f5e442d Fix VS2013 warnings about integer conversions 2014-04-17 13:06:06 -07:00
Howard Hinnant
fdfcebd1cb Refactoring of container usage:
* New ripple container aliases use hardened_hash
* Use std::tuple instead of boost::tuple
* Use std unordered containers instead of boost
* Fix Destroyer for new containers
* Fix warning for fnv1a on 32-bit arch
* Validator fixes for new containers
2014-04-16 19:00:13 -07:00
Tom Swirly
8f5b4a6c96 Add CleanCCPFiles.py, a utility for tidying up whitespace 2014-04-15 11:52:02 -07:00
Nik Bougalis
a45b532664 Add beast::tagged_integer:
* Wraps standard integer types to provide type-safety
 * Named types provide self-documenting semantics
 * Catches programmer errors involving mismatched types at compile time
 * Operators restrict mutation to only safe and meaningful operations
2014-04-15 11:48:35 -07:00
Vinnie Falco
c0dfbdc910 Fix Visual Studio 2013 build 2014-04-15 08:13:53 -07:00
Tom Swirly
a4ef993282 New Zero struct implements "compare with zero."
* Zero lets classes efficiently compare with 0, so
  you can use constructors like x < zero or y != zero.
* New BEAST_CONSTEXPR to handle Windows/C++11 differences
  regarding the constexpr specifier.
2014-04-14 11:14:11 -07:00
Tom Ritchford
6b0cec1189 Improvements to scons build for beast.
* Common code extracted to Python directories.
* Read ~/.scons file for scons environment defaults.
* Override scons settings with shell environment variables.
* New "tags" for debug, nodebug, optimize, nooptimize builds.
* Universal platform detection.
* Default value of environment variables set through prefix dictionaries.
* Check for correct Boost value and fail otherwise.
* Extract git describe --tags into a preprocesor variable, -DTIP_BRANCH
* More colors - blue for unchanged defaults, green for changed defaults, red for error.
* Contain unit tests for non-obvious stuff.
* Check to see that boost libraries have been built.
* Right now, we accept both .dylib and .a versions but it'd be easy to enforce .a only.
2014-04-11 10:40:26 -07:00
Howard Hinnant
4a3176e3a0 Force BOOST_ASIO_HAS_STD_ARRAY to 1
for the clang / gcc libstdc++ 4.8 combination
2014-04-03 14:58:28 -04:00
Howard Hinnant
fd9206584f Sub in std::array for boost::array and beast::FixedArray 2014-04-03 14:02:34 -04:00
Howard Hinnant
2ab7cfbf30 New hash_append robust container hash function framework:
* is_contiguous_hashable trait identifies optimizable types
* hash_append() function overloads for basic types:
  - scalars, floats
  - array, C array
  - pair, tuple
  - boost array and tuple (if configured)
* Provided Spooky hash wrapper for use with hash_append
* Use hash_append in hardened_hash and other places
* New Utility meta functions for working with variadics:
  - static_and
  - static_sum
* Added type_name utility function for diagnostics
* hash_metrics suite of functions to evalulate hash functions
* Test suites to measure hash function performance
* Various fixes
2014-03-31 15:49:23 -07:00
Vinnie Falco
6b467e7e59 Move hardened_hash to container/ 2014-03-25 15:22:34 -07:00
Vinnie Falco
d64f5a387c Add beast SConstruct and .travis.yml 2014-03-25 15:22:34 -07:00
Nik Bougalis
cc6cd0bb8f Transactor journal support and small cleanups 2014-03-25 15:22:13 -07:00
Vinnie Falco
3fbff6e620 beast cleanup and tidying:
* Replace custom types with C++11 <cstdint> types
* Fix sqlite integer intos and uses
* Fix String implicit integer constructors
* Escape the enclosing namespace in sqdb
* Replace contract checks with assert
* Make many header files compile independently
* Remove the dependence on beast_core.h in many places
* Remove unused or obsolete classes and functions
* Remove unused or obsolete macros
* Remove unused network functions and files
* Remove unused or obsolete classes:
  - ChildProcess
  - HighResolutionTimer
  - InterProcessLock
  - Throw
  - TrackedMutex
  - UntrackedMutex
  - XmlDocument
  - XmlElement
2014-03-23 15:23:55 -07:00
Vinnie Falco
5eb0aa2765 Add hardened_hash, prevents adversarial inputs 2014-03-22 18:42:18 -07:00
Vinnie Falco
f63cf33118 New unit_test framework:
* Header-only!
* No external dependencies or other beast modules
* Compilation options allow for:
  - Stand-alone application to run a single test suite
  - Stand-alone application to run a set of test suites
  - Global suite of tests inline with the host application
  - Disable test suite generation completely
* Existing tests reworked to use the new classes
2014-03-21 18:00:37 -07:00
Vinnie Falco
0bb6171a85 beast.streams improvements:
* New basic_std_ostream wraps any std::stream.
* New debug_ostream redirects output to debugger if attached.
2014-03-21 07:33:16 -07:00
Vinnie Falco
e92dd73169 Add const_container 2014-03-21 07:33:16 -07:00
Vinnie Falco
2d490f6e6a beast cleaning and tidying:
* Consolidate small modules into one
* Remove Android-specific platform support
* Remove Chrono.h from beast_core.h
* Removed files:
  - TypeTraits.h
  - Utility.h
  - Net.h
  - Asio.h
* Remove zlib support:
  - Remove inline zlib library sources
  - Remove GZIPCompressorOutputStream
  - Remove GZIPDecompressorInputStream
* Remove obsolete or unused classes:
  - AbstractObject
  - BigInteger
  - BufferedInputStream
  - CacheLine
  - CPUMeter
  - DatagramSocket
  - DynamicObject
  - FileLogger
  - FPUFlags
  - Identifier
  - JSON
  - LocalisedStrings
  - MACAddress
  - MemoryAlignment
  - MemoryInputStream
  - MemoryMappedFile
  - NamedValueSet
  - OptionalScopedPointer
  - PerformanceCounter
  - PropertySet
  - ScopedTimeInterval
  - SparseSet
  - SpinDelay
  - StreamingSocket
  - StringPool
  - SubregionStream
  - Uuid
  - Variant
2014-03-21 07:30:50 -07:00
Vinnie Falco
761affacc3 Update to SQLite 3.8.4.1 2014-03-20 19:17:25 -07:00
Howard Hinnant
979c834ee0 Fix and add tests for empty_base_optimization. 2014-03-20 13:47:48 -07:00
Vinnie Falco
aff0ec18b0 Fix error code assignment in raw_parser 2014-03-20 10:43:01 -07:00
Vinnie Falco
d32b91e0de Add abstract streams module:
* New basic_abstract_ostream template for generic output
* New abstract_ostream, common type alias
* basic_scoped_ostream, RAII output to abstract streams
2014-03-19 15:42:20 -07:00
Vinnie Falco
8b659a6d32 Add workaround/noexcept.h for visual studio 2014-03-19 13:42:05 -07:00
Vinnie Falco
18486169b3 Change to the treatment of BeastConfig.h
* No longer requires its own compiler include path
* Includes use relative paths to locate the file
* Client applications include the file themselves
* Inclusion of BeastConfig.h can be controlled via preprocessor directive
2014-03-19 13:42:04 -07:00
Howard Hinnant
d580e7c694 General tidy and refactoring:
* Use nullptr (C++11) instead of NULL.
* Put each file into its own namespace declaration.
* Remove "using namespace" directives and add scope qualifiers.
* Control when beast's implementation of std::equal (C++14) is used.
* Tidy up some const declarations.

Conflicts:
	src/ripple_app/shamap/SHAMapSync.cpp
	src/ripple_app/tx/TransactionEngine.cpp
2014-03-19 13:42:01 -07:00
Vinnie Falco
78ec5ccdbc Restructure joyent message parser (from Node.js):
* New http::raw_parser wrapper
* Convert parser errors to error_code
* Enumeration and strings for parsed HTTP method
* Move parser engine into joyent namespace
* Rename includes to be distinct
2014-03-19 10:41:24 -07:00
Vinnie Falco
d4a5c0353d beast, beast::asio improvements and fixes:
* New maybe_const_t alias for maybe_const
* New asio::enable_wait_for_async for safe cleanup
* New asio::memory_buffer, a managed boost::asio compatible buffer
* shared_handler improvements:
   - Can be 'empty' (no stored handler).
   - Default constructible as 'empty'.
   - Safe evaluation in bool contexts, false==empty
* Fix is_call_possible metafunction:
   - Works on empty argument lists
   - Works with reference types
* Replace SafeBool idiom with C++11 explicit operator bool
* Move IPAddress function definitions to the header
* Move cyclic_iterator to container/
* Remove unused BufferType
* Remove obsolete classes:
   - NamedPipe
   - ReadWriteLock
   - ScopedReadLock
   - ScopedWriteLock
   - LockGuard
2014-03-17 17:40:55 -07:00
Vinnie Falco
6546c30e17 Refactor beast::asio:
* New tools for completion handlers:
  - wrap_handler provides composed io_service execution guarantees.
  - bind_handler rebinds arguments to handlers.
  - shared_handler type-erases any completion handler.
  - buffer_sequence type-erases templated BufferSequences
  - abstract_socket replaces Socket
  - socket_wrapper replaces SocketWrapper
  - beast::asio placeholders to work with std::bind

* Removed obsolete classes and functions
  - AbstractHandler
  - ComposedAsyncOperation
  - SharedFunction
  - SharedHandler
  - SharedHandlerAllocator
  - SharedHandlerPtr
  - SharedHandlerType
  - SocketBase
  - SocketWrapperStrand
  - wrapHandler

* Refactored classes to use new tools
  - abstract_socket
  - socket_wrapper
  - HandshakeDetector
  - HttpClientType

* Miscellanous tidying
  - socket classes moved to beast::asio namespace
  - beast asio files provide their own namespace declaration.
  - Fix IsCallPossible conflicting template parameter name
  - Use <boost/get_pointer.hpp> for C++11 compatibility.
  - Remove extraneous include path from build environment.
2014-03-14 08:03:48 -07:00
Vinnie Falco
5478c540cb Add std::integer_sequence C++14 compatibility 2014-03-14 07:57:20 -07:00
Vinnie Falco
b5d81f4f92 Add beast::buffer_view 2014-03-14 07:57:19 -07:00
Vinnie Falco
2a99a8350f Add C++11 noexcept compatibility for VS2013 2014-03-14 07:57:19 -07:00
JoelKatz
028935a254 Handle unexpected relative paths from __FILE__
Fixes comref#RIPD-133
2014-03-13 16:49:20 -07:00
Vinnie Falco
6df466c692 Update http code for http parser API changes 2014-03-06 21:44:29 -08:00
Vinnie Falco
956f2b98b8 Merge commit '6c0edd2190bfd18ffc523f486367da3724cf98a3' into develop 2014-03-06 21:22:22 -08:00
Howard Hinnant
4e3dcd1ce6 Fix beast::asio failures on OS X.
There are 38 unittest failures on OS X.  These changes address all of
them by adjusting which side of the socket (send or receive) gets
shut down.  In each case, the failure was 'Socket is not connected'.
I've interpreted that to mean that the other thread had already shut
down its side of the connection.
2014-03-04 15:43:33 -08:00
Vinnie Falco
a690690b53 Remove unused TextDiff 2014-03-04 07:23:53 -08:00
Vinnie Falco
b9d0bf8822 Consolidate C++14 compatibility into new headers 2014-03-03 18:51:56 -08:00
Howard Hinnant
bb02112752 Fix clang warnings 2014-02-28 12:15:12 -08:00
Vinnie Falco
8eddcfd3d5 Remove unused classes 2014-02-28 12:03:33 -08:00
Vinnie Falco
78e1995365 New utility classes, containers, C++14 compatibility, and fixes:
* Add std::equal_to <void> (since C++14)
* Add heterogeneous std::equal (since C++14)
* Add maybe_const
* Add empty_base_optimization
* Add is_constructible specialization for pair, tuple
* Add aged associative containers:
  - aged_set, aged_map, aged_multiset, aged_multimap
  - aged_unordered_set, aged_unordered_map,
  - aged_unordered_multiset, aged_unordered_multimap
* Fix auto keyword pass by reference
* Fix basic_seconds_clock warning and project file
2014-02-24 19:25:01 -08:00
Vinnie Falco
c48b9244f2 Remove deprecated IPAddress 2014-02-22 21:33:00 -08:00
Vinnie Falco
e219008320 Make abstract_clock members const 2014-02-14 11:14:09 -08:00
Vinnie Falco
f603ae175b Add chrono APIs to DeadlineTimer 2014-02-12 12:58:20 -08:00
Nicholas Dudfield
f62d034692 Fix clang compile error 2014-02-11 19:13:45 -08:00
Vinnie Falco
deb180cc83 Update beast project file 2014-02-10 19:48:37 -08:00
Vinnie Falco
17b970a387 Fix insight object lifetimes in Group 2014-02-08 10:48:54 -08:00
Vinnie Falco
d060eb498f Improved logging for insight stat packets 2014-02-08 09:33:04 -08:00
NATTSiM
c2bc7e2c30 Fix clang compile 2014-02-07 08:09:15 -08:00
Vinnie Falco
eb5691e8fa Change bassert to always call assert 2014-02-06 14:30:03 -08:00
Vinnie Falco
864b20565b Refactor IP::Endpoint 2014-02-05 15:53:16 -08:00
Vinnie Falco
3e6818b407 Remove obsolete Visual Studio projects 2014-02-05 15:42:28 -08:00
Vinnie Falco
aaced060bf Add basic_seconds_clock, insight::Groups 2014-02-03 22:55:47 -08:00
Vinnie Falco
af77ff3eed Update Visual Studio 2013 project file 2014-02-03 22:36:29 -08:00
Vinnie Falco
98162cec33 Update project build requirements
* Add Visual Studio 2013 project file
* Update SConstruct for boost 1.55.0
2014-02-03 16:58:32 -08:00
Vinnie Falco
048a2d7bc3 Fix PropertyStream overloads 2014-01-29 07:53:27 -08:00
Vinnie Falco
307ad244b0 Use duration in insight::Event, add chrono_util 2014-01-21 10:28:35 -05:00
Vinnie Falco
0c0fa877cf Add ScopedPointer::reset 2014-01-21 10:28:34 -05:00
Vinnie Falco
49bd8ac880 Tidy up for C++11, and fixes:
* Remove shared_ptr legacy support
* Add make_unique support for pre-C++14 environments
* Fix comparison bug in sqdb
* Use std::shared_ptr in a few places
2014-01-17 12:19:04 -05:00
Vinnie Falco
969ea98fd9 Add std::make_unique 2014-01-17 12:19:03 -05:00
NATTSiM
bd0f4b95ae Fix Clang compile and link errors 2014-01-16 17:18:05 -05:00
NATTSiM
dda419ddd6 Improved PropertyStream find and print routines 2014-01-13 21:51:31 -08:00
Vinnie Falco
1f9e2c920c Add io_latency_probe 2014-01-10 22:54:00 -08:00
Nik Bougalis
43f38a240e Don't log StatsD messages to the console by default 2014-01-08 16:57:47 -08:00
Vinnie Falco
705e629001 Add std::hash <std::pair> specialization 2014-01-07 21:14:13 -08:00
Vinnie Falco
edc60e2e01 Fix warning in chrono_io 2014-01-07 21:14:07 -08:00
Vinnie Falco
9f65b26288 Add abstract_clock, manual_clock, chrono_io
Conflicts:
	src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
2014-01-07 17:17:26 -08:00
Vinnie Falco
496b337b27 General refactoring, using C++11
* Remove broken RecycledObjectPool

* Fix beast::ServiceQueue using List instead of LockFreeStack

* Add class semaphore, fixes broken Semaphore

* Move crytpo module files to new beast directory

* Use c++11 replacements for boost and beast types:
  - std::atomic instead of beast::Atomic
  - std::function instead of boost::function, beast::function
  - std::unique_ptr instead of beast::ScopedPointer
  - std::shared_ptr instead of boost::shared_ptr

* Remove modules:
  - beast_db
  - beast_crypto
  - beast_extras

* Remove unnecessary classes:
  - AbstractFifo
  - AddConst
  - AtomicCounter
  - AtomicFlag
  - AtomicPointer
  - AtomicState
  - CopyConst
  - Expression
  - ForwardList
  - IfCond
  - Interval
  - IntrusiveArray
  - KeyvaDB
  - PointerToOther
  - PointerTraits
  - RemoveConst
  - RemoveConstVolatile
  - RemoveReference
  - RemoveVolatile
  - SharedObjectArray
  - SingleThreadedSharedObject
  - SophiaDB factory
  - SortedSet
  - WeakReference
  - beast::unique_ptr
2014-01-07 15:57:45 -08:00
Vinnie Falco
3a895ccfaa Reduce StatsDCollector log verbosity 2014-01-02 19:32:27 -08:00
NATTSiM
eb19343f91 Fix clang compile 2013-12-27 17:46:51 -08:00
Vinnie Falco
893b2d4587 Add AbstractObject, cyclic_iterator, Journal improvements 2013-12-27 16:47:43 -08:00
Nik Bougalis
370d98a858 Add reference counting to AsyncObject 2013-12-19 14:39:26 -08:00
Vinnie Falco
d11983ae32 Add Beast.Insight stats collection module 2013-12-16 12:22:25 -08:00
Vinnie Falco
42692abd1c Add stl module for c++11 compatibility classes 2013-12-16 11:35:21 -08:00
Vinnie Falco
d1335a6efd Make AbstractObject unit test manual 2013-12-06 09:57:03 -08:00
Vinnie Falco
61cfa6e37e Add double conversion for PropertyStream map items 2013-11-30 17:56:25 -08:00
Vinnie Falco
f7aa4f9593 Refactor some Journal::Sink members 2013-11-30 17:32:50 -08:00
Vinnie Falco
1dfd9e3c10 IPAddress fixes and algorithm comparison functors 2013-11-30 09:21:46 -08:00
Vinnie Falco
2f656e09c6 Refactor and fix some object arithmetic comparisons 2013-11-30 06:28:29 -08:00
Vinnie Falco
6c9d88bd6d Fix missing assert in UnitTest runner 2013-11-30 01:42:37 -08:00
Vinnie Falco
045e38314a Add AbstractObject 2013-11-30 01:42:37 -08:00
Vinnie Falco
d346e6645a Tidy doc comments 2013-11-29 23:44:36 -08:00
JoelKatz
760f51910f Add BEAST_SQLITE_FORCE_NDEBUG option 2013-11-26 21:56:17 -08:00
Vinnie Falco
9e5619ce99 Fix Workers thread name 2013-11-22 15:51:20 -08:00
Vinnie Falco
b38dd98e71 Journal API improvements 2013-11-15 12:30:01 -08:00
Vinnie Falco
71db1dfa06 Fix severity check on ~ScopedStream 2013-11-15 11:29:45 -08:00
Patrick Dehne
08aa415c66 Beast improvements and vflib compatibility module work
* Add CallQueue vflib compatibility class
* Use run instead of run_one
* Merge BindableServiceQueue into CallQueue
* Take BEAST_VARIADIC_MAX into account
* Fix license headers as suggested by Vinnie
* Remove obsolete comment
* Add ManualServiceQueue
* Add ManualServiceQueue to beast_vflib include
* Move static unit test variables of header only classes to module cpp
* Remove no longer used mutex member
* _VARIADIC_MAX maxes out at 10
* Correctly apply BEAST_VARIADIC_MAX
* Merge BindableServiceQueue into CallQueue
* New GuiServiceQueue and its JUCE dependency
* Fix leftover merge errors
* Fix CallQueue unit test
* Don't use bassert for better CI support
2013-11-07 09:42:37 -08:00
Vinnie Falco
bf87614fa6 Fix warning 2013-11-05 03:23:15 -08:00
Vinnie Falco
55045b5fe9 Improve hasher for IPAddress 2013-11-05 03:15:09 -08:00
Vinnie Falco
56c5c2ebaa Fix compile error 2013-11-05 03:09:39 -08:00
Vinnie Falco
a2c574fa15 Set boolalpha for Journal::ScopedStream 2013-11-05 03:09:39 -08:00
Vinnie Falco
b560f5a474 Add ostream support for PropertyStream items 2013-11-05 03:09:39 -08:00
Vinnie Falco
206169476f Add to_string for asio endpoints 2013-11-05 03:09:39 -08:00
Nicholas Dudfield
30648a1819 Fix IPAddress::V4::Proxy 2013-11-05 03:02:20 -08:00
Vinnie Falco
00575cf847 Stoppable, make stop() require call to start() 2013-11-01 13:31:38 -07:00
Vinnie Falco
ef94f42b62 Improve URL string conversions and ostream support 2013-10-31 08:10:06 -07:00
Vinnie Falco
4ed36da458 Fix error parameter in HTTPClient logic 2013-10-31 08:10:06 -07:00
Vinnie Falco
68b5966fef Move ServiceQueueBase out of detail namespace 2013-10-31 08:10:05 -07:00
Vinnie Falco
7bae496257 Add hash function to URL 2013-10-31 08:10:05 -07:00
Vinnie Falco
dc591f8943 Move MurmurHash to beast 2013-10-31 08:10:04 -07:00
Vinnie Falco
31089931d3 Make ServiceQueue::enqueue virtual 2013-10-31 08:10:04 -07:00
Patrick Dehne
55dd5b5547 Add beast_vflib compatibility module and stand alone unit test app 2013-10-23 17:37:00 -07:00
Vinnie Falco
1f97a239dc Measure CPU usage in Workers 2013-10-22 17:23:54 -07:00
Vinnie Falco
8604e216eb Add IPAddressConversion and asio module 2013-10-22 11:45:30 -07:00
Vinnie Falco
f4120635e9 Rename to IPAddress and remove unused files 2013-10-22 10:43:16 -07:00
Vinnie Falco
e8f1dd8421 Squelch spurious linker warning 2013-10-22 10:43:15 -07:00
Vinnie Falco
2ec6050959 Fix crash in PropertyStream::find 2013-10-22 10:13:46 -07:00
Vinnie Falco
29c38ef0d4 RelativeTime tidying 2013-10-20 15:31:50 -07:00
Patrick Dehne
74d616ac78 monotonicCurrentTimeInSeconds should return seconds, not milliseconds 2013-10-21 00:11:44 +02:00
Patrick Dehne
504a892887 Wrap hiResCounterHandler in a function to prevent an order of initialization problems 2013-10-20 23:38:52 +02:00
Patrick Dehne
30cf0f8d3a Rename millisecondsSinceStartup to monotonicCurrentTimeInSeconds 2013-10-20 23:37:24 +02:00
Patrick Dehne
d794d7d30b #ifdef unneeded sys/prctl.h include in the mac build 2013-10-20 01:43:24 +02:00
Patrick Dehne
b112b333bd Make fromStartup compile on mac 2013-10-20 01:38:59 +02:00
Vinnie Falco
0e7bac945f Fix include path 2013-10-19 15:54:02 -07:00
Patrick Dehne
e5bb90fdfa Fix constness of Proxy 2013-10-19 15:54:02 -07:00
Patrick Dehne
ac0142a49e Use template cast 2013-10-19 15:54:02 -07:00
Patrick Dehne
ef6e381de3 Add missing Url.h include 2013-10-19 15:54:01 -07:00
Patrick Dehne
206e65cf05 Fix constness of operator[] 2013-10-19 15:54:01 -07:00
Patrick Dehne
695cc38b36 Use template instantiation for friend declaration 2013-10-19 15:54:01 -07:00
Vinnie Falco
7b1e03a585 Add BaseFromMember 2013-10-18 16:04:37 -07:00
Vinnie Falco
49bc04fa48 Make List<>::Node not uncopyable 2013-10-17 17:46:18 -07:00
Vinnie Falco
d5954fffa8 Add Journal to UnitTest 2013-10-17 17:46:13 -07:00
Vinnie Falco
58da1065d6 Temporarily disable ServiceQueue dtor precondition asserts 2013-10-16 15:59:04 -07:00
Vinnie Falco
fe58c1a383 Add missing #include 2013-10-07 14:26:26 -07:00
Vinnie Falco
2c02580c37 Add PropertyStream for server state introspection 2013-10-07 14:00:03 -07:00
Vinnie Falco
24c2315476 Add ScopedWrapperContext 2013-10-06 19:46:42 -07:00
Nik Bougalis
a3845f54e1 Add RelativeTime::value_type typedef 2013-10-06 18:33:53 -07:00
Vinnie Falco
7442932b5e Fix missing PropertyStream members 2013-10-06 18:25:53 -07:00
Vinnie Falco
ed5a98f697 More PropertyStream output for PeerFinder 2013-10-06 17:30:45 -07:00
Vinnie Falco
fcfa10d508 Add PropertyStream 2013-10-06 17:30:44 -07:00
Vinnie Falco
3cf0729878 Tidy up AbstractHandler usage in HTTPClient 2013-10-05 15:38:27 -07:00
Vinnie Falco
55171f42f6 Remove obsolete source files 2013-10-05 13:08:39 -07:00
Vinnie Falco
1311ca37e5 Increase arity of SharedFunction 2013-10-05 13:08:39 -07:00
Vinnie Falco
67d807d8fc Add IPEndpoint::key_equal 2013-10-05 02:41:29 -07:00
Vinnie Falco
ebf395ecc4 Add ErrorCode and boost library 2013-10-04 23:18:28 -07:00
Vinnie Falco
2c3ead339e Add ServiceQueue::wrap 2013-10-04 23:18:26 -07:00
Vinnie Falco
6c7f5d093c Move many Thread related classes 2013-10-04 14:34:01 -07:00
Vinnie Falco
93e9d8622e Measure CPU utilization in ServiceQueue 2013-10-04 14:34:00 -07:00
Vinnie Falco
ca47d72aee Move ServiceQueue, ThreadLocalValue, SpinLock 2013-10-04 14:34:00 -07:00
Vinnie Falco
c864e4d3db Move WaitableEvent 2013-10-04 14:33:59 -07:00
Vinnie Falco
ff305e63b6 Add CPUMeter and ScopedTimeInterval 2013-10-04 14:33:59 -07:00
Vinnie Falco
01fd05cb4b Add RecursiveMutex, UnlockGuard, TryLockGuard 2013-10-04 14:33:59 -07:00
Vinnie Falco
5831a53697 Remove Journal from most Stoppable overrides 2013-10-04 14:33:57 -07:00
Vinnie Falco
b60a7f3363 Add Request and Response HTTP parsers 2013-10-04 14:33:55 -07:00
Vinnie Falco
44445ff1b8 Refactor net buffers classes 2013-10-04 14:33:55 -07:00
Vinnie Falco
ac37c38133 Beast class refactor 2013-10-03 19:03:10 -07:00
Vinnie Falco
8b7056b06c Fix eof on HTTP client get 2013-10-03 18:36:55 -07:00
Vinnie Falco
228b664ecf Remove obsolete beast container classes 2013-10-03 18:36:53 -07:00
Vinnie Falco
1dfd655959 Use RelativeTime from startup in DeadlineTimer 2013-10-03 18:36:53 -07:00
Vinnie Falco
ae22d5dc8a Add more methods to RelativeTime 2013-10-03 18:36:53 -07:00
Vinnie Falco
c67929ea39 Remove unhandled exception catcher 2013-10-01 12:25:01 -07:00
Vinnie Falco
2472a902dd Add 64 bit output for MurmurHash 2013-10-01 12:25:01 -07:00
Vinnie Falco
f3d97c76df Add RelativeTime::fromStartup 2013-10-01 12:25:00 -07:00
Vinnie Falco
b0b8660132 IPEndpoint better parsing 2013-10-01 12:25:00 -07:00
Vinnie Falco
ae551cde63 Add alternate form string parsing to IPEndpoint 2013-09-30 09:29:37 -07:00
Vinnie Falco
d0a0dbf430 Don't break on Throw 2013-09-30 09:29:36 -07:00
Vinnie Falco
0e46762962 Add hasher functors for IPEndpoint 2013-09-30 09:29:36 -07:00
Vinnie Falco
a1ec423235 Add Thread::stopThreadAsync 2013-09-30 09:29:33 -07:00
Vinnie Falco
4f7dca3e5a Add compiler, stdlib, and platform skeleton to beast/config 2013-09-28 19:34:16 -07:00
Vinnie Falco
4394594518 Tidy up some use of Error for throw 2013-09-28 19:34:16 -07:00
Vinnie Falco
e5e0f527fe Journal console output improvements 2013-09-28 16:42:16 -07:00
Vinnie Falco
f07515eb88 Add Stoppable prepare and start interfaces 2013-09-28 15:30:01 -07:00
Vinnie Falco
d37dd46f65 Move RelativeTime to chrono, add ostream support 2013-09-28 15:09:12 -07:00
Vinnie Falco
3f6e7aa05a Add console feature to Journal 2013-09-28 15:09:12 -07:00
Vinnie Falco
ad0064a310 Journal option to write to Output window (MSVC) 2013-09-28 15:09:11 -07:00
Vinnie Falco
0b7574ba00 Add compilation test script 2013-09-28 15:09:11 -07:00
Vinnie Falco
cc05ce19f9 Add ServiceQueue 2013-09-28 15:09:10 -07:00
Vinnie Falco
e132aabdae Use boost for functional when the config is set 2013-09-28 15:09:10 -07:00
Vinnie Falco
026b9268ae Fix is_continuation for boost version 2013-09-28 15:09:09 -07:00
Vinnie Falco
c807a4e383 Fix invoked_type type reference 2013-09-28 15:09:09 -07:00
Vinnie Falco
2ff781b25f Remove LockFreeStack::size 2013-09-28 15:09:08 -07:00
Vinnie Falco
3acb474795 Add SharedData::ConstAccess 2013-09-28 15:09:08 -07:00
Vinnie Falco
7e4c834c0e Add LockFreeStack::empty 2013-09-28 15:09:07 -07:00
Vinnie Falco
9c61a6df62 Added AbstractHandler, WrapHandler. HTTPClient Fixes. 2013-09-28 15:09:07 -07:00
Alex Dupre
94e40dc554 Fix unittest, by removing recursive call. 2013-09-28 20:25:41 +02:00
Vinnie Falco
38bf40884c Fix nonstandard C++ extension in getNullSink 2013-09-27 05:18:34 -07:00
Vinnie Falco
1ef044d628 Build fixes 2013-09-27 05:15:55 -07:00
Vinnie Falco
d5d37466e0 Fix missing <cmath> include for Gentoo 2013-09-27 05:15:46 -07:00
Vinnie Falco
5f231d305f Update copyright notice and licenses 2013-09-25 17:27:06 -07:00
Vinnie Falco
7b89bf6cc7 Add FixedArray, IntrusiveArray, Crypto 2013-09-23 10:13:25 -07:00
Vinnie Falco
5c5de57290 Reorganize beast modules and files 2013-09-23 10:13:24 -07:00
Vinnie Falco
9e18bb3c31 Merge commit '43deaaa5cf0d0178a4a6c3cb69c02a2a9a43ec7d' as 'src/beast/beast/http/impl/http-parser' 2013-09-23 09:54:31 -07:00
Vinnie Falco
57703acf75 Fix BeforeBoost.h include 2013-09-22 11:52:26 -07:00
Vinnie Falco
fbc247bf53 Add Stoppable to beast 2013-09-22 11:51:46 -07:00
Vinnie Falco
56496d8287 IPEndpoint comparisons 2013-09-22 11:51:44 -07:00
Vinnie Falco
9d9c822efb Migrate some headers and general tidying 2013-09-22 11:51:44 -07:00
Vinnie Falco
1a3cddc002 Add SharedArg and AsyncObject 2013-09-22 11:51:43 -07:00
Vinnie Falco
373ca9cef0 Add HTTPRequest and improvements to HTTPMessage parsing 2013-09-22 11:51:43 -07:00
Vinnie Falco
9534516b42 Add some thread classes and fix SharedData with a simple mutex adapter 2013-09-21 16:58:55 -07:00
Vinnie Falco
755ab36f0d Make CallQueue unit test runManual 2013-09-20 01:12:21 -07:00
Vinnie Falco
c0ca0373b6 Remove Beast version printing on startup 2013-09-20 00:57:55 -07:00
Vinnie Falco
7efb6a3ab8 Reorganize some MPL and Utility classes and files 2013-09-19 21:37:47 -07:00
Vinnie Falco
69c26a180e Fix missing BeastConfig.h include in Net.cpp 2013-09-19 18:25:01 -07:00
Vinnie Falco
40aa552489 Disable Beast version printing in Ripple BeastConfig.h 2013-09-19 18:22:18 -07:00
Vinnie Falco
7b1352d9c5 Add InterruptibleThread unit test 2013-09-19 14:42:55 -07:00
Vinnie Falco
68cf7599d8 ThreadWithCallQueue unit test adjustment 2013-09-19 14:42:55 -07:00
Vinnie Falco
6501dea7a3 IPEndpoint parsing and tidying 2013-09-19 14:42:55 -07:00
Vinnie Falco
72fc42b60c Move and add some template metaprogramming classes 2013-09-19 14:42:54 -07:00
Vinnie Falco
2a164f0165 Change filname capitalization (end) 2013-09-19 14:42:54 -07:00
Vinnie Falco
6a14f251ba Change filename capitalization 2013-09-19 14:42:53 -07:00
Vinnie Falco
92fd417962 Move integer types to beast/CStdInt.h 2013-09-19 14:42:53 -07:00
Vinnie Falco
ebbd9ff414 Move TargetPlatform.h to beast/Config.h 2013-09-19 14:42:52 -07:00
Vinnie Falco
874b5240d2 Add IPEndpoint
Conflicts:
	src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
2013-09-19 14:42:52 -07:00
Vinnie Falco
14b34fc6ef Tidy up some zlib macro undefines 2013-09-19 14:42:52 -07:00
Vinnie Falco
34fffca202 Rename beast sources for consistency 2013-09-19 14:42:51 -07:00
Vinnie Falco
4e59ab2261 Add CallQueue unit test 2013-09-19 14:42:50 -07:00
Vinnie Falco
327d7a6524 Fixes for consolidated beast unity includes 2013-09-19 14:42:49 -07:00
Vinnie Falco
d5ece4e909 Remove unused and broken classes 2013-09-19 14:42:49 -07:00
Vinnie Falco
39f13beaf7 Remove unused ConcurrentObject 2013-09-19 14:42:48 -07:00
Vinnie Falco
37624a7303 Add ThreadWithCallQueue unit test 2013-09-19 14:42:47 -07:00
Vinnie Falco
e82ec68820 Remove obsolete beast_Function 2013-09-19 14:42:46 -07:00
JoelKatz
90551a6eaf Temporarily leave sqlite3 in whatever threading mode it was already in. 2013-09-19 10:33:22 -07:00
Vinnie Falco
43ebbb1c70 Fix SharedSingleton to use memoryBarrier 2013-09-17 17:58:21 -07:00
Vinnie Falco
f343941a96 Tidy up SharedSingleton doc comments 2013-09-17 17:47:06 -07:00
Vinnie Falco
001997e088 Fix leak on exit from Singleton dependency cycle 2013-09-17 17:47:06 -07:00
Vinnie Falco
83b9d22ff0 Rename to DeadlineTimer::cancel() 2013-09-17 17:47:05 -07:00
Vinnie Falco
77874ee518 Use new instead of ::new for placement 2013-09-17 17:47:05 -07:00
Vinnie Falco
2a04dcc334 Journal improvements 2013-09-17 17:47:04 -07:00
Vinnie Falco
50965ca9c0 SharedFunction improvements 2013-09-17 17:47:04 -07:00
Vinnie Falco
277e32bb1e Add LockFreeStack iterators 2013-09-17 17:47:04 -07:00
Vinnie Falco
d94e4c2491 Fix undefined behavior in UnsignedIntegerCalc (again) 2013-09-17 17:47:03 -07:00
Vinnie Falco
2dc25cec72 Fix DeadlineTimer, callback while holding lock 2013-09-17 14:13:27 -07:00
Vinnie Falco
207ffdec8e Fix undefined behavior in UnsignedIntegerCalc 2013-09-16 18:47:35 -07:00
Vinnie Falco
1ad8ff9b64 Fix UnsignedInteger::isZero 2013-09-13 13:06:45 -07:00
Vinnie Falco
1dd2836f1b Add support for multiprecision integer arithmetic and binary data encoding 2013-09-13 12:43:43 -07:00
Vinnie Falco
a45fc47682 Update .gitignore 2013-09-12 23:58:56 -07:00
Vinnie Falco
962a95d770 Tidy up UnsignedInteger 2013-09-12 23:58:56 -07:00
Vinnie Falco
ca695fa6e1 Add Time::isNull() 2013-09-12 23:58:55 -07:00
Vinnie Falco
e96ce99d3d Better random number facilities in UnitTest 2013-09-12 21:39:17 -07:00
Vinnie Falco
550b8e55ee Fine tune UnsignedInteger declaration 2013-09-12 19:18:31 -07:00
Vinnie Falco
8e7e3b7256 Allow negative relative expirations in DeadlineTimer 2013-09-12 18:07:57 -07:00
Vinnie Falco
f3dc7ce52c Add generic Journal class for logging 2013-09-12 15:06:28 -07:00
Vinnie Falco
bfdda3212a Make ChildProcess UnitTest manual since it malfunctions 2013-09-12 10:55:24 -07:00
Vinnie Falco
02acf7d6d0 General refactoring of beast framework classes 2013-09-12 10:55:24 -07:00
Vinnie Falco
84ef06e35c Fix ExitHook to derive from AtExitHook 2013-09-12 10:55:17 -07:00
Vinnie Falco
f0acc9c901 Reduce the max threads in the Workers unit test 2013-09-12 05:46:45 -07:00
Vinnie Falco
55447b05ac New SharedSingleton, resolves destruction of objects with static storage duration. 2013-09-12 05:38:39 -07:00
Vinnie Falco
41eb8a1e29 Remove deprecated SharedPtr::getObject 2013-09-12 04:47:03 -07:00
Vinnie Falco
9eda4bc6fa Make SharedObject members const, the counter mutable 2013-09-12 04:47:03 -07:00
Vinnie Falco
6eda7772eb Remove deprecated createOnDemandOnce SingletonLifetime option 2013-09-12 00:43:05 -07:00
Vinnie Falco
8c522aa758 Fix off by one in pending i/o count on HTTPClient 2013-09-11 21:40:17 -07:00
Vinnie Falco
057344e1af Add HTTPMessage::toString and family 2013-09-11 20:04:23 -07:00
Vinnie Falco
ee728e3dbc Add UniformResourceLocator::empty 2013-09-11 19:58:11 -07:00
Vinnie Falco
ae324fba94 Move ./modules to ./src 2013-09-11 11:20:53 -07:00
Vinnie Falco
43e6d345e4 General beast update, fixes, optimizations, features:
* Clean ups, optimizations, and new File::commonDocumentsDirectory enum
* Replace sortArray with std::sort for performance
* More error tolerance in XML parser, speedups
* Refactor some byte-order mark detection code
* Add String::appendCharPointer overloads
* More XML parser optimisations and better error detection
* Misc performance tweaks
* Fixes for support of non utf8 strings
* Increased precision when storing strings in XmlElement
* Minor clean-ups
* Minor fix to XmlDocument
* Cleanups to CriticalSection and related synchronization primitives
* Fix DynamicArray unit test
2013-09-10 10:36:46 -07:00
Vinnie Falco
27307fca0c Use SharedFunction in ProtectedCall 2013-09-10 08:04:54 -07:00
Vinnie Falco
8b1b6050e7 Put back BEAST_CATCH_UNHANDLED_EXCEPTIONS macro, but disabled by default 2013-09-10 08:04:46 -07:00
Vinnie Falco
da925ee5cc Update to SQLite 3.8.0.2 2013-09-10 07:45:34 -07:00
Vinnie Falco
4676db126a Remove BEAST_CATCH_UNHANDLED_EXCEPTIONS 2013-09-09 13:34:18 -07:00
Vinnie Falco
d8ea4f9b06 Make UnsignedInteger HashFunction a unary function object 2013-09-09 10:50:35 -07:00
Vinnie Falco
d2d946204c Improvements to BuffersType 2013-09-09 10:50:35 -07:00
Vinnie Falco
2b132ae892 Tune HashMap parameters 2013-09-09 10:28:10 -07:00
Vinnie Falco
34b7599df6 Rename to IsCond<> 2013-09-09 10:28:09 -07:00
Vinnie Falco
270ceb7ceb Defer DeadlineTimer callback until the lock is released 2013-09-07 21:20:13 -07:00
Vinnie Falco
200c935228 Disable gcc warning for KeyvaDB 2013-09-07 11:57:53 -07:00
Vinnie Falco
f0c57cf95c Add HTTPClientType and HTTPMessage related helpers 2013-09-07 11:53:38 -07:00
Vinnie Falco
19d05b8024 Tidy up contract checks in InterruptibleThread 2013-09-07 11:53:38 -07:00
Vinnie Falco
2a362a99da Disable exception catching in unit tests 2013-09-07 11:53:37 -07:00
Vinnie Falco
497c8aeabf Add ContentBodyBuffer 2013-09-07 11:53:37 -07:00
Vinnie Falco
c35843fda5 Add SharedFunction to replace boost::function 2013-09-07 11:53:36 -07:00
Vinnie Falco
88af355028 Update programming by contract macros 2013-09-07 11:53:36 -07:00
Vinnie Falco
10958459a3 Add BEAST_MOVE_* macros 2013-09-07 11:53:35 -07:00
Vinnie Falco
5f6e2ee026 Add Debug unit test to check bassert behavior 2013-09-07 11:53:35 -07:00
Vinnie Falco
7a7514fa0c Add StringPairArray::swapWith 2013-09-07 11:53:34 -07:00
Vinnie Falco
637eafedee Add UniformResourceLocator and ParsedURL 2013-09-07 11:53:34 -07:00
Vinnie Falco
3f74cb76e9 Rename boost_asio files 2013-09-07 11:53:34 -07:00
Vinnie Falco
f79b34b2c9 Add http-parser to boost_asio 2013-09-07 11:53:33 -07:00
Vinnie Falco
85ced3dbf7 Use destroy() override instead of ContainerDeletePolicy for SharedObject 2013-09-07 11:53:32 -07:00
Vinnie Falco
718569d6a1 Fix DeadlineTimer for InterruptibleThread::wait timeout 2013-09-06 21:45:41 -07:00
Vinnie Falco
a56c01d044 Fix DeadlineTimer for InterruptibleThread::wait timeout 2013-09-06 21:44:53 -07:00
Vinnie Falco
04a4219a75 Make bassert fatal 2013-09-06 21:29:16 -07:00
Vinnie Falco
16113e783f Fix SharedPtr commit bug again 2013-09-06 21:25:55 -07:00
Vinnie Falco
63b0a1c9e0 Fix reference count bug in SharedPtr container 2013-09-06 20:18:25 -07:00
Vinnie Falco
a386b458fb Merge commit '60d5ca452314e0131993e1adcc004394fb64eed2' as 'Subtrees/beast/modules/beast_asio/parsehttp' 2013-09-06 12:46:39 -07:00
Vinnie Falco
8017b18039 Remove incorrect parsehttp subtree path 2013-09-06 12:46:23 -07:00
Vinnie Falco
981f6a8972 Merge commit 'ef544b108f8979e4622bd27657c9e93271b461fc' as 'Subtrees/beast/beast_asio/parsehttp' 2013-09-06 12:44:36 -07:00
Vinnie Falco
429deb959c Fix compile error on configs with c++11 move support 2013-09-05 05:08:41 -07:00
Vinnie Falco
86793468de Replace obsolete OncePerSecond with DeadlineTimer 2013-09-05 04:38:18 -07:00
Vinnie Falco
04d039eddd New ContainerTest generic templates 2013-09-05 04:22:27 -07:00
Vinnie Falco
201221253d Refactor SharedPtr and fix ContainerDeletePolicy bug 2013-09-05 04:22:26 -07:00
Vinnie Falco
aa2773e483 Add HashMap unit test 2013-09-05 04:22:25 -07:00
Vinnie Falco
25f29a2287 Add new-styled Intrusive and MPL modules 2013-09-05 04:22:25 -07:00
Vinnie Falco
b0503691c5 Fix bug and tidy up DeadlineTimer 2013-09-04 15:17:22 -07:00
Vinnie Falco
457c3262d7 Fix String from number conversions 2013-09-04 13:24:41 -07:00
Vinnie Falco
de2c4cc7b8 Added DynamicArray, DynamicList, and HashMap 2013-09-03 08:31:16 -07:00
Vinnie Falco
81e5b59060 Update TODO Files 2013-09-02 18:03:44 -07:00
Vinnie Falco
96587dc68c Add BeforeBoost.h and tidy up beast system headers 2013-09-01 12:22:08 -07:00
Vinnie Falco
d9d291abcb Tidy up includes and header material 2013-08-30 17:33:33 -07:00
Vinnie Falco
38516ef793 Tidy up beast project files 2013-08-30 17:24:32 -07:00
JoelKatz
5acd433080 Fix another regression. 2013-08-27 01:49:46 -07:00
Vinnie Falco
5c2da08c13 Fix warnings 2013-08-26 18:59:57 -07:00
Vinnie Falco
3c79ebda17 Add toString for IPv4Address 2013-08-25 01:57:50 -07:00
Vinnie Falco
46e5dc2f5c Add SSLContext 2013-08-25 01:57:50 -07:00
Vinnie Falco
0aa7e871d1 Improvements to Socket and SocketWrapper 2013-08-24 20:06:17 -07:00
Vinnie Falco
34527fbbe4 Add SocketWrapperStrand 2013-08-24 20:06:16 -07:00
Vinnie Falco
9fcab37445 Fix PrefilledReadStream::close to use lowest_layer 2013-08-24 20:06:16 -07:00
Vinnie Falco
5c0ee3d9a8 Make asio Socket unit tests run automatically 2013-08-24 20:06:16 -07:00
Vinnie Falco
f3327e6dca Update to SQLite 3.8.0 Pre-release (as of 2013-08-22 02:56 UTC) 2013-08-24 20:06:15 -07:00
Vinnie Falco
0e6e22ac3d Update sqlite to 3.7.17 (2013-05-20) 2013-08-24 18:48:08 -07:00
Vinnie Falco
5002ab2169 Merge beast_basics to beast_core 2013-08-24 10:18:24 -07:00
Vinnie Falco
db05b9ff04 Add TracketMutex unit test 2013-08-23 17:49:29 -07:00
Vinnie Falco
04f9270772 Add TrackedMutex and measureFunctionCallTime 2013-08-23 15:00:04 -07:00
Vinnie Falco
29feaba22f Fix KeyvaDB warnings 2013-08-23 07:01:37 -07:00
Vinnie Falco
dd3fc7a084 Fix #ifdef for pragma 2013-08-22 18:43:55 -07:00
Vinnie Falco
c5130e3eb3 Add String::fromNumber<> template for disambiguation 2013-08-22 18:10:01 -07:00
Vinnie Falco
b4855b6ac9 New beast Socket, SharedHandler, ComposedAsyncOperation APIs 2013-08-21 19:41:22 -07:00
Vinnie Falco
b09e975b4c Fix DirectoryIterator when multiple wildcards are used. 2013-08-20 15:24:02 -07:00
Vinnie Falco
ac9c02f73b Fix ProtectedCall default handler 2013-08-20 15:22:21 -07:00
Vinnie Falco
52ff45549d Make HandlerCall operator() const 2013-08-18 17:21:59 -07:00
Vinnie Falco
325a265a33 Add explicit checking for OpenSSL multithreading support 2013-08-18 13:09:09 -07:00
Vinnie Falco
918950ba49 Move destroy to the .cpp 2013-08-18 13:09:09 -07:00
Vinnie Falco
34dfcee2e8 Fix pure virtual stubs for future returns 2013-08-18 13:08:34 -07:00
Vinnie Falco
95cb192209 Clean up combinations of buffered handshaking and future returns 2013-08-18 03:20:57 -07:00
Vinnie Falco
c1bef9b35c Tidy up argument types for all wrappers and call sites 2013-08-18 03:07:12 -07:00
Vinnie Falco
005672e8af Remove obsolete handler wrappers 2013-08-18 02:35:53 -07:00
Vinnie Falco
e52e7d15dc New Context object for composed operations and continuation hooks 2013-08-18 01:53:43 -07:00
Vinnie Falco
dda53a96cc Fix clang compile error 2013-08-17 22:54:43 -07:00
Vinnie Falco
35f53516c7 Refactor Handler wrapper to meet the safety assurances of the original Handler 2013-08-17 21:10:03 -07:00
Vinnie Falco
14f8ed8dd2 Fatal error if a Thread is destroyed while running 2013-08-17 21:10:02 -07:00
Vinnie Falco
21b78adfee Add ContainerDeletePolicy for ownership containers 2013-08-17 21:10:01 -07:00
Vinnie Falco
503b8047b1 Fix thread destruction in TestPeer and better exception reporting 2013-08-17 21:10:00 -07:00
Vinnie Falco
d959af430e Fixes to handshake and socket wrapper 2013-08-17 21:09:59 -07:00
Vinnie Falco
4e908d3e96 Fix incorrect future returns for pure virtuals 2013-08-17 21:09:59 -07:00
Vinnie Falco
3db2b7d6a6 Fix gcc compile 2013-08-17 21:09:59 -07:00
Vinnie Falco
4615297b00 Refactor handshake parsing and logic classes 2013-08-17 21:09:58 -07:00
Vinnie Falco
6108aca055 Add TestPeerLogicProxyClient 2013-08-17 21:09:57 -07:00
Vinnie Falco
068cb83803 Generic HandshakeDetectStream and HandshakeDetectLogic 2013-08-17 21:09:57 -07:00
Vinnie Falco
22b4e17fad Allow selective enabling of async future returns 2013-08-17 21:09:56 -07:00
Vinnie Falco
7333d13dd4 Rename to max_needed for clarity 2013-08-17 21:09:55 -07:00
Vinnie Falco
77268845a6 Add class PrefilledReadStream 2013-08-17 21:09:55 -07:00
Vinnie Falco
93d490bc8f Fix async_result returns and handler copying 2013-08-17 21:09:55 -07:00
Vinnie Falco
e1d0bc83f4 Add default construction and isNull for Call handlers 2013-08-17 21:09:54 -07:00
Vinnie Falco
0ac3f826e1 Add 1-arity and 2-arity binding to CompletionCall 2013-08-17 21:09:54 -07:00
Vinnie Falco
2ef937a9dc Add this_layer and this_layer_type to SocketWrapper 2013-08-17 21:09:53 -07:00
Vinnie Falco
52b0f65bb3 Check for macro before setting it 2013-08-17 21:09:53 -07:00
Vinnie Falco
0c92204927 Tidy up move obsolete and deprecated files 2013-08-17 21:09:53 -07:00
Vinnie Falco
8632d43748 Fix missing return value 2013-08-16 10:43:31 -07:00
Vinnie Falco
9bf8c3765b Fix server to block until listening 2013-08-15 19:00:19 -07:00
Vinnie Falco
5b691224f0 Fix rvalue move arguments 2013-08-15 19:00:19 -07:00
Vinnie Falco
9cdf27cbf5 Make KeyvaDB unit tests run manually 2013-08-15 16:57:49 -07:00
Vinnie Falco
d1621692dc Report notes for issue #1 2013-08-15 16:57:46 -07:00
Vinnie Falco
cc133ccc4c Refactor SocketWrapper 2013-08-15 16:57:46 -07:00
Vinnie Falco
69f0eb109f Add BEAST_DEFINE_IS_CALL_POSSIBLE metaprogramming macro 2013-08-15 16:57:45 -07:00
Vinnie Falco
a3ab23a36a Improvements to TestPeer and PeerTest classes 2013-08-15 16:57:45 -07:00
Vinnie Falco
5e5b49d4e2 Consolidate Process::terminate code 2013-08-15 15:45:18 -07:00
Vinnie Falco
377c983ecb Remove spaces from unit test package and class names 2013-08-15 15:45:17 -07:00
Vinnie Falco
69b20b52cc Handshake detection wrappers 2013-08-15 15:45:17 -07:00
Vinnie Falco
e4a68d9962 Infinite PeerTest timeout when debugger attached 2013-08-15 15:45:17 -07:00
Vinnie Falco
21f0d63507 Add uint24 and network byte order conversions 2013-08-15 15:45:16 -07:00
Vinnie Falco
e7b008c6d5 Add some missing ByteOrder functions and templates 2013-08-15 15:45:16 -07:00
Vinnie Falco
7735187d36 Move PeerRole to its own file 2013-08-15 15:45:15 -07:00
Vinnie Falco
85f4d7d025 Move some classes into their own files 2013-08-15 15:45:15 -07:00
Vinnie Falco
e0eaa08597 Add PROXY TestPeer client 2013-08-15 15:45:15 -07:00
Vinnie Falco
43c065c5b6 Robust method for extracting the underlying template type 2013-08-15 15:45:14 -07:00
Vinnie Falco
df154e43b1 Import ProxyHandshake into beast 2013-08-15 15:45:14 -07:00
Vinnie Falco
ba21367b40 Fix unused variable warning 2013-08-15 08:31:13 -07:00
Vinnie Falco
c420f60259 Fix Workers warning 2013-08-15 08:28:51 -07:00
Vinnie Falco
b13f35645a Call _exit from Process::terminate() 2013-08-12 13:29:24 -07:00
Vinnie Falco
68560c9ea7 Add thread naming to Workers 2013-08-12 11:00:55 -07:00
Vinnie Falco
1a9019f5f5 Add numberOfCurrentlyRunningTasks to Workers 2013-08-12 11:00:47 -07:00
Vinnie Falco
969eeec717 Add programming by contract support 2013-08-12 11:00:37 -07:00
Vinnie Falco
1f59e38dc7 Use std::ostream for double to String conversions 2013-08-10 03:12:53 -07:00
Vinnie Falco
b202b82f5a Disable failing TestPeer unit test 2013-08-10 00:46:33 -07:00
Vinnie Falco
d0bdafff71 Fix c++0x errors 2013-08-10 00:45:40 -07:00
Vinnie Falco
685af493a4 Use deadline_timer to handle async logic properly 2013-08-09 23:14:58 -07:00
Vinnie Falco
e8ad5a0e6b Tidy up beast_asio 2013-08-09 20:53:49 -07:00
Vinnie Falco
000b5a2b7c Fix gcc warnings and errors 2013-08-09 19:59:59 -07:00
Vinnie Falco
88ffd3cdfb TestPeer boost::asio Socket and UnitTest framework 2013-08-09 19:47:12 -07:00
Vinnie Falco
98352429c2 Update .gitignore for beast_boost module 2013-08-09 19:23:40 -07:00
Vinnie Falco
5171a00569 Clean up rvalues in arguments and call sites 2013-08-09 19:23:40 -07:00
Vinnie Falco
01af51308e Add SslContext abstraction 2013-08-09 19:23:40 -07:00
Vinnie Falco
65d4440d0d Fix using BOOST_ASIO_MOVE_CAST for passing rvalue references 2013-08-07 19:14:21 -07:00
Vinnie Falco
37276f357c Fix use sites of BOOST_ASIO_MOVE_ARG 2013-08-07 18:42:19 -07:00
Vinnie Falco
e0b6620df2 More match options for unit test selection string 2013-08-07 17:31:48 -07:00
Vinnie Falco
ebabeb6fbd Add 'print' unit test which prints the list of tests 2013-08-07 15:34:13 -07:00
Vinnie Falco
ab6c138a7c Set __WIN32_WINNT in properties 2013-08-07 15:16:43 -07:00
Vinnie Falco
33e7c124a3 Fix gcc compile errors 2013-08-07 15:16:43 -07:00
Vinnie Falco
11ff62e120 Revise all Socket function signatures and return values 2013-08-07 15:16:42 -07:00
Vinnie Falco
155a6a09b6 Tidy up beast_asio 2013-08-07 15:16:41 -07:00
Vinnie Falco
74156b6b89 Add beast_asio module 2013-08-07 15:16:40 -07:00
Vinnie Falco
9387e7dd2d Tweak fatal_error macro to remove warning 2013-08-07 15:16:40 -07:00
Vinnie Falco
9aaaa6aef0 Make Uncopyable derivations public 2013-08-07 15:16:38 -07:00
Vinnie Falco
cc9358ee95 Adjust access-specifier 2013-08-07 15:16:38 -07:00
Vinnie Falco
06ed133ae3 Add fatal_error() macro 2013-08-07 15:16:37 -07:00
Vinnie Falco
75b778924f Change to fatal_assert() 2013-08-07 15:16:37 -07:00
Vinnie Falco
fe902db322 Update beast vcxproj 2013-08-07 15:16:36 -07:00
Vinnie Falco
0c00335627 Fatal error in ~Thread if thread still running (undefined behavior) 2013-08-07 15:16:36 -07:00
Vinnie Falco
5e3548fc00 Add fatal_require and improved FatalError reporting interfaces 2013-08-07 15:16:35 -07:00
Vinnie Falco
c8837d07e7 Add bool return to stopThread 2013-08-07 15:16:35 -07:00
Vinnie Falco
fd14957072 Return results of expect in UnitTest 2013-08-07 15:16:35 -07:00
Vinnie Falco
1df03b67e7 Add RelativeTime::seconds() ctor 2013-08-07 15:16:34 -07:00
Vinnie Falco
6d9131084f Add default to UnitTest::fail() and tidy up 2013-08-07 15:16:34 -07:00
Vinnie Falco
66b96b90d5 Generate a fatal error if a running Thread object is destroyed 2013-08-07 15:16:33 -07:00
Vinnie Falco
03baeccda5 Add getConstData for MemoryBlock 2013-08-07 15:16:33 -07:00
Vinnie Falco
91b0c1cd0e Add Random::fillBitsRandomly 2013-08-07 15:16:32 -07:00
Vinnie Falco
6d974daaf2 Add default value to Semaphore ctor 2013-08-07 15:16:32 -07:00
Vinnie Falco
849d0c1c34 Return popped element in List 2013-08-07 15:16:31 -07:00
Vinnie Falco
63dc75fb81 Add std container compatibility to MemoryBlock 2013-08-07 15:16:31 -07:00
Vinnie Falco
f07732a9ca Fix clang warnings 2013-08-07 15:16:31 -07:00
Alex Dupre
9702446d91 Comment out a quite useless test case if platform is not Windows, since getcwd()
return the canonical path (resolving symlinks), while HOME may contains symlinks.
2013-08-05 09:39:41 -07:00
Alex Dupre
d3a07234cd Fix retrieval of CPU info (number of CPUs, speed, flags, vendor) on FreeBSD,
using 'dmesg' and 'sysctl' instead of /proc/cpuinfo that is Linux-specific.
2013-08-05 09:39:34 -07:00
Vinnie Falco
cf2c43e7ab Fix clang compile 2013-08-01 15:54:24 -07:00
Vinnie Falco
83c3beb2ed Run startup unit tests from Main 2013-08-01 15:27:18 -07:00
Vinnie Falco
52133569f5 Add runStartup category to UnitTest 2013-08-01 15:27:18 -07:00
Vinnie Falco
1c39721ff7 Add SemanticVersion 2013-08-01 15:27:18 -07:00
Vinnie Falco
57b2c3c2e4 Add overloaded translate() that takes CharPointer_UTF8 2013-08-01 11:36:13 -07:00
Vinnie Falco
ed82643faf Fix mutex scope and storage duration 2013-07-31 18:41:59 -07:00
Vinnie Falco
5131752402 Add return value to some InputStream methods 2013-07-31 16:40:28 -07:00
Vinnie Falco
1b44479311 Default parameter to false 2013-07-31 16:40:28 -07:00
Vinnie Falco
4c987d04d6 Add tests for SSE3 capability 2013-07-31 16:35:52 -07:00
Vinnie Falco
728ace79c5 Fix Android warnings 2013-07-31 16:29:34 -07:00
Vinnie Falco
a937b97a61 Add FatalError 2013-07-30 21:05:11 -07:00
Vinnie Falco
35d2ea862b Fix clang compile 2013-07-29 16:33:09 -07:00
Vinnie Falco
1c502948f5 Add ProtectedCallTests 2013-07-29 15:35:27 -07:00
Vinnie Falco
45f321a3a2 Fix summary stats for unit test results 2013-07-29 14:54:54 -07:00
Vinnie Falco
85f5672280 Fix UnitTest doc 2013-07-29 14:38:58 -07:00
Vinnie Falco
62c1b02eb1 Clarify behavior of pauseAllThreadsAndWait 2013-07-29 14:00:45 -07:00
Vinnie Falco
67af5ccda8 Fix KeyvaDB unit test package name 2013-07-29 13:43:39 -07:00
Vinnie Falco
bd49b0edf8 Add class Workers 2013-07-29 13:31:50 -07:00
Vinnie Falco
3126654d33 Add timeout to Semaphore::wait 2013-07-29 13:31:11 -07:00
Vinnie Falco
1b55d39997 Fix integer to String conversions 2013-07-29 13:31:10 -07:00
Vinnie Falco
51372c01f2 Make expectEquals more generic 2013-07-29 13:31:10 -07:00
Vinnie Falco
7008db7dda Add initiallySignaled parameter to WaitableEvent 2013-07-29 13:31:10 -07:00
Vinnie Falco
47456a1723 Add class Workers 2013-07-29 13:30:06 -07:00
Vinnie Falco
933ba3c7d6 Make timeouts default to infinity in Thread 2013-07-29 13:30:06 -07:00
Vinnie Falco
08ff5f02b1 Tidy up String conversions 2013-07-29 13:30:05 -07:00
Vinnie Falco
2bf39203e8 Add infinite wait default to waitForThreadToExit 2013-07-29 13:30:04 -07:00
Vinnie Falco
d323a84dd9 Remove unused function 2013-07-29 13:30:04 -07:00
Vinnie Falco
2e402ba654 Add lexicalCast 2013-07-28 21:27:04 -07:00
Vinnie Falco
f0afa04037 Fix numberToString for limit cases 2013-07-28 21:04:20 -07:00
Vinnie Falco
b9290acb85 Update TODO 2013-07-28 14:58:20 -07:00
Vinnie Falco
cb47146b3b Add classes ProtectedCall and Main 2013-07-28 14:58:19 -07:00
Vinnie Falco
04fadc84a6 Rename to swapWith and use a template parameter 2013-07-28 14:58:19 -07:00
Vinnie Falco
18333eac29 Remove unnecessary .mm files 2013-07-28 14:58:18 -07:00
Vinnie Falco
abd3668b65 Upgrade UnitTest and provide JUnit XML output formatting 2013-07-28 02:44:26 -07:00
Vinnie Falco
9064af3b1c Call pass() in AbstractFifo unit test 2013-07-28 02:41:09 -07:00
Vinnie Falco
2f7b42b13b Return index in Array::add() 2013-07-28 02:41:09 -07:00
Vinnie Falco
56755c278b Add UnitTest::anyTestsFailed() 2013-07-27 14:57:38 -07:00
Vinnie Falco
7266111b68 Generalize swapWithArray
Conflicts:
	Subtrees/beast/TODO.txt
2013-07-27 11:00:21 -07:00
Vinnie Falco
810954014b Add hardened HashFunction to UnsignedInteger 2013-07-27 10:47:32 -07:00
Vinnie Falco
3248a1b57f HashMap ctor stores an instance of the hash function 2013-07-27 10:47:32 -07:00
Vinnie Falco
4edf1fd8fa Add OwnedArray::clearQuick() 2013-07-27 10:47:32 -07:00
Vinnie Falco
67f22e602e Update TODO 2013-07-24 11:51:39 -07:00
Vinnie Falco
114012fab2 Add pass and fail to UnitTest 2013-07-24 11:47:43 -07:00
Vinnie Falco
c50fc88827 Update TODO 2013-07-24 11:47:42 -07:00
Vinnie Falco
f5e4b3aeb3 Use beast_sqlite and beast_sqdb 2013-07-24 11:47:42 -07:00
Vinnie Falco
76e0d4c770 Add beast_sqdb module 2013-07-24 11:47:42 -07:00
Vinnie Falco
ed8d9b1ed3 Add beast_sqlite module 2013-07-24 11:47:41 -07:00
Vinnie Falco
c825fce0cf Put unit test in 'beast' group 2013-07-23 14:06:06 -07:00
Vinnie Falco
0f5b35f408 Import KeyvaDB to Beast 2013-07-23 13:23:07 -07:00
Vinnie Falco
ae0cd50840 Optimised Result::ok() 2013-07-23 13:04:52 -07:00
Vinnie Falco
9a7c5b02d4 Allow external buffers in MemoryOutputStream 2013-07-22 13:20:52 -07:00
Vinnie Falco
66c5b4ed01 Add identity import tests to NodeStoreTests 2013-07-21 14:02:23 -07:00
Vinnie Falco
f125c3a3c8 Add template I/O for streams 2013-07-21 12:56:27 -07:00
Vinnie Falco
e36f027a9a Clean up RandomAccessFile 2013-07-21 12:56:26 -07:00
Vinnie Falco
dc7035ed19 Update RandomAccessFile unit test 2013-07-21 12:55:47 -07:00
Vinnie Falco
d25fe19d87 Add group and run type to UnitTest 2013-07-21 12:55:47 -07:00
Vinnie Falco
dc52a31814 Add RecycledObjectPool 2013-07-21 12:54:14 -07:00
Vinnie Falco
2f45613017 Hack to fix Random 2013-07-21 12:54:13 -07:00
Vinnie Falco
8d881d3b6f Add Random::nextBlob 2013-07-21 12:54:13 -07:00
Vinnie Falco
ce6f051551 Fix compare() 2013-07-21 12:54:11 -07:00
Vinnie Falco
b3b188061a Fix POSIX RandomAccessFile 2013-07-21 12:54:11 -07:00
Vinnie Falco
49f70c083d Add POSIX RandomAccessFile native routines 2013-07-21 12:54:11 -07:00
Vinnie Falco
ed392300b4 Fix RandomAccessFile read 2013-07-21 12:54:10 -07:00
Vinnie Falco
a3af6404b0 RandomAccessFile unit tests 2013-07-21 12:54:09 -07:00
Vinnie Falco
312b7352b2 Run an individual unit test 2013-07-21 12:54:08 -07:00
Vinnie Falco
23e4bc4f9a Run a named unit test 2013-07-21 12:54:08 -07:00
Vinnie Falco
8208bb25ba Add RandomAccessFile 2013-07-21 12:54:07 -07:00
Vinnie Falco
a90ea340d2 Add return values to OutputStream methods 2013-07-21 12:54:07 -07:00
Vinnie Falco
e2fd51c282 Assert on type size invariant 2013-07-21 12:54:05 -07:00
Vinnie Falco
0008193a20 Fix gcc compile 2013-07-15 09:38:12 -07:00
Vinnie Falco
5c691c0883 Rename to SharedObjectArray
Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
2013-07-15 09:38:11 -07:00
Vinnie Falco
e363cbe542 Add UnsignedInteger class and tests 2013-07-15 09:38:11 -07:00
Vinnie Falco
d8bec0a43c Add module beast_crypto 2013-07-15 09:38:11 -07:00
Vinnie Falco
e1c176ceb7 Added StringArray::ensureStorageAllocated 2013-07-15 09:38:09 -07:00
Vinnie Falco
a1289eb502 Use template for UnitTest 2013-07-15 09:38:09 -07:00
Vinnie Falco
4a00e8feed Adjust UnitTest output 2013-07-15 09:38:08 -07:00
Vinnie Falco
60e0e5c38f Move UnitTest to diagnostic 2013-07-15 09:38:07 -07:00
Vinnie Falco
93ef4f2301 Rename to SharedObject 2013-07-15 09:38:07 -07:00
Vinnie Falco
ccda3068ef Remove deprecated SharedObject 2013-07-15 09:38:06 -07:00
Vinnie Falco
ebad05a9df Add DeadlineTimer member docs 2013-07-15 09:38:06 -07:00
Vinnie Falco
4f19ea4a8e Fix warning 2013-07-12 14:43:06 -07:00
Vinnie Falco
8e2722da95 Improve DeadlineTimer 2013-07-10 09:51:32 -07:00
Vinnie Falco
b5fbcfaa8e Replace deprecated GetVersionEx Win32 call 2013-07-10 09:51:32 -07:00
Vinnie Falco
d0ea813515 Add timer parameter to DeadlineTimer callback 2013-07-10 09:51:31 -07:00
Vinnie Falco
932bc382dc Update TODO 2013-07-10 09:51:29 -07:00
Vinnie Falco
bdfb19fe38 Add DeadlineTimer class 2013-07-10 09:51:28 -07:00
Vinnie Falco
d798330f44 Update documentation for member 2013-07-10 09:51:27 -07:00
Vinnie Falco
caa3a5d0bb Replace calls to deprecated siginterrupt() 2013-07-10 09:51:26 -07:00
Vinnie Falco
d54a5c49c1 Fix warnings and errors 2013-07-10 09:51:25 -07:00
Vinnie Falco
9e75075dc4 Adjust a comment 2013-07-10 09:51:24 -07:00
Vinnie Falco
6a833e19aa Add Objective C++ beast_basics compile unit 2013-07-10 09:51:23 -07:00
Vinnie Falco
941ac2ae5e Fix compile error for two phase lookup 2013-07-10 09:51:23 -07:00
JoelKatz
34f4b3cad4 beast, not BEAST 2013-07-03 18:39:49 -07:00
Vinnie Falco
03948cd685 Various beast cleanups 2013-07-03 10:07:46 -07:00
Vinnie Falco
3c993884cd Fix beast macro calls 2013-07-03 10:05:43 -07:00
Vinnie Falco
9e99aed182 Add neverDestroyed lifetime for SharedSingleton 2013-07-03 09:41:46 -07:00
Vinnie Falco
66edf2822c Fix for atomic aliasing in Clang or GCC builds 2013-07-03 09:41:46 -07:00
Vinnie Falco
9c9ba18619 constness fix in OwnedArray 2013-07-03 09:41:46 -07:00
Vinnie Falco
485d048415 Update some beast container code 2013-07-03 09:41:44 -07:00
Alex Dupre
10a0db9160 Linux implementation of isRunningUnderDebugger using ptrace() doesn't work on FreeBSD.
(I doubt it'll work on Linux, too, but I'm not sure)
2013-07-03 09:41:43 -07:00
Alex Dupre
8260b75586 FreeBSD tuning. 2013-07-03 09:41:43 -07:00
Vinnie Falco
8365ed7408 Remove ConcurrentObject and rename to SharedData 2013-07-01 09:32:08 -07:00
Vinnie Falco
d4298d1bd2 Tidy up List documentation 2013-07-01 09:32:07 -07:00
Vinnie Falco
75736f547a Tidy up LeakChecked and configuration macro 2013-07-01 09:32:07 -07:00
Vinnie Falco
e84b524fc4 Default MSVC CRT Debug heap leak checks to ON 2013-07-01 09:32:07 -07:00
Vinnie Falco
7eb80615c7 Tidy up project file 2013-07-01 09:32:06 -07:00
Vinnie Falco
030c763549 Remove beast::Singleton 2013-07-01 09:32:05 -07:00
Vinnie Falco
57d0e556d8 Fix File::nonexistent false leak using SharedSingleton 2013-07-01 09:32:05 -07:00
Vinnie Falco
3fea8a4202 Rename SharedSingleton and move files around 2013-07-01 09:32:05 -07:00
Vinnie Falco
ca1eda2df1 Use LeakChecked throughout Beast 2013-07-01 09:32:04 -07:00
Vinnie Falco
386fea5e71 Tidy up and activate the MSVC Debug Heap 2013-07-01 09:32:03 -07:00
Vinnie Falco
e7bda30506 Large tidying up of Beast
- Move key classes into beast_core
- Tidy up various macros and files
- Disable leaking FifoFreeStoreWithTLS
2013-07-01 09:32:03 -07:00
Vinnie Falco
6dcf61669c Return object in OwnedArray add routines 2013-07-01 09:32:02 -07:00
Alex Dupre
1832463010 Implement MACAddress::findAllAddresses as in MacOSX. 2013-06-29 10:04:27 +02:00
Alex Dupre
a0baaeafd1 Use nanosleep on FreeBSD, instead of failing because clock_nanosleep is missing. 2013-06-29 10:02:51 +02:00
Vinnie Falco
c5a113ca80 Put boost placeholders in a namespace (hack) 2013-06-28 17:01:04 -07:00
Vinnie Falco
e6b3ded33f Lift cref into beast namespace 2013-06-28 17:01:03 -07:00
Vinnie Falco
aa66af151a Roll back 7 commits 2013-06-28 11:48:43 -07:00
Vinnie Falco
ab57495e29 Hack to put boost placeholders in a namespace 2013-06-28 10:19:40 -07:00
Vinnie Falco
afb5d161e3 Annotate bind 2013-06-28 08:11:04 -07:00
Vinnie Falco
1fdaafb30b Lift cref into beast namespace 2013-06-28 07:02:48 -07:00
Vinnie Falco
9328e6fdec Improve bind, placeholder, and function support 2013-06-28 07:02:47 -07:00
Vinnie Falco
98ac0697a9 Add default EntryPoints 2013-06-28 07:02:47 -07:00
Vinnie Falco
b658f82510 Fix for UTF32 strings 2013-06-27 11:52:09 -07:00
Vinnie Falco
b50894fa70 Fix UTF32 string creation 2013-06-27 07:23:45 -07:00
Vinnie Falco
e002000764 Fix assertion 2013-06-26 17:42:48 -07:00
Vinnie Falco
9182c1558c Update Beast ReadMe 2013-06-26 17:42:47 -07:00
Vinnie Falco
ded7eca60f Fix false assertion 2013-06-26 17:42:47 -07:00
Vinnie Falco
74e8c881f7 Add missing native BSD support for Beast 2013-06-26 09:24:44 -07:00
Alex Dupre
f1eac72d20 Fix compilation on FreeBSD. 2013-06-26 12:02:22 +02:00
Vinnie Falco
6d13ddd43a Fix Clang static analysis warnings 2013-06-26 00:19:41 -07:00
Vinnie Falco
94e9632234 Add override specifier to some Beast functions 2013-06-24 15:51:32 -07:00
Vinnie Falco
3699b74ebb Alternate thread naming for older GLIBC 2013-06-24 15:07:09 -07:00
Vinnie Falco
4eeab3bc3e Remove unused Beast configuration macros 2013-06-24 09:40:17 -07:00
Vinnie Falco
0d1ded5278 Avoid using pthread_setname_np on older linux distros 2013-06-23 11:09:53 -07:00
Vinnie Falco
86142ecdf1 Add BEAST_ARM macro to detect ARM platforms 2013-06-23 09:18:58 -07:00
Vinnie Falco
8cdc00230d Add BEAST_FILEANDLINE_ macro for warning pragmas 2013-06-23 09:18:58 -07:00
Vinnie Falco
d3d674ba4b Beast fixes for FreeBSD 2013-06-20 13:38:44 -07:00
Vinnie Falco
6d961d87f8 Add beast_basics and remove unused modules from build 2013-06-17 09:38:16 -07:00
Vinnie Falco
5a28c54505 Update Beast copyright and various tidying 2013-06-17 09:28:43 -07:00
Vinnie Falco
9968101d96 Add Doxyfile 2013-06-17 07:09:34 -07:00
Vinnie Falco
d0a309e6da Add beast_basics module 2013-06-17 07:09:33 -07:00
Vinnie Falco
f2d84f0a90 Add Beast fork from JUCE commit 265fb0e8ebc26e1469d6edcc68d2ca9acefeb508 2013-06-16 16:57:52 -07:00
Vinnie Falco
d81345d8f6 Update CodingStyle document 2013-06-06 21:43:22 -07:00
Vinnie Falco
97b6260c9a Use beast::ScopedPointer to hold IFeeVote in Application 2013-06-02 08:55:07 -07:00
Vinnie Falco
48cf78af68 Beast initial commit 2013-06-02 08:55:07 -07:00
2426 changed files with 263692 additions and 211214 deletions

17
.gitignore vendored
View File

@@ -1,5 +1,9 @@
# .gitignore
bin/boostbook_catalog.xml
bin/config.log
bin/project-cache.jam
# Ignore vim swap files.
*.swp
@@ -73,10 +77,6 @@ DerivedData
# Intel Parallel Studio 2013 XE
My Amplifier XE Results - RippleD
# KeyvaDB files
*.key
*.val
# Compiler intermediate output
/out.txt
@@ -85,3 +85,12 @@ rippled-build.log
# Profiling data
gmon.out
Builds/VisualStudio2015/*.db
Builds/VisualStudio2015/*.user
Builds/VisualStudio2015/*.opendb
Builds/VisualStudio2015/*.sdf
# MSVC
*.pdb
.vs/

12
.gitmodules vendored Normal file
View File

@@ -0,0 +1,12 @@
[submodule "docs/docca"]
path = docs/docca
url = https://github.com/vinniefalco/docca.git
[submodule "src/nudb/extras/beast"]
path = src/nudb/extras/beast
url = https://github.com/vinniefalco/Beast.git
[submodule "src/nudb/extras/rocksdb"]
path = src/nudb/extras/rocksdb
url = https://github.com/facebook/rocksdb.git
[submodule "src/nudb/doc/docca"]
path = src/nudb/doc/docca
url = https://github.com/vinniefalco/docca.git

View File

@@ -3,72 +3,65 @@ language: cpp
env:
global:
- LLVM_VERSION=3.8.0
# Maintenance note: to move to a new version
# of boost, update both BOOST_ROOT and BOOST_URL.
# Note that for simplicity, BOOST_ROOT's final
# namepart must match the folder name internal
# to boost's .tar.gz.
- BOOST_ROOT=$HOME/boost_1_59_0
- BOOST_URL='http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.59.0%2Fboost_1_59_0.tar.gz%2Fdownload&ts=1441761349&use_mirror=skylineservers'
- LCOV_ROOT=$HOME/lcov
- BOOST_ROOT=$HOME/boost_1_60_0
- BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz'
packages: &gcc5_pkgs
- gcc-5
- g++-5
- python-software-properties
- protobuf-compiler
- libprotobuf-dev
- libssl-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
packages: &clang36_pkgs
- clang-3.6
- g++-5
- python-software-properties
- protobuf-compiler
- libprotobuf-dev
- libssl-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages:
- gcc-5
- g++-5
- python-software-properties
- protobuf-compiler
- libprotobuf-dev
- libssl-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
matrix:
include:
# Default BUILD is "scons".
- compiler: gcc
env: GCC_VER=5 TARGET=debug.nounity
addons: &ao_gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: *gcc5_pkgs
env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity PATH=$PWD/cmake/bin:$PATH
- compiler: gcc
env: GCC_VER=5 TARGET=coverage
addons: *ao_gcc5
- compiler: clang
env: GCC_VER=5 TARGET=debug CLANG_VER=3.6
addons: &ao_clang36
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: *clang36_pkgs
env: GCC_VER=5 TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
- compiler: clang
env: GCC_VER=5 TARGET=debug.nounity CLANG_VER=3.6
addons: *ao_clang36
env: GCC_VER=5 TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
# The clang cmake builds do not link.
# - compiler: clang
# env: GCC_VER=5 BUILD=cmake TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH
# - compiler: clang
# env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PWD/cmake/bin:$PATH
cache:
directories:
- $BOOST_ROOT
- llvm-$LLVM_VERSION
- cmake
before_install:
- bin/ci/ubuntu/install-dependencies.sh
script:
- bin/ci/ubuntu/build-and-test.sh
- travis_retry bin/ci/ubuntu/build-and-test.sh
notifications:
email:

View File

@@ -9,7 +9,6 @@ url="https://github.com/ripple/rippled"
license=('custom:ISC')
depends=('protobuf' 'openssl' 'boost-libs')
makedepends=('git' 'scons' 'boost')
checkdepends=('nodejs')
backup=("etc/$pkgname/rippled.cfg")
source=("git://github.com/ripple/rippled.git#branch=master")
sha512sums=('SKIP')
@@ -26,8 +25,6 @@ build() {
check() {
cd "$srcdir/$pkgname"
npm install
npm test
build/rippled --unittest
}

View File

@@ -0,0 +1,658 @@
# This is a set of common functions and settings for rippled
# and derived products.
############################################################
cmake_minimum_required(VERSION 3.1.0)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(WARNING "Builds are strongly discouraged in "
"${CMAKE_SOURCE_DIR}.")
endif()
macro(parse_target)
if (NOT target AND NOT CMAKE_BUILD_TYPE)
if (APPLE)
set(target clang.debug)
elseif(WIN32)
set(target msvc)
else()
set(target gcc.debug)
endif()
endif()
if (target)
# Parse the target
set(remaining ${target})
while (remaining)
# get the component up to the next dot or end
string(REGEX REPLACE "^\\.?([^\\.]+).*$" "\\1" cur_component ${remaining})
string(REGEX REPLACE "^\\.?[^\\.]+(.*$)" "\\1" remaining ${remaining})
if (${cur_component} STREQUAL gcc)
if (DEFINED ENV{GNU_CC})
set(CMAKE_C_COMPILER $ENV{GNU_CC})
elseif ($ENV{CXX} MATCHES .*gcc.*)
set(CMAKE_CXX_COMPILER $ENV{CC})
else()
find_program(CMAKE_C_COMPILER gcc)
endif()
if (DEFINED ENV{GNU_CXX})
set(CMAKE_C_COMPILER $ENV{GNU_CXX})
elseif ($ENV{CXX} MATCHES .*g\\+\\+.*)
set(CMAKE_C_COMPILER $ENV{CC})
else()
find_program(CMAKE_CXX_COMPILER g++)
endif()
endif()
if (${cur_component} STREQUAL clang)
if (DEFINED ENV{CLANG_CC})
set(CMAKE_C_COMPILER $ENV{CLANG_CC})
elseif ($ENV{CXX} MATCHES .*clang.*)
set(CMAKE_CXX_COMPILER $ENV{CC})
else()
find_program(CMAKE_C_COMPILER clang)
endif()
if (DEFINED ENV{CLANG_CXX})
set(CMAKE_C_COMPILER $ENV{CLANG_CXX})
elseif ($ENV{CXX} MATCHES .*clang.*)
set(CMAKE_C_COMPILER $ENV{CC})
else()
find_program(CMAKE_CXX_COMPILER clang++)
endif()
endif()
if (${cur_component} STREQUAL msvc)
# TBD
endif()
if (${cur_component} STREQUAL unity)
set(unity true)
set(nonunity false)
endif()
if (${cur_component} STREQUAL nounity)
set(unity false)
set(nonunity true)
endif()
if (${cur_component} STREQUAL debug)
set(release false)
endif()
if (${cur_component} STREQUAL release)
set(release true)
endif()
if (${cur_component} STREQUAL coverage)
set(coverage true)
set(debug true)
endif()
if (${cur_component} STREQUAL profile)
set(profile true)
endif()
if (${cur_component} STREQUAL ci)
# Workarounds that make various CI builds work, but that
# we don't want in the general case.
set(ci true)
set(openssl_min 1.0.1)
endif()
endwhile()
if (release)
set(CMAKE_BUILD_TYPE Release)
else()
set(CMAKE_BUILD_TYPE Debug)
endif()
if (NOT unity)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}Classic)
endif()
endif()
endmacro()
############################################################
macro(setup_build_cache)
set(san "" CACHE STRING "On gcc & clang, add sanitizer
instrumentation")
set_property(CACHE san PROPERTY STRINGS ";address;thread")
set(assert false CACHE BOOL "Enables asserts, even in release builds")
set(static false CACHE BOOL
"On linux, link protobuf, openssl, libc++, and boost statically")
if (static AND (WIN32 OR APPLE))
message(FATAL_ERROR "Static linking is only supported on linux.")
endif()
if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# Can't exclude files from configurations, so can't support both
# unity and nonunity configurations at the same time
if (NOT DEFINED unity OR unity)
set(CMAKE_CONFIGURATION_TYPES
Debug
Release)
else()
set(CMAKE_CONFIGURATION_TYPES
DebugClassic
ReleaseClassic)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_BUILD_TYPE DebugClassic)
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(CMAKE_BUILD_TYPE ReleaseClassic)
endif()
endif()
set(CMAKE_CONFIGURATION_TYPES
${CMAKE_CONFIGURATION_TYPES} CACHE STRING "" FORCE)
endmacro()
############################################################
function(prepend var prefix)
set(listVar "")
foreach(f ${ARGN})
list(APPEND listVar "${prefix}${f}")
endforeach(f)
set(${var} "${listVar}" PARENT_SCOPE)
endfunction()
macro(append_flags name)
foreach (arg ${ARGN})
set(${name} "${${name}} ${arg}")
endforeach()
endmacro()
macro(group_sources curdir)
file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir}
${PROJECT_SOURCE_DIR}/${curdir}/*)
foreach (child ${children})
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
group_sources(${curdir}/${child})
else()
string(REPLACE "/" "\\" groupname ${curdir})
source_group(${groupname} FILES
${PROJECT_SOURCE_DIR}/${curdir}/${child})
endif()
endforeach()
endmacro()
macro(add_with_props src_var files)
list(APPEND ${src_var} ${files})
foreach (arg ${ARGN})
set(props "${props} ${arg}")
endforeach()
set_source_files_properties(
${files}
PROPERTIES COMPILE_FLAGS
${props})
endmacro()
############################################################
macro(determine_build_type)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang") # both Clang and AppleClang
set(is_clang true)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(is_gcc true)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(is_msvc true)
endif()
if (${CMAKE_GENERATOR} STREQUAL "Xcode")
set(is_xcode true)
else()
set(is_xcode false)
endif()
if (NOT is_gcc AND NOT is_clang AND NOT is_msvc)
message("Current compiler is ${CMAKE_CXX_COMPILER_ID}")
message(FATAL_ERROR "Missing compiler. Must be GNU, Clang, or MSVC")
endif()
endmacro()
############################################################
macro(check_gcc4_abi)
# Check if should use gcc4's ABI
set(gcc4_abi false)
if ($ENV{RIPPLED_OLD_GCC_ABI})
set(gcc4_abi true)
endif()
if (is_gcc AND NOT gcc4_abi)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5)
execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE lsb)
string(STRIP "${lsb}" lsb)
if ("${lsb}" STREQUAL "Ubuntu")
execute_process(COMMAND lsb_release -sr OUTPUT_VARIABLE lsb)
string(STRIP ${lsb} lsb)
if (${lsb} VERSION_LESS 15.1)
set(gcc4_abi true)
endif()
endif()
endif()
endif()
if (gcc4_abi)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
endif()
endmacro()
############################################################
macro(special_build_flags)
if (coverage)
add_compile_options(-fprofile-arcs -ftest-coverage)
append_flags(CMAKE_EXE_LINKER_FLAGS -fprofile-arcs -ftest-coverage)
endif()
if (profile)
add_compile_options(-p -pg)
append_flags(CMAKE_EXE_LINKER_FLAGS -p -pg)
endif()
endmacro()
############################################################
# Params: Boost components to search for.
macro(use_boost)
if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT}))
set(BOOST_ROOT $ENV{BOOST_ROOT})
endif()
if(WIN32 OR CYGWIN)
# Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders
if(DEFINED BOOST_ROOT)
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND IS_DIRECTORY ${BOOST_ROOT}/stage64/lib)
set(Boost_LIBRARY_DIR ${BOOST_ROOT}/stage64/lib)
else()
set(Boost_LIBRARY_DIR ${BOOST_ROOT}/stage/lib)
endif()
endif()
endif()
if (is_clang AND DEFINED ENV{CLANG_BOOST_ROOT})
set(BOOST_ROOT $ENV{CLANG_BOOST_ROOT})
endif()
set(Boost_USE_STATIC_LIBS on)
set(Boost_USE_MULTITHREADED on)
set(Boost_USE_STATIC_RUNTIME off)
find_package(Boost COMPONENTS
${ARGN})
if (Boost_FOUND OR
((CYGWIN OR WIN32) AND Boost_INCLUDE_DIRS AND Boost_LIBRARY_DIRS))
if(NOT Boost_FOUND)
message(WARNING "Boost directory found, but not all components. May not be able to build.")
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
else()
message(FATAL_ERROR "Boost not found")
endif()
endmacro()
macro(use_pthread)
if (NOT WIN32)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
add_compile_options(${CMAKE_THREAD_LIBS_INIT})
endif()
endmacro()
macro(use_openssl openssl_min)
if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR})
find_program(HOMEBREW brew)
if (NOT HOMEBREW STREQUAL "HOMEBREW-NOTFOUND")
execute_process(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
if (WIN32)
if (DEFINED ENV{OPENSSL_ROOT})
include_directories($ENV{OPENSSL_ROOT}/include)
link_directories($ENV{OPENSSL_ROOT}/lib)
endif()
else()
if (static)
set(tmp CMAKE_FIND_LIBRARY_SUFFIXES)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
find_package(OpenSSL)
if (static)
set(CMAKE_FIND_LIBRARY_SUFFIXES tmp)
endif()
if (OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
message(FATAL_ERROR "OpenSSL not found")
endif()
if (UNIX AND NOT APPLE AND ${OPENSSL_VERSION} VERSION_LESS ${openssl_min})
message(FATAL_ERROR
"Your openssl is Version: ${OPENSSL_VERSION}, ${openssl_min} or better is required.")
endif()
endif()
endmacro()
macro(use_protobuf)
if (WIN32)
if (DEFINED ENV{PROTOBUF_ROOT})
include_directories($ENV{PROTOBUF_ROOT}/src)
link_directories($ENV{PROTOBUF_ROOT}/src/.libs)
endif()
# Modified from FindProtobuf.cmake
FUNCTION(PROTOBUF_GENERATE_CPP SRCS HDRS PROTOFILES)
# argument parsing
IF(NOT PROTOFILES)
MESSAGE(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
RETURN()
ENDIF()
SET(OUTPATH ${CMAKE_CURRENT_BINARY_DIR})
SET(PROTOROOT ${CMAKE_CURRENT_SOURCE_DIR})
# the real logic
SET(${SRCS})
SET(${HDRS})
FOREACH(PROTOFILE ${PROTOFILES})
# ensure that the file ends with .proto
STRING(REGEX MATCH "\\.proto$$" PROTOEND ${PROTOFILE})
IF(NOT PROTOEND)
MESSAGE(SEND_ERROR "Proto file '${PROTOFILE}' does not end with .proto")
ENDIF()
GET_FILENAME_COMPONENT(PROTO_PATH ${PROTOFILE} PATH)
GET_FILENAME_COMPONENT(ABS_FILE ${PROTOFILE} ABSOLUTE)
GET_FILENAME_COMPONENT(FILE_WE ${PROTOFILE} NAME_WE)
STRING(REGEX MATCH "^${PROTOROOT}" IN_ROOT_PATH ${PROTOFILE})
STRING(REGEX MATCH "^${PROTOROOT}" IN_ROOT_ABS_FILE ${ABS_FILE})
IF(IN_ROOT_PATH)
SET(MATCH_PATH ${PROTOFILE})
ELSEIF(IN_ROOT_ABS_FILE)
SET(MATCH_PATH ${ABS_FILE})
ELSE()
MESSAGE(SEND_ERROR "Proto file '${PROTOFILE}' is not in protoroot '${PROTOROOT}'")
ENDIF()
# build the result file name
STRING(REGEX REPLACE "^${PROTOROOT}(/?)" "" ROOT_CLEANED_FILE ${MATCH_PATH})
STRING(REGEX REPLACE "\\.proto$$" "" EXT_CLEANED_FILE ${ROOT_CLEANED_FILE})
SET(CPP_FILE "${OUTPATH}/${EXT_CLEANED_FILE}.pb.cc")
SET(H_FILE "${OUTPATH}/${EXT_CLEANED_FILE}.pb.h")
LIST(APPEND ${SRCS} "${CPP_FILE}")
LIST(APPEND ${HDRS} "${H_FILE}")
ADD_CUSTOM_COMMAND(
OUTPUT "${CPP_FILE}" "${H_FILE}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPATH}
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS "--cpp_out=${OUTPATH}" --proto_path "${PROTOROOT}" "${MATCH_PATH}"
DEPENDS ${ABS_FILE}
COMMENT "Running C++ protocol buffer compiler on ${MATCH_PATH} with root ${PROTOROOT}, generating: ${CPP_FILE}"
VERBATIM)
ENDFOREACH()
SET_SOURCE_FILES_PROPERTIES(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
SET(${SRCS} ${${SRCS}} PARENT_SCOPE)
SET(${HDRS} ${${HDRS}} PARENT_SCOPE)
ENDFUNCTION()
set(PROTOBUF_PROTOC_EXECUTABLE Protoc) # must be on path
else()
if (static)
set(tmp CMAKE_FIND_LIBRARY_SUFFIXES)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
find_package(Protobuf REQUIRED)
if (static)
set(CMAKE_FIND_LIBRARY_SUFFIXES tmp)
endif()
if (is_clang AND DEFINED ENV{CLANG_PROTOBUF_ROOT})
link_directories($ENV{CLANG_PROTOBUF_ROOT}/src/.libs)
include_directories($ENV{CLANG_PROTOBUF_ROOT}/src)
else()
include_directories(${PROTOBUF_INCLUDE_DIRS})
endif()
endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB ripple_proto src/ripple/proto/*.proto)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${ripple_proto})
if (WIN32)
include_directories(src/protobuf/src
src/protobuf/vsprojects
${CMAKE_CURRENT_BINARY_DIR}/src/ripple/proto)
endif()
endmacro()
############################################################
macro(setup_build_boilerplate)
if (NOT WIN32 AND san)
add_compile_options(-fsanitize=${san} -fno-omit-frame-pointer)
append_flags(CMAKE_EXE_LINKER_FLAGS
-fsanitize=${san})
string(TOLOWER ${san} ci_san)
if (${ci_san} STREQUAL address)
set(SANITIZER_LIBRARIES asan)
add_definitions(-DSANITIZER=ASAN)
endif()
if (${ci_san} STREQUAL thread)
set(SANITIZER_LIBRARIES tsan)
add_definitions(-DSANITIZER=TSAN)
endif()
endif()
############################################################
add_definitions(
-DOPENSSL_NO_SSL2
-DDEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
-DHAVE_USLEEP=1
-DSOCI_CXX_C11=1
-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
-DBOOST_NO_AUTO_PTR
)
if (is_gcc)
add_compile_options(-Wno-unused-but-set-variable -Wno-deprecated)
endif()
# Generator expressions are not supported in add_definitions, use set_property instead
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:DEBUG _DEBUG>)
if (NOT assert)
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS
$<$<OR:$<BOOL:${profile}>,$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:NDEBUG>)
endif()
if (NOT WIN32)
add_definitions(-D_FILE_OFFSET_BITS=64)
append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof
-DBOOST_COROUTINE_NO_DEPRECATION_WARNING -DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
add_compile_options(-Wall -Wno-sign-compare -Wno-char-subscripts -Wno-format
-Wno-unused-local-typedefs -g)
# There seems to be an issue using generator experssions with multiple values,
# split the expression
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:-O3>)
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:-fno-strict-aliasing>)
append_flags(CMAKE_EXE_LINKER_FLAGS -rdynamic -g)
if (is_clang)
add_compile_options(
-Wno-redeclared-class-member -Wno-mismatched-tags -Wno-deprecated-register)
add_definitions(-DBOOST_ASIO_HAS_STD_ARRAY)
endif()
if (APPLE)
add_definitions(-DBEAST_COMPILE_OBJECTIVE_CPP=1
-DNO_LOG_UNHANDLED_EXCEPTIONS)
add_compile_options(
-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-variable -Wno-unused-function)
endif()
if (is_gcc)
add_compile_options(-Wno-unused-but-set-variable -Wno-unused-local-typedefs)
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:-O0>)
endif (is_gcc)
else(NOT WIN32)
add_compile_options(
/bigobj # Increase object file max size
/EHa # ExceptionHandling all
/fp:precise # Floating point behavior
/Gd # __cdecl calling convention
/Gm- # Minimal rebuild: disabled
/GR # Enable RTTI
/Gy- # Function level linking: disabled
/FS
/MP # Multiprocessor compilation
/openmp- # pragma omp: disabled
/Zc:forScope # Language extension: for scope
/Zi # Generate complete debug info
/errorReport:none # No error reporting to Internet
/nologo # Suppress login banner
/W3 # Warning level 3
/WX- # Disable warnings as errors
/wd"4018"
/wd"4244"
/wd"4267"
/wd"4800" # Disable C4800(int to bool performance)
/wd"4503" # Decorated name length exceeded, name was truncated
)
add_definitions(
-D_WIN32_WINNT=0x6000
-D_SCL_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS
-DWIN32_CONSOLE
-DNOMINMAX
-DBOOST_COROUTINE_NO_DEPRECATION_WARNING
-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
append_flags(CMAKE_EXE_LINKER_FLAGS
/DEBUG
/DYNAMICBASE
/ERRORREPORT:NONE
/MACHINE:X64
/MANIFEST
/nologo
/NXCOMPAT
/SUBSYSTEM:CONSOLE
/TLBID:1)
# There seems to be an issue using generator experssions with multiple values,
# split the expression
# /GS Buffers security check: enable
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/GS>)
# /MTd Language: Multi-threaded Debug CRT
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/MTd>)
# /Od Optimization: Disabled
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/Od>)
# /RTC1 Run-time error checks:
add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:/RTC1>)
# Generator expressions are not supported in add_definitions, use set_property instead
set_property(
DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:_CRTDBG_MAP_ALLOC>)
# /MT Language: Multi-threaded CRT
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:/MT>)
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:/Ox>)
# /Ox Optimization: Full
endif (NOT WIN32)
if (static)
append_flags(CMAKE_EXE_LINKER_FLAGS -static-libstdc++)
# set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_START_STATIC 1)
# set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_END_STATIC 1)
endif()
endmacro()
############################################################
macro(create_build_folder cur_project)
if (NOT WIN32)
ADD_CUSTOM_TARGET(build_folder ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Creating build output folder")
add_dependencies(${cur_project} build_folder)
endif()
endmacro()
macro(set_startup_project cur_project)
if (WIN32 AND NOT ci)
if (CMAKE_VERSION VERSION_LESS 3.6)
message(WARNING
"Setting the VS startup project requires cmake 3.6 or later. Please upgrade.")
endif()
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY
VS_STARTUP_PROJECT ${cur_project})
endif()
endmacro()
macro(link_common_libraries cur_project)
if (NOT MSVC)
target_link_libraries(${cur_project} ${Boost_LIBRARIES})
target_link_libraries(${cur_project} dl)
target_link_libraries(${cur_project} Threads::Threads)
if (APPLE)
find_library(app_kit AppKit)
find_library(foundation Foundation)
target_link_libraries(${cur_project}
crypto ssl ${app_kit} ${foundation})
else()
target_link_libraries(${cur_project} rt)
endif()
else(NOT MSVC)
target_link_libraries(${cur_project}
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:VC/static/ssleay32MTd>
$<$<OR:$<CONFIG:Debug>,$<CONFIG:DebugClassic>>:VC/static/libeay32MTd>)
target_link_libraries(${cur_project}
$<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:VC/static/ssleay32MT>
$<$<OR:$<CONFIG:Release>,$<CONFIG:ReleaseClassic>>:VC/static/libeay32MT>)
target_link_libraries(${cur_project}
legacy_stdio_definitions.lib Shlwapi kernel32 user32 gdi32 winspool comdlg32
advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32)
endif (NOT MSVC)
endmacro()

View File

@@ -48,18 +48,39 @@ import itertools
import os
import platform
import re
import subprocess
import shutil
import sys
import subprocess
def powerset(iterable):
"""powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"""
s = list(iterable)
return itertools.chain.from_iterable(itertools.combinations(s, r) for r in range(len(s) + 1))
IS_WINDOWS = platform.system().lower() == 'windows'
IS_OS_X = platform.system().lower() == 'darwin'
if IS_WINDOWS:
BINARY_RE = re.compile(r'build\\([^\\]+)\\rippled.exe')
if IS_WINDOWS or IS_OS_X:
ALL_TARGETS = [('debug',), ('release',)]
else:
BINARY_RE = re.compile(r'build/([^/]+)/rippled')
ALL_TARGETS = [(cc + "." + target,)
for cc in ['gcc', 'clang']
for target in ['debug', 'release', 'coverage', 'profile',
'debug.nounity', 'release.nounity', 'coverage.nounity', 'profile.nounity']]
ALL_TARGETS = ['debug', 'release']
# list of tuples of all possible options
if IS_WINDOWS or IS_OS_X:
ALL_OPTIONS = [tuple(x) for x in powerset(['--assert'])]
else:
ALL_OPTIONS = list(set(
[tuple(x) for x in powerset(['--ninja', '--static', '--assert', '--sanitize=address'])] +
[tuple(x) for x in powerset(['--ninja', '--static', '--assert', '--sanitize=thread'])]))
# list of tuples of all possible options + all possible targets
ALL_BUILDS = [options + target
for target in ALL_TARGETS
for options in ALL_OPTIONS]
parser = argparse.ArgumentParser(
description='Test.py - run ripple tests'
@@ -75,55 +96,68 @@ parser.add_argument(
'--keep_going', '-k',
action='store_true',
help='Keep going after one configuration has failed.',
)
)
parser.add_argument(
'--silent', '-s',
action='store_true',
help='Silence all messages except errors',
)
)
parser.add_argument(
'--verbose', '-v',
action='store_true',
help=('Report more information about which commands are executed and the '
'results.'),
)
)
parser.add_argument(
'--test', '-t',
default='',
help='Add a prefix for unit tests',
)
)
parser.add_argument(
'--clean', '-c',
action='store_true',
help='delete all build artifacts after testing',
)
parser.add_argument(
'scons_args',
default=(),
nargs='*'
)
)
ARGS = parser.parse_args()
def shell(*cmd, **kwds):
"Execute a shell command and return the output."
silent = kwds.pop('silent', ARGS.silent)
verbose = not silent and kwds.pop('verbose', ARGS.verbose)
def shell(cmd, args=(), silent=False):
""""Execute a shell command and return the output."""
silent = ARGS.silent or silent
verbose = not silent and ARGS.verbose
if verbose:
print('$', ' '.join(cmd))
kwds['shell'] = IS_WINDOWS
print('$' + cmd, *args)
command = (cmd,) + args
process = subprocess.Popen(
cmd,
command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
**kwds)
shell=IS_WINDOWS)
lines = []
count = 0
for line in process.stdout:
lines.append(line)
# Python 2 vs. Python 3
if isinstance(line, str):
decoded = line
else:
decoded = line.decode()
lines.append(decoded)
if verbose:
print(line, end='')
print(decoded, end='')
elif not silent:
count += 1
if count >= 80:
@@ -137,27 +171,16 @@ def shell(*cmd, **kwds):
process.wait()
return process.returncode, lines
if __name__ == '__main__':
args = list(ARGS.scons_args)
if ARGS.all:
for a in ALL_TARGETS:
if a not in args:
args.append(a)
print('Building:', *(args or ['(default)']))
# Build everything.
resultcode, lines = shell('scons', *args)
if resultcode:
print('Build FAILED:')
if not ARGS.verbose:
print(*lines, sep='')
exit(1)
# Now extract the executable names and corresponding targets.
def run_tests(args):
failed = []
_, lines = shell('scons', '-n', '--tree=derived', *args, silent=True)
if IS_WINDOWS:
binary_re = re.compile(r'build\\([^\\]+)\\rippled.exe')
else:
binary_re = re.compile(r'build/([^/]+)/rippled')
_, lines = shell('scons', ('-n', '--tree=derived',) + args, silent=True)
for line in lines:
match = BINARY_RE.search(line)
match = binary_re.search(line)
if match:
executable, target = match.group(0, 1)
@@ -165,27 +188,79 @@ if __name__ == '__main__':
testflag = '--unittest'
if ARGS.test:
testflag += ('=' + ARGS.test)
resultcode, lines = shell(executable, (testflag,))
resultcode, lines = shell(executable, testflag)
if resultcode:
print('ERROR:', *lines, sep='')
if not ARGS.verbose:
print('ERROR:', *lines, sep='')
failed.append([target, 'unittest'])
if not ARGS.keep_going:
break
ARGS.verbose and print(*lines, sep='')
print('npm tests for', target)
resultcode, lines = shell('npm', 'test', '--rippled=' + executable)
if resultcode:
print('ERROR:\n', *lines, sep='')
failed.append([target, 'npm'])
if not ARGS.keep_going:
break
else:
ARGS.verbose and print(*lines, sep='')
return failed
if failed:
print('FAILED:', *(':'.join(f) for f in failed))
exit(1)
def run_build(args=None):
print('Building:', *args or ('(default)',))
resultcode, lines = shell('scons', args)
if resultcode:
print('Build FAILED:')
if not ARGS.verbose:
print(*lines, sep='')
sys.exit(1)
if '--ninja' in args:
resultcode, lines = shell('ninja')
if resultcode:
print('Ninja build FAILED:')
if not ARGS.verbose:
print(*lines, sep='')
sys.exit(1)
def main():
if ARGS.all:
to_build = ALL_BUILDS
else:
print('Success')
to_build = [tuple(ARGS.scons_args)]
all_failed = []
for build in to_build:
args = ()
# additional arguments come first
for arg in list(ARGS.scons_args):
if arg not in build:
args += (arg,)
args += build
run_build(args)
failed = run_tests(args)
if failed:
print('FAILED:', *(':'.join(f) for f in failed))
if not ARGS.keep_going:
sys.exit(1)
else:
all_failed.extend([','.join(build), ':'.join(f)]
for f in failed)
else:
print('Success')
if ARGS.clean:
shutil.rmtree('build')
if '--ninja' in args:
os.remove('build.ninja')
os.remove('.ninja_deps')
os.remove('.ninja_log')
if all_failed:
if len(to_build) > 1:
print()
print('FAILED:', *(':'.join(f) for f in all_failed))
sys.exit(1)
if __name__ == '__main__':
main()
sys.exit(0)

View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
#
# This scripts installs boost and protobuf built with clang. This is needed on
# ubuntu 15.10 when building with clang
# It will build these in a 'clang' subdirectory that it creates below the directory
# this script is run from. If a clang directory already exists the script will refuse
# to run.
if hash lsb_release 2>/dev/null; then
if [ $(lsb_release -si) == "Ubuntu" ]; then
ubuntu_release=$(lsb_release -sr)
fi
fi
if [ -z "${ubuntu_release}" ]; then
echo "System not supported"
exit 1
fi
if ! hash clang 2>/dev/null; then
clang_version=3.7
if [ ${ubuntu_release} == "16.04" ]; then
clang_version=3.8
fi
sudo apt-get -y install clang-${clang_version}
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${clang_version} 99 clang++
hash -r
if ! hash clang 2>/dev/null; then
echo "Please install clang"
exit 1
fi
fi
if [ ${ubuntu_release} != "16.04" ] && [ ${ubuntu_release} != "15.10" ]; then
echo "clang specific boost and protobuf not needed"
exit 0
fi
if [ -d clang ]; then
echo "clang directory already exists. Cowardly refusing to run"
exit 1
fi
if ! hash wget 2>/dev/null; then
sudo apt-get -y install wget
hash -r
if ! hash wget 2>/dev/null; then
echo "Please install wget"
exit 1
fi
fi
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # pysical cores
mkdir clang
pushd clang > /dev/null
# Install protobuf
pb=protobuf-2.6.1
pb_tar=${pb}.tar.gz
wget -O ${pb_tar} https://github.com/google/protobuf/releases/download/v2.6.1/${pb_tar}
tar xf ${pb_tar}
rm ${pb_tar}
pushd ${pb} > /dev/null
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++14 -O3 -g'
make -j${num_procs}
popd > /dev/null
# Install boost
boost_ver=1.60.0
bd=boost_${boost_ver//./_}
bd_tar=${bd}.tar.gz
wget -O ${bd_tar} http://sourceforge.net/projects/boost/files/boost/${boost_ver}/${bd_tar}
tar xf ${bd_tar}
rm ${bd_tar}
pushd ${bd} > /dev/null
./bootstrap.sh
./b2 toolset=clang -j${num_procs}
popd > /dev/null
popd > /dev/null

View File

@@ -25,7 +25,7 @@ if [ ${ubuntu_release} == "12.04" ]; then
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get -y upgrade
apt-get -y install curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties boost1.57-all-dev nodejs g++-5 g++-4.9
apt-get -y install curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties boost1.57-all-dev g++-5 g++-4.9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 99 --slave /usr/bin/g++ g++ /usr/bin/g++-5
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 99 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
exit 0
@@ -33,21 +33,21 @@ fi
if [ ${ubuntu_release} == "14.04" ] || [ ${ubuntu_release} == "15.04" ]; then
apt-get install python-software-properties
echo "deb [arch=amd64] https://mirrors.ripple.com/ubuntu/ trusty stable contrib" | sudo tee /etc/apt/sources.list.d/ripple.list
echo "deb [arch=amd64] https://mirrors.ripple.com/ubuntu/ trusty stable contrib" | sudo tee /etc/apt/sources.list.d/ripple.list
wget -O- -q https://mirrors.ripple.com/mirrors.ripple.com.gpg.key | sudo apt-key add -
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get -y upgrade
apt-get -y install curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties boost-all-dev nodejs g++-5 g++-4.9
apt-get -y install curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties boost-all-dev g++-5 g++-4.9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 99 --slave /usr/bin/g++ g++ /usr/bin/g++-5
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 99 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
exit 0
fi
if [ ${ubuntu_release} == "15.10" ]; then
if [ ${ubuntu_release} == "16.04" ] || [ ${ubuntu_release} == "15.10" ]; then
apt-get update
apt-get -y upgrade
apt-get -y install python-software-properties curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties libboost-all-dev nodejs
apt-get -y install python-software-properties curl git scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties libboost-all-dev
exit 0
fi

View File

@@ -17,8 +17,7 @@ software components:
* [Google Protocol Buffers Compiler](README.md#install-google-protocol-buffers-compiler)
* (Optional) [Python and Scons](README.md#optional-install-python-and-scons)
* [OpenSSL Library](README.md#install-openssl)
* [Boost 1.59 library](README.md#build-boost)
* [Node.js](README.md#install-nodejs)
* [Boost library](README.md#build-boost)
## Install Software
@@ -84,8 +83,8 @@ for Visual Studio 2015 support.
[Download OpenSSL.](http://slproweb.com/products/Win32OpenSSL.html)
There will be four variants available:
1. 64-bit. Use this if you are running 64-bit windows. As of this writing, the link is called: "Win64 OpenSSL v1.0.2d".
2. 64-bit light - Don't use this. It is missing files needed to build rippled. As of this writing, the link is called: "Win64 OpenSSL v1.0.2d Light"
1. 64-bit. Use this if you are running 64-bit windows. As of this writing, the link is called: "Win64 OpenSSL v1.0.2j".
2. 64-bit light - Don't use this. It is missing files needed to build rippled. As of this writing, the link is called: "Win64 OpenSSL v1.0.2j Light"
Run the installer, and choose an appropriate location for your OpenSSL
installation. In this guide we use **C:\lib\OpenSSL-Win64** as the
@@ -108,8 +107,13 @@ unpacking it, open a **Developer Command Prompt** for
Visual Studio, change to the directory containing boost, then
bootstrap the build tools:
(As of this writing, the most recent version of boost is 1.62.0, which
will unpack into a directory named `boost_1_62_0`. For higher versions
of boost, adjust the directories provided in these examples as
appropriate.)
```powershell
cd C:\lib\boost_1_59_0
cd C:\lib\boost_1_62_0
bootstrap
```
@@ -119,7 +123,7 @@ affected by changes in outside files. Therefore, it is necessary to build the
required boost static libraries using this command:
```powershell
bjam --toolset=msvc-14.0 --build-type=complete variant=debug,release link=static runtime-link=static address-model=64
bjam --toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared,static stage --stagedir=stage64
```
Building the boost libraries may take considerable time. When the build process
@@ -161,7 +165,7 @@ git checkout master
### Configure Library Paths
Open the solution file located at **Builds/Visual Studio 2015/ripple.sln**
and select the "View->Other Windows->Property Manager" to bring up the Property Manager.
and select the "View->Property Manager" to bring up the Property Manager.
Expand the *debug | x64* section and
double click the *Microsoft.Cpp.x64.user* property sheet to bring up the
*Property Pages* dialog. These are global properties applied to all
@@ -237,9 +241,7 @@ and then choose the **Build->Build Solution** menu item.
# Unit Tests (Recommended)
## Internal
The internal rippled unit tests are written in C++ and are part
The rippled unit tests are written in C++ and are part
of the rippled executable.
From a Windows console, run the unit tests:
@@ -250,108 +252,4 @@ From a Windows console, run the unit tests:
Substitute the correct path to the executable to test different builds.
## External
The external rippled unit tests are written in Javascript using Node.js,
and utilize the mocha unit test framework. To run the unit tests, it
will be necessary to perform the following steps:
### Install Node.js
[Install Node.js](http://nodejs.org/download/). We recommend the Windows
installer (**.msi** file) as it takes care of updating the *PATH* environment
variable so that scripts can find the command. On Windows systems,
**Node.js** comes with **npm**. A separate installation of **npm**
is not necessary.
### Create node_modules
Open a windows console. From the root of your local rippled repository
directory, invoke **npm** to bring in the necessary components:
```
npm install
```
If you get an error that looks like
```
Error: ENOENT, stat 'C:\Users\username\AppData\Roaming\npm'
```
simply create the indicated folder and try again.
### Create a test config.js
From a *bash* shell (installed with Git for Windows), copy the
example configuration file into the appropriate location:
```
cp test/config-example.js test/config.js
```
Edit your version of test/config.js to reflect the correct path to the rippled executable:
```
exports.default_server_config = {
// Where to find the binary.
rippled_path: path.resolve(__dirname, "../build/msvc.debug/rippled.exe")
};
```
Also in **test/config.js**, change any occurrences of the
IP address *0.0.0.0* to *127.0.0.1*.
### Run Tests
From a windows console, run the unit tests:
```
npm test
```
Alternatively, run an individual test using mocha:
```
sh
node_modules/mocha/bin/mocha test/account_tx-test.js
```
* NOTE: The version of ripple-lib provided by the npm install
facility is usually slightly behind the develop branch of the
authoritative ripple-lib repository. Therefore, some tests might fail.
### Development ripple-lib
To use the latest branch of **ripple-lib** during the unit tests,
first clone the repository in a new location outside of your rippled
repository. Then update the submodules. After, run **npm install**
to set up the **node_modules** directory. Finally, install the
**grunt** command line tools required to run **grunt** and
build **ripple-lib**.
```
git clone git@github.com:ripple/ripple-lib.git
cd ripple-lib
git submodule update --init
npm install
npm install -g grunt-cli
grunt
```
Now link this version of **ripple-lib** into the global packages:
```
sudo npm link
```
To make rippled use the newly linked global **ripple-lib** package
instead of the one installed under **node_modules**, change
directories to the local rippled repository and delete the old
**ripple-lib** then link to the new one:
```
sh
rm -rf node_modules/ripple-lib
npm link ripple-lib
```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -1,26 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RippleD", "RippleD.vcxproj", "{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug.classic|x64 = debug.classic|x64
debug.classic|x86 = debug.classic|x86
debug|x64 = debug|x64
debug|x86 = debug|x86
release.classic|x64 = release.classic|x64
release.classic|x86 = release.classic|x86
release|x64 = release|x64
release|x86 = release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x64.ActiveCfg = debug.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x64.Build.0 = debug.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug.classic|x86.ActiveCfg = debug.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x64.ActiveCfg = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x64.Build.0 = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.debug|x86.ActiveCfg = debug|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x64.ActiveCfg = release.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x64.Build.0 = release.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release.classic|x86.ActiveCfg = release.classic|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x64.ActiveCfg = release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x64.Build.0 = release|x64
{26B7D9AC-1A80-8EF8-6703-D061F1BECB75}.release|x86.ActiveCfg = release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

177
Builds/XCode/README.md Normal file
View File

@@ -0,0 +1,177 @@
# macos Build Instructions
## Important
We don't recommend OS X for rippled production use at this time. Currently, the
Ubuntu platform has received the highest level of quality assurance and
testing.
## Prerequisites
You'll need OSX 10.8 or later
To clone the source code repository, create branches for inspection or
modification, build rippled using clang, and run the system tests you will need
these software components:
* [XCode](https://developer.apple.com/xcode/)
* [Homebrew](http://brew.sh/)
* [Git](http://git-scm.com/)
* [Scons](http://www.scons.org/)
## Install Software
### Install XCode
If not already installed on your system, download and install XCode using the
appstore or by using [this link](https://developer.apple.com/xcode/).
For more info, see "Step 1: Download and Install the Command Line Tools"
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac)
The command line tools can be installed through the terminal with the command:
```
xcode-select --install
```
### Install Homebrew
> "[Homebrew](http://brew.sh/) installs the stuff you need that Apple didnt."
Open a terminal and type:
```
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
For more info, see "Step 3: Install Homebrew"
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac)
### Install Git
```
brew update brew install git
```
For more info, see "Step 4: Install Git"
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac)
**NOTE**: To gain full featured access to the
[git-subtree](http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
functionality used in the rippled repository, we suggest Git version 1.8.3.2 or
later.
### Install Scons
Requires version 2.3.0 or later
```
brew install scons
```
`brew` will generally install the latest stable version of any package, which
will satisfy the scons minimum version requirement for rippled.
### Install Package Config
```
brew install pkg-config
```
## Install/Build/Configure Dependencies
### Build Google Protocol Buffers Compiler
Building rippled on osx requires `protoc` version 2.5.x or 2.6.x (later versions
do not work with rippled at this time).
Download [this](https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.bz2)
We want to compile protocol buffers with clang/libc++:
```
tar xfvj protobuf-2.6.1.tar.bz2
cd protobuf-2.6.1
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
make -j 4
sudo make install
```
If you have installed `protobuf` via brew - either directly or indirectly as a
dependency of some other package - this is likely to conflict with our specific
version requirements. The simplest way to avoid conflicts is to uninstall it.
`brew ls --versions protobuf` will list any versions of protobuf
you currently have installed.
### Install OpenSSL
```
brew install openssl
```
### Build Boost
We want to compile boost with clang/libc++
Download [a release](https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2)
Extract it to a folder, making note of where, open a terminal, then:
```
./bootstrap.sh ./b2 toolset=clang threading=multi runtime-link=static link=static cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" address-model=64
```
Create an environment variable `BOOST_ROOT` in one of your `rc` files, pointing
to the root of the extracted directory.
### Clone the rippled repository
From the terminal
```
git clone git@github.com:ripple/rippled.git
cd rippled
```
Choose the master branch or one of the tagged releases listed on
[GitHub](https://github.com/ripple/rippled/releases GitHub).
```
git checkout master
```
or to test the latest release candidate, choose the `release` branch.
```
git checkout release
```
### Configure Library Paths
If you didn't persistently set the `BOOST_ROOT` environment variable to the
root of the extracted directory above, then you should set it temporarily.
For example, assuming your username were `Abigail` and you extracted Boost
1.61.0 in `/Users/Abigail/Downloads/boost_1_61_0`, you would do for any
shell in which you want to build:
```
export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_61_0
```
## Build
```
scons
```
See: [here](https://ripple.com/wiki/Rippled_build_instructions#Building)
## Unit Tests (Recommended)
rippled builds a set of unit tests into the server executable. To run these unit
tests after building, pass the `--unittest` option to the compiled `rippled`
executable. The executable will exit after running the unit tests.

View File

@@ -1 +0,0 @@
Place XCode project file here!

6
Builds/build_all.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # number of physical cores
cd ..
./Builds/Test.py -a -c -- -j${num_procs}

517
CMakeLists.txt Normal file
View File

@@ -0,0 +1,517 @@
# !!! The official build system is SConstruct !!!
# This is an experimental cmake build file for rippled
#
# cmake support in rippled. Currently supports:
#
# * unity/nounity debug/release
# * running protobuf
# * sanitizer builds
# * optional release build with assert turned on
# * `target` variable to easily set compiler/debug/unity
# (i.e. -Dtarget=gcc.debug.nounity)
# * gcc/clang/visual studio/xcode
# * linux/mac/win
# * gcc 4 ABI, when needed
# * ninja builds
# * check openssl version on linux
# * static builds (swd TBD: needs to be tested by building & deploying on different systems)
#
# TBD:
# * jemalloc support
# * count
# * Windows protobuf compiler puts generated file in src directory instead of build directory.
#
# Notes:
# * Use the -G"Visual Studio 14 2015 Win64" generator on Windows. Without this
# a 32-bit project will be created. There is no way to set the generator or
# force a 64-bit build in CMakeLists.txt (setting CMAKE_GENERATOR_PLATFORM won't work).
# The best solution may be to wrap cmake with a script.
#
# * It is not possible to generate a visual studio project on linux or
# mac. The visual studio generator is only available on windows.
#
# * The visual studio project can be _either_ unity or
# non-unity (selected at generation time). It does not appear possible
# to disable compilation based on configuration.
#
# * Language is _much_ worse than python, poor documentation and "quirky"
# language support (for example, generator expressions can only be used
# in limited contexts and seem to work differently based on
# context (set_property can set multiple values, add_compile_options
# can not/or is buggy)
#
# * Could not call out to `sed` because cmake messed with the regular
# expression before calling the external command. I did not see a way
# around this.
#
# * Makefile generators want to be single target. It wants a separate
# directory for each target type. I saw some mentions on the web for
# ways around this bug haven't look into it. The visual studio project
# does support debug/release configurations in the same project (but
# not unity/non-unity).
############################################################
cmake_minimum_required(VERSION 3.1.0)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
set(dir "build")
set(cmd "cmake")
if (target)
set(dir "${dir}/${target}")
set(cmd "${cmd} -Dtarget=${target}")
elseif(CMAKE_BUILD_TYPE)
set(dir "${dir}/${CMAKE_BUILD_TYPE}")
set(cmd "${cmd} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
else()
set(dir "${dir}/default")
endif()
set(cmd "${cmd} ${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR "Builds are not allowed in ${CMAKE_SOURCE_DIR}.\n"
"Instead:\n"
"1) Remove the CMakeCache.txt file and CMakeFiles directory "
"from ${CMAKE_SOURCE_DIR}.\n"
"2) Create a directory to hold your build files, for example: ${dir}.\n"
"3) Change to that directory.\n"
"4) Run cmake targetting ${CMAKE_SOURCE_DIR}, for example: ${cmd}")
endif()
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND
NOT ("${CMAKE_GENERATOR}" MATCHES .*Win64.*))
message(FATAL_ERROR "Visual Studio 32-bit build is unsupported. Use
-G\"${CMAKE_GENERATOR} Win64\"")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/Builds/CMake")
include(CMakeFuncs)
set(openssl_min 1.0.2)
parse_target()
if (NOT DEFINED unity)
set(unity true)
set(nonunity false)
endif()
setup_build_cache()
project(rippled)
if(nonunity)
get_cmake_property(allvars VARIABLES)
string(REGEX MATCHALL "[^;]*(DEBUG|RELEASE)[^;]*" matchvars "${allvars}")
foreach(var IN LISTS matchvars)
string(REGEX REPLACE "(DEBUG|RELEASE)" "\\1CLASSIC" newvar ${var})
set(${newvar} ${${var}})
endforeach()
get_cmake_property(allvars CACHE_VARIABLES)
string(REGEX MATCHALL "[^;]*(DEBUG|RELEASE)[^;]*" matchvars "${allvars}")
foreach(var IN LISTS matchvars)
string(REGEX REPLACE "(DEBUG|RELEASE)" "\\1CLASSIC" newvar ${var})
set(${newvar} ${${var}} CACHE STRING "Copied from ${var}")
endforeach()
endif()
determine_build_type()
check_gcc4_abi()
############################################################
include_directories(
src
src/beast
src/beast/include
src/beast/extras
src/nudb/include
src/soci/src
src/soci/include)
special_build_flags()
############################################################
use_boost(
# resist the temptation to alphabetize these. coroutine
# must come before context.
chrono
coroutine
context
date_time
filesystem
program_options
regex
system
thread)
use_pthread()
use_openssl(${openssl_min})
use_protobuf()
setup_build_boilerplate()
############################################################
if (is_clang)
set(rocks_db_system_header --system-header-prefix=rocksdb2)
else()
unset(rocks_db_system_header)
endif()
set(soci_extra_includes
-I"${CMAKE_SOURCE_DIR}/"src/soci/src/core
-I"${CMAKE_SOURCE_DIR}/"src/soci/include/private
-I"${CMAKE_SOURCE_DIR}/"src/sqlite)
############################################################
# Unity sources
prepend(beast_unity_srcs
src/ripple/beast/unity/
beast_insight_unity.cpp
beast_net_unity.cpp
beast_utility_unity.cpp)
prepend(ripple_unity_srcs
src/ripple/unity/
app_ledger.cpp
app_main.cpp
app_misc.cpp
app_paths.cpp
app_tx.cpp
conditions.cpp
core.cpp
basics.cpp
crypto.cpp
ledger.cpp
net.cpp
overlay.cpp
peerfinder.cpp
json.cpp
protocol.cpp
rpcx.cpp
shamap.cpp
server.cpp)
prepend(test_unity_srcs
src/test/unity/
app_test_unity.cpp
basics_test_unity.cpp
beast_test_unity.cpp
conditions_test_unity.cpp
core_test_unity.cpp
json_test_unity.cpp
ledger_test_unity.cpp
overlay_test_unity.cpp
peerfinder_test_unity.cpp
protocol_test_unity.cpp
resource_test_unity.cpp
rpc_test_unity.cpp
server_test_unity.cpp
shamap_test_unity.cpp
support_unity.cpp)
list(APPEND rippled_src_unity ${beast_unity_srcs} ${ripple_unity_srcs} ${test_unity_srcs})
add_with_props(rippled_src_unity src/test/unity/nodestore_test_unity.cpp
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
add_with_props(rippled_src_unity src/ripple/unity/nodestore.cpp
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
add_with_props(rippled_src_unity src/ripple/unity/soci_ripple.cpp ${soci_extra_includes})
list(APPEND ripple_unity_srcs ${beast_unity_srcs} ${test_unity_srcs}
src/ripple/unity/nodestore.cpp
src/ripple/unity/soci_ripple.cpp
src/test/unity/nodestore_test_unity.cpp)
############################################################
# Non-unity sources
file(GLOB_RECURSE core_srcs src/ripple/core/*.cpp)
add_with_props(rippled_src_nonunity "${core_srcs}"
-I"${CMAKE_SOURCE_DIR}/"src/soci/src/core
-I"${CMAKE_SOURCE_DIR}/"src/sqlite)
set(non_unity_srcs ${core_srcs})
foreach(curdir
beast/clock
beast/container
beast/insight
beast/net
beast/utility
app
basics
conditions
crypto
json
ledger
legacy
net
overlay
peerfinder
protocol
rpc
server
shamap)
file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp)
list(APPEND rippled_src_nonunity "${cursrcs}")
list(APPEND non_unity_srcs "${cursrcs}")
endforeach()
file(GLOB_RECURSE nodestore_srcs src/ripple/nodestore/*.cpp
src/test/nodestore/*.cpp)
add_with_props(rippled_src_nonunity "${nodestore_srcs}"
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
list(APPEND non_unity_srcs "${nodestore_srcs}")
# unit test sources
foreach(curdir
app
basics
beast
conditions
core
json
ledger
nodestore
overlay
peerfinder
protocol
resource
rpc
server
shamap
jtx)
file(GLOB_RECURSE cursrcs src/test/${curdir}/*.cpp)
list(APPEND test_srcs "${cursrcs}")
endforeach()
add_with_props(rippled_src_nonunity "${test_srcs}"
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${rocks_db_system_header})
list(APPEND non_unity_srcs "${test_srcs}")
if(WIN32 OR is_xcode)
# Rippled headers. Only needed for IDEs.
file(GLOB_RECURSE rippled_headers src/*.h src/*.hpp)
list(APPEND rippled_headers Builds/CMake/CMakeFuncs.cmake)
foreach(curdir
beast/asio
beast/core
beast/crypto
beast/cxx17
beast/hash
proto
resource
validators
websocket)
file(GLOB_RECURSE cursrcs src/ripple/${curdir}/*.cpp)
list(APPEND rippled_headers "${cursrcs}")
endforeach()
list(APPEND rippled_src_nonunity "${rippled_headers}")
set_property(
SOURCE ${rippled_headers}
APPEND
PROPERTY HEADER_FILE_ONLY
true)
# Doesn't work
# $<OR:$<CONFIG:Debug>,$<CONFIG:Release>>)
endif()
if (WIN32 OR is_xcode)
# Documentation sources. Only needed for IDEs.
prepend(doc_srcs
docs/
Jamfile.v2
boostbook.dtd
index.xml
main.qbk
quickref.xml
reference.xsl
source.dox)
set_property(
SOURCE ${doc_srcs}
APPEND
PROPERTY HEADER_FILE_ONLY
true)
# Doesn't work
# $<OR:$<CONFIG:Debug>,$<CONFIG:Release>>)
endif()
############################################################
add_with_props(rippled_src_all src/ripple/unity/soci.cpp
${soci_extra_includes})
if (NOT is_msvc)
set(no_unused_w -Wno-unused-function)
else()
unset(no_unused_w)
endif()
add_with_props(rippled_src_all src/ripple/unity/secp256k1.cpp
-I"${CMAKE_SOURCE_DIR}/"src/secp256k1
${no_unused_w}
)
foreach(cursrc
src/ripple/beast/unity/beast_hash_unity.cpp
src/ripple/unity/beast.cpp
src/ripple/unity/lz4.c
src/ripple/unity/protobuf.cpp
src/ripple/unity/ripple.proto.cpp
src/ripple/unity/resource.cpp)
add_with_props(rippled_src_all ${cursrc}
${rocks_db_system_header}
)
endforeach()
if (NOT is_msvc)
set(extra_props -Wno-array-bounds)
else()
unset(extra_props)
endif()
add_with_props(rippled_src_all src/sqlite/sqlite_unity.c
${extra_props})
add_with_props(rippled_src_all src/ripple/unity/ed25519_donna.c
-I"${CMAKE_SOURCE_DIR}/"src/ed25519-donna)
if (is_gcc)
set(no_init_w -Wno-maybe-uninitialized)
else()
unset(no_init_w)
endif()
add_with_props(rippled_src_all src/ripple/unity/rocksdb.cpp
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2
-I"${CMAKE_SOURCE_DIR}/"src/rocksdb2/include
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${no_init_w} ${rocks_db_system_header})
if (NOT is_msvc)
set(no_unused_w -Wno-unused-function)
endif()
add_with_props(rippled_src_all src/ripple/unity/snappy.cpp
-I"${CMAKE_SOURCE_DIR}/"src/snappy/snappy
-I"${CMAKE_SOURCE_DIR}/"src/snappy/config
${no_unused_w})
if (APPLE AND is_clang)
list(APPEND rippled_src_all src/ripple/unity/beastobjc.mm)
endif()
list(APPEND rippled_src_unity "${rippled_src_all}")
list(APPEND rippled_src_nonunity "${rippled_src_all}")
############################################################
if (WIN32 OR is_xcode)
group_sources(src)
group_sources(docs)
group_sources(Builds)
endif()
if(unity)
add_executable(rippled ${rippled_src_unity} ${PROTO_HDRS})
add_executable(rippled_classic EXCLUDE_FROM_ALL ${rippled_src_nonunity} ${PROTO_HDRS})
set(other_target rippled_classic)
else()
add_executable(rippled ${rippled_src_nonunity} ${PROTO_HDRS})
add_executable(rippled_unity EXCLUDE_FROM_ALL ${rippled_src_unity} ${PROTO_HDRS})
set(other_target rippled_unity)
endif()
list(APPEND targets "rippled")
list(APPEND targets ${other_target})
# Not the same as EXCLUDE_FROM_ALL. Prevents Visual Studio from building the
# other_target when the user builds the solution (default when pressing <F7>)
set_property(TARGET ${other_target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD true)
find_program(
B2_EXE
NAMES b2
HINTS ${BOOST_ROOT}
PATHS ${BOOST_ROOT}
DOC "Location of the b2 build executable from Boost")
if(${B2_EXE} STREQUAL "B2_EXE-NOTFOUND")
message(WARNING
"Boost b2 executable not found. docs target will not be buildable")
elseif(NOT BOOST_ROOT)
if(Boost_INCLUDE_DIRS)
set(BOOST_ROOT ${Boost_INCLUDE_DIRS})
else()
get_filename_component(BOOST_ROOT ${B2_EXE} DIRECTORY)
endif()
endif()
# The value for BOOST_ROOT will be determined based on
# 1) The environment BOOST_ROOT
# 2) The Boost_INCLUDE_DIRS found by `get_boost`
# 3) The folder the `b2` executable is found in.
# If those checks don't yield the correct path, BOOST_ROOT
# can be defined on the cmake command line:
# cmake <path> -DBOOST_ROOT=<boost_path>
if(BOOST_ROOT)
set(B2_PARAMS "-sBOOST_ROOT=${BOOST_ROOT}")
endif()
# Find bash to help Windows avoid file association problems
find_program(
BASH_EXE
NAMES bash sh
DOC "Location of the bash shell executable"
)
if(${BASH_EXE} STREQUAL "BASH_EXE-NOTFOUND")
message(WARNING
"Unable to find bash executable. docs target may not be buildable")
set(BASH_EXE "")
endif()
add_custom_target(docs
COMMAND ${CMAKE_COMMAND} -E env "PATH=$ENV{PATH} " ${BASH_EXE} ./makeqbk.sh
COMMAND ${B2_EXE} ${B2_PARAMS}
BYPRODUCTS "${CMAKE_SOURCE_DIR}/docs/html/index.html"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs"
SOURCES "${doc_srcs}"
)
set_startup_project(rippled)
foreach(target IN LISTS targets)
target_link_libraries(${target}
${OPENSSL_LIBRARIES} ${PROTOBUF_LIBRARIES} ${SANITIZER_LIBRARIES})
link_common_libraries(${target})
endforeach()
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(WARNING "Rippled requires a 64 bit target architecture.\n"
"The most likely cause of this warning is trying to build rippled with a 32-bit OS.")
endif()

11
Jamroot Normal file
View File

@@ -0,0 +1,11 @@
#
# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
import boost ;
boost.use-project ;

176
README.md
View File

@@ -1,129 +1,91 @@
![Ripple](/images/ripple.png)
#The Worlds Fastest and Most Secure Payment System
# What is Ripple?
Ripple is a network of computers which use the [Ripple consensus algorithm]
(https://www.youtube.com/watch?v=pj1QVb1vlC0) to atomically settle and record
transactions on a secure distributed database, the Ripple Consensus Ledger
(RCL). Because of its distributed nature, the RCL offers transaction immutability
without a central operator. The RCL contains a built-in currency exchange and its
path-finding algorithm finds competitive exchange rates across order books
and currency pairs.
**What is Ripple?**
### Key Features
- **Distributed**
- Direct account-to-account settlement with no central operator
- Decentralized global market for competitive FX
- **Secure**
- Transactions are cryptographically signed using ECDSA or Ed25519
- Multi-signing capabilities
- **Scalable**
- Capacity to process the worlds cross-border payments volume
- Easy access to liquidity through a competitive FX marketplace
Ripple is the open-source, distributed payment protocol that enables instant
payments with low fees, no chargebacks, and currency flexibility (for example
dollars, yen, euros, bitcoins, or even loyalty points). Businesses of any size
can easily build payment solutions such as banking or remittance apps, and
accelerate the movement of money. Ripple enables the world to move value the
way it moves information on the Internet.
## Cross-border payments
Ripple enables banks to settle cross-border payments in real-time, with
end-to-end transparency, and at lower costs. Banks can provide liquidity
for FX themselves or source it from third parties.
![Ripple Network](images/network.png)
As Ripple adoption grows, so do the number of currencies and counterparties.
Liquidity providers need to maintain accounts with each counterparty for
each currency a capital- and time-intensive endeavor that spreads liquidity
thin. Further, some transactions, such as exotic currency trades, will require
multiple trading parties, who each layer costs to the transaction. Thin
liquidity and many intermediary trading parties make competitive pricing
challenging.
**What is a Gateway?**
![Flow - Direct](images/flow1.png)
Ripple works with gateways: independent businesses which hold customer
deposits in various currencies such as U.S. dollars (USD) or Euros (EUR),
in exchange for providing cryptographically-signed issuances that users can
send and trade with one another in seconds on the Ripple network. Within the
protocol, exchanges between multiple currencies can occur atomically without
any central authority to monitor them. Later, customers can withdraw their
Ripple balances from the gateways that created those issuances.
### XRP as a Bridge Currency
Ripple can bridge even exotic currency pairs directly through XRP. Similar to
USD in todays currency market, XRP allows liquidity providers to focus on
offering competitive FX rates on fewer pairs and adding depth to order books.
Unlike USD, trading through XRP does not require bank accounts, service fees,
counterparty risk, or additional operational costs. By using XRP, liquidity
providers can specialize in certain currency corridors, reduce operational
costs, and ultimately, offer more competitive FX pricing.
**How do Ripple payments work?**
![Flow - Bridged over XRP](images/flow2.png)
A sender specifies the amount and currency the recipient should receive and
Ripple automatically converts the senders available currencies using the
distributed order books integrated into the Ripple protocol. Independent third
parties acting as market makers provide liquidity in these order books.
# rippled - Ripple server
`rippled` is the reference server implementation of the Ripple
protocol. To learn more about how to build and run a `rippled`
server, visit https://ripple.com/build/rippled-setup/
Ripple uses a pathfinding algorithm that considers currency pairs when
converting from the source to the destination currency. This algorithm searches
for a series of currency swaps that gives the user the lowest cost. Since
anyone can participate as a market maker, market forces drive fees to the
lowest practical level.
[![travis-ci.org: Build Status](https://travis-ci.org/ripple/rippled.png?branch=develop)](https://travis-ci.org/ripple/rippled)
[![codecov.io: Code Coverage](https://codecov.io/gh/ripple/rippled/branch/develop/graph/badge.svg)](https://codecov.io/gh/ripple/rippled)
**What can you do with Ripple?**
### License
`rippled` is open source and permissively licensed under the
ISC license. See the LICENSE file for more details.
The protocol is entirely open-source and the networks shared ledger is public
information, so no central authority prevents anyone from participating. Anyone
can become a market maker, create a wallet or a gateway, or monitor network
behavior. Competition drives down spreads and fees, making the network useful
to everyone.
#### Repository Contents
| Folder | Contents |
|---------|----------|
| ./bin | Scripts and data files for Ripple integrators. |
| ./build | Intermediate and final build outputs. |
| ./Builds| Platform or IDE-specific project files. |
| ./doc | Documentation and example configuration files. |
| ./src | Source code. |
###Key Protocol Features
1. XRP is Ripples native [cryptocurrency]
(http://en.wikipedia.org/wiki/Cryptocurrency) with a fixed supply that
decreases slowly over time, with no mining. XRP acts as a bridge currency, and
pays for transaction fees that protect the network against spam.
![XRP as a bridge currency](/images/vehicle_currency.png)
Some of the directories under `src` are external repositories inlined via
git-subtree. See the corresponding README for more details.
2. Pathfinding discovers cheap and efficient payment paths through multiple
[order books](https://www.ripplecharts.com) allowing anyone to [trade](https://www.rippletrade.com) anything. When two accounts arent linked by relationships of trust, the Ripple pathfinding engine considers intermediate links and order books to produce a set of possible paths the transaction can take. When the payment is processed, the liquidity along these paths is iteratively consumed in best-first order.
![Pathfinding from Dollars to Euro](/images/pathfinding.png)
##For more information:
3. [Consensus](https://www.youtube.com/watch?v=pj1QVb1vlC0) confirms
transactions in an atomic fashion, without mining, ensuring efficient use of
resources.
* [Ripple Knowledge Center](https://ripple.com/learn/)
* [Ripple Developer Center](https://ripple.com/build/)
* [Ripple Whitepapers & Reports](https://ripple.com/whitepapers-reports/)
* [Ripple Consensus Whitepaper](https://ripple.com/consensus-whitepaper/)
* [Ripple Solutions Guide](https://ripple.com/files/ripple_solutions_guide.pdf)
[transact]: https://ripple.com/files/ripple-FIs.pdf
[build]: https://ripple.com/build/
[transact.png]: /images/transact.png
[build.png]: /images/build.png
[contribute.png]: /images/contribute.png
###Join The Ripple Community
|![Transact][transact.png]|![Build][build.png]|![Contribute][contribute.png]|
|:-----------------------:|:-----------------:|:---------------------------:|
|[Transact on the fastest payment infrastructure][transact]|[Build Imaginative Apps][build]|Contribute to the Ripple Protocol Implementation|
#rippled - Ripple P2P server
##[![Build Status](https://travis-ci.org/ripple/rippled.png?branch=develop)](https://travis-ci.org/ripple/rippled)
This is the repository for Ripple's `rippled`, reference P2P server.
###Build instructions:
* https://ripple.com/wiki/Rippled_build_instructions
###Setup instructions:
* https://ripple.com/wiki/Rippled_setup_instructions
###Issues
* https://ripplelabs.atlassian.net/browse/RIPD
### Repository Contents
#### ./bin
Scripts and data files for Ripple integrators.
#### ./build
Intermediate and final build outputs.
#### ./Builds
Platform or IDE-specific project files.
#### ./doc
Documentation and example configuration files.
#### ./src
Source code directory. Some of the directories contained here are
external repositories inlined via git-subtree, see the corresponding
README for more details.
#### ./test
Javascript / Mocha tests.
## License
Ripple is open source and permissively licensed under the ISC license. See the
LICENSE file for more details.
###For more information:
* Ripple Wiki - https://ripple.com/wiki/
* Ripple Primer - https://ripple.com/ripple_primer.pdf
* Ripple Primer (Market Making) - https://ripple.com/ripple-mm.pdf
* Ripple Gateway Primer - https://ripple.com/ripple-gateways.pdf
* Consensus - https://wiki.ripple.com/Consensus
To learn about how Ripple is transforming global payments visit
[https://ripple.com/contact/](https://ripple.com/contact/)
- - -
Copyright © 2015, Ripple Labs. All rights reserved.
Portions of this document, including but not limited to the Ripple logo, images
and image templates are the property of Ripple Labs and cannot be copied or
used without permission.
Portions of this document, including but not limited to the Ripple logo,
images and image templates are the property of Ripple Labs and cannot be
copied or used without permission.

2385
RELEASENOTES.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -61,10 +61,16 @@ The following environment variables modify the build environment:
Path to the boost directory.
OPENSSL_ROOT
Path to the openssl directory.
PROTOBUF_DIR
Path to the protobuf directory. This is usually only needed when
the installed protobuf library uses a different ABI than clang
(as with ubuntu 15.10).
PROTOBUF_ROOT
Path to the protobuf directory.
CLANG_PROTOBUF_ROOT
Override the path to the protobuf directory for the clang toolset. This is
usually only needed when the installed protobuf library uses a different
ABI than clang (as with ubuntu 15.10).
CLANG_BOOST_ROOT
Override the path to the boost directory for the clang toolset. This is
usually only needed when the installed protobuf library uses a different
ABI than clang (as with ubuntu 15.10).
The following extra options may be used:
--ninja Generate a `build.ninja` build file for the specified target
@@ -73,6 +79,10 @@ The following extra options may be used:
--static On linux, link protobuf, openssl, libc++, and boost statically
--sanitize=[address, thread] On gcc & clang, add sanitizer instrumentation
--assert Enable asserts, even in release builds.
GCC 5: If the gcc toolchain is used, gcc version 5 or better is required. On
linux distros that ship with gcc 4 (ubuntu < 15.10), rippled will force gcc
to use gcc4's ABI (there was an ABI change between versions). This allows us
@@ -105,13 +115,19 @@ TODO
import collections
import os
import platform
import subprocess
import sys
import textwrap
import time
import glob
import SCons.Action
sys.path.append(os.path.join('src', 'beast', 'site_scons'))
if (not platform.machine().endswith('64')):
print('Warning: Detected {} architecture. Rippled requires a 64-bit OS.'.format(
platform.machine()));
sys.path.append(os.path.join('src', 'ripple', 'beast', 'site_scons'))
sys.path.append(os.path.join('src', 'ripple', 'site_scons'))
import Beast
@@ -122,9 +138,15 @@ import scons_to_ninja
AddOption('--ninja', dest='ninja', action='store_true',
help='generate ninja build file build.ninja')
AddOption('--sanitize', dest='sanitize', choices=['address', 'thread'],
help='Build with sanitizer support (gcc and clang only).')
AddOption('--static', dest='static', action='store_true',
help='On linux, link protobuf, openssl, libc++, and boost statically')
AddOption('--assert', dest='assert', action='store_true',
help='Enable asserts, even in release mode')
def parse_time(t):
l = len(t.split())
if l==5:
@@ -348,24 +370,9 @@ def config_base(env):
,{'HAVE_USLEEP' : '1'}
,{'SOCI_CXX_C11' : '1'}
,'_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS'
,'-DBOOST_NO_AUTO_PTR'
,'BOOST_NO_AUTO_PTR'
])
try:
BOOST_ROOT = os.path.normpath(os.environ['BOOST_ROOT'])
env.Append(LIBPATH=[
os.path.join(BOOST_ROOT, 'stage', 'lib'),
])
env['BOOST_ROOT'] = BOOST_ROOT
except KeyError:
pass
try:
protobuf_dir = os.environ['PROTOBUF_DIR']
env.Append(LIBPATH=[protobuf_dir])
except KeyError:
pass
if Beast.system.windows:
try:
OPENSSL_ROOT = os.path.normpath(os.environ['OPENSSL_ROOT'])
@@ -378,11 +385,15 @@ def config_base(env):
except KeyError:
pass
elif Beast.system.osx:
OSX_OPENSSL_ROOT = '/usr/local/Cellar/openssl/'
most_recent = sorted(os.listdir(OSX_OPENSSL_ROOT))[-1]
openssl = os.path.join(OSX_OPENSSL_ROOT, most_recent)
env.Prepend(CPPPATH='%s/include' % openssl)
env.Prepend(LIBPATH=['%s/lib' % openssl])
try:
openssl = subprocess.check_output(['brew', '--prefix','openssl'],
stderr=subprocess.STDOUT).strip()
env.Prepend(CPPPATH='%s/include' % openssl)
env.Prepend(LIBPATH=['%s/lib' % openssl])
except:
pass
if not 'vcxproj' in COMMAND_LINE_TARGETS:
env.Append(CPPDEFINES=['NO_LOG_UNHANDLED_EXCEPTIONS'])
# handle command-line arguments
profile_jemalloc = ARGUMENTS.get('profile-jemalloc')
@@ -400,7 +411,7 @@ def add_static_libs(env, static_libs, dyn_libs=None):
for k,l in [('STATICLIBS', static_libs or []), ('DYNAMICLIBS', dyn_libs or [])]:
c = env.get(k, '')
for f in l:
c += ' -l' + f
c += ' -l' + f
env[k] = c
def get_libs(lib, static):
@@ -425,33 +436,90 @@ def get_libs(lib, static):
else:
static_libs.append(l)
return (static_libs, dynamic_libs)
except:
raise Exception('pkg-config failed for ' + lib)
except Exception as e:
raise Exception('pkg-config failed for ' + lib + '; Exception: ' + str(e))
# Set toolchain and variant specific construction variables
def config_env(toolchain, variant, env):
if is_debug_variant(variant):
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
def add_sanitizer (toolchain, env):
san = GetOption('sanitize')
if not san: return
san_to_lib = {'address': 'asan', 'thread': 'tsan'}
if toolchain not in Split('clang gcc'):
raise Exception("Sanitizers are only supported for gcc and clang")
env.Append(CCFLAGS=['-fsanitize='+san, '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize='+san])
add_static_libs(env, [san_to_lib[san]])
env.Append(CPPDEFINES=['SANITIZER='+san_to_lib[san].upper()])
elif variant == 'release' or variant == 'profile':
env.Append(CPPDEFINES=['NDEBUG'])
def add_boost_and_protobuf(toolchain, env):
def get_environ_value(candidates):
for c in candidates:
try:
return os.environ[c]
except KeyError:
pass
raise KeyError('Environment variable not set')
if 'BOOST_ROOT' in env:
if toolchain == 'gcc':
try:
br_cands = ['CLANG_BOOST_ROOT'] if toolchain == 'clang' else []
br_cands.append('BOOST_ROOT')
BOOST_ROOT = os.path.normpath(get_environ_value(br_cands))
stage64_path = os.path.join(BOOST_ROOT, 'stage64', 'lib')
if os.path.exists(stage64_path):
env.Append(LIBPATH=[
stage64_path,
])
else:
env.Append(LIBPATH=[
os.path.join(BOOST_ROOT, 'stage', 'lib'),
])
env['BOOST_ROOT'] = BOOST_ROOT
if toolchain in ['gcc', 'clang']:
env.Append(CCFLAGS=['-isystem' + env['BOOST_ROOT']])
else:
env.Append(CPPPATH=[
env['BOOST_ROOT'],
])
except KeyError:
pass
try:
pb_cands = ['CLANG_PROTOBUF_ROOT'] if toolchain == 'clang' else []
pb_cands.append('PROTOBUF_ROOT')
PROTOBUF_ROOT = os.path.normpath(get_environ_value(pb_cands))
env.Append(LIBPATH=[PROTOBUF_ROOT + '/src/.libs'])
if not should_link_static() and toolchain in['clang', 'gcc']:
env.Append(LINKFLAGS=['-Wl,-rpath,' + PROTOBUF_ROOT + '/src/.libs'])
env['PROTOBUF_ROOT'] = PROTOBUF_ROOT
env.Append(CPPPATH=[env['PROTOBUF_ROOT'] + '/src',])
except KeyError:
pass
def enable_asserts ():
return GetOption('assert')
# Set toolchain and variant specific construction variables
def config_env(toolchain, variant, env):
add_boost_and_protobuf(toolchain, env)
env.Append(CPPDEFINES=[
'BOOST_COROUTINE_NO_DEPRECATION_WARNING',
'BOOST_COROUTINES_NO_DEPRECATION_WARNING'
])
if is_debug_variant(variant):
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
elif (variant == 'release' or variant == 'profile') and (not enable_asserts()):
env.Append(CPPDEFINES=['NDEBUG'])
if should_link_static() and not Beast.system.linux:
raise Exception("Static linking is only implemented for linux.")
add_sanitizer(toolchain, env)
if toolchain in Split('clang gcc'):
if Beast.system.linux:
link_static = should_link_static()
for l in ['openssl', 'protobuf']:
static, dynamic = get_libs(l, link_static)
static, dynamic = get_libs(l, link_static)
if link_static:
add_static_libs(env, static, dynamic)
else:
@@ -490,7 +558,8 @@ def config_env(toolchain, variant, env):
env.Append(CXXFLAGS=[
'-frtti',
'-std=c++14',
'-Wno-invalid-offsetof'])
'-Wno-invalid-offsetof'
])
env.Append(CPPDEFINES=['_FILE_OFFSET_BITS=64'])
@@ -524,6 +593,9 @@ def config_env(toolchain, variant, env):
])
boost_libs = [
# resist the temptation to alphabetize these. coroutine
# must come before context.
'boost_chrono',
'boost_coroutine',
'boost_context',
'boost_date_time',
@@ -540,9 +612,13 @@ def config_env(toolchain, variant, env):
else:
# We prefer static libraries for boost
if env.get('BOOST_ROOT'):
static_libs64 = ['%s/stage64/lib/lib%s.a' % (env['BOOST_ROOT'], l) for
l in boost_libs]
static_libs = ['%s/stage/lib/lib%s.a' % (env['BOOST_ROOT'], l) for
l in boost_libs]
if all(os.path.exists(f) for f in static_libs):
if all(os.path.exists(f) for f in static_libs64):
boost_libs = [File(f) for f in static_libs64]
elif all(os.path.exists(f) for f in static_libs):
boost_libs = [File(f) for f in static_libs]
env.Append(LIBS=boost_libs)
@@ -601,9 +677,6 @@ def config_env(toolchain, variant, env):
# extra error checking into the code (e.g. std::vector will throw
# for out-of-bounds conditions)
if is_debug_variant(variant):
env.Append(CPPDEFINES={
'_FORTIFY_SOURCE': 2
})
env.Append(CCFLAGS=[
'-O0'
])
@@ -635,6 +708,7 @@ def config_env(toolchain, variant, env):
'/wd"4244"',
'/wd"4267"',
'/wd"4800"', # Disable C4800 (int to bool performance)
'/wd"4503"', # Disable C4503 (Decorated name length exceeded)
])
env.Append(CPPDEFINES={
'_WIN32_WINNT' : '0x6000',
@@ -643,6 +717,7 @@ def config_env(toolchain, variant, env):
'_SCL_SECURE_NO_WARNINGS',
'_CRT_SECURE_NO_WARNINGS',
'WIN32_CONSOLE',
'NOMINMAX'
])
if variant == 'debug':
env.Append(LIBS=[
@@ -710,7 +785,7 @@ root_dir = Dir('#').srcnode().get_abspath() # Path to this SConstruct file
build_dir = os.path.join('build')
base = Environment(
toolpath=[os.path.join ('src', 'beast', 'site_scons', 'site_tools')],
toolpath=[os.path.join ('src', 'ripple', 'beast', 'site_scons', 'site_tools')],
tools=['default', 'Protoc', 'VSProject'],
ENV=os.environ,
TARGET_ARCH='x86_64')
@@ -719,6 +794,9 @@ config_base(base)
base.Append(CPPPATH=[
'src',
os.path.join('src', 'beast'),
os.path.join('src', 'beast', 'include'),
os.path.join('src', 'beast', 'extras'),
os.path.join('src', 'nudb', 'include'),
os.path.join(build_dir, 'proto'),
os.path.join('src','soci','src'),
os.path.join('src','soci','include'),
@@ -852,8 +930,14 @@ def get_classic_sources(toolchain):
'src/soci/src/core',
'src/sqlite']
)
append_sources(result, *list_sources('src/ripple/beast/clock', '.cpp'))
append_sources(result, *list_sources('src/ripple/beast/container', '.cpp'))
append_sources(result, *list_sources('src/ripple/beast/insight', '.cpp'))
append_sources(result, *list_sources('src/ripple/beast/net', '.cpp'))
append_sources(result, *list_sources('src/ripple/beast/utility', '.cpp'))
append_sources(result, *list_sources('src/ripple/app', '.cpp'))
append_sources(result, *list_sources('src/ripple/basics', '.cpp'))
append_sources(result, *list_sources('src/ripple/conditions', '.cpp'))
append_sources(result, *list_sources('src/ripple/crypto', '.cpp'))
append_sources(result, *list_sources('src/ripple/json', '.cpp'))
append_sources(result, *list_sources('src/ripple/ledger', '.cpp'))
@@ -864,9 +948,24 @@ def get_classic_sources(toolchain):
append_sources(result, *list_sources('src/ripple/protocol', '.cpp'))
append_sources(result, *list_sources('src/ripple/rpc', '.cpp'))
append_sources(result, *list_sources('src/ripple/shamap', '.cpp'))
append_sources(result, *list_sources('src/ripple/test', '.cpp'))
append_sources(result, *list_sources('src/ripple/unl', '.cpp'))
append_sources(result, *list_sources('src/ripple/server', '.cpp'))
append_sources(result, *list_sources('src/test/app', '.cpp'))
append_sources(result, *list_sources('src/test/basics', '.cpp'))
append_sources(result, *list_sources('src/test/beast', '.cpp'))
append_sources(result, *list_sources('src/test/conditions', '.cpp'))
append_sources(result, *list_sources('src/test/core', '.cpp'))
append_sources(result, *list_sources('src/test/json', '.cpp'))
append_sources(result, *list_sources('src/test/ledger', '.cpp'))
append_sources(result, *list_sources('src/test/overlay', '.cpp'))
append_sources(result, *list_sources('src/test/peerfinder', '.cpp'))
append_sources(result, *list_sources('src/test/protocol', '.cpp'))
append_sources(result, *list_sources('src/test/resource', '.cpp'))
append_sources(result, *list_sources('src/test/rpc', '.cpp'))
append_sources(result, *list_sources('src/test/server', '.cpp'))
append_sources(result, *list_sources('src/test/shamap', '.cpp'))
append_sources(result, *list_sources('src/test/jtx', '.cpp'))
if use_shp(toolchain):
cc_flags = {'CCFLAGS': ['--system-header-prefix=rocksdb2']}
else:
@@ -874,7 +973,7 @@ def get_classic_sources(toolchain):
append_sources(
result,
*list_sources('src/ripple/nodestore', '.cpp'),
*(list_sources('src/ripple/nodestore', '.cpp') + list_sources('src/test/nodestore', '.cpp')),
CPPPATH=[
'src/rocksdb2/include',
'src/snappy/snappy',
@@ -891,12 +990,15 @@ def get_unity_sources(toolchain):
result = []
append_sources(
result,
'src/ripple/beast/unity/beast_insight_unity.cpp',
'src/ripple/beast/unity/beast_net_unity.cpp',
'src/ripple/beast/unity/beast_utility_unity.cpp',
'src/ripple/unity/app_ledger.cpp',
'src/ripple/unity/app_main.cpp',
'src/ripple/unity/app_misc.cpp',
'src/ripple/unity/app_paths.cpp',
'src/ripple/unity/app_tests.cpp',
'src/ripple/unity/app_tx.cpp',
'src/ripple/unity/conditions.cpp',
'src/ripple/unity/core.cpp',
'src/ripple/unity/basics.cpp',
'src/ripple/unity/crypto.cpp',
@@ -908,8 +1010,22 @@ def get_unity_sources(toolchain):
'src/ripple/unity/protocol.cpp',
'src/ripple/unity/rpcx.cpp',
'src/ripple/unity/shamap.cpp',
'src/ripple/unity/test.cpp',
'src/ripple/unity/unl.cpp',
'src/ripple/unity/server.cpp',
'src/test/unity/app_test_unity.cpp',
'src/test/unity/basics_test_unity.cpp',
'src/test/unity/beast_test_unity.cpp',
'src/test/unity/core_test_unity.cpp',
'src/test/unity/conditions_test_unity.cpp',
'src/test/unity/json_test_unity.cpp',
'src/test/unity/ledger_test_unity.cpp',
'src/test/unity/overlay_test_unity.cpp',
'src/test/unity/peerfinder_test_unity.cpp',
'src/test/unity/protocol_test_unity.cpp',
'src/test/unity/resource_test_unity.cpp',
'src/test/unity/rpc_test_unity.cpp',
'src/test/unity/server_test_unity.cpp',
'src/test/unity/shamap_test_unity.cpp',
'src/test/unity/support_unity.cpp'
)
if use_shp(toolchain):
@@ -920,6 +1036,7 @@ def get_unity_sources(toolchain):
append_sources(
result,
'src/ripple/unity/nodestore.cpp',
'src/test/unity/nodestore_test_unity.cpp',
CPPPATH=[
'src/rocksdb2/include',
'src/snappy/snappy',
@@ -1030,37 +1147,23 @@ for tu_style in ['classic', 'unity']:
for s, k in sources:
object_builder.add_source_files(*s, **k)
git_commit_tag = {}
if toolchain != 'msvc':
git = Beast.Git(env)
if git.exists:
id = '%s+%s.%s' % (git.tags, git.user, git.branch)
git_commit_tag = {'CPPDEFINES':
{'GIT_COMMIT_ID' : '\'"%s"\'' % id }}
object_builder.add_source_files(
'src/ripple/unity/git_id.cpp',
**git_commit_tag)
if use_shp(toolchain):
cc_flags = {'CCFLAGS': ['--system-header-prefix=rocksdb2']}
else:
cc_flags = {}
object_builder.add_source_files(
'src/beast/beast/unity/hash_unity.cpp',
'src/ripple/beast/unity/beast_hash_unity.cpp',
'src/ripple/unity/beast.cpp',
'src/ripple/unity/lz4.c',
'src/ripple/unity/protobuf.cpp',
'src/ripple/unity/ripple.proto.cpp',
'src/ripple/unity/resource.cpp',
'src/ripple/unity/server.cpp',
'src/ripple/unity/websocket02.cpp',
**cc_flags
)
object_builder.add_source_files(
'src/ripple/unity/beastc.c',
'src/sqlite/sqlite_unity.c',
CCFLAGS = ([] if toolchain == 'msvc' else ['-Wno-array-bounds']))
if 'gcc' in toolchain:
@@ -1071,7 +1174,7 @@ for tu_style in ['classic', 'unity']:
cc_flags = {}
object_builder.add_source_files(
'src/ripple/unity/ed25519.c',
'src/ripple/unity/ed25519_donna.c',
CPPPATH=[
'src/ed25519-donna',
]
@@ -1097,11 +1200,6 @@ for tu_style in ['classic', 'unity']:
]
)
object_builder.add_source_files(
'src/ripple/unity/websocket04.cpp',
CPPPATH='src/websocketpp',
)
if toolchain == "clang" and Beast.system.osx:
object_builder.add_source_files('src/ripple/unity/beastobjc.mm')
@@ -1145,7 +1243,13 @@ for key, value in aliases.iteritems():
vcxproj = base.VSProject(
os.path.join('Builds', 'VisualStudio2015', 'RippleD'),
source = [],
VSPROJECT_ROOT_DIRS = ['src/beast', 'src', '.'],
VSPROJECT_ROOT_DIRS = [
'build/',
'src/beast/extras',
'src/beast/include',
'src/nudb/include',
'src',
'.'],
VSPROJECT_CONFIGS = msvc_configs)
base.Alias('vcxproj', vcxproj)
@@ -1167,10 +1271,10 @@ def do_count(target, source, env):
path = os.path.join(parent, path)
r = os.path.splitext(path)
if r[1] in suffixes:
if r[0].endswith('.test'):
if r[0].endswith('_test'):
yield os.path.normpath(path)
return list(_iter(base))
testfiles = list_testfiles(os.path.join('src', 'ripple'), env.get('CPPSUFFIXES'))
testfiles = list_testfiles(os.path.join('src', 'test'), env.get('CPPSUFFIXES'))
lines = 0
for f in testfiles:
lines = lines + sum(1 for line in open(f))

View File

@@ -6,22 +6,39 @@ environment:
# that it's a small download. We also use appveyor's free cache, avoiding fees
# downloading from S3 each time.
# TODO: script to create this package.
RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/rippled_deps15.01.zip
RIPPLED_DEPS_PATH: rippled_deps15.02
RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip
# Other dependencies we just download each time.
PIP_URL: https://bootstrap.pypa.io/get-pip.py
PYWIN32_URL: https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe
PIP_PATH: get-pip.py
PIP_URL: https://bootstrap.pypa.io/%PIP_PATH%
# The % in this URL messes up variable substition, so any updates will
# need to update both PYWIN32_PATH and PYWIN32_URL
PYWIN32_PATH: pywin32-220.win-amd64-py2.7.exe
PYWIN32_URL: https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win-amd64-py2.7.exe
# Scons honours these environment variables, setting the include/lib paths.
BOOST_ROOT: C:/rippled_deps15.01/boost
OPENSSL_ROOT: C:/rippled_deps15.01/openssl
BOOST_ROOT: C:/%RIPPLED_DEPS_PATH%/boost
OPENSSL_ROOT: C:/%RIPPLED_DEPS_PATH%/openssl
matrix:
# This build works, but our current Appveyor config runs matrix builds
# sequentially, and the one build is already slow enough.
# - build: scons
# target: msvc.debug
- build: cmake
target: msvc.debug
buildconfig: Debug
os: Visual Studio 2015
# At the end of each successful build we cache this directory. It must be less
# than 100MB total compressed.
# At the end of each successful build we cache this directory.
# https://www.appveyor.com/docs/build-cache/
# Resulting archive should not exceed 100 MB.
cache:
- "C:\\rippled_deps15.01"
- 'C:\%RIPPLED_DEPS_PATH%'
- '%PIP_PATH%'
- '%PYWIN32_PATH%'
# This means we'll download a zip of the branch we want, rather than the full
# history.
@@ -29,36 +46,37 @@ shallow_clone: true
install:
# We want easy_install, python and protoc.exe on PATH.
- SET PATH=%PYTHON%;%PYTHON%/Scripts;C:/rippled_deps15.01;%PATH%
- SET PATH=%PYTHON%;%PYTHON%/Scripts;C:/%RIPPLED_DEPS_PATH%;%PATH%
# `ps` prefix means the command is executed by powershell.
- ps: Start-FileDownload $env:PIP_URL
- ps: Start-FileDownload $env:PYWIN32_URL
# Installing pip will install setuptools/easy_install.
- python get-pip.py
# Pip has some problems installing scons on windows so we use easy install.
- easy_install scons
# Scons has problems with parallel builds on windows without pywin32.
- easy_install pywin32-219.win-amd64-py2.7.exe
# (easy_install can do headless installs of .exe wizards)
- ps: |
if ($env:build -eq "scons") {
if(-not(Test-Path $env:PIP_PATH)) {
echo "Download from $env:PIP_URL"
Start-FileDownload $env:PIP_URL
}
if(-not(Test-Path $env:PYWIN32_PATH)) {
echo "Download from $env:PYWIN32_URL"
Start-FileDownload $env:PYWIN32_URL
}
}
- bin/ci/windows/install-dependencies.bat
# Download dependencies if appveyor didn't restore them from the cache.
# Use 7zip to unzip.
- ps: |
if (-not(Test-Path 'C:/rippled_deps15.01')) {
if (-not(Test-Path 'C:/$env:RIPPLED_DEPS_PATH')) {
echo "Download from $env:RIPPLED_DEPS_URL"
Start-FileDownload "$env:RIPPLED_DEPS_URL"
7z x rippled_deps15.01.zip -oC:\ -y > $null
7z x "$($env:RIPPLED_DEPS_PATH).zip" -oC:\ -y > $null
if ($LastExitCode -ne 0) { throw "7z failed" }
}
# Newer DEPS include a versions file.
# Dump it so we can verify correct behavior.
- ps: |
if (Test-Path 'C:/rippled_deps15.01/versions.txt') {
cat 'C:/rippled_deps15.01/versions.txt'
if (Test-Path "C:/$env:RIPPLED_DEPS_PATH/versions.txt") {
cat "C:/$env:RIPPLED_DEPS_PATH/versions.txt"
}
# TODO: This is giving me grief
@@ -71,17 +89,46 @@ build_script:
- '"%VS140COMNTOOLS%../../VC/vcvarsall.bat" x86_amd64'
# Show which version of the compiler we are using.
- cl
- scons msvc.debug -j%NUMBER_OF_PROCESSORS%
- ps: |
if ($env:build -eq "scons") {
# Build with scons
scons $env:target -j%NUMBER_OF_PROCESSORS%
if ($LastExitCode -ne 0) { throw "scons build failed" }
}
else
{
# Build with cmake
cmake --version
$cmake_target="$($env:target).ci"
"$cmake_target"
New-Item -ItemType Directory -Force -Path "build/$cmake_target"
Push-Location "build/$cmake_target"
cmake -G"Visual Studio 14 2015 Win64" -Dtarget="$cmake_target" ../..
if ($LastExitCode -ne 0) { throw "CMake failed" }
cmake --build . --config $env:buildconfig -- -m
if ($LastExitCode -ne 0) { throw "CMake build failed" }
Pop-Location
}
after_build:
# Put our executable in a place where npm test can find it.
- ps: cp build/msvc.debug/rippled.exe build
- ps: ls build
- ps: |
if ($env:build -eq "scons") {
cp build/$($env:target)/rippled.exe build
ls build
$exe="build/rippled"
}
else
{
$exe="build/$cmake_target/$env:buildconfig/rippled"
}
"Exe is at $exe"
test_script:
# Run the unit tests
- build\\rippled --unittest
- ps: |
& {
# Run the rippled unit tests
& $exe --unittest
# https://connect.microsoft.com/PowerShell/feedback/details/751703/option-to-stop-script-if-command-line-exe-fails
if ($LastExitCode -ne 0) { throw "Unit tests failed" }
}
# Run the integration tests
- npm install
- npm test

View File

@@ -1,41 +1,92 @@
#!/bin/bash -u
# We use set -e and bash with -u to bail on first non zero exit code of any
# processes launched or upon any unbound variable
set -e
# processes launched or upon any unbound variable.
# We use set -x to print commands before running them to help with
# debugging.
set -ex
__dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
echo "using CC: $CC"
echo "using TARGET: $TARGET"
export RIPPLED_PATH="$PWD/build/$CC.$TARGET/rippled"
echo "using RIPPLED_PATH: $RIPPLED_PATH"
# Make sure vcxproj is up to date
scons vcxproj
git diff --exit-code
# $CC will be either `clang` or `gcc`
# http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
# indicates that 2 cores are available to containers.
scons -j${NUM_PROCESSORS:-2} $CC.$TARGET
# Ensure APP defaults to rippled if it's not set.
: ${APP:=rippled}
if [[ ${BUILD:-scons} == "cmake" ]]; then
echo "cmake building ${APP}"
CMAKE_TARGET=$CC.$TARGET
if [[ ${CI:-} == true ]]; then
CMAKE_TARGET=$CMAKE_TARGET.ci
fi
mkdir -p "build/${CMAKE_TARGET}"
pushd "build/${CMAKE_TARGET}"
cmake ../.. -Dtarget=$CMAKE_TARGET
cmake --build . -- -j${NUM_PROCESSORS:-2}
popd
export APP_PATH="$PWD/build/${CMAKE_TARGET}/${APP}"
echo "using APP_PATH: $APP_PATH"
else
export APP_PATH="$PWD/build/$CC.$TARGET/${APP}"
echo "using APP_PATH: $APP_PATH"
# Make sure vcxproj is up to date
scons vcxproj
git diff --exit-code
# $CC will be either `clang` or `gcc`
# http://docs.travis-ci.com/user/migrating-from-legacy/?utm_source=legacy-notice&utm_medium=banner&utm_campaign=legacy-upgrade
# indicates that 2 cores are available to containers.
scons -j${NUM_PROCESSORS:-2} $CC.$TARGET
fi
# We can be sure we're using the build/$CC.$TARGET variant
# (-f so never err)
rm -f build/rippled
rm -f build/${APP}
# See what we've actually built
ldd $RIPPLED_PATH
if [[ $TARGET == "coverage" ]]; then
$RIPPLED_PATH --unittest
# We pass along -p to keep path segments so as to avoid collisions
codecov --gcov-args=-p --gcov-source-match='^src/(ripple|beast)'
ldd $APP_PATH
if [[ ${APP} == "rippled" ]]; then
export APP_ARGS="--unittest"
# Only report on src/ripple files
export LCOV_FILES="*/src/ripple/*"
# Nothing to explicitly exclude
export LCOV_EXCLUDE_FILES="LCOV_NO_EXCLUDE"
else
if [[ $CC == "clang" ]]; then
# gdb segfaults with a clang build
$RIPPLED_PATH --unittest
else
# Run unittests (under gdb)
cat $__dirname/unittests.gdb | gdb \
--return-child-result \
--args $RIPPLED_PATH --unittest
fi
: ${APP_ARGS:=}
: ${LCOV_FILES:="*/src/*"}
# Don't exclude anything
: ${LCOV_EXCLUDE_FILES:="LCOV_NO_EXCLUDE"}
fi
# Run NPM tests
npm install
npm test --rippled=$RIPPLED_PATH
if [[ $TARGET == "coverage" ]]; then
export PATH=$PATH:$LCOV_ROOT/usr/bin
# Create baseline coverage data file
lcov --no-external -c -i -d . -o baseline.info
fi
# Execute unit tests under gdb, printing a call stack
# if we get a crash.
gdb -return-child-result -quiet -batch \
-ex "set env MALLOC_CHECK_=3" \
-ex "set print thread-events off" \
-ex run \
-ex "thread apply all backtrace full" \
-ex "quit" \
--args $APP_PATH --unittest
if [[ $TARGET == "coverage" ]]; then
# Create test coverage data file
lcov --no-external -c -d . -o tests.info
# Combine baseline and test coverage data
lcov -a baseline.info -a tests.info -o lcov-all.info
# Included files
lcov -e "lcov-all.info" "${LCOV_FILES}" -o lcov.pre.info
# Excluded files
lcov --remove lcov.pre.info "${LCOV_EXCLUDE_FILES}" -o lcov.info
# Push the results (lcov.info) to codecov
codecov -X gcov # don't even try and look for .gcov files ;)
fi

View File

@@ -1,6 +1,11 @@
#!/bin/bash -u
# Exit if anything fails.
set -e
# Exit if anything fails. Echo commands to aid debugging.
set -ex
# Target working dir - defaults to current dir.
# Can be set from caller, or in the first parameter
TWD=$( cd ${TWD:-${1:-${PWD:-$( pwd )}}}; pwd )
echo "Target path is: $TWD"
# Override gcc version to $GCC_VER.
# Put an appropriate symlink at the front of the path.
mkdir -v $HOME/bin
@@ -9,26 +14,54 @@ do
test -x $( type -p ${g}-$GCC_VER )
ln -sv $(type -p ${g}-$GCC_VER) $HOME/bin/${g}
done
for c in clang clang++
do
test -x $( type -p ${c}-$CLANG_VER )
ln -sv $(type -p ${c}-$CLANG_VER) $HOME/bin/${c}
done
export PATH=$PWD/bin:$PATH
if [[ -n ${CLANG_VER:-} ]]; then
# There are cases where the directory exists, but the exe is not available.
# Use this workaround for now.
if [[ ! -x ${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config && -d ${TWD}/llvm-${LLVM_VERSION} ]]; then
rm -fr ${TWD}/llvm-${LLVM_VERSION}
fi
if [[ ! -d ${TWD}/llvm-${LLVM_VERSION} ]]; then
mkdir ${TWD}/llvm-${LLVM_VERSION}
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
wget -O - ${LLVM_URL} | tar -Jxvf - --strip 1 -C ${TWD}/llvm-${LLVM_VERSION}
fi
${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config --version;
export LLVM_CONFIG="${TWD}/llvm-${LLVM_VERSION}/bin/llvm-config";
fi
if [[ ${BUILD:-} == cmake ]]; then
# There are cases where the directory exists, but the exe is not available.
# Use this workaround for now.
if [[ ! -x ${TWD}/cmake/bin/cmake && -d ${TWD}/cmake ]]; then
rm -fr ${TWD}/cmake
fi
if [[ ! -d ${TWD}/cmake ]]; then
CMAKE_URL="https://www.cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.tar.gz"
wget --version
# wget version 1.13.4 thinks this certificate is invalid, even though it's fine.
# "ERROR: no certificate subject alternative name matches"
# See also: https://github.com/travis-ci/travis-ci/issues/5059
mkdir ${TWD}/cmake &&
wget -O - --no-check-certificate ${CMAKE_URL} | tar --strip-components=1 -xz -C ${TWD}/cmake
cmake --version
fi
fi
# What versions are we ACTUALLY running?
if [ -x $HOME/bin/g++ ]; then
$HOME/bin/g++ -v
fi
if [ -x $HOME/bin/clang ]; then
$HOME/bin/clang -v
fi
# Avoid `spurious errors` caused by ~/.npm permission issues
# Does it already exist? Who owns? What permissions?
ls -lah ~/.npm || mkdir ~/.npm
# Make sure we own it
chown -Rc $USER ~/.npm
# We use this so we can filter the subtrees from our coverage report
pip install --user https://github.com/sublimator/codecov-python/zipball/source-match
pip install --user https://github.com/codecov/codecov-python/archive/master.zip
bash bin/sh/install-boost.sh
# Install lcov
# Download the archive
wget https://github.com/linux-test-project/lcov/releases/download/v1.12/lcov-1.12.tar.gz
# Extract to ~/lcov-1.12
tar xfvz lcov-1.12.tar.gz -C $HOME
# Set install path
mkdir -p $LCOV_ROOT
cd $HOME/lcov-1.12 && make install PREFIX=$LCOV_ROOT

View File

@@ -1,4 +0,0 @@
set env MALLOC_CHECK_=3
set print thread-events off
run
backtrace full

View File

@@ -0,0 +1,13 @@
if "%build%" == "scons" (
rem Installing pip will install setuptools/easy_install.
python "%PIP_PATH%"
rem Pip has some problems installing scons on windows so we use easy install.
rem - easy_install scons
rem Workaround
easy_install https://pypi.python.org/packages/source/S/SCons/scons-2.5.0.tar.gz#md5=bda5530a70a41a7831d83c8b191c021e
rem Scons has problems with parallel builds on windows without pywin32.
easy_install "%PYWIN32_PATH%"
rem (easy_install can do headless installs of .exe wizards)
)

84
bin/getInfoRippled.sh Normal file
View File

@@ -0,0 +1,84 @@
#!/usr/bin/env bash
rippled_exe=/opt/ripple/bin/rippled
conf_file=/etc/opt/ripple/rippled.cfg
while getopts ":e:c:" opt; do
case $opt in
e)
rippled_exe=${OPTARG}
;;
c)
conf_file=${OPTARG}
;;
\?)
echo "Invalid option: -$OPTARG"
esac
done
tmp_loc=$(mktemp -d --tmpdir ripple_info.XXXX)
cd /tmp
chmod 751 ripple_info.*
cd ~
echo ${tmp_loc}
cleaned_conf=${tmp_loc}/cleaned_rippled_cfg.txt
if [[ -f ${conf_file} ]]
then
db=$(sed -r -e 's/\<s[a-zA-Z0-9]{28}\>/secretsecretsecretsecretmaybe/g' ${conf_file} |\
awk -v OUT_FILE=${cleaned_conf} '
BEGIN {skip=0; db_path="";print > OUT_FILE}
/^\[validation_seed\]/ {skip=1; next}
/^\[node_seed\]/ {skip=1; next}
/^\[.*\]/ {skip=0}
skip==1 {next}
save==1 {save=0;db_path=$0}
/^\[database_path\]/ {save=1}
{print >> OUT_FILE}
END {print db_path}
')
fi
echo "database_path: ${db}"
df ${db} > ${tmp_loc}/db_path_df.txt
echo
# Send output from this script to a log file
## this captures any messages
## or errors from the script itself
log_file=${tmp_loc}/get_info.log
exec 3>&1 1>>${log_file} 2>&1
## Send all stdout files to /tmp
if [[ -x ${rippled_exe} ]]
then
pgrep rippled && \
${rippled_exe} --conf ${conf_file} \
-- server_info > ${tmp_loc}/server_info.txt
fi
df -h > ${tmp_loc}/free_disk_space.txt
cat /proc/meminfo > ${tmp_loc}/amount_mem.txt
cat /proc/swaps > ${tmp_loc}/swap_space.txt
ulimit -a > ${tmp_loc}/reported_current_limits.txt
for dev_path in $(df | awk '$1 ~ /^\/dev\// {print $1}'); do
# strip numbers from end and remove '/dev/'
dev=$(basename ${dev_path%%[0-9]})
if [[ "$(cat /sys/block/${dev}/queue/rotational)" = 0 ]]
then
echo "${dev} : SSD" >> ${tmp_loc}/is_ssd.txt
else
echo "${dev} : NO SSD" >> ${tmp_loc}/is_ssd.txt
fi
done
pushd ${tmp_loc}
tar -czvf info-package.tar.gz *.txt *.log
popd
echo "Use the following command on your local machine to download from your rippled instance: scp <remote_rippled_username>@<remote_host>:${tmp_loc}/info-package.tar.gz <path/to/local_machine/directory>"| tee /dev/fd/3

View File

@@ -4,4 +4,4 @@ import sys
from ripple.util import Sign
result = Sign.run_command(sys.argv[1:])
exit(0 if result else -1)
sys.exit(0 if result else -1)

View File

@@ -5,4 +5,11 @@ To run the Python unit tests, execute:
python -m unittest discover
from this directory.
from this directory.
To run Python unit tests from a particular file (such as
`ripple/util/test_Sign.py`), execute:
python -m unittest ripple.util.test_Sign
Add `-v` to run tests in verbose mode.

View File

@@ -52,7 +52,7 @@ class DatumInContext(object):
"""
Represents a datum along a path from a context.
Essentially a zipper but with a structure represented by JsonPath,
Essentially a zipper but with a structure represented by JSONPath,
and where the context is more of a parent pointer than a proper
representation of the context.

View File

@@ -49,3 +49,4 @@ sfSequence = field_code(STI_UINT32, 4)
sfPublicKey = field_code(STI_VL, 1)
sfSigningPubKey = field_code(STI_VL, 3)
sfSignature = field_code(STI_VL, 6)
sfMasterSignature = field_code(STI_VL, 18)

View File

@@ -5,23 +5,27 @@ from __future__ import print_function
import base64, os, random, struct, sys
import ed25519
import ecdsa
import hashlib
from ripple.util import Base58
from ripple.ledger import SField
ED25519_BYTE = chr(0xed)
WRAP_COLUMNS = 60
WRAP_COLUMNS = 72
USAGE = """\
Usage:
create
Create a new master public/secret key pair.
create <master-secret>
Generate master key pair using provided secret.
check <key>
Check an existing key for validity.
sign <sequence> <validator-public> <master-secret>
sign <sequence> <validation-public-key> <validation-private-key> <master-secret>
Create a new signed manifest with the given sequence
number, validator public key, and master secret key.
number and keys.
"""
def prepend_length_byte(b):
@@ -38,17 +42,17 @@ def make_seed(urandom=os.urandom):
return urandom(16)
def make_ed25519_keypair(urandom=os.urandom):
private_key = urandom(32)
return private_key, ed25519.publickey(private_key)
sk = urandom(32)
return sk, ed25519.publickey(sk)
def make_ecdsa_keypair():
def make_ecdsa_keypair(urandom=None):
# This is not used.
private_key = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1)
sk = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1, entropy=urandom)
# Can't be unit tested easily - need a mock for ecdsa.
vk = private_key.get_verifying_key()
sig = private_key.sign('message')
vk = sk.get_verifying_key()
sig = sk.sign('message')
assert vk.verify(sig, 'message')
return private_key, vk
return sk, vk
def make_seed_from_passphrase(passphrase):
# For convenience, like say testing against rippled we can hash a passphrase
@@ -56,18 +60,58 @@ def make_seed_from_passphrase(passphrase):
# an optional arg, which can be a base58 encoded seed, or a passphrase.
return hashlib.sha512(passphrase).digest()[:16]
def make_manifest(public_key, validator_public_key, seq):
def make_manifest(master_pk, validation_pk, seq):
"""create a manifest
Parameters
----------
master_pk : string
validator's master public key (binary, _not_ BASE58 encoded)
validation_pk : string
validator's validation public key (binary, _not_ BASE58 encoded)
seq : int
manifest sequence number
Returns
----------
string
String with fields for seq, master_pk, validation_pk
"""
return ''.join([
SField.sfSequence,
to_int32(seq),
SField.sfPublicKey, # Master public key.
prepend_length_byte(public_key),
SField.sfSigningPubKey, # Ephemeral public key.
prepend_length_byte(validator_public_key)])
SField.sfPublicKey,
prepend_length_byte(master_pk),
SField.sfSigningPubKey,
prepend_length_byte(validation_pk)])
def sign_manifest(manifest, private_key, public_key):
sig = ed25519.signature('MAN\0' + manifest, private_key, public_key)
return manifest + SField.sfSignature + prepend_length_byte(sig)
def sign_manifest(manifest, validation_sk, master_sk, master_pk):
"""sign a validator manifest
Parameters
----------
manifest : string
manifest to sign
validation_sk : string
validator's validation secret key (binary, _not_ BASE58 encoded)
This is one of the keys that will sign the manifest.
master_sk : string
validator's master secret key (binary, _not_ BASE58 encoded)
This is one of the keys that will sign the manifest.
master_pk : string
validator's master public key (binary, _not_ BASE58 encoded)
Returns
----------
string
manifest signed by both the validation and master keys
"""
man_hash = hashlib.sha512('MAN\0' + manifest).digest()[:32]
validation_sig = validation_sk.sign_digest_deterministic(
man_hash, hashfunc=hashlib.sha256, sigencode=ecdsa.util.sigencode_der_canonize)
master_sig = ed25519.signature('MAN\0' + manifest, master_sk, master_pk)
return manifest + SField.sfSignature + prepend_length_byte(validation_sig) + \
SField.sfMasterSignature + prepend_length_byte(master_sig)
def wrap(s, cols=WRAP_COLUMNS):
if s:
@@ -77,47 +121,64 @@ def wrap(s, cols=WRAP_COLUMNS):
return s
def create_ed_keys(urandom=os.urandom):
private_key, public_key = make_ed25519_keypair(urandom)
public_key_human = Base58.encode_version(
Base58.VER_NODE_PUBLIC, ED25519_BYTE + public_key)
private_key_human = Base58.encode_version(
Base58.VER_NODE_PRIVATE, private_key)
return public_key_human, private_key_human
sk, pk = make_ed25519_keypair(urandom)
pk_human = Base58.encode_version(
Base58.VER_NODE_PUBLIC, ED25519_BYTE + pk)
sk_human = Base58.encode_version(
Base58.VER_NODE_PRIVATE, sk)
return pk_human, sk_human
def check_validator_public(v, validator_public_key):
def create_ed_public_key(sk_human):
v, sk = Base58.decode_version(sk_human)
check_secret_key(v, sk)
pk = ed25519.publickey(sk)
pk_human = Base58.encode_version(
Base58.VER_NODE_PUBLIC, ED25519_BYTE + pk)
return pk_human
def check_validation_public_key(v, pk):
Base58.check_version(v, Base58.VER_NODE_PUBLIC)
if len(validator_public_key) != 33:
raise ValueError('Validator key should be length 33, is %s' %
len(validator_public_key))
b = ord(validator_public_key[0])
if len(pk) != 33:
raise ValueError('Validation public key should be length 33, is %s' %
len(pk))
b = ord(pk[0])
if b not in (2, 3):
raise ValueError('First validator key byte must be 2 or 3, is %d' % b)
raise ValueError('First validation public key byte must be 2 or 3, is %d' % b)
def check_master_secret(v, private_key):
def check_secret_key(v, sk):
Base58.check_version(v, Base58.VER_NODE_PRIVATE)
if len(private_key) != 32:
if len(sk) != 32:
raise ValueError('Length of master secret should be 32, is %s' %
len(private_key))
len(sk))
def get_signature(seq, validation_pk_human, validation_sk_human, master_sk_human):
v, validation_pk = Base58.decode_version(validation_pk_human)
check_validation_public_key(v, validation_pk)
def get_signature(seq, validator_public_key_human, private_key_human):
v, validator_public_key = Base58.decode_version(validator_public_key_human)
check_validator_public(v, validator_public_key)
v, validation_sk_str = Base58.decode_version(validation_sk_human)
check_secret_key(v, validation_sk_str)
validation_sk = ecdsa.SigningKey.from_string(validation_sk_str, curve=ecdsa.SECP256k1)
v, private_key = Base58.decode_version(private_key_human)
check_master_secret(v, private_key)
v, master_sk = Base58.decode_version(master_sk_human)
check_secret_key(v, master_sk)
pk = ed25519.publickey(private_key)
pk = ed25519.publickey(master_sk)
apk = ED25519_BYTE + pk
m = make_manifest(apk, validator_public_key, seq)
m1 = sign_manifest(m, private_key, pk)
m = make_manifest(apk, validation_pk, seq)
m1 = sign_manifest(m, validation_sk, master_sk, pk)
return base64.b64encode(m1)
# Testable versions of functions.
def perform_create(urandom=os.urandom, print=print):
public, private = create_ed_keys(urandom)
print('[validator_keys]', public, '', '[master_secret]', private, sep='\n')
pk, sk = create_ed_keys(urandom)
print('[validator_keys]', pk, '', '[master_secret]', sk, sep='\n')
def perform_create_public(sk_human, print=print):
pk_human = create_ed_public_key(sk_human)
print(
'[validator_keys]',pk_human, '',
'[master_secret]', sk_human, sep='\n')
def perform_check(s, print=print):
version, b = Base58.decode_version(s)
@@ -126,21 +187,29 @@ def perform_check(s, print=print):
assert Base58.encode_version(version, b) == s
def perform_sign(
seq, validator_public_key_human, private_key_human, print=print):
seq, validation_pk_human, validation_sk_human, master_sk_human, print=print):
print('[validation_manifest]')
print(wrap(get_signature(
int(seq), validator_public_key_human, private_key_human)))
int(seq), validation_pk_human, validation_sk_human, master_sk_human)))
def perform_verify(
seq, validation_pk_human, master_pk_human, signature, print=print):
verify_signature(
int(seq), validation_pk_human, master_pk_human, signature)
print('Signature valid for', master_pk_human)
# Externally visible versions of functions.
def create():
perform_create()
def create(sk_human=None):
if sk_human:
perform_create_public(sk_human)
else:
perform_create()
def check(s):
perform_check(s)
def sign(seq, validator_public_key_human, private_key_human):
perform_sign(seq, validator_public_key_human, private_key_human)
def sign(seq, validation_pk_human, validation_sk_human, master_sk_human):
perform_sign(seq, validation_pk_human, validation_sk_human, master_sk_human)
def usage(*errors):
if errors:

View File

@@ -10,10 +10,7 @@ BINARY = 'nN9kfUnKTf7PpgLG'
class test_Sign(TestCase):
SEQUENCE = 23
SIGNATURE = (
'JAAAABdxIe2DIKUZd9jDjKikknxnDfWCHkSXYZReFenvsmoVCdIw6nMhAnZ2dnZ2'
'dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkDOjlWtQSvRTjuwe+4iNusg0sJM'
'zqkBJwDz30b2SkxZ7Fte/Vx4htM/kkfUfJCaxmxE5N4dHSKuiO9iDHsktqIA')
VALIDATOR_KEY_HUMAN = 'n9JijuoCv8ubEy5ag3LiX3hyq27GaLJsitZPbQ6APkwx2MkUXq8E'
def setUp(self):
self.results = []
@@ -55,13 +52,17 @@ class test_Sign(TestCase):
'\xef*\x97\x16n<\xa6\xf2\xe4\xfb\xfc\xcd\x80P[\xf1s\x06verify')
def test_sign_manifest(self):
ssk, spk = Sign.make_ecdsa_keypair(self.urandom)
sk, pk = Sign.make_ed25519_keypair(self.urandom)
s = Sign.sign_manifest('manifest', sk, pk)
s = Sign.sign_manifest('manifest', ssk, sk, pk)
self.assertEquals(
s, 'manifestv@\xe5\x84\xbe\xc4\x80N\xa0v"\xb2\x80A\x88\x06\xc0'
'\xd2\xbae\x92\x89\xa8\'!\xdd\x00\x88\x06s\xe0\xf74\xe3Yg\xad{$'
'\x17\xd3\x99\xaa\x16\xb0\xeaZ\xd7]\r\xb3\xdc\x1b\x8f\xc1Z\xdfHU'
'\xb5\x92\xac\x82jI\x02')
s, 'manifestvF0D\x02 \x04\x85\x95p\x0f\xb8\x17\x7f\xdf\xdd\x04'
'\xaa+\x16q1W\xf6\xfd\xe8X\xb12l\xd5\xc3\xf1\xd6\x05\x1b\x1c\x9a'
'\x02 \x18\\.(o\xa8 \xeb\x87\xfa&~\xbd\xe6,\xfb\xa61\xd1\xcd\xcd'
'\xc8\r\x16[\x81\x9a\x19\xda\x93i\xcdp\x12@\xe5\x84\xbe\xc4\x80N'
'\xa0v"\xb2\x80A\x88\x06\xc0\xd2\xbae\x92\x89\xa8\'!\xdd\x00\x88'
'\x06s\xe0\xf74\xe3Yg\xad{$\x17\xd3\x99\xaa\x16\xb0\xeaZ\xd7]\r'
'\xb3\xdc\x1b\x8f\xc1Z\xdfHU\xb5\x92\xac\x82jI\x02')
def test_wrap(self):
wrap = lambda s: Sign.wrap(s, 5)
@@ -79,22 +80,31 @@ class test_Sign(TestCase):
self.assertEquals(
skh, 'pnEp13Zu7xTeKQVQ2RZVaUraE9GXKqFtnXQVUFKXbTE6wsP4wne')
def test_create_ed_public_key(self):
pkh = Sign.create_ed_public_key(
'pnEp13Zu7xTeKQVQ2RZVaUraE9GXKqFtnXQVUFKXbTE6wsP4wne')
self.assertEquals(
pkh, 'nHUUaKHpxyRP4TZZ79tTpXuTpoM8pRNs5crZpGVA5jdrjib5easY')
def get_test_keypair(self):
public = (Base58.VER_NODE_PUBLIC, '\x02' + (32 * 'v'))
private = (Base58.VER_NODE_PRIVATE, 32 * 'k')
Sign.check_validator_public(*public)
Sign.check_master_secret(*private)
Sign.check_validation_public_key(*public)
Sign.check_secret_key(*private)
return (Base58.encode_version(*public), Base58.encode_version(*private))
def test_get_signature(self):
signature = Sign.get_signature(self.SEQUENCE, *self.get_test_keypair())
pk, sk = self.get_test_keypair()
signature = Sign.get_signature(self.SEQUENCE, pk, sk, sk)
self.assertEquals(
signature,
'JAAAABdxIe2DIKUZd9jDjKikknxnDfWCHkSXYZReFenvsmoVCdIw6nMhAnZ2dnZ2'
'dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkDOjlWtQSvRTjuwe+4iNusg0sJM'
'zqkBJwDz30b2SkxZ7Fte/Vx4htM/kkfUfJCaxmxE5N4dHSKuiO9iDHsktqIA')
'dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkYwRAIgXyobHA8sDQxmDJNLE6HI'
'aARlzvcd79/wT068e113gUkCIHkI540JQT2LHwAD7/y3wFE5X3lEXMfgZRkpLZTx'
'kpticBJAzo5VrUEr0U47sHvuIjbrINLCTM6pAScA899G9kpMWexbXv1ceIbTP5JH'
'1HyQmsZsROTeHR0irojvYgx7JLaiAA==')
def test_check(self):
public = Base58.encode_version(Base58.VER_NODE_PRIVATE, 32 * 'k')
@@ -114,14 +124,26 @@ class test_Sign(TestCase):
'pnEp13Zu7xTeKQVQ2RZVaUraE9GXKqFtnXQVUFKXbTE6wsP4wne'],
{'sep': '\n'}]])
def test_create_public(self):
Sign.perform_create_public(
'pnEp13Zu7xTeKQVQ2RZVaUraE9GXKqFtnXQVUFKXbTE6wsP4wne', self.print)
self.assertEquals(
self.results,
[[['[validator_keys]',
'nHUUaKHpxyRP4TZZ79tTpXuTpoM8pRNs5crZpGVA5jdrjib5easY',
'',
'[master_secret]',
'pnEp13Zu7xTeKQVQ2RZVaUraE9GXKqFtnXQVUFKXbTE6wsP4wne'],
{'sep': '\n'}]])
def test_sign(self):
public, private = self.get_test_keypair()
Sign.perform_sign(self.SEQUENCE, public, private, print=self.print)
Sign.perform_sign(self.SEQUENCE, public, private, private, print=self.print)
self.assertEquals(
self.results,
[[['[validation_manifest]'], {}],
[['JAAAABdxIe2DIKUZd9jDjKikknxnDfWCHkSXYZReFenvsmo\n'
'VCdIw6nMhAnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dn\n'
'Z2dnZ2dkDOjlWtQSvRTjuwe+4iNusg0sJMzqkBJwDz30b2S\n'
'kxZ7Fte/Vx4htM/kkfUfJCaxmxE5N4dHSKuiO9iDHsktqIA'],
[['JAAAABdxIe2DIKUZd9jDjKikknxnDfWCHkSXYZReFenvsmoVCdIw6nMhAnZ2dnZ2dnZ2dnZ2\n'
'dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dkYwRAIgXyobHA8sDQxmDJNLE6HIaARlzvcd79/wT068\n'
'e113gUkCIHkI540JQT2LHwAD7/y3wFE5X3lEXMfgZRkpLZTxkpticBJAzo5VrUEr0U47sHvu\n'
'IjbrINLCTM6pAScA899G9kpMWexbXv1ceIbTP5JH1HyQmsZsROTeHR0irojvYgx7JLaiAA=='],
{}]])

View File

@@ -7,6 +7,7 @@
# When testing you can force a boost build by clearing travis caches:
# https://travis-ci.org/ripple/rippled/caches
set -e
if [ ! -d "$BOOST_ROOT/lib" ]
then
wget $BOOST_URL -O /tmp/boost.tar.gz
@@ -15,7 +16,8 @@ then
tar xzf /tmp/boost.tar.gz
cd $BOOST_ROOT && \
./bootstrap.sh --prefix=$BOOST_ROOT && \
./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 && ./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install
./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 -j${NUM_PROCESSORS:-2} &&\
./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install
else
echo "Using cached boost at $BOOST_ROOT"
fi

View File

@@ -3,13 +3,11 @@ machine:
- docker
dependencies:
pre:
- sudo apt-add-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main'
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:afrank/boost
- wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
- echo "deb [arch=amd64 trusted=yes] https://test-mirrors.ripple.com/ubuntu/ trusty testing" | sudo tee /etc/apt/sources.list.d/ripple.list
- sudo apt-get update -qq
- sudo apt-get purge -qq libboost1.48-dev
- sudo apt-get install -qq libboost1.57-all-dev
- sudo apt-get install -qq libboost1.60-all-dev
- sudo apt-get install -qq clang-3.6 gcc-5 g++-5 libobjc-5-dev libgcc-5-dev libstdc++-5-dev libclang1-3.6 libgcc1 libgomp1 libstdc++6 scons protobuf-compiler libprotobuf-dev libssl-dev exuberant-ctags
- lsb_release -a
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 99
@@ -22,26 +20,5 @@ test:
pre:
- scons clang.debug
override:
- | # create gdb script
echo "set env MALLOC_CHECK_=3" > script.gdb
echo "run" >> script.gdb
echo "backtrace full" >> script.gdb
# gdb --help
# gdb segfaults
# - cat script.gdb | gdb --ex 'set print thread-events off' --return-child-result --args build/clang.debug/rippled --unittest
- build/clang.debug/rippled --unittest
- npm install
# Use build/(gcc|clang).debug/rippled
- |
echo "exports.default_server_config = {\"rippled_path\" : \"$HOME/rippled/build/clang.debug/rippled\"};" > test/config.js
# Run integration tests
- npm test
post:
- ./Builds/Docker/build-ci.sh
- docker images
deployment:
docker:
branch: /.*/
commands:
- ./Builds/Docker/push-to-hub.sh
# Execute unit tests under gdb
- gdb -return-child-result -quiet -batch -ex "set env MALLOC_CHECK_=3" -ex "set print thread-events off" -ex run -ex "thread apply all backtrace full" -ex "quit" --args build/clang.debug/rippled --unittest

View File

@@ -22,10 +22,10 @@ master key pair:
Sample output:
```
[validator_keys]
nHUSSzGw4A9zEmFtK2Q2NcWDH9xmGdXMHc1MsVej3QkLTgvDNeBr
nHDwNP6jbJgVKj5zSEjMn8SJhTnPV54Fx5sSiNpwqLbb42nmh3Ln
[master_secret]
pnxayCakmZRQE2qhEVRbFjiWCunReSbN1z64vPL36qwyLgogyYc
paamfhAn5m1NM4UUu5mmvVaHQy8Fb65bkpbaNrvKwX3YMKdjzi2
```
The first value is the master public key. Add the public key to the config
@@ -54,10 +54,11 @@ Sample output:
Securely connecting to 127.0.0.1:5005
{
"result" : {
"status" : "success",
"validation_key" : "TOO EDNA SHUN FEUD STAB JOAN BIAS FLEA WISE BOHR LOSS WEEK",
"validation_public_key" : "n9JzKV3ZrcZ3DW5pwjakj4hpijJ9oMiyrPDGJc3mpsndL6Gf3zwd",
"validation_seed" : "sahzkAajS2dyhjXg2yovjdZhXmjsx"
"status" : "success",
"validation_key" : "MIN HEAT NUN FAWN HIP KAHN BORG PHI BALK ANN TWIG RACY",
"validation_private_key" : "pn6kTqE4WyeRQzZrRp5FnJ5J2vLdSCB5KD3DEyfVw6C9woDBfED",
"validation_public_key" : "n9LtZ9haqYMbzJ92cDd3pu3Lko6uEznrXuYea3ehuhVcwDHF5coX",
"validation_seed" : "sh8bLqqkGBknGcsgRTrFMxcciwytm"
}
}
```
@@ -68,36 +69,37 @@ number as a comment as well (sequence numbers are be explained below):
```
[validation_seed]
sahzkAajS2dyhjXg2yovjdZhXmjsx
# validation_public_key: n9JzKV3ZrcZ3DW5pwjakj4hpijJ9oMiyrPDGJc3mpsndL6Gf3zwd
sh8bLqqkGBknGcsgRTrFMxcciwytm
# validation_public_key: n9LtZ9haqYMbzJ92cDd3pu3Lko6uEznrXuYea3ehuhVcwDHF5coX
# sequence number: 1
```
A manifest is a signed message used to inform other servers of this validator's
ephemeral public key. A manifest contains a sequence number, the new ephemeral
public key, and it is signed with the master secret key. The sequence number
should be higher than the previous sequence number (if it is not, the manifest
will be ignored). Usually the previous sequence number will be incremented by
one. Use the `manifest` script to create a manifest. It has the form:
public key, and it is signed with both the ephemeral and master secret keys.
The sequence number should be higher than the previous sequence number (if it
is not, the manifest will be ignored). Usually the previous sequence number
will be incremented by one. Use the `manifest` script to create a manifest.
It has the form:
```
$ bin/manifest sign sequence_number validation_public_key master_secret
$ bin/manifest sign sequence validation_public_key validation_private_key master_secret
```
For example:
```
$ bin/manifest sign 1 n9JzKV3Z...L6Gf3zwd pnxayCak...yLgogyYc
$ bin/manifest sign 1 n9LtZ9ha...wDHF5coX pn6kTqE4...9woDBfED paamfhAn...YMKdjzi2
```
Sample output:
```
[validation_manifest]
JAAAAAFxIe2PEzNhe996gykB1PJQNoDxvr/Y0XhDELw8d/i
Fcgz3A3MhAjqhKsgZTmK/3BPEI+kzjV1p9ip7pl/AtF7CKd
NSfAH9dkCxezV6apS4FLYzAcQilONx315HvebwAB/pLPaM4
2sWCEppSuLNKN/JJjTABOo9tmAiNnnstF83yvecKMJzniwN
JAAAAAFxIe3t8rIb4Ba8JHI97CbwpxmTq0LhN/7ZAbsNaSwrbHaypHMhAzTuu07YGOvVvB3+
aS0jhP+q0TVgTjGJKhx+yTY1Da3ddkYwRAIgDkmIt3dPNsfeCH3ApMZgpwqG4JwtIlKEymqK
S7v+VqkCIFQXg20ZMpXXT86vmLdlmPspgeUN1scWsuFoPYUUJywycBJAl93+/bZbfZ4quTeM
5y80/OSIcVoWPcHajwrAl68eiAW4MVFeJXvShXNfnT+XsxMjDh0VpOkhvyp971i1MgjBAA==
```
Copy this to the config for this validator. Don't forget to update the comment
@@ -107,4 +109,4 @@ noting the sequence number.
If a master key is compromised, the key may be revoked permanently. To revoke a
master key, sign a manifest with the highest possible sequence number:
`4,294,967,295`
`4294967295`

View File

@@ -260,6 +260,19 @@
# If you need a certificate chain, specify the path to the
# certificate chain here. The chain may include the end certificate.
#
# ssl_ciphers = <cipherlist>
#
# Control the ciphers which the server will support over SSL on the port,
# specified using the OpenSSL "cipher list format".
#
# NOTE If unspecified, rippled will automatically configure a modern
# cipher suite. This default suite should be widely supported.
#
# You should not modify this string unless you have a specific
# reason and cryptographic expertise. Incorrect modification may
# keep rippled from connecting to other instances of rippled or
# prevent RPC and WebSocket clients from connecting.
#
#
#
# [rpc_startup]
@@ -418,16 +431,77 @@
#
# The queue will be limited to this <number> of average ledgers'
# worth of transactions. If the queue fills up, the transactions
# with the lowest fees will be dropped from the queue any time a
# transaction with a higher fee level is added. Default: 20.
# with the lowest fee levels will be dropped from the queue any
# time a transaction with a higher fee level is added.
# Default: 20.
#
# retry_sequence_percent = <number>
#
# If a client resubmits a transaction, the new transaction's fee
# must be more than <number> percent higher than the original
# transaction's fee, or meet the current open ledger fee to be
# considered. Default: 125.
# If a client replaces a transaction in the queue (same sequence
# number as a transaction already in the queue), the new
# transaction's fee must be more than <number> percent higher
# than the original transaction's fee, or meet the current open
# ledger fee to be considered. Default: 25.
#
# multi_txn_percent = <number>
#
# If a client submits multiple transactions (different sequence
# numbers), later transactions must pay a fee at least <number>
# percent higher than the transaction with the previous sequence
# number.
# Default: -90.
#
# minimum_escalation_multiplier = <number>
#
# At ledger close time, the median fee level of the transactions
# in that ledger is used as a multiplier in escalation
# calculations of the next ledger. This minimum value ensures that
# the escalation is significant. Default: 500.
#
# minimum_txn_in_ledger = <number>
#
# Minimum number of transactions that must be allowed into the
# ledger at the minimum required fee before the required fee
# escalates. Default: 5.
#
# minimum_txn_in_ledger_standalone = <number>
#
# Like minimum_txn_in_ledger when rippled is running in standalone
# mode. Default: 1000.
#
# target_txn_in_ledger = <number>
#
# Number of transactions allowed into the ledger at the minimum
# required fee that the queue will "work toward" as long as
# consensus stays healthy. The limit will grow quickly until it
# reaches or exceeds this number. After that the limit may still
# change, but will stay above the target. If consensus is not
# healthy, the limit will be clamped to this value or lower.
# Default: 50.
#
# maximum_txn_in_ledger = <number>
#
# (Optional) Maximum number of transactions that will be allowed
# into the ledger at the minimum required fee before the required
# fee escalates. Default: no maximum.
#
# maximum_txn_per_account = <number>
#
# Maximum number of transactions that one account can have in the
# queue at any given time. Default: 10.
#
# minimum_last_ledger_buffer = <number>
#
# If a transaction has a LastLedgerSequence, it must be at least
# this much larger than the current open ledger sequence number.
# Default: 2.
#
# zero_basefee_transaction_feelevel = <number>
#
# So we don't deal with infinite fee levels, treat any transaction
# with a 0 base fee (ie. SetRegularKey password recovery) as
# having this fee level.
# Default: 256000.
#
#
#-------------------------------------------------------------------------------
@@ -452,14 +526,6 @@
#
#
#
# [validation_quorum]
#
# Sets the minimum number of trusted validations a ledger must have before
# the server considers it fully validated. Note that if you are validating,
# your validation counts.
#
#
#
# [ledger_history]
#
# The number of past ledgers to acquire on server startup and the minimum to
@@ -501,53 +567,36 @@
#
#
#
# [validators]
#
# List of nodes to always accept as validators. Nodes are specified by domain
# or public key.
#
# For domains, rippled will probe for https web servers at the specified
# domain in the following order: ripple.DOMAIN, www.DOMAIN, DOMAIN
#
# For public key entries, a comment may optionally be specified after adding
# a space to the public key.
#
# Examples:
# ripple.com
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
#
#
#
# [validators_file]
#
# Path to file contain a list of nodes to always accept as validators. Use
# this to specify a file other than this file to manage your validators list.
# Path or name of a file that contains the validation public keys of nodes
# to always accept as validators as well as the minimum number of validators
# needed to accept consensus.
#
# If this entry is not present or empty and no nodes from previous runs were
# found in the database, rippled will look for a validators.txt in the config
# directory. If not found there, it will attempt to retrieve the file from
# the [validators_site] web site.
# The contents of the file should include a [validators] and a
# [validation_quorum] entry. [validators] should be followed by
# a list of validation public keys of nodes, one per line, optionally
# followed by a comment separated by whitespace.
# [validation_quorum] should be followed by a number.
#
# After specifying a different [validators_file] or changing the contents of
# the validators file, issue a RPC unl_load command to have rippled load the
# file.
#
# Specify the file by specifying its full path.
# Specify the file by its name or path.
# Unless an absolute path is specified, it will be considered relative to
# the folder in which the rippled.cfg file is located.
#
# Examples:
# C:/home/johndoe/ripple/validators.txt
# /home/johndoe/ripple/validators.txt
# /home/ripple/validators.txt
# C:/home/ripple/validators.txt
#
# Example content:
# [validators]
# n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 RL1
# n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj RL2
# n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C RL3
# n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS RL4
# n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA RL5
#
#
# [validators_site]
#
# Specifies where to find validators.txt for UNL boostrapping and RPC
# unl_network command.
#
# Example: ripple.com
#
# [validation_quorum]
# 3
#
#
# [path_search]
@@ -938,22 +987,11 @@ pool.ntp.org
[ips]
r.ripple.com 51235
# Public keys of the validators that this rippled instance trusts. The latest
# list of validators can be obtained from https://ripple.com/ripple.txt
#
# See also https://wiki.ripple.com/Ripple.txt
#
[validators]
n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 RL1
n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj RL2
n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C RL3
n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS RL4
n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA RL5
# The number of validators rippled needs to accept a consensus.
# Don't change this unless you know what you're doing.
[validation_quorum]
3
# File containing validation quorum and trusted validator keys.
# Unless an absolute path is specified, it will be considered relative to the
# folder in which the rippled.cfg file is located.
[validators_file]
validators.txt
# Turn down default logging to save disk space in the long run.
# Valid values here are trace, debug, info, warning, error, and fatal

View File

@@ -8,20 +8,41 @@
# Blank lines and lines starting with a '#' are ignored.
# All other lines should be hankos or domain names.
#
# [validators]:
# List of nodes to accept as validators specified by public key or domain.
#
# For domains, rippled will probe for https web servers at the specified
# domain in the following order: ripple.DOMAIN, www.DOMAIN, DOMAIN
#
# Examples: redstem.com
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
# [validators]
#
# List of the validation public keys of nodes to always accept as validators.
# A comment may, optionally, be associated with each entry, separated by
# whitespace from the validation public key.
#
# The latest list of recommended validators can be obtained from
# https://ripple.com/ripple.txt
#
# See also https://wiki.ripple.com/Ripple.txt
#
# Examples:
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
#
#
#
# [validation_quorum]
#
# Sets the minimum number of trusted validations a ledger must have before
# the server considers it fully validated. Note that if you are validating,
# your validation counts.
#
# Public keys of the validators that this rippled instance trusts.
[validators]
n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 RL1
n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj RL2
n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C RL3
n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS RL4
n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA RL5
# The number of validators rippled needs to accept a consensus.
# Don't change this unless you know what you're doing.
[validation_quorum]
3

3
docs/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
html
temp
out.txt

22
docs/Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get -y install build-essential g++ git libbz2-dev wget python-dev
# Install Boost
ENV BOOST_SHA 440a59f8bc4023dbe6285c9998b0f7fa288468b889746b1ef00e8b36c559dce1
RUN wget https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.gz
RUN echo "$BOOST_SHA boost_1_62_0.tar.gz" | sha256sum -c
RUN tar xzf boost_1_62_0.tar.gz
RUN cd boost_1_62_0 && ./bootstrap.sh --prefix=/usr/local
RUN cd boost_1_62_0 && ./b2 install
ENV BOOST_ROOT=/boost_1_62_0
# Install dependencies
RUN apt-get -y install doxygen
RUN apt-get -y install xsltproc
CMD cd /opt/rippled/docs && \
chmod +x makeqbk.sh && \
./makeqbk.sh && \
$BOOST_ROOT/b2

71
docs/Jamfile.v2 Normal file
View File

@@ -0,0 +1,71 @@
#
# Copyright (c) 2015-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
import os ;
local broot = [ os.environ BOOST_ROOT ] ;
project rippled/doc ;
using boostbook ;
using quickbook ;
using doxygen ;
path-constant out : . ;
install stylesheets
:
$(broot)/doc/src/boostbook.css
:
<location>$(out)/html
;
explicit stylesheets ;
install images
:
[ glob $(broot)/doc/src/images/*.png ]
:
<location>$(out)/html/images
;
explicit images ;
install callouts
:
[ glob $(broot)/doc/src/images/callouts/*.png ]
:
<location>$(out)/html/images/callouts
;
explicit callout ;
xml doc
:
main.qbk
:
<location>temp
<include>$(broot)/tools/boostbook/dtd
;
boostbook boostdoc
:
doc
:
<xsl:param>chapter.autolabel=0
<xsl:param>boost.root=$(broot)
<xsl:param>chunk.first.sections=1 # Chunk the first top-level section?
<xsl:param>chunk.section.depth=8 # Depth to which sections should be chunked
<xsl:param>generate.section.toc.level=1 # Control depth of TOC generation in sections
<xsl:param>toc.max.depth=2 # How many levels should be created for each TOC?
<xsl:param>toc.section.depth=2 # How deep should recursive sections appear in the TOC?
<xsl:param>generate.toc="chapter toc section toc"
:
<location>temp
<dependency>stylesheets
<dependency>images
;

84
docs/README.md Normal file
View File

@@ -0,0 +1,84 @@
# Building documentation
## Specifying Files
To specify the source files for which to build documentation, modify `INPUT`
and its related fields in `docs/source.dox`. Note that the `INPUT` paths are
relative to the `docs/` directory.
## Install Dependencies
### Windows
Install these dependencies:
1. Install [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html)
2. Download the following zip files from [xsltproc](https://www.zlatkovic.com/pub/libxml/)
(Alternate download: ftp://ftp.zlatkovic.com/libxml/),
and extract the `bin\` folder contents into any folder in your path.
* iconv
* libxml2
* libxslt
* zlib
3. Download [Boost](http://www.boost.org/users/download/)
1. Extract the compressed file contents to your (new) `$BOOST_ROOT` location.
2. Open a command prompt or shell in the `$BOOST_ROOT`.
3. `./bootstrap.bat`
4. (Optional, if you also plan to build rippled) `./bjam.exe --toolset=msvc-14.0
--build-type=complete variant=debug,release link=static runtime-link=static
address-model=64 stage`
5. If it is not already there, add your `$BOOST_ROOT` to your environment `$PATH`.
### MacOS
1. Install doxygen:
* Use homebrew to install: `brew install doxygen`. The executable will be
installed in `/usr/local/bin` which is already in your path.
* Alternatively, install from here: [doxygen](http://www.stack.nl/~dimitri/doxygen/download.html).
You'll then need to make doxygen available to your command line. You can
do this by adding a symbolic link from `/usr/local/bin` to the doxygen
executable. For example, `$ ln -s /Applications/Doxygen.app/Contents/Resources/doxygen /usr/local/bin/doxygen`
2. Install [Boost](http://www.boost.org/users/download/)
1. Extract the compressed file contents to your (new) `$BOOST_ROOT` location.
2. Open a command prompt or shell in the `$BOOST_ROOT`.
3. `$ ./bootstrap.bat`
4. (Optional, if you also plan to build rippled)
`$ ./b2 toolset=clang threading=multi runtime-link=static link=static
cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" adress-model=64`
5. If it is not already there, add your `$BOOST_ROOT` to your environment
`$PATH`. This makes the `b2` command available to the command line.
3. That should be all that's required. In OS X 10.11, at least, libxml2 and
libxslt come pre-installed.
### Linux
1. Install [Docker](https://docs.docker.com/engine/installation/)
2. Build Docker image. From the rippled root folder:
```
sudo docker build -t rippled-docs docs/
```
## Setup project submodules
1. Open a shell in your rippled root folder.
2. `git submodule init`
3. `git submodule update docs/docca`
## Do it
### Windows & MacOS
From the rippled root folder:
```
cd docs
./makeqbk.sh && b2
```
The output will be in `docs/html`.
### Linux
From the rippled root folder:
```
sudo docker run -v $PWD:/opt/rippled --rm rippled-docs
```
The output will be in `docs/html`.

439
docs/boostbook.dtd Normal file
View File

@@ -0,0 +1,439 @@
<!--
BoostBook DTD - development version
For further information, see: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Boost_Documentation_Format
Copyright (c) 2002 by Peter Simons <simons@cryp.to>
Copyright (c) 2003-2004 by Douglas Gregor <doug.gregor -at- gmail.com>
Copyright (c) 2007 by Frank Mori Hess <fmhess@users.sourceforge.net>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
The latest stable DTD module is identified by the PUBLIC and SYSTEM identifiers:
PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN"
SYSTEM "http://www.boost.org/tools/boostbook/dtd/1.1/boostbook.dtd"
$Revision$
$Date$
-->
<!--========== Define XInclude features. ==========-->
<!-- This is not really integrated into the DTD yet. Needs more
research. -->
<!--
<!ELEMENT xi:include (xi:fallback)?>
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
encoding CDATA #IMPLIED>
<!ELEMENT xi:fallback ANY>
<!ATTLIST xi:fallback
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude">
-->
<!ENTITY % local.common.attrib "last-revision CDATA #IMPLIED">
<!--========== Define the BoostBook extensions ==========-->
<!ENTITY % boost.common.attrib "%local.common.attrib;
id CDATA #IMPLIED">
<!ENTITY % boost.namespace.mix
"class|class-specialization|struct|struct-specialization|
union|union-specialization|typedef|enum|
free-function-group|function|overloaded-function|
namespace">
<!ENTITY % boost.template.mix
"template-type-parameter|template-nontype-parameter|template-varargs">
<!ENTITY % boost.class.members
"static-constant|typedef|enum|
copy-assignment|constructor|destructor|method-group|
method|overloaded-method|data-member|class|class-specialization|struct|
struct-specialization|union|union-specialization">
<!ENTITY % boost.class.mix
"%boost.class.members;|free-function-group|function|overloaded-function">
<!ENTITY % boost.class.content
"template?, inherit*, purpose?, description?,
(%boost.class.mix;|access)*">
<!ENTITY % boost.class-specialization.content
"template?, specialization?, inherit?, purpose?, description?,
(%boost.class.mix;|access)*">
<!ENTITY % boost.function.semantics
"purpose?, description?, requires?, effects?, postconditions?,
returns?, throws?, complexity?, notes?, rationale?">
<!ENTITY % library.content
"libraryinfo, (title, ((section|library-reference|testsuite))+)?">
<!ELEMENT library (%library.content;)>
<!ATTLIST library
name CDATA #REQUIRED
dirname CDATA #REQUIRED
html-only CDATA #IMPLIED
url CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT boostbook (title, (chapter|library)*)>
<!ATTLIST boostbook %boost.common.attrib;>
<!ELEMENT libraryinfo (author+, copyright*, legalnotice*, librarypurpose, librarycategory*)>
<!ATTLIST libraryinfo %boost.common.attrib;>
<!ELEMENT librarypurpose (#PCDATA|code|ulink|functionname|methodname|classname|macroname|headername|enumname|globalname)*>
<!ATTLIST librarypurpose %boost.common.attrib;>
<!ELEMENT librarycategory (#PCDATA)>
<!ATTLIST librarycategory
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT libraryname (#PCDATA)>
<!ATTLIST libraryname %boost.common.attrib;>
<!ELEMENT library-reference ANY>
<!ATTLIST library-reference
%boost.common.attrib;>
<!ELEMENT librarylist EMPTY>
<!ATTLIST librarylist %boost.common.attrib;>
<!ELEMENT librarycategorylist (librarycategorydef)*>
<!ATTLIST librarycategorylist %boost.common.attrib;>
<!ELEMENT librarycategorydef (#PCDATA)>
<!ATTLIST librarycategorydef
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT header ANY>
<!ATTLIST header
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT namespace (%boost.namespace.mix;)*>
<!ATTLIST namespace
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT class (%boost.class.content;)>
<!ATTLIST class
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT struct (%boost.class.content;)>
<!ATTLIST struct
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT union (%boost.class.content;)>
<!ATTLIST union
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT class-specialization (%boost.class-specialization.content;)>
<!ATTLIST class-specialization
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT struct-specialization (%boost.class-specialization.content;)>
<!ATTLIST struct-specialization
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT union-specialization (%boost.class-specialization.content;)>
<!ATTLIST union-specialization
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT access (%boost.class.members;)+>
<!ATTLIST access
name CDATA #REQUIRED
%boost.common.attrib;>
<!--========= C++ Templates =========-->
<!ELEMENT template (%boost.template.mix;)*>
<!ATTLIST template %boost.common.attrib;>
<!ELEMENT template-type-parameter (default?, purpose?)>
<!ATTLIST template-type-parameter
name CDATA #REQUIRED
pack CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT template-nontype-parameter (type, default?, purpose?)>
<!ATTLIST template-nontype-parameter
name CDATA #REQUIRED
pack CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT template-varargs EMPTY>
<!ATTLIST template-varargs %boost.common.attrib;>
<!ELEMENT specialization (template-arg)*>
<!ATTLIST specialization %boost.common.attrib;>
<!ELEMENT template-arg ANY>
<!ATTLIST template-arg
pack CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT default ANY>
<!ATTLIST default %boost.common.attrib;>
<!ELEMENT inherit (type, purpose?)>
<!ATTLIST inherit
access CDATA #IMPLIED
pack CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT purpose ANY>
<!ATTLIST purpose %boost.common.attrib;>
<!ELEMENT description ANY>
<!ATTLIST description %boost.common.attrib;>
<!ELEMENT type ANY>
<!ATTLIST type %boost.common.attrib;>
<!ELEMENT typedef (type, purpose?, description?)>
<!ATTLIST typedef
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT enum (enumvalue*, purpose?, description?)>
<!ATTLIST enum
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT enumvalue (default?, purpose?, description?)>
<!ATTLIST enumvalue
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT static-constant (type, default, purpose?, description?)>
<!ATTLIST static-constant
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT data-member (type, purpose?, description?)>
<!ATTLIST data-member
name CDATA #REQUIRED
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT paramtype ANY>
<!ATTLIST paramtype %boost.common.attrib;>
<!ELEMENT effects ANY>
<!ATTLIST effects %boost.common.attrib;>
<!ELEMENT postconditions ANY>
<!ATTLIST postconditions %boost.common.attrib;>
<!ELEMENT method-group (method|overloaded-method)*>
<!ATTLIST method-group
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT constructor (template?, parameter*, %boost.function.semantics;)>
<!ATTLIST constructor
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT destructor (%boost.function.semantics;)>
<!ATTLIST destructor
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT method (template?, type, parameter*, %boost.function.semantics;)>
<!ATTLIST method
name CDATA #REQUIRED
cv CDATA #IMPLIED
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT function (template?, type, parameter*, %boost.function.semantics;)>
<!ATTLIST function
name CDATA #REQUIRED
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT overloaded-method (signature*, %boost.function.semantics;)>
<!ATTLIST overloaded-method
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT overloaded-function (signature*, %boost.function.semantics;)>
<!ATTLIST overloaded-function
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT signature (template?, type, parameter*)>
<!ATTLIST signature
cv CDATA #IMPLIED
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT requires ANY>
<!ATTLIST requires %boost.common.attrib;>
<!ELEMENT returns ANY>
<!ATTLIST returns %boost.common.attrib;>
<!ELEMENT throws ANY>
<!ATTLIST throws %boost.common.attrib;>
<!ELEMENT complexity ANY>
<!ATTLIST complexity %boost.common.attrib;>
<!ELEMENT notes ANY>
<!ATTLIST notes %boost.common.attrib;>
<!ELEMENT rationale ANY>
<!ATTLIST rationale %boost.common.attrib;>
<!ELEMENT functionname (#PCDATA)>
<!ATTLIST functionname
alt CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT enumname (#PCDATA)>
<!ATTLIST enumname
alt CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT macroname (#PCDATA)>
<!ATTLIST macroname
alt CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT headername (#PCDATA)>
<!ATTLIST headername
alt CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT globalname (#PCDATA)>
<!ATTLIST globalname
alt CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT copy-assignment
(template?, type?, parameter*, %boost.function.semantics;)>
<!ATTLIST copy-assignment
cv CDATA #IMPLIED
specifiers CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT free-function-group (function|overloaded-function)*>
<!ATTLIST free-function-group
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT precondition ANY>
<!ATTLIST precondition %boost.common.attrib;>
<!ELEMENT code ANY>
<!ATTLIST code %boost.common.attrib;>
<!ELEMENT using-namespace EMPTY>
<!ATTLIST using-namespace
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT using-class EMPTY>
<!ATTLIST using-class
name CDATA #REQUIRED
%boost.common.attrib;>
<!--========== Boost Testsuite Extensions ==========-->
<!ENTITY % boost.testsuite.tests
"compile-test|link-test|run-test|
compile-fail-test|link-fail-test|run-fail-test">
<!ENTITY % boost.testsuite.test.content
"source*, lib*, requirement*, purpose, if-fails?">
<!ELEMENT testsuite ((%boost.testsuite.tests;)+)>
<!ATTLIST testsuite %boost.common.attrib;>
<!ELEMENT compile-test (%boost.testsuite.test.content;)>
<!ATTLIST compile-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT link-test (%boost.testsuite.test.content;)>
<!ATTLIST link-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT run-test (%boost.testsuite.test.content;)>
<!ATTLIST run-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT compile-fail-test (%boost.testsuite.test.content;)>
<!ATTLIST compile-fail-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT link-fail-test (%boost.testsuite.test.content;)>
<!ATTLIST link-fail-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT run-fail-test (%boost.testsuite.test.content;)>
<!ATTLIST run-fail-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT source (#PCDATA|snippet)*>
<!ELEMENT snippet EMPTY>
<!ATTLIST snippet
name CDATA #REQUIRED>
<!ELEMENT lib (#PCDATA)>
<!ELEMENT requirement (#PCDATA)>
<!ATTLIST requirement
name CDATA #REQUIRED>
<!ELEMENT if-fails ANY>
<!ELEMENT parameter (paramtype, default?, description?)>
<!ATTLIST parameter
name CDATA #IMPLIED
pack CDATA #IMPLIED>
<!ELEMENT programlisting ANY>
<!ATTLIST programlisting
name CDATA #IMPLIED>
<!--========== Customize the DocBook DTD ==========-->
<!ENTITY % local.tech.char.class "|functionname|libraryname|enumname|headername|macroname|code">
<!ENTITY % local.para.class
"|using-namespace|using-class|librarylist|librarycategorylist">
<!ENTITY % local.descobj.class "|libraryinfo">
<!ENTITY % local.classname.attrib "alt CDATA #IMPLIED">
<!ENTITY % local.methodname.attrib "alt CDATA #IMPLIED">
<!ENTITY % local.refentry.class "|library-reference|testsuite">
<!ENTITY % local.title.char.mix "">
<!ENTITY % programlisting.module "IGNORE">
<!ENTITY % parameter.module "IGNORE">
<!ENTITY % function.module "IGNORE">
<!ENTITY % type.module "IGNORE">
<!--========== Import DocBook DTD ==========-->
<!ENTITY % DocBook PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
%DocBook;

1
docs/docca Submodule

Submodule docs/docca added at 335dbf9c36

14
docs/index.xml Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "boostbook.dtd">
<!--
Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-->
<section id="rippled.index">
<title>Index</title>
<index/>
</section>

View File

@@ -1,7 +1,5 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
[/
Copyright (c) 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
@@ -14,15 +12,26 @@
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.
*/
//==============================================================================
]
#ifndef BEAST_SMARTPTR_H_INCLUDED
#define BEAST_SMARTPTR_H_INCLUDED
[library rippled
[quickbook 1.6]
[copyright 2012 - 2016 Ripple Labs Inc.]
[purpose C++ Library]
[license
Distributed under the ISC License
]
[authors [Labs, Ripple]]
[category template]
[category generic]
]
#include <beast/Config.h>
[template mdash[] '''&mdash; ''']
[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
#include <beast/smart_ptr/SharedObject.h>
#include <beast/smart_ptr/SharedPtr.h>
[section:ref Reference]
[include temp/reference.qbk]
[endsect]
#endif
[xinclude index.xml]

11
docs/makeqbk.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
mkdir -p temp
doxygen source.dox
xsltproc temp/combine.xslt temp/index.xml > temp/all.xml
xsltproc reference.xsl temp/all.xml > temp/reference.qbk

61
docs/quickref.xml Normal file
View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "boostbook.dtd">
<!--
Copyright (c) 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.
-->
<informaltable frame="all">
<tgroup cols="3">
<colspec colname="a"/>
<colspec colname="b"/>
<colspec colname="c"/>
<thead>
<row>
<entry valign="center" namest="a" nameend="c">
<bridgehead renderas="sect2">Core</bridgehead>
</entry>
</row>
</thead>
<tbody>
<row>
<entry valign="top">
<bridgehead renderas="sect3">Classes</bridgehead>
<simplelist type="vert" columns="1">
</simplelist>
<bridgehead renderas="sect3">Constants</bridgehead>
<simplelist type="vert" columns="1">
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Functions</bridgehead>
<simplelist type="vert" columns="1">
</simplelist>
<bridgehead renderas="sect3">Type Traits</bridgehead>
<simplelist type="vert" columns="1">
</simplelist>
</entry>
<entry valign="top">
<bridgehead renderas="sect3">Types</bridgehead>
<simplelist type="vert" columns="1">
</simplelist>
<bridgehead renderas="sect3">Concepts</bridgehead>
<simplelist type="vert" columns="1">
</simplelist>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

14
docs/reference.xsl Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- Variables (Edit for your project) -->
<xsl:variable name="doc-ref" select="'rippled.ref.'"/>
<xsl:variable name="doc-ns" select="'ripple'"/>
<xsl:variable name="debug" select="0"/>
<xsl:variable name="private" select="0"/>
<!-- End Variables -->
<xsl:include href="docca/include/docca/doxygen.xsl"/>
</xsl:stylesheet>

341
docs/source.dox Normal file
View File

@@ -0,0 +1,341 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "rippled"
PROJECT_NUMBER =
PROJECT_BRIEF = C++ Library
PROJECT_LOGO =
OUTPUT_DIRECTORY =
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = ../src/
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = NO
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = NO
SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = YES
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = NO
GENERATE_TESTLIST = NO
GENERATE_BUGLIST = NO
GENERATE_DEPRECATEDLIST= NO
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_FILES = NO
SHOW_NAMESPACES = NO
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
\
../src/ripple/protocol/STObject.h \
../src/ripple/protocol/JsonFields.h \
../src/test/support/AbstractClient.h \
../src/test/support/JSONRPCClient.h \
../src/test/support/WSClient.h \
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
CLANG_ASSISTED_PARSING = NO
CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = NO
HTML_OUTPUT = dhtm
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = YES
XML_OUTPUT = temp/
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES
INCLUDE_PATH = ../
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN \
GENERATING_DOCS \
_MSC_VER \
NUDB_POSIX_FILE=1
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/flow1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
images/flow2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -1,31 +0,0 @@
{
"name": "rippled",
"version": "0.0.1",
"description": "Rippled Server",
"private": true,
"directories": {
"test": "test"
},
"dependencies": {
"assert-diff": "^1.0.1",
"async": "~0.2.9",
"babel": "^5.8.21",
"coffee-script": "^1.8.0",
"deep-equal": "0.0.0",
"extend": "~1.2.0",
"lodash": "^3.5.0",
"mocha": "^2.1.0",
"request": "^2.47.0",
"ripple-lib": "0.13.0-rc6.0",
"simple-jsonrpc": "~0.0.2"
},
"scripts": {
"pretest": "node test/pretest.js",
"test": "mocha test/websocket-test.js test/server-test.js test/*-test.{js,coffee}"
},
"repository": {
"type": "git",
"url": "git://github.com/ripple/rippled.git"
},
"readmeFilename": "README.md"
}

View File

@@ -149,13 +149,6 @@
#define RIPPLE_USE_VALIDATORS 0
#endif
/** Config: RIPPLE_PROPOSE_FEATURES
This determines whether to add any features to the proposed transaction set.
*/
#ifndef RIPPLE_PROPOSE_AMENDMENTS
#define RIPPLE_PROPOSE_AMENDMENTS 0
#endif
/** Config: RIPPLE_SINGLE_IO_SERVICE_THREAD
When set, restricts the number of threads calling io_service::run to one.
This is useful when debugging.

30
src/beast/.gitignore vendored
View File

@@ -1,30 +1,2 @@
Docs
._*
*.mode1v3
*.pbxuser
*.perspectivev3
*.user
*.ncb
*.suo
*.obj
*.ilk
*.pch
*.pdb
*.dep
*.idb
*.manifest
*.manifest.res
*.o
*.opensdf
*.d
*.sdf
xcuserdata
contents.xcworkspacedata
.DS_Store
.svn
profile
Builds/VisualStudio2012/Debug
Builds/VisualStudio2012/Release
project.xcworkspace
modules/beast_cryptopp
bin/
bin64/

View File

@@ -1,26 +1,88 @@
sudo: false
language: cpp
compiler:
- gcc
- clang
env:
global:
- LLVM_VERSION=3.8.0
# Maintenance note: to move to a new version
# of boost, update both BOOST_ROOT and BOOST_URL.
# Note that for simplicity, BOOST_ROOT's final
# namepart must match the folder name internal
# to boost's .tar.gz.
- LCOV_ROOT=$HOME/lcov
- VALGRIND_ROOT=$HOME/valgrind-install
- BOOST_ROOT=$HOME/boost_1_61_0
- BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.gz'
packages: &gcc5_pkgs
- gcc-5
- g++-5
- python-software-properties
- libssl-dev
- libffi-dev
- libstdc++6
- binutils-gold
# Provides a backtrace if the unittests crash
- gdb
# Needed for installing valgrind
- subversion
- automake
- autotools-dev
- libc6-dbg
matrix:
include:
# GCC/Coverage/Autobahn (if master or develop branch)
- compiler: gcc
env:
- GCC_VER=5
- VARIANT=coverage
- ADDRESS_MODEL=64
- BUILD_SYSTEM=cmake
- PATH=$PWD/cmake/bin:$PATH
addons: &ao_gcc5
apt:
sources: ['ubuntu-toolchain-r-test']
packages: *gcc5_pkgs
# Clang/UndefinedBehaviourSanitizer
- compiler: clang
env:
- GCC_VER=5
- VARIANT=usan
- CLANG_VER=3.8
- ADDRESS_MODEL=64
- UBSAN_OPTIONS='print_stacktrace=1'
- BUILD_SYSTEM=cmake
- PATH=$PWD/cmake/bin:$PATH
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
addons: *ao_gcc5
# Clang/AddressSanitizer
- compiler: clang
env:
- GCC_VER=5
- VARIANT=asan
- CLANG_VER=3.8
- ADDRESS_MODEL=64
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
addons: *ao_gcc5
cache:
directories:
- $BOOST_ROOT
- $VALGRIND_ROOT
- llvm-$LLVM_VERSION
- cmake
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:boost-latest/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq python-software-properties
- sudo apt-get install -qq g++-4.8
- sudo apt-get install -qq libboost1.55-all-dev
- sudo apt-get install -qq libssl-dev
- sudo apt-get install -qq gcc-4.8
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
- sudo update-alternatives --set gcc /usr/bin/gcc-4.8
# - sudo apt-get -y install binutils-gold
- g++ -v
- clang -v
- scripts/install-dependencies.sh
script:
# Abort build on failure
- set -e
- scons
- travis_retry scripts/build-and-test.sh
after_script:
- cat nohup.out || echo "nohup.out already deleted"
notifications:
email:
false

View File

@@ -1,139 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_BEASTCONFIG_H_INCLUDED
#define BEAST_BEASTCONFIG_H_INCLUDED
/** Configuration file for Beast.
This sets various configurable options for Beast. In order to compile you
must place a copy of this file in a location where your build environment
can find it, and then customize its contents to suit your needs.
@file BeastConfig.h
*/
//------------------------------------------------------------------------------
//
// Unit Tests
//
//------------------------------------------------------------------------------
/** Config: BEAST_NO_UNIT_TEST_INLINE
Prevents unit test definitions from being inserted into a global table.
*/
#ifndef BEAST_NO_UNIT_TEST_INLINE
#define BEAST_NO_UNIT_TEST_INLINE 0
#endif
//------------------------------------------------------------------------------
//
// Diagnostics
//
//------------------------------------------------------------------------------
/** Config: BEAST_FORCE_DEBUG
Normally, BEAST_DEBUG is set to 1 or 0 based on compiler and project
settings, but if you define this value, you can override this to force it
to be true or false.
*/
#ifndef BEAST_FORCE_DEBUG
//#define BEAST_FORCE_DEBUG 1
#endif
/** Config: BEAST_CHECK_MEMORY_LEAKS
Enables a memory-leak check for certain objects when the app terminates.
See the LeakChecked class for more details about enabling leak checking for
specific classes.
*/
#ifndef BEAST_CHECK_MEMORY_LEAKS
//#define BEAST_CHECK_MEMORY_LEAKS 0
#endif
//------------------------------------------------------------------------------
//
// Libraries
//
//------------------------------------------------------------------------------
/** Config: BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
In a Visual C++ build, this can be used to stop the required system libs
being automatically added to the link stage.
*/
#ifndef BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
//#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES 1
#endif
/** Config: BEAST_INCLUDE_ZLIB_CODE
This can be used to disable Beast's embedded 3rd-party zlib code.
You might need to tweak this if you're linking to an external zlib library
in your app, but for normal apps, this option should be left alone.
If you disable this, you might also want to set a value for
BEAST_ZLIB_INCLUDE_PATH, to specify the path where your zlib headers live.
*/
#ifndef BEAST_INCLUDE_ZLIB_CODE
//#define BEAST_INCLUDE_ZLIB_CODE 1
#endif
/** Config: BEAST_ZLIB_INCLUDE_PATH
This is included when BEAST_INCLUDE_ZLIB_CODE is set to zero.
*/
#ifndef BEAST_ZLIB_INCLUDE_PATH
#define BEAST_ZLIB_INCLUDE_PATH <zlib.h>
#endif
/** Config: BEAST_SQLITE_FORCE_NDEBUG
Setting this option forces sqlite into release mode even if NDEBUG is not set
*/
#ifndef BEAST_SQLITE_FORCE_NDEBUG
//#define BEAST_SQLITE_FORCE_NDEBUG 1
#endif
/** Config: BEAST_FUNCTIONAL_USES_###
<functional> source configuration.
Set one of these to manually force a particular implementation of bind().
If nothing is chosen then beast will use whatever is appropriate for your
environment based on what is available.
If you override these, set ONE to 1 and the rest to 0
*/
#ifndef BEAST_FUNCTIONAL_USES_STD
//#define BEAST_FUNCTIONAL_USES_STD 0
#endif
#ifndef BEAST_FUNCTIONAL_USES_TR1
//#define BEAST_FUNCTIONAL_USES_TR1 0
#endif
#ifndef BEAST_FUNCTIONAL_USES_BOOST
//#define BEAST_FUNCTIONAL_USES_BOOST 0
#endif
//------------------------------------------------------------------------------
//
// Boost
//
//------------------------------------------------------------------------------
/** Config: BEAST_USE_BOOST_FEATURES
This activates boost specific features and improvements. If this is
turned on, the include paths for your build environment must be set
correctly to find the boost headers.
*/
#ifndef BEAST_USE_BOOST_FEATURES
//#define BEAST_USE_BOOST_FEATURES 1
#endif
#endif

277
src/beast/CHANGELOG.md Normal file
View File

@@ -0,0 +1,277 @@
1.0.0-b23
* Tune websocket echo server for performance
* Add file and line number to thrown exceptions
* Better logging in async echo server
* Add copy special members
* Fix message constructor and special members
* Travis CI improvements
--------------------------------------------------------------------------------
1.0.0-b22
* Fix broken Intellisense
* Implement the Asio deallocation-before-invocation guarantee
* Add handler helpers
* Avoid copies in handler_alloc
* Update README.md example programs
* Fix websocket stream read documentation
* Disable Boost.Coroutine deprecation warning
* Update documentation examples
--------------------------------------------------------------------------------
1.0.0-b21
* Remove extraneous includes
--------------------------------------------------------------------------------
1.0.0-b20
ZLib
* Add ZLib module
API Changes:
* Rename HTTP identifiers
--------------------------------------------------------------------------------
1.0.0-b19
* Boost library min/max guidance
* Improvements to code coverage
* Use boost::lexical_cast instead of std::to_string
* Fix prepare_buffers value_type
* Fix consuming_buffers value_type
* Better buffer_cat
HTTP
* Make chunk_encode public
* Add write, async_write, operator<< for message_headers
* Add read, async_read for message_headers
* Fix with_body example
WebSocket
* Optimize utf8 validation
* Optimize mask operations
API Changes:
* Refactor message and message_headers declarations
* prepared_buffers is private
* consume_buffers is removed
--------------------------------------------------------------------------------
1.0.0-b18
* Increase optimization settings for MSVC builds
HTTP
* Check invariants in parse_op:
* Clean up message docs
WebSocket
* Write buffer option does not change capacity
* Close connection during async_read on close frame
* Add pong, async pong to stream
Core
* Meet DynamicBuffer requirements for static_streambuf
* Fix write_frame masking and auto-fragment handling
Extras
* unit_test::suite fixes:
- New overload of fail() specifies file and line
- BEAST_EXPECTS only evaluates the reason string on a failure
* Add zlib module
--------------------------------------------------------------------------------
1.0.0-b17
* Change implicit to default value in example
* Tidy up some declarations
* Fix basic_streambuf::capacity
* Add basic_streambuf::alloc_size
* Parser callbacks may not throw
* Fix Reader concept doc typo
* Add is_Reader trait
* Tidy up basic_headers for documentation
* Tidy up documentation
* Add basic_parser_v1::reset
* Fix handling of body_what::pause in basic_parser_v1
* Add headers_parser
* Engaged invokable is destructible
* Improve websocket example in README.md
* Refactor read_size_helper
API Changes:
* Added init() to Reader requirements
* Reader must be nothrow constructible
* Reader is now constructed right before reading the body
- The message passed on construction is filled in
* Rework HTTP concepts:
- Writer uses write instead of operator()
- Refactor traits to use void_t
- Remove is_ReadableBody, is_WritableBody
- Add has_reader, has_writer, is_Reader, is_Writer
- More friendly compile errors on failed concept checks
* basic_parser_v1 requires all callbacks present
* on_headers parser callback now returns void
* on_body_what is a new required parser callback returning body_what
--------------------------------------------------------------------------------
1.0.0-b16
* Make value optional in param-list
* Frame processing routines are member functions
* Fix on_headers called twice from basic_parser_v1
* Constrain parser_v1 constructor
* Improve first line serialization
* Add pause option to on_headers interface
* Refactor base_parser_v1 callback traits:
* Refine Parser concept
* Relax ForwardIterator requirements in FieldSequence
* Fix websocket failure testing
* Refine Writer concept and fix exemplar in documentation
API Changes:
* Rename mask_buffer_size to write_buffer_size
* Make auto_fragment a boolean option
The message class hierarchy is refactored (breaking change):
* One message class now models both HTTP/1 and HTTP/2 messages
* message_v1, request_v1, response_v1 removed
* New classes basic_request and basic_response model
messages without the body.
Error resolution: Callers should use message, request,
and response instead of message_v1, request_v1, and
response_v1 respectively.
--------------------------------------------------------------------------------
1.0.0-b15
* rfc7230 section 3.3.2 compliance
* Add HTTPS example
* Add Secure WebSocket example
* Fix message_v1 constructor
* Tidy up DynamicBuffer requirements
* Tidy up error types and headers
* Fix handling empty HTTP headers in parser_v1
--------------------------------------------------------------------------------
1.0.0-b14
* Add missing rebind to handler_alloc
* Fix error handling in http server examples
* Fix CMake scripts for MinGW
* Use BOOST_ASSERT
* Better WebSocket decorator
* Update and tidy documentation
--------------------------------------------------------------------------------
1.0.0-b13
* dstream improvements
* Remove bin and bin64 directories
* Tidy up .vcxproj file groupings
--------------------------------------------------------------------------------
1.0.0-b12
* Use -p to print suites from unit test main.
* BEAST_EXPECTS to add a reason string to test failures
* Fix unit test runner to output all case names
* Update README for build requirements
* Rename to CHANGELOG.md
--------------------------------------------------------------------------------
1.0.0-b11
* Set URI in generated WebSocket Upgrade requests
* Rename echo server class and file names
* Rename to DynamicBuffer in some code and documentation
* Fix integer warnings in Windows builds
* Add 32 and 64 bit Windows build support
* Update README for build instructions and more
* Add repository and documention banners
--------------------------------------------------------------------------------
1.0.0-b10
* Fix compilation warnings
* Add websocketpp comparison to HTML documentation
--------------------------------------------------------------------------------
1.0.0-b9
* Fix CMakeLists.txt
--------------------------------------------------------------------------------
1.0.0-b8
* Fix include in example code
* Fix basic_headers rfc2616 Section 4.2 compliance
--------------------------------------------------------------------------------
1.0.0-b7
* Fix prepare by calling init. prepare() can throw depending on the
implementation of Writer. Publicly provided beast::http writers never throw.
* Fixes to example HTTP server
* Fully qualify ambiguous calls to read and parse
* Remove deprecated http::stream wrapper
* Example HTTP server now calculates the MIME-type
* Fixes and documentation for teardown and use with SSL:
* Add example code to rfc7230 javadocs
* Remove extraneous header file <beast/http/status.hpp>
* Add skip_body parser option
--------------------------------------------------------------------------------
1.0.0-b6
* Use SFINAE on return values
* Use beast::error_code instead of nested types
* Tidy up use of GENERATING_DOCS
* Remove obsolete RFC2616 functions
* Add message swap members and free functions
* Add HTTP field value parser containers: ext_list, param_list, token_list
* Fixes for some corner cases in basic_parser_v1
* Configurable limits on headers and body sizes in basic_parser_v1
API Changes:
* ci_equal is moved to beast::http namespace, in rfc7230.hpp
* "DynamicBuffer","dynabuf" renamed from "Streambuf", "streambuf". See:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html#requirements.dynamic_buffers
* basic_parser_v1 adheres to rfc7230 as strictly as possible
--------------------------------------------------------------------------------

120
src/beast/CMakeLists.txt Normal file
View File

@@ -0,0 +1,120 @@
# Part of Beast
cmake_minimum_required (VERSION 3.2)
project (Beast)
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
if (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /MP /W4 /wd4100 /bigobj /D _WIN32_WINNT=0x0601 /D _SCL_SECURE_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /Oi /Ot /GL /MT")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Oi /Ot /MT")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
# for RelWithDebInfo builds, disable incremental linking
# since CMake sets it ON by default for that build type and it
# causes warnings
string (REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" replacement_flags
${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${replacement_flags})
else()
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED COMPONENTS coroutine context thread filesystem program_options system)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIR})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
endif()
add_definitions ("-DBOOST_COROUTINES_NO_DEPRECATION_WARNING")
if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR})
find_program(HOMEBREW brew)
if (NOT HOMEBREW STREQUAL "HOMEBREW-NOTFOUND")
execute_process(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
find_package(OpenSSL)
if (MINGW)
link_libraries(${Boost_LIBRARIES} ws2_32 mswsock)
endif()
if ("${VARIANT}" STREQUAL "coverage")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
elseif ("${VARIANT}" STREQUAL "asan")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
elseif ("${VARIANT}" STREQUAL "usan")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
elseif ("${VARIANT}" STREQUAL "debug")
set(CMAKE_BUILD_TYPE DEBUG)
elseif ("${VARIANT}" STREQUAL "release")
set(CMAKE_BUILD_TYPE RELEASE)
endif()
function(DoGroupSources curdir rootdir folder)
file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
DoGroupSources(${curdir}/${child} ${rootdir} ${folder})
elseif(${child} STREQUAL "CMakeLists.txt")
source_group("" FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
else()
string(REGEX REPLACE ^${rootdir} ${folder} groupname ${curdir})
string(REPLACE "/" "\\" groupname ${groupname})
source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
endif()
endforeach()
endfunction()
function(GroupSources curdir folder)
DoGroupSources(${curdir} ${curdir} ${folder})
endfunction()
include_directories (extras)
include_directories (include)
file(GLOB_RECURSE BEAST_INCLUDES
${PROJECT_SOURCE_DIR}/include/beast/*.hpp
${PROJECT_SOURCE_DIR}/include/beast/*.ipp
)
file(GLOB_RECURSE EXTRAS_INCLUDES
${PROJECT_SOURCE_DIR}/extras/beast/*.hpp
${PROJECT_SOURCE_DIR}/extras/beast/*.ipp
)
add_subdirectory (examples)
if (NOT OPENSSL_FOUND)
message("OpenSSL not found. Not building examples/ssl")
else()
add_subdirectory (examples/ssl)
endif()
add_subdirectory (test)
add_subdirectory (test/core)
add_subdirectory (test/http)
add_subdirectory (test/websocket)
add_subdirectory (test/zlib)

122
src/beast/Jamroot Normal file
View File

@@ -0,0 +1,122 @@
#
# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
import os ;
import feature ;
import boost ;
boost.use-project ;
if [ os.name ] = SOLARIS
{
lib socket ;
lib nsl ;
}
else if [ os.name ] = NT
{
lib ws2_32 ;
lib mswsock ;
}
else if [ os.name ] = HPUX
{
lib ipv6 ;
}
else if [ os.name ] = QNXNTO
{
lib socket ;
}
else if [ os.name ] = HAIKU
{
lib network ;
}
if [ os.name ] = NT
{
lib ssl : : <name>ssleay32 ;
lib crypto : : <name>libeay32 ;
}
else
{
lib ssl ;
lib crypto ;
}
variant coverage
:
debug
:
<cxxflags>"-fprofile-arcs -ftest-coverage"
<linkflags>"-lgcov"
;
variant asan
:
release
:
<cxxflags>"-fsanitize=address -fno-omit-frame-pointer"
<linkflags>"-fsanitize=address"
;
variant msan
:
debug
:
<cxxflags>"-fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins=2 -fsanitize-memory-use-after-dtor"
<linkflags>"-fsanitize=memory"
;
variant usan
:
debug
:
<cxxflags>"-fsanitize=undefined -fno-omit-frame-pointer"
<linkflags>"-fsanitize=undefined"
;
project beast
: requirements
<include>.
<include>./extras
<include>./include
#<use>/boost//headers
<library>/boost/system//boost_system
<library>/boost/coroutine//boost_coroutine
<library>/boost/filesystem//boost_filesystem
<library>/boost/program_options//boost_program_options
<define>BOOST_ALL_NO_LIB=1
<threading>multi
<runtime-link>shared
<debug-symbols>on
<toolset>gcc:<cxxflags>-std=c++11
<toolset>gcc:<cxxflags>-Wno-unused-parameter
<toolset>clang:<cxxflags>-std=c++11
<toolset>clang:<cxxflags>-Wno-unused-parameter
<toolset>gcc:<cxxflags>-Wno-unused-variable # Temporary until we can figure out -isystem
<toolset>clang:<cxxflags>-Wno-unused-variable # Temporary until we can figure out -isystem
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS=1
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS=1
<toolset>msvc:<cxxflags>"/wd4100 /bigobj"
<toolset>msvc,<variant>release:<cxxflags>"/Ob2 /Oi /Ot"
<os>LINUX:<define>_XOPEN_SOURCE=600
<os>LINUX:<define>_GNU_SOURCE=1
<os>SOLARIS:<define>_XOPEN_SOURCE=500
<os>SOLARIS:<define>__EXTENSIONS__
<os>SOLARIS:<library>socket
<os>SOLARIS:<library>nsl
<os>NT:<define>_WIN32_WINNT=0x0601
<os>NT,<toolset>cw:<library>ws2_32
<os>NT,<toolset>cw:<library>mswsock
<os>NT,<toolset>gcc:<library>ws2_32
<os>NT,<toolset>gcc:<library>mswsock
<os>NT,<toolset>gcc-cygwin:<define>__USE_W32_SOCKETS
: usage-requirements
:
build-dir bin
;
build-project test ;
build-project examples ;

231
src/beast/README.md Normal file
View File

@@ -0,0 +1,231 @@
<img width="880" height = "80" alt = "Beast"
src="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/readme.png">
[![Join the chat at https://gitter.im/vinniefalco/Beast](https://badges.gitter.im/vinniefalco/Beast.svg)](https://gitter.im/vinniefalco/Beast?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status]
(https://travis-ci.org/vinniefalco/Beast.svg?branch=master)](https://travis-ci.org/vinniefalco/Beast) [![codecov]
(https://codecov.io/gh/vinniefalco/Beast/branch/master/graph/badge.svg)](https://codecov.io/gh/vinniefalco/Beast) [![coveralls]
(https://coveralls.io/repos/github/vinniefalco/Beast/badge.svg?branch=master)](https://coveralls.io/github/vinniefalco/Beast?branch=master) [![Documentation]
(https://img.shields.io/badge/documentation-master-brightgreen.svg)](http://vinniefalco.github.io/beast/) [![License]
(https://img.shields.io/badge/license-boost-brightgreen.svg)](LICENSE_1_0.txt)
# HTTP and WebSocket implementations built on Boost.Asio
---
## Beast at CppCon 2016
Presentation
(slides: <a href="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/CppCon2016.pdf">CppCon2016.pdf</a>)
<a href="https://www.youtube.com/watch?v=uJZgRcvPFwI">
<img width="320" height = "180" alt = "Beast"
src="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/CppCon2016.png">
</a>
---
## Contents
- [Introduction](#introduction)
- [Description](#description)
- [Requirements](#requirements)
- [Building](#building)
- [Usage](#usage)
- [Licence](#licence)
- [Contact](#contact)
## Introduction
Beast is a header-only, cross-platform C++ library built on Boost.Asio and
Boost, containing two modules implementing widely used network protocols.
Beast.HTTP offers a universal model for describing, sending, and receiving
HTTP messages while Beast.WebSocket provides a complete implementation of
the WebSocket protocol. Their design achieves these goals:
* **Symmetry.** Interfaces are role-agnostic; the same interfaces can be
used to build clients, servers, or both.
* **Ease of Use.** HTTP messages are modeled using simple, readily
accessible objects. Functions and classes used to send and receive HTTP
or WebSocket messages are designed to resemble Boost.Asio as closely as
possible. Users familiar with Boost.Asio will be immediately comfortable
using this library.
* **Flexibility.** Interfaces do not mandate specific implementation
strategies; important decisions such as buffer or thread management are
left to users of the library.
* **Performance.** The implementation performs competitively, making it a
realistic choice for building high performance network servers.
* **Scalability.** Development of network applications that scale to thousands
of concurrent connections is possible with the implementation.
* **Basis for further abstraction.** The interfaces facilitate the
development of other libraries that provide higher levels of abstraction.
Beast is used in [rippled](https://github.com/ripple/rippled), an
open source server application that implements a decentralized
cryptocurrency system.
## Description
This software is currently in beta: interfaces may change.
For recent changes see the [CHANGELOG](CHANGELOG.md).
The library has been submitted to the
[Boost Library Incubator](http://rrsd.com/blincubator.com/bi_library/beast-2/?gform_post_id=1579)
* [Project Site](http://vinniefalco.github.io/)
* [Repository](https://github.com/vinniefalco/Beast)
* [Project Documentation](http://vinniefalco.github.io/beast/)
* [Autobahn.testsuite results](http://vinniefalco.github.io/autobahn/index.html)
## Requirements
* Boost 1.58 or higher
* C++11 or greater
* OpenSSL (optional)
## Building
Beast is header-only so there are no libraries to build or link with.
To use Beast in your project, simply copy the Beast sources to your
project's source tree (alternatively, bring Beast into your Git repository
using the `git subtree` or `git submodule` commands). Then, edit your
build scripts to add the `include/` directory to the list of paths checked
by the C++ compiler when searching for includes. Beast `#include` lines
will look like this:
```C++
#include <beast/http.hpp>
#include <beast/websocket.hpp>
```
To link your program successfully, you'll need to add the Boost.System
library to link with. If you use coroutines you'll also need the
Boost.Coroutine library. Please visit the Boost documentation for
instructions on how to do this for your particular build system.
For the examples and tests, Beast provides build scripts for Boost.Build (bjam)
and CMake. Developers using Microsoft Visual Studio can generate Visual Studio
project files by executing these commands from the root of the repository:
```
cd bin
cmake .. # for 32-bit Windows build
cd ../bin64
cmake .. # for Linux/Mac builds, OR
cmake -G"Visual Studio 14 2015 Win64" .. # for 64-bit Windows builds
```
To build with Boost.Build, it is necessary to have the bjam executable
in your path. And bjam needs to know how to find the Boost sources. The
easiest way to do this is make sure that the version of bjam in your path
is the one at the root of the Boost source tree, which is built when
running `bootstrap.sh` (or `bootstrap.bat` on Windows).
Once bjam is in your path, simply run bjam in the root of the Beast
repository to automatically build the required Boost libraries if they
are not already built, build the examples, then build and run the unit
tests.
The files in the repository are laid out thusly:
```
./
bin/ Holds executables and project files
bin64/ Holds 64-bit Windows executables and project files
doc/ Source code and scripts for the documentation
include/ Add this to your compiler includes
beast/
extras/ Additional APIs, may change
examples/ Self contained example programs
test/ Unit tests and benchmarks
```
## Usage
These examples are complete, self-contained programs that you can build
and run yourself (they are in the `examples` directory).
Example WebSocket program:
```C++
#include <beast/core/to_string.hpp>
#include <beast/websocket.hpp>
#include <boost/asio.hpp>
#include <iostream>
#include <string>
int main()
{
// Normal boost::asio setup
std::string const host = "echo.websocket.org";
boost::asio::io_service ios;
boost::asio::ip::tcp::resolver r{ios};
boost::asio::ip::tcp::socket sock{ios};
boost::asio::connect(sock,
r.resolve(boost::asio::ip::tcp::resolver::query{host, "80"}));
// WebSocket connect and send message using beast
beast::websocket::stream<boost::asio::ip::tcp::socket&> ws{sock};
ws.handshake(host, "/");
ws.write(boost::asio::buffer(std::string("Hello, world!")));
// Receive WebSocket message, print and close using beast
beast::streambuf sb;
beast::websocket::opcode op;
ws.read(op, sb);
ws.close(beast::websocket::close_code::normal);
std::cout << beast::to_string(sb.data()) << "\n";
}
```
Example HTTP program:
```C++
#include <beast/http.hpp>
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <string>
int main()
{
// Normal boost::asio setup
std::string const host = "boost.org";
boost::asio::io_service ios;
boost::asio::ip::tcp::resolver r{ios};
boost::asio::ip::tcp::socket sock{ios};
boost::asio::connect(sock,
r.resolve(boost::asio::ip::tcp::resolver::query{host, "http"}));
// Send HTTP request using beast
beast::http::request<beast::http::empty_body> req;
req.method = "GET";
req.url = "/";
req.version = 11;
req.fields.replace("Host", host + ":" +
boost::lexical_cast<std::string>(sock.remote_endpoint().port()));
req.fields.replace("User-Agent", "Beast");
beast::http::prepare(req);
beast::http::write(sock, req);
// Receive and print HTTP response using beast
beast::streambuf sb;
beast::http::response<beast::http::streambuf_body> resp;
beast::http::read(sock, sb, resp);
std::cout << resp;
}
```
## License
Distributed under the Boost Software License, Version 1.0.
(See accompanying file [LICENSE_1_0.txt](LICENSE_1_0.txt) or copy at
http://www.boost.org/LICENSE_1_0.txt)
## Contact
Please report issues or questions here:
https://github.com/vinniefalco/Beast/issues

View File

@@ -1,31 +0,0 @@
# Beast: An amazing cross platform library
Contains cross platform objects to do a variety of useful things.
No external dependencies, no complicated build steps.
Things people need for building peer to peer, concurrent, cryptographic systems.
The hope is that this will replace the use of boost and other cumbersome jalopies.
## JUCE
Parts of Beast are based on the juce_core module which is provided under the ISC
license. More information about JUCE is available at
http://www.juce.com
## License
Beast is provided under the terms of the ISC license:
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.

View File

@@ -1,139 +0,0 @@
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import itertools
import ntpath
import os
import random
import sys
def add_beast_to_path():
python_home = os.path.join(os.getcwd(), 'python')
if python_home not in sys.path:
sys.path.append(python_home)
add_beast_to_path()
from beast.env.AddCommonFlags import add_common_flags
from beast.env.AddUserEnv import add_user_env
from beast.env import Print
from beast.platform import GetEnvironment
from beast.util import Boost
from beast.util import File
from beast.util import Tests
VARIANT_DIRECTORIES = {
'beast': ('bin', 'beast'),
'modules': ('bin', 'modules'),
}
BOOST_LIBRARIES = '' #boost_system'
MAIN_PROGRAM_FILE = 'beast/unit_test/tests/main.cpp'
DOTFILE = '~/.scons'
def main():
File.validate_libraries(Boost.LIBPATH, BOOST_LIBRARIES)
defaults = GetEnvironment.get_environment(ARGUMENTS)
working = copy.deepcopy(defaults)
add_common_flags(defaults)
add_user_env(working, DOTFILE)
add_common_flags(working)
Print.print_build_config(working, defaults)
env = Environment(**working)
for name, path in VARIANT_DIRECTORIES.items():
env.VariantDir(os.path.join(*path), name, duplicate=0)
env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
#Tests.run_tests(env, MAIN_PROGRAM_FILE, '.', '.test.cpp')
#main()
#-------------------------------------------------------------------------------
def is_unity(path):
b, e = os.path.splitext(path)
return os.path.splitext(b)[1] == '.unity' and e in ['.c', '.cpp']
def files(base):
for parent, _, files in os.walk(base):
for path in files:
path = os.path.join(parent, path)
yield os.path.normpath(path)
#-------------------------------------------------------------------------------
'''
/MP /GS /W3 /wd"4018" /wd"4244" /wd"4267" /Gy- /Zc:wchar_t
/I"D:\lib\OpenSSL-Win64\include" /I"D:\lib\boost_1_55_0"
/I"..\..\src\protobuf\src" /I"..\..\src\protobuf\vsprojects"
/I"..\..\src\leveldb" /I"..\..\src\leveldb\include" /I"..\..\build\proto"
/Zi /Gm- /Od /Fd"..\..\build\obj\VisualStudio2013\Debug.x64\vc120.pdb"
/fp:precise /D "_CRTDBG_MAP_ALLOC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE"
/D "_VARIADIC_MAX=10" /D "_WIN32_WINNT=0x0600" /D "_SCL_SECURE_NO_WARNINGS"
/D "_CRT_SECURE_NO_WARNINGS" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope
/RTC1 /GR /Gd /MTd /openmp- /Fa"..\..\build\obj\VisualStudio2013\Debug.x64\"
/EHa /nologo /Fo"..\..\build\obj\VisualStudio2013\Debug.x64\"
/Fp"..\..\build\obj\VisualStudio2013\Debug.x64\rippled.pch"
'''
# Path to this SConstruct file
base_dir = Dir('#').srcnode().get_abspath()
base_env = Environment(
tools = ['default', 'VSProject'],
CCCOMSTR = '',
CMDLINE_QUIET = 1,
CPPPATH = [
os.environ['BOOST_ROOT'],
os.environ['OPENSSL_ROOT']
],
CPPDEFINES = [
'_WIN32_WINNT=0x6000']
)
#base_env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
env = base_env
bin_dir = os.path.join(base_dir, 'bin')
srcs = filter(is_unity, list(files('beast')) + list(files('modules')))
for variant in ['Debug']: #, 'Release']:
for platform in ['Win32']:
#env = base_env.Clone()
#env.Replace(PRINT_CMD_LINE_FUNC=Print.print_cmd_line)
variant_dir = os.path.join(bin_dir, variant + '.' + platform)
env.VariantDir(os.path.join(variant_dir, 'beast'), 'beast', duplicate=0)
env.VariantDir(os.path.join(variant_dir, 'modules'), 'modules', duplicate=0)
env.Append(CCFLAGS=[
'/EHsc',
'/bigobj',
'/Fd${TARGET}.pdb'
])
if variant == 'Debug':
env.Append(CCFLAGS=[
'/MTd',
'/Od',
'/Zi'
])
else:
env.Append(CCFLAGS=[
'/MT',
'/Ox'
])
variant_srcs = [os.path.join(variant_dir, os.path.relpath(f, base_dir)) for f in srcs]
beast = env.StaticLibrary(
target = os.path.join(variant_dir, 'beast.lib'),
source = variant_srcs)
env.VSProject (
'out',
buildtarget = beast,
source = filter(is_unity, list(files('beast')) + list(files('modules'))))
env.Default ('out.vcxproj')
#env.Default (os.path.join(bin_dir,'Debug.Win32', 'beast.lib'))

58
src/beast/TODO.txt Normal file
View File

@@ -0,0 +1,58 @@
* Add writer::prepare(msg&) interface to set Content-Type
Boost.Http
* Use enum instead of bool in isRequest
Docs:
* Include Example program listings in the docs
* Fix index in docs
* melpon sandbox?
* Implement cleanup-param to remove spaces around template arguments
e.g. in basic_streambuf move constructor members
* Don't put using namespace at file scope in examples,
do something like "using ba = boost::asio" instead.
Core:
* Replace Jamroot with Jamfile
* Fix bidirectional buffers iterators operator->()
* Complete allocator testing in basic_streambuf
WebSocket:
* Minimize sizeof(websocket::stream)
* Move check for message size limit to account for compression
* more invokable unit test coverage
* More control over the HTTP request and response during handshakes
* optimized versions of key/masking, choose prepared_key size
* Give callers control over the http request/response used during handshake
* Investigate poor autobahn results in Debug builds
* Fall through composed operation switch cases
* Use close_code::no_code instead of close_code::none
* Make request_type, response_type public APIs,
use in stream member function signatures
HTTP:
* Define Parser concept in HTTP
- Need parse version of read() so caller can set parser options
like maximum size of headers, maximum body size, etc
* add bool should_close(message_v1 const&) to replace the use
of eof return value from write and async_write
* More fine grained parser errors
* HTTP parser size limit with test (configurable?)
* HTTP parser trailers with test
* Decode chunk encoding parameters
* URL parser, strong URL character checking in HTTP parser
* Fix prepare() calling content_length() without init()
* Complete allocator testing in basic_streambuf, basic_headers
* Custom HTTP error codes for various situations
* Branch prediction hints in parser
* Check basic_parser_v1 against rfc7230 for leading message whitespace
* Fix the order of message constructor parameters:
body first then headers (since body is constructed with arguments more often)
* Unit tests for char tables
* Remove status_code() from API when isRequest==true, et. al.
* Permit sending trailers and parameters in chunk-encoding chunks
Future:
* SOCKS proxy client and server implementations

View File

@@ -1,106 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Portions of this file are from JUCE.
Copyright (c) 2013 - Raw Material Software Ltd.
Please visit http://www.juce.com
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.
*/
//==============================================================================
#ifndef BEAST_ARITHMETIC_H_INCLUDED
#define BEAST_ARITHMETIC_H_INCLUDED
#include <beast/Config.h>
#include <cmath>
#include <cstdint>
#include <algorithm>
namespace beast {
//==============================================================================
/** Constrains a value to keep it within a given range.
This will check that the specified value lies between the lower and upper bounds
specified, and if not, will return the nearest value that would be in-range. Effectively,
it's like calling bmax (lowerLimit, bmin (upperLimit, value)).
Note that it expects that lowerLimit <= upperLimit. If this isn't true,
the results will be unpredictable.
@param lowerLimit the minimum value to return
@param upperLimit the maximum value to return
@param valueToConstrain the value to try to return
@returns the closest value to valueToConstrain which lies between lowerLimit
and upperLimit (inclusive)
@see blimit0To, bmin, bmax
*/
template <typename Type>
inline Type blimit (const Type lowerLimit,
const Type upperLimit,
const Type valueToConstrain) noexcept
{
// if these are in the wrong order, results are unpredictable.
bassert (lowerLimit <= upperLimit);
return (valueToConstrain < lowerLimit) ? lowerLimit
: ((upperLimit < valueToConstrain) ? upperLimit
: valueToConstrain);
}
/** Returns true if a value is at least zero, and also below a specified upper limit.
This is basically a quicker way to write:
@code valueToTest >= 0 && valueToTest < upperLimit
@endcode
*/
template <typename Type>
inline bool isPositiveAndBelow (Type valueToTest, Type upperLimit) noexcept
{
bassert (Type() <= upperLimit); // makes no sense to call this if the upper limit is itself below zero..
return Type() <= valueToTest && valueToTest < upperLimit;
}
template <>
inline bool isPositiveAndBelow (const int valueToTest, const int upperLimit) noexcept
{
bassert (upperLimit >= 0); // makes no sense to call this if the upper limit is itself below zero..
return static_cast <unsigned int> (valueToTest) < static_cast <unsigned int> (upperLimit);
}
//==============================================================================
/** Handy function for getting the number of elements in a simple const C array.
E.g.
@code
static int myArray[] = { 1, 2, 3 };
int numElements = numElementsInArray (myArray) // returns 3
@endcode
*/
template <typename Type, int N>
int numElementsInArray (Type (&array)[N])
{
(void) array; // (required to avoid a spurious warning in MS compilers)
(void) sizeof (0[array]); // This line should cause an error if you pass an object with a user-defined subscript operator
return N;
}
}
#endif

View File

@@ -1,60 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Portions of this file are from JUCE.
Copyright (c) 2013 - Raw Material Software Ltd.
Please visit http://www.juce.com
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.
*/
//==============================================================================
#ifndef BEAST_CONFIG_H_INCLUDED
#define BEAST_CONFIG_H_INCLUDED
// VFALCO NOTE this is analogous to <boost/config.hpp>
#if !defined(BEAST_COMPILER_CONFIG) && !defined(BEAST_NO_COMPILER_CONFIG) && !defined(BEAST_NO_CONFIG)
#include <beast/config/SelectCompilerConfig.h>
#endif
#ifdef BEAST_COMPILER_CONFIG
#include BEAST_COMPILER_CONFIG
#endif
#if !defined(BEAST_STDLIB_CONFIG) && !defined(BEAST_NO_STDLIB_CONFIG) && !defined(BEAST_NO_CONFIG) && defined(__cplusplus)
#include <beast/config/SelectStdlibConfig.h>
#endif
#ifdef BEAST_STDLIB_CONFIG
#include BEAST_STDLIB_CONFIG
#endif
#if !defined(BEAST_PLATFORM_CONFIG) && !defined(BEAST_NO_PLATFORM_CONFIG) && !defined(BEAST_NO_CONFIG)
#include <beast/config/SelectCompilerConfig.h>
#endif
#ifdef BEAST_PLATFORM_CONFIG
#include BEAST_PLATFORM_CONFIG
#endif
// Legacy
#include <beast/Version.h>
#include <beast/config/PlatformConfig.h>
#include <beast/config/CompilerConfig.h>
#include <beast/config/StandardConfig.h>
#include <beast/config/ConfigCheck.h>
// Suffix
#include <beast/config/Suffix.h>
#endif

View File

@@ -1,360 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Portions of this file are from JUCE.
Copyright (c) 2013 - Raw Material Software Ltd.
Please visit http://www.juce.com
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.
*/
//==============================================================================
#ifndef BEAST_HEAPBLOCK_H_INCLUDED
#define BEAST_HEAPBLOCK_H_INCLUDED
#include <cstddef>
#include <cstdlib>
#include <stdexcept>
#include <beast/Memory.h>
// If the MSVC debug heap headers were included, disable
// the macros during the juce include since they conflict.
#ifdef _CRTDBG_MAP_ALLOC
#pragma push_macro("calloc")
#pragma push_macro("free")
#pragma push_macro("malloc")
#pragma push_macro("realloc")
#pragma push_macro("_recalloc")
#pragma push_macro("_aligned_free")
#pragma push_macro("_aligned_malloc")
#pragma push_macro("_aligned_offset_malloc")
#pragma push_macro("_aligned_realloc")
#pragma push_macro("_aligned_recalloc")
#pragma push_macro("_aligned_offset_realloc")
#pragma push_macro("_aligned_offset_recalloc")
#pragma push_macro("_aligned_msize")
#undef calloc
#undef free
#undef malloc
#undef realloc
#undef _recalloc
#undef _aligned_free
#undef _aligned_malloc
#undef _aligned_offset_malloc
#undef _aligned_realloc
#undef _aligned_recalloc
#undef _aligned_offset_realloc
#undef _aligned_offset_recalloc
#undef _aligned_msize
#endif
namespace beast {
#ifndef DOXYGEN
namespace HeapBlockHelper
{
template <bool shouldThrow>
struct ThrowOnFail { static void check (void*) {} };
template<>
struct ThrowOnFail <true> { static void check (void* data) { if (data == nullptr) throw std::bad_alloc(); } };
}
#endif
//==============================================================================
/**
Very simple container class to hold a pointer to some data on the heap.
When you need to allocate some heap storage for something, always try to use
this class instead of allocating the memory directly using malloc/free.
A HeapBlock<char> object can be treated in pretty much exactly the same way
as an char*, but as long as you allocate it on the stack or as a class member,
it's almost impossible for it to leak memory.
It also makes your code much more concise and readable than doing the same thing
using direct allocations,
E.g. instead of this:
@code
int* temp = (int*) malloc (1024 * sizeof (int));
memcpy (temp, xyz, 1024 * sizeof (int));
free (temp);
temp = (int*) calloc (2048 * sizeof (int));
temp[0] = 1234;
memcpy (foobar, temp, 2048 * sizeof (int));
free (temp);
@endcode
..you could just write this:
@code
HeapBlock <int> temp (1024);
memcpy (temp, xyz, 1024 * sizeof (int));
temp.calloc (2048);
temp[0] = 1234;
memcpy (foobar, temp, 2048 * sizeof (int));
@endcode
The class is extremely lightweight, containing only a pointer to the
data, and exposes malloc/realloc/calloc/free methods that do the same jobs
as their less object-oriented counterparts. Despite adding safety, you probably
won't sacrifice any performance by using this in place of normal pointers.
The throwOnFailure template parameter can be set to true if you'd like the class
to throw a std::bad_alloc exception when an allocation fails. If this is false,
then a failed allocation will just leave the heapblock with a null pointer (assuming
that the system's malloc() function doesn't throw).
@see Array, MemoryBlock
*/
template <class ElementType, bool throwOnFailure = false>
class HeapBlock
{
public:
//==============================================================================
/** Creates a HeapBlock which is initially just a null pointer.
After creation, you can resize the array using the malloc(), calloc(),
or realloc() methods.
*/
HeapBlock() noexcept
: data (nullptr)
{
}
/** Creates a HeapBlock containing a number of elements.
The contents of the block are undefined, as it will have been created by a
malloc call.
If you want an array of zero values, you can use the calloc() method or the
other constructor that takes an InitialisationState parameter.
*/
explicit HeapBlock (const size_t numElements)
: data (static_cast <ElementType*> (std::malloc (numElements * sizeof (ElementType))))
{
throwOnAllocationFailure();
}
/** Creates a HeapBlock containing a number of elements.
The initialiseToZero parameter determines whether the new memory should be cleared,
or left uninitialised.
*/
HeapBlock (const size_t numElements, const bool initialiseToZero)
: data (static_cast <ElementType*> (initialiseToZero
? std::calloc (numElements, sizeof (ElementType))
: std::malloc (numElements * sizeof (ElementType))))
{
throwOnAllocationFailure();
}
HeapBlock(HeapBlock const&) = delete;
HeapBlock& operator= (HeapBlock const&) = delete;
/** Destructor.
This will free the data, if any has been allocated.
*/
~HeapBlock()
{
std::free (data);
}
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
HeapBlock (HeapBlock&& other) noexcept
: data (other.data)
{
other.data = nullptr;
}
HeapBlock& operator= (HeapBlock&& other) noexcept
{
std::swap (data, other.data);
return *this;
}
#endif
//==============================================================================
/** Returns a raw pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline operator ElementType*() const noexcept { return data; }
/** Returns a raw pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline ElementType* getData() const noexcept { return data; }
/** Returns a void pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline operator void*() const noexcept { return static_cast <void*> (data); }
/** Returns a void pointer to the allocated data.
This may be a null pointer if the data hasn't yet been allocated, or if it has been
freed by calling the free() method.
*/
inline operator const void*() const noexcept { return static_cast <const void*> (data); }
/** Lets you use indirect calls to the first element in the array.
Obviously this will cause problems if the array hasn't been initialised, because it'll
be referencing a null pointer.
*/
inline ElementType* operator->() const noexcept { return data; }
/** Returns a reference to one of the data elements.
Obviously there's no bounds-checking here, as this object is just a dumb pointer and
has no idea of the size it currently has allocated.
*/
template <typename IndexType>
inline ElementType& operator[] (IndexType index) const noexcept { return data [index]; }
/** Returns a pointer to a data element at an offset from the start of the array.
This is the same as doing pointer arithmetic on the raw pointer itself.
*/
template <typename IndexType>
inline ElementType* operator+ (IndexType index) const noexcept { return data + index; }
//==============================================================================
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
inline bool operator== (const ElementType* const otherPointer) const noexcept { return otherPointer == data; }
/** Compares the pointer with another pointer.
This can be handy for checking whether this is a null pointer.
*/
inline bool operator!= (const ElementType* const otherPointer) const noexcept { return otherPointer != data; }
//==============================================================================
/** Allocates a specified amount of memory.
This uses the normal malloc to allocate an amount of memory for this object.
Any previously allocated memory will be freed by this method.
The number of bytes allocated will be (newNumElements * elementSize). Normally
you wouldn't need to specify the second parameter, but it can be handy if you need
to allocate a size in bytes rather than in terms of the number of elements.
The data that is allocated will be freed when this object is deleted, or when you
call free() or any of the allocation methods.
*/
void malloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{
std::free (data);
data = static_cast <ElementType*> (std::malloc (newNumElements * elementSize));
throwOnAllocationFailure();
}
/** Allocates a specified amount of memory and clears it.
This does the same job as the malloc() method, but clears the memory that it allocates.
*/
void calloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{
std::free (data);
data = static_cast <ElementType*> (std::calloc (newNumElements, elementSize));
throwOnAllocationFailure();
}
/** Allocates a specified amount of memory and optionally clears it.
This does the same job as either malloc() or calloc(), depending on the
initialiseToZero parameter.
*/
void allocate (const size_t newNumElements, bool initialiseToZero)
{
std::free (data);
data = static_cast <ElementType*> (initialiseToZero
? std::calloc (newNumElements, sizeof (ElementType))
: std::malloc (newNumElements * sizeof (ElementType)));
throwOnAllocationFailure();
}
/** Re-allocates a specified amount of memory.
The semantics of this method are the same as malloc() and calloc(), but it
uses realloc() to keep as much of the existing data as possible.
*/
void reallocate (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
{
data = static_cast <ElementType*> (data == nullptr ? std::malloc (newNumElements * elementSize)
: std::realloc (data, newNumElements * elementSize));
throwOnAllocationFailure();
}
/** Frees any currently-allocated data.
This will free the data and reset this object to be a null pointer.
*/
void free_up()
{
std::free (data);
data = nullptr;
}
/** Swaps this object's data with the data of another HeapBlock.
The two objects simply exchange their data pointers.
*/
template <bool otherBlockThrows>
void swapWith (HeapBlock <ElementType, otherBlockThrows>& other) noexcept
{
std::swap (data, other.data);
}
/** This fills the block with zeros, up to the number of elements specified.
Since the block has no way of knowing its own size, you must make sure that the number of
elements you specify doesn't exceed the allocated size.
*/
void clear (size_t numElements) noexcept
{
zeromem (data, sizeof (ElementType) * numElements);
}
/** This type alias can be used to get the type of the heapblock's elements. */
using Type = ElementType;
private:
//==============================================================================
ElementType* data;
void throwOnAllocationFailure() const
{
HeapBlockHelper::ThrowOnFail<throwOnFailure>::check (data);
}
};
}
#ifdef _CRTDBG_MAP_ALLOC
#pragma pop_macro("_aligned_msize")
#pragma pop_macro("_aligned_offset_recalloc")
#pragma pop_macro("_aligned_offset_realloc")
#pragma pop_macro("_aligned_recalloc")
#pragma pop_macro("_aligned_realloc")
#pragma pop_macro("_aligned_offset_malloc")
#pragma pop_macro("_aligned_malloc")
#pragma pop_macro("_aligned_free")
#pragma pop_macro("_recalloc")
#pragma pop_macro("realloc")
#pragma pop_macro("malloc")
#pragma pop_macro("free")
#pragma pop_macro("calloc")
#endif
#endif

View File

@@ -1,27 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_STRINGS_H_INCLUDED
#define BEAST_STRINGS_H_INCLUDED
#include <beast/strings/String.h>
#include <beast/strings/NewLine.h>
#endif

View File

@@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_THREADS_H_INCLUDED
#define BEAST_THREADS_H_INCLUDED
#include <beast/threads/UnlockGuard.h>
#include <beast/threads/TryLockGuard.h>
#include <beast/threads/SharedLockGuard.h>
#include <beast/threads/SharedMutexAdapter.h>
#include <beast/threads/SpinLock.h>
#include <beast/threads/Stoppable.h>
#include <beast/threads/Thread.h>
#include <beast/threads/WaitableEvent.h>
#include <beast/threads/ScopedWrapperContext.h>
#include <beast/threads/semaphore.h>
#endif

View File

@@ -1,45 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_VERSION_H_INCLUDED
#define BEAST_VERSION_H_INCLUDED
#include <string>
/** Current BEAST version number. */
unsigned int const BEAST_VERSION_MAJOR = 1;
unsigned int const BEAST_VERSION_MINOR = 0;
unsigned int const BEAST_VERSION_BUILD = 0;
unsigned int const BEAST_VERSION =
(BEAST_VERSION_MAJOR << 16) +
(BEAST_VERSION_MINOR << 8) +
BEAST_VERSION_BUILD;
inline
std::string
getBeastVersion()
{
return "Beast v" + std::to_string (BEAST_VERSION_MAJOR) +
"." + std::to_string (BEAST_VERSION_MINOR) +
"." + std::to_string (BEAST_VERSION_BUILD);
}
#endif

View File

@@ -1,29 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#include <beast/asio/impl/IPAddressConversion.cpp>
#include <beast/asio/impl/error.cpp>
#include <beast/asio/tests/bind_handler.test.cpp>
#include <beast/asio/tests/streambuf.test.cpp>
#include <beast/asio/tests/error_test.cpp>

View File

@@ -1,14 +0,0 @@
# beast::asio
Wrappers and utilities to make working with boost::asio easier.
## Rules for asynchronous objects
If an object calls asynchronous initiating functions it must either:
1. Manage its lifetime by being reference counted
or
2. Wait for all pending completion handlers to be called before
allowing itself to be destroyed.

View File

@@ -1,164 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_ASIO_BIND_HANDLER_H_INCLUDED
#define BEAST_ASIO_BIND_HANDLER_H_INCLUDED
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <functional>
#include <type_traits>
#include <utility>
namespace beast {
namespace asio {
namespace detail {
/** Nullary handler that calls Handler with bound arguments.
The rebound handler provides the same io_service execution
guarantees as the original handler.
*/
template <class DeducedHandler, class... Args>
class bound_handler
{
private:
using args_type = std::tuple <std::decay_t <Args>...>;
std::decay_t <DeducedHandler> m_handler;
args_type m_args;
template <class Handler, class Tuple, std::size_t... S>
static void invoke (Handler& h, Tuple& args,
std::index_sequence <S...>)
{
h (std::get <S> (args)...);
}
public:
using result_type = void;
explicit
bound_handler (DeducedHandler&& handler, Args&&... args)
: m_handler (std::forward <DeducedHandler> (handler))
, m_args (std::forward <Args> (args)...)
{
}
void
operator() ()
{
invoke (m_handler, m_args,
std::index_sequence_for <Args...> ());
}
void
operator() () const
{
invoke (m_handler, m_args,
std::index_sequence_for <Args...> ());
}
template <class Function>
friend
void
asio_handler_invoke (Function& f, bound_handler* h)
{
boost_asio_handler_invoke_helpers::
invoke (f, h->m_handler);
}
template <class Function>
friend
void
asio_handler_invoke (Function const& f, bound_handler* h)
{
boost_asio_handler_invoke_helpers::
invoke (f, h->m_handler);
}
friend
void*
asio_handler_allocate (std::size_t size, bound_handler* h)
{
return boost_asio_handler_alloc_helpers::
allocate (size, h->m_handler);
}
friend
void
asio_handler_deallocate (void* p, std::size_t size, bound_handler* h)
{
boost_asio_handler_alloc_helpers::
deallocate (p, size, h->m_handler);
}
friend
bool
asio_handler_is_continuation (bound_handler* h)
{
return boost_asio_handler_cont_helpers::
is_continuation (h->m_handler);
}
};
}
//------------------------------------------------------------------------------
/** Binds parameters to a handler to produce a nullary functor.
The returned handler provides the same io_service execution guarantees
as the original handler. This is designed to use as a replacement for
io_service::wrap, to ensure that the handler will not be invoked
immediately by the calling function.
*/
template <class DeducedHandler, class... Args>
detail::bound_handler <DeducedHandler, Args...>
bind_handler (DeducedHandler&& handler, Args&&... args)
{
return detail::bound_handler <DeducedHandler, Args...> (
std::forward <DeducedHandler> (handler),
std::forward <Args> (args)...);
}
}
}
//------------------------------------------------------------------------------
namespace std {
template <class Handler, class... Args>
void bind (beast::asio::detail::bound_handler <
Handler, Args...>, ...) = delete;
#if 0
template <class Handler, class... Args>
struct is_bind_expression <
beast::asio::detail::bound_handler <Handler, Args...>
> : std::true_type
{
};
#endif
}
#endif

View File

@@ -1,59 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#include <beast/asio/error.h>
#include <boost/lexical_cast.hpp>
namespace beast {
namespace asio {
// This buffer must be at least 120 bytes, most examples use 256.
// https://www.openssl.org/docs/crypto/ERR_error_string.html
static std::uint32_t const errorBufferSize (256);
std::string
asio_message (boost::system::error_code const& ec)
{
std::string error;
if (ec.category () == boost::asio::error::get_ssl_category ())
{
error = " ("
+ boost::lexical_cast<std::string> (ERR_GET_LIB (ec.value ()))
+ ","
+ boost::lexical_cast<std::string> (ERR_GET_FUNC (ec.value ()))
+ ","
+ boost::lexical_cast<std::string> (ERR_GET_REASON (ec.value ()))
+ ") ";
//
char buf[errorBufferSize];
::ERR_error_string_n (ec.value (), buf, errorBufferSize);
error += buf;
}
else
{
error = ec.message ();
}
return error;
}
}
}

View File

@@ -1,41 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_ASIO_PLACEHOLDERS_H_INCLUDED
#define BEAST_ASIO_PLACEHOLDERS_H_INCLUDED
#include <functional>
namespace beast {
namespace asio {
namespace placeholders {
// asio placeholders that work with std::bind
namespace {
static auto const error (std::placeholders::_1);
static auto const bytes_transferred (std::placeholders::_2);
static auto const iterator (std::placeholders::_2);
static auto const signal_number (std::placeholders::_2);
}
}
}
}
#endif

View File

@@ -1,679 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_ASIO_STREAMBUF_H_INCLUDED
#define BEAST_ASIO_STREAMBUF_H_INCLUDED
#include <beast/utility/empty_base_optimization.h>
#include <boost/asio/buffer.hpp>
#include <boost/intrusive/list.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <algorithm>
#include <cassert>
#include <memory>
#include <exception>
#include <type_traits>
#include <string>
#include <utility>
namespace beast {
namespace asio {
/** Implements asio::streambuf interface using multiple buffers. */
template <class Allocator>
class basic_streambuf
: private empty_base_optimization<Allocator>
{
public:
using size_type = typename std::allocator_traits<Allocator>::size_type;
using const_buffer = boost::asio::const_buffer;
using mutable_buffer = boost::asio::mutable_buffer;
private:
class element;
using alloc_traits = std::allocator_traits<Allocator>;
using list_type = typename boost::intrusive::make_list <element,
boost::intrusive::constant_time_size <true>>::type;
using iterator = typename list_type::iterator;
using const_iterator = typename list_type::const_iterator;
/* These diagrams illustrate the layout and state variables.
Input and output contained entirely in one element:
0 out_
|<-------------+------------------------------------------->|
in_pos_ out_pos_ out_end_
Output contained in first and second elements:
out_
|<------+----------+------->| |<----------+-------------->|
in_pos_ out_pos_ out_end_
Output contained in the second element:
out_
|<------------+------------>| |<----+-------------------->|
in_pos_ out_pos_ out_end_
Output contained in second and third elements:
out_
|<-----+-------->| |<-------+------>| |<--------------->|
in_pos_ out_pos_ out_end_
Input sequence is empty:
out_
|<------+------------------>| |<-----------+------------->|
out_pos_ out_end_
in_pos_
Output sequence is empty:
out_
|<------+------------------>| |<------+------------------>|
in_pos_ out_pos_
out_end_
The end of output can point to the end of an element.
But out_pos_ should never point to the end:
out_
|<------+------------------>| |<------+------------------>|
in_pos_ out_pos_ out_end_
When the input sequence entirely fills the last element and
the output sequence is empty, out_ will point to the end of
the list of buffers, and out_pos_ and out_end_ will be 0:
|<------+------------------>| out_ == list_.end()
in_pos_ out_pos_ == 0
out_end_ == 0
*/
list_type list_;
size_type block_size_;
size_type block_size_next_;
size_type in_size_ = 0; // size of the input sequence
iterator out_; // element that contains out_pos_
size_type in_pos_ = 0; // input offset in list_.front()
size_type out_pos_ = 0; // output offset in *out_
size_type out_end_ = 0; // output end offset in list_.back()
public:
class const_buffers_type;
class mutable_buffers_type;
basic_streambuf (basic_streambuf const& other) = delete;
basic_streambuf& operator= (basic_streambuf const& other) = delete;
basic_streambuf& operator= (basic_streambuf&& other) = delete;
~basic_streambuf();
explicit
basic_streambuf(std::size_t block_size = 16*1024,
Allocator const& alloc = Allocator{});
basic_streambuf (basic_streambuf&& other);
/** Get the maximum size of the basic_streambuf. */
size_type
max_size() const
{
return std::numeric_limits<std::size_t>::max();
}
/** Get the size of the input sequence. */
size_type
size() const
{
return in_size_;
}
/** Get a list of buffers that represents the output sequence, with the given size. */
mutable_buffers_type
prepare (size_type n);
/** Move bytes from the output sequence to the input sequence. */
void
commit (size_type n);
/** Get a list of buffers that represents the input sequence. */
const_buffers_type
data() const;
/** Remove bytes from the input sequence. */
void
consume (size_type n);
private:
void
debug_check() const;
};
//------------------------------------------------------------------------------
template <class Allocator>
class basic_streambuf<Allocator>::element
: public boost::intrusive::list_base_hook <
boost::intrusive::link_mode <boost::intrusive::normal_link>>
{
private:
size_type const size_; // size of the allocation minus sizeof(element)
public:
element (element const&) = delete;
element& operator= (element const&) = delete;
explicit
element (size_type block_size)
: size_(block_size)
{ }
size_type
size() const
{
return size_;
}
size_type
alloc_size() const
{
return size_ + sizeof(*this);
}
char*
data() const
{
return const_cast<char*>(
reinterpret_cast<char const*>(this+1));
}
};
//------------------------------------------------------------------------------
template <class Allocator>
class basic_streambuf<Allocator>::const_buffers_type
{
public:
using value_type = const_buffer;
private:
struct transform
{
using argument_type = element;
using result_type = value_type;
basic_streambuf const* streambuf_ = nullptr;
transform() = default;
explicit
transform (basic_streambuf const& streambuf)
: streambuf_ (&streambuf)
{
}
value_type const
operator() (element const& e) const;
};
basic_streambuf const* streambuf_ = nullptr;
public:
using const_iterator = boost::transform_iterator<
transform, typename list_type::const_iterator,
value_type, value_type>;
const_buffers_type() = default;
const_buffers_type (const_buffers_type const&) = default;
const_buffers_type& operator= (const_buffers_type const&) = default;
const_iterator
begin() const
{
return const_iterator (streambuf_->list_.begin(),
transform(*streambuf_));
}
const_iterator
end() const
{
return const_iterator (streambuf_->out_ ==
streambuf_->list_.end() ? streambuf_->list_.end() :
std::next(streambuf_->out_), transform(*streambuf_));
}
private:
friend class basic_streambuf;
explicit
const_buffers_type (basic_streambuf const& streambuf);
};
template <class Allocator>
basic_streambuf<Allocator>::const_buffers_type::const_buffers_type (
basic_streambuf const& streambuf)
: streambuf_ (&streambuf)
{
}
template <class Allocator>
auto
basic_streambuf<Allocator>::const_buffers_type::
transform::operator() (element const& e) const ->
value_type const
{
return value_type (e.data(),
(streambuf_->out_ == streambuf_->list_.end() ||
&e != &*streambuf_->out_) ? e.size() : streambuf_->out_pos_) +
(&e == &*streambuf_->list_.begin() ?
streambuf_->in_pos_ : 0);
}
//------------------------------------------------------------------------------
template <class Allocator>
class basic_streambuf<Allocator>::mutable_buffers_type
{
public:
using value_type = mutable_buffer;
private:
struct transform
{
using argument_type = element;
using result_type = value_type;
basic_streambuf const* streambuf_ = nullptr;
transform() = default;
explicit
transform (basic_streambuf const& streambuf)
: streambuf_ (&streambuf)
{
}
value_type const
operator() (element const& e) const;
};
basic_streambuf const* streambuf_;
public:
using const_iterator = boost::transform_iterator<
transform, typename list_type::const_iterator,
value_type, value_type>;
mutable_buffers_type() = default;
mutable_buffers_type (mutable_buffers_type const&) = default;
mutable_buffers_type& operator= (mutable_buffers_type const&) = default;
const_iterator
begin() const
{
return const_iterator (streambuf_->out_,
transform(*streambuf_));
}
const_iterator
end() const
{
return const_iterator (streambuf_->list_.end(),
transform(*streambuf_));
}
private:
friend class basic_streambuf;
mutable_buffers_type (basic_streambuf const& streambuf);
};
template <class Allocator>
basic_streambuf<Allocator>::mutable_buffers_type::mutable_buffers_type (
basic_streambuf const& streambuf)
: streambuf_ (&streambuf)
{
}
template <class Allocator>
auto
basic_streambuf<Allocator>::mutable_buffers_type::
transform::operator() (element const& e) const ->
value_type const
{
return value_type (e.data(), &e == &*std::prev(streambuf_->list_.end()) ?
streambuf_->out_end_ : e.size()) + (&e == &*streambuf_->out_ ?
streambuf_->out_pos_ : 0);
}
//------------------------------------------------------------------------------
template <class Allocator>
basic_streambuf<Allocator>::~basic_streambuf()
{
for(auto iter = list_.begin(); iter != list_.end();)
{
auto& e = *iter++;
size_type const n = e.alloc_size();
alloc_traits::destroy(this->member(), &e);
alloc_traits::deallocate(this->member(),
reinterpret_cast<char*>(&e), n);
}
}
template <class Allocator>
basic_streambuf<Allocator>::basic_streambuf(std::size_t block_size,
Allocator const& alloc)
: empty_base_optimization<Allocator>(alloc)
, block_size_ (block_size)
, block_size_next_ (block_size)
, out_ (list_.end())
{
if (! (block_size > 0))
throw std::invalid_argument(
"basic_streambuf: invalid block_size");
}
template <class Allocator>
basic_streambuf<Allocator>::basic_streambuf (basic_streambuf&& other)
: empty_base_optimization<Allocator>(other.member())
, list_ (std::move(other.list_))
, block_size_ (other.block_size_)
, block_size_next_ (other.block_size_next_)
, in_size_ (other.in_size_)
, out_ (other.out_)
, in_pos_ (other.in_pos_)
, out_pos_ (other.out_pos_)
, out_end_ (other.out_end_)
{
other.in_size_ = 0;
other.out_ = other.list_.end();
other.in_pos_ = 0;
other.out_pos_ = 0;
other.out_end_ = 0;
}
template <class Allocator>
auto
basic_streambuf<Allocator>::prepare (size_type n) ->
mutable_buffers_type
{
iterator pos = out_;
if (pos != list_.end())
{
auto const avail = pos->size() - out_pos_;
if (n > avail)
{
n -= avail;
while (++pos != list_.end())
{
if (n < pos->size())
{
out_end_ = n;
n = 0;
++pos;
break;
}
n -= pos->size();
}
}
else
{
++pos;
out_end_ = out_pos_ + n;
n = 0;
}
debug_check();
}
if (n > 0)
{
assert(pos == list_.end());
for(;;)
{
auto const avail = block_size_next_;
auto& e = *reinterpret_cast<element*>(alloc_traits::allocate(
this->member(), avail + sizeof(element)));
alloc_traits::construct(this->member(), &e, avail);
list_.push_back(e);
if (out_ == list_.end())
{
out_ = list_.iterator_to(e);
debug_check();
}
if (n <= avail)
{
out_end_ = n;
debug_check();
break;
}
n -= avail;
}
}
else
{
while (pos != list_.end())
{
auto& e = *pos++;
list_.erase(list_.iterator_to(e));
auto const len = e.alloc_size();
alloc_traits::destroy(this->member(), &e);
alloc_traits::deallocate(this->member(),
reinterpret_cast<char*>(&e), len);
}
debug_check();
}
return mutable_buffers_type (*this);
}
template <class Allocator>
void
basic_streambuf<Allocator>::commit (size_type n)
{
if (list_.empty())
return;
if (out_ == list_.end())
return;
auto const last = std::prev(list_.end());
while (out_ != last)
{
auto const avail =
out_->size() - out_pos_;
if (n < avail)
{
out_pos_ += n;
in_size_ += n;
debug_check();
return;
}
++out_;
n -= avail;
out_pos_ = 0;
in_size_ += avail;
debug_check();
}
n = std::min (n, out_end_ - out_pos_);
out_pos_ += n;
in_size_ += n;
if (out_pos_ == out_->size())
{
++out_;
out_pos_ = 0;
out_end_ = 0;
}
debug_check();
}
template <class Allocator>
auto
basic_streambuf<Allocator>::data() const ->
const_buffers_type
{
return const_buffers_type(*this);
}
template <class Allocator>
void
basic_streambuf<Allocator>::consume (size_type n)
{
if (list_.empty())
return;
auto pos = list_.begin();
for(;;)
{
if (pos != out_)
{
auto const avail = pos->size() - in_pos_;
if (n < avail)
{
in_size_ -= n;
in_pos_ += n;
debug_check();
break;
}
n -= avail;
in_size_ -= avail;
in_pos_ = 0;
debug_check();
element& e = *pos++;
list_.erase(list_.iterator_to(e));
size_type const len = e.alloc_size();
alloc_traits::destroy(this->member(), &e);
alloc_traits::deallocate(this->member(),
reinterpret_cast<char*>(&e), len);
}
else
{
auto const avail = out_pos_ - in_pos_;
if (n < avail)
{
in_size_ -= n;
in_pos_ += n;
}
else
{
in_size_ -= avail;
if (out_pos_ != out_end_||
out_ != list_.iterator_to(list_.back()))
{
in_pos_ = out_pos_;
}
else
{
// Use the whole buffer now.
// Alternatively we could deallocate it.
in_pos_ = 0;
out_pos_ = 0;
out_end_ = 0;
}
}
debug_check();
break;
}
}
}
template <class Allocator>
void
basic_streambuf<Allocator>::debug_check() const
{
#ifndef NDEBUG
if (list_.empty())
{
assert(in_pos_ == 0);
assert(in_size_ == 0);
assert(out_pos_ == 0);
assert(out_end_ == 0);
assert(out_ == list_.end());
return;
}
auto const& front = list_.front();
assert(in_pos_ < front.size());
if (out_ == list_.end())
{
assert(out_pos_ == 0);
assert(out_end_ == 0);
}
else
{
auto const& out = *out_;
auto const& back = list_.back();
assert(out_end_ <= back.size());
assert(out_pos_ < out.size());
assert(&out != &front || out_pos_ >= in_pos_);
assert(&out != &front || out_pos_ - in_pos_ == in_size_);
assert(&out != &back || out_pos_ <= out_end_);
}
#endif
}
template <class Alloc, class T>
basic_streambuf<Alloc>&
operator<< (basic_streambuf<Alloc>& buf, T const& t)
{
std::stringstream ss;
ss << t;
auto const& s = ss.str();
buf.commit(boost::asio::buffer_copy(
buf.prepare(s.size()), boost::asio::buffer(s)));
return buf;
}
//------------------------------------------------------------------------------
using streambuf = basic_streambuf<std::allocator<char>>;
/** Convert the entire basic_streambuf to a string.
@note It is more efficient to deal directly in the streambuf instead.
*/
template <class Allocator>
std::string
to_string (basic_streambuf<Allocator> const& buf)
{
std::string s;
s.resize(buf.size());
boost::asio::buffer_copy(boost::asio::buffer(
&s[0], s.size()), buf.data());
return s;
}
}
}
#endif

View File

@@ -1,55 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// LIBS: boost_system
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#include <beast/unit_test/suite.h>
#include <beast/asio/bind_handler.h>
#include <functional>
namespace beast {
namespace asio {
class bind_handler_test : public unit_test::suite
{
public:
static void foo (int)
{
}
void run()
{
auto f (bind_handler (
std::bind (&foo, std::placeholders::_1),
42));
f();
pass();
}
};
BEAST_DEFINE_TESTSUITE(bind_handler,asio,beast);
}
}

View File

@@ -1,158 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#include <beast/asio/streambuf.h>
#include <beast/unit_test/suite.h>
namespace beast {
namespace asio {
class streambuf_test : public unit_test::suite
{
public:
// Convert a buffer sequence to a string
template <class Buffers>
static
std::string
to_str (Buffers const& b)
{
std::string s;
auto const n = boost::asio::buffer_size(b);
s.resize(n);
boost::asio::buffer_copy(
boost::asio::buffer(&s[0], n), b);
return s;
}
// Fill a buffer sequence with predictable data
template <class Buffers>
static
void
fill (Buffers const& b)
{
char c = 0;
auto first = boost::asio::buffers_begin(b);
auto last = boost::asio::buffers_end(b);
while (first != last)
*first++ = c++;
}
// Check that a buffer sequence has predictable data
template <class Buffers>
void
check (Buffers const& b, char c = 0)
{
auto first = boost::asio::buffers_begin(b);
auto last = boost::asio::buffers_end(b);
while (first != last)
expect (*first++ == c++);
}
void
test_prepare()
{
testcase << "prepare";
beast::asio::streambuf b(11);
for (std::size_t n = 0; n < 97; ++n)
{
fill(b.prepare(n));
b.commit(n);
check(b.data());
b.consume(n);
}
}
void
test_commit()
{
testcase << "commit";
beast::asio::streambuf b(11);
for (std::size_t n = 0; n < 97; ++n)
{
fill(b.prepare(n));
char c = 0;
for (int i = 1;; ++i)
{
b.commit(i);
check(b.data(), c);
b.consume(i);
if (b.size() < 1)
break;
c += i;
}
}
}
void
test_consume()
{
testcase << "consume";
beast::asio::streambuf b(11);
for (std::size_t n = 0; n < 97; ++n)
{
fill(b.prepare(n));
b.commit(n);
char c = 0;
for (int i = 1; b.size() > 0; ++i)
{
check(b.data(), c);
b.consume(i);
c += i;
}
}
}
void run()
{
{
beast::asio::streambuf b(10);
std::string const s = "1234567890";
b << s;
expect (to_str(b.data()) == s);
b.prepare(5);
}
{
beast::asio::streambuf b(10);
b.prepare(10);
b.commit(10);
b.consume(10);
}
{
beast::asio::streambuf b(5);
boost::asio::buffer_copy(b.prepare(14),
boost::asio::buffer(std::string("1234567890ABCD")));
b.commit(4);
expect(to_str(b.data()) == "1234");
b.consume(4);
b.commit(10);
expect(to_str(b.data()) == "567890ABCD");
}
test_prepare();
test_commit();
test_consume();
}
};
BEAST_DEFINE_TESTSUITE(streambuf,asio,beast);
}
}

View File

@@ -1,315 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_ASIO_WAITABLE_EXECUTOR_H_INCLUDED
#define BEAST_ASIO_WAITABLE_EXECUTOR_H_INCLUDED
#include <boost/asio/handler_alloc_hook.hpp>
#include <boost/asio/handler_continuation_hook.hpp>
#include <boost/asio/handler_invoke_hook.hpp>
#include <condition_variable>
#include <functional>
#include <memory>
#include <mutex>
#include <type_traits>
#include <utility>
#include <vector>
namespace beast {
namespace asio {
namespace detail {
template <class Owner, class Handler>
class waitable_executor_wrapped_handler
{
private:
static_assert (std::is_same <std::decay_t <Owner>, Owner>::value,
"Owner cannot be a const or reference type");
Handler handler_;
std::reference_wrapper <Owner> owner_;
bool cont_;
public:
waitable_executor_wrapped_handler (Owner& owner,
Handler&& handler, bool continuation = false)
: handler_ (std::move(handler))
, owner_ (owner)
{
using boost::asio::asio_handler_is_continuation;
cont_ = continuation ? true :
asio_handler_is_continuation(
std::addressof(handler_));
owner_.get().increment();
}
waitable_executor_wrapped_handler (Owner& owner,
Handler const& handler, bool continuation = false)
: handler_ (handler)
, owner_ (owner)
{
using boost::asio::asio_handler_is_continuation;
cont_ = continuation ? true :
asio_handler_is_continuation(
std::addressof(handler_));
owner_.get().increment();
}
~waitable_executor_wrapped_handler()
{
owner_.get().decrement();
}
waitable_executor_wrapped_handler (
waitable_executor_wrapped_handler const& other)
: handler_ (other.handler_)
, owner_ (other.owner_)
, cont_ (other.cont_)
{
owner_.get().increment();
}
waitable_executor_wrapped_handler (
waitable_executor_wrapped_handler&& other)
: handler_ (std::move(other.handler_))
, owner_ (other.owner_)
, cont_ (other.cont_)
{
owner_.get().increment();
}
waitable_executor_wrapped_handler& operator=(
waitable_executor_wrapped_handler const&) = delete;
template <class... Args>
void
operator()(Args&&... args)
{
handler_(std::forward<Args>(args)...);
}
template <class... Args>
void
operator()(Args&&... args) const
{
handler_(std::forward<Args>(args)...);
}
template <class Function>
friend
void
asio_handler_invoke (Function& f,
waitable_executor_wrapped_handler* h)
{
using boost::asio::asio_handler_invoke;
asio_handler_invoke(f,
std::addressof(h->handler_));
}
template <class Function>
friend
void
asio_handler_invoke (Function const& f,
waitable_executor_wrapped_handler* h)
{
using boost::asio::asio_handler_invoke;
asio_handler_invoke(f,
std::addressof(h->handler_));
}
friend
void*
asio_handler_allocate (std::size_t size,
waitable_executor_wrapped_handler* h)
{
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(
size, std::addressof(h->handler_));
}
friend
void
asio_handler_deallocate (void* p, std::size_t size,
waitable_executor_wrapped_handler* h)
{
using boost::asio::asio_handler_deallocate;
asio_handler_deallocate(
p, size, std::addressof(h->handler_));
}
friend
bool
asio_handler_is_continuation (
waitable_executor_wrapped_handler* h)
{
return h->cont_;
}
};
} // detail
//------------------------------------------------------------------------------
/** Executor which provides blocking until all handlers are called. */
class waitable_executor
{
private:
template <class, class>
friend class detail::waitable_executor_wrapped_handler;
std::mutex mutex_;
std::condition_variable cond_;
std::size_t count_ = 0;
std::vector<std::function<void(void)>> notify_;
public:
/** Block until all handlers are called. */
template <class = void>
void
wait();
/** Blocks until all handlers are called or time elapses.
@return `true` if all handlers are done or `false` if the time elapses.
*/
template <class Rep, class Period>
bool
wait_for (std::chrono::duration<
Rep, Period> const& elapsed_time);
/** Blocks until all handlers are called or a time is reached.
@return `true` if all handlers are done or `false` on timeout.
*/
template <class Clock, class Duration>
bool
wait_until (std::chrono::time_point<
Clock, Duration> const& timeout_time);
/** Call a function asynchronously after all handlers are called.
The function may be called on the callers thread.
*/
template <class = void>
void
async_wait(std::function<void(void)> f);
/** Create a new handler that dispatches the wrapped handler on the Context. */
template <class Handler>
detail::waitable_executor_wrapped_handler<waitable_executor,
std::remove_reference_t<Handler>>
wrap (Handler&& handler);
private:
template <class = void>
void
increment();
template <class = void>
void
decrement();
};
template <class>
void
waitable_executor::wait()
{
std::unique_lock<std::mutex> lock(mutex_);
cond_.wait(lock,
[this]() { return count_ == 0; });
}
template <class Rep, class Period>
bool
waitable_executor::wait_for (std::chrono::duration<
Rep, Period> const& elapsed_time)
{
std::unique_lock<std::mutex> lock(mutex_);
return cond_.wait_for(lock, elapsed_time,
[this]() { return count_ == 0; }) ==
std::cv_status::no_timeout;
}
template <class Clock, class Duration>
bool
waitable_executor::wait_until (std::chrono::time_point<
Clock, Duration> const& timeout_time)
{
std::unique_lock<std::mutex> lock(mutex_);
return cond_.wait_until(lock, timeout_time,
[this]() { return count_ == 0; }) ==
std::cv_status::no_timeout;
return true;
}
template <class>
void
waitable_executor::async_wait(std::function<void(void)> f)
{
bool busy;
{
std::lock_guard<std::mutex> _(mutex_);
busy = count_ > 0;
if (busy)
notify_.emplace_back(std::move(f));
}
if (! busy)
f();
}
template <class Handler>
detail::waitable_executor_wrapped_handler<waitable_executor,
std::remove_reference_t<Handler>>
waitable_executor::wrap (Handler&& handler)
{
return detail::waitable_executor_wrapped_handler<
waitable_executor, std::remove_reference_t<Handler>>(
*this, std::forward<Handler>(handler));
}
template <class>
void
waitable_executor::increment()
{
std::lock_guard<std::mutex> _(mutex_);
++count_;
}
template <class>
void
waitable_executor::decrement()
{
bool notify;
std::vector<std::function<void(void)>> list;
{
std::lock_guard<std::mutex> _(mutex_);
notify = --count_ == 0;
if (notify)
std::swap(list, notify_);
}
if (notify)
{
cond_.notify_all();
for(auto& _ : list)
_();
}
}
} // asio
} // beast
#endif

View File

@@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_BOOST_ERRORCODE_H_INCLUDED
#define BEAST_BOOST_ERRORCODE_H_INCLUDED
#include <boost/system/error_code.hpp>
namespace beast {
// Lift this into our namespace. For now we will
// use boost, and then switch to std::error_code when
// it is available on all our supported platforms.
//
using ErrorCode = boost::system::error_code;
}
#endif

View File

@@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#include <beast/Config.h>
#include <beast/chrono/impl/chrono_io.cpp>
#include <beast/chrono/impl/RelativeTime.cpp>
#include <beast/chrono/tests/abstract_clock.test.cpp>
#include <beast/chrono/tests/basic_seconds_clock.test.cpp>

View File

@@ -1,803 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// chrono_io
//
// (C) Copyright Howard Hinnant
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#ifndef BEAST_CHRONO_CHRONO_IO_H_INCLUDED
#define BEAST_CHRONO_CHRONO_IO_H_INCLUDED
#include <beast/Config.h>
#include <ctime>
#include <locale>
/*
chrono_io synopsis
#include <chrono>
#include <ratio_io>
namespace std
{
namespace chrono
{
enum duration_style {prefix, symbol};
enum timezone {utc, local};
// facets
class durationpunct
: public locale::facet
{
public:
static locale::id id;
explicit durationpunct(size_t refs = 0);
explicit durationpunct(duration_style fmt, size_t refs = 0);
bool is_symbol_name() const noexcept;
bool is_prefix_name() const noexcept;
};
template <class charT>
class timepunct
: public locale::facet
{
public:
typedef basic_string<charT> string_type;
static locale::id id;
explicit timepunct(size_t refs = 0);
timepunct(timezone tz, string_type fmt, size_t refs = 0);
const string_type& fmt() const noexcept;
std::chrono::timezone timezone() const noexcept;
};
// manipulators
class duration_fmt
{
public:
explicit duration_fmt(duration_style f) noexcept;
explicit operator duration_style() const noexcept;
};
unspecified time_fmt(timezone tz);
template<class charT>
unspecified time_fmt(timezone tz, basic_string<charT> fmt);
template<class charT>
unspecified time_fmt(timezone tz, const charT* fmt);
template<class charT, class traits>
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, duration_fmt d);
template<class charT, class traits>
std::basic_istream<charT, traits>&
operator>>(std::basic_istream<charT, traits>& is, duration_fmt d);
// duration I/O
template <class charT, class Traits, class Rep, class Period>
basic_ostream<charT, Traits>&
operator<<(basic_ostream<charT, Traits>& os, const duration<Rep, Period>& d);
template <class charT, class Traits, class Rep, class Period>
basic_istream<charT, Traits>&
operator>>(basic_istream<charT, Traits>& is, duration<Rep, Period>& d);
// system_clock I/O
template <class charT, class Traits, class Duration>
basic_ostream<charT, Traits>&
operator<<(basic_ostream<charT, Traits>& os,
const time_point<system_clock, Duration>& tp);
template <class charT, class Traits, class Duration>
basic_istream<charT, Traits>&
operator>>(basic_istream<charT, Traits>& is,
time_point<system_clock, Duration>& tp);
// steady_clock I/O
template <class charT, class Traits, class Duration>
basic_ostream<charT, Traits>&
operator<<(basic_ostream<charT, Traits>& os,
const time_point<steady_clock, Duration>& tp);
template <class charT, class Traits, class Duration>
basic_istream<charT, Traits>&
operator>>(basic_istream<charT, Traits>& is,
time_point<steady_clock, Duration>& tp);
// high_resolution_clock I/O
template <class charT, class Traits, class Duration>
basic_ostream<charT, Traits>&
operator<<(basic_ostream<charT, Traits>& os,
const time_point<high_resolution_clock, Duration>& tp);
template <class charT, class Traits, class Duration>
basic_istream<charT, Traits>&
operator>>(basic_istream<charT, Traits>& is,
time_point<high_resolution_clock, Duration>& tp);
} // chrono
} // std
*/
#include <chrono>
#include <beast/chrono/ratio_io.h>
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {
namespace chrono
{
template <class To, class Rep, class Period>
To
round(const duration<Rep, Period>& d)
{
To t0 = duration_cast<To>(d);
To t1 = t0;
++t1;
typedef typename common_type<To, duration<Rep, Period> >::type _D;
_D diff0 = d - t0;
_D diff1 = t1 - d;
if (diff0 == diff1)
{
if (t0.count() & 1)
return t1;
return t0;
}
else if (diff0 < diff1)
return t0;
return t1;
}
enum duration_style {prefix, symbol};
enum timezone {utc, local};
class durationpunct
: public locale::facet
{
private:
duration_style __style_;
public:
static locale::id id;
explicit durationpunct(size_t refs = 0)
: locale::facet(refs), __style_(prefix) {}
explicit durationpunct(duration_style fmt, size_t refs = 0)
: locale::facet(refs), __style_(fmt) {}
bool is_symbol_name() const noexcept {return __style_ == symbol;}
bool is_prefix_name() const noexcept {return __style_ == prefix;}
};
class duration_fmt
{
duration_style form_;
public:
explicit duration_fmt(duration_style f) noexcept : form_(f) {}
// VFALCO NOTE disabled this for MSVC
/*explicit*/
operator duration_style() const noexcept {return form_;}
};
template<class charT, class traits>
basic_ostream<charT, traits>&
operator <<(basic_ostream<charT, traits>& os, duration_fmt d)
{
os.imbue(locale(os.getloc(), new durationpunct(static_cast<duration_style>(d))));
return os;
}
template<class charT, class traits>
basic_istream<charT, traits>&
operator >>(basic_istream<charT, traits>& is, duration_fmt d)
{
is.imbue(locale(is.getloc(), new durationpunct(static_cast<duration_style>(d))));
return is;
}
template <class _CharT, class _Rep, class _Period>
basic_string<_CharT>
__get_unit(bool __is_long, const duration<_Rep, _Period>& d)
{
if (__is_long)
{
_CharT __p[] = {'s', 'e', 'c', 'o', 'n', 'd', 's', 0};
basic_string<_CharT> s = ratio_string<_Period, _CharT>::prefix() + __p;
if (d.count() == 1 || d.count() == -1)
s.pop_back();
return s;
}
return ratio_string<_Period, _CharT>::symbol() + 's';
}
template <class _CharT, class _Rep>
basic_string<_CharT>
__get_unit(bool __is_long, const duration<_Rep, ratio<1> >& d)
{
if (__is_long)
{
_CharT __p[] = {'s', 'e', 'c', 'o', 'n', 'd', 's'};
basic_string<_CharT> s = basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT));
if (d.count() == 1 || d.count() == -1)
s.pop_back();
return s;
}
return basic_string<_CharT>(1, 's');
}
template <class _CharT, class _Rep>
basic_string<_CharT>
__get_unit(bool __is_long, const duration<_Rep, ratio<60> >& d)
{
if (__is_long)
{
_CharT __p[] = {'m', 'i', 'n', 'u', 't', 'e', 's'};
basic_string<_CharT> s = basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT));
if (d.count() == 1 || d.count() == -1)
s.pop_back();
return s;
}
_CharT __p[] = {'m', 'i', 'n'};
return basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT));
}
template <class _CharT, class _Rep>
basic_string<_CharT>
__get_unit(bool __is_long, const duration<_Rep, ratio<3600> >& d)
{
if (__is_long)
{
_CharT __p[] = {'h', 'o', 'u', 'r', 's'};
basic_string<_CharT> s = basic_string<_CharT>(__p, __p + sizeof(__p) / sizeof(_CharT));
if (d.count() == 1 || d.count() == -1)
s.pop_back();
return s;
}
return basic_string<_CharT>(1, 'h');
}
template <class _CharT, class _Traits, class _Rep, class _Period>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const duration<_Rep, _Period>& __d)
{
typename basic_ostream<_CharT, _Traits>::sentry ok(__os);
if (ok)
{
typedef durationpunct _F;
typedef basic_string<_CharT> string_type;
bool failed = false;
try
{
bool __is_long = true;
locale __loc = __os.getloc();
if (has_facet<_F>(__loc))
{
const _F& f = use_facet<_F>(__loc);
__is_long = f.is_prefix_name();
}
string_type __unit = __get_unit<_CharT>(__is_long, __d);
__os << __d.count() << ' ' << __unit;
}
catch (...)
{
failed = true;
}
if (failed)
__os.setstate(ios_base::failbit | ios_base::badbit);
}
return __os;
}
template <class _Rep, bool = is_scalar<_Rep>::value>
struct __duration_io_intermediate
{
typedef _Rep type;
};
template <class _Rep>
struct __duration_io_intermediate<_Rep, true>
{
typedef typename conditional
<
is_floating_point<_Rep>::value,
long double,
typename conditional
<
is_signed<_Rep>::value,
long long,
unsigned long long
>::type
>::type type;
};
template <class T>
T
__gcd(T x, T y)
{
while (y != 0)
{
T old_x = x;
x = y;
y = old_x % y;
}
return x;
}
template <>
long double
inline
__gcd(long double, long double)
{
return 1;
}
template <class _CharT, class _Traits, class _Rep, class _Period>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, duration<_Rep, _Period>& __d)
{
// These are unused and generate warnings
//typedef basic_string<_CharT> string_type;
//typedef durationpunct _F;
typedef typename __duration_io_intermediate<_Rep>::type _IR;
_IR __r;
// read value into __r
__is >> __r;
if (__is.good())
{
// now determine unit
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __e;
if (__i != __e && *__i == ' ') // mandatory ' ' after value
{
++__i;
if (__i != __e)
{
locale __loc = __is.getloc();
// unit is num / den (yet to be determined)
unsigned long long num = 0;
unsigned long long den = 0;
ios_base::iostate __err = ios_base::goodbit;
if (*__i == '[')
{
// parse [N/D]s or [N/D]seconds format
++__i;
_CharT __x;
__is >> num >> __x >> den;
if (!__is.good() || __x != '/')
{
__is.setstate(__is.failbit);
return __is;
}
__i = _I(__is);
if (*__i != ']')
{
__is.setstate(__is.failbit);
return __is;
}
++__i;
const basic_string<_CharT> __units[] =
{
__get_unit<_CharT>(true, seconds(2)),
__get_unit<_CharT>(true, seconds(1)),
__get_unit<_CharT>(false, seconds(1))
};
const basic_string<_CharT>* __k = __scan_keyword(__i, __e,
__units, __units + sizeof(__units)/sizeof(__units[0]),
use_facet<ctype<_CharT> >(__loc),
__err);
switch ((__k - __units) / 3)
{
case 0:
break;
default:
__is.setstate(__err);
return __is;
}
}
else
{
// parse SI name, short or long
const basic_string<_CharT> __units[] =
{
__get_unit<_CharT>(true, duration<_Rep, atto>(2)),
__get_unit<_CharT>(true, duration<_Rep, atto>(1)),
__get_unit<_CharT>(false, duration<_Rep, atto>(1)),
__get_unit<_CharT>(true, duration<_Rep, femto>(2)),
__get_unit<_CharT>(true, duration<_Rep, femto>(1)),
__get_unit<_CharT>(false, duration<_Rep, femto>(1)),
__get_unit<_CharT>(true, duration<_Rep, pico>(2)),
__get_unit<_CharT>(true, duration<_Rep, pico>(1)),
__get_unit<_CharT>(false, duration<_Rep, pico>(1)),
__get_unit<_CharT>(true, duration<_Rep, nano>(2)),
__get_unit<_CharT>(true, duration<_Rep, nano>(1)),
__get_unit<_CharT>(false, duration<_Rep, nano>(1)),
__get_unit<_CharT>(true, duration<_Rep, micro>(2)),
__get_unit<_CharT>(true, duration<_Rep, micro>(1)),
__get_unit<_CharT>(false, duration<_Rep, micro>(1)),
__get_unit<_CharT>(true, duration<_Rep, milli>(2)),
__get_unit<_CharT>(true, duration<_Rep, milli>(1)),
__get_unit<_CharT>(false, duration<_Rep, milli>(1)),
__get_unit<_CharT>(true, duration<_Rep, centi>(2)),
__get_unit<_CharT>(true, duration<_Rep, centi>(1)),
__get_unit<_CharT>(false, duration<_Rep, centi>(1)),
__get_unit<_CharT>(true, duration<_Rep, deci>(2)),
__get_unit<_CharT>(true, duration<_Rep, deci>(1)),
__get_unit<_CharT>(false, duration<_Rep, deci>(1)),
__get_unit<_CharT>(true, duration<_Rep, deca>(2)),
__get_unit<_CharT>(true, duration<_Rep, deca>(1)),
__get_unit<_CharT>(false, duration<_Rep, deca>(1)),
__get_unit<_CharT>(true, duration<_Rep, hecto>(2)),
__get_unit<_CharT>(true, duration<_Rep, hecto>(1)),
__get_unit<_CharT>(false, duration<_Rep, hecto>(1)),
__get_unit<_CharT>(true, duration<_Rep, kilo>(2)),
__get_unit<_CharT>(true, duration<_Rep, kilo>(1)),
__get_unit<_CharT>(false, duration<_Rep, kilo>(1)),
__get_unit<_CharT>(true, duration<_Rep, mega>(2)),
__get_unit<_CharT>(true, duration<_Rep, mega>(1)),
__get_unit<_CharT>(false, duration<_Rep, mega>(1)),
__get_unit<_CharT>(true, duration<_Rep, giga>(2)),
__get_unit<_CharT>(true, duration<_Rep, giga>(1)),
__get_unit<_CharT>(false, duration<_Rep, giga>(1)),
__get_unit<_CharT>(true, duration<_Rep, tera>(2)),
__get_unit<_CharT>(true, duration<_Rep, tera>(1)),
__get_unit<_CharT>(false, duration<_Rep, tera>(1)),
__get_unit<_CharT>(true, duration<_Rep, peta>(2)),
__get_unit<_CharT>(true, duration<_Rep, peta>(1)),
__get_unit<_CharT>(false, duration<_Rep, peta>(1)),
__get_unit<_CharT>(true, duration<_Rep, exa>(2)),
__get_unit<_CharT>(true, duration<_Rep, exa>(1)),
__get_unit<_CharT>(false, duration<_Rep, exa>(1)),
__get_unit<_CharT>(true, duration<_Rep, ratio<1> >(2)),
__get_unit<_CharT>(true, duration<_Rep, ratio<1> >(1)),
__get_unit<_CharT>(false, duration<_Rep, ratio<1> >(1)),
__get_unit<_CharT>(true, duration<_Rep, ratio<60> >(2)),
__get_unit<_CharT>(true, duration<_Rep, ratio<60> >(1)),
__get_unit<_CharT>(false, duration<_Rep, ratio<60> >(1)),
__get_unit<_CharT>(true, duration<_Rep, ratio<3600> >(2)),
__get_unit<_CharT>(true, duration<_Rep, ratio<3600> >(1)),
__get_unit<_CharT>(false, duration<_Rep, ratio<3600> >(1))
};
const basic_string<_CharT>* __k = __scan_keyword(__i, __e,
__units, __units + sizeof(__units)/sizeof(__units[0]),
use_facet<ctype<_CharT> >(__loc),
__err);
switch (__k - __units)
{
case 0:
case 1:
case 2:
num = 1ULL;
den = 1000000000000000000ULL;
break;
case 3:
case 4:
case 5:
num = 1ULL;
den = 1000000000000000ULL;
break;
case 6:
case 7:
case 8:
num = 1ULL;
den = 1000000000000ULL;
break;
case 9:
case 10:
case 11:
num = 1ULL;
den = 1000000000ULL;
break;
case 12:
case 13:
case 14:
num = 1ULL;
den = 1000000ULL;
break;
case 15:
case 16:
case 17:
num = 1ULL;
den = 1000ULL;
break;
case 18:
case 19:
case 20:
num = 1ULL;
den = 100ULL;
break;
case 21:
case 22:
case 23:
num = 1ULL;
den = 10ULL;
break;
case 24:
case 25:
case 26:
num = 10ULL;
den = 1ULL;
break;
case 27:
case 28:
case 29:
num = 100ULL;
den = 1ULL;
break;
case 30:
case 31:
case 32:
num = 1000ULL;
den = 1ULL;
break;
case 33:
case 34:
case 35:
num = 1000000ULL;
den = 1ULL;
break;
case 36:
case 37:
case 38:
num = 1000000000ULL;
den = 1ULL;
break;
case 39:
case 40:
case 41:
num = 1000000000000ULL;
den = 1ULL;
break;
case 42:
case 43:
case 44:
num = 1000000000000000ULL;
den = 1ULL;
break;
case 45:
case 46:
case 47:
num = 1000000000000000000ULL;
den = 1ULL;
break;
case 48:
case 49:
case 50:
num = 1;
den = 1;
break;
case 51:
case 52:
case 53:
num = 60;
den = 1;
break;
case 54:
case 55:
case 56:
num = 3600;
den = 1;
break;
default:
__is.setstate(__err);
return __is;
}
}
// unit is num/den
// __r should be multiplied by (num/den) / _Period
// Reduce (num/den) / _Period to lowest terms
unsigned long long __gcd_n1_n2 = __gcd<unsigned long long>(num, _Period::num);
unsigned long long __gcd_d1_d2 = __gcd<unsigned long long>(den, _Period::den);
num /= __gcd_n1_n2;
den /= __gcd_d1_d2;
unsigned long long __n2 = _Period::num / __gcd_n1_n2;
unsigned long long __d2 = _Period::den / __gcd_d1_d2;
if (num > numeric_limits<unsigned long long>::max() / __d2 ||
den > numeric_limits<unsigned long long>::max() / __n2)
{
// (num/den) / _Period overflows
__is.setstate(__is.failbit);
return __is;
}
num *= __d2;
den *= __n2;
// num / den is now factor to multiply by __r
typedef typename common_type<_IR, unsigned long long>::type _CT;
if (is_integral<_IR>::value)
{
// Reduce __r * num / den
_CT __t = __gcd<_CT>(__r, den);
__r /= __t;
den /= __t;
if (den != 1)
{
// Conversion to _Period is integral and not exact
__is.setstate(__is.failbit);
return __is;
}
}
if (__r > duration_values<_CT>::max() / num)
{
// Conversion to _Period overflowed
__is.setstate(__is.failbit);
return __is;
}
_CT __t = __r * num;
__t /= den;
if (duration_values<_Rep>::max() < __t)
{
// Conversion to _Period overflowed
__is.setstate(__is.failbit);
return __is;
}
// Success! Store it.
__r = _Rep(__t);
__d = duration<_Rep, _Period>(__r);
__is.setstate(__err);
}
else
__is.setstate(__is.failbit | __is.eofbit);
}
else
{
if (__i == __e)
__is.setstate(__is.eofbit);
__is.setstate(__is.failbit);
}
}
else
__is.setstate(__is.failbit);
return __is;
}
template <class charT>
class timepunct
: public locale::facet
{
public:
typedef basic_string<charT> string_type;
private:
string_type fmt_;
chrono::timezone tz_;
public:
static locale::id id;
explicit timepunct(size_t refs = 0)
: locale::facet(refs), tz_(utc) {}
timepunct(timezone tz, string_type fmt, size_t refs = 0)
: locale::facet(refs), fmt_(std::move(fmt)), tz_(tz) {}
const string_type& fmt() const noexcept {return fmt_;}
chrono::timezone get_timezone() const noexcept {return tz_;}
};
template <class CharT>
locale::id
timepunct<CharT>::id;
template <class _CharT, class _Traits, class _Duration>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const time_point<steady_clock, _Duration>& __tp)
{
return __os << __tp.time_since_epoch() << " since boot";
}
template<class charT>
struct __time_manip
{
basic_string<charT> fmt_;
timezone tz_;
__time_manip(timezone tz, basic_string<charT> fmt)
: fmt_(std::move(fmt)),
tz_(tz) {}
};
template<class charT, class traits>
basic_ostream<charT, traits>&
operator <<(basic_ostream<charT, traits>& os, __time_manip<charT> m)
{
os.imbue(locale(os.getloc(), new timepunct<charT>(m.tz_, std::move(m.fmt_))));
return os;
}
template<class charT, class traits>
basic_istream<charT, traits>&
operator >>(basic_istream<charT, traits>& is, __time_manip<charT> m)
{
is.imbue(locale(is.getloc(), new timepunct<charT>(m.tz_, std::move(m.fmt_))));
return is;
}
template<class charT>
inline
__time_manip<charT>
time_fmt(timezone tz, const charT* fmt)
{
return __time_manip<charT>(tz, fmt);
}
template<class charT>
inline
__time_manip<charT>
time_fmt(timezone tz, basic_string<charT> fmt)
{
return __time_manip<charT>(tz, std::move(fmt));
}
class __time_man
{
timezone form_;
public:
explicit __time_man(timezone f) : form_(f) {}
// explicit
operator timezone() const {return form_;}
};
template<class charT, class traits>
basic_ostream<charT, traits>&
operator <<(basic_ostream<charT, traits>& os, __time_man m)
{
os.imbue(locale(os.getloc(), new timepunct<charT>(static_cast<timezone>(m), basic_string<charT>())));
return os;
}
template<class charT, class traits>
basic_istream<charT, traits>&
operator >>(basic_istream<charT, traits>& is, __time_man m)
{
is.imbue(locale(is.getloc(), new timepunct<charT>(static_cast<timezone>(m), basic_string<charT>())));
return is;
}
inline
__time_man
time_fmt(timezone f)
{
return __time_man(f);
}
} // chrono
}
#endif

View File

@@ -1,41 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// chrono_io
//
// (C) Copyright Howard Hinnant
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#include <beast/chrono/chrono_io.h>
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {
namespace chrono
{
locale::id
durationpunct::id;
} // chrono
//_LIBCPP_END_NAMESPACE_STD
}

View File

@@ -1,622 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// ratio_io
//
// (C) Copyright Howard Hinnant
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
#ifndef BEAST_CHRONO_RATIO_IO_H_INCLUDED
#define BEAST_CHRONO_RATIO_IO_H_INCLUDED
/*
ratio_io synopsis
#include <ratio>
#include <string>
namespace std
{
template <class Ratio, class charT>
struct ratio_string
{
static basic_string<charT> symbol();
static basic_string<charT> prefix();
};
} // std
*/
#include <ratio>
#include <string>
#include <sstream>
//_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {
template <class _Ratio, class _CharT>
struct ratio_string
{
static basic_string<_CharT> symbol() {return prefix();}
static basic_string<_CharT> prefix();
};
template <class _Ratio, class _CharT>
basic_string<_CharT>
ratio_string<_Ratio, _CharT>::prefix()
{
basic_ostringstream<_CharT> __os;
__os << _CharT('[') << _Ratio::num << _CharT('/')
<< _Ratio::den << _CharT(']');
return __os.str();
}
// atto
template <>
struct ratio_string<atto, char>
{
static string symbol() {return string(1, 'a');}
static string prefix() {return string("atto");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<atto, char16_t>
{
static u16string symbol() {return u16string(1, u'a');}
static u16string prefix() {return u16string(u"atto");}
};
template <>
struct ratio_string<atto, char32_t>
{
static u32string symbol() {return u32string(1, U'a');}
static u32string prefix() {return u32string(U"atto");}
};
#endif
template <>
struct ratio_string<atto, wchar_t>
{
static wstring symbol() {return wstring(1, L'a');}
static wstring prefix() {return wstring(L"atto");}
};
// femto
template <>
struct ratio_string<femto, char>
{
static string symbol() {return string(1, 'f');}
static string prefix() {return string("femto");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<femto, char16_t>
{
static u16string symbol() {return u16string(1, u'f');}
static u16string prefix() {return u16string(u"femto");}
};
template <>
struct ratio_string<femto, char32_t>
{
static u32string symbol() {return u32string(1, U'f');}
static u32string prefix() {return u32string(U"femto");}
};
#endif
template <>
struct ratio_string<femto, wchar_t>
{
static wstring symbol() {return wstring(1, L'f');}
static wstring prefix() {return wstring(L"femto");}
};
// pico
template <>
struct ratio_string<pico, char>
{
static string symbol() {return string(1, 'p');}
static string prefix() {return string("pico");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<pico, char16_t>
{
static u16string symbol() {return u16string(1, u'p');}
static u16string prefix() {return u16string(u"pico");}
};
template <>
struct ratio_string<pico, char32_t>
{
static u32string symbol() {return u32string(1, U'p');}
static u32string prefix() {return u32string(U"pico");}
};
#endif
template <>
struct ratio_string<pico, wchar_t>
{
static wstring symbol() {return wstring(1, L'p');}
static wstring prefix() {return wstring(L"pico");}
};
// nano
template <>
struct ratio_string<nano, char>
{
static string symbol() {return string(1, 'n');}
static string prefix() {return string("nano");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<nano, char16_t>
{
static u16string symbol() {return u16string(1, u'n');}
static u16string prefix() {return u16string(u"nano");}
};
template <>
struct ratio_string<nano, char32_t>
{
static u32string symbol() {return u32string(1, U'n');}
static u32string prefix() {return u32string(U"nano");}
};
#endif
template <>
struct ratio_string<nano, wchar_t>
{
static wstring symbol() {return wstring(1, L'n');}
static wstring prefix() {return wstring(L"nano");}
};
// micro
template <>
struct ratio_string<micro, char>
{
static string symbol() {return string("\xC2\xB5");}
static string prefix() {return string("micro");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<micro, char16_t>
{
static u16string symbol() {return u16string(1, u'\xB5');}
static u16string prefix() {return u16string(u"micro");}
};
template <>
struct ratio_string<micro, char32_t>
{
static u32string symbol() {return u32string(1, U'\xB5');}
static u32string prefix() {return u32string(U"micro");}
};
#endif
template <>
struct ratio_string<micro, wchar_t>
{
static wstring symbol() {return wstring(1, L'\xB5');}
static wstring prefix() {return wstring(L"micro");}
};
// milli
template <>
struct ratio_string<milli, char>
{
static string symbol() {return string(1, 'm');}
static string prefix() {return string("milli");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<milli, char16_t>
{
static u16string symbol() {return u16string(1, u'm');}
static u16string prefix() {return u16string(u"milli");}
};
template <>
struct ratio_string<milli, char32_t>
{
static u32string symbol() {return u32string(1, U'm');}
static u32string prefix() {return u32string(U"milli");}
};
#endif
template <>
struct ratio_string<milli, wchar_t>
{
static wstring symbol() {return wstring(1, L'm');}
static wstring prefix() {return wstring(L"milli");}
};
// centi
template <>
struct ratio_string<centi, char>
{
static string symbol() {return string(1, 'c');}
static string prefix() {return string("centi");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<centi, char16_t>
{
static u16string symbol() {return u16string(1, u'c');}
static u16string prefix() {return u16string(u"centi");}
};
template <>
struct ratio_string<centi, char32_t>
{
static u32string symbol() {return u32string(1, U'c');}
static u32string prefix() {return u32string(U"centi");}
};
#endif
template <>
struct ratio_string<centi, wchar_t>
{
static wstring symbol() {return wstring(1, L'c');}
static wstring prefix() {return wstring(L"centi");}
};
// deci
template <>
struct ratio_string<deci, char>
{
static string symbol() {return string(1, 'd');}
static string prefix() {return string("deci");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<deci, char16_t>
{
static u16string symbol() {return u16string(1, u'd');}
static u16string prefix() {return u16string(u"deci");}
};
template <>
struct ratio_string<deci, char32_t>
{
static u32string symbol() {return u32string(1, U'd');}
static u32string prefix() {return u32string(U"deci");}
};
#endif
template <>
struct ratio_string<deci, wchar_t>
{
static wstring symbol() {return wstring(1, L'd');}
static wstring prefix() {return wstring(L"deci");}
};
// deca
template <>
struct ratio_string<deca, char>
{
static string symbol() {return string("da");}
static string prefix() {return string("deca");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<deca, char16_t>
{
static u16string symbol() {return u16string(u"da");}
static u16string prefix() {return u16string(u"deca");}
};
template <>
struct ratio_string<deca, char32_t>
{
static u32string symbol() {return u32string(U"da");}
static u32string prefix() {return u32string(U"deca");}
};
#endif
template <>
struct ratio_string<deca, wchar_t>
{
static wstring symbol() {return wstring(L"da");}
static wstring prefix() {return wstring(L"deca");}
};
// hecto
template <>
struct ratio_string<hecto, char>
{
static string symbol() {return string(1, 'h');}
static string prefix() {return string("hecto");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<hecto, char16_t>
{
static u16string symbol() {return u16string(1, u'h');}
static u16string prefix() {return u16string(u"hecto");}
};
template <>
struct ratio_string<hecto, char32_t>
{
static u32string symbol() {return u32string(1, U'h');}
static u32string prefix() {return u32string(U"hecto");}
};
#endif
template <>
struct ratio_string<hecto, wchar_t>
{
static wstring symbol() {return wstring(1, L'h');}
static wstring prefix() {return wstring(L"hecto");}
};
// kilo
template <>
struct ratio_string<kilo, char>
{
static string symbol() {return string(1, 'k');}
static string prefix() {return string("kilo");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<kilo, char16_t>
{
static u16string symbol() {return u16string(1, u'k');}
static u16string prefix() {return u16string(u"kilo");}
};
template <>
struct ratio_string<kilo, char32_t>
{
static u32string symbol() {return u32string(1, U'k');}
static u32string prefix() {return u32string(U"kilo");}
};
#endif
template <>
struct ratio_string<kilo, wchar_t>
{
static wstring symbol() {return wstring(1, L'k');}
static wstring prefix() {return wstring(L"kilo");}
};
// mega
template <>
struct ratio_string<mega, char>
{
static string symbol() {return string(1, 'M');}
static string prefix() {return string("mega");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<mega, char16_t>
{
static u16string symbol() {return u16string(1, u'M');}
static u16string prefix() {return u16string(u"mega");}
};
template <>
struct ratio_string<mega, char32_t>
{
static u32string symbol() {return u32string(1, U'M');}
static u32string prefix() {return u32string(U"mega");}
};
#endif
template <>
struct ratio_string<mega, wchar_t>
{
static wstring symbol() {return wstring(1, L'M');}
static wstring prefix() {return wstring(L"mega");}
};
// giga
template <>
struct ratio_string<giga, char>
{
static string symbol() {return string(1, 'G');}
static string prefix() {return string("giga");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<giga, char16_t>
{
static u16string symbol() {return u16string(1, u'G');}
static u16string prefix() {return u16string(u"giga");}
};
template <>
struct ratio_string<giga, char32_t>
{
static u32string symbol() {return u32string(1, U'G');}
static u32string prefix() {return u32string(U"giga");}
};
#endif
template <>
struct ratio_string<giga, wchar_t>
{
static wstring symbol() {return wstring(1, L'G');}
static wstring prefix() {return wstring(L"giga");}
};
// tera
template <>
struct ratio_string<tera, char>
{
static string symbol() {return string(1, 'T');}
static string prefix() {return string("tera");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<tera, char16_t>
{
static u16string symbol() {return u16string(1, u'T');}
static u16string prefix() {return u16string(u"tera");}
};
template <>
struct ratio_string<tera, char32_t>
{
static u32string symbol() {return u32string(1, U'T');}
static u32string prefix() {return u32string(U"tera");}
};
#endif
template <>
struct ratio_string<tera, wchar_t>
{
static wstring symbol() {return wstring(1, L'T');}
static wstring prefix() {return wstring(L"tera");}
};
// peta
template <>
struct ratio_string<peta, char>
{
static string symbol() {return string(1, 'P');}
static string prefix() {return string("peta");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<peta, char16_t>
{
static u16string symbol() {return u16string(1, u'P');}
static u16string prefix() {return u16string(u"peta");}
};
template <>
struct ratio_string<peta, char32_t>
{
static u32string symbol() {return u32string(1, U'P');}
static u32string prefix() {return u32string(U"peta");}
};
#endif
template <>
struct ratio_string<peta, wchar_t>
{
static wstring symbol() {return wstring(1, L'P');}
static wstring prefix() {return wstring(L"peta");}
};
// exa
template <>
struct ratio_string<exa, char>
{
static string symbol() {return string(1, 'E');}
static string prefix() {return string("exa");}
};
#if HAS_UNICODE_SUPPORT
template <>
struct ratio_string<exa, char16_t>
{
static u16string symbol() {return u16string(1, u'E');}
static u16string prefix() {return u16string(u"exa");}
};
template <>
struct ratio_string<exa, char32_t>
{
static u32string symbol() {return u32string(1, U'E');}
static u32string prefix() {return u32string(U"exa");}
};
#endif
template <>
struct ratio_string<exa, wchar_t>
{
static wstring symbol() {return wstring(1, L'E');}
static wstring prefix() {return wstring(L"exa");}
};
//_LIBCPP_END_NAMESPACE_STD
}
#endif // _RATIO_IO

View File

@@ -1,86 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_CONFIG_CONTRACTCHECKS_H_INCLUDED
#define BEAST_CONFIG_CONTRACTCHECKS_H_INCLUDED
// This file has to work when included in a C source file.
#if defined (fatal_error) || \
defined (fatal_condition) || \
defined (meets_condition) || \
defined (meets_precondition) || \
defined (meets_postcondition) || \
defined (meets_invariant) || \
defined (check_invariant)
#error "Programming by contract macros cannot be overriden!"
#endif
/** Report a fatal error message and terminate the application.
This macro automatically fills in the file and line number
Meets this declaration syntax:
@code inline void fatal_error (char const* message); @endif
@see FatalError
*/
#define fatal_error(message) beast_reportFatalError (message, __FILE__, __LINE__)
/** Reports a fatal error message type if the condition is false
The condition is always evaluated regardless of settings.
Meets this declaration syntax:
@code inline void fatal_condition (bool condition, char const* category); @endcode
*/
#define fatal_condition(condition,category) static_cast <void> \
(((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), 0)))
/** Reports a fatal error message type if the condition is false
The condition is always evaluated regardless of settings.
Meets this declaration syntax:
@code inline void fatal_condition (bool condition, char const* category); @endcode
*/
#define meets_condition(condition,category) static_cast <bool> \
(((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), false)))
/** Condition tests for programming by contract.
The condition is always evaluated regardless of settings, and gets returned.
Meets this declaration syntax:
@code inline bool meets_condition (bool); @endcode
*/
/** @{ */
#define meets_precondition(condition) meets_condition(condition,"Pre-condition")
#define meets_postcondition(condition) meets_condition(condition,"Post-condition")
#define meets_invariant(condition) meets_condition(condition,"Invariant")
/** @} */
/** Condition tests for programming by contract.
The condition is evaluated only if BEAST_DISABLE_CONTRACT_CHECKS is 0.
Meets this declaration syntax:
@code inline void check_condition (bool); @endcode
@see BEAST_DISABLE_CONTRACT_CHECKS
*/
/** @{ */
#if ! BEAST_DISABLE_CONTRACT_CHECKS
# define check_invariant(condition) meets_invariant(condition)
#else
# define check_invariant(condition) ((void)0)
#endif
/** @} */
#endif

View File

@@ -1,48 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// Ideas from boost
// Intel
#ifndef BEAST_CONFIG_SELECTCOMPILERCONFIG_H_INCLUDED
#define BEAST_CONFIG_SELECTCOMPILERCONFIG_H_INCLUDED
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
#define BEAST_COMPILER_CONFIG "config/compiler/Intel.h"
// Clang C++ emulates GCC, so it has to appear early.
#elif defined __clang__
#define BEAST_COMPILER_CONFIG "config/compiler/Clang.h"
// GNU C++:
#elif defined __GNUC__
#define BEAST_COMPILER_CONFIG "config/compiler/Gcc.h"
// Microsoft Visual C++
//
// Must remain the last #elif since some other vendors (Metrowerks, for
// example) also #define _MSC_VER
#elif defined _MSC_VER
#define BEAST_COMPILER_CONFIG "config/compiler/VisualC.h"
#else
#error "Unsupported compiler."
#endif
#endif

View File

@@ -1,48 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// Ideas from boost
// Android, which must be manually set by defining BEAST_ANDROID
#ifndef BEAST_CONFIG_SELECTPLATFORMCONFIG_H_INCLUDED
#define BEAST_CONFIG_SELECTPLATFORMCONFIG_H_INCLUDED
#if defined(BEAST_ANDROID)
#define BEAST_PLATFORM_CONFIG "config/platform/Android.h"
// linux, also other platforms (Hurd etc) that use GLIBC
#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC)
#define BEAST_PLATFORM_CONFIG "config/platform/Linux.h"
// BSD
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#define BEAST_PLATFORM_CONFIG "config/platform/Bsd.h"
// win32
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(_WIN64)
#define BEAST_PLATFORM_CONFIG "config/platform/Win32.h"
// MacOS
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(__APPLE_CPP__)
#define BEAST_PLATFORM_CONFIG "config/platform/MacOS.h"
#else
#error "Unsupported platform."
#endif
#endif

View File

@@ -1,21 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// Ideas from boost

View File

@@ -1,25 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
#ifndef BEAST_CONFIG_SUFFIX_H_INCLUDED
#define BEAST_CONFIG_SUFFIX_H_INCLUDED
// Included at the end of Config.h
#endif

View File

@@ -1,20 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// Clang compiler configuration

View File

@@ -1,20 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// GNU C++ compiler configuration

View File

@@ -1,20 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
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.
*/
//==============================================================================
// Intel compiler configuration

Some files were not shown because too many files have changed in this diff Show More