Compare commits
238 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f31ca2860f | ||
|
|
d702e736ca | ||
|
|
6156ff3eb7 | ||
|
|
04f1388860 | ||
|
|
c1c332f0b0 | ||
|
|
93780c25f7 | ||
|
|
a442d3fdb3 | ||
|
|
7bc163ee4c | ||
|
|
6bd0b850a0 | ||
|
|
1eece9b1fd | ||
|
|
859d18adb0 | ||
|
|
c4a9b73a66 | ||
|
|
8eb8c77886 | ||
|
|
ef3bc92b82 | ||
|
|
f7a4a94c3b | ||
|
|
3dc0714273 | ||
|
|
deb9e4ce3c | ||
|
|
4bc300e251 | ||
|
|
d65e208a99 | ||
|
|
f8fb1f6c7d | ||
|
|
db3b4dd396 | ||
|
|
b7335fdff5 | ||
|
|
d45556ec82 | ||
|
|
cebb9c6604 | ||
|
|
b7692b7bc1 | ||
|
|
327377cb2d | ||
|
|
75c4dbb0a1 | ||
|
|
f0b9506617 | ||
|
|
b4e1b3c1b1 | ||
|
|
02c487348a | ||
|
|
5db5e31140 | ||
|
|
4869a0d00e | ||
|
|
d9be0de269 | ||
|
|
0b18b36186 | ||
|
|
8d9dffcf84 | ||
|
|
2b8893dfca | ||
|
|
881cd4cfad | ||
|
|
067dbf299c | ||
|
|
8e9495f487 | ||
|
|
40dc6b1458 | ||
|
|
d5f981f5fc | ||
|
|
25de6b0a5f | ||
|
|
9af994ceb4 | ||
|
|
5549ff4c8a | ||
|
|
3730d46dad | ||
|
|
1507ed66a8 | ||
|
|
3a5a6c3637 | ||
|
|
4b2afc8f42 | ||
|
|
deef322b07 | ||
|
|
9456b83576 | ||
|
|
864844086e | ||
|
|
755849115e | ||
|
|
605ace7645 | ||
|
|
1a245234f1 | ||
|
|
20defb4844 | ||
|
|
8b909d5c17 | ||
|
|
4a3a40174e | ||
|
|
2fee75bfc1 | ||
|
|
6230204e42 | ||
|
|
5807ce2127 | ||
|
|
da43775d1b | ||
|
|
099a050c0b | ||
|
|
6fb2482886 | ||
|
|
b07da94c31 | ||
|
|
531e153144 | ||
|
|
079f346efd | ||
|
|
6d3b2b404d | ||
|
|
9685e756e6 | ||
|
|
8e365ea44a | ||
|
|
9a210cfda5 | ||
|
|
060692aad4 | ||
|
|
3e9e0c4b53 | ||
|
|
88570df135 | ||
|
|
c6a307fcd7 | ||
|
|
fd00e6e035 | ||
|
|
94c6a2a850 | ||
|
|
1c44c4a43e | ||
|
|
7e936187ac | ||
|
|
6328fabd5c | ||
|
|
125316f2a6 | ||
|
|
ed750a84dd | ||
|
|
e0ee58c92d | ||
|
|
6286a9708e | ||
|
|
5e4cb78208 | ||
|
|
a8481e369d | ||
|
|
35cc341544 | ||
|
|
f6013c1c37 | ||
|
|
992a390d75 | ||
|
|
ba43bfc646 | ||
|
|
cc9c976b76 | ||
|
|
eaff9a0e6a | ||
|
|
2a4eac6eb8 | ||
|
|
0ec66b3dbc | ||
|
|
718d217158 | ||
|
|
aeda2430cd | ||
|
|
819ea46bf0 | ||
|
|
2d5ddbf1bf | ||
|
|
76ad06ef47 | ||
|
|
49b5c42e85 | ||
|
|
d9337ad43a | ||
|
|
0c22e0262d | ||
|
|
593a53253c | ||
|
|
0c4f0fdd01 | ||
|
|
ecd1528197 | ||
|
|
cc0ce7163a | ||
|
|
259394029a | ||
|
|
a307d2d03f | ||
|
|
ad4ba44394 | ||
|
|
6b56426719 | ||
|
|
44e5e8bccf | ||
|
|
edf58820cf | ||
|
|
20cdb4dca0 | ||
|
|
d8bbcf21be | ||
|
|
7ff6d34a49 | ||
|
|
e3499b5df8 | ||
|
|
4e8c8deeaa | ||
|
|
92c987a6b4 | ||
|
|
5e4dac41a7 | ||
|
|
dc9e9f498a | ||
|
|
0d3ed84864 | ||
|
|
468b1e22f5 | ||
|
|
c89bb5f4b1 | ||
|
|
7d6c2229ab | ||
|
|
516a1b85d1 | ||
|
|
2836c20649 | ||
|
|
80050c110f | ||
|
|
d2fc4e3569 | ||
|
|
fbfb4bd74e | ||
|
|
8fff0fa6a9 | ||
|
|
d0dac38ea8 | ||
|
|
3d6ea6737c | ||
|
|
dc5f40bf62 | ||
|
|
1882bbdae7 | ||
|
|
855681a40b | ||
|
|
db066da443 | ||
|
|
090d813065 | ||
|
|
722917e9a6 | ||
|
|
8a02b76d73 | ||
|
|
3e483cfa4c | ||
|
|
c42ea14531 | ||
|
|
a30af2ac89 | ||
|
|
83dc45db62 | ||
|
|
3757829f8e | ||
|
|
db17ae8997 | ||
|
|
cd19246937 | ||
|
|
d61436cca5 | ||
|
|
4e6c8d8b35 | ||
|
|
16acba1636 | ||
|
|
50b35e2090 | ||
|
|
e8d02c1333 | ||
|
|
3523cee63d | ||
|
|
aa76632bb3 | ||
|
|
feb7582aca | ||
|
|
07e3f81b76 | ||
|
|
6ff5d3734f | ||
|
|
5fe65c5906 | ||
|
|
2c13d9eb57 | ||
|
|
b9fc9f6334 | ||
|
|
1853c0d678 | ||
|
|
6dc79c23ed | ||
|
|
5a9c3c797c | ||
|
|
a4a43a4de9 | ||
|
|
25b002b37f | ||
|
|
40c39c4afb | ||
|
|
f0e1024ad6 | ||
|
|
c11e186659 | ||
|
|
0a48916d98 | ||
|
|
dffb999efb | ||
|
|
044dd53513 | ||
|
|
02059a27d6 | ||
|
|
8f347a5333 | ||
|
|
bce9bca2ce | ||
|
|
cafe18c592 | ||
|
|
3e5490ef6d | ||
|
|
c76656cf7f | ||
|
|
c7c1b3cc3b | ||
|
|
39f9135104 | ||
|
|
dd52bdd2c4 | ||
|
|
7a0fa312ea | ||
|
|
fc640504ba | ||
|
|
3c0b35092c | ||
|
|
89e8ea436a | ||
|
|
21dc05fc33 | ||
|
|
589570daa3 | ||
|
|
a02a469b20 | ||
|
|
be1f734845 | ||
|
|
98d7fa3fd9 | ||
|
|
74823cb7d1 | ||
|
|
e47bfa223f | ||
|
|
5c1ec051f0 | ||
|
|
65094d9c90 | ||
|
|
c00341a97e | ||
|
|
36423a5f77 | ||
|
|
60dd194b72 | ||
|
|
9ae717c433 | ||
|
|
d90a0647d6 | ||
|
|
35d81e65c1 | ||
|
|
cca574c9a9 | ||
|
|
c96c423afb | ||
|
|
463b154e3d | ||
|
|
3666948610 | ||
|
|
397410bac6 | ||
|
|
7aa838c091 | ||
|
|
458ac470aa | ||
|
|
a79cb95c85 | ||
|
|
5ad49454f1 | ||
|
|
1a56b9c5f2 | ||
|
|
efe3700f70 | ||
|
|
fc89d2e014 | ||
|
|
3c37539cee | ||
|
|
3d977aeacb | ||
|
|
4308b124c2 | ||
|
|
b23e9c207d | ||
|
|
c3a6b1600f | ||
|
|
138e1ba9a8 | ||
|
|
2858661bce | ||
|
|
afc791835e | ||
|
|
d981bff8ea | ||
|
|
b24d47c093 | ||
|
|
df086301b6 | ||
|
|
01b4d5cdd4 | ||
|
|
8c155dd875 | ||
|
|
3f9a38697d | ||
|
|
87742a5e6c | ||
|
|
5b9e8a77ca | ||
|
|
2821624ede | ||
|
|
ac1ab720c4 | ||
|
|
e0168b98d7 | ||
|
|
18801b81de | ||
|
|
1daefeb594 | ||
|
|
068048718e | ||
|
|
56946e8128 | ||
|
|
3dfb4a13f1 | ||
|
|
7ae3c91015 | ||
|
|
95f107d487 | ||
|
|
61316c7f95 | ||
|
|
49bdf2e72d | ||
|
|
f0f96bd1da |
6
.codecov.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
codecov:
|
||||
ci:
|
||||
- ci.ops.ripple.com # add custom jenkins server
|
||||
- !appveyor
|
||||
- !travis
|
||||
5
.gitignore
vendored
@@ -33,9 +33,6 @@ Release/*.*
|
||||
*.gcda
|
||||
*.gcov
|
||||
|
||||
# Ignore locally installed node_modules
|
||||
/node_modules
|
||||
|
||||
# Ignore tmp directory.
|
||||
tmp
|
||||
|
||||
@@ -50,10 +47,10 @@ debug_log.txt
|
||||
# Ignore customized configs
|
||||
rippled.cfg
|
||||
validators.txt
|
||||
test/config.js
|
||||
|
||||
# Doxygen generated documentation output
|
||||
HtmlDocumentation
|
||||
docs/html_doc
|
||||
|
||||
# Xcode user-specific project settings
|
||||
# Xcode
|
||||
|
||||
3
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
||||
[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
|
||||
|
||||
40
.travis.yml
@@ -3,19 +3,19 @@ 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.
|
||||
- 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'
|
||||
- BOOST_ROOT=$HOME/boost_1_65_1
|
||||
- BOOST_URL='https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz'
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-5.0
|
||||
packages:
|
||||
- gcc-5
|
||||
- g++-5
|
||||
@@ -25,37 +25,40 @@ addons:
|
||||
- libssl-dev
|
||||
- libstdc++6
|
||||
- binutils-gold
|
||||
# Provides a backtrace if the unittests crash
|
||||
- gdb
|
||||
- cmake
|
||||
- lcov
|
||||
- llvm-5.0
|
||||
- clang-5.0
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Default BUILD is "scons".
|
||||
|
||||
- compiler: gcc
|
||||
env: GCC_VER=5 BUILD=cmake TARGET=debug.nounity PATH=$PWD/cmake/bin:$PATH
|
||||
env: GCC_VER=5 TARGET=debug
|
||||
# - APP_ARGS="--unittest-jobs=2"
|
||||
|
||||
- compiler: gcc
|
||||
env: GCC_VER=5 TARGET=coverage
|
||||
# - compiler: gcc
|
||||
# env: GCC_VER=5 TARGET=debug.nounity
|
||||
|
||||
# - compiler: gcc
|
||||
# env: GCC_VER=5 TARGET=coverage PATH=$PWD/cmake/bin:$PATH
|
||||
|
||||
- compiler: clang
|
||||
env: GCC_VER=5 TARGET=debug CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
|
||||
env: GCC_VER=5 TARGET=debug
|
||||
|
||||
- compiler: clang
|
||||
env: GCC_VER=5 TARGET=debug.nounity CLANG_VER=3.8 PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
|
||||
# - compiler: clang
|
||||
# env: GCC_VER=5 TARGET=debug.nounity
|
||||
|
||||
# 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
|
||||
# env: GCC_VER=5 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
|
||||
# env: GCC_VER=5 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
|
||||
@@ -69,3 +72,4 @@ notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "chat.freenode.net#ripple-dev"
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# Maintainer: Roberto Catini <roberto.catini@gmail.com>
|
||||
|
||||
pkgname=rippled
|
||||
pkgrel=1
|
||||
pkgver=0
|
||||
pkgdesc="Ripple peer-to-peer network daemon"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://github.com/ripple/rippled"
|
||||
license=('custom:ISC')
|
||||
depends=('protobuf' 'openssl' 'boost-libs')
|
||||
makedepends=('git' 'scons' 'boost')
|
||||
backup=("etc/$pkgname/rippled.cfg")
|
||||
source=("git://github.com/ripple/rippled.git#branch=master")
|
||||
sha512sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
cd "$srcdir/$pkgname"
|
||||
git describe --long --tags | sed -r 's/([^-]*-g)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$pkgname"
|
||||
scons
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "$srcdir/$pkgname"
|
||||
build/rippled --unittest
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$srcdir/$pkgname"
|
||||
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
install -D build/rippled "$pkgdir/usr/bin/rippled"
|
||||
install -D -m644 doc/rippled-example.cfg "$pkgdir/etc/$pkgname/rippled.cfg"
|
||||
mkdir -p "$pkgdir/var/lib/$pkgname/db"
|
||||
mkdir -p "$pkgdir/var/log/$pkgname"
|
||||
}
|
||||
@@ -12,7 +12,7 @@ endif()
|
||||
|
||||
macro(parse_target)
|
||||
|
||||
if (NOT target)
|
||||
if (NOT target OR target STREQUAL "default")
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
@@ -110,14 +110,27 @@ macro(parse_target)
|
||||
|
||||
endwhile()
|
||||
endif()
|
||||
# Promote these values to the CACHE, then unset the locals
|
||||
# to prevent shadowing.
|
||||
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE FILEPATH
|
||||
"Path to a program" FORCE)
|
||||
unset(CMAKE_C_COMPILER)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH
|
||||
"Path to a program" FORCE)
|
||||
unset(CMAKE_CXX_COMPILER)
|
||||
|
||||
if(CMAKE_C_COMPILER MATCHES "-NOTFOUND$" OR
|
||||
CMAKE_CXX_COMPILER MATCHES "-NOTFOUND$")
|
||||
message(FATAL_ERROR "Can not find appropriate compiler for target ${target}")
|
||||
endif()
|
||||
|
||||
# If defined, promote the compiler path values to the CACHE, then
|
||||
# unset the locals to prevent shadowing. Some scenarios do not
|
||||
# need or want to find a compiler, such as -GNinja under Windows.
|
||||
# Setting these values in those case may prevent CMake from finding
|
||||
# a valid compiler.
|
||||
if (CMAKE_C_COMPILER)
|
||||
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER} CACHE FILEPATH
|
||||
"Path to a program" FORCE)
|
||||
unset(CMAKE_C_COMPILER)
|
||||
endif (CMAKE_C_COMPILER)
|
||||
if (CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE FILEPATH
|
||||
"Path to a program" FORCE)
|
||||
unset(CMAKE_CXX_COMPILER)
|
||||
endif (CMAKE_CXX_COMPILER)
|
||||
|
||||
if (release)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
@@ -156,11 +169,17 @@ macro(setup_build_cache)
|
||||
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")
|
||||
set(jemalloc false CACHE BOOL "Enables jemalloc for heap profiling")
|
||||
set(perf false CACHE BOOL "Enables flags that assist with perf recording")
|
||||
|
||||
if (static AND (WIN32 OR APPLE))
|
||||
message(FATAL_ERROR "Static linking is only supported on linux.")
|
||||
endif()
|
||||
|
||||
if (perf AND (WIN32 OR APPLE))
|
||||
message(FATAL_ERROR "perf flags are only supported on linux.")
|
||||
endif()
|
||||
|
||||
if (${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" AND NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
@@ -302,6 +321,7 @@ macro(use_boost)
|
||||
if ((NOT DEFINED BOOST_ROOT) AND (DEFINED ENV{BOOST_ROOT}))
|
||||
set(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
endif()
|
||||
file(TO_CMAKE_PATH "${BOOST_ROOT}" BOOST_ROOT)
|
||||
if(WIN32 OR CYGWIN)
|
||||
# Workaround for MSVC having two boost versions - x86 and x64 on same PC in stage folders
|
||||
if(DEFINED BOOST_ROOT)
|
||||
@@ -317,7 +337,13 @@ macro(use_boost)
|
||||
set(BOOST_ROOT $ENV{CLANG_BOOST_ROOT})
|
||||
endif()
|
||||
|
||||
set(Boost_USE_STATIC_LIBS on)
|
||||
# boost dynamic libraries don't trivially support @rpath
|
||||
# linking right now (cmake's default), so just force
|
||||
# static linking for macos, or if requested on linux
|
||||
# by flag
|
||||
if (static OR APPLE)
|
||||
set(Boost_USE_STATIC_LIBS on)
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED on)
|
||||
set(Boost_USE_STATIC_RUNTIME off)
|
||||
if(MSVC)
|
||||
@@ -331,8 +357,24 @@ macro(use_boost)
|
||||
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})
|
||||
|
||||
if(MSVC14)
|
||||
# VS2017 with boost <= 1.66.0 requires a flag to suppress warnings
|
||||
if(NOT Boost_VERSION VERSION_GREATER 106600)
|
||||
add_definitions(-DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (is_xcode)
|
||||
include_directories(BEFORE ${Boost_INCLUDE_DIRS})
|
||||
append_flags(CMAKE_CXX_FLAGS --system-header-prefix="boost/")
|
||||
else()
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Boost not found")
|
||||
endif()
|
||||
@@ -357,9 +399,13 @@ macro(use_openssl openssl_min)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (DEFINED ENV{OPENSSL_ROOT})
|
||||
include_directories($ENV{OPENSSL_ROOT}/include)
|
||||
link_directories($ENV{OPENSSL_ROOT}/lib)
|
||||
if ((NOT DEFINED OPENSSL_ROOT) AND (DEFINED ENV{OPENSSL_ROOT}))
|
||||
set(OPENSSL_ROOT $ENV{OPENSSL_ROOT})
|
||||
endif()
|
||||
file(TO_CMAKE_PATH "${OPENSSL_ROOT}" OPENSSL_ROOT)
|
||||
if (DEFINED OPENSSL_ROOT)
|
||||
include_directories(${OPENSSL_ROOT}/include)
|
||||
link_directories(${OPENSSL_ROOT}/lib)
|
||||
endif()
|
||||
else()
|
||||
if (static)
|
||||
@@ -368,6 +414,11 @@ macro(use_openssl openssl_min)
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL)
|
||||
# depending on how openssl is built, it might depend
|
||||
# on zlib. In fact, the openssl find package should
|
||||
# figure this out for us, but it does not currently...
|
||||
# so let's add zlib ourselves to the lib list
|
||||
find_package(ZLIB)
|
||||
|
||||
if (static)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES tmp)
|
||||
@@ -375,6 +426,7 @@ macro(use_openssl openssl_min)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
list(APPEND OPENSSL_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "OpenSSL not found")
|
||||
endif()
|
||||
@@ -473,6 +525,11 @@ macro(use_protobuf)
|
||||
else()
|
||||
include_directories(${PROTOBUF_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if (is_xcode)
|
||||
append_flags(CMAKE_CXX_FLAGS --system-header-prefix="google/protobuf")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
@@ -498,15 +555,23 @@ macro(setup_build_boilerplate)
|
||||
|
||||
string(TOLOWER ${san} ci_san)
|
||||
if (${ci_san} STREQUAL address)
|
||||
set(SANITIZER_LIBRARIES asan)
|
||||
if (is_gcc)
|
||||
set(SANITIZER_LIBRARIES asan)
|
||||
endif()
|
||||
add_definitions(-DSANITIZER=ASAN)
|
||||
endif()
|
||||
if (${ci_san} STREQUAL thread)
|
||||
set(SANITIZER_LIBRARIES tsan)
|
||||
if (is_gcc)
|
||||
set(SANITIZER_LIBRARIES tsan)
|
||||
endif()
|
||||
add_definitions(-DSANITIZER=TSAN)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (perf)
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
endif()
|
||||
|
||||
############################################################
|
||||
|
||||
add_definitions(
|
||||
@@ -525,8 +590,18 @@ macro(setup_build_boilerplate)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
|
||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if ("${LD_VERSION}" MATCHES "GNU gold")
|
||||
append_flags(CMAKE_EXE_LINKER_FLAGS -fuse-ld=gold)
|
||||
# NOTE: THE gold linker inserts -rpath as DT_RUNPATH by default
|
||||
# intead of DT_RPATH, so you might have slightly unexpected
|
||||
# runtime ld behavior if you were expecting DT_RPATH.
|
||||
# Specify --disable-new-dtags to gold if you do not want
|
||||
# the default DT_RUNPATH behavior. This rpath treatment as well
|
||||
# as static/dynamic selection means that gold does not currently
|
||||
# have ideal default behavior when we are using jemalloc. Thus
|
||||
# for simplicity we don't use it when jemalloc is requested.
|
||||
# An alternative to disabling would be to figure out all the settings
|
||||
# required to make gold play nicely with jemalloc.
|
||||
if (("${LD_VERSION}" MATCHES "GNU gold") AND (NOT jemalloc))
|
||||
append_flags(CMAKE_EXE_LINKER_FLAGS -fuse-ld=gold -Wl,--no-as-needed)
|
||||
endif ()
|
||||
unset(LD_VERSION)
|
||||
endif()
|
||||
@@ -555,9 +630,18 @@ macro(setup_build_boilerplate)
|
||||
STRING(REGEX REPLACE "[-/]DNDEBUG" "" CMAKE_C_FLAGS_RELEASECLASSIC "${CMAKE_C_FLAGS_RELEASECLASSIC}")
|
||||
endif()
|
||||
|
||||
if (jemalloc)
|
||||
find_package(jemalloc REQUIRED)
|
||||
add_definitions(-DPROFILE_JEMALLOC)
|
||||
include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS})
|
||||
link_libraries(${JEMALLOC_LIBRARIES})
|
||||
get_filename_component(JEMALLOC_LIB_PATH ${JEMALLOC_LIBRARIES} DIRECTORY)
|
||||
set(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${JEMALLOC_LIB_PATH})
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof
|
||||
append_flags(CMAKE_CXX_FLAGS -frtti -std=c++14 -Wno-invalid-offsetof -Wdeprecated
|
||||
-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)
|
||||
@@ -583,9 +667,8 @@ macro(setup_build_boilerplate)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
add_definitions(-DBEAST_COMPILE_OBJECTIVE_CPP=1)
|
||||
add_compile_options(
|
||||
-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-variable -Wno-unused-function)
|
||||
-Wno-deprecated-declarations -Wno-unused-function)
|
||||
endif()
|
||||
|
||||
if (is_gcc)
|
||||
@@ -594,27 +677,27 @@ macro(setup_build_boilerplate)
|
||||
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
|
||||
/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
|
||||
/MP # Multiprocessor compilation
|
||||
/openmp- # pragma omp: disabled
|
||||
/Zc:forScope # Language conformance: 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
|
||||
/wd4018 # Disable signed/unsigned comparison warnings
|
||||
/wd4244 # Disable float to int possible loss of data warnings
|
||||
/wd4267 # Disable size_t to T possible loss of data warnings
|
||||
/wd4800 # Disable C4800(int to bool performance)
|
||||
/wd4503 # Decorated name length exceeded, name was truncated
|
||||
)
|
||||
add_definitions(
|
||||
-D_WIN32_WINNT=0x6000
|
||||
@@ -666,6 +749,75 @@ macro(setup_build_boilerplate)
|
||||
# set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||
# set_target_properties(ripple-libpp PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||
endif()
|
||||
|
||||
## The following options were migrated from the erstwhile BeastConfig.h
|
||||
## Some of these should be considered for removal in the future if
|
||||
## unused or unmaintained
|
||||
|
||||
# beast_no_unit_test_inline
|
||||
# Prevents unit test definitions from being inserted into a global table
|
||||
if (beast_no_unit_test_inline)
|
||||
add_definitions(-DBEAST_NO_UNIT_TEST_INLINE=1)
|
||||
endif()
|
||||
|
||||
# beast_force_debug
|
||||
# Force BEAST_DEBUG behavior regardless of other compiler settings
|
||||
if (beast_force_debug)
|
||||
add_definitions(-DBEAST_FORCE_DEBUG=1)
|
||||
endif()
|
||||
|
||||
# beast_check_mem_leaks
|
||||
# Force BEAST_CHECK_MEMORY_LEAKS to be ON. Default is ON only for debug
|
||||
# builds. Only implemeted for windows builds.
|
||||
if (beast_check_mem_leaks)
|
||||
add_definitions(-DBEAST_CHECK_MEMORY_LEAKS=1)
|
||||
elseif(DEFINED beast_check_mem_leaks)
|
||||
add_definitions(-DBEAST_CHECK_MEMORY_LEAKS=0)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
# beast_disable_auto_link
|
||||
# Disables autolinking of system library dependencies on windows
|
||||
if (beast_disable_auto_link)
|
||||
add_definitions(-DBEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES=1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# dump_leaks_on_exit
|
||||
# Displays heap blocks and counted objects which were not disposed of
|
||||
# during exit. Only implemented for windows builds.
|
||||
if (DEFINED dump_leaks_on_exit AND NOT dump_leaks_on_exit)
|
||||
add_definitions(-DRIPPLE_DUMP_LEAKS_ON_EXIT=0)
|
||||
else ()
|
||||
add_definitions(-DRIPPLE_DUMP_LEAKS_ON_EXIT=1)
|
||||
endif()
|
||||
|
||||
# NOTE - THIS OPTION CURRENTLY DOES NOT COMPILE !!
|
||||
# verify_nodeobject_keys
|
||||
# This verifies that the hash of node objects matches the payload.
|
||||
# This check is expensive - use with caution.
|
||||
if (verify_nodeobject_keys)
|
||||
add_definitions(-DRIPPLE_VERIFY_NODEOBJECT_KEYS=1)
|
||||
endif()
|
||||
|
||||
# single_io_service_thread
|
||||
# Restricts the number of threads calling io_service::run to one.
|
||||
# This can be useful when debugging."
|
||||
if (single_io_service_thread)
|
||||
add_definitions(-DRIPPLE_SINGLE_IO_SERVICE_THREAD=1)
|
||||
endif()
|
||||
|
||||
# use_rocksdb
|
||||
# Controls whether or not the RocksDB database back-end is compiled into
|
||||
# rippled. RocksDB requires a relatively modern C++ compiler (tested with
|
||||
# gcc versions 4.8.1 and later) that supports some C++11 features. The
|
||||
# default is ON for modern unix compilers and OFF for everything else.
|
||||
if (use_rocksdb)
|
||||
add_definitions(-DRIPPLE_ROCKSDB_AVAILABLE=1)
|
||||
elseif(DEFINED use_rocksdb)
|
||||
add_definitions(-DRIPPLE_ROCKSDB_AVAILABLE=0)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
############################################################
|
||||
@@ -699,7 +851,7 @@ macro(link_common_libraries cur_project)
|
||||
find_library(app_kit AppKit)
|
||||
find_library(foundation Foundation)
|
||||
target_link_libraries(${cur_project}
|
||||
crypto ssl ${app_kit} ${foundation})
|
||||
${app_kit} ${foundation})
|
||||
else()
|
||||
target_link_libraries(${cur_project} rt)
|
||||
endif()
|
||||
@@ -712,6 +864,6 @@ macro(link_common_libraries cur_project)
|
||||
$<$<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)
|
||||
advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32 crypt32)
|
||||
endif (NOT MSVC)
|
||||
endmacro()
|
||||
|
||||
47
Builds/CMake/Findjemalloc.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# - Try to find jemalloc
|
||||
# Once done this will define
|
||||
# JEMALLOC_FOUND - System has jemalloc
|
||||
# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
|
||||
# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
|
||||
|
||||
if(NOT USE_BUNDLED_JEMALLOC)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
|
||||
endif()
|
||||
else()
|
||||
set(PC_JEMALLOC_INCLUDEDIR)
|
||||
set(PC_JEMALLOC_INCLUDE_DIRS)
|
||||
set(PC_JEMALLOC_LIBDIR)
|
||||
set(PC_JEMALLOC_LIBRARY_DIRS)
|
||||
set(LIMIT_SEARCH NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set(JEMALLOC_DEFINITIONS ${PC_JEMALLOC_CFLAGS_OTHER})
|
||||
|
||||
find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h
|
||||
PATHS ${PC_JEMALLOC_INCLUDEDIR} ${PC_JEMALLOC_INCLUDE_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
# If we're asked to use static linkage, add libjemalloc.a as a preferred library name.
|
||||
if(JEMALLOC_USE_STATIC)
|
||||
list(APPEND JEMALLOC_NAMES
|
||||
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
|
||||
list(APPEND JEMALLOC_NAMES jemalloc)
|
||||
|
||||
find_library(JEMALLOC_LIBRARY NAMES ${JEMALLOC_NAMES}
|
||||
HINTS ${PC_JEMALLOC_LIBDIR} ${PC_JEMALLOC_LIBRARY_DIRS}
|
||||
${LIMIT_SEARCH})
|
||||
|
||||
set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
|
||||
set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
|
||||
JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)
|
||||
@@ -1,30 +0,0 @@
|
||||
# rippled
|
||||
|
||||
# use the ubuntu base image
|
||||
FROM ubuntu
|
||||
MAINTAINER Roberto Catini roberto.catini@gmail.com
|
||||
|
||||
# make sure the package repository is up to date
|
||||
RUN apt-get update
|
||||
RUN apt-get -y upgrade
|
||||
|
||||
# install the dependencies
|
||||
RUN apt-get -y install git scons pkg-config protobuf-compiler libprotobuf-dev libssl-dev libboost1.55-all-dev
|
||||
|
||||
# download source code from official repository
|
||||
RUN git clone https://github.com/ripple/rippled.git src; cd src/; git checkout master
|
||||
|
||||
# compile
|
||||
RUN cd src/; scons build/rippled
|
||||
|
||||
# move to root directory and strip
|
||||
RUN cp src/build/rippled rippled; strip rippled
|
||||
|
||||
# copy default config
|
||||
RUN cp src/doc/rippled-example.cfg rippled.cfg
|
||||
|
||||
# clean source
|
||||
RUN rm -r src
|
||||
|
||||
# launch rippled when launching the container
|
||||
ENTRYPOINT ./rippled
|
||||
@@ -1,23 +0,0 @@
|
||||
FROM ubuntu
|
||||
MAINTAINER Torrie Fischer <torrie@ripple.com>
|
||||
|
||||
RUN apt-get update -qq &&\
|
||||
apt-get install -qq software-properties-common &&\
|
||||
apt-add-repository -y ppa:ubuntu-toolchain-r/test &&\
|
||||
apt-add-repository -y ppa:afrank/boost &&\
|
||||
apt-get update -qq
|
||||
|
||||
RUN apt-get purge -qq libboost1.48-dev &&\
|
||||
apt-get install -qq libprotobuf8 libboost1.57-all-dev
|
||||
|
||||
RUN mkdir -p /srv/rippled/data
|
||||
|
||||
VOLUME /srv/rippled/data/
|
||||
|
||||
ENTRYPOINT ["/srv/rippled/bin/rippled"]
|
||||
CMD ["--conf", "/srv/rippled/data/rippled.cfg"]
|
||||
EXPOSE 51235/udp
|
||||
EXPOSE 5005/tcp
|
||||
|
||||
ADD ./rippled.cfg /srv/rippled/data/rippled.cfg
|
||||
ADD ./rippled /srv/rippled/bin/
|
||||
@@ -1,13 +0,0 @@
|
||||
set -e
|
||||
|
||||
mkdir -p build/docker/
|
||||
cp doc/rippled-example.cfg build/clang.debug/rippled build/docker/
|
||||
cp Builds/Docker/Dockerfile-testnet build/docker/Dockerfile
|
||||
mv build/docker/rippled-example.cfg build/docker/rippled.cfg
|
||||
strip build/docker/rippled
|
||||
docker build -t ripple/rippled:$CIRCLE_SHA1 build/docker/
|
||||
docker tag ripple/rippled:$CIRCLE_SHA1 ripple/rippled:latest
|
||||
|
||||
if [ -z "$CIRCLE_PR_NUMBER" ]; then
|
||||
docker tag ripple/rippled:$CIRCLE_SHA1 ripple/rippled:$CIRCLE_BRANCH
|
||||
fi
|
||||
@@ -1,16 +0,0 @@
|
||||
set -e
|
||||
|
||||
if [ -z "$DOCKER_EMAIL" -o -z "$DOCKER_USERNAME" -o -z "$DOCKER_PASSWORD" ];then
|
||||
echo "Docker credentials are not set. Can't login to docker, no containers will be pushed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "$CIRCLE_PR_NUMBER" ]; then
|
||||
echo "Not pushing results of a pull request build."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
docker login -e $DOCKER_EMAIL -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||
docker push ripple/rippled:$CIRCLE_SHA1
|
||||
docker push ripple/rippled:$CIRCLE_BRANCH
|
||||
docker push ripple/rippled:latest
|
||||
@@ -1,31 +0,0 @@
|
||||
**Requirements**
|
||||
|
||||
1. Java Runtime Environment (JRE)
|
||||
2. Eclipse with CDT (tested on Luna):
|
||||
http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunasr2
|
||||
3. Eclipse SCons plugin: http://sconsolidator.com/
|
||||
**WARNING**: by default the SCons plugin uses 16 threads. Go to
|
||||
*Window->Preferences->SCons->Build Settings* in Eclipse and make it
|
||||
use only 4-8 jobs(threads) or whatever you feel confortable with. It will
|
||||
positively freeze your system if you run with 16 threads/jobs.
|
||||
|
||||

|
||||
|
||||
**Getting Started**
|
||||
|
||||
After setting up Eclipse just do a File->New->Other...
|
||||
Select: C/C++ / New SCons project from existing source
|
||||
Point the importer to the folder where the SConstruct resides (the root
|
||||
folder of your git workspace normally)
|
||||
|
||||
**Build**
|
||||
|
||||
Just hit Project->Build All in Eclipse to get started. And remember to not
|
||||
let it run 16 threads!
|
||||
|
||||
**Debug**
|
||||
|
||||
Start a new Eclipse debug configuration and set binary to run to build/rippled
|
||||
(assuming you have built it).
|
||||
|
||||

|
||||
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 17 KiB |
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This scripts installs the dependencies needed by rippled. It should be run
|
||||
# with sudo.
|
||||
#
|
||||
|
||||
if [ ! -f /etc/fedora-release ]; then
|
||||
echo "This script is meant to be run on fedora"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fedora_release=$(grep -o '[0-9]*' /etc/fedora-release)
|
||||
|
||||
if (( $(bc <<< "${fedora_release} < 22") )); then
|
||||
echo "This script is meant to run on fedora 22 or greater"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
yum -y update
|
||||
yum -y group install "Development Tools"
|
||||
yum -y install gcc-c++ scons openssl-devel openssl-static protobuf-devel protobuf-static boost-devel boost-static libstdc++-static
|
||||
5
Builds/QtCreator/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
# QTCreator
|
||||
|
||||
Makefile
|
||||
*.user
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
|
||||
# Ripple protocol buffers
|
||||
|
||||
PROTOS = ../../src/ripple_data/protocol/ripple.proto
|
||||
PROTOS_DIR = ../../build/proto
|
||||
|
||||
# Google Protocol Buffers support
|
||||
|
||||
protobuf_h.name = protobuf header
|
||||
protobuf_h.input = PROTOS
|
||||
protobuf_h.output = $${PROTOS_DIR}/${QMAKE_FILE_BASE}.pb.h
|
||||
protobuf_h.depends = ${QMAKE_FILE_NAME}
|
||||
protobuf_h.commands = protoc --cpp_out=$${PROTOS_DIR} --proto_path=${QMAKE_FILE_PATH} ${QMAKE_FILE_NAME}
|
||||
protobuf_h.variable_out = HEADERS
|
||||
QMAKE_EXTRA_COMPILERS += protobuf_h
|
||||
|
||||
protobuf_cc.name = protobuf implementation
|
||||
protobuf_cc.input = PROTOS
|
||||
protobuf_cc.output = $${PROTOS_DIR}/${QMAKE_FILE_BASE}.pb.cc
|
||||
protobuf_cc.depends = $${PROTOS_DIR}/${QMAKE_FILE_BASE}.pb.h
|
||||
protobuf_cc.commands = $$escape_expand(\\n)
|
||||
#protobuf_cc.variable_out = SOURCES
|
||||
QMAKE_EXTRA_COMPILERS += protobuf_cc
|
||||
|
||||
# Ripple compilation
|
||||
|
||||
DESTDIR = ../../build/QtCreator
|
||||
OBJECTS_DIR = ../../build/QtCreator/obj
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += console thread warn_off
|
||||
CONFIG -= qt gui
|
||||
|
||||
DEFINES += _DEBUG
|
||||
|
||||
linux-g++:QMAKE_CXXFLAGS += \
|
||||
-Wall \
|
||||
-Wno-sign-compare \
|
||||
-Wno-char-subscripts \
|
||||
-Wno-invalid-offsetof \
|
||||
-Wno-unused-parameter \
|
||||
-Wformat \
|
||||
-O0 \
|
||||
-std=c++11 \
|
||||
-pthread
|
||||
|
||||
INCLUDEPATH += \
|
||||
"../../src/leveldb/" \
|
||||
"../../src/leveldb/port" \
|
||||
"../../src/leveldb/include" \
|
||||
$${PROTOS_DIR}
|
||||
|
||||
OTHER_FILES += \
|
||||
# $$files(../../src/*, true) \
|
||||
# $$files(../../src/beast/*) \
|
||||
# $$files(../../src/beast/modules/beast_basics/diagnostic/*)
|
||||
# $$files(../../src/beast/modules/beast_core/, true)
|
||||
|
||||
UI_HEADERS_DIR += ../../src/ripple_basics
|
||||
|
||||
# ---------
|
||||
# New style
|
||||
#
|
||||
SOURCES += \
|
||||
../../src/ripple/beast/ripple_beast.unity.cpp \
|
||||
../../src/ripple/beast/ripple_beastc.c \
|
||||
../../src/ripple/common/ripple_common.unity.cpp \
|
||||
../../src/ripple/http/ripple_http.unity.cpp \
|
||||
../../src/ripple/json/ripple_json.unity.cpp \
|
||||
../../src/ripple/peerfinder/ripple_peerfinder.unity.cpp \
|
||||
../../src/ripple/radmap/ripple_radmap.unity.cpp \
|
||||
../../src/ripple/resource/ripple_resource.unity.cpp \
|
||||
../../src/ripple/sitefiles/ripple_sitefiles.unity.cpp \
|
||||
../../src/ripple/sslutil/ripple_sslutil.unity.cpp \
|
||||
../../src/ripple/testoverlay/ripple_testoverlay.unity.cpp \
|
||||
../../src/ripple/types/ripple_types.unity.cpp \
|
||||
../../src/ripple/validators/ripple_validators.unity.cpp
|
||||
|
||||
# ---------
|
||||
# Old style
|
||||
#
|
||||
SOURCES += \
|
||||
../../src/ripple_app/ripple_app.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt1.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt2.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt3.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt4.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt5.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt6.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt7.unity.cpp \
|
||||
../../src/ripple_app/ripple_app_pt8.unity.cpp \
|
||||
../../src/ripple_basics/ripple_basics.unity.cpp \
|
||||
../../src/ripple_core/ripple_core.unity.cpp \
|
||||
../../src/ripple_data/ripple_data.unity.cpp \
|
||||
../../src/ripple_hyperleveldb/ripple_hyperleveldb.unity.cpp \
|
||||
../../src/ripple_leveldb/ripple_leveldb.unity.cpp \
|
||||
../../src/ripple_net/ripple_net.unity.cpp \
|
||||
../../src/ripple_overlay/ripple_overlay.unity.cpp \
|
||||
../../src/ripple_rpc/ripple_rpc.unity.cpp \
|
||||
../../src/ripple_websocket/ripple_websocket.unity.cpp
|
||||
|
||||
LIBS += \
|
||||
-lboost_date_time-mt\
|
||||
-lboost_filesystem-mt \
|
||||
-lboost_program_options-mt \
|
||||
-lboost_regex-mt \
|
||||
-lboost_system-mt \
|
||||
-lboost_thread-mt \
|
||||
-lboost_random-mt \
|
||||
-lprotobuf \
|
||||
-lssl \
|
||||
-lrt
|
||||
312
Builds/Test.py
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This file is part of rippled: https://github.com/ripple/rippled
|
||||
# Copyright (c) 2012 - 2015 Ripple Labs Inc.
|
||||
# Copyright (c) 2012 - 2017 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
|
||||
@@ -22,10 +22,10 @@ Invocation:
|
||||
|
||||
The build must succeed without shell aliases for this to work.
|
||||
|
||||
To pass flags to scons, put them at the very end of the command line, after
|
||||
To pass flags to cmake, put them at the very end of the command line, after
|
||||
the -- flag - like this:
|
||||
|
||||
./Builds/Test.py -- -j4 # Pass -j4 to scons.
|
||||
./Builds/Test.py -- -j4 # Pass -j4 to cmake --build
|
||||
|
||||
|
||||
Common problems:
|
||||
@@ -34,11 +34,7 @@ Common problems:
|
||||
|
||||
2) OpenSSL not found. Solution: export OPENSSL_ROOT=[path to OpenSSL folder]
|
||||
|
||||
3) scons is an alias. Solution: Create a script named "scons" somewhere in
|
||||
your $PATH (eg. ~/bin/scons will often work).
|
||||
|
||||
#!/bin/sh
|
||||
python /C/Python27/Scripts/scons.py "${@}"
|
||||
3) cmake is not found. Solution: Be sure cmake directory is on your $PATH
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
@@ -61,26 +57,36 @@ def powerset(iterable):
|
||||
IS_WINDOWS = platform.system().lower() == 'windows'
|
||||
IS_OS_X = platform.system().lower() == 'darwin'
|
||||
|
||||
if IS_WINDOWS or IS_OS_X:
|
||||
ALL_TARGETS = [('debug',), ('release',)]
|
||||
# CMake
|
||||
if IS_WINDOWS:
|
||||
CMAKE_UNITY_CONFIGS = ['Debug', 'Release']
|
||||
CMAKE_NONUNITY_CONFIGS = ['DebugClassic', 'ReleaseClassic']
|
||||
else:
|
||||
ALL_TARGETS = [(cc + "." + target,)
|
||||
CMAKE_UNITY_CONFIGS = []
|
||||
CMAKE_NONUNITY_CONFIGS = []
|
||||
CMAKE_UNITY_COMBOS = { '' : [['rippled', 'rippled_classic'], CMAKE_UNITY_CONFIGS],
|
||||
'.nounity' : [['rippled', 'rippled_unity'], CMAKE_NONUNITY_CONFIGS] }
|
||||
|
||||
if IS_WINDOWS:
|
||||
CMAKE_DIR_TARGETS = { ('msvc' + unity,) : targets for unity, targets in
|
||||
CMAKE_UNITY_COMBOS.items() }
|
||||
elif IS_OS_X:
|
||||
CMAKE_DIR_TARGETS = { (build + unity,) : targets
|
||||
for build in ['debug', 'release']
|
||||
for unity, targets in CMAKE_UNITY_COMBOS.items() }
|
||||
else:
|
||||
CMAKE_DIR_TARGETS = { (cc + "." + build + unity,) : targets
|
||||
for cc in ['gcc', 'clang']
|
||||
for target in ['debug', 'release', 'coverage', 'profile',
|
||||
'debug.nounity', 'release.nounity', 'coverage.nounity', 'profile.nounity']]
|
||||
for build in ['debug', 'release', 'coverage', 'profile']
|
||||
for unity, targets in CMAKE_UNITY_COMBOS.items() }
|
||||
|
||||
# list of tuples of all possible options
|
||||
if IS_WINDOWS or IS_OS_X:
|
||||
ALL_OPTIONS = [tuple(x) for x in powerset(['--assert'])]
|
||||
CMAKE_ALL_GENERATE_OPTIONS = [tuple(x) for x in powerset(['-GNinja', '-Dassert=true'])]
|
||||
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]
|
||||
CMAKE_ALL_GENERATE_OPTIONS = list(set(
|
||||
[tuple(x) for x in powerset(['-GNinja', '-Dstatic=true', '-Dassert=true', '-Dsan=address'])] +
|
||||
[tuple(x) for x in powerset(['-GNinja', '-Dstatic=true', '-Dassert=true', '-Dsan=thread'])]))
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Test.py - run ripple tests'
|
||||
@@ -117,6 +123,13 @@ parser.add_argument(
|
||||
help='Add a prefix for unit tests',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--testjobs',
|
||||
default='0',
|
||||
type=int,
|
||||
help='Run tests in parallel'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--clean', '-c',
|
||||
action='store_true',
|
||||
@@ -130,13 +143,60 @@ parser.add_argument(
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'scons_args',
|
||||
'--dir', '-d',
|
||||
default=(),
|
||||
nargs='*'
|
||||
nargs='*',
|
||||
help='Specify one or more CMake dir names. '
|
||||
'Will also be used as -Dtarget=<dir> running cmake.'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--target',
|
||||
default=(),
|
||||
nargs='*',
|
||||
help='Specify one or more CMake build targets. '
|
||||
'Will be used as --target <target> running cmake --build.'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--config',
|
||||
default=(),
|
||||
nargs='*',
|
||||
help='Specify one or more CMake build configs. '
|
||||
'Will be used as --config <config> running cmake --build.'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--generator_option',
|
||||
action='append',
|
||||
help='Specify a CMake generator option. Repeat for multiple options. '
|
||||
'Will be passed to the cmake generator. '
|
||||
'Due to limits of the argument parser, arguments starting with \'-\' '
|
||||
'must be attached to this option. e.g. --generator_option=-GNinja.')
|
||||
|
||||
parser.add_argument(
|
||||
'--build_option',
|
||||
action='append',
|
||||
help='Specify a build option. Repeat for multiple options. '
|
||||
'Will be passed to the build tool via cmake --build. '
|
||||
'Due to limits of the argument parser, arguments starting with \'-\' '
|
||||
'must be attached to this option. e.g. --build_option=-j8.')
|
||||
|
||||
parser.add_argument(
|
||||
'extra_args',
|
||||
default=(),
|
||||
nargs='*',
|
||||
help='Extra arguments are passed through to the tools'
|
||||
)
|
||||
|
||||
ARGS = parser.parse_args()
|
||||
|
||||
def decodeString(line):
|
||||
# Python 2 vs. Python 3
|
||||
if isinstance(line, str):
|
||||
return line
|
||||
else:
|
||||
return line.decode()
|
||||
|
||||
def shell(cmd, args=(), silent=False):
|
||||
""""Execute a shell command and return the output."""
|
||||
@@ -147,6 +207,7 @@ def shell(cmd, args=(), silent=False):
|
||||
|
||||
command = (cmd,) + args
|
||||
|
||||
# shell is needed in Windows to find executable in the path
|
||||
process = subprocess.Popen(
|
||||
command,
|
||||
stdin=subprocess.PIPE,
|
||||
@@ -155,117 +216,150 @@ def shell(cmd, args=(), silent=False):
|
||||
shell=IS_WINDOWS)
|
||||
lines = []
|
||||
count = 0
|
||||
for line in process.stdout:
|
||||
# Python 2 vs. Python 3
|
||||
if isinstance(line, str):
|
||||
decoded = line
|
||||
# readline returns '' at EOF
|
||||
for line in iter(process.stdout.readline, ''):
|
||||
if process.poll() is None:
|
||||
decoded = decodeString(line)
|
||||
lines.append(decoded)
|
||||
if verbose:
|
||||
print(decoded, end='')
|
||||
elif not silent:
|
||||
count += 1
|
||||
if count >= 80:
|
||||
print()
|
||||
count = 0
|
||||
else:
|
||||
print('.', end='')
|
||||
else:
|
||||
decoded = line.decode()
|
||||
lines.append(decoded)
|
||||
if verbose:
|
||||
print(decoded, end='')
|
||||
elif not silent:
|
||||
count += 1
|
||||
if count >= 80:
|
||||
print()
|
||||
count = 0
|
||||
else:
|
||||
print('.', end='')
|
||||
break
|
||||
|
||||
if not verbose and count:
|
||||
print()
|
||||
process.wait()
|
||||
return process.returncode, lines
|
||||
|
||||
def get_cmake_dir(cmake_dir):
|
||||
return os.path.join('build' , 'cmake' , cmake_dir)
|
||||
|
||||
def run_tests(args):
|
||||
failed = []
|
||||
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)
|
||||
if match:
|
||||
executable, target = match.group(0, 1)
|
||||
def run_cmake(directory, cmake_dir, args):
|
||||
print('Generating build in', directory, 'with', *args or ('default options',))
|
||||
old_dir = os.getcwd()
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
os.chdir(directory)
|
||||
if IS_WINDOWS and not any(arg.startswith("-G") for arg in args) and not os.path.exists("CMakeCache.txt"):
|
||||
if '--ninja' in args:
|
||||
args += ( '-GNinja', )
|
||||
else:
|
||||
args += ( '-GVisual Studio 14 2015 Win64', )
|
||||
args += ( '-Dtarget=' + cmake_dir, os.path.join('..', '..', '..'), )
|
||||
resultcode, lines = shell('cmake', args)
|
||||
|
||||
print('Unit tests for', target)
|
||||
testflag = '--unittest'
|
||||
quiet = ''
|
||||
if ARGS.test:
|
||||
testflag += ('=' + ARGS.test)
|
||||
if ARGS.quiet:
|
||||
quiet = '-q'
|
||||
resultcode, lines = shell(executable, (testflag, quiet,))
|
||||
if resultcode:
|
||||
print('Generating FAILED:')
|
||||
if not ARGS.verbose:
|
||||
print(*lines, sep='')
|
||||
sys.exit(1)
|
||||
|
||||
if resultcode:
|
||||
if not ARGS.verbose:
|
||||
print('ERROR:', *lines, sep='')
|
||||
failed.append([target, 'unittest'])
|
||||
if not ARGS.keep_going:
|
||||
break
|
||||
os.chdir(old_dir)
|
||||
|
||||
return failed
|
||||
|
||||
|
||||
def run_build(args=None):
|
||||
print('Building:', *args or ('(default)',))
|
||||
resultcode, lines = shell('scons', args)
|
||||
def run_cmake_build(directory, target, config, args):
|
||||
print('Building', target, config, 'in', directory, 'with', *args or ('default options',))
|
||||
build_args=('--build', directory)
|
||||
if target:
|
||||
build_args += ('--target', target)
|
||||
if config:
|
||||
build_args += ('--config', config)
|
||||
if args:
|
||||
build_args += ('--',)
|
||||
build_args += tuple(args)
|
||||
resultcode, lines = shell('cmake', build_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 run_cmake_tests(directory, target, config):
|
||||
failed = []
|
||||
if IS_WINDOWS:
|
||||
target += '.exe'
|
||||
executable = os.path.join(directory, config if config else 'Debug', target)
|
||||
if(not os.path.exists(executable)):
|
||||
executable = os.path.join(directory, target)
|
||||
print('Unit tests for', executable)
|
||||
testflag = '--unittest'
|
||||
quiet = ''
|
||||
testjobs = ''
|
||||
if ARGS.test:
|
||||
testflag += ('=' + ARGS.test)
|
||||
if ARGS.quiet:
|
||||
quiet = '-q'
|
||||
if ARGS.testjobs:
|
||||
testjobs = ('--unittest-jobs=' + str(ARGS.testjobs))
|
||||
resultcode, lines = shell(executable, (testflag, quiet, testjobs,))
|
||||
|
||||
if resultcode:
|
||||
if not ARGS.verbose:
|
||||
print('ERROR:', *lines, sep='')
|
||||
failed.append([target, 'unittest'])
|
||||
|
||||
return failed
|
||||
|
||||
def main():
|
||||
if ARGS.all:
|
||||
to_build = ALL_BUILDS
|
||||
else:
|
||||
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)
|
||||
if ARGS.all:
|
||||
build_dir_targets = CMAKE_DIR_TARGETS
|
||||
generator_options = CMAKE_ALL_GENERATE_OPTIONS
|
||||
else:
|
||||
build_dir_targets = { tuple(ARGS.dir) : [ARGS.target, ARGS.config] }
|
||||
if ARGS.generator_option:
|
||||
generator_options = [tuple(ARGS.generator_option)]
|
||||
else:
|
||||
print('Success')
|
||||
generator_options = [tuple()]
|
||||
|
||||
if ARGS.clean:
|
||||
shutil.rmtree('build')
|
||||
if '--ninja' in args:
|
||||
os.remove('build.ninja')
|
||||
os.remove('.ninja_deps')
|
||||
os.remove('.ninja_log')
|
||||
if not build_dir_targets:
|
||||
# Let CMake choose the build tool.
|
||||
build_dir_targets = { () : [] }
|
||||
|
||||
if ARGS.build_option:
|
||||
ARGS.build_option = ARGS.build_option + list(ARGS.extra_args)
|
||||
else:
|
||||
ARGS.build_option = list(ARGS.extra_args)
|
||||
|
||||
for args in generator_options:
|
||||
for build_dirs, (build_targets, build_configs) in build_dir_targets.items():
|
||||
if not build_dirs:
|
||||
build_dirs = ('default',)
|
||||
if not build_targets:
|
||||
build_targets = ('rippled',)
|
||||
if not build_configs:
|
||||
build_configs = ('',)
|
||||
for cmake_dir in build_dirs:
|
||||
cmake_full_dir = get_cmake_dir(cmake_dir)
|
||||
run_cmake(cmake_full_dir, cmake_dir, args)
|
||||
|
||||
for target in build_targets:
|
||||
for config in build_configs:
|
||||
run_cmake_build(cmake_full_dir, target, config, ARGS.build_option)
|
||||
failed = run_cmake_tests(cmake_full_dir, target, config)
|
||||
|
||||
if failed:
|
||||
print('FAILED:', *(':'.join(f) for f in failed))
|
||||
if not ARGS.keep_going:
|
||||
sys.exit(1)
|
||||
else:
|
||||
all_failed.extend([decodeString(cmake_dir +
|
||||
"." + target + "." + config), ':'.join(f)]
|
||||
for f in failed)
|
||||
else:
|
||||
print('Success')
|
||||
if ARGS.clean:
|
||||
shutil.rmtree(cmake_full_dir)
|
||||
|
||||
if all_failed:
|
||||
if len(to_build) > 1:
|
||||
if len(all_failed) > 1:
|
||||
print()
|
||||
print('FAILED:', *(':'.join(f) for f in all_failed))
|
||||
sys.exit(1)
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This script builds boost with the correct ABI flags for ubuntu
|
||||
#
|
||||
|
||||
version=63
|
||||
patch=0
|
||||
|
||||
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
|
||||
|
||||
extra_defines=""
|
||||
if (( $(bc <<< "${ubuntu_release} < 15.1") )); then
|
||||
extra_defines="define=_GLIBCXX_USE_CXX11_ABI=0"
|
||||
fi
|
||||
num_procs=$(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) # pysical cores
|
||||
printf "\nBuild command will be: ./b2 -j${num_procs} ${extra_defines}\n\n"
|
||||
|
||||
boost_dir="boost_1_${version}_${patch}"
|
||||
boost_tag="boost-1.${version}.${patch}"
|
||||
git clone -b "${boost_tag}" --recursive https://github.com/boostorg/boost.git "${boost_dir}"
|
||||
|
||||
cd ${boost_dir}
|
||||
git checkout --force ${boost_tag}
|
||||
git submodule foreach git checkout --force ${boost_tag}
|
||||
./bootstrap.sh
|
||||
./b2 headers
|
||||
./b2 -j${num_procs} ${extra_defines}
|
||||
echo "Build command was: ./b2 -j${num_procs} ${extra_defines}"
|
||||
echo "Don't forget to set BOOST_ROOT!"
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This scripts installs the dependencies needed by rippled. It should be run
|
||||
# with sudo. For ubuntu < 15.10, it installs gcc 5 as the default compiler. gcc
|
||||
# 5 is ABI incompatable with gcc 4. If needed, the following will switch back to
|
||||
# gcc-4: `sudo update-alternatives --config gcc` and choosing the gcc-4
|
||||
# option.
|
||||
#
|
||||
|
||||
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 [ ${ubuntu_release} == "12.04" ]; then
|
||||
apt-get install python-software-properties
|
||||
add-apt-repository ppa:afrank/boost
|
||||
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 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} == "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
|
||||
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 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
|
||||
|
||||
# Test if 0th parameter has a version number greater than or equal to the 1st param
|
||||
function version_check() { test "$(printf '%s\n' "$@" | sort -V | tail -n 1)" == "$1"; }
|
||||
|
||||
# this should work for versions greater than 15.10
|
||||
if version_check ${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
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "System not supported"
|
||||
exit 1
|
||||
4
Builds/VisualStudio2015/.gitattributes
vendored
@@ -1,4 +0,0 @@
|
||||
RippleD.vcxproj -text
|
||||
RippleD.vcxproj.filters -text
|
||||
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
# Visual Studio 2015 Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
We do not recommend Windows for rippled production use at this time. Currently, the Ubuntu
|
||||
platform has received the highest level of quality assurance, testing, and support.
|
||||
Additionally, 32-bit Windows versions are not supported.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To clone the source code repository, create branches for inspection or modification,
|
||||
build rippled under Visual Studio, and run the unit tests you will need these
|
||||
software components:
|
||||
|
||||
* [Visual Studio 2015](README.md#install-visual-studio-2015)
|
||||
* [Git for Windows](README.md#install-git-for-windows)
|
||||
* [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 library](README.md#build-boost)
|
||||
|
||||
## Install Software
|
||||
|
||||
### Install Visual Studio 2015
|
||||
|
||||
If not already installed on your system, download your choice of installer from the
|
||||
[Visual Studio 2015 Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
|
||||
page, run the installer, and follow the directions. You may need to choose a "Custom"
|
||||
installation and ensure that "Visual C++" is selected under "Programming Languages".
|
||||
|
||||
Any version of Visual Studio 2015 may be used to build rippled.
|
||||
The **Visual Studio 2015 Community** edition is available free of charge (see
|
||||
[the product page](https://www.visualstudio.com/products/visual-studio-community-vs)
|
||||
for licensing details), while paid editions may be used for an free initial trial period.
|
||||
|
||||
### Install Git for Windows
|
||||
|
||||
Git is a distributed revision control system. The Windows version also provides the
|
||||
bash shell and many Windows versions of Unix commands. While there are other
|
||||
varieties of Git (such as TortoiseGit, which has a native Windows interface and
|
||||
integrates with the Explorer shell), we recommend installing
|
||||
[Git for Windows](https://git-scm.com/) since
|
||||
it provides a Unix-like command line environment useful for running shell scripts.
|
||||
Use of the bash shell under Windows is mandatory for running the unit tests.
|
||||
|
||||
* NOTE: To gain full featured access to the
|
||||
[git-subtree](https://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/)
|
||||
functionality used in the rippled repository we suggest Git version 2.6.2 or later.
|
||||
|
||||
### Install Google Protocol Buffers Compiler
|
||||
|
||||
Building rippled requires **protoc.exe** version 2.5.1 or later. At your option you
|
||||
may build it yourself from the sources in the
|
||||
[Google Protocol Buffers](https://github.com/google/protobuf) repository,
|
||||
or you may download a
|
||||
[protoc.exe](https://ripple.github.io/Downloads/protoc/2.5.1/protoc.exe)
|
||||
([alternate link](https://github.com/ripple/Downloads/raw/gh-pages/protoc/2.5.1/protoc.exe))
|
||||
precompiled Windows executable from the
|
||||
[Ripple Organization](https://github.com/ripple).
|
||||
|
||||
Either way, once you have the required version of **protoc.exe**, copy it into
|
||||
a folder in your command line `%PATH%`.
|
||||
|
||||
* **NOTE:** If you use an older version of the compiler, the build will
|
||||
fail with errors related to a mismatch of the version of protocol
|
||||
buffer headers versus the compiler.
|
||||
|
||||
### (Optional) Install Python and Scons
|
||||
|
||||
[Python](https://www.python.org/downloads/) and
|
||||
[Scons](http://scons.org/download.php) are not required to build
|
||||
rippled with Visual Studio, but can be used to build from the
|
||||
command line and in scripts, and are required to properly update
|
||||
the `RippleD.vcxproj` file.
|
||||
|
||||
If you wish to build with scons, a version after 2.3.5 is required
|
||||
for Visual Studio 2015 support.
|
||||
|
||||
## Configure Dependencies
|
||||
|
||||
### Install OpenSSL
|
||||
|
||||
[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.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
|
||||
destination location.
|
||||
|
||||
You may be informed on running the installer that "Visual C++ 2008
|
||||
Redistributables" must first be installed first. If so, download it
|
||||
from the [same page](http://slproweb.com/products/Win32OpenSSL.html),
|
||||
again making sure to get the correct 32-/64-bit variant.
|
||||
|
||||
* NOTE: Since rippled links statically to OpenSSL, it does not matter
|
||||
where the OpenSSL .DLL files are placed, or what version they are.
|
||||
rippled does not use or require any external .DLL files to run
|
||||
other than the standard operating system ones.
|
||||
|
||||
### Build Boost
|
||||
|
||||
After [downloading boost](http://www.boost.org/users/download/) and
|
||||
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_62_0
|
||||
bootstrap
|
||||
```
|
||||
|
||||
The rippled application is linked statically to the standard runtimes and external
|
||||
dependencies on Windows, to ensure that the behavior of the executable is not
|
||||
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 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
|
||||
is completed, take note of both the reported compiler include paths and linker
|
||||
library paths as they will be required later.
|
||||
|
||||
* NOTE: If older versions of Visual Studio are also installed, the build may fail.
|
||||
If this happens, make sure that only Visual Studio 2015 is installed. Due to
|
||||
defects in the uninstallation procedures of these Microsoft products, it may
|
||||
be necessary to start with a fresh install of the operating system with only
|
||||
the necessary development environment components installed to have a successful build.
|
||||
|
||||
### Clone the rippled repository
|
||||
|
||||
If you are familiar with cloning github repositories, just follow your normal process
|
||||
and clone `git@github.com:ripple/rippled.git`. Otherwise follow this section for instructions.
|
||||
|
||||
1. If you don't have a github account, sign up for one at
|
||||
[github.com](https://github.com/).
|
||||
2. Make sure you have Github ssh keys. For help see
|
||||
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
|
||||
|
||||
Open the "Git Bash" shell that was installed with "Git for Windows" in the
|
||||
step above. Navigate to the directory where you want to clone rippled (git
|
||||
bash uses `/c` for windows's `C:` and forward slash where windows uses
|
||||
backslash, so `C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash).
|
||||
Now clone the repository and optionally switch to the *master* branch.
|
||||
Type the following at the bash prompt:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
git checkout master
|
||||
```
|
||||
|
||||
* If you receive an error about not having the "correct access rights"
|
||||
make sure you have Github ssh keys, as described above.
|
||||
|
||||
### Configure Library Paths
|
||||
|
||||
Open the solution file located at **Builds/Visual Studio 2015/ripple.sln**
|
||||
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
|
||||
64-bit build targets:
|
||||
|
||||

|
||||
|
||||
Go to *C/C++, General, Additional Include Directories* and add the
|
||||
location of the boost installation:
|
||||
|
||||

|
||||
|
||||
Then, go to *Linker, General, Additional Library Directories* and add
|
||||
the location of the compiled boost libraries reported at the completion
|
||||
of building the boost libraries:
|
||||
|
||||

|
||||
|
||||
Follow the same procedure for adding the `Additional Include Directories`
|
||||
and `Additional Library Directories` required for OpenSSL. In our example
|
||||
these directories are **C:\lib\OpenSSL-Win64\include** and
|
||||
**C:\lib\OpenSSL-Win64\lib** respectively.
|
||||
|
||||
# Setup Environment
|
||||
|
||||
## Create a working directory for rippled.cfg
|
||||
|
||||
The rippled server uses the [Rippled.cfg](https://wiki.ripple.com/Rippled.cfg)
|
||||
file to read its configuration parameters. This section describes setting up
|
||||
a directory to hold the config file. The next sections describe how to tell
|
||||
the rippled server where that file is.
|
||||
|
||||
1. Create a directory to hold the configuration file. In this example, the
|
||||
ripple config directory was created in `C:\Users\joe\ripple\config`.
|
||||
2. Copy the example config file located in `doc\rippled-example.cfg` to the
|
||||
new directory and rename it "rippled.cfg".
|
||||
3. Read the rippled.cfg file and edit as appropriate.
|
||||
|
||||
## Change the Visual Studio Projects Debugging Properties
|
||||
|
||||
1. If not already open, open the solution file located at **Builds/Visual Studio 2015/Ripple.sln**
|
||||
2. Select the correct solution platform in the solution platform dropdown (either *x64*
|
||||
or *Win32* depending on machine type).
|
||||
3. Select the "Project->Properties" menu item to bring up RippleD's Properties Pages
|
||||
4. In "Configuration Properties" select "Debugging".
|
||||
5. In the upper-left Configurations drop down, select "All Configurations".
|
||||
6. In "Debugger to Launch" select "Local Windows Debugger".
|
||||
|
||||
### Tell rippled where to find the configuration file.
|
||||
|
||||
The `--conf` command-line switch to tell rippled where to find this file.
|
||||
In the "Command Arguments" field in the properties dialog (that you opened
|
||||
in the above section), add: `--conf="C:/Users/joe/ripple/config/rippled.cfg"`
|
||||
(of course replacing that path with the path you set up above).
|
||||
|
||||

|
||||
|
||||
### Set the _NO_DEBUG_HEAP Environment Variable
|
||||
|
||||
Rippled can run very slowly in the debugger when using the Windows Debug Heap.
|
||||
Set the `_NO_DEBUG_HEAP` environment variable to one to disable the debug heap.
|
||||
In the "Environment" field (that you opened in the above section), add:
|
||||
`_NO_DEBUG_HEAP=1`
|
||||
|
||||

|
||||
|
||||
# Build
|
||||
|
||||
After these steps are complete, rippled should be ready to build. Simply
|
||||
set rippled as the startup project by right clicking on it in the
|
||||
Visual Studio Solution Explorer, choose **Set as Startup Project**,
|
||||
and then choose the **Build->Build Solution** menu item.
|
||||
|
||||
# Unit Tests (Recommended)
|
||||
|
||||
The rippled unit tests are written in C++ and are part
|
||||
of the rippled executable.
|
||||
|
||||
From a Windows console, run the unit tests:
|
||||
|
||||
```
|
||||
./build/msvc.debug/rippled.exe --unittest
|
||||
```
|
||||
|
||||
Substitute the correct path to the executable to test different builds.
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 19 KiB |
@@ -1,36 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
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
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
45
Builds/VisualStudio2017/CMakeSettings-example.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${thisFileDir}\\build\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v:minimal",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "BOOST_ROOT",
|
||||
"value": "C:\\lib\\boost"
|
||||
},
|
||||
{
|
||||
"name": "OPENSSL_ROOT",
|
||||
"value": "C:\\lib\\OpenSSL-Win64"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${thisFileDir}\\build\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v:minimal",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": [
|
||||
{
|
||||
"name": "BOOST_ROOT",
|
||||
"value": "C:\\lib\\boost"
|
||||
},
|
||||
{
|
||||
"name": "OPENSSL_ROOT",
|
||||
"value": "C:\\lib\\OpenSSL-Win64"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
263
Builds/VisualStudio2017/README.md
Normal file
@@ -0,0 +1,263 @@
|
||||
# Visual Studio 2017 Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
We do not recommend Windows for rippled production use at this time. Currently,
|
||||
the Ubuntu platform has received the highest level of quality assurance,
|
||||
testing, and support. Additionally, 32-bit Windows versions are not supported.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To clone the source code repository, create branches for inspection or
|
||||
modification, build rippled under Visual Studio, and run the unit tests you will
|
||||
need these software components
|
||||
|
||||
| Component | Minimum Recommended Version |
|
||||
|-----------|-----------------------|
|
||||
| [Visual Studio 2017](README.md#install-visual-studio-2017)| 15.5.4 |
|
||||
| [Git for Windows](README.md#install-git-for-windows)| 2.16.1|
|
||||
| [Google Protocol Buffers Compiler](README.md#install-google-protocol-buffers-compiler) | 2.5.1|
|
||||
| [OpenSSL Library](README.md#install-openssl) | 1.0.2n |
|
||||
| [Boost library](README.md#build-boost) | 1.66.0 |
|
||||
| [CMake for Windows](README.md#optional-install-cmake-for-windows)* | 3.10.2 |
|
||||
|
||||
\* Only needed if not using the integrated CMake in VS 2017 and prefer generating dedicated project/solution files.
|
||||
|
||||
## Install Software
|
||||
|
||||
### Install Visual Studio 2017
|
||||
|
||||
If not already installed on your system, download your choice of installer from
|
||||
the [Visual Studio 2017
|
||||
Download](https://www.visualstudio.com/downloads/download-visual-studio-vs)
|
||||
page, run the installer, and follow the directions. **You may need to choose the
|
||||
`Desktop development with C++` workload to install all necessary C++ features.**
|
||||
|
||||
Any version of Visual Studio 2017 may be used to build rippled. The **Visual
|
||||
Studio 2017 Community** edition is available free of charge (see [the product
|
||||
page](https://www.visualstudio.com/products/visual-studio-community-vs) for
|
||||
licensing details), while paid editions may be used for an initial free-trial
|
||||
period.
|
||||
|
||||
### Install Git for Windows
|
||||
|
||||
Git is a distributed revision control system. The Windows version also provides
|
||||
the bash shell and many Windows versions of Unix commands. While there are other
|
||||
varieties of Git (such as TortoiseGit, which has a native Windows interface and
|
||||
integrates with the Explorer shell), we recommend installing [Git for
|
||||
Windows](https://git-scm.com/) since it provides a Unix-like command line
|
||||
environment useful for running shell scripts. Use of the bash shell under
|
||||
Windows is mandatory for running the unit tests.
|
||||
|
||||
### Install Google Protocol Buffers Compiler
|
||||
|
||||
Building rippled requires **protoc.exe** version 2. Version 3 is not currently
|
||||
supported.. At your option you may build it yourself from the sources in the
|
||||
[Google Protocol Buffers](https://github.com/google/protobuf) repository, or you
|
||||
may download a
|
||||
[protoc.exe](https://ripple.github.io/Downloads/protoc/2.5.1/protoc.exe)
|
||||
([alternate
|
||||
link](https://github.com/ripple/Downloads/raw/gh-pages/protoc/2.5.1/protoc.exe))
|
||||
precompiled Windows executable from the [Ripple
|
||||
Organization](https://github.com/ripple).
|
||||
|
||||
Either way, once you have the required version of **protoc.exe**, copy it into a
|
||||
standard location that is in your command line `%PATH%`.
|
||||
|
||||
* **NOTE:** If you use an older version of the compiler, the build will fail
|
||||
with errors related to a mismatch of the version of protocol buffer headers
|
||||
versus the compiler. Likewise, if you use version 3 or newer, the build will
|
||||
fail.
|
||||
|
||||
### Install OpenSSL
|
||||
|
||||
[Download OpenSSL.](http://slproweb.com/products/Win32OpenSSL.html) There will
|
||||
four `Win64` bit variants available, you want the non-light `v1.0` line. As of
|
||||
this writing, you **should** select
|
||||
|
||||
* Win64 OpenSSL v1.0.2n.
|
||||
|
||||
and should **not** select
|
||||
|
||||
* Win64 OpenSSL v1.0.2n light
|
||||
* Win64 OpenSSL v1.1.0g
|
||||
* Win64 OpenSSL v1.1.0g light
|
||||
|
||||
Run the installer, and choose an appropriate location for your OpenSSL
|
||||
installation. In this guide we use `C:\lib\OpenSSL-Win64` as the destination
|
||||
location.
|
||||
|
||||
You may be informed on running the installer that "Visual C++ 2008
|
||||
Redistributables" must first be installed first. If so, download it from the
|
||||
[same page](http://slproweb.com/products/Win32OpenSSL.html), again making sure
|
||||
to get the correct 32-/64-bit variant.
|
||||
|
||||
* NOTE: Since rippled links statically to OpenSSL, it does not matter where the
|
||||
OpenSSL .DLL files are placed, or what version they are. rippled does not use
|
||||
or require any external .DLL files to run other than the standard operating
|
||||
system ones.
|
||||
|
||||
### Build Boost
|
||||
|
||||
After [downloading boost](http://www.boost.org/users/download/) and unpacking it
|
||||
to `c:\lib`. As of this writing, the most recent version of boost is 1.66.0,
|
||||
which will unpack into a directory named `boost_1_66_0`. We recommended either
|
||||
renaming this directory to `boost`, or creating a junction link `mklink /J boost
|
||||
boost_1_66_0`, so that you can more easily switch between versions.
|
||||
|
||||
Next, open **Developer Command Prompt** and type the following commands
|
||||
|
||||
```powershell
|
||||
cd C:\lib\boost
|
||||
bootstrap
|
||||
```
|
||||
|
||||
The rippled application is linked statically to the standard runtimes and
|
||||
external dependencies on Windows, to ensure that the behavior of the executable
|
||||
is not affected by changes in outside files. Therefore, it is necessary to build
|
||||
the required boost static libraries using this command:
|
||||
|
||||
```powershell
|
||||
bjam -j<Num Parallel> --toolset=msvc-14.1 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared,static stage
|
||||
```
|
||||
|
||||
where you should replace `<Num Parallel>` with the number of parallel
|
||||
invocations to use build, e.g. `bjam -j4 ...` would use up to 4 concurrent build
|
||||
shell commands for the build.
|
||||
|
||||
Building the boost libraries may take considerable time. When the build process
|
||||
is completed, take note of both the reported compiler include paths and linker
|
||||
library paths as they will be required later.
|
||||
|
||||
### (Optional) Install CMake for Windows
|
||||
|
||||
[CMake](http://cmake.org) is a cross platform build system generator. Visual
|
||||
Studio 2017 includes an integrated version of CMake that avoids having to
|
||||
manually run CMake, but it is undergoing continuous improvement. Users that
|
||||
prefer to use standard Visual Studio project and solution files need to install
|
||||
a dedicated version of Cmake to generate them. The latest version can be found
|
||||
at the [CMake download site](https://cmake.org/download/). It is recommended you
|
||||
select the install option to add CMake to your path.
|
||||
|
||||
As of this writing, the latest version of CMake for windows is 3.10.2.
|
||||
|
||||
## Clone the rippled repository
|
||||
|
||||
If you are familiar with cloning github repositories, just follow your normal
|
||||
process and clone `git@github.com:ripple/rippled.git`. Otherwise follow this
|
||||
section for instructions.
|
||||
|
||||
1. If you don't have a github account, sign up for one at
|
||||
[github.com](https://github.com/).
|
||||
2. Make sure you have Github ssh keys. For help see
|
||||
[generating-ssh-keys](https://help.github.com/articles/generating-ssh-keys).
|
||||
|
||||
Open the "Git Bash" shell that was installed with "Git for Windows" in the step
|
||||
above. Navigate to the directory where you want to clone rippled (git bash uses
|
||||
`/c` for windows's `C:` and forward slash where windows uses backslash, so
|
||||
`C:\Users\joe\projs` would be `/c/Users/joe/projs` in git bash). Now clone the
|
||||
repository and optionally switch to the *master* branch. Type the following at
|
||||
the bash prompt:
|
||||
|
||||
```powershell
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
If you receive an error about not having the "correct access rights" make sure
|
||||
you have Github ssh keys, as described above.
|
||||
|
||||
For a stable release, choose the `master` branch or one of the tagged releases
|
||||
listed on [rippled's GitHub page](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```
|
||||
git checkout master
|
||||
```
|
||||
|
||||
To test the latest release candidate, choose the `release` branch.
|
||||
|
||||
```
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of untested features,
|
||||
you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
# Build using Visual Studio integrated CMake
|
||||
|
||||
In Visual Studio 2017, Microsoft added [integrated IDE support for
|
||||
cmake](https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/).
|
||||
To begin, simply:
|
||||
|
||||
1. Launch Visual Studio and choose **File | Open | Folder**, navigating to the
|
||||
cloned rippled folder.
|
||||
2. Right-click on `CMakeLists.txt` in the **Solution Explorer - Folder View** to
|
||||
generate a `CMakeSettings.json` file. A sample settings file is provided
|
||||
[here](/Builds/VisualStudio2017/CMakeSettings-example.json). Customize the
|
||||
settings for `BOOST_ROOT`, `OPENSSL_ROOT` to match the install paths if they
|
||||
differ from those in the file.
|
||||
4. Select either the `x64-Release` or `x64-Debug` configuration from the
|
||||
**Project Setings** drop-down. This should invoke the built-in CMake project
|
||||
generator. If not, you can right-click on the `CMakeLists.txt` file and
|
||||
choose **Cache | Generate Cache**.
|
||||
5. Select either the `rippled.exe` (unity) or `rippled_classic.exe` (non-unity)
|
||||
option in the **Select Startup Item** drop-down. This will be the target
|
||||
built when you press F7. Alternatively, you can choose a target to build from
|
||||
the top-level **CMake | Build** menu. Note that at this time, there are other
|
||||
targets listed that come from third party visual studio files embedded in the
|
||||
rippled repo, e.g. `datagen.vcxproj`. Please ignore them.
|
||||
|
||||
For details on configuring debugging sessions or further customization of CMake,
|
||||
please refer to the [CMake tools for VS
|
||||
documentation](https://docs.microsoft.com/en-us/cpp/ide/cmake-tools-for-visual-cpp).
|
||||
|
||||
If using the provided `CMakeSettings.json` file, the executable will be in
|
||||
```
|
||||
.\build\x64-Release\Release\rippled(_classic).exe
|
||||
```
|
||||
or
|
||||
```
|
||||
.\build\x64-Debug\Debug\rippled(_classic).exe
|
||||
```
|
||||
where these paths are relative to your cloned git repository.
|
||||
|
||||
# Build using stand-alone CMake
|
||||
|
||||
This requires having installed [CMake for
|
||||
Windows](README.md#optional-install-cmake-for-windows). We do not recommend
|
||||
mixing this method with the integrated CMake method for the same repository
|
||||
clone. Assuming you included the cmake executable folder in your path,
|
||||
execute the following commands within your `rippled` cloned repository:
|
||||
|
||||
```
|
||||
mkdir build\cmake
|
||||
cd build\cmake
|
||||
cmake ..\.. -G"Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\lib\boost_1_66_0" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64"
|
||||
```
|
||||
Now launch Visual Studio 2017 and select **File | Open | Project/Solution**.
|
||||
Navigate to the `build\cmake` folder created above and select the `rippled.sln`
|
||||
file. You can then choose whether to build the `Debug` or `Release` solution
|
||||
configuration. Within the **Solution Explorer**, selected either the `rippled`
|
||||
(unity build) project or the `rippled_classic` (non-unity) project, and
|
||||
right-click to build.
|
||||
|
||||
The executable will be in
|
||||
```
|
||||
.\build\cmake\Release\rippled(_classic).exe
|
||||
```
|
||||
or
|
||||
````
|
||||
.\build\cmake\Debug\rippled(_classic).exe
|
||||
````
|
||||
where these paths are relative to your cloned git repository.
|
||||
|
||||
# Unit Test (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 with summary info after running
|
||||
the unit tests.
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
# 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 didn’t."
|
||||
|
||||
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.
|
||||
|
||||
|
||||
5
Builds/build_all.sh
Normal file → Executable file
@@ -2,5 +2,6 @@
|
||||
|
||||
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}
|
||||
path=$(cd $(dirname $0) && pwd)
|
||||
cd $(dirname $path)
|
||||
${path}/Test.py -a -c --testjobs=${num_procs} -- -j${num_procs}
|
||||
|
||||
147
Builds/linux/README.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Linux Build Instructions
|
||||
|
||||
This document focuses on building rippled for development purposes under recent
|
||||
Ubuntu linux distributions. To build rippled for Redhat, Fedora or Centos
|
||||
builds, including docker based builds for those distributions, please consult
|
||||
the [rippled-package-builder](https://github.com/ripple/rippled-package-builder)
|
||||
repository.
|
||||
|
||||
Development is regularly done on Ubuntu 16.04 or later. For non Ubuntu
|
||||
distributions, the steps below should work be installing the appropriate
|
||||
dependencies using that distribution's package management tools.
|
||||
|
||||
## Dependencies
|
||||
|
||||
Use `apt-get` to install the dependencies provided by the distribution
|
||||
|
||||
```
|
||||
$ apt-get update
|
||||
$ apt-get install -y gcc g++ wget git cmake protobuf-compiler libprotobuf-dev libssl-dev
|
||||
```
|
||||
|
||||
Advanced users can choose to install newer versions of gcc, or the clang compiler.
|
||||
At this time, rippled only supports protobuf version 2. Using version 3 of
|
||||
protobuf will give errors.
|
||||
|
||||
### Build Boost
|
||||
|
||||
We recommend downloading and compiling a more recent version of boost than
|
||||
provided by the `boost-all-dev` package. After changing to the directory where
|
||||
you wish to download and compile boost, run
|
||||
|
||||
```
|
||||
$ wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
|
||||
$ tar -xzf boost_1_65_1.tar.gz
|
||||
$ cd boost_1_65_1
|
||||
$ ./bootstrap.sh
|
||||
$ ./b2 headers
|
||||
$ ./b2 -j<Num Parallel>
|
||||
```
|
||||
|
||||
### (Optional) Dependencies for Building Source Documentation
|
||||
|
||||
Source code documentation is not required for running/debugging rippled. That
|
||||
said, the documentation contains some helpful information about specific
|
||||
components of the application. For more information on how to install and run
|
||||
the necessary components, see [this document](../../docs/README.md)
|
||||
|
||||
## Build
|
||||
|
||||
### Clone the rippled repository
|
||||
|
||||
From a shell:
|
||||
|
||||
```
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
|
||||
For a stable release, choose the `master` branch or one of the tagged releases
|
||||
listed on [GitHub](https://github.com/ripple/rippled/releases).
|
||||
|
||||
```
|
||||
git checkout master
|
||||
```
|
||||
|
||||
or to test the latest release candidate, choose the `release` branch.
|
||||
|
||||
```
|
||||
git checkout release
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of untested
|
||||
features, you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
### Configure Library Paths
|
||||
|
||||
If you didn't persistently set the `BOOST_ROOT` environment variable to the
|
||||
directory in which you compiled boost, then you should set it temporarily.
|
||||
|
||||
For example, you built Boost in your home directory `~/boost_1_65_1`, you
|
||||
would do for any shell in which you want to build:
|
||||
|
||||
```
|
||||
export BOOST_ROOT=~/boost_1_65_1
|
||||
```
|
||||
|
||||
Alternatively, you can add `DBOOST_ROOT=~/boost_1_65_1` to the command line when
|
||||
invoking `cmake`.
|
||||
|
||||
### Generate and Build
|
||||
|
||||
All builds should be done in a separate directory from the source tree root
|
||||
(a subdirectory is fine). For example, from the root of the ripple source tree:
|
||||
|
||||
```
|
||||
mkdir my_build
|
||||
cd my_build
|
||||
```
|
||||
|
||||
followed by:
|
||||
|
||||
```
|
||||
cmake -Dtarget=gcc.debug.unity ..
|
||||
```
|
||||
|
||||
The target variable can be adjusted as needed for `gcc` vs `clang`, `debug` vs.
|
||||
`release` and `unity` vs. `nounity` builds. `unity` builds are typically faster
|
||||
to compile but run the risk of ODR violations given that multiple compilation
|
||||
units are merged together at compile time. `nounity` builds will take longer to
|
||||
compile but align more closely with language standards.
|
||||
|
||||
Once you have generated the build system, you can run the build via cmake:
|
||||
|
||||
```
|
||||
cmake --build . -- -j <parallel jobs>
|
||||
```
|
||||
|
||||
the `-j` parameter in this example tells the build tool to compile several
|
||||
files in parallel. This value should be chosen roughly based on the number of
|
||||
cores you have available and/or want to use for building.
|
||||
|
||||
When the build completes succesfully, you will have a `rippled` executable in
|
||||
the current directory, which can be used to connect to the network (when
|
||||
properly configured) or to run unit tests.
|
||||
|
||||
#### Options During Configuration:
|
||||
|
||||
There are a number of config variables that our CMake files support. These
|
||||
can be added to the cmake generation command as needed:
|
||||
|
||||
* `-Dassert=ON` to enable asserts
|
||||
* `-Djemalloc=ON` to enable jemalloc support for heap checking
|
||||
* `-Dsan=thread` to enable the thread sanitizer with clang
|
||||
* `-Dsan=address` to enable the address sanitizer with clang
|
||||
* `-Dstatic=ON` to enable static linking library dependencies
|
||||
|
||||
## 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 with summary info after running the unit tests.
|
||||
|
||||
|
||||
206
Builds/macos/README.md
Normal file
@@ -0,0 +1,206 @@
|
||||
# macos Build Instructions
|
||||
|
||||
## Important
|
||||
|
||||
We don't recommend macos for rippled production use at this time. Currently, the
|
||||
Ubuntu platform has received the highest level of quality assurance and
|
||||
testing. That said, macos is suitable for many development/test tasks.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You'll need macos 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/)
|
||||
* [Boost](http://boost.org/)
|
||||
* other misc utilities and libraries installed via homebrew
|
||||
|
||||
## 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 didn’t."
|
||||
|
||||
Open a terminal and type:
|
||||
|
||||
```
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
```
|
||||
|
||||
For more info, see "Step 2: Install Homebrew"
|
||||
[here](http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac#step-2)
|
||||
|
||||
### Install Dependencies Using Homebrew
|
||||
|
||||
`brew` will generally install the latest stable version of any package, which
|
||||
should satisfy the the minimum version requirements for rippled.
|
||||
|
||||
```
|
||||
brew update
|
||||
brew install git cmake pkg-config protobuf openssl ninja
|
||||
```
|
||||
|
||||
### Build Boost
|
||||
|
||||
We want to compile boost with clang/libc++
|
||||
|
||||
Download [a release](https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2)
|
||||
|
||||
Extract it to a folder, making note of where, open a terminal, then:
|
||||
|
||||
```
|
||||
./bootstrap.sh
|
||||
./b2 cxxflags="-std=c++14"
|
||||
```
|
||||
|
||||
Create an environment variable `BOOST_ROOT` in one of your `rc` files, pointing
|
||||
to the root of the extracted directory.
|
||||
|
||||
### Dependencies for Building Source Documentation
|
||||
|
||||
Source code documentation is not required for running/debugging rippled. That
|
||||
said, the documentation contains some helpful information about specific
|
||||
components of the application. For more information on how to install and run
|
||||
the necessary components, see [this document](../../docs/README.md)
|
||||
|
||||
## Build
|
||||
|
||||
### Clone the rippled repository
|
||||
|
||||
From a shell:
|
||||
|
||||
```
|
||||
git clone git@github.com:ripple/rippled.git
|
||||
cd rippled
|
||||
```
|
||||
|
||||
For a stable release, 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
|
||||
```
|
||||
|
||||
If you are doing development work and want the latest set of untested
|
||||
features, you can consider using the `develop` branch instead.
|
||||
|
||||
```
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
### 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.66.0 in `/Users/Abigail/Downloads/boost_1_66_0`, you would do for any
|
||||
shell in which you want to build:
|
||||
|
||||
```
|
||||
export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_66_0
|
||||
```
|
||||
|
||||
### Generate and Build
|
||||
|
||||
For simple command line building we recommend using the *Unix Makefile* or
|
||||
*Ninja* generator with cmake. All builds should be done in a separate directory
|
||||
from the source tree root (a subdirectory is fine). For example, from the root
|
||||
of the ripple source tree:
|
||||
|
||||
```
|
||||
mkdir my_build
|
||||
cd my_build
|
||||
```
|
||||
|
||||
followed by:
|
||||
|
||||
```
|
||||
cmake -G "Unix Makefiles" -Dtarget=clang.debug.unity ..
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
cmake -G "Ninja" -Dtarget=clang.debug.unity ..
|
||||
```
|
||||
|
||||
The target variable can be adjusted as needed for `debug` vs. `release` and
|
||||
`unity` vs. `nounity` builds. `unity` builds are typically faster to compile
|
||||
but run the risk of ODR violations given that multiple compilation units are
|
||||
merged together at compile time. `nounity` builds will take longer to compile
|
||||
but align more closely with language standards.
|
||||
|
||||
Once you have generated the build system, you can run the build via cmake:
|
||||
|
||||
```
|
||||
cmake --build . -- -j 4
|
||||
```
|
||||
|
||||
the `-j` parameter in this example tells the build tool to compile several
|
||||
files in parallel. This value should be chosen roughly based on the number of
|
||||
cores you have available and/or want to use for building.
|
||||
|
||||
When the build completes succesfully, you will have a `rippled` executable in
|
||||
the current directory, which can be used to connect to the network (when
|
||||
properly configured) or to run unit tests.
|
||||
|
||||
If you prefer to have an XCode project to use for building, ask CMake to
|
||||
generate that instead:
|
||||
|
||||
```
|
||||
cmake -GXcode ..
|
||||
```
|
||||
|
||||
After generation succeeds, the xcode project file can be opened and used to
|
||||
build/debug. However, just as with other generators, cmake knows how to build
|
||||
using the xcode project as well:
|
||||
|
||||
```
|
||||
cmake --build . -- -jobs 4
|
||||
```
|
||||
|
||||
This will invoke the `xcodebuild` utility to compile the project. See `xcodebuild
|
||||
--help` for details about build options.
|
||||
|
||||
#### Options During Configuration:
|
||||
|
||||
There are a number of config variables that our CMake files support. These
|
||||
can be added to the cmake generation command as needed:
|
||||
|
||||
* `-Dassert=ON` to enable asserts
|
||||
* `-Djemalloc=ON` to enable jemalloc support for heap checking
|
||||
* `-Dsan=thread` to enable the thread sanitizer with clang
|
||||
* `-Dsan=address` to enable the address sanitizer with clang
|
||||
|
||||
## 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 with summary info after running the unit tests.
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
--- /usr/include/boost/config/compiler/clang.hpp 2013-07-20 13:17:10.000000000 -0400
|
||||
+++ /usr/include/boost/config/compiler/clang.rippled.hpp 2014-03-11 16:40:51.000000000 -0400
|
||||
@@ -39,6 +39,10 @@
|
||||
// Clang supports "long long" in all compilation modes.
|
||||
#define BOOST_HAS_LONG_LONG
|
||||
|
||||
+#if defined(__SIZEOF_INT128__)
|
||||
+# define BOOST_HAS_INT128
|
||||
+#endif
|
||||
+
|
||||
//
|
||||
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
|
||||
//
|
||||
@@ -1,10 +0,0 @@
|
||||
--- /usr/include/boost/bimap/detail/debug/static_error.hpp 2008-03-22 17:45:55.000000000 -0400
|
||||
+++ /usr/include/boost/bimap/detail/debug/static_error.rippled.hpp 2014-03-12 19:40:05.000000000 -0400
|
||||
@@ -25,7 +25,6 @@
|
||||
// a static error.
|
||||
/*===========================================================================*/
|
||||
#define BOOST_BIMAP_STATIC_ERROR(MESSAGE,VARIABLES) \
|
||||
- struct BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE) {}; \
|
||||
BOOST_MPL_ASSERT_MSG(false, \
|
||||
BOOST_PP_CAT(BIMAP_STATIC_ERROR__,MESSAGE), \
|
||||
VARIABLES)
|
||||
214
CMakeLists.txt
@@ -1,57 +1,58 @@
|
||||
# !!! The official build system is SConstruct !!!
|
||||
# This is an experimental cmake build file for rippled
|
||||
# cmake support for building rippled. The rippled specific settings
|
||||
# below can be set at the command line as `-D<setting>=<value>`.
|
||||
#
|
||||
# cmake support in rippled. Currently supports:
|
||||
# * `target` is a period separated tuple from the sets
|
||||
# {gcc,clang,msvc} x {debug, release} x {unity, nounity} x {coverage} x {profile}
|
||||
#
|
||||
# * 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)
|
||||
# Example, build gcc debug nonunity build
|
||||
# -Dtarget=gcc.debug.nounity
|
||||
# Example, clang release unity build
|
||||
# -Dtarget=clang.release.unity
|
||||
# Example, visual studio debug unity build
|
||||
# -Dtarget=msvc.release.unity
|
||||
# Example, build gcc release unity build suited for profiling with perf
|
||||
# -Dtarget=gcc.release.unity.profile
|
||||
# Example, build gcc debug unity build suited for measuring code coverage
|
||||
# with gcov
|
||||
# -Dtarget=gcc.release.unity.coverage
|
||||
#
|
||||
# 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.
|
||||
# The default is a unity debug build using gcc (linux), clang (osx), and
|
||||
# msvc (windows).
|
||||
#
|
||||
# * It is not possible to generate a visual studio project on linux or
|
||||
# mac. The visual studio generator is only available on windows.
|
||||
# Note the generated Visual Studio solution will always have two projects,
|
||||
# one unity and one non-unity. If the `target` is unity, the default project
|
||||
# will be named `rippled` and second non-default (non-unity) project
|
||||
# will be called `rippled_classic`. Likewise, if the `target` is non-unity,
|
||||
# the project will have a default project called `rippled` (now non-unity)
|
||||
# and second non-default (unity) project `rippled_unity`. In either
|
||||
# case, only the `rippled` build will be enabled by default.
|
||||
#
|
||||
# * 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.
|
||||
# * `assert` whether to enable asserts in release build
|
||||
#
|
||||
# * 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)
|
||||
# Example, enable asserts even in release builds
|
||||
# -Dassert=True
|
||||
#
|
||||
# * 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.
|
||||
# Default is not to enable asserts in release builds.
|
||||
#
|
||||
# * `san` enable clang sanitizers
|
||||
#
|
||||
# Example, enable thread sanitizer
|
||||
# -Dsan=thread
|
||||
# Example, enable address sanitizer
|
||||
# -Dsan=address
|
||||
#
|
||||
# * `static`, on linux, link protobuf, openssl, libc++, and boost
|
||||
# statically.
|
||||
#
|
||||
# Example, enable static linking
|
||||
# -Dstatic=True
|
||||
#
|
||||
# * `jemalloc`, on linux, enables jemalloc for heap profiling.
|
||||
#
|
||||
# Example, enable jemalloc
|
||||
# -Djemallc=True
|
||||
#
|
||||
# * 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_C_COMPILER and CMAKE_CXX_COMPILER must be defined
|
||||
# before the project statement; However, the project
|
||||
@@ -144,6 +145,7 @@ use_boost(
|
||||
filesystem
|
||||
program_options
|
||||
regex
|
||||
serialization
|
||||
system
|
||||
thread)
|
||||
|
||||
@@ -175,14 +177,18 @@ prepend(beast_unity_srcs
|
||||
src/ripple/beast/unity/
|
||||
beast_insight_unity.cpp
|
||||
beast_net_unity.cpp
|
||||
beast_hash_unity.cpp
|
||||
beast_utility_unity.cpp)
|
||||
|
||||
prepend(ripple_unity_srcs
|
||||
src/ripple/unity/
|
||||
app_consensus.cpp
|
||||
app_ledger.cpp
|
||||
app_main.cpp
|
||||
app_ledger_impl.cpp
|
||||
app_main1.cpp
|
||||
app_main2.cpp
|
||||
app_misc.cpp
|
||||
app_misc_impl.cpp
|
||||
app_paths.cpp
|
||||
app_tx.cpp
|
||||
conditions.cpp
|
||||
@@ -192,19 +198,24 @@ basics.cpp
|
||||
crypto.cpp
|
||||
ledger.cpp
|
||||
net.cpp
|
||||
overlay.cpp
|
||||
overlay1.cpp
|
||||
overlay2.cpp
|
||||
peerfinder.cpp
|
||||
json.cpp
|
||||
protocol.cpp
|
||||
rpcx.cpp
|
||||
resource.cpp
|
||||
rpcx1.cpp
|
||||
rpcx2.cpp
|
||||
shamap.cpp
|
||||
server.cpp)
|
||||
|
||||
prepend(test_unity_srcs
|
||||
src/test/unity/
|
||||
app_test_unity.cpp
|
||||
app_test_unity1.cpp
|
||||
app_test_unity2.cpp
|
||||
basics_test_unity.cpp
|
||||
beast_test_unity.cpp
|
||||
beast_test_unity1.cpp
|
||||
beast_test_unity2.cpp
|
||||
conditions_test_unity.cpp
|
||||
consensus_test_unity.cpp
|
||||
core_test_unity.cpp
|
||||
@@ -216,8 +227,10 @@ protocol_test_unity.cpp
|
||||
resource_test_unity.cpp
|
||||
rpc_test_unity.cpp
|
||||
server_test_unity.cpp
|
||||
server_status_test_unity.cpp
|
||||
shamap_test_unity.cpp
|
||||
jtx_unity.cpp
|
||||
jtx_unity1.cpp
|
||||
jtx_unity2.cpp
|
||||
csf_unity.cpp)
|
||||
|
||||
list(APPEND rippled_src_unity ${beast_unity_srcs} ${ripple_unity_srcs} ${test_unity_srcs})
|
||||
@@ -254,6 +267,7 @@ set(non_unity_srcs ${core_srcs})
|
||||
foreach(curdir
|
||||
beast/clock
|
||||
beast/container
|
||||
beast/hash
|
||||
beast/insight
|
||||
beast/net
|
||||
beast/utility
|
||||
@@ -269,6 +283,7 @@ foreach(curdir
|
||||
overlay
|
||||
peerfinder
|
||||
protocol
|
||||
resource
|
||||
rpc
|
||||
server
|
||||
shamap)
|
||||
@@ -294,8 +309,11 @@ foreach(curdir
|
||||
basics
|
||||
beast
|
||||
conditions
|
||||
consensus
|
||||
core
|
||||
csf
|
||||
json
|
||||
jtx
|
||||
ledger
|
||||
nodestore
|
||||
overlay
|
||||
@@ -305,8 +323,7 @@ foreach(curdir
|
||||
rpc
|
||||
server
|
||||
shamap
|
||||
jtx
|
||||
csf)
|
||||
unit_test)
|
||||
file(GLOB_RECURSE cursrcs src/test/${curdir}/*.cpp)
|
||||
list(APPEND test_srcs "${cursrcs}")
|
||||
endforeach()
|
||||
@@ -321,16 +338,14 @@ 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)
|
||||
file(GLOB_RECURSE rippled_headers src/*.h src/*.hpp *.md)
|
||||
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)
|
||||
@@ -351,15 +366,10 @@ if (WIN32 OR is_xcode)
|
||||
# Documentation sources. Only needed for IDEs.
|
||||
prepend(doc_srcs
|
||||
docs/
|
||||
Jamfile.v2
|
||||
boostbook.dtd
|
||||
consensus.qbk
|
||||
index.xml
|
||||
main.qbk
|
||||
quickref.xml
|
||||
reference.xsl
|
||||
source.dox)
|
||||
|
||||
file(GLOB_RECURSE other_docs docs/*.md)
|
||||
list(APPEND doc_srcs "${other_docs}")
|
||||
set_property(
|
||||
SOURCE ${doc_srcs}
|
||||
APPEND
|
||||
@@ -386,12 +396,10 @@ add_with_props(rippled_src_all src/ripple/unity/secp256k1.cpp
|
||||
)
|
||||
|
||||
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)
|
||||
src/ripple/unity/ripple.proto.cpp)
|
||||
|
||||
add_with_props(rippled_src_all ${cursrc}
|
||||
${rocks_db_system_header}
|
||||
@@ -412,9 +420,9 @@ 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)
|
||||
set(no_gcc_warnings -w)
|
||||
else()
|
||||
unset(no_init_w)
|
||||
unset(no_gcc_warnings)
|
||||
endif()
|
||||
|
||||
add_with_props(rippled_src_all src/ripple/unity/rocksdb.cpp
|
||||
@@ -422,7 +430,7 @@ add_with_props(rippled_src_all src/ripple/unity/rocksdb.cpp
|
||||
-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})
|
||||
${no_gcc_warnings} ${rocks_db_system_header})
|
||||
|
||||
if (NOT is_msvc)
|
||||
set(no_unused_w -Wno-unused-function)
|
||||
@@ -433,10 +441,6 @@ add_with_props(rippled_src_all src/ripple/unity/snappy.cpp
|
||||
-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}")
|
||||
|
||||
@@ -463,52 +467,28 @@ list(APPEND targets ${other_target})
|
||||
# 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)
|
||||
find_package(Doxygen)
|
||||
if(TARGET Doxygen::doxygen)
|
||||
# read the source config and make a modified one
|
||||
# that points the output files to our build directory
|
||||
FILE(READ "${CMAKE_SOURCE_DIR}/docs/source.dox" dox_content)
|
||||
string(REGEX REPLACE "[\t ]*OUTPUT_DIRECTORY[\t ]*=(.*)"
|
||||
"OUTPUT_DIRECTORY=${CMAKE_BINARY_DIR}\n\\1"
|
||||
new_config "${dox_content}")
|
||||
FILE(WRITE "${CMAKE_BINARY_DIR}/source.dox" "${new_config}")
|
||||
add_custom_target(docs
|
||||
COMMAND "${DOXYGEN_EXECUTABLE}" "${CMAKE_BINARY_DIR}/source.dox"
|
||||
BYPRODUCTS "${CMAKE_BINARY_DIR}/html_doc/index.html"
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs"
|
||||
SOURCES "${doc_srcs}"
|
||||
)
|
||||
else()
|
||||
message(WARNING
|
||||
"doxygen executable not found. docs target will not be buildable")
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.9.0")
|
||||
message("...consider updating to CMake 3.9.0 or greater for better doxygen support")
|
||||
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)
|
||||
|
||||
|
||||
539
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,539 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
import groovy.json.JsonOutput
|
||||
import java.text.*
|
||||
|
||||
def all_status = [:]
|
||||
def commit_id = ''
|
||||
// this is not the actual token, but an ID/key into the jenkins
|
||||
// credential store which httpRequest can access.
|
||||
def github_cred = '6bd3f3b9-9a35-493e-8aef-975403c82d3e'
|
||||
//
|
||||
// root API url for our repo (default, overriden below)
|
||||
//
|
||||
String github_repo = 'https://api.github.com/repos/ripple/rippled'
|
||||
|
||||
try {
|
||||
stage ('Startup Checks') {
|
||||
// here we check the commit author against collaborators
|
||||
// we need a node to do this because readJSON requires
|
||||
// a filesystem (although we just pass it text)
|
||||
node {
|
||||
checkout scm
|
||||
commit_id = sh(
|
||||
script: 'git rev-parse HEAD',
|
||||
returnStdout: true)
|
||||
commit_id = commit_id.trim()
|
||||
echo "commit ID is ${commit_id}"
|
||||
commit_log = sh (
|
||||
script: "git show --name-status ${commit_id}",
|
||||
returnStdout: true)
|
||||
printGitInfo (commit_id, commit_log)
|
||||
//
|
||||
// NOTE this getUserRemoteConfigs call requires a one-time
|
||||
// In-process Script Approval (configure jenkins). We need this
|
||||
// to detect the remote repo to interact with via the github API.
|
||||
//
|
||||
def remote_url = scm.getUserRemoteConfigs()[0].getUrl()
|
||||
if (remote_url) {
|
||||
echo "GIT URL scm: $remote_url"
|
||||
def fork = remote_url.tokenize('/')[2]
|
||||
def repo = remote_url.tokenize('/')[3].split('\\.')[0]
|
||||
echo "GIT FORK: $fork"
|
||||
echo "GIT REPO: $repo"
|
||||
github_repo = "https://api.github.com/repos/${fork}/${repo}"
|
||||
echo "API URL REPO: $github_repo"
|
||||
}
|
||||
|
||||
if (env.CHANGE_AUTHOR) {
|
||||
//
|
||||
// this means we have some sort of PR , so verify the author
|
||||
//
|
||||
echo "CHANGE AUTHOR ---> $CHANGE_AUTHOR"
|
||||
echo "CHANGE TARGET ---> $CHANGE_TARGET"
|
||||
echo "CHANGE ID ---> $CHANGE_ID"
|
||||
//
|
||||
// check the commit author against collaborators
|
||||
// we need a node to do this because readJSON requires
|
||||
// a filesystem (although we just pass it text)
|
||||
//
|
||||
def response = httpRequest(
|
||||
timeout: 10,
|
||||
authentication: github_cred,
|
||||
url: "${github_repo}/collaborators")
|
||||
def collab_data = readJSON(
|
||||
text: response.content)
|
||||
collab_found = false;
|
||||
for (collaborator in collab_data) {
|
||||
if (collaborator['login'] == "$CHANGE_AUTHOR") {
|
||||
echo "$CHANGE_AUTHOR is a collaborator!"
|
||||
collab_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! collab_found) {
|
||||
manager.addShortText(
|
||||
'Author of this change is not a collaborator!',
|
||||
'Crimson',
|
||||
'white',
|
||||
'0px',
|
||||
'white')
|
||||
all_status['startup'] =
|
||||
[false, 'Author Check', "$CHANGE_AUTHOR is not a collaborator!"]
|
||||
error "$CHANGE_AUTHOR does not appear to be a collaborator...bailing on this build"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ('Parallel Build') {
|
||||
String[][] variants = [
|
||||
['coverage'],
|
||||
['docs'],
|
||||
['msvc.debug'],
|
||||
// This one does not currently build (TBD):
|
||||
//['msvc.debug.nounity'],
|
||||
['msvc.debug', '', 'PROJECT_NAME=rippled_classic'],
|
||||
['msvc.release'],
|
||||
['clang.debug.unity'],
|
||||
['clang.debug.unity', '', 'PARALLEL_TESTS=false'],
|
||||
['clang.debug.nounity'],
|
||||
['gcc.debug.unity'],
|
||||
['gcc.debug.nounity'],
|
||||
['clang.release.unity'],
|
||||
['gcc.release.unity'],
|
||||
// add a static build just to make sure it works
|
||||
['gcc.debug.unity', '-Dstatic=true'],
|
||||
// TODO - sanitizer runs currently fail
|
||||
//['gcc.debug.nounity' , '-Dsan=address', 'PARALLEL_TESTS=false'],
|
||||
//['gcc.debug.nounity' , '-Dsan=thread', 'PARALLEL_TESTS=false'],
|
||||
]
|
||||
|
||||
// create a map of all builds
|
||||
// that we want to run. The map
|
||||
// is string keys and node{} object values
|
||||
def builds = [:]
|
||||
for (int index = 0; index < variants.size(); index++) {
|
||||
def bldtype = variants[index][0]
|
||||
def cmake_extra = variants[index].size() > 1 ? variants[index][1] : ''
|
||||
def bldlabel = bldtype + cmake_extra
|
||||
def extra_env = variants[index].size() > 2 ? variants[index][2..-1] : []
|
||||
for (int j = 0; j < extra_env.size(); j++) {
|
||||
bldlabel += "_" + extra_env[j]
|
||||
}
|
||||
bldlabel = bldlabel.replace('-', '_')
|
||||
bldlabel = bldlabel.replace(' ', '')
|
||||
bldlabel = bldlabel.replace('=', '_')
|
||||
|
||||
def compiler = getFirstPart(bldtype)
|
||||
def target = getSecondPart(bldtype)
|
||||
def config = getFirstPart(target)
|
||||
if (compiler == 'coverage' || compiler == 'docs') {
|
||||
compiler = 'gcc'
|
||||
}
|
||||
def cc =
|
||||
(compiler == 'clang') ? '/opt/llvm-5.0.1/bin/clang' : 'gcc'
|
||||
def cxx =
|
||||
(compiler == 'clang') ? '/opt/llvm-5.0.1/bin/clang++' : 'g++'
|
||||
def ucc = isNoUnity(target) ? 'true' : 'false'
|
||||
def node_type =
|
||||
(compiler == 'msvc') ? 'rippled-win' : 'rippled-dev'
|
||||
// the default disposition for parallel test..disabled
|
||||
// for coverage, enabled otherwise. Can still be overridden
|
||||
// by explicitly setting with extra env settings above.
|
||||
def pt = (compiler == 'coverage') ? 'false' : 'true'
|
||||
|
||||
def env_vars = [
|
||||
"TARGET=${target}",
|
||||
"CONFIG_TYPE=${config}",
|
||||
"COMPILER=${compiler}",
|
||||
"PARALLEL_TESTS=${pt}",
|
||||
'BUILD=cmake',
|
||||
"BUILD_DIR=${bldlabel}",
|
||||
"CMAKE_EXTRA_ARGS=${cmake_extra}",
|
||||
'VERBOSE_BUILD=true']
|
||||
|
||||
builds[bldlabel] = {
|
||||
node(node_type) {
|
||||
checkout scm
|
||||
dir ('build') {
|
||||
deleteDir()
|
||||
}
|
||||
def cdir = upDir(pwd())
|
||||
echo "BASEDIR: ${cdir}"
|
||||
echo "COMPILER: ${compiler}"
|
||||
echo "TARGET: ${target}"
|
||||
echo "CONFIG: ${config}"
|
||||
echo "USE_CC: ${ucc}"
|
||||
if (compiler == 'msvc') {
|
||||
env_vars.addAll([
|
||||
'BOOST_ROOT=c:\\lib\\boost_1_66',
|
||||
'PROJECT_NAME=rippled',
|
||||
'MSBUILDDISABLENODEREUSE=1', // this ENV setting is probably redundant since we also pass /nr:false to msbuild
|
||||
'OPENSSL_ROOT=c:\\OpenSSL-Win64'])
|
||||
}
|
||||
else {
|
||||
env_vars.addAll([
|
||||
'NINJA_BUILD=false',
|
||||
"CCACHE_BASEDIR=${cdir}",
|
||||
'PLANTUML_JAR=/opt/plantuml/plantuml.jar',
|
||||
'CCACHE_NOHASHDIR=true',
|
||||
"CC=${cc}",
|
||||
"CXX=${cxx}",
|
||||
'LCOV_ROOT=""',
|
||||
'PATH+CMAKE_BIN=/opt/local/cmake',
|
||||
'GDB_ROOT=/opt/local/gdb',
|
||||
'BOOST_ROOT=/opt/local/boost_1_66_0',
|
||||
"USE_CCACHE=${ucc}"])
|
||||
}
|
||||
|
||||
if (extra_env.size() > 0) {
|
||||
env_vars.addAll(extra_env)
|
||||
}
|
||||
|
||||
withCredentials(
|
||||
[string(
|
||||
credentialsId: 'RIPPLED_CODECOV_TOKEN',
|
||||
variable: 'CODECOV_TOKEN')])
|
||||
{
|
||||
withEnv(env_vars) {
|
||||
myStage(bldlabel)
|
||||
try {
|
||||
if (compiler == 'msvc') {
|
||||
powershell "Remove-Item -Path \"${bldlabel}.txt\" -Force -ErrorAction Ignore"
|
||||
// we capture stdout to variable because I could
|
||||
// not figure out how to make powershell redirect internally
|
||||
output = powershell (
|
||||
returnStdout: true,
|
||||
script: '''
|
||||
# Enable streams 3-6
|
||||
$WarningPreference = 'Continue'
|
||||
$VerbosePreference = 'Continue'
|
||||
$DebugPreference = 'Continue'
|
||||
$InformationPreference = 'Continue'
|
||||
|
||||
Invoke-BatchFile "${env:ProgramFiles(x86)}\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x86_amd64
|
||||
Get-ChildItem env:* | Sort-Object name
|
||||
cl
|
||||
cmake --version
|
||||
New-Item -ItemType Directory -Force -Path "build/$env:BUILD_DIR" -ErrorAction Stop
|
||||
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||
try {
|
||||
Push-Location "build/$env:BUILD_DIR"
|
||||
if ($env:NINJA_BUILD -eq "true") {
|
||||
cmake -G"Ninja" -Dtarget="$env:COMPILER.$env:TARGET" -DCMAKE_VERBOSE_MAKEFILE=ON ../..
|
||||
}
|
||||
else {
|
||||
cmake -G"Visual Studio 15 2017 Win64" -Dtarget="$env:COMPILER.$env:TARGET" -DCMAKE_VERBOSE_MAKEFILE=ON ../..
|
||||
}
|
||||
if ($LastExitCode -ne 0) { throw "CMake failed" }
|
||||
|
||||
## as of 01/2018, DO NOT USE cmake to run the actual build step. for some
|
||||
## reason, cmake spawning the build under jenkins causes MSBUILD/ninja to
|
||||
## get stuck at the end of the build. Perhaps cmake is spawning
|
||||
## incorrectly or failing to pass certain params
|
||||
|
||||
if ($env:NINJA_BUILD -eq "true") {
|
||||
ninja -j $env:NUMBER_OF_PROCESSORS -v
|
||||
}
|
||||
else {
|
||||
msbuild /fl /m /nr:false /p:Configuration="$env:CONFIG_TYPE" /p:Platform=x64 /p:GenerateFullPaths=True /v:normal /nologo /clp:"ShowCommandLine;DisableConsoleColor" "$env:PROJECT_NAME.vcxproj"
|
||||
}
|
||||
if ($LastExitCode -ne 0) { throw "CMake build failed" }
|
||||
|
||||
$exe = "./$env:CONFIG_TYPE/$env:PROJECT_NAME"
|
||||
if ($env:NINJA_BUILD -eq "true") {
|
||||
$exe = "./$env:PROJECT_NAME"
|
||||
}
|
||||
"Exe is at $exe"
|
||||
$params = '--unittest', '--quiet', '--unittest-log'
|
||||
if ($env:PARALLEL_TESTS -eq "true") {
|
||||
$params = $params += "--unittest-jobs=$env:NUMBER_OF_PROCESSORS"
|
||||
}
|
||||
& $exe $params
|
||||
if ($LastExitCode -ne 0) { throw "Unit tests failed" }
|
||||
}
|
||||
catch {
|
||||
throw
|
||||
}
|
||||
finally {
|
||||
$sw.Stop()
|
||||
$sw.Elapsed
|
||||
Pop-Location
|
||||
}
|
||||
''')
|
||||
// if the powershell command fails (has nonzero exit)
|
||||
// then the command above throws, we don't get our output,
|
||||
// and we never create this output file.
|
||||
// SEE https://issues.jenkins-ci.org/browse/JENKINS-44930
|
||||
// Alternatively, figure out how to reliably redirect
|
||||
// all output above to a file (Start/Stop transcript does not work)
|
||||
writeFile(
|
||||
file: "${bldlabel}.txt",
|
||||
text: output)
|
||||
}
|
||||
else {
|
||||
sh "rm -fv ${bldlabel}.txt"
|
||||
// execute the bld command in a redirecting shell
|
||||
// to capture output
|
||||
sh '''\
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
log_file=''' + "${bldlabel}.txt" + '''
|
||||
exec 3>&1 1>>${log_file} 2>&1
|
||||
ccache -s
|
||||
source /opt/rh/devtoolset-6/enable
|
||||
/usr/bin/time -p ./bin/ci/ubuntu/build-and-test.sh 2>&1
|
||||
ccache -s
|
||||
'''
|
||||
}
|
||||
}
|
||||
finally {
|
||||
def outstr = ''
|
||||
def loglink = '[console](' + env.BUILD_URL + '/console)'
|
||||
def logfile = "${bldlabel}.txt"
|
||||
if (fileExists(logfile)) {
|
||||
outstr = readFile(logfile)
|
||||
loglink = "[logfile](" + env.BUILD_URL + "/artifact/${logfile})"
|
||||
}
|
||||
def st = getResults(outstr, bldlabel)
|
||||
def time = getTime(outstr, bldlabel)
|
||||
def fail_count = getFailures(outstr, bldlabel)
|
||||
outstr = null
|
||||
def txtcolor =
|
||||
fail_count == 0 ? 'DarkGreen' : 'Crimson'
|
||||
def shortbld = bldlabel
|
||||
shortbld = shortbld.replace('debug', 'dbg')
|
||||
shortbld = shortbld.replace('release', 'rel')
|
||||
shortbld = shortbld.replace('unity', 'un')
|
||||
manager.addShortText(
|
||||
"${shortbld}: ${st}, t: ${time}",
|
||||
txtcolor,
|
||||
'white',
|
||||
'0px',
|
||||
'white')
|
||||
archive("${bldlabel}.txt")
|
||||
if (bldtype == 'docs') {
|
||||
publishHTML(
|
||||
allowMissing: true,
|
||||
alwaysLinkToLastBuild: false,
|
||||
keepAll: true,
|
||||
reportName: 'Doxygen',
|
||||
reportDir: 'build/docs/html_doc',
|
||||
reportFiles: 'index.html')
|
||||
}
|
||||
def envs = ''
|
||||
for (int j = 0; j < extra_env.size(); j++) {
|
||||
envs += ", <br/>" + extra_env[j]
|
||||
}
|
||||
def cmake_txt = cmake_extra
|
||||
if (cmake_txt != '') {
|
||||
cmake_txt = " <br/>" + cmake_txt
|
||||
}
|
||||
lock('rippled_dev_status') {
|
||||
all_status[bldlabel] =
|
||||
[fail_count == 0, bldtype + cmake_txt + envs, "${st}, t: ${time}", loglink]
|
||||
}
|
||||
} //try-catch-finally
|
||||
} //withEnv
|
||||
} //withCredentials
|
||||
} //node
|
||||
} //builds item
|
||||
} //for variants
|
||||
|
||||
// this actually executes all the builds we just defined
|
||||
// above, in parallel as slaves are available
|
||||
parallel builds
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// anything here should run always...
|
||||
stage ('Final Status') {
|
||||
node {
|
||||
def start_time = new Date()
|
||||
def sdf = new SimpleDateFormat('yyyyMMdd - HH:mm:ss')
|
||||
def datestamp = sdf.format(start_time)
|
||||
|
||||
def results = """
|
||||
## Jenkins Build Summary
|
||||
|
||||
Built from [this commit](https://github.com/ripple/rippled/commit/${commit_id})
|
||||
|
||||
Built at __${datestamp}__
|
||||
|
||||
### Test Results
|
||||
|
||||
Build Type | Log | Result | Status
|
||||
---------- | --- | ------ | ------
|
||||
"""
|
||||
for ( e in all_status) {
|
||||
results += e.value[1] + ' | ' + e.value[3] + ' | ' + e.value[2] + ' | ' +
|
||||
(e.value[0] ? 'PASS :white_check_mark: ' : 'FAIL :red_circle: ') + '\n'
|
||||
}
|
||||
results += '\n'
|
||||
echo 'FINAL BUILD RESULTS'
|
||||
echo results
|
||||
|
||||
try {
|
||||
def url_comment = ''
|
||||
if (env.CHANGE_ID && env.CHANGE_ID ==~ /\d+/) {
|
||||
//
|
||||
// CHANGE_ID indicates we are building a PR
|
||||
// find PR comments
|
||||
//
|
||||
def resp = httpRequest(
|
||||
timeout: 10,
|
||||
authentication: github_cred,
|
||||
url: "${github_repo}/pulls/$CHANGE_ID")
|
||||
def result = readJSON(text: resp.content)
|
||||
//
|
||||
// follow issue comments link
|
||||
//
|
||||
url_comment = result['_links']['issue']['href'] + '/comments'
|
||||
}
|
||||
else {
|
||||
//
|
||||
// if not a PR, just search comments for our commit ID
|
||||
//
|
||||
url_comment =
|
||||
"${github_repo}/commits/${commit_id}/comments"
|
||||
}
|
||||
|
||||
def response = httpRequest(
|
||||
timeout: 10,
|
||||
authentication: github_cred,
|
||||
url: url_comment)
|
||||
def data = readJSON(text: response.content)
|
||||
def comment_id = 0
|
||||
def mode = 'POST'
|
||||
// see if we can find and existing comment here with
|
||||
// a heading that matches ours...
|
||||
for (comment in data) {
|
||||
if (comment['body'] =~ /(?m)^##\s+Jenkins Build/) {
|
||||
comment_id = comment['id']
|
||||
echo "existing status comment ${comment_id} found"
|
||||
url_comment = comment['url']
|
||||
mode = 'PATCH'
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (comment_id == 0) {
|
||||
echo 'no existing status comment found'
|
||||
}
|
||||
|
||||
def body = JsonOutput.toJson([
|
||||
body: results
|
||||
])
|
||||
|
||||
response = httpRequest(
|
||||
timeout: 10,
|
||||
authentication: github_cred,
|
||||
url: url_comment,
|
||||
contentType: 'APPLICATION_JSON',
|
||||
httpMode: mode,
|
||||
requestBody: body)
|
||||
}
|
||||
catch (e) {
|
||||
echo 'had a problem interacting with github...status is probably not updated'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------
|
||||
// util functions
|
||||
// ---------------
|
||||
def myStage(name) {
|
||||
echo """
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
>> building ${name}
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
"""
|
||||
}
|
||||
|
||||
def printGitInfo(id, log) {
|
||||
echo """
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
>> Building commit ID ${id}
|
||||
>>
|
||||
${log}
|
||||
+++++++++++++++++++++++++++++++++++++++++
|
||||
"""
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def getResults(text, label) {
|
||||
// example:
|
||||
/// 194.5s, 154 suites, 948 cases, 360485 tests total, 0 failures
|
||||
// or build log format:
|
||||
// [msvc.release] 71.3s, 162 suites, 995 cases, 318901 tests total, 1 failure
|
||||
def matcher =
|
||||
text == '' ?
|
||||
manager.getLogMatcher(/\[${label}\].+?(\d+) case[s]?, (\d+) test[s]? total, (\d+) (failure(s?))/) :
|
||||
text =~ /(\d+) case[s]?, (\d+) test[s]? total, (\d+) (failure(s?))/
|
||||
matcher ? matcher[0][1] + ' cases, ' + matcher[0][3] + ' failed' : 'no test results'
|
||||
}
|
||||
|
||||
def getFailures(text, label) {
|
||||
// [see above for format]
|
||||
def matcher =
|
||||
text == '' ?
|
||||
manager.getLogMatcher(/\[${label}\].+?(\d+) test[s]? total, (\d+) (failure(s?))/) :
|
||||
text =~ /(\d+) test[s]? total, (\d+) (failure(s?))/
|
||||
// if we didn't match, then return 1 since something is
|
||||
// probably wrong, e.g. maybe the build failed...
|
||||
matcher ? matcher[0][2] as Integer : 1i
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def getTime(text, label) {
|
||||
// look for text following a label 'real' for
|
||||
// wallclock time. Some `time`s report fractional
|
||||
// seconds and we can omit those in what we report
|
||||
def matcher =
|
||||
text == '' ?
|
||||
manager.getLogMatcher(/(?m)^\[${label}\]\s+real\s+(.+)\.(\d+?)[s]?/) :
|
||||
text =~ /(?m)^real\s+(.+)\.(\d+?)[s]?/
|
||||
if (matcher) {
|
||||
return matcher[0][1] + 's'
|
||||
}
|
||||
|
||||
// alternatively, look for powershell elapsed time
|
||||
// format, e.g. :
|
||||
// TotalSeconds : 523.2140529
|
||||
def matcher2 =
|
||||
text == '' ?
|
||||
manager.getLogMatcher(/(?m)^\[${label}\]\s+TotalSeconds\s+:\s+(\d+)\.(\d+?)?/) :
|
||||
text =~ /(?m)^TotalSeconds\s+:\s+(\d+)\.(\d+?)?/
|
||||
matcher2 ? matcher2[0][1] + 's' : 'n/a'
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def getFirstPart(bld) {
|
||||
def matcher = bld =~ /^(.+?)\.(.+)$/
|
||||
matcher ? matcher[0][1] : bld
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def isNoUnity(bld) {
|
||||
def matcher = bld =~ /\.nounity\s*$/
|
||||
matcher ? true : false
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def getSecondPart(bld) {
|
||||
def matcher = bld =~ /^(.+?)\.(.+)$/
|
||||
matcher ? matcher[0][2] : bld
|
||||
}
|
||||
|
||||
// because I can't seem to find path manipulation
|
||||
// functions in groovy....
|
||||
@NonCPS
|
||||
def upDir(path) {
|
||||
def matcher = path =~ /^(.+)\/(.+?)/
|
||||
matcher ? matcher[0][1] : path
|
||||
}
|
||||
|
||||
|
||||
26
README.md
@@ -1,10 +1,11 @@
|
||||

|
||||
|
||||
**Do you work at a digital asset exchange or wallet provider?**
|
||||
|
||||
Please [contact us](mailto:support@ripple.com). We can help guide your integration.
|
||||
|
||||
# What is Ripple?
|
||||
|
||||

|
||||
|
||||
> **Do you work at a digital asset exchange or wallet provider?**
|
||||
>
|
||||
> Please [contact us](mailto:support@ripple.com). We can help guide your integration.
|
||||
|
||||
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
|
||||
@@ -36,7 +37,7 @@ multiple trading parties, who each layer costs to the transaction. Thin
|
||||
liquidity and many intermediary trading parties make competitive pricing
|
||||
challenging.
|
||||
|
||||

|
||||

|
||||
|
||||
### XRP as a Bridge Currency
|
||||
Ripple can bridge even exotic currency pairs directly through XRP. Similar to
|
||||
@@ -47,7 +48,7 @@ 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.
|
||||
|
||||

|
||||

|
||||
|
||||
# rippled - Ripple server
|
||||
`rippled` is the reference server implementation of the Ripple
|
||||
@@ -67,8 +68,9 @@ ISC license. See the LICENSE file for more details.
|
||||
|---------|----------|
|
||||
| ./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. |
|
||||
| ./Builds| Platform-specific guides for building rippled. |
|
||||
| ./docs | Source documentation files and doxygen config. |
|
||||
| ./cfg | Example configuration files. |
|
||||
| ./src | Source code. |
|
||||
|
||||
Some of the directories under `src` are external repositories inlined via
|
||||
@@ -78,8 +80,8 @@ git-subtree. See the corresponding README for more details.
|
||||
|
||||
* [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 Whitepapers & Reports
|
||||
* [Ripple Consensus Whitepaper](https://ripple.com/files/ripple_consensus_whitepaper.pdf)
|
||||
* [Ripple Solutions Guide](https://ripple.com/files/ripple_solutions_guide.pdf)
|
||||
|
||||
To learn about how Ripple is transforming global payments visit
|
||||
|
||||
167
RELEASENOTES.md
@@ -1,16 +1,175 @@
|
||||

|
||||
# Release Notes
|
||||
|
||||

|
||||
|
||||
This document contains the release notes for `rippled`, 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/
|
||||
|
||||
**Do you work at a digital asset exchange or wallet provider?**
|
||||
|
||||
Please [contact us](mailto:support@ripple.com). We can help guide your integration.
|
||||
> **Do you work at a digital asset exchange or wallet provider?**
|
||||
>
|
||||
> Please [contact us](mailto:support@ripple.com). We can help guide your integration.
|
||||
|
||||
## Updating `rippled`
|
||||
|
||||
If you are using Red Hat Enterprise Linux 7 or CentOS 7, you can [update using `yum`](https://ripple.com/build/rippled-setup/#updating-rippled). For other platforms, please [compile from source](https://wiki.ripple.com/Rippled_build_instructions).
|
||||
|
||||
# Releases
|
||||
|
||||
## Version 1.0.0.
|
||||
|
||||
The `rippled` 1.0.0 release includes incremental improvements to several previously released features.
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
- The **history sharding** functionality has been improved. Instances can now use the shard store to satisfy ledger requests.
|
||||
- Change permessage-deflate and compress defaults (RIPD-506)
|
||||
- Update validations on UNL change (RIPD-1566)
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Add `check`, `escrow`, and `pay_chan` to `ledger_entry` (RIPD-1600)
|
||||
- Clarify Escrow semantics (RIPD-1571)
|
||||
|
||||
|
||||
## Version 0.90.1
|
||||
|
||||
The `rippled` 0.90.1 release includes fixes for issues reported by external security researchers. These issues, when exploited, could cause a rippled instance to restart or, in some circumstances, stop executing. While these issues can result in a denial of service attack, none affect the integrity of the XRP Ledger and no user funds, including XRP, are at risk.
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
This release has no new features.
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Address issues identified by external review:
|
||||
- Verify serialized public keys more strictly before using them
|
||||
(RIPD-1617, RIPD-1619, RIPD-1621)
|
||||
- Eliminate a potential out-of-bounds memory access in the base58
|
||||
encoding/decoding logic (RIPD-1618)
|
||||
- Avoid invoking undefined behavior in memcpy (RIPD-1616)
|
||||
- Limit STVar recursion during deserialization (RIPD-1603)
|
||||
- Use lock when creating a peer shard rangeset
|
||||
|
||||
|
||||
## Version 0.90.0
|
||||
|
||||
The `rippled` 0.90.0 release introduces several features and enhancements that improve the reliability, scalability and security of the XRP Ledger.
|
||||
|
||||
Highlights of this release include:
|
||||
|
||||
- The `DepositAuth` amendment, which lets an account strictly reject any incoming money from transactions sent by other accounts.
|
||||
- The `Checks` amendment, which allows users to create deferred payments that can be cancelled or cashed by their intended recipients.
|
||||
- **History Sharding**, which allows `rippled` servers to distribute historical ledger data if they agree to dedicate storage for segments of ledger history.
|
||||
- New **Preferred Ledger by Branch** semantics which improve the logic that allow a server to decide which ledger it should base future ledgers on when there are multiple candidates.
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
- Add support for Deposit Authorization account root flag ([#2239](https://github.com/ripple/rippled/issues/2239))
|
||||
- Implement history shards ([#2258](https://github.com/ripple/rippled/issues/2258))
|
||||
- Preferred ledger by branch ([#2300](https://github.com/ripple/rippled/issues/2300))
|
||||
- Redesign Consensus Simulation Framework ([#2209](https://github.com/ripple/rippled/issues/2209))
|
||||
- Tune for higher transaction processing ([#2294](https://github.com/ripple/rippled/issues/2294))
|
||||
- Optimize queries for `account_tx` to work around SQLite query planner ([#2312](https://github.com/ripple/rippled/issues/2312))
|
||||
- Allow `Journal` to be copied/moved ([#2292](https://github.com/ripple/rippled/issues/2292))
|
||||
- Cleanly report invalid `[server]` settings ([#2305](https://github.com/ripple/rippled/issues/2305))
|
||||
- Improve log scrubbing ([#2358](https://github.com/ripple/rippled/issues/2358))
|
||||
- Update `rippled-example.cfg` ([#2307](https://github.com/ripple/rippled/issues/2307))
|
||||
- Force json commands to be objects ([#2319](https://github.com/ripple/rippled/issues/2319))
|
||||
- Fix cmake clang build for sanitizers ([#2325](https://github.com/ripple/rippled/issues/2325))
|
||||
- Allow `account_objects` RPC to filter by “check” ([#2356](https://github.com/ripple/rippled/issues/2356))
|
||||
- Limit nesting of json commands ([#2326](https://github.com/ripple/rippled/issues/2326))
|
||||
- Unit test that `sign_for` returns a correct hash ([#2333](https://github.com/ripple/rippled/issues/2333))
|
||||
- Update Visual Studio build instructions ([#2355](https://github.com/ripple/rippled/issues/2355))
|
||||
- Force boost static linking for MacOS builds ([#2334](https://github.com/ripple/rippled/issues/2334))
|
||||
- Update MacOS build instructions ([#2342](https://github.com/ripple/rippled/issues/2342))
|
||||
- Add dev docs generation to Jenkins ([#2343](https://github.com/ripple/rippled/issues/2343))
|
||||
- Poll if process is still alive in Test.py ([#2290](https://github.com/ripple/rippled/issues/2290))
|
||||
- Remove unused `beast::currentTimeMillis()` ([#2345](https://github.com/ripple/rippled/issues/2345))
|
||||
|
||||
|
||||
**Bug Fixes**
|
||||
- Improve error message on mistyped command ([#2283](https://github.com/ripple/rippled/issues/2283))
|
||||
- Add missing includes ([#2368](https://github.com/ripple/rippled/issues/2368))
|
||||
- Link boost statically only when requested ([#2291](https://github.com/ripple/rippled/issues/2291))
|
||||
- Unit test logging fixes ([#2293](https://github.com/ripple/rippled/issues/2293))
|
||||
- Fix Jenkins pipeline for branches ([#2289](https://github.com/ripple/rippled/issues/2289))
|
||||
- Avoid AppVeyor stack overflow ([#2344](https://github.com/ripple/rippled/issues/2344))
|
||||
- Reduce noise in log ([#2352](https://github.com/ripple/rippled/issues/2352))
|
||||
|
||||
|
||||
## Version 0.81.0
|
||||
|
||||
The `rippled` 0.81.0 release introduces changes that improve the scalability of the XRP Ledger and transitions the recommended validator configuration to a new hosted site, as described in Ripple's [Decentralization Strategy Update](https://ripple.com/dev-blog/decentralization-strategy-update/) post.
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
- New hosted validator configuration.
|
||||
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Optimize queries for account_tx to work around SQLite query planner ([#2312](https://github.com/ripple/rippled/issues/2312))
|
||||
|
||||
|
||||
## Version 0.80.2
|
||||
|
||||
The `rippled` 0.80.2 release introduces changes that improve the scalability of the XRP Ledger.
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
This release has no new features.
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Do not dispatch a transaction received from a peer for processing if it has already been dispatched within the past ten seconds.
|
||||
- Increase the number of transaction handlers that can be in flight in the job queue and decrease the relative cost for peers to share transaction and ledger data.
|
||||
- Make better use of resources by adjusting the number of threads we initialize, by reverting commit [#68b8ffd](https://github.com/ripple/rippled/commit/68b8ffdb638d07937f841f7217edeb25efdb3b5d).
|
||||
|
||||
## Version 0.80.1
|
||||
|
||||
The `rippled` 0.80.1 release provides several enhancements in support of published validator lists and corrects several bugs.
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
- Allow including validator manifests in published list ([#2278](https://github.com/ripple/rippled/issues/2278))
|
||||
- Add validator list RPC commands ([#2242](https://github.com/ripple/rippled/issues/2242))
|
||||
- Support [SNI](https://en.wikipedia.org/wiki/Server_Name_Indication) when querying published list sites and use Windows system root certificates ([#2275](https://github.com/ripple/rippled/issues/2275))
|
||||
- Grow TxQ expected size quickly, shrink slowly ([#2235](https://github.com/ripple/rippled/issues/2235))
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Make consensus quorum unreachable if validator list expires ([#2240](https://github.com/ripple/rippled/issues/2240))
|
||||
- Properly use ledger hash to break ties when determing working ledger for consensus ([#2257](https://github.com/ripple/rippled/issues/2257))
|
||||
- Explictly use std::deque for missing node handler in SHAMap code ([#2252](https://github.com/ripple/rippled/issues/2252))
|
||||
- Verify validator token manifest matches private key ([#2268](https://github.com/ripple/rippled/issues/2268))
|
||||
|
||||
|
||||
## Version 0.80.0
|
||||
|
||||
The `rippled` 0.80.0 release introduces several enhancements that improve the reliability, scalability and security of the XRP Ledger.
|
||||
|
||||
Highlights of this release include:
|
||||
|
||||
- The `SortedDirectories` amendment, which allows the entries stored within a page to be sorted, and corrects a technical flaw that could, in some edge cases, prevent an empty intermediate page from being deleted.
|
||||
- Changes to the UNL and quorum rules
|
||||
+ Use a fixed size UNL if the total listed validators are below threshold
|
||||
+ Ensure a quorum of 0 cannot be configured
|
||||
+ Set a quorum to provide Byzantine fault tolerance until a threshold of total validators is exceeded, at which time the quorum is 80%
|
||||
|
||||
**New and Updated Features**
|
||||
|
||||
- Improve directory insertion and deletion ([#2165](https://github.com/ripple/rippled/issues/2165))
|
||||
- Move consensus thread safety logic from the generic implementation in Consensus into the RCL adapted version RCLConsensus ([#2106](https://github.com/ripple/rippled/issues/2106))
|
||||
- Refactor Validations class into a generic version that can be adapted ([#2084](https://github.com/ripple/rippled/issues/2084))
|
||||
- Make minimum quorum Byzantine fault tolerant ([#2093](https://github.com/ripple/rippled/issues/2093))
|
||||
- Make amendment blocked state thread-safe and simplify a constructor ([#2207](https://github.com/ripple/rippled/issues/2207))
|
||||
- Use ledger hash to break ties ([#2169](https://github.com/ripple/rippled/issues/2169))
|
||||
- Refactor RangeSet ([#2113](https://github.com/ripple/rippled/issues/2113))
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Fix an issue where `setAmendmentBlocked` is only called when processing the `EnableAmendment` transaction for the amendment ([#2137](https://github.com/ripple/rippled/issues/2137))
|
||||
- Track escrow in recipient's owner directory ([#2212](https://github.com/ripple/rippled/issues/2212))
|
||||
|
||||
## Version 0.70.2
|
||||
|
||||
The `rippled` 0.70.2 release corrects an emergent behavior which causes large numbers of transactions to get
|
||||
|
||||
1301
SConstruct
68
appveyor.yml
@@ -1,66 +1,42 @@
|
||||
# Set environment variables.
|
||||
environment:
|
||||
PYTHON: C:/Python27-x64
|
||||
|
||||
# We bundle up protoc.exe and only the parts of boost and openssl we need so
|
||||
# that it's a small download. We also use appveyor's free cache, avoiding fees
|
||||
# downloading from S3 each time.
|
||||
# downloading from S3 each time.
|
||||
# TODO: script to create this package.
|
||||
RIPPLED_DEPS_PATH: rippled_deps15.02
|
||||
RIPPLED_DEPS_PATH: rippled_deps17.01
|
||||
RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip
|
||||
|
||||
# Other dependencies we just download each time.
|
||||
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.
|
||||
# CMake honors these environment variables, setting the include/lib paths.
|
||||
BOOST_ROOT: C:/%RIPPLED_DEPS_PATH%/boost
|
||||
OPENSSL_ROOT: C:/%RIPPLED_DEPS_PATH%/openssl
|
||||
|
||||
# We've had trouble with AppVeyor apparently not having a stack as large
|
||||
# as the *nix CI platforms. AppVeyor support suggested that we try
|
||||
# GCE VMs. The following line is supposed to enable that VM type.
|
||||
appveyor_build_worker_cloud: gce
|
||||
|
||||
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
|
||||
os: Visual Studio 2017
|
||||
|
||||
# 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_DEPS_PATH%'
|
||||
- '%PIP_PATH%'
|
||||
- '%PYWIN32_PATH%'
|
||||
|
||||
# This means we'll download a zip of the branch we want, rather than the full
|
||||
# history.
|
||||
shallow_clone: true
|
||||
|
||||
install:
|
||||
# We want easy_install, python and protoc.exe on PATH.
|
||||
- SET PATH=%PYTHON%;%PYTHON%/Scripts;C:/%RIPPLED_DEPS_PATH%;%PATH%
|
||||
|
||||
# `ps` prefix means the command is executed by powershell.
|
||||
- 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
|
||||
# We want protoc.exe on PATH.
|
||||
- SET PATH=C:/%RIPPLED_DEPS_PATH%;%PATH%
|
||||
|
||||
# Download dependencies if appveyor didn't restore them from the cache.
|
||||
# Use 7zip to unzip.
|
||||
@@ -90,44 +66,28 @@ build_script:
|
||||
# Show which version of the compiler we are using.
|
||||
- cl
|
||||
- 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" ../..
|
||||
cmake -G"Visual Studio 15 2017 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:
|
||||
- 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="build/$cmake_target/$env:buildconfig/rippled"
|
||||
"Exe is at $exe"
|
||||
|
||||
test_script:
|
||||
- ps: |
|
||||
& {
|
||||
# Run the rippled unit tests
|
||||
& $exe --unittest --quiet --unittest-log
|
||||
& $exe --unittest --unittest-log
|
||||
# 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" }
|
||||
}
|
||||
|
||||
@@ -6,48 +6,105 @@
|
||||
set -ex
|
||||
__dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
echo "using CC: $CC"
|
||||
"${CC}" --version
|
||||
COMPNAME=$(basename $CC)
|
||||
echo "using CXX: ${CXX:-notset}"
|
||||
if [[ $CXX ]]; then
|
||||
"${CXX}" --version
|
||||
fi
|
||||
echo "using TARGET: $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"
|
||||
echo "using APP: $APP"
|
||||
|
||||
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
|
||||
JOBS=${NUM_PROCESSORS:-2}
|
||||
if [[ ${TRAVIS:-false} != "true" ]]; then
|
||||
JOBS=$((JOBS+1))
|
||||
fi
|
||||
# We can be sure we're using the build/$CC.$TARGET variant
|
||||
# (-f so never err)
|
||||
rm -f build/${APP}
|
||||
|
||||
if [ -x /usr/bin/time ] ; then
|
||||
: ${TIME:="Duration: %E"}
|
||||
export TIME
|
||||
time=/usr/bin/time
|
||||
else
|
||||
time=
|
||||
fi
|
||||
|
||||
echo "cmake building ${APP}"
|
||||
: ${CMAKE_EXTRA_ARGS:=""}
|
||||
if [[ ${NINJA_BUILD:-} == true ]]; then
|
||||
CMAKE_EXTRA_ARGS+=" -G Ninja"
|
||||
fi
|
||||
CMAKE_TARGET=${COMPNAME}.${TARGET}
|
||||
if [[ ${CI:-} == true ]]; then
|
||||
CMAKE_TARGET=$CMAKE_TARGET.ci
|
||||
fi
|
||||
#
|
||||
# allow explicit setting of the name of the build
|
||||
# dir, otherwise default to the CMAKE_TARGET value
|
||||
#
|
||||
: "${BUILD_DIR:=$CMAKE_TARGET}"
|
||||
BUILDARGS=" -j${JOBS}"
|
||||
if [[ ${VERBOSE_BUILD:-} == true ]]; then
|
||||
CMAKE_EXTRA_ARGS+=" -DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
|
||||
# TODO: if we use a different generator, this
|
||||
# option to build verbose would need to change:
|
||||
if [[ ${NINJA_BUILD:-} == true ]]; then
|
||||
BUILDARGS+=" -v"
|
||||
else
|
||||
BUILDARGS+=" verbose=1"
|
||||
fi
|
||||
fi
|
||||
if [[ ${USE_CCACHE:-} == true ]]; then
|
||||
echo "using ccache with basedir [${CCACHE_BASEDIR:-}]"
|
||||
CMAKE_EXTRA_ARGS+=" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
fi
|
||||
if [ -d "build/${BUILD_DIR}" ]; then
|
||||
rm -rf "build/${BUILD_DIR}"
|
||||
fi
|
||||
|
||||
mkdir -p "build/${BUILD_DIR}"
|
||||
pushd "build/${BUILD_DIR}"
|
||||
$time cmake ../.. -Dtarget=$CMAKE_TARGET ${CMAKE_EXTRA_ARGS}
|
||||
if [[ ${TARGET} == "docs" ]]; then
|
||||
$time cmake --build . --target docs -- $BUILDARGS
|
||||
## mimic the standard test output for docs build
|
||||
## to make controlling processes like jenkins happy
|
||||
if [ -f html_doc/index.html ]; then
|
||||
echo "1 case, 1 test total, 0 failures"
|
||||
else
|
||||
echo "1 case, 1 test total, 1 failures"
|
||||
fi
|
||||
exit
|
||||
else
|
||||
$time cmake --build . -- $BUILDARGS
|
||||
if [[ ${BUILD_BOTH:-} == true ]]; then
|
||||
if [[ ${TARGET} == *.unity ]]; then
|
||||
cmake --build . --target rippled_classic -- $BUILDARGS
|
||||
else
|
||||
cmake --build . --target rippled_unity -- $BUILDARGS
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
popd
|
||||
export APP_PATH="$PWD/build/${BUILD_DIR}/${APP}"
|
||||
echo "using APP_PATH: $APP_PATH"
|
||||
|
||||
|
||||
# See what we've actually built
|
||||
ldd $APP_PATH
|
||||
|
||||
if [[ ${APP} == "rippled" ]]; then
|
||||
export APP_ARGS="--unittest --quiet --unittest-log"
|
||||
APP_ARGS+="--unittest --quiet --unittest-log"
|
||||
# Only report on src/ripple files
|
||||
export LCOV_FILES="*/src/ripple/*"
|
||||
# Nothing to explicitly exclude
|
||||
export LCOV_EXCLUDE_FILES="LCOV_NO_EXCLUDE"
|
||||
if [[ $TARGET != "coverage" && ${PARALLEL_TESTS:-} == true ]]; then
|
||||
APP_ARGS+=" --unittest-jobs ${JOBS}"
|
||||
fi
|
||||
else
|
||||
: ${APP_ARGS:=}
|
||||
: ${LCOV_FILES:="*/src/*"}
|
||||
@@ -59,22 +116,33 @@ 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
|
||||
lcov --no-external -c -i -d . -o baseline.info | grep -v "ignoring data for external file"
|
||||
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 $APP_ARGS
|
||||
if [[ ${SKIP_TESTS:-} == true ]]; then
|
||||
echo "skipping tests for ${TARGET}"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $TARGET == debug* && -v GDB_ROOT && -x $GDB_ROOT/bin/gdb ]]; then
|
||||
$GDB_ROOT/bin/gdb -v
|
||||
# Execute unit tests under gdb, printing a call stack
|
||||
# if we get a crash.
|
||||
export APP_ARGS
|
||||
$GDB_ROOT/bin/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 $APP_ARGS
|
||||
else
|
||||
$APP_PATH $APP_ARGS
|
||||
fi
|
||||
|
||||
if [[ $TARGET == "coverage" ]]; then
|
||||
# Create test coverage data file
|
||||
lcov --no-external -c -d . -o tests.info
|
||||
lcov --no-external -c -d . -o tests.info | grep -v "ignoring data for external file"
|
||||
|
||||
# Combine baseline and test coverage data
|
||||
lcov -a baseline.info -a tests.info -o lcov-all.info
|
||||
@@ -87,6 +155,8 @@ if [[ $TARGET == "coverage" ]]; then
|
||||
|
||||
# Push the results (lcov.info) to codecov
|
||||
codecov -X gcov # don't even try and look for .gcov files ;)
|
||||
|
||||
find . -name "*.gcda" | xargs rm -f
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -8,49 +8,18 @@ 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
|
||||
mkdir -pv $HOME/bin
|
||||
for g in gcc g++ gcov gcc-ar gcc-nm gcc-ranlib
|
||||
do
|
||||
test -x $( type -p ${g}-$GCC_VER )
|
||||
ln -sv $(type -p ${g}-$GCC_VER) $HOME/bin/${g}
|
||||
done
|
||||
|
||||
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
|
||||
else
|
||||
g++ -v
|
||||
fi
|
||||
|
||||
pip install --user requests==2.13.0
|
||||
@@ -58,11 +27,3 @@ 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
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
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)
|
||||
)
|
||||
@@ -8,6 +8,14 @@
|
||||
# https://travis-ci.org/ripple/rippled/caches
|
||||
set -e
|
||||
|
||||
if [ -x /usr/bin/time ] ; then
|
||||
: ${TIME:="Duration: %E"}
|
||||
export TIME
|
||||
time=/usr/bin/time
|
||||
else
|
||||
time=
|
||||
fi
|
||||
|
||||
if [ ! -d "$BOOST_ROOT/lib" ]
|
||||
then
|
||||
wget $BOOST_URL -O /tmp/boost.tar.gz
|
||||
@@ -15,9 +23,9 @@ then
|
||||
rm -fr ${BOOST_ROOT}
|
||||
tar xzf /tmp/boost.tar.gz
|
||||
cd $BOOST_ROOT && \
|
||||
./bootstrap.sh --prefix=$BOOST_ROOT && \
|
||||
./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 -j${NUM_PROCESSORS:-2} &&\
|
||||
./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install
|
||||
$time ./bootstrap.sh --prefix=$BOOST_ROOT && \
|
||||
$time ./b2 -d1 define=_GLIBCXX_USE_CXX11_ABI=0 -j$((2*${NUM_PROCESSORS:-2})) &&\
|
||||
$time ./b2 -d0 define=_GLIBCXX_USE_CXX11_ABI=0 install
|
||||
else
|
||||
echo "Using cached boost at $BOOST_ROOT"
|
||||
fi
|
||||
|
||||
@@ -172,6 +172,13 @@
|
||||
# NOTE If no ports support the peer protocol, rippled cannot
|
||||
# receive incoming peer connections or become a superpeer.
|
||||
#
|
||||
# limit = <number>
|
||||
#
|
||||
# Optional. An integer value that will limit the number of connected
|
||||
# clients that the port will accept. Once the limit is reached, new
|
||||
# connections will be refused until other clients disconnect.
|
||||
# Omit or set to 0 to allow unlimited numbers of clients.
|
||||
#
|
||||
# user = <text>
|
||||
# password = <text>
|
||||
#
|
||||
@@ -634,9 +641,7 @@
|
||||
#
|
||||
# [validators_file]
|
||||
#
|
||||
# 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.
|
||||
# Path or name of a file that determines the nodes to always accept as validators.
|
||||
#
|
||||
# The contents of the file should include a [validators] and/or
|
||||
# [validator_list_sites] and [validator_list_keys] entries.
|
||||
@@ -819,6 +824,10 @@
|
||||
# require administrative RPC call "can_delete"
|
||||
# to enable online deletion of ledger records.
|
||||
#
|
||||
# earliest_seq The default is 32570 to match the XRP ledger
|
||||
# network's earliest allowed sequence. Alternate
|
||||
# networks may set this value. Minimum value of 1.
|
||||
#
|
||||
# Notes:
|
||||
# The 'node_db' entry configures the primary, persistent storage.
|
||||
#
|
||||
@@ -829,6 +838,33 @@
|
||||
# [import_db] Settings for performing a one-time import (optional)
|
||||
# [database_path] Path to the book-keeping databases.
|
||||
#
|
||||
# [shard_db] Settings for the Shard Database (optional)
|
||||
#
|
||||
# Format (without spaces):
|
||||
# One or more lines of case-insensitive key / value pairs:
|
||||
# <key> '=' <value>
|
||||
# ...
|
||||
#
|
||||
# Example:
|
||||
# type=nudb
|
||||
# path=db/nudb
|
||||
#
|
||||
# The "type" field must be present and controls the choice of backend:
|
||||
#
|
||||
# type = NuDB
|
||||
#
|
||||
# type = RocksDB
|
||||
#
|
||||
# The RocksDB backend also provides these optional parameters:
|
||||
#
|
||||
# compression 0 for none, 1 for Snappy compression
|
||||
#
|
||||
# Required keys:
|
||||
# path Location to store the database (all types)
|
||||
#
|
||||
# max_size_gb Maximum disk space the database will utilize (in gigabytes)
|
||||
#
|
||||
#
|
||||
# There are 4 bookkeeping SQLite database that the server creates and
|
||||
# maintains. If you omit this configuration setting, it will default to
|
||||
# creating a directory called "db" located in the same place as your
|
||||
@@ -894,6 +930,24 @@
|
||||
# address=192.168.0.95:4201
|
||||
# prefix=my_validator
|
||||
#
|
||||
# [perf]
|
||||
#
|
||||
# Configuration of performance logging. If enabled, write Json-formatted
|
||||
# performance-oriented data periodically to a distinct log file.
|
||||
#
|
||||
# "perf_log" A string specifying the pathname of the performance log
|
||||
# file. A relative pathname will log relative to the
|
||||
# configuration directory. Required to enable
|
||||
# performance logging.
|
||||
#
|
||||
# "log_interval" Integer value for number of seconds between writing
|
||||
# to performance log. Default 1.
|
||||
#
|
||||
# Example:
|
||||
# [perf]
|
||||
# perf_log=/var/log/rippled/perf.log
|
||||
# log_interval=2
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# 7. Voting
|
||||
@@ -1044,6 +1098,15 @@ file_size_mult=2
|
||||
online_delete=2000
|
||||
advisory_delete=0
|
||||
|
||||
# This is the persistent datastore for shards. It is important for the health
|
||||
# of the ripple network that rippled operators shard as much as practical.
|
||||
# NuDB requires SSD storage. Helpful information can be found here
|
||||
# https://ripple.com/build/history-sharding
|
||||
#[shard_db]
|
||||
#type=NuDB
|
||||
#path=/var/lib/rippled/db/shards/nudb
|
||||
#max_size_gb=500
|
||||
|
||||
[database_path]
|
||||
/var/lib/rippled/db
|
||||
|
||||
@@ -1059,10 +1122,14 @@ time.nist.gov
|
||||
pool.ntp.org
|
||||
|
||||
# Where to find some other servers speaking the Ripple protocol.
|
||||
#
|
||||
[ips]
|
||||
r.ripple.com 51235
|
||||
|
||||
# To use the XRP test network (see https://ripple.com/build/xrp-test-net/),
|
||||
# use the following [ips] section instead:
|
||||
# [ips]
|
||||
# r.altnet.rippletest.net 51235
|
||||
|
||||
# File containing trusted validator keys or validator list publishers.
|
||||
# Unless an absolute path is specified, it will be considered relative to the
|
||||
# folder in which the rippled.cfg file is located.
|
||||
@@ -28,7 +28,7 @@
|
||||
# List of URIs serving lists of recommended validators.
|
||||
#
|
||||
# Examples:
|
||||
# https://ripple.com/validators
|
||||
# https://vl.ripple.com
|
||||
# http://127.0.0.1:8000
|
||||
#
|
||||
# [validator_list_keys]
|
||||
@@ -45,10 +45,20 @@
|
||||
# 02dd8b7075f64d77d9d2bdb88da364f29fcd975f9ea6f21894abcc7564efda8054
|
||||
#
|
||||
|
||||
# Public keys of the validators that this rippled instance trusts.
|
||||
[validators]
|
||||
n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
|
||||
n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
|
||||
n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
|
||||
n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
|
||||
n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
|
||||
# The default validator list publishers that the rippled instance
|
||||
# trusts.
|
||||
|
||||
[validator_list_sites]
|
||||
https://vl.ripple.com
|
||||
|
||||
[validator_list_keys]
|
||||
ED2677ABFFD1B33AC6FBC3062B71F1E8397C1505E1C42C64D11AD1B28FF73F4734
|
||||
|
||||
# To use the XRP test network (see https://ripple.com/build/xrp-test-net/),
|
||||
# use the following configuration instead:
|
||||
#
|
||||
# [validator_list_sites]
|
||||
# https://vl.altnet.rippletest.net
|
||||
#
|
||||
# [validator_list_keys]
|
||||
# ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860
|
||||
24
circle.yml
@@ -1,24 +0,0 @@
|
||||
machine:
|
||||
services:
|
||||
- docker
|
||||
dependencies:
|
||||
pre:
|
||||
- sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- 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.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
|
||||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 99
|
||||
- sudo update-alternatives --force --install /usr/bin/clang clang /usr/bin/clang-3.6 99 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-3.6
|
||||
- gcc --version
|
||||
- clang --version
|
||||
- clang++ --version
|
||||
test:
|
||||
pre:
|
||||
- scons clang.debug
|
||||
override:
|
||||
# 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 --quiet --unittest-log
|
||||
@@ -1,29 +0,0 @@
|
||||
A list of rippled version numbers, and the Github pull requests they contain.
|
||||
|
||||
0.28.0-b12: Includes pulls 836, 887, 902, 903 and 904.
|
||||
0.28.0-b13: Includes pulls 906, 912, 913, 914 and 915.
|
||||
0.28.0-b14: Includes pulls 907, 910, 922 and 923.
|
||||
0.28.0-b15: Includes pulls 832, 870, 879, 883, 911, 916, 919, 920, 924, 925 and 928. FAILED pulls 909 and 926.
|
||||
0.28.0-b16: Includes pulls 909, 926, 929, 931, 932, 935 and 934.
|
||||
0.28.0-b17: Includes pulls 927, 939, 940, 943, 944, 945 and 949.
|
||||
0.28.0-b18: Includes pulls 930, 946, 947, 948, 951, 952, 953, 954, 955, 956, 959, 960 and 962.
|
||||
0.29.0-b19: Includes pulls 967, 969 and 971.
|
||||
0.29.0-b20: Includes pulls 935, 942, 957, 958, 963, 964, 965, 966, 968, 972, 973, 974 and 975.
|
||||
0.29.0-b21: Includes pulls 970 and 976.
|
||||
0.28.1-b4: Includes pulls 968, 998, 1005, 1008, 1010, 1011 and 1012.
|
||||
0.28.1-b6: Includes pulls 983, 984, 1013, 1023 and 1024.
|
||||
0.28.1-b8: Includes pulls 988, 1009, 1014, 1019, 1029, 1031, 1033, 1034 and 1035.
|
||||
0.28.1-b9: Includes pulls 1026, 1030, 1036, 1037, 1038, 1040, and 1041.
|
||||
0.28.1-rc2: Includes pulls 1044
|
||||
0.28.1-rc3: Includes pulls 1052 and 1055.
|
||||
0.28.1: Includes pulls 1056, 1059 and 1062, 1063.
|
||||
0.28.2-b1: Includes pulls 866, 1045, 1046, 1047, 1050, 1051, 1057
|
||||
0.28.2-b2: Includes pulls 1058, 1061, 1064 and 1065
|
||||
0.28.2-b3: Includes pulls 1066, 1067, 1068
|
||||
0.28.2-b4: Includes pulls 1060, 1069, 1071, 1072, 1075 and 1076.
|
||||
0.28.2-b5: Includes pulls 1073, 1074, 1081, 1083, 1084, 1087, 1089, 1090, 1091
|
||||
0.28.2-b6: Includes pulls 1085, 1093, 1094, 1096, 1101, 1102, 1105
|
||||
0.28.2-b7: Includes pulls 1077, 1080, 1086, 1095, 1098, 1106 and 1112.
|
||||
0.28.2-b8: Includes pulls 1078, 1100, 1108, 1114, 1118, 1119 and 1121.
|
||||
0.28.2-b9: Includes pulls 1053, 1109, 1111, 1117, 1122 and 1123.
|
||||
0.29.1-b11: Includes pulls 1279, 1271, 1289, 1291, 1290, 1267, 1294, 1276, 1231, and 1286.
|
||||
2304
doc/Doxyfile
@@ -1,126 +0,0 @@
|
||||
#
|
||||
# Sample ripple.txt
|
||||
#
|
||||
# More information: https://ripple.com/wiki/Ripple.txt
|
||||
#
|
||||
# Publishing this file allows a site to declare in a trustworthy manor ripple
|
||||
# associated information.
|
||||
#
|
||||
# This file is stored on the web server for a domain. This file is searched
|
||||
# for in the following order:
|
||||
# - https://ripple.DOMAIN/ripple.txt
|
||||
# - https://www.DOMAIN/ripple.txt
|
||||
# - https://DOMAIN/ripple.txt
|
||||
#
|
||||
# The server MUST set the following HTTP header when serving this file:
|
||||
# Access-Control-Allow-Origin: *
|
||||
#
|
||||
# This file is UTF-8 with Dos, UNIX, or Mac style end of lines.
|
||||
# Blank lines and lines beginning with '#' are ignored.
|
||||
# Undefined sections are reserved.
|
||||
# No escapes are currently defined.
|
||||
#
|
||||
# IMPORTANT: Please remove these comments before publishing this file. Doing so
|
||||
# makes the file much more readable to humans trying to find info on your site.
|
||||
#
|
||||
# [expires]
|
||||
# Number of days after which this file should be considered expire. Clients
|
||||
# are expected to check this file when they have cause to believe it has
|
||||
# changed or expired. For example, if a client discovers an account declares
|
||||
# that it is associated with the domain, it should check to see if this file
|
||||
# has been updated. If an expiration date is not declared, the default
|
||||
# expiration for this file is 30 days.
|
||||
#
|
||||
# Example: 30
|
||||
#
|
||||
# [accounts]
|
||||
# Only valid in "ripple.txt". A list of accounts that are declared to be
|
||||
# controlled by this domain. A client wishing to indicate that an account is
|
||||
# verified as belonging to a domain will be show the account with a green
|
||||
# background. A client can verify that an account belongs to a domain by
|
||||
# checking if the account's root entry mentions the domain containing this
|
||||
# file and this file found at the domain mentions the account in this
|
||||
# section.
|
||||
#
|
||||
# Example: rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn
|
||||
#
|
||||
# [hotwallets]
|
||||
# Only valid in "ripple.txt". A list of accounts that are declared to be
|
||||
# controlled by this domain and used as hotwallets.
|
||||
#
|
||||
# Example: rG1QQv2nh2gr7RCZ1P8YYcBUKCCN633jCn
|
||||
#
|
||||
# [validation_public_key]:
|
||||
# Only valid in "ripple.txt". A validation public key that is declared
|
||||
# to be used by this domain for validating ledgers and that it is the
|
||||
# authorized signature for the domain. This does not imply that a node
|
||||
# serving the Ripple protocol is avilable at the web host providing the
|
||||
# file.
|
||||
#
|
||||
# Example: n9MZTnHe5D5Q2cgE8oV2usFwRqhUvEA8MwP5Mu1XVD6TxmssPRev
|
||||
#
|
||||
# [domain]:
|
||||
# Mandatory in "ripple.txt".
|
||||
# Only valid in "ripple.txt".
|
||||
# Must match location of file.
|
||||
#
|
||||
# Example: google.com
|
||||
#
|
||||
# [ips]:
|
||||
# Only valid in "rippled.cfg", "ripple.txt", and the referered [ips_url].
|
||||
# List of ips where the Newcoin protocol is avialable.
|
||||
# One ipv4 or ipv6 address per line.
|
||||
# A port may optionally be specified after adding a space to the address.
|
||||
# By convention, if known, IPs are listed in from most to least trusted.
|
||||
#
|
||||
# Examples:
|
||||
# 192.168.0.1
|
||||
# 192.168.0.1 3939
|
||||
# 2001:0db8:0100:f101:0210:a4ff:fee3:9566
|
||||
#
|
||||
# [validators]:
|
||||
# Only valid in "rippled.cfg", "ripple.txt", and the referered [validators_url].
|
||||
# List of Ripple validators this node recommends.
|
||||
#
|
||||
# For domains, rippled will probe for https web servers at the specied
|
||||
# domain in the following order: ripple.DOMAIN, www.DOMAIN, DOMAIN
|
||||
#
|
||||
# These are encoded 257-bit secp256k1 public keys.
|
||||
#
|
||||
# Examples:
|
||||
# redstem.com
|
||||
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
|
||||
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
|
||||
#
|
||||
# [ips_url]:
|
||||
# Only valid in "ripple.txt".
|
||||
# https URL to a similarily formatted file containing [ips].
|
||||
#
|
||||
# Example: https://google.com/ripple_ips.txt
|
||||
#
|
||||
# [validators_url]:
|
||||
# Only valid in "ripple.txt".
|
||||
# https URL to a similarily formatted file containing [validators].
|
||||
#
|
||||
# Example: https://google.com/ripple_validators.txt
|
||||
#
|
||||
# [currencies]:
|
||||
# This section allows a site to declare currencies it currently issues.
|
||||
#
|
||||
# Examples: (multiple allowed one per line)
|
||||
# USD
|
||||
# BTC
|
||||
# LTC
|
||||
#
|
||||
|
||||
[validation_public_key]
|
||||
n9MZTnHe5D5Q2cgE8oV2usFwRqhUvEA8MwP5Mu1XVD6TxmssPRev
|
||||
|
||||
[domain]
|
||||
loss
|
||||
|
||||
[ips]
|
||||
192.168.0.5
|
||||
|
||||
[validators]
|
||||
redstem.com
|
||||
@@ -1,4 +1,6 @@
|
||||
# Form
|
||||
# Code Style Cheat Sheet
|
||||
|
||||
## Form
|
||||
|
||||
- One class per header file.
|
||||
- Place each data member on its own line.
|
||||
@@ -11,7 +13,7 @@
|
||||
- Order class declarations as types, public, protected, private, then data.
|
||||
- Prefer 'private' over 'protected'
|
||||
|
||||
# Function
|
||||
## Function
|
||||
|
||||
- Minimize external dependencies
|
||||
* Pass options in the ctor instead of using theConfig
|
||||
@@ -1,5 +1,3 @@
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
# Coding Standards
|
||||
|
||||
Coding standards used here gradually evolve and propagate through
|
||||
@@ -1,22 +1,31 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install build-essential g++ git libbz2-dev wget python-dev
|
||||
RUN apt -y update
|
||||
RUN apt -y upgrade
|
||||
RUN apt -y install build-essential g++ git libbz2-dev wget python-dev
|
||||
RUN apt -y install cmake flex bison graphviz graphviz-dev libicu-dev
|
||||
RUN apt -y install jarwrapper java-common
|
||||
|
||||
# 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
|
||||
RUN cd /tmp
|
||||
ENV CM_INSTALLER=cmake-3.10.0-rc3-Linux-x86_64.sh
|
||||
ENV CM_VER_DIR=/opt/local/cmake-3.10.0
|
||||
RUN cd /tmp && wget https://cmake.org/files/v3.10/$CM_INSTALLER && chmod a+x $CM_INSTALLER
|
||||
RUN mkdir -p $CM_VER_DIR
|
||||
RUN ln -s $CM_VER_DIR /opt/local/cmake
|
||||
RUN /tmp/$CM_INSTALLER --prefix=$CM_VER_DIR --exclude-subdir
|
||||
RUN rm -f /tmp/$CM_INSTALLER
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get -y install doxygen
|
||||
RUN apt-get -y install xsltproc
|
||||
RUN cd /tmp && wget https://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.14.src.tar.gz
|
||||
RUN cd /tmp && tar xvf doxygen-1.8.14.src.tar.gz
|
||||
RUN mkdir -p /tmp/doxygen-1.8.14/build
|
||||
RUN cd /tmp/doxygen-1.8.14/build && /opt/local/cmake/bin/cmake -G "Unix Makefiles" ..
|
||||
RUN cd /tmp/doxygen-1.8.14/build && make -j2
|
||||
RUN cd /tmp/doxygen-1.8.14/build && make install
|
||||
RUN rm -f /tmp/doxygen-1.8.14.src.tar.gz
|
||||
RUN rm -rf /tmp/doxygen-1.8.14
|
||||
|
||||
CMD cd /opt/rippled/docs && \
|
||||
chmod +x makeqbk.sh && \
|
||||
./makeqbk.sh && \
|
||||
$BOOST_ROOT/b2
|
||||
RUN mkdir -p /opt/plantuml
|
||||
RUN wget -O /opt/plantuml/plantuml.jar http://sourceforge.net/projects/plantuml/files/plantuml.jar/download
|
||||
ENV PLANTUML_JAR=/opt/plantuml/plantuml.jar
|
||||
|
||||
CMD cd /opt/rippled/docs && doxygen source.dox
|
||||
|
||||
@@ -13,21 +13,6 @@ relative to the `docs/` directory.
|
||||
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
|
||||
|
||||
@@ -38,47 +23,54 @@ Install these dependencies:
|
||||
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/
|
||||
```
|
||||
1. Install doxygen using your package manager OR from source using the links above.
|
||||
|
||||
## Setup project submodules
|
||||
### [Optional] Install Plantuml (all platforms)
|
||||
|
||||
1. Open a shell in your rippled root folder.
|
||||
2. `git submodule init`
|
||||
3. `git submodule update docs/docca`
|
||||
Doxygen supports the optional use of [plantuml](http://plantuml.com) to
|
||||
generate diagrams from `@startuml` sections. We don't currently rely on this
|
||||
functionality for docs, so it's largely optional. Requirements:
|
||||
|
||||
1. Download/install a functioning java runtime, if you don't already have one.
|
||||
2. Download [plantuml](http://plantuml.com) from
|
||||
[here](http://sourceforge.net/projects/plantuml/files/plantuml.jar/download).
|
||||
Set a system environment variable named `PLANTUML_JAR` with a value of the fullpath
|
||||
to the file system location of the `plantuml.jar` file you downloaded.
|
||||
|
||||
## Do it
|
||||
|
||||
### Windows & MacOS
|
||||
### all platforms
|
||||
|
||||
From the rippled root folder:
|
||||
```
|
||||
cd docs
|
||||
./makeqbk.sh && b2
|
||||
mkdir -p html_doc
|
||||
doxygen source.dox
|
||||
```
|
||||
The output will be in `docs/html`.
|
||||
The output will be in `docs/html_doc`.
|
||||
|
||||
### Linux
|
||||
## Docker
|
||||
|
||||
(applicable to all platforms)
|
||||
|
||||
Instead of installing the doxygen tools locally, you can use the provided `Dockerfile` to create
|
||||
an ubuntu based image for running the tools:
|
||||
|
||||
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/
|
||||
```
|
||||
|
||||
Then to run the image, from the rippled root folder:
|
||||
|
||||
From the rippled root folder:
|
||||
```
|
||||
sudo docker run -v $PWD:/opt/rippled --rm rippled-docs
|
||||
```
|
||||
The output will be in `docs/html`.
|
||||
|
||||
The output will be in `docs/html_doc`.
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
[section Consensus and Validation]
|
||||
# Consensus and Validation
|
||||
|
||||
[*This section is a work in progress!!]
|
||||
**This section is a work in progress!!**
|
||||
|
||||
Consensus is the task of reaching agreement within a distributed system in the
|
||||
presence of faulty or even malicious participants. This document outlines the
|
||||
[@https://ripple.com/files/ripple/consensus/whitepaper.pdf Ripple Consensus
|
||||
Algorithm] as implemented in [@https://github.com/ripple/rippled rippled], but
|
||||
[Ripple Consensus Algorithm](https://ripple.com/files/ripple/consensus/whitepaper.pdf)
|
||||
as implemented in [rippled](https://github.com/ripple/rippled), but
|
||||
focuses on its utility as a generic consensus algorithm independent of the
|
||||
detailed mechanics of the Ripple Consensus Ledger. Most notably, the algorithm
|
||||
does not require fully synchronous communication between all nodes in the
|
||||
network, or even a fixed network topology, but instead achieves consensus via
|
||||
collectively trusted subnetworks.
|
||||
|
||||
[heading Distributed Agreement]
|
||||
## Distributed Agreement
|
||||
|
||||
A challenge for distributed systems is reaching agreement on changes in shared
|
||||
state. For the Ripple network, the shared state is the current ledger--account
|
||||
@@ -20,7 +20,7 @@ information, account balances, order books and other financial data. We will
|
||||
refer to shared distributed state as a /ledger/ throughout the remainder of this
|
||||
document.
|
||||
|
||||
[$images/consensus/ledger_chain.png [width 50%] [height 50%] ]
|
||||

|
||||
|
||||
As shown above, new ledgers are made by applying a set of transactions to the
|
||||
prior ledger. For the Ripple network, transactions include payments,
|
||||
@@ -33,14 +33,14 @@ the set of transactions to include, the order to apply those transactions, and
|
||||
even the resulting ledger after applying the transactions. This is even more
|
||||
difficult when some participants are faulty or malicious.
|
||||
|
||||
The Ripple network is a decentralized and _trust-full_ network. Anyone is free
|
||||
The Ripple network is a decentralized and **trust-full** network. Anyone is free
|
||||
to join and participants are free to choose a subset of peers that are
|
||||
collectively trusted to not collude in an attempt to defraud the participant.
|
||||
Leveraging this network of trust, the Ripple algorithm has two main components.
|
||||
|
||||
* /Consensus/ in which network participants agree on the transactions to apply
|
||||
* *Consensus* in which network participants agree on the transactions to apply
|
||||
to a prior ledger, based on the positions of their chosen peers.
|
||||
* /Validation/ in which network participants agree on what ledger was
|
||||
* *Validation* in which network participants agree on what ledger was
|
||||
generated, based on the ledgers generated by chosen peers.
|
||||
|
||||
These phases are continually repeated to process transactions submitted to the
|
||||
@@ -50,46 +50,46 @@ links between ledgers point backward to the parent. Also note the alternate
|
||||
Ledger 2 that was generated by some participants, but which failed validation
|
||||
and was abandoned.
|
||||
|
||||
[$images/consensus/block_chain.png]
|
||||

|
||||
|
||||
The remainder of this section describes the Consensus and Validation algorithms
|
||||
in more detail and is meant as a companion guide to understanding the generic
|
||||
implementation in =rippled=. The document *does not* discuss correctness,
|
||||
implementation in `rippled`. The document **does not** discuss correctness,
|
||||
fault-tolerance or liveness properties of the algorithms or the full details of
|
||||
how they integrate within =rippled= to support the Ripple Consensus Ledger.
|
||||
how they integrate within `rippled` to support the Ripple Consensus Ledger.
|
||||
|
||||
[section Consensus Overview]
|
||||
## Consensus Overview
|
||||
|
||||
[heading Definitions]
|
||||
### Definitions
|
||||
|
||||
* The /ledger/ is the shared distributed state. Each ledger has a unique ID to
|
||||
distinguish it from all other ledgers. During consensus, the /previous/,
|
||||
/prior/ or /last-closed/ ledger is the most recent ledger seen by consensus
|
||||
* The *ledger* is the shared distributed state. Each ledger has a unique ID to
|
||||
distinguish it from all other ledgers. During consensus, the *previous*,
|
||||
*prior* or *last-closed* ledger is the most recent ledger seen by consensus
|
||||
and is the basis upon which it will build the next ledger.
|
||||
* A /transaction/ is an instruction for an atomic change in the ledger state. A
|
||||
* A *transaction* is an instruction for an atomic change in the ledger state. A
|
||||
unique ID distinguishes a transaction from other transactions.
|
||||
* A /transaction set/ is a set of transactions under consideration by consensus.
|
||||
* A *transaction set* is a set of transactions under consideration by consensus.
|
||||
The goal of consensus is to reach agreement on this set. The generic
|
||||
consensus algorithm does not rely on an ordering of transactions within the
|
||||
set, nor does it specify how to apply a transaction set to a ledger to
|
||||
generate a new ledger. A unique ID distinguishes a set of transactions from
|
||||
all other sets of transactions.
|
||||
* A /node/ is one of the distributed actors running the consensus algorithm. It
|
||||
* A *node* is one of the distributed actors running the consensus algorithm. It
|
||||
has a unique ID to distinguish it from all other nodes.
|
||||
* A /peer/ of a node is another node that it has chosen to follow and which it
|
||||
* A *peer* of a node is another node that it has chosen to follow and which it
|
||||
believes will not collude with other chosen peers. The choice of peers is not
|
||||
symmetric, since participants can decide on their chosen sets independently.
|
||||
* A /position/ is the current belief of the next ledger's transaction set and
|
||||
close time. Position can refer to the node's own position or the position of a
|
||||
peer.
|
||||
* A /proposal/ is one of a sequence of positions a node shares during consensus.
|
||||
* A *proposal* is one of a sequence of positions a node shares during consensus.
|
||||
An initial proposal contains the starting position taken by a node before it
|
||||
considers any peer positions. If a node subsequently updates its position in
|
||||
response to its peers, it will issue an updated proposal. A proposal is
|
||||
uniquely identified by the ID of the proposing node, the ID of the position
|
||||
taken, the ID of the prior ledger the proposal is for, and the sequence number
|
||||
of the proposal.
|
||||
* A /dispute/ is a transaction that is either not part of a node's position or
|
||||
* A *dispute* is a transaction that is either not part of a node's position or
|
||||
not in a peer's position. During consensus, the node will add or remove
|
||||
disputed transactions from its position based on that transaction's support
|
||||
amongst its peers.
|
||||
@@ -101,61 +101,61 @@ contain the ID of the position of a peer. Since many peers likely have the same
|
||||
position, this reduces the need to send the full transaction set multiple times.
|
||||
Instead, a node can request the transaction set from the network if necessary.
|
||||
|
||||
[heading Overview ]
|
||||
[$images/consensus/consensus_overview.png [width 50%] [height 50%] ]
|
||||
### Overview
|
||||
|
||||

|
||||
|
||||
The diagram above is an overview of the consensus process from the perspective
|
||||
of a single participant. Recall that during a single consensus round, a node is
|
||||
trying to agree with its peers on which transactions to apply to its prior
|
||||
ledger when generating the next ledger. It also attempts to agree on the
|
||||
[link effective_close_time network time when the ledger closed]. There are
|
||||
[network time when the ledger closed](#effective_close_time). There are
|
||||
3 main phases to a consensus round:
|
||||
|
||||
* A call to =startRound= places the node in the =Open= phase. In this phase,
|
||||
* A call to `startRound` places the node in the `Open` phase. In this phase,
|
||||
the node is waiting for transactions to include in its open ledger.
|
||||
* At some point, the node will =Close= the open ledger and transition to the
|
||||
=Establish= phase. In this phase, the node shares/receives peer proposals on
|
||||
* At some point, the node will `Close` the open ledger and transition to the
|
||||
`Establish` phase. In this phase, the node shares/receives peer proposals on
|
||||
which transactions should be accepted in the closed ledger.
|
||||
* At some point, the node determines it has reached consensus with its peers on
|
||||
which transactions to include. It transitions to the =Accept= phase. In this
|
||||
which transactions to include. It transitions to the `Accept` phase. In this
|
||||
phase, the node works on applying the transactions to the prior ledger to
|
||||
generate a new closed ledger. Once the new ledger is completed, the node shares
|
||||
the validated ledger hash with the network and makes a call to =startRound= to
|
||||
the validated ledger hash with the network and makes a call to `startRound` to
|
||||
start the cycle again for the next ledger.
|
||||
|
||||
Throughout, a heartbeat timer calls =timerEntry= at a regular frequency to drive
|
||||
the process forward. Although the =startRound= call occurs at arbitrary times
|
||||
Throughout, a heartbeat timer calls `timerEntry` at a regular frequency to drive
|
||||
the process forward. Although the `startRound` call occurs at arbitrary times
|
||||
based on when the initial round began and the time it takes to apply
|
||||
transactions, the transitions from =Open= to =Establish= and =Establish= to
|
||||
=Accept= only occur during calls to =timerEntry=. Similarly, transactions can
|
||||
transactions, the transitions from `Open` to `Establish` and `Establish` to
|
||||
`Accept` only occur during calls to `timerEntry`. Similarly, transactions can
|
||||
arrive at arbitrary times, independent of the heartbeat timer. Transactions
|
||||
received after the =Open= to =Close= transition and not part of peer proposals
|
||||
received after the `Open` to `Close` transition and not part of peer proposals
|
||||
won't be considered until the next consensus round. They are represented above
|
||||
by the light green triangles.
|
||||
|
||||
Peer proposals are issued by a node during a =timerEntry= call, but since peers
|
||||
do not synchronize =timerEntry= calls, they are received by other peers at
|
||||
Peer proposals are issued by a node during a `timerEntry` call, but since peers
|
||||
do not synchronize `timerEntry` calls, they are received by other peers at
|
||||
arbitrary times. Peer proposals are only considered if received prior to the
|
||||
=Establish= to =Accept= transition, and only if the peer is working on the same
|
||||
`Establish` to `Accept` transition, and only if the peer is working on the same
|
||||
prior ledger. Peer proposals received after consensus is reached will not be
|
||||
meaningful and are represented above by the circle with the X in it. Only
|
||||
proposals from chosen peers are considered.
|
||||
|
||||
[#effective_close_time]
|
||||
[heading Effective Close Time]
|
||||
|
||||
### Effective Close Time ### {#effective_close_time}
|
||||
|
||||
In addition to agreeing on a transaction set, each consensus round tries to
|
||||
agree on the time the ledger closed. Each node calculates its own close time
|
||||
when it closes the open ledger. This exact close time is rounded to the nearest
|
||||
multiple of the current /effective close time resolution/. It is this
|
||||
/effective close time/ that nodes seek to agree on. This allows servers to
|
||||
multiple of the current *effective close time resolution*. It is this
|
||||
*effective close time* that nodes seek to agree on. This allows servers to
|
||||
derive a common time for a ledger without the need for perfectly synchronized
|
||||
clocks. As depicted below, the 3 pink arrows represent exact close times from 3
|
||||
consensus nodes that round to the same effective close time given the current
|
||||
resolution. The purple arrow represents a peer whose estimate rounds to a
|
||||
different effective close time given the current resolution.
|
||||
|
||||
[$images/consensus/EffCloseTime.png]
|
||||

|
||||
|
||||
The effective close time is part of the node's position and is shared with peers
|
||||
in its proposals. Just like the position on the consensus transaction set, a
|
||||
@@ -168,14 +168,14 @@ subsequent consensus rounds if nodes are unable to reach consensus on an
|
||||
effective close time and increasing (finer) resolution if nodes consistently
|
||||
reach close time consensus.
|
||||
|
||||
[heading Modes]
|
||||
### Modes
|
||||
|
||||
Internally, a node operates under one of the following consensus modes. Either
|
||||
of the first two modes may be chosen when a consensus round starts.
|
||||
|
||||
* /Proposing/ indicates the node is a full-fledged consensus participant. It
|
||||
* *Proposing* indicates the node is a full-fledged consensus participant. It
|
||||
takes on positions and sends proposals to its peers.
|
||||
* /Observing/ indicates the node is a passive consensus participant. It
|
||||
* *Observing* indicates the node is a passive consensus participant. It
|
||||
maintains a position internally, but does not propose that position to its
|
||||
peers. Instead, it receives peer proposals and updates its position
|
||||
to track the majority of its peers. This may be preferred if the node is only
|
||||
@@ -184,21 +184,21 @@ of the first two modes may be chosen when a consensus round starts.
|
||||
|
||||
The other two modes are set internally during the consensus round when the node
|
||||
believes it is no longer working on the dominant ledger chain based on peer
|
||||
validations. It checks this on every call to =timerEntry=.
|
||||
validations. It checks this on every call to `timerEntry`.
|
||||
|
||||
* /Wrong Ledger/ indicates the node is not working on the correct prior ledger
|
||||
* *Wrong Ledger* indicates the node is not working on the correct prior ledger
|
||||
and does not have it available. It requests that ledger from the network, but
|
||||
continues to work towards consensus this round while waiting. If it had been
|
||||
/proposing/, it will send a special "bowout" proposal to its peers to indicate
|
||||
*proposing*, it will send a special "bowout" proposal to its peers to indicate
|
||||
its change in mode for the rest of this round. For the duration of the round,
|
||||
it defers to peer positions for determining the consensus outcome as if it
|
||||
were just /observing/.
|
||||
* /Switch Ledger/ indicates that the node has acquired the correct prior ledger
|
||||
were just *observing*.
|
||||
* *Switch Ledger* indicates that the node has acquired the correct prior ledger
|
||||
from the network. Although it now has the correct prior ledger, the fact that
|
||||
it had the wrong one at some point during this round means it is likely behind
|
||||
and should defer to peer positions for determining the consensus outcome.
|
||||
|
||||
[$images/consensus/consensus_modes.png]
|
||||

|
||||
|
||||
Once either wrong ledger or switch ledger are reached, the node cannot
|
||||
return to proposing or observing until the next consensus round. However,
|
||||
@@ -212,49 +212,49 @@ time to share over the network, whereas the smaller ID could be shared in a peer
|
||||
validation much more quickly. Distinguishing the two states allows the node to
|
||||
decide how best to generate the next ledger once it declares consensus.
|
||||
|
||||
[heading Phases]
|
||||
### Phases
|
||||
|
||||
As depicted in the overview diagram, consensus is best viewed as a progression
|
||||
through 3 phases. There are 4 public methods of the generic consensus algorithm
|
||||
that determine this progression
|
||||
|
||||
* =startRound= begins a consensus round.
|
||||
* =timerEntry= is called at a regular frequency (=LEDGER_MIN_CLOSE=) and is the
|
||||
only call to consensus that can change the phase from =Open= to =Establish=
|
||||
or =Accept=.
|
||||
* =peerProposal= is called whenever a peer proposal is received and is what
|
||||
allows a node to update its position in a subsequent =timerEntry= call.
|
||||
* =gotTxSet= is called when a transaction set is received from the network. This
|
||||
* `startRound` begins a consensus round.
|
||||
* `timerEntry` is called at a regular frequency (`LEDGER_MIN_CLOSE`) and is the
|
||||
only call to consensus that can change the phase from `Open` to `Establish`
|
||||
or `Accept`.
|
||||
* `peerProposal` is called whenever a peer proposal is received and is what
|
||||
allows a node to update its position in a subsequent `timerEntry` call.
|
||||
* `gotTxSet` is called when a transaction set is received from the network. This
|
||||
is typically in response to a prior request from the node to acquire the
|
||||
transaction set corresponding to a disagreeing peer's position.
|
||||
|
||||
The following subsections describe each consensus phase in more detail and what
|
||||
actions are taken in response to these calls.
|
||||
|
||||
[h6 Open]
|
||||
#### Open
|
||||
|
||||
The =Open= phase is a quiescent period to allow transactions to build up in the
|
||||
The `Open` phase is a quiescent period to allow transactions to build up in the
|
||||
node's open ledger. The duration is a trade-off between latency and throughput.
|
||||
A shorter window reduces the latency to generating the next ledger, but also
|
||||
reduces transaction throughput due to fewer transactions accepted into the
|
||||
ledger.
|
||||
|
||||
A call to =startRound= would forcibly begin the next consensus round, skipping
|
||||
A call to `startRound` would forcibly begin the next consensus round, skipping
|
||||
completion of the current round. This is not expected during normal operation.
|
||||
Calls to =peerProposal= or =gotTxSet= simply store the proposal or transaction
|
||||
set for use in the coming =Establish= phase.
|
||||
Calls to `peerProposal` or `gotTxSet` simply store the proposal or transaction
|
||||
set for use in the coming `Establish` phase.
|
||||
|
||||
A call to =timerEntry= first checks that the node is working on the correct
|
||||
A call to `timerEntry` first checks that the node is working on the correct
|
||||
prior ledger. If not, it will update the mode and request the correct ledger.
|
||||
Otherwise, the node checks whether to switch to the =Establish= phase and close
|
||||
Otherwise, the node checks whether to switch to the `Establish` phase and close
|
||||
the ledger.
|
||||
|
||||
['Ledger Close]
|
||||
##### Ledger Close
|
||||
|
||||
Under normal circumstances, the open ledger period ends when one of the following
|
||||
is true
|
||||
|
||||
* if there are transactions in the open ledger and more than =LEDGER_MIN_CLOSE=
|
||||
* if there are transactions in the open ledger and more than `LEDGER_MIN_CLOSE`
|
||||
have elapsed. This is the typical behavior.
|
||||
* if there are no open transactions and a suitably longer idle interval has
|
||||
elapsed. This increases the opportunity to get some transaction into
|
||||
@@ -275,48 +275,48 @@ transaction.
|
||||
In the example below, we suppose our node has closed with transactions 1,2 and 3. It creates disputes
|
||||
for transactions 2,3 and 4, since at least one peer position differs on each.
|
||||
|
||||
[#disputes_image]
|
||||
[$images/consensus/disputes.png [width 20%] [height 20%]]
|
||||
##### disputes ##### {#disputes_image}
|
||||
|
||||

|
||||
|
||||
[h6 Establish]
|
||||
#### Establish
|
||||
|
||||
The establish phase is the active period of consensus in which the node
|
||||
exchanges proposals with peers in an attempt to reach agreement on the consensus
|
||||
transactions and effective close time.
|
||||
|
||||
A call to =startRound= would forcibly begin the next consensus round, skipping
|
||||
A call to `startRound` would forcibly begin the next consensus round, skipping
|
||||
completion of the current round. This is not expected during normal operation.
|
||||
Calls to =peerProposal= or =gotTxSet= that reflect new positions will generate
|
||||
Calls to `peerProposal` or `gotTxSet` that reflect new positions will generate
|
||||
disputed transactions for any new disagreements and will update the peer's vote
|
||||
for all disputed transactions.
|
||||
|
||||
A call to =timerEntry= first checks that the node is working from the correct
|
||||
A call to `timerEntry` first checks that the node is working from the correct
|
||||
prior ledger. If not, the node will update the mode and request the correct
|
||||
ledger. Otherwise, the node updates the node's position and considers whether
|
||||
to switch to the =Accepted= phase and declare consensus reached. However, at
|
||||
least =LEDGER_MIN_CONSENSUS= time must have elapsed before doing either. This
|
||||
to switch to the `Accepted` phase and declare consensus reached. However, at
|
||||
least `LEDGER_MIN_CONSENSUS` time must have elapsed before doing either. This
|
||||
allows peers an opportunity to take an initial position and share it.
|
||||
|
||||
['Update Position]
|
||||
##### Update Position
|
||||
|
||||
In order to achieve consensus, the node is looking for a transaction set that is
|
||||
supported by a super-majority of peers. The node works towards this set by
|
||||
adding or removing disputed transactions from its position based on an
|
||||
increasing threshold for inclusion.
|
||||
|
||||
[$images/consensus/threshold.png [width 50%] [height 50%]]
|
||||

|
||||
|
||||
By starting with a lower threshold, a node initially allows a wide set of
|
||||
transactions into its position. If the establish round continues and the node is
|
||||
"stuck", a higher threshold can focus on accepting transactions with the most
|
||||
support. The constants that define the thresholds and durations at which the
|
||||
thresholds change are given by `AV_XXX_CONSENSUS_PCT` and
|
||||
`AV_XXX_CONSENSUS_TIME` respectively, where =XXX= is =INIT=,=MID=,=LATE= and
|
||||
=STUCK=. The effective close time position is updated using the same
|
||||
`AV_XXX_CONSENSUS_TIME` respectively, where `XXX` is `INIT`,`MID`,`LATE` and
|
||||
`STUCK`. The effective close time position is updated using the same
|
||||
thresholds.
|
||||
|
||||
Given the [link disputes_image example disputes above] and an initial threshold
|
||||
Given the [example disputes above](#disputes_image) and an initial threshold
|
||||
of 50%, our node would retain its position since transaction 1 was not in
|
||||
dispute and transactions 2 and 3 have 75% support. Since its position did not
|
||||
change, it would not need to send a new proposal to peers. Peer C would not
|
||||
@@ -333,7 +333,7 @@ Lastly, if our node were not in the proposing mode, it would not include its own
|
||||
vote and just take the majority (>50%) position of its peers. In this example,
|
||||
our node would maintain its position of transactions 1, 2 and 3.
|
||||
|
||||
['Checking Consensus]
|
||||
##### Checking Consensus
|
||||
|
||||
After updating its position, the node checks for supermajority agreement with
|
||||
its peers on its current position. This agreement is of the exact transaction
|
||||
@@ -347,11 +347,11 @@ Consensus is declared when the following 3 clauses are true:
|
||||
* `LEDGER_MIN_CONSENSUS` time has elapsed in the establish phase
|
||||
* At least 75% of the prior round proposers have proposed OR this establish
|
||||
phase is `LEDGER_MIN_CONSENSUS` longer than the last round's establish phase
|
||||
* =minimumConsensusPercentage= of ourself and our peers share the same position
|
||||
* `minimumConsensusPercentage` of ourself and our peers share the same position
|
||||
|
||||
The middle condition ensures slower peers have a chance to share positions, but
|
||||
prevents waiting too long on peers that have disconnected. Additionally, a node
|
||||
can declare that consensus has moved on if =minimumConsensusPercentage= peers
|
||||
can declare that consensus has moved on if `minimumConsensusPercentage` peers
|
||||
have sent validations and moved on to the next ledger. This outcome indicates
|
||||
the node has fallen behind its peers and needs to catch up.
|
||||
|
||||
@@ -359,45 +359,43 @@ If a node is not proposing, it does not include its own position when
|
||||
calculating the percent of agreeing participants but otherwise follows the above
|
||||
logic.
|
||||
|
||||
['Accepting Consensus]
|
||||
##### Accepting Consensus
|
||||
|
||||
Once consensus is reached (or moved on), the node switches to the =Accept= phase
|
||||
Once consensus is reached (or moved on), the node switches to the `Accept` phase
|
||||
and signals to the implementing code that the round is complete. That code is
|
||||
responsible for using the consensus transaction set to generate the next ledger
|
||||
and calling =startRound= to begin the next round. The implementation has total
|
||||
and calling `startRound` to begin the next round. The implementation has total
|
||||
freedom on ordering transactions, deciding what to do if consensus moved on,
|
||||
determining whether to retry or abandon local transactions that did not make the
|
||||
consensus set and updating any internal state based on the consensus progress.
|
||||
|
||||
#### Accept
|
||||
|
||||
[h6 Accept]
|
||||
|
||||
The =Accept= phase is the terminal phase of the consensus algorithm. Calls to
|
||||
=timerEntry=, =peerProposal= and =gotTxSet= will not change the internal
|
||||
The `Accept` phase is the terminal phase of the consensus algorithm. Calls to
|
||||
`timerEntry`, `peerProposal` and `gotTxSet` will not change the internal
|
||||
consensus state while in the accept phase. The expectation is that the
|
||||
application specific code is working to generate the new ledger based on the
|
||||
consensus outcome. Once complete, that code should make a call to =startRound=
|
||||
to kick off the next consensus round. The =startRound= call includes the new
|
||||
consensus outcome. Once complete, that code should make a call to `startRound`
|
||||
to kick off the next consensus round. The `startRound` call includes the new
|
||||
prior ledger, prior ledger ID and whether the round should begin in the
|
||||
proposing or observing mode. After setting some initial state, the phase
|
||||
transitions to =Open=. The node will also check if the provided prior ledger
|
||||
transitions to `Open`. The node will also check if the provided prior ledger
|
||||
and ID are correct, updating the mode and requesting the proper ledger from the
|
||||
network if necessary.
|
||||
|
||||
[endsect] [/Consensus Overview]
|
||||
|
||||
[section Consensus Type Requirements]
|
||||
## Consensus Type Requirements
|
||||
|
||||
The consensus type requirements are given below as minimal implementation stubs.
|
||||
Actual implementations would augment these stubs with members appropriate for
|
||||
managing the details of transactions and ledgers within the larger application
|
||||
framework.
|
||||
|
||||
[heading Transaction]
|
||||
The transaction type =Tx= encapsulates a single transaction under consideration
|
||||
### Transaction
|
||||
|
||||
The transaction type `Tx` encapsulates a single transaction under consideration
|
||||
by consensus.
|
||||
|
||||
```
|
||||
```{.cpp}
|
||||
struct Tx
|
||||
{
|
||||
using ID = ...;
|
||||
@@ -407,13 +405,14 @@ struct Tx
|
||||
};
|
||||
```
|
||||
|
||||
[heading Transaction Set]
|
||||
The transaction set type =TxSet= represents a set of [^Tx]s that are collectively
|
||||
under consideration by consensus. A =TxSet= can be compared against other [^TxSet]s
|
||||
### Transaction Set
|
||||
|
||||
The transaction set type `TxSet` represents a set of `Tx`s that are collectively
|
||||
under consideration by consensus. A `TxSet` can be compared against other `TxSet`s
|
||||
(typically from peers) and can be modified to add or remove transactions via
|
||||
the mutable subtype.
|
||||
|
||||
```
|
||||
```{.cpp}
|
||||
struct TxSet
|
||||
{
|
||||
using Tx = Tx;
|
||||
@@ -446,22 +445,26 @@ struct TxSet
|
||||
};
|
||||
```
|
||||
|
||||
[heading Ledger] The =Ledger= type represents the state shared amongst the
|
||||
### Ledger
|
||||
|
||||
The `Ledger` type represents the state shared amongst the
|
||||
distributed participants. Notice that the details of how the next ledger is
|
||||
generated from the prior ledger and the consensus accepted transaction set is
|
||||
not part of the interface. Within the generic code, this type is primarily used
|
||||
to know that peers are working on the same tip of the ledger chain and to
|
||||
provide some basic timing data for consensus.
|
||||
|
||||
```
|
||||
```{.cpp}
|
||||
struct Ledger
|
||||
{
|
||||
using ID = ...;
|
||||
|
||||
using Seq = //std::uint32_t?...;
|
||||
|
||||
ID const & id() const;
|
||||
|
||||
// Sequence number that is 1 more than the parent ledger's seq()
|
||||
std::size_t seq() const;
|
||||
Seq seq() const;
|
||||
|
||||
// Whether the ledger's close time was a non-trivial consensus result
|
||||
bool closeAgree() const;
|
||||
@@ -480,69 +483,91 @@ struct Ledger
|
||||
//... implementation specific
|
||||
};
|
||||
```
|
||||
[heading Generic Consensus Interface]
|
||||
|
||||
Following the
|
||||
[@https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern CRTP]
|
||||
idiom, generic =Consensus= relies on a deriving class implementing a set of
|
||||
helpers and callbacks that encapsulate implementation specific details of the
|
||||
algorithm. Below are excerpts of the generic consensus implementation and of
|
||||
helper types that will interact with the concrete implementing class.
|
||||
### PeerProposal
|
||||
|
||||
```
|
||||
The `PeerProposal` type represents the signed position taken
|
||||
by a peer during consensus. The only type requirement is owning an instance of a
|
||||
generic `ConsensusProposal`.
|
||||
|
||||
```{.cpp}
|
||||
// Represents our proposed position or a peer's proposed position
|
||||
// and is provided with the generic code
|
||||
template <class NodeID_t, class LedgerID_t, class Position_t> class ConsensusProposal;
|
||||
|
||||
struct PeerPosition
|
||||
{
|
||||
ConsensusProposal<
|
||||
NodeID_t,
|
||||
typename Ledger::ID,
|
||||
typename TxSet::ID> const &
|
||||
proposal() const;
|
||||
|
||||
// ... implementation specific
|
||||
};
|
||||
```
|
||||
|
||||
### Generic Consensus Interface
|
||||
|
||||
The generic `Consensus` relies on `Adaptor` template class to implement a set
|
||||
of helper functions that plug the consensus algorithm into a specific application.
|
||||
The `Adaptor` class also defines the types above needed by the algorithm. Below
|
||||
are excerpts of the generic consensus implementation and of helper types that will
|
||||
interact with the concrete implementing class.
|
||||
|
||||
```{.cpp}
|
||||
// Represents a transction under dispute this round
|
||||
template <class Tx_t, class NodeID_t> class DisputedTx;
|
||||
|
||||
template <class Derived, class Traits> class Consensus
|
||||
// Represents how the node participates in Consensus this round
|
||||
enum class ConsensusMode { proposing, observing, wrongLedger, switchedLedger};
|
||||
|
||||
// Measure duration of phases of consensus
|
||||
class ConsensusTimer
|
||||
{
|
||||
protected:
|
||||
enum class Mode { proposing, observing, wrongLedger, switchedLedger};
|
||||
|
||||
// Measure duration of phases of consensus
|
||||
class Stopwatch
|
||||
{
|
||||
public:
|
||||
std::chrono::milliseconds read() const;
|
||||
// details omitted ...
|
||||
};
|
||||
|
||||
// Initial ledger close times, not rounded by closeTimeResolution
|
||||
// Used to gauge degree of synchronization between a node and its peers
|
||||
struct CloseTimes
|
||||
{
|
||||
std::map<NetClock::time_point, int> peers;
|
||||
NetClock::time_point self;
|
||||
};
|
||||
|
||||
// Encapsulates the result of consensus.
|
||||
struct Result
|
||||
{
|
||||
//! The set of transactions consensus agrees go in the ledger
|
||||
TxSet_t set;
|
||||
|
||||
//! Our proposed position on transactions/close time
|
||||
Proposal_t position;
|
||||
|
||||
//! Transactions which are under dispute with our peers
|
||||
using Dispute_t = DisputedTx<Tx_t, NodeID_t>;
|
||||
hash_map<typename Tx_t::ID, Dispute_t> disputes;
|
||||
|
||||
// Set of TxSet ids we have already compared/created disputes
|
||||
hash_set<typename TxSet_t::ID> compares;
|
||||
|
||||
// Measures the duration of the establish phase for this consensus round
|
||||
Stopwatch roundTime;
|
||||
|
||||
// Indicates state in which consensus ended. Once in the accept phase
|
||||
// will be either Yes or MovedOn
|
||||
ConsensusState state = ConsensusState::No;
|
||||
};
|
||||
|
||||
public:
|
||||
std::chrono::milliseconds read() const;
|
||||
// details omitted ...
|
||||
};
|
||||
|
||||
// Initial ledger close times, not rounded by closeTimeResolution
|
||||
// Used to gauge degree of synchronization between a node and its peers
|
||||
struct ConsensusCloseTimes
|
||||
{
|
||||
std::map<NetClock::time_point, int> peers;
|
||||
NetClock::time_point self;
|
||||
};
|
||||
|
||||
// Encapsulates the result of consensus.
|
||||
template <class Adaptor>
|
||||
struct ConsensusResult
|
||||
{
|
||||
//! The set of transactions consensus agrees go in the ledger
|
||||
Adaptor::TxSet_t set;
|
||||
|
||||
//! Our proposed position on transactions/close time
|
||||
ConsensusProposal<...> position;
|
||||
|
||||
//! Transactions which are under dispute with our peers
|
||||
hash_map<Adaptor::Tx_t::ID, DisputedTx<...>> disputes;
|
||||
|
||||
// Set of TxSet ids we have already compared/created disputes
|
||||
hash_set<typename Adaptor::TxSet_t::ID> compares;
|
||||
|
||||
// Measures the duration of the establish phase for this consensus round
|
||||
ConsensusTimer roundTime;
|
||||
|
||||
// Indicates state in which consensus ended. Once in the accept phase
|
||||
// will be either Yes or MovedOn
|
||||
ConsensusState state = ConsensusState::No;
|
||||
};
|
||||
|
||||
template <class Adaptor>
|
||||
class Consensus
|
||||
{
|
||||
public:
|
||||
Consensus(clock_type, Adaptor &, beast::journal);
|
||||
|
||||
// Kick-off the next round of consensus.
|
||||
void startRound(
|
||||
NetClock::time_point const& now,
|
||||
@@ -563,31 +588,26 @@ public:
|
||||
// ... details
|
||||
};
|
||||
```
|
||||
[heading Adapting Generic Consensus]
|
||||
|
||||
### Adapting Generic Consensus
|
||||
|
||||
The stub below shows the set of callback/helper functions required in the implementing class.
|
||||
|
||||
```
|
||||
struct Traits
|
||||
```{.cpp}
|
||||
struct Adaptor
|
||||
{
|
||||
using Ledger_t = Ledger;
|
||||
using TxSet_t = TxSet;
|
||||
using NodeID_t = ...; // Integer-like std::uint32_t to uniquely identify a node
|
||||
using Ledger_t = Ledger;
|
||||
using TxSet_t = TxSet;
|
||||
using PeerProposal_t = PeerProposal;
|
||||
using NodeID_t = ...; // Integer-like std::uint32_t to uniquely identify a node
|
||||
|
||||
};
|
||||
|
||||
class ConsensusImp : public Consensus<ConsensusImp, Traits>
|
||||
{
|
||||
// Attempt to acquire a specific ledger from the network.
|
||||
boost::optional<Ledger> acquireLedger(Ledger::ID const & ledgerID);
|
||||
|
||||
// Acquire the transaction set associated with a proposed position.
|
||||
boost::optional<TxSet> acquireTxSet(TxSet::ID const & setID);
|
||||
|
||||
// Get peers' proposed positions. Returns an iterable
|
||||
// with value_type convertable to ConsensusPosition<...>
|
||||
auto const & proposals(Ledger::ID const & ledgerID);
|
||||
|
||||
// Whether any transactions are in the open ledger
|
||||
bool hasOpenTransactions() const;
|
||||
|
||||
@@ -602,30 +622,33 @@ class ConsensusImp : public Consensus<ConsensusImp, Traits>
|
||||
// application thinks consensus should use as the prior ledger.
|
||||
Ledger::ID getPrevLedger(Ledger::ID const & prevLedgerID,
|
||||
Ledger const & prevLedger,
|
||||
Mode mode);
|
||||
ConsensusMode mode);
|
||||
|
||||
// Called when consensus operating mode changes
|
||||
void onModeChange(ConsensuMode before, ConsensusMode after);
|
||||
|
||||
// Called when ledger closes. Implementation should generate an initial Result
|
||||
// with position based on the current open ledger's transactions.
|
||||
Result onClose(Ledger const &, Ledger const & prev, Mode mode);
|
||||
ConsensusResult onClose(Ledger const &, Ledger const & prev, ConsensusMode mode);
|
||||
|
||||
// Called when ledger is accepted by consensus
|
||||
void onAccept(Result const & result,
|
||||
void onAccept(ConsensusResult const & result,
|
||||
RCLCxLedger const & prevLedger,
|
||||
NetClock::duration closeResolution,
|
||||
CloseTimes const & rawCloseTimes,
|
||||
Mode const & mode);
|
||||
ConsensusCloseTimes const & rawCloseTimes,
|
||||
ConsensusMode const & mode);
|
||||
|
||||
// Propose the position to peers.
|
||||
void propose(ConsensusProposal<...> const & pos);
|
||||
|
||||
// Relay a received peer proposal on to other peer's.
|
||||
void relay(ConsensusProposal<...> const & pos);
|
||||
// Share a received peer proposal with other peers.
|
||||
void share(PeerPosition_t const & pos);
|
||||
|
||||
// Relay a disputed transaction to peers
|
||||
void relay(TxSet::Tx const & tx);
|
||||
// Share a disputed transaction with peers
|
||||
void share(TxSet::Tx const & tx);
|
||||
|
||||
// Realy given transaction set with peers
|
||||
void relay(TxSet const &s);
|
||||
// Share given transaction set with peers
|
||||
void share(TxSet const &s);
|
||||
|
||||
//... implementation specific
|
||||
};
|
||||
@@ -634,30 +657,27 @@ class ConsensusImp : public Consensus<ConsensusImp, Traits>
|
||||
The implementing class hides many details of the peer communication
|
||||
model from the generic code.
|
||||
|
||||
* The =relay= member functions are responsible for sharing the given type with a
|
||||
* The `share` member functions are responsible for sharing the given type with a
|
||||
node's peers, but are agnostic to the mechanism. Ideally, messages are delivered
|
||||
faster than =LEDGER_GRANULARITY=.
|
||||
faster than `LEDGER_GRANULARITY`.
|
||||
* The generic code does not specify how transactions are submitted by clients,
|
||||
propagated through the network or stored in the open ledger. Indeed, the open
|
||||
ledger is only conceptual from the perspective of the generic code---the
|
||||
initial position and transaction set are opaquely generated in a
|
||||
`Consensus::Result` instance returned from the =onClose= callback.
|
||||
* The calls to =acquireLedger= and =acquireTxSet= only have non-trivial return
|
||||
`Consensus::Result` instance returned from the `onClose` callback.
|
||||
* The calls to `acquireLedger` and `acquireTxSet` only have non-trivial return
|
||||
if the ledger or transaction set of interest is available. The implementing
|
||||
class is free to block while acquiring, or return the empty option while
|
||||
servicing the request asynchronously. Due to legacy reasons, the two calls
|
||||
are not symmetric. =acquireTxSet= requires the host application to call
|
||||
=gotTxSet= when an asynchronous =acquire= completes. Conversely,
|
||||
=acquireLedger= will be called again later by the consensus code if it still
|
||||
are not symmetric. `acquireTxSet` requires the host application to call
|
||||
`gotTxSet` when an asynchronous `acquire` completes. Conversely,
|
||||
`acquireLedger` will be called again later by the consensus code if it still
|
||||
desires the ledger with the hope that the asynchronous acquisition is
|
||||
complete.
|
||||
|
||||
[endsect] [/Consensus Type Requirements]
|
||||
|
||||
[section Validation]
|
||||
## Validation
|
||||
|
||||
Coming Soon!
|
||||
|
||||
[endsect] [/Validation]
|
||||
|
||||
[endsect] [/Consensus and Validation]
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 13 KiB |
BIN
docs/images/flow1.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
docs/images/flow2.png
Normal file
|
After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
@@ -1,39 +0,0 @@
|
||||
[/
|
||||
Copyright (c) Copyright (c) 2012-2017 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.
|
||||
]
|
||||
|
||||
[library rippled
|
||||
[quickbook 1.6]
|
||||
[copyright 2012 - 2017 Ripple Labs Inc.]
|
||||
[purpose C++ Library]
|
||||
[license
|
||||
Distributed under the ISC License
|
||||
]
|
||||
[authors [Labs, Ripple]]
|
||||
[category template]
|
||||
[category generic]
|
||||
]
|
||||
|
||||
[template mdash[] '''— ''']
|
||||
[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
|
||||
[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
|
||||
|
||||
[include consensus.qbk]
|
||||
|
||||
[section:ref Reference]
|
||||
[include temp/reference.qbk]
|
||||
[endsect]
|
||||
|
||||
[xinclude index.xml]
|
||||
@@ -1,61 +0,0 @@
|
||||
<?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>
|
||||
24
docs/sample_chart.doc
Normal file
@@ -0,0 +1,24 @@
|
||||
/*!
|
||||
\page somestatechart Example state diagram
|
||||
|
||||
\startuml SomeState "my state diagram"
|
||||
scale 600 width
|
||||
|
||||
[*] -> State1
|
||||
State1 --> State2 : Succeeded
|
||||
State1 --> [*] : Aborted
|
||||
State2 --> State3 : Succeeded
|
||||
State2 --> [*] : Aborted
|
||||
state State3 {
|
||||
state "Accumulate Enough Data\nLong State Name" as long1
|
||||
long1 : Just a test
|
||||
[*] --> long1
|
||||
long1 --> long1 : New Data
|
||||
long1 --> ProcessData : Enough Data
|
||||
}
|
||||
State3 --> State3 : Failed
|
||||
State3 --> [*] : Succeeded / Save Result
|
||||
State3 --> [*] : Aborted
|
||||
|
||||
\enduml
|
||||
*/
|
||||
@@ -6,6 +6,7 @@ PROJECT_NAME = "rippled"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_BRIEF = C++ Library
|
||||
PROJECT_LOGO =
|
||||
PROJECT_LOGO = images/LogoForDocumentation.png
|
||||
OUTPUT_DIRECTORY =
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
@@ -111,8 +112,12 @@ INPUT = \
|
||||
../src/test/jtx/WSClient.h \
|
||||
../src/ripple/consensus/Consensus.h \
|
||||
../src/ripple/consensus/ConsensusProposal.h \
|
||||
../src/ripple/consensus/ConsensusTypes.h \
|
||||
../src/ripple/consensus/DisputedTx.h \
|
||||
../src/ripple/consensus/LedgerTiming.h \
|
||||
../src/ripple/consensus/LedgerTrie.h \
|
||||
../src/ripple/consensus/Validations.h \
|
||||
../src/ripple/consensus/ConsensusParms.h \
|
||||
../src/ripple/app/consensus/RCLCxTx.h \
|
||||
../src/ripple/app/consensus/RCLCxLedger.h \
|
||||
../src/ripple/app/consensus/RCLConsensus.h \
|
||||
@@ -120,6 +125,42 @@ INPUT = \
|
||||
../src/ripple/app/tx/apply.h \
|
||||
../src/ripple/app/tx/applySteps.h \
|
||||
../src/ripple/app/tx/impl/InvariantCheck.h \
|
||||
../src/ripple/app/consensus/RCLValidations.h \
|
||||
../src/README.md \
|
||||
../src/ripple/README.md \
|
||||
../README.md \
|
||||
../RELEASENOTES.md \
|
||||
../docs/CodingStyle.md \
|
||||
../docs/CheatSheet.md \
|
||||
../docs/README.md \
|
||||
../docs/sample_chart.doc \
|
||||
../docs/HeapProfiling.md \
|
||||
../docs/Docker.md \
|
||||
../docs/consensus.md \
|
||||
../Builds/XCode/README.md \
|
||||
../Builds/VisualStudio2015/README.md \
|
||||
../src/ripple/consensus/README.md \
|
||||
../src/ripple/app/consensus/README.md \
|
||||
../src/test/csf/README.md \
|
||||
../src/ripple/basics/README.md \
|
||||
../src/ripple/crypto/README.md \
|
||||
../src/ripple/peerfinder/README.md \
|
||||
../src/ripple/app/misc/README.md \
|
||||
../src/ripple/app/misc/FeeEscalation.md \
|
||||
../src/ripple/app/ledger/README.md \
|
||||
../src/ripple/app/paths/README.md \
|
||||
../src/ripple/app/tx/README.md \
|
||||
../src/ripple/proto/README.md \
|
||||
../src/ripple/shamap/README.md \
|
||||
../src/ripple/protocol/README.md \
|
||||
../src/ripple/json/README.md \
|
||||
../src/ripple/json/TODO.md \
|
||||
../src/ripple/resource/README.md \
|
||||
../src/ripple/rpc/README.md \
|
||||
../src/ripple/overlay/README.md \
|
||||
../src/ripple/nodestore/README.md \
|
||||
../src/ripple/nodestore/Benchmarks.md \
|
||||
|
||||
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS =
|
||||
@@ -131,12 +172,16 @@ EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
IMAGE_PATH = \
|
||||
./images/ \
|
||||
./images/consensus/ \
|
||||
../src/test/csf/ \
|
||||
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
USE_MDFILE_AS_MAINPAGE = ../src/README.md
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
@@ -163,8 +208,8 @@ IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = NO
|
||||
HTML_OUTPUT = dhtm
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html_doc
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
@@ -264,8 +309,8 @@ MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = YES
|
||||
XML_OUTPUT = temp/
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = temp
|
||||
XML_PROGRAMLISTING = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -341,7 +386,7 @@ DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_JAR_PATH = $(PLANTUML_JAR)
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
|
||||
BIN
images/flow1.png
|
Before Width: | Height: | Size: 102 KiB |
BIN
images/flow2.png
|
Before Width: | Height: | Size: 90 KiB |
@@ -1,165 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#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.
|
||||
The default is to include inline unit test definitions.
|
||||
*/
|
||||
|
||||
#ifndef BEAST_NO_UNIT_TEST_INLINE
|
||||
//#define BEAST_NO_UNIT_TEST_INLINE 1
|
||||
#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.
|
||||
*/
|
||||
#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
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Ripple
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Config: RIPPLE_VERIFY_NODEOBJECT_KEYS
|
||||
This verifies that the hash of node objects matches the payload.
|
||||
It is quite expensive so normally this is turned off!
|
||||
*/
|
||||
#ifndef RIPPLE_VERIFY_NODEOBJECT_KEYS
|
||||
//#define RIPPLE_VERIFY_NODEOBJECT_KEYS 1
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_DUMP_LEAKS_ON_EXIT
|
||||
Displays heap blocks and counted objects which were not disposed of
|
||||
during exit.
|
||||
*/
|
||||
#ifndef RIPPLE_DUMP_LEAKS_ON_EXIT
|
||||
#define RIPPLE_DUMP_LEAKS_ON_EXIT 1
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// These control whether or not certain functionality gets
|
||||
// compiled into the resulting rippled executable
|
||||
|
||||
/** Config: RIPPLE_ROCKSDB_AVAILABLE
|
||||
Controls whether or not the RocksDB database back-end is compiled into
|
||||
rippled. RocksDB requires a relatively modern C++ compiler (tested with
|
||||
gcc versions 4.8.1 and later) that supports some C++11 features.
|
||||
*/
|
||||
#ifndef RIPPLE_ROCKSDB_AVAILABLE
|
||||
//#define RIPPLE_ROCKSDB_AVAILABLE 0
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Here temporarily to turn off new Validations code while it
|
||||
// is being written.
|
||||
//
|
||||
#ifndef RIPPLE_USE_VALIDATORS
|
||||
#define RIPPLE_USE_VALIDATORS 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.
|
||||
*/
|
||||
#ifndef RIPPLE_SINGLE_IO_SERVICE_THREAD
|
||||
#define RIPPLE_SINGLE_IO_SERVICE_THREAD 0
|
||||
#endif
|
||||
|
||||
// Uses OpenSSL instead of alternatives
|
||||
#ifndef RIPPLE_USE_OPENSSL
|
||||
#define RIPPLE_USE_OPENSSL 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
23
src/beast/.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
PLEASE DON'T FORGET TO "STAR" THIS REPOSITORY :)
|
||||
|
||||
When reporting a bug please include the following:
|
||||
|
||||
### Version of Beast
|
||||
|
||||
You can find the version number in <beast/version.hpp>
|
||||
or using the command "git log -1".
|
||||
|
||||
### Steps necessary to reproduce the problem
|
||||
|
||||
A small compiling program is the best. If your code is
|
||||
public, you can provide a link to the repository.
|
||||
|
||||
### All relevant compiler information
|
||||
|
||||
If you are unable to compile please include the type and
|
||||
version of compiler you are using as well as all compiler
|
||||
output including the error message, file, and line numbers
|
||||
involved.
|
||||
|
||||
The more information you provide the sooner your issue
|
||||
can get resolved!
|
||||
5
src/beast/.gitignore
vendored
@@ -1,2 +1,7 @@
|
||||
bin/
|
||||
bin64/
|
||||
|
||||
# Because of CMake and VS2017
|
||||
Win32/
|
||||
x64/
|
||||
|
||||
|
||||
@@ -11,17 +11,15 @@ env:
|
||||
# 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'
|
||||
- BOOST_ROOT=$HOME/boost_1_58_0
|
||||
- BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz'
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages:
|
||||
- gcc-5
|
||||
- g++-5
|
||||
sources: &base_sources
|
||||
- ubuntu-toolchain-r-test
|
||||
packages: &base_packages
|
||||
- python-software-properties
|
||||
- libssl-dev
|
||||
- libffi-dev
|
||||
- libstdc++6
|
||||
- binutils-gold
|
||||
@@ -35,35 +33,81 @@ addons:
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# GCC/Coverage/Autobahn (if master or develop branch)
|
||||
# gcc coverage
|
||||
- compiler: gcc
|
||||
env:
|
||||
- GCC_VER=6
|
||||
- VARIANT=coverage
|
||||
- ADDRESS_MODEL=64
|
||||
- DO_VALGRIND=false
|
||||
- BUILD_SYSTEM=cmake
|
||||
- PATH=$PWD/cmake/bin:$PATH
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-6
|
||||
- g++-6
|
||||
- libssl-dev
|
||||
- *base_packages
|
||||
sources:
|
||||
- *base_sources
|
||||
|
||||
# older GCC, release
|
||||
- compiler: gcc
|
||||
env:
|
||||
- GCC_VER=4.8
|
||||
- VARIANT=release
|
||||
- DO_VALGRIND=false
|
||||
- ADDRESS_MODEL=64
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- *base_packages
|
||||
sources:
|
||||
- *base_sources
|
||||
|
||||
# later GCC
|
||||
- compiler: gcc
|
||||
env:
|
||||
- GCC_VER=5
|
||||
- VARIANT=coverage
|
||||
- VARIANT=release
|
||||
- DO_VALGRIND=true
|
||||
- ADDRESS_MODEL=64
|
||||
- BUILD_SYSTEM=cmake
|
||||
- PATH=$PWD/cmake/bin:$PATH
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-5
|
||||
- g++-5
|
||||
- libssl-dev
|
||||
- *base_packages
|
||||
sources:
|
||||
- *base_sources
|
||||
|
||||
# Clang/UndefinedBehaviourSanitizer
|
||||
# clang ubsan+asan
|
||||
- compiler: clang
|
||||
env:
|
||||
- GCC_VER=5
|
||||
- VARIANT=usan
|
||||
- VARIANT=ubasan
|
||||
- CLANG_VER=3.8
|
||||
- DO_VALGRIND=false
|
||||
- ADDRESS_MODEL=64
|
||||
- UBSAN_OPTIONS='print_stacktrace=1'
|
||||
- BUILD_SYSTEM=cmake
|
||||
- PATH=$PWD/cmake/bin:$PATH
|
||||
- PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH
|
||||
|
||||
# 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:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-5
|
||||
- g++-5
|
||||
- libssl-dev
|
||||
- *base_packages
|
||||
sources:
|
||||
- *base_sources
|
||||
|
||||
cache:
|
||||
directories:
|
||||
@@ -72,7 +116,7 @@ cache:
|
||||
- llvm-$LLVM_VERSION
|
||||
- cmake
|
||||
|
||||
before_install:
|
||||
before_install: &base_before_install
|
||||
- scripts/install-dependencies.sh
|
||||
|
||||
script:
|
||||
|
||||
@@ -1,3 +1,829 @@
|
||||
Version 79:
|
||||
|
||||
* Remove spurious fallthrough guidance
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 78:
|
||||
|
||||
* Add span
|
||||
* Documentation work
|
||||
* Use make_unique_noinit
|
||||
* Fix warning in zlib
|
||||
* Header file tidying
|
||||
* Tidy up FieldsReader doc
|
||||
* Add Boost.Locale utf8 benchmark comparison
|
||||
* Tidy up dstream for existing Boost versions
|
||||
* Tidy up file_posix unused variable
|
||||
* Fix warning in root ca declaration
|
||||
|
||||
HTTP:
|
||||
|
||||
* Tidy up basic_string_body
|
||||
* Add vector_body
|
||||
* span, string, vector bodies are public
|
||||
* Fix spurious uninitialized warning
|
||||
* fields temp string uses allocator
|
||||
|
||||
API Changes:
|
||||
|
||||
* Add message::keep_alive()
|
||||
* Add message::chunked() and message::content_length()
|
||||
* Remove string_view_body
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Change user defined implementations of Fields and
|
||||
FieldsReader to meet the new requirements.
|
||||
|
||||
* Use span_body<char> instead of string_view_body
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 77:
|
||||
|
||||
* file_posix works without large file support
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 76:
|
||||
|
||||
* Always go through write_some
|
||||
* Use Boost.Config
|
||||
* BodyReader may construct from a non-const message
|
||||
* Add serializer::get
|
||||
* Add serializer::chunked
|
||||
* Serializer members are not const
|
||||
* serializing file_body is not const
|
||||
* Add file_body_win32
|
||||
* Fix parse illegal characters in obs-fold
|
||||
* Disable SSE4.2 optimizations
|
||||
|
||||
API Changes:
|
||||
|
||||
* Rename to serializer::keep_alive
|
||||
* BodyReader, BodyWriter use two-phase init
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Use serializer::keep_alive instead of serializer::close and
|
||||
take the logical NOT of the return value.
|
||||
|
||||
* Modify instances of user-defined BodyReader and BodyWriter
|
||||
types to perfrom two-phase initialization, as per the
|
||||
updated documented type requirements.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 75:
|
||||
|
||||
* Use file_body for valid requests, string_body otherwise.
|
||||
* Construct buffer_prefix_view in-place
|
||||
* Shrink serializer buffers using buffers_ref
|
||||
* Tidy up BEAST_NO_BIG_VARIANTS
|
||||
* Shrink serializer buffers using buffers_ref
|
||||
* Add serializer::limit
|
||||
* file_body tests
|
||||
* Using SSE4.2 intrinsics in basic_parser if available
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 74:
|
||||
|
||||
* Add file_stdio and File concept
|
||||
* Add file_win32
|
||||
* Add file_body
|
||||
* Remove common/file_body.hpp
|
||||
* Add file_posix
|
||||
* Fix Beast include directories for cmake targets
|
||||
* remove redundant flush() from example
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 73:
|
||||
|
||||
* Jamroot tweak
|
||||
* Verify certificates in SSL clients
|
||||
* Adjust benchmarks
|
||||
* Initialize local variable in basic_parser
|
||||
* Fixes for gcc-4.8
|
||||
|
||||
HTTP:
|
||||
|
||||
* basic_parser optimizations
|
||||
* Add basic_parser tests
|
||||
|
||||
API Changes:
|
||||
|
||||
* Refactor header and message constructors
|
||||
* serializer::next replaces serializer::get
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Evaluate each message constructor call site and
|
||||
adjust the constructor argument list as needed.
|
||||
|
||||
* Use serializer::next instead of serializer::get at call sites
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 72:
|
||||
|
||||
HTTP:
|
||||
|
||||
* Tidy up set payload in http-server-fast
|
||||
* Refine Body::size specification
|
||||
* Newly constructed responses have a 200 OK result
|
||||
* Refactor file_body for best practices
|
||||
* Add http-server-threaded example
|
||||
* Documentation tidying
|
||||
* Various improvements to http_server_fast.cpp
|
||||
|
||||
WebSocket:
|
||||
|
||||
* Add websocket-server-async example
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 71:
|
||||
|
||||
* Fix extra ; warning
|
||||
* Documentation revision
|
||||
* Fix spurious on_chunk invocation
|
||||
* Call prepare_payload in HTTP example
|
||||
* Check trailers in test
|
||||
* Fix buffer overflow handling for string_body and mutable_body
|
||||
* Concept check in basic_dynamic_body
|
||||
* Tidy up http_sync_port error check
|
||||
* Tidy up Jamroot /permissive-
|
||||
|
||||
WebSockets:
|
||||
|
||||
* Fine tune websocket op asserts
|
||||
* Refactor websocket composed ops
|
||||
* Allow close, ping, and write to happen concurrently
|
||||
* Fix race in websocket read op
|
||||
* Fix websocket write op
|
||||
* Add cmake options for examples and tests
|
||||
|
||||
API Changes:
|
||||
|
||||
* Return `std::size_t` from `Body::writer::put`
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Return the number of bytes actually transferred from the
|
||||
input buffers in user defined `Body::writer::put` functions.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 70:
|
||||
|
||||
* Serialize in one step when possible
|
||||
* Add basic_parser header and body limits
|
||||
* Add parser::on_header to set a callback
|
||||
* Fix BEAST_FALLTHROUGH
|
||||
* Fix HEAD response in file_service
|
||||
|
||||
API Changes:
|
||||
|
||||
* Rename to message::base
|
||||
* basic_parser default limits are now 1MB/8MB
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Change calls to message::header_part() with message::base()
|
||||
|
||||
* Call body_limit and/or header_limit as needed to adjust the
|
||||
limits to suitable values if the defaults are insufficient.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 69:
|
||||
|
||||
* basic_parser optimizations
|
||||
* Use BEAST_FALLTHROUGH to silence warnings
|
||||
* Add /permissive- to msvc toolchain
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 68:
|
||||
|
||||
* Split common tests to a new project
|
||||
* Small speed up in fields comparisons
|
||||
* Adjust buffer size in fast server
|
||||
* Use string_ref in older Boost versions
|
||||
* Optimize field lookups
|
||||
* Add const_body, mutable_body to examples
|
||||
* Link statically on cmake MSVC
|
||||
|
||||
API Changes:
|
||||
|
||||
* Change BodyReader, BodyWriter requirements
|
||||
* Remove BodyReader::is_deferred
|
||||
* http::error::bad_target replaces bad_path
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Change user defined instances of BodyReader and BodyWriter
|
||||
to meet the new requirements.
|
||||
|
||||
* Replace references to http::error::bad_path with http::error::bad_target
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 67:
|
||||
|
||||
* Fix doc example link
|
||||
* Add http-server-small example
|
||||
* Merge stream_base to stream and tidy
|
||||
* Use boost::string_view
|
||||
* Rename to http-server-fast
|
||||
* Appveyor use Boost 1.64.0
|
||||
* Group common example headers
|
||||
|
||||
API Changes:
|
||||
|
||||
* control_callback replaces ping_callback
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Change calls to websocket::stream::ping_callback to use
|
||||
websocket::stream::control_callback
|
||||
|
||||
* Change user defined ping callbacks to have the new
|
||||
signature and adjust the callback definition appropriately.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 66:
|
||||
|
||||
* string_param optimizations
|
||||
* Add serializer request/response aliases
|
||||
* Make consuming_buffers smaller
|
||||
* Fix costly potential value-init in parser
|
||||
* Fix unused parameter warning
|
||||
* Handle bad_alloc in parser
|
||||
* Tidy up message piecewise ctors
|
||||
* Add header aliases
|
||||
* basic_fields optimizations
|
||||
* Add http-server example
|
||||
* Squelch spurious warning on gcc
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 65:
|
||||
|
||||
* Enable narrowing warning on msvc cmake
|
||||
* Fix integer types in deflate_stream::bi_reverse
|
||||
* Fix narrowing in static_ostream
|
||||
* Fix narrowing in ostream
|
||||
* Fix narrowing in inflate_stream
|
||||
* Fix narrowing in deflate_stream
|
||||
* Fix integer warnings
|
||||
* Enable unused variable warning on msvc cmake
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 64:
|
||||
|
||||
* Simplify buffered_read_stream composed op
|
||||
* Simplify ssl teardown composed op
|
||||
* Simplify websocket write_op
|
||||
* Exemplars are compiled code
|
||||
* Better User-Agent in examples
|
||||
* async_write requires a non-const message
|
||||
* Doc tidying
|
||||
* Add link_directories to cmake
|
||||
|
||||
API Changes:
|
||||
|
||||
* Remove make_serializer
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Replace calls to make_serializer with variable declarations
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 63:
|
||||
|
||||
* Use std::to_string instead of lexical_cast
|
||||
* Don't use cached Boost
|
||||
* Put num_jobs back up on Travis
|
||||
* Only build and run tests in variant=coverage
|
||||
* Move benchmarks to a separate project
|
||||
* Only run the tests under ubasan
|
||||
* Tidy up CMakeLists.txt
|
||||
* Tidy up Jamfiles
|
||||
* Control running with valgrind explicitly
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 62:
|
||||
|
||||
* Remove libssl-dev from a Travis matrix item
|
||||
* Increase detail::static_ostream coverage
|
||||
* Add server-framework tests
|
||||
* Doc fixes and tidy
|
||||
* Tidy up namespaces in examples
|
||||
* Clear the error faster
|
||||
* Avoid explicit operator bool for error
|
||||
* Add http::is_fields trait
|
||||
* Squelch harmless not_connected errors
|
||||
* Put slow tests back for coverage builds
|
||||
|
||||
API Changes:
|
||||
|
||||
* parser requires basic_fields
|
||||
* Refine FieldsReader concept
|
||||
* message::prepare_payload replaces message::prepare
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Callers using `parser` with Fields types other than basic_fields
|
||||
will need to create their own subclass of basic_parser to work
|
||||
with their custom fields type.
|
||||
|
||||
* Implement chunked() and keep_alive() for user defined FieldsReader types.
|
||||
|
||||
* Change calls to msg.prepare to msg.prepare_payload. For messages
|
||||
with a user-defined Fields, provide the function prepare_payload_impl
|
||||
in the fields type according to the Fields requirements.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 61:
|
||||
|
||||
* Remove Spirit dependency
|
||||
* Use generic_cateogry for errno
|
||||
* Reorganize SSL examples
|
||||
* Tidy up some integer conversion warnings
|
||||
* Add message::header_part()
|
||||
* Tidy up names in error categories
|
||||
* Flush the output stream in the example
|
||||
* Clean close in Secure WebSocket client
|
||||
* Add server-framework SSL HTTP and WebSocket ports
|
||||
* Fix shadowing warnings
|
||||
* Tidy up http-crawl example
|
||||
* Add multi_port to server-framework
|
||||
* Tidy up resolver calls
|
||||
* Use one job on CI
|
||||
* Don't run slow tests on certain targets
|
||||
|
||||
API Changes:
|
||||
|
||||
* header::version is unsigned
|
||||
* status-codes is unsigned
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 60:
|
||||
|
||||
* String comparisons are public interfaces
|
||||
* Fix response message type in async websocket accept
|
||||
* New server-framework, full featured server example
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 59:
|
||||
|
||||
* Integrated Beast INTERFACE (cmake)
|
||||
* Fix base64 alphabet
|
||||
* Remove obsolete doc/README.md
|
||||
|
||||
API Changes:
|
||||
|
||||
* Change Body::size signature (API Change):
|
||||
|
||||
Actions Required:
|
||||
|
||||
* For any user-defined models of Body, change the function signature
|
||||
to accept `value_type const&` and modify the function definition
|
||||
accordingly.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 58:
|
||||
|
||||
* Fix unaligned reads in utf8-checker
|
||||
* Qualify size_t in message template
|
||||
* Reorganize examples
|
||||
* Specification for http read
|
||||
* Avoid `std::string` in websocket
|
||||
* Fix basic_fields insert ordering
|
||||
* basic_fields::set optimization
|
||||
* basic_parser::put doc
|
||||
* Use static string in basic_fields::reader
|
||||
* Remove redundant code
|
||||
* Fix parsing chunk size with leading zeroes
|
||||
* Better message formal parameter names
|
||||
|
||||
API Changes:
|
||||
|
||||
* `basic_fields::set` renamed from `basic_fields::replace`
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Rename calls to `basic_fields::replace` to `basic_fields::set`
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 57:
|
||||
|
||||
* Fix message.hpp javadocs
|
||||
* Fix warning in basic_parser.cpp
|
||||
* Integrate docca for documentation and tidy
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 56:
|
||||
|
||||
* Add provisional IANA header field names
|
||||
* Add string_view_body
|
||||
* Call on_chunk when the extension is empty
|
||||
* HTTP/1.1 is the default version
|
||||
* Try harder to find Boost (cmake)
|
||||
* Reset error codes
|
||||
* More basic_parser tests
|
||||
* Add an INTERFACE cmake target
|
||||
* Convert buffer in range loops
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 55:
|
||||
|
||||
* Don't allocate memory to handle obs-fold
|
||||
* Avoid a parser allocation using non-flat buffer
|
||||
* read_size replaces read_size_helper
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 54:
|
||||
|
||||
* static_buffer coverage
|
||||
* flat_buffer coverage
|
||||
* multi_buffer coverage
|
||||
* consuming_buffers members and coverage
|
||||
* basic_fields members and coverage
|
||||
* Add string_param
|
||||
* Retain ownership when reading using a message
|
||||
* Fix incorrect use of [[fallthrough]]
|
||||
|
||||
API Changes:
|
||||
|
||||
* basic_fields refactor
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 53:
|
||||
|
||||
* Fix basic_parser::maybe_flatten
|
||||
* Fix read_size_helper usage
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 52:
|
||||
|
||||
* flat_buffer is an AllocatorAwareContainer
|
||||
* Add drain_buffer class
|
||||
|
||||
API Changes:
|
||||
|
||||
* `auto_fragment` is a member of `stream`
|
||||
* `binary`, `text` are members of `stream`
|
||||
* read_buffer_size is a member of `stream`
|
||||
* read_message_max is a member of `stream`
|
||||
* `write_buffer_size` is a member of `stream`
|
||||
* `ping_callback` is a member of stream
|
||||
* Remove `opcode` from `read`, `async_read`
|
||||
* `read_frame` returns `bool` fin
|
||||
* `opcode` is private
|
||||
* finish(error_code&) is a BodyReader requirement
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Change call sites which use `auto_fragment` with `set_option`
|
||||
to call `stream::auto_fragment` instead.
|
||||
|
||||
* Change call sites which use message_type with `set_option`
|
||||
to call `stream::binary` or `stream::text` instead.
|
||||
|
||||
* Change call sites which use `read_buffer_size` with `set_option` to
|
||||
call `stream::read_buffer_size` instead.
|
||||
|
||||
* Change call sites which use `read_message_max` with `set_option` to
|
||||
call `stream::read_message_max` instead.
|
||||
|
||||
* Change call sites which use `write_buffer_size` with `set_option` to
|
||||
call `stream::write_buffer_size` instead.
|
||||
|
||||
* Change call sites which use `ping_callback1 with `set_option` to
|
||||
call `stream::ping_callback` instead.
|
||||
|
||||
* Remove the `opcode` reference parameter from calls to synchronous
|
||||
and asynchronous read functions, replace the logic with calls to
|
||||
`stream::got_binary` and `stream::got_text` instead.
|
||||
|
||||
* Remove the `frame_info` parameter from all read frame call sites
|
||||
|
||||
* Check the return value 'fin' for calls to `read_frame`
|
||||
|
||||
* Change ReadHandlers passed to `async_read_frame` to have
|
||||
the signature `void(error_code, bool fin)`, use the `bool`
|
||||
to indicate if the frame is the last frame.
|
||||
|
||||
* Remove all occurrences of the `opcode` enum at call sites
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 51
|
||||
|
||||
* Fix operator<< for header
|
||||
* Tidy up file_body
|
||||
* Fix file_body::get() not setting the more flag correctly
|
||||
* Use BOOST_FALLTHROUGH
|
||||
* Use BOOST_STRINGIZE
|
||||
* DynamicBuffer benchmarks
|
||||
* Add construct, destroy to handler_alloc
|
||||
* Fix infinite loop in basic_parser
|
||||
|
||||
API Changes:
|
||||
|
||||
* Tune up static_buffer
|
||||
* multi_buffer implementation change
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Call sites passing a number to multi_buffer's constructor
|
||||
will need to be adjusted, see the corresponding commit message.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 50
|
||||
|
||||
* parser is constructible from other body types
|
||||
* Add field enumeration
|
||||
* Use allocator more in basic_fields
|
||||
* Fix basic_fields allocator awareness
|
||||
* Use field in basic_fields and call sites
|
||||
* Use field in basic_parser
|
||||
* Tidy up basic_fields, header, and field concepts
|
||||
* Fields concept work
|
||||
* Body documentation work
|
||||
* Add missing handler_alloc nested types
|
||||
* Fix chunk delimiter parsing
|
||||
* Fix test::pipe read_size
|
||||
* Fix chunk header parsing
|
||||
|
||||
API Changes:
|
||||
|
||||
* Remove header_parser
|
||||
* Add verb to on_request for parsers
|
||||
* Refactor prepare
|
||||
* Protect basic_fields special members
|
||||
* Remove message connection settings
|
||||
* Remove message free functions
|
||||
* Remove obsolete serializer allocator
|
||||
* http read_some, async_read_some don't return bytes
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 49
|
||||
|
||||
* Use <iosfwd> instead of <ostream>
|
||||
|
||||
HTTP:
|
||||
|
||||
* Add HEAD request example
|
||||
|
||||
API Changes:
|
||||
|
||||
* Refactor method and verb
|
||||
* Canonicalize string_view parameter types
|
||||
* Tidy up empty_body writer error
|
||||
* Refactor header status, reason, and target
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 48
|
||||
|
||||
* Make buffer_prefix_view public
|
||||
* Remove detail::sync_ostream
|
||||
* Tidy up core type traits
|
||||
|
||||
API Changes:
|
||||
|
||||
* Tidy up chunk decorator
|
||||
* Rename to buffer_cat_view
|
||||
* Consolidate parsers to parser.hpp
|
||||
* Rename to parser
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 47
|
||||
|
||||
* Disable operator<< for buffer_body
|
||||
* buffer_size overload for basic_multi_buffer::const_buffers_type
|
||||
* Fix undefined behavior in pausation
|
||||
* Fix leak in basic_flat_buffer
|
||||
|
||||
API Changes:
|
||||
|
||||
* Refactor treatment of request-method
|
||||
* Refactor treatment of status code and obsolete reason
|
||||
* Refactor HTTP serialization and parsing
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 46
|
||||
|
||||
* Add test::pipe
|
||||
* Documentation work
|
||||
|
||||
API Changes:
|
||||
|
||||
* Remove HTTP header aliases
|
||||
* Refactor HTTP serialization
|
||||
* Refactor type traits
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 45
|
||||
|
||||
* Workaround for boost::asio::basic_streambuf type check
|
||||
* Fix message doc image
|
||||
* Better test::enable_yield_to
|
||||
* Fix header::reason
|
||||
* Documentation work
|
||||
* buffer_view skips empty buffer sequences
|
||||
* Disable reverse_iterator buffer_view test
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 44
|
||||
|
||||
* Use BOOST_THROW_EXCEPTION
|
||||
* Tidy up read_size_helper and dynamic buffers
|
||||
* Require Boost 1.58.0 or later
|
||||
* Tidy up and make get_lowest_layer public
|
||||
* Use BOOST_STATIC_ASSERT
|
||||
* Fix async return values in docs
|
||||
* Fix README websocket example
|
||||
* Add buffers_adapter regression test
|
||||
* Tidy up is_dynamic_buffer traits test
|
||||
* Make buffers_adapter meet requirements
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 43
|
||||
|
||||
* Require Boost 1.64.0
|
||||
* Fix strict aliasing warnings in buffers_view
|
||||
* Tidy up buffer_prefix overloads and test
|
||||
* Add write limit to test::string_ostream
|
||||
* Additional constructors for consuming_buffers
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 42
|
||||
|
||||
* Fix javadoc typo
|
||||
* Add formal review notes
|
||||
* Make buffers_view a public interface
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 41
|
||||
|
||||
* Trim Appveyor matrix rows
|
||||
* Concept revision and documentation
|
||||
* Remove coveralls integration
|
||||
* Tidy up formal parameter names
|
||||
|
||||
WebSocket
|
||||
|
||||
* Tidy up websocket::close_code enum and constructors
|
||||
|
||||
API Changes
|
||||
|
||||
* Return http::error::end_of_stream on HTTP read eof
|
||||
* Remove placeholders
|
||||
* Rename prepare_buffer(s) to buffer_prefix
|
||||
* Remove handler helpers, tidy up hook invocations
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 40
|
||||
|
||||
* Add to_static_string
|
||||
* Consolidate get_lowest_layer in type_traits.hpp
|
||||
* Fix basic_streambuf movable trait
|
||||
* Tidy up .travis.yml
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 39
|
||||
|
||||
Beast versions are now identified by a single integer which
|
||||
is incremented on each merge. The macro BEAST_VERSION
|
||||
identifies the version number, currently at 39. A version
|
||||
setting commit will always be at the tip of the master
|
||||
and develop branches.
|
||||
|
||||
* Use beast::string_view alias
|
||||
* Fixed braced-init error with older gcc
|
||||
|
||||
HTTP
|
||||
|
||||
* Tidy up basic_parser javadocs
|
||||
|
||||
WebSocket:
|
||||
|
||||
* Add websocket async echo ssl server test:
|
||||
* Fix eof error on ssl::stream shutdown
|
||||
|
||||
API Changes:
|
||||
|
||||
* Refactor http::header contents
|
||||
* New ostream() returns dynamic buffer output stream
|
||||
* New buffers() replaces to_string()
|
||||
* Rename to multi_buffer, basic_multi_buffer
|
||||
* Rename to flat_buffer, basic_flat_buffer
|
||||
* Rename to static_buffer, static_buffer_n
|
||||
* Rename to buffered_read_stream
|
||||
* Harmonize concepts and identifiers with net-ts
|
||||
* Tidy up HTTP reason_string
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1.0.0-b38
|
||||
|
||||
* Refactor static_string
|
||||
* Refactor base64
|
||||
* Use static_string for WebSocket handshakes
|
||||
* Simplify get_lowest_layer test
|
||||
* Add test_allocator to extras/test
|
||||
* More flat_streambuf tests
|
||||
* WebSocket doc work
|
||||
* Prevent basic_fields operator[] assignment
|
||||
|
||||
API Changes:
|
||||
|
||||
* Refactor WebSocket error codes
|
||||
* Remove websocket::keep_alive option
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1.0.0-b37
|
||||
|
||||
* CMake hide command lines in .vcxproj Output windows"
|
||||
* Rename to detail::is_invocable
|
||||
* Rename project to http-bench
|
||||
* Fix flat_streambuf
|
||||
* Add ub sanitizer blacklist
|
||||
* Add -funsigned-char to asan build target
|
||||
* Fix narrowing warning in table constants
|
||||
|
||||
WebSocket:
|
||||
|
||||
* Add is_upgrade() free function
|
||||
* Document websocket::stream thread safety
|
||||
* Rename to websocket::detail::pausation
|
||||
|
||||
API Changes:
|
||||
|
||||
* Provide websocket::stream accept() overloads
|
||||
* Refactor websocket decorators
|
||||
* Move everything in basic_fields.hpp to fields.hpp
|
||||
* Rename to http::dynamic_body, consolidate header
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1.0.0-b36
|
||||
|
||||
* Update README.md
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1.0.0-b35
|
||||
|
||||
* Add Appveyor build scripts and badge
|
||||
* Tidy up MSVC CMake configuration
|
||||
* Make close_code a proper enum
|
||||
* Add flat_streambuf
|
||||
* Rename to BEAST_DOXYGEN
|
||||
* Update .gitignore for VS2017
|
||||
* Fix README.md CMake instructions
|
||||
|
||||
API Changes:
|
||||
|
||||
* New HTTP interfaces
|
||||
* Remove http::empty_body
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
1.0.0-b34
|
||||
|
||||
* Fix and tidy up CMake build scripts
|
||||
|
||||
@@ -2,19 +2,26 @@
|
||||
|
||||
cmake_minimum_required (VERSION 3.5.2)
|
||||
|
||||
project (Beast)
|
||||
project (Beast VERSION 79)
|
||||
|
||||
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
option (Beast_BUILD_EXAMPLES "Build examples" ON)
|
||||
option (Beast_BUILD_TESTS "Build tests" ON)
|
||||
|
||||
if (MSVC)
|
||||
# /wd4244 /wd4127
|
||||
set (CMAKE_VERBOSE_MAKEFILE FALSE)
|
||||
|
||||
add_definitions (-D_WIN32_WINNT=0x0601)
|
||||
add_definitions (-D_SCL_SECURE_NO_WARNINGS=1)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS=1)
|
||||
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4244 /wd4251 /MP /W4 /bigobj")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /Oi /Ot /GL")
|
||||
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Oi /Ot")
|
||||
set (Boost_USE_STATIC_LIBS ON)
|
||||
set (Boost_USE_STATIC_RUNTIME ON)
|
||||
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /W4 /bigobj /permissive-")
|
||||
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")
|
||||
@@ -28,11 +35,15 @@ if (MSVC)
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${replacement_flags})
|
||||
|
||||
else()
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package (Threads)
|
||||
|
||||
set(CMAKE_CXX_FLAGS
|
||||
set( CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wrange-loop-analysis")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -42,31 +53,18 @@ endif()
|
||||
|
||||
option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON)
|
||||
|
||||
set (Boost_NO_SYSTEM_PATHS ON)
|
||||
set (Boost_USE_MULTITHREADED ON)
|
||||
set(BOOST_COMPONENTS system)
|
||||
if (Beast_BUILD_EXAMPLES OR Beast_BUILD_TESTS)
|
||||
list(APPEND BOOST_COMPONENTS coroutine context filesystem program_options thread)
|
||||
endif()
|
||||
find_package (Boost 1.58.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
unset (Boost_INCLUDE_DIR CACHE)
|
||||
unset (Boost_LIBRARY_DIRS CACHE)
|
||||
find_package (Boost REQUIRED COMPONENTS
|
||||
coroutine
|
||||
context
|
||||
filesystem
|
||||
program_options
|
||||
system
|
||||
thread
|
||||
)
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
||||
include_directories (SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
link_libraries (${Boost_LIBRARIES})
|
||||
|
||||
if (MSVC)
|
||||
add_definitions (-DBOOST_ALL_NO_LIB) # disable autolinking
|
||||
elseif (MINGW)
|
||||
if (MINGW)
|
||||
link_libraries(ws2_32 mswsock)
|
||||
endif()
|
||||
|
||||
add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING=1) # for asio
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# OpenSSL
|
||||
@@ -83,15 +81,23 @@ endif()
|
||||
|
||||
find_package(OpenSSL)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
add_definitions (-DBEAST_USE_OPENSSL=1)
|
||||
|
||||
else()
|
||||
add_definitions (-DBEAST_USE_OPENSSL=0)
|
||||
message("OpenSSL not found.")
|
||||
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})
|
||||
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")
|
||||
elseif (${child} STREQUAL "CMakeLists.txt")
|
||||
source_group("" FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
|
||||
else()
|
||||
string(REGEX REPLACE ^${rootdir} ${folder} groupname ${curdir})
|
||||
@@ -102,77 +108,87 @@ function(DoGroupSources curdir rootdir folder)
|
||||
endfunction()
|
||||
|
||||
function(GroupSources curdir folder)
|
||||
DoGroupSources(${curdir} ${curdir} ${folder})
|
||||
DoGroupSources (${curdir} ${curdir} ${folder})
|
||||
endfunction()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
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)
|
||||
if (MSVC)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
|
||||
endif()
|
||||
|
||||
elseif ("${VARIANT}" STREQUAL "ubasan")
|
||||
if (MSVC)
|
||||
else()
|
||||
set (CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -DBEAST_NO_SLOW_TESTS=1 -msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
|
||||
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
|
||||
endif()
|
||||
|
||||
elseif ("${VARIANT}" STREQUAL "debug")
|
||||
set(CMAKE_BUILD_TYPE DEBUG)
|
||||
set (CMAKE_BUILD_TYPE DEBUG)
|
||||
|
||||
elseif ("${VARIANT}" STREQUAL "release")
|
||||
set(CMAKE_BUILD_TYPE RELEASE)
|
||||
set (CMAKE_BUILD_TYPE RELEASE)
|
||||
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# Library interface
|
||||
#
|
||||
|
||||
add_library (${PROJECT_NAME} INTERFACE)
|
||||
target_link_libraries (${PROJECT_NAME} INTERFACE ${Boost_SYSTEM_LIBRARY})
|
||||
if (NOT MSVC)
|
||||
target_link_libraries (${PROJECT_NAME} INTERFACE Threads::Threads)
|
||||
endif()
|
||||
target_compile_definitions (${PROJECT_NAME} INTERFACE BOOST_COROUTINES_NO_DEPRECATION_WARNING=1)
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR}/include)
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# Tests and examples
|
||||
#
|
||||
|
||||
include_directories (.)
|
||||
include_directories (extras)
|
||||
include_directories (include)
|
||||
|
||||
set(ZLIB_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/crc32.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/deflate.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inffast.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inffixed.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inflate.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inftrees.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/trees.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/zlib.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/zutil.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/adler32.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/compress.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/crc32.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/deflate.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/infback.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inffast.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inflate.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/inftrees.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/trees.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/uncompr.c
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/zutil.c
|
||||
)
|
||||
if (OPENSSL_FOUND)
|
||||
include_directories (${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE BEAST_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/include/beast/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/beast/*.ipp
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE COMMON_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/example/common/*.hpp
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE EXAMPLE_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/example/*.hpp
|
||||
)
|
||||
|
||||
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)
|
||||
if (Beast_BUILD_TESTS)
|
||||
add_subdirectory (test)
|
||||
endif()
|
||||
|
||||
add_subdirectory (test)
|
||||
add_subdirectory (test/core)
|
||||
add_subdirectory (test/http)
|
||||
add_subdirectory (test/websocket)
|
||||
add_subdirectory (test/zlib)
|
||||
if (Beast_BUILD_EXAMPLES AND
|
||||
(NOT "${VARIANT}" STREQUAL "coverage") AND
|
||||
(NOT "${VARIANT}" STREQUAL "ubasan"))
|
||||
add_subdirectory (example)
|
||||
endif()
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
import os ;
|
||||
import feature ;
|
||||
import boost ;
|
||||
import modules ;
|
||||
import testing ;
|
||||
|
||||
boost.use-project ;
|
||||
|
||||
@@ -50,40 +52,24 @@ if [ os.name ] = MACOSX
|
||||
using clang : : ;
|
||||
}
|
||||
|
||||
variant coverage
|
||||
:
|
||||
debug
|
||||
:
|
||||
<cxxflags>"-fprofile-arcs -ftest-coverage"
|
||||
variant coverage :
|
||||
release
|
||||
:
|
||||
<cxxflags>"-msse4.2 -fprofile-arcs -ftest-coverage"
|
||||
<linkflags>"-lgcov"
|
||||
;
|
||||
;
|
||||
|
||||
variant asan
|
||||
variant ubasan
|
||||
:
|
||||
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"
|
||||
<cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=scripts/blacklist.supp"
|
||||
<linkflags>"-fsanitize=address,undefined"
|
||||
;
|
||||
|
||||
project beast
|
||||
: requirements
|
||||
<implicit-dependency>/boost//headers
|
||||
<include>.
|
||||
<include>./extras
|
||||
<include>./include
|
||||
@@ -103,9 +89,10 @@ project beast
|
||||
<toolset>clang:<cxxflags>-std=c++11
|
||||
<toolset>clang:<cxxflags>-Wno-unused-parameter
|
||||
<toolset>clang:<cxxflags>-Wno-unused-variable # Temporary until we can figure out -isystem
|
||||
<toolset>clang:<cxxflags>-Wrange-loop-analysis
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS=1
|
||||
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS=1
|
||||
<toolset>msvc:<cxxflags>"/wd4100 /wd4251 /bigobj"
|
||||
<toolset>msvc:<cxxflags>"/permissive- /bigobj"
|
||||
<toolset>msvc:<variant>release:<cxxflags>"/Ob2 /Oi /Ot"
|
||||
<os>LINUX:<define>_XOPEN_SOURCE=600
|
||||
<os>LINUX:<define>_GNU_SOURCE=1
|
||||
@@ -125,4 +112,4 @@ project beast
|
||||
;
|
||||
|
||||
build-project test ;
|
||||
build-project examples ;
|
||||
build-project example ;
|
||||
|
||||
@@ -1,63 +1,50 @@
|
||||
<img width="880" height = "80" alt = "Beast"
|
||||
src="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/readme.png">
|
||||
|
||||
[](https://gitter.im/vinniefalco/Beast?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://travis-ci.org/vinniefalco/Beast) [](https://codecov.io/gh/vinniefalco/Beast) [](https://coveralls.io/github/vinniefalco/Beast?branch=master) [](http://vinniefalco.github.io/beast/) [](LICENSE_1_0.txt)
|
||||
|
||||
# HTTP and WebSocket built on Boost.Asio in C++11
|
||||
|
||||
---
|
||||
|
||||
## Appearances
|
||||
|
||||
| <a href="http://cppcast.com/2017/01/vinnie-falco/">CppCast 2017</a> | <a href="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/CppCon2016.pdf">CppCon 2016</a> |
|
||||
| ------------ | ----------- |
|
||||
| <a href="http://cppcast.com/2017/01/vinnie-falco/"><img width="180" height="180" alt="Vinnie Falco" src="https://avatars1.githubusercontent.com/u/1503976?v=3&u=76c56d989ef4c09625256662eca2775df78a16ad&s=180"></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> |
|
||||
|
||||
---
|
||||
Branch | Build | Coverage | Documentation
|
||||
------------|---------------|----------------|---------------
|
||||
[master](https://github.com/vinniefalco/Beast/tree/master) | [](https://travis-ci.org/vinniefalco/Beast) [](https://ci.appveyor.com/project/vinniefalco/beast/branch/master) | [](https://codecov.io/gh/vinniefalco/Beast/branch/master) | [](http://vinniefalco.github.io/beast/)
|
||||
[develop](https://github.com/vinniefalco/Beast/tree/develop) | [](https://travis-ci.org/vinniefalco/Beast) [](https://ci.appveyor.com/project/vinniefalco/beast/branch/develop) | [](https://codecov.io/gh/vinniefalco/Beast/branch/develop) | [](http://vinniefalco.github.io/stage/beast/develop)
|
||||
|
||||
## Contents
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Appearances](#appearances)
|
||||
- [Description](#description)
|
||||
- [Requirements](#requirements)
|
||||
- [Building](#building)
|
||||
- [Usage](#usage)
|
||||
- [Licence](#licence)
|
||||
- [Contact](#contact)
|
||||
- [Contributing](#Contributing)
|
||||
|
||||
## 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:
|
||||
Beast is a C++ header-only library serving as a foundation for writing
|
||||
interoperable networking libraries by providing **low-level HTTP/1,
|
||||
WebSocket, and networking protocol** vocabulary types and algorithms
|
||||
using the consistent asynchronous model of Boost.Asio.
|
||||
|
||||
* **Symmetry.** Interfaces are role-agnostic; the same interfaces can be
|
||||
used to build clients, servers, or both.
|
||||
This library is designed for:
|
||||
|
||||
* **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.
|
||||
* **Symmetry:** Algorithms are role-agnostic; build clients, servers, or both.
|
||||
|
||||
* **Flexibility.** Interfaces do not mandate specific implementation
|
||||
strategies; important decisions such as buffer or thread management are
|
||||
left to users of the library.
|
||||
* **Ease of Use:** Boost.Asio users will immediately understand Beast.
|
||||
|
||||
* **Performance.** The implementation performs competitively, making it a
|
||||
realistic choice for building high performance network servers.
|
||||
* **Flexibility:** Users make the important decisions such as buffer or
|
||||
thread management.
|
||||
|
||||
* **Scalability.** Development of network applications that scale to thousands
|
||||
of concurrent connections is possible with the implementation.
|
||||
* **Performance:** Build applications handling thousands of connections or more.
|
||||
|
||||
* **Basis for further abstraction.** The interfaces facilitate the
|
||||
development of other libraries that provide higher levels of abstraction.
|
||||
* **Basis for Further Abstraction.** Components are well-suited for building upon.
|
||||
|
||||
Beast is used in [rippled](https://github.com/ripple/rippled), an
|
||||
open source server application that implements a decentralized
|
||||
cryptocurrency system.
|
||||
## Appearances
|
||||
|
||||
| <a href="http://cppcast.com/2017/01/vinnie-falco/">CppCast 2017</a> | <a href="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/CppCon2016.pdf">CppCon 2016</a> |
|
||||
| ------------ | ----------- |
|
||||
| <a href="http://cppcast.com/2017/01/vinnie-falco/"><img width="180" height="180" alt="Vinnie Falco" src="https://avatars1.githubusercontent.com/u/1503976?v=3&u=76c56d989ef4c09625256662eca2775df78a16ad&s=180"></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> |
|
||||
|
||||
## Description
|
||||
|
||||
@@ -73,17 +60,20 @@ The library has been submitted to the
|
||||
|
||||
## Requirements
|
||||
|
||||
* Boost 1.58 or later
|
||||
* C++11 or later
|
||||
This library is for programmers familiar with Boost.Asio. Users
|
||||
who wish to use asynchronous interfaces should already know how to
|
||||
create concurrent network programs using callbacks or coroutines.
|
||||
|
||||
* **C++11:** Robust support for most language features.
|
||||
* **Boost:** Boost.Asio and some other parts of Boost.
|
||||
* **OpenSSL:** Optional, for using TLS/Secure sockets.
|
||||
|
||||
When using Microsoft Visual C++, Visual Studio 2015 Update 3 or later is required.
|
||||
|
||||
These components are optionally required in order to build the
|
||||
tests and examples:
|
||||
These components are required in order to build the tests and examples:
|
||||
|
||||
* OpenSSL (optional)
|
||||
* CMake 3.7.2 or later (optional)
|
||||
* Properly configured bjam/b2 (optional)
|
||||
* CMake 3.7.2 or later
|
||||
* Properly configured bjam/b2
|
||||
|
||||
## Building
|
||||
|
||||
@@ -106,24 +96,21 @@ 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. It is possible to generate Microsoft Visual Studio or Apple
|
||||
Developers using Microsoft Visual Studio can generate Visual Studio
|
||||
project files by executing these commands from the root of the repository:
|
||||
Xcode project files using CMake by executing these commands from
|
||||
the root of the repository:
|
||||
|
||||
```
|
||||
mkdir bin
|
||||
cd bin
|
||||
cmake .. # for 32-bit Windows builds
|
||||
|
||||
cd ../bin64
|
||||
cmake .. # for Linux/Mac builds, OR
|
||||
cmake -G"Visual Studio 14 2015 Win64" .. # for 64-bit Windows builds
|
||||
```
|
||||
|
||||
When using Apple Xcode it is possible to generate Xcode project files
|
||||
using these commands:
|
||||
|
||||
```
|
||||
cd bin
|
||||
cmake -G Xcode .. # for Apple Xcode builds
|
||||
|
||||
cd ..
|
||||
mkdir bin64
|
||||
cd bin64
|
||||
cmake -G"Visual Studio 14 2015 Win64" .. # for 64-bit Windows builds (VS2015)
|
||||
cmake -G"Visual Studio 15 2017 Win64" .. # for 64-bit Windows builds (VS2017)
|
||||
|
||||
```
|
||||
|
||||
To build with Boost.Build, it is necessary to have the bjam executable
|
||||
@@ -141,13 +128,13 @@ The files in the repository are laid out thusly:
|
||||
|
||||
```
|
||||
./
|
||||
bin/ Holds executables and project files
|
||||
bin64/ Holds 64-bit Windows executables and project files
|
||||
bin/ Create this to hold executables and project files
|
||||
bin64/ Create this to hold 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
|
||||
example/ Self contained example programs
|
||||
test/ Unit tests and benchmarks
|
||||
```
|
||||
|
||||
@@ -155,76 +142,9 @@ The files in the repository are laid out thusly:
|
||||
## Usage
|
||||
|
||||
These examples are complete, self-contained programs that you can build
|
||||
and run yourself (they are in the `examples` directory).
|
||||
and run yourself (they are in the `example` 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;
|
||||
}
|
||||
```
|
||||
http://vinniefalco.github.io/beast/beast/quick_start.html
|
||||
|
||||
## License
|
||||
|
||||
@@ -236,3 +156,51 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
Please report issues or questions here:
|
||||
https://github.com/vinniefalco/Beast/issues
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Contributing (We Need Your Help!)
|
||||
|
||||
If you would like to contribute to Beast and help us maintain high
|
||||
quality, consider performing code reviews on active pull requests.
|
||||
Any feedback from users and stakeholders, even simple questions about
|
||||
how things work or why they were done a certain way, carries value
|
||||
and can be used to improve the library. Code review provides these
|
||||
benefits:
|
||||
|
||||
* Identify bugs
|
||||
* Documentation proof-reading
|
||||
* Adjust interfaces to suit use-cases
|
||||
* Simplify code
|
||||
|
||||
You can look through the Closed pull requests to get an idea of how
|
||||
reviews are performed. To give a code review just sign in with your
|
||||
GitHub account and then add comments to any open pull requests below,
|
||||
don't be shy!
|
||||
<p>https://github.com/vinniefalco/Beast/pulls</p>
|
||||
|
||||
Here are some resources to learn more about
|
||||
code reviews:
|
||||
|
||||
* <a href="https://blog.scottnonnenberg.com/top-ten-pull-request-review-mistakes/">Top 10 Pull Request Review Mistakes</a>
|
||||
* <a href="https://smartbear.com/SmartBear/media/pdfs/best-kept-secrets-of-peer-code-review.pdf">Best Kept Secrets of Peer Code Review (pdf)</a>
|
||||
* <a href="http://support.smartbear.com/support/media/resources/cc/11_Best_Practices_for_Peer_Code_Review.pdf">11 Best Practices for Peer Code Review (pdf)</a>
|
||||
* <a href="http://www.evoketechnologies.com/blog/code-review-checklist-perform-effective-code-reviews/">Code Review Checklist – To Perform Effective Code Reviews</a>
|
||||
* <a href="https://www.codeproject.com/Articles/524235/Codeplusreviewplusguidelines">Code review guidelines</a>
|
||||
* <a href="https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md">C++ Core Guidelines</a>
|
||||
* <a href="https://doc.lagout.org/programmation/C/CPP101.pdf">C++ Coding Standards (Sutter & Andrescu)</a>
|
||||
|
||||
Beast thrives on code reviews and any sort of feedback from users and
|
||||
stakeholders about its interfaces. Even if you just have questions,
|
||||
asking them in the code review or in issues provides valuable information
|
||||
that can be used to improve the library - do not hesitate, no question
|
||||
is insignificant or unimportant!
|
||||
|
||||
While code reviews are the preferred form of donation, if you simply
|
||||
must donate money to support the library, please do so
|
||||
using <a href="https://bitcoin.org">Bitcoin</a> sent to this address:
|
||||
<a href="bitcoin:1DaPsDvv6MjFUSnsxXSHzeYKSjzrWrQY7T?amount=0.03&label=Beast%20Library"><b>1DaPsDvv6MjFUSnsxXSHzeYKSjzrWrQY7T</b></a>
|
||||
|
||||
<a href="bitcoin:1DaPsDvv6MjFUSnsxXSHzeYKSjzrWrQY7T?amount=0.03&label=Beast%20Library">
|
||||
<img src="https://raw.githubusercontent.com/vinniefalco/Beast/master/doc/images/btc_qr2.png" width="490" height="100"></a>
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
* 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
|
||||
|
||||
102
src/beast/appveyor.yml
Normal file
@@ -0,0 +1,102 @@
|
||||
# Copyright 2016 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#version: 1.0.{build}-{branch}
|
||||
version: "{branch} (#{build})"
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
platform:
|
||||
#- x86
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
#- Debug
|
||||
- Release
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- git clone https://github.com/boostorg/boost.git boost
|
||||
- cd boost
|
||||
# - git checkout boost-1.64.0
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\
|
||||
- git submodule update --init tools/build
|
||||
- git submodule update --init libs/config
|
||||
- git submodule update --init tools/boostdep
|
||||
# - python tools/boostdep/depinst/depinst.py beast
|
||||
- git submodule update --init libs/any
|
||||
- git submodule update --init libs/asio
|
||||
- git submodule update --init libs/algorithm
|
||||
- git submodule update --init libs/array
|
||||
- git submodule update --init libs/assert
|
||||
- git submodule update --init libs/atomic
|
||||
- git submodule update --init libs/bind
|
||||
- git submodule update --init libs/chrono
|
||||
- git submodule update --init libs/concept_check
|
||||
- git submodule update --init libs/config
|
||||
- git submodule update --init libs/container
|
||||
- git submodule update --init libs/context
|
||||
- git submodule update --init libs/conversion
|
||||
- git submodule update --init libs/core
|
||||
- git submodule update --init libs/coroutine
|
||||
- git submodule update --init libs/date_time
|
||||
- git submodule update --init libs/detail
|
||||
- git submodule update --init libs/endian
|
||||
- git submodule update --init libs/exception
|
||||
- git submodule update --init libs/filesystem
|
||||
- git submodule update --init libs/foreach
|
||||
- git submodule update --init libs/function
|
||||
- git submodule update --init libs/function_types
|
||||
- git submodule update --init libs/functional
|
||||
- git submodule update --init libs/fusion
|
||||
- git submodule update --init libs/integer
|
||||
- git submodule update --init libs/intrusive
|
||||
- git submodule update --init libs/io
|
||||
- git submodule update --init libs/iostreams
|
||||
- git submodule update --init libs/iterator
|
||||
- git submodule update --init libs/lambda
|
||||
- git submodule update --init libs/lexical_cast
|
||||
- git submodule update --init libs/locale
|
||||
- git submodule update --init libs/logic
|
||||
- git submodule update --init libs/math
|
||||
- git submodule update --init libs/move
|
||||
- git submodule update --init libs/mpl
|
||||
- git submodule update --init libs/numeric/conversion
|
||||
- git submodule update --init libs/optional
|
||||
# - git submodule update --init libs/phoenix
|
||||
- git submodule update --init libs/pool
|
||||
- git submodule update --init libs/predef
|
||||
- git submodule update --init libs/preprocessor
|
||||
- git submodule update --init libs/program_options
|
||||
- git submodule update --init libs/proto
|
||||
- git submodule update --init libs/random
|
||||
- git submodule update --init libs/range
|
||||
- git submodule update --init libs/ratio
|
||||
- git submodule update --init libs/rational
|
||||
- git submodule update --init libs/regex
|
||||
- git submodule update --init libs/serialization
|
||||
- git submodule update --init libs/smart_ptr
|
||||
# - git submodule update --init libs/spirit
|
||||
- git submodule update --init libs/static_assert
|
||||
- git submodule update --init libs/system
|
||||
- git submodule update --init libs/thread
|
||||
- git submodule update --init libs/throw_exception
|
||||
- git submodule update --init libs/tokenizer
|
||||
- git submodule update --init libs/tti
|
||||
- git submodule update --init libs/tuple
|
||||
- git submodule update --init libs/type_index
|
||||
- git submodule update --init libs/type_traits
|
||||
- git submodule update --init libs/typeof
|
||||
- git submodule update --init libs/unordered
|
||||
- git submodule update --init libs/utility
|
||||
- git submodule update --init libs/variant
|
||||
- git submodule update --init libs/winapi
|
||||
- bootstrap
|
||||
- b2 headers
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- b2 libs/beast/example toolset=msvc-14.0
|
||||
- b2 libs/beast/test toolset=msvc-14.0
|
||||
113
src/beast/doc/0_main.qbk
Normal file
@@ -0,0 +1,113 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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)
|
||||
]
|
||||
|
||||
[library Beast
|
||||
[quickbook 1.6]
|
||||
[copyright 2013 - 2017 Vinnie Falco]
|
||||
[purpose Networking Protocol Library]
|
||||
[license
|
||||
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])
|
||||
]
|
||||
[authors [Falco, Vinnie]]
|
||||
[category template]
|
||||
[category generic]
|
||||
]
|
||||
|
||||
[template mdash[] '''— ''']
|
||||
[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
|
||||
[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
|
||||
[template repo_file[path] '''<ulink url="https://github.com/vinniefalco/Beast/blob/master/'''[path]'''">'''[path]'''</ulink>''']
|
||||
[template include_file[path][^<'''<ulink url="https://github.com/vinniefalco/Beast/blob/master/include/'''[path]'''">'''[path]'''</ulink>'''>]]
|
||||
|
||||
[def __N3747__ [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3747.pdf [*N3747]]]
|
||||
[def __N4588__ [@http://cplusplus.github.io/networking-ts/draft.pdf [*N4588]]]
|
||||
[def __rfc6455__ [@https://tools.ietf.org/html/rfc6455 rfc6455]]
|
||||
[def __rfc7230__ [@https://tools.ietf.org/html/rfc7230 rfc7230]]
|
||||
|
||||
[def __Asio__ [@http://www.boost.org/doc/html/boost_asio.html Boost.Asio]]
|
||||
|
||||
[def __asio_handler_invoke__ [@http://www.boost.org/doc/html/boost_asio/reference/asio_handler_invoke.html `asio_handler_invoke`]]
|
||||
[def __asio_handler_allocate__ [@http://www.boost.org/doc/html/boost_asio/reference/asio_handler_allocate.html `asio_handler_allocate`]]
|
||||
[def __io_service__ [@http://www.boost.org/doc/html/boost_asio/reference/io_service.html `io_service`]]
|
||||
[def __socket__ [@http://www.boost.org/doc/html/boost_asio/reference/ip__tcp/socket.html `boost::asio::ip::tcp::socket`]]
|
||||
[def __ssl_stream__ [@http://www.boost.org/doc/html/boost_asio/reference/ssl__stream.html `boost::asio::ssl::stream`]]
|
||||
[def __streambuf__ [@http://www.boost.org/doc/html/boost_asio/reference/streambuf.html `boost::asio::streambuf`]]
|
||||
[def __use_future__ [@http://www.boost.org/doc/html/boost_asio/reference/use_future_t.html `boost::asio::use_future`]]
|
||||
[def __void_or_deduced__ [@http://www.boost.org/doc/html/boost_asio/reference/asynchronous_operations.html#boost_asio.reference.asynchronous_operations.return_type_of_an_initiating_function ['void-or-deduced]]]
|
||||
[def __yield_context__ [@http://www.boost.org/doc/html/boost_asio/reference/yield_context.html `boost::asio::yield_context`]]
|
||||
|
||||
[def __AsyncReadStream__ [@http://www.boost.org/doc/html/boost_asio/reference/AsyncReadStream.html [*AsyncReadStream]]]
|
||||
[def __AsyncWriteStream__ [@http://www.boost.org/doc/html/boost_asio/reference/AsyncWriteStream.html [*AsyncWriteStream]]]
|
||||
[def __CompletionHandler__ [@http://www.boost.org/doc/html/boost_asio/reference/CompletionHandler.html [*CompletionHandler]]]
|
||||
[def __ConstBufferSequence__ [@http://www.boost.org/doc/html/boost_asio/reference/ConstBufferSequence.html [*ConstBufferSequence]]]
|
||||
[def __Handler__ [@http://www.boost.org/doc/html/boost_asio/reference/Handler.html [*Handler]]]
|
||||
[def __MutableBufferSequence__ [@http://www.boost.org/doc/html/boost_asio/reference/MutableBufferSequence.html [*MutableBufferSequence]]]
|
||||
[def __SyncReadStream__ [@http://www.boost.org/doc/html/boost_asio/reference/SyncReadStream.html [*SyncReadStream]]]
|
||||
[def __SyncWriteStream__ [@http://www.boost.org/doc/html/boost_asio/reference/SyncWriteStream.html [*SyncWriteStream]]]
|
||||
|
||||
[def __async_initfn__ [@http://www.boost.org/doc/html/boost_asio/reference/asynchronous_operations.html initiating function]]
|
||||
|
||||
[def __AsyncStream__ [link beast.concept.streams.AsyncStream [*AsyncStream]]]
|
||||
[def __Body__ [link beast.concept.Body [*Body]]]
|
||||
[def __BodyReader__ [link beast.concept.BodyReader [*BodyReader]]]
|
||||
[def __BodyWriter__ [link beast.concept.BodyWriter [*BodyWriter]]]
|
||||
[def __DynamicBuffer__ [link beast.concept.DynamicBuffer [*DynamicBuffer]]]
|
||||
[def __Fields__ [link beast.concept.Fields [*Fields]]]
|
||||
[def __FieldsReader__ [link beast.concept.FieldsReader [*FieldsReader]]]
|
||||
[def __File__ [link beast.concept.File [*File]]]
|
||||
[def __Stream__ [link beast.concept.streams [*Stream]]]
|
||||
[def __SyncStream__ [link beast.concept.streams.SyncStream [*SyncStream]]]
|
||||
|
||||
[def __basic_fields__ [link beast.ref.beast__http__basic_fields `basic_fields`]]
|
||||
[def __basic_multi_buffer__ [link beast.ref.beast__basic_multi_buffer `basic_multi_buffer`]]
|
||||
[def __basic_parser__ [link beast.ref.beast__http__basic_parser `basic_parser`]]
|
||||
[def __buffer_body__ [link beast.ref.beast__http__buffer_body `buffer_body`]]
|
||||
[def __fields__ [link beast.ref.beast__http__fields `fields`]]
|
||||
[def __flat_buffer__ [link beast.ref.beast__flat_buffer `flat_buffer`]]
|
||||
[def __header__ [link beast.ref.beast__http__header `header`]]
|
||||
[def __message__ [link beast.ref.beast__http__message `message`]]
|
||||
[def __multi_buffer__ [link beast.ref.beast__multi_buffer `multi_buffer`]]
|
||||
[def __parser__ [link beast.ref.beast__http__parser `parser`]]
|
||||
[def __serializer__ [link beast.ref.beast__http__serializer `serializer`]]
|
||||
[def __static_buffer__ [link beast.ref.beast__static_buffer `static_buffer`]]
|
||||
[def __static_buffer_n__ [link beast.ref.beast__static_buffer_n `static_buffer_n`]]
|
||||
|
||||
[import ../example/common/detect_ssl.hpp]
|
||||
[import ../example/doc/http_examples.hpp]
|
||||
[import ../example/echo-op/echo_op.cpp]
|
||||
[import ../example/http-client/http_client.cpp]
|
||||
[import ../example/websocket-client/websocket_client.cpp]
|
||||
|
||||
[import ../include/beast/http/file_body.hpp]
|
||||
|
||||
[import ../test/exemplars.cpp]
|
||||
[import ../test/core/doc_snippets.cpp]
|
||||
[import ../test/http/doc_snippets.cpp]
|
||||
[import ../test/websocket/doc_snippets.cpp]
|
||||
|
||||
[include 1_intro.qbk]
|
||||
[include 2_examples.qbk]
|
||||
[include 3_0_core.qbk]
|
||||
[include 5_00_http.qbk]
|
||||
[include 6_0_http_examples.qbk]
|
||||
[include 7_0_websocket.qbk]
|
||||
[include 8_concepts.qbk]
|
||||
[include 9_0_design.qbk]
|
||||
|
||||
[section:quickref Reference]
|
||||
[xinclude quickref.xml]
|
||||
[endsect]
|
||||
|
||||
[block'''<reference id="hidden"><title>This Page Intentionally Left Blank 1/2</title>''']
|
||||
[section:ref This Page Intentionally Left Blank 2/2]
|
||||
[include reference.qbk]
|
||||
[endsect]
|
||||
[block'''</reference>''']
|
||||
|
||||
[xinclude index.xml]
|
||||
96
src/beast/doc/1_intro.qbk
Normal file
@@ -0,0 +1,96 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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:intro Introduction]
|
||||
|
||||
Beast is a C++ header-only library serving as a foundation for writing
|
||||
interoperable networking libraries by providing [*low-level HTTP/1,
|
||||
WebSocket, and networking protocol] vocabulary types and algorithms
|
||||
using the consistent asynchronous model of __Asio__.
|
||||
|
||||
This library is designed for:
|
||||
|
||||
* [*Symmetry:] Algorithms are role-agnostic; build clients, servers, or both.
|
||||
|
||||
* [*Ease of Use:] __Asio__ users will immediately understand Beast.
|
||||
|
||||
* [*Flexibility:] Users make the important decisions such as buffer or
|
||||
thread management.
|
||||
|
||||
* [*Performance:] Build applications handling thousands of connections or more.
|
||||
|
||||
* [*Basis for Further Abstraction.] Components are well-suited for building upon.
|
||||
|
||||
Beast is not an HTTP client or HTTP server, but it can be used to build
|
||||
those things.
|
||||
|
||||
[heading Motivation]
|
||||
|
||||
Beast empowers users to create their own libraries, clients, and servers
|
||||
using HTTP/1 and WebSocket. Code will be easier and faster to implement,
|
||||
understand, and maintain, because Beast takes care of the low-level
|
||||
protocol details.
|
||||
The HTTP and WebSocket protocols drive most of the World Wide Web.
|
||||
Every web browser implements these protocols to load webpages and
|
||||
to enable client side programs (often written in JavaScript) to
|
||||
communicate interactively. C++ benefits greatly from having a
|
||||
standardized implementation of these protocols.
|
||||
|
||||
[heading Requirements]
|
||||
|
||||
[important
|
||||
This library is for programmers familiar with __Asio__. Users who
|
||||
wish to use asynchronous interfaces should already know how to
|
||||
create concurrent network programs using callbacks or coroutines.
|
||||
]
|
||||
|
||||
Beast requires:
|
||||
|
||||
* [*C++11:] Robust support for most language features.
|
||||
* [*Boost:] Beast only works with Boost, not stand-alone Asio
|
||||
* [*OpenSSL:] Optional, for using TLS/Secure sockets.
|
||||
|
||||
Supported compilers: msvc-14+, gcc 4.8+, clang 3.6+
|
||||
|
||||
Sources are [*header-only]. To link a program using Beast successfully, add the
|
||||
[@http://www.boost.org/libs/system/doc/reference.html Boost.System]
|
||||
library to the list of linked libraries. If you use coroutines
|
||||
you'll also need the
|
||||
[@http://www.boost.org/libs/coroutine/doc/html/index.html Boost.Coroutine]
|
||||
library. Please visit the
|
||||
[@http://www.boost.org/doc/ Boost documentation]
|
||||
for instructions on how to do this for your particular build system.
|
||||
|
||||
[heading Credits]
|
||||
|
||||
Boost.Asio is the inspiration behind which all of the interfaces and
|
||||
implementation strategies are built. Some parts of the documentation are
|
||||
written to closely resemble the wording and presentation of Boost.Asio
|
||||
documentation. Credit goes to
|
||||
[@https://github.com/chriskohlhoff Christopher Kohlhoff]
|
||||
for his wonderful Asio library and the ideas in __N4588__ which power Beast.
|
||||
|
||||
Beast would not be possible without the support of
|
||||
[@https://www.ripple.com Ripple]
|
||||
during the library's early development, or the ideas, time and patience
|
||||
contributed by
|
||||
[@https://github.com/JoelKatz David Schwartz],
|
||||
[@https://github.com/ximinez Edward Hennis],
|
||||
[@https://github.com/howardhinnant Howard Hinnant],
|
||||
[@https://github.com/miguelportilla Miguel Portilla],
|
||||
[@https://github.com/nbougalis Nik Bougalis],
|
||||
[@https://github.com/seelabs Scott Determan],
|
||||
[@https://github.com/scottschurr Scott Schurr],
|
||||
Many thanks to
|
||||
[@https://github.com/K-ballo Agustín Bergé],
|
||||
[@http://www.boost.org/users/people/glen_fernandes.html Glen Fernandes],
|
||||
and
|
||||
[@https://github.com/pdimov Peter Dimov]
|
||||
for tirelessly answering questions on
|
||||
[@https://cpplang.slack.com/ Cpplang-Slack].
|
||||
|
||||
[endsect]
|
||||
192
src/beast/doc/2_examples.qbk
Normal file
@@ -0,0 +1,192 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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:quickstart Quick Start]
|
||||
[block'''<?dbhtml stop-chunking?>''']
|
||||
|
||||
These complete programs are intended to quickly impress upon readers
|
||||
the flavor of the library. Source code and build scripts for them are
|
||||
located in the example/ directory.
|
||||
|
||||
[section HTTP Client]
|
||||
|
||||
Use HTTP to make a GET request to a website and print the response:
|
||||
|
||||
File: [repo_file example/http-client/http_client.cpp]
|
||||
|
||||
[example_http_client]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section WebSocket Client]
|
||||
|
||||
Establish a WebSocket connection, send a message and receive the reply:
|
||||
|
||||
File: [repo_file example/websocket-client/websocket_client.cpp]
|
||||
|
||||
[example_websocket_client]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section:examples Examples]
|
||||
[block'''<?dbhtml stop-chunking?>''']
|
||||
|
||||
Source code and build scripts for these programs are located
|
||||
in the example/ directory.
|
||||
|
||||
|
||||
|
||||
[section HTTP Crawl]
|
||||
|
||||
This example retrieves the page at each of the most popular domains
|
||||
as measured by Alexa.
|
||||
|
||||
* [repo_file example/http-crawl/http_crawl.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section HTTP Client (with SSL)]
|
||||
|
||||
This example demonstrates sending and receiving HTTP messages
|
||||
over a TLS connection. Requires OpenSSL to build.
|
||||
|
||||
* [repo_file example/http-client-ssl/http_client_ssl.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section HTTP Server (Fast)]
|
||||
|
||||
This example implements a very simple HTTP server with
|
||||
some optimizations suitable for calculating benchmarks.
|
||||
|
||||
* [repo_file example/http-server-fast/fields_alloc.hpp]
|
||||
* [repo_file example/http-server-fast/http_server_fast.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section HTTP Server (Small)]
|
||||
|
||||
This example implements a very simple HTTP server
|
||||
suitable as a starting point on an embedded device.
|
||||
|
||||
* [repo_file example/http-server-small/http_server_small.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section HTTP Server (Threaded)]
|
||||
|
||||
This example implements a very simple HTTP server using
|
||||
synchronous interfaces and using one thread per connection:
|
||||
|
||||
* [repo_file example/http-server-threaded/http_server_threaded.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section WebSocket Client (with SSL)]
|
||||
|
||||
Establish a WebSocket connection over an encrypted TLS connection,
|
||||
send a message and receive the reply. Requires OpenSSL to build.
|
||||
|
||||
* [repo_file example/websocket-client-ssl/websocket_client_ssl.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section WebSocket Server (Asynchronous)]
|
||||
|
||||
This program implements a WebSocket echo server using asynchronous
|
||||
interfaces and a configurable number of threads.
|
||||
|
||||
* [repo_file example/websocket-server-async/websocket_server_async.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section Documentation Samples]
|
||||
|
||||
Here are all of the example functions and classes presented
|
||||
throughout the documentation, they can be included and used
|
||||
in your program without modification
|
||||
|
||||
* [repo_file example/doc/http_examples.hpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section Composed Operations]
|
||||
|
||||
This program shows how to use Beast's network foundations to build a
|
||||
composable asynchronous initiation function with associated composed
|
||||
operation implementation. This is a complete, runnable version of
|
||||
the example described in the Core Foundations document section.
|
||||
|
||||
* [repo_file example/echo-op/echo_op.cpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section Common Code]
|
||||
|
||||
This code is reused between some of the examples. The header files
|
||||
stand alone can be directly included in your projects.
|
||||
|
||||
* [repo_file example/common/detect_ssl.hpp]
|
||||
* [repo_file example/common/helpers.hpp]
|
||||
* [repo_file example/common/mime_types.hpp]
|
||||
* [repo_file example/common/rfc7231.hpp]
|
||||
* [repo_file example/common/ssl_stream.hpp]
|
||||
* [repo_file example/common/write_msg.hpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[section Server Framework]
|
||||
|
||||
This is a complete program and framework of classes implementing
|
||||
a general purpose server that users may copy to use as the basis
|
||||
for writing their own servers. It serves both HTTP and WebSocket.
|
||||
|
||||
* [repo_file example/server-framework/file_service.hpp]
|
||||
* [repo_file example/server-framework/framework.hpp]
|
||||
* [repo_file example/server-framework/http_async_port.hpp]
|
||||
* [repo_file example/server-framework/http_base.hpp]
|
||||
* [repo_file example/server-framework/http_sync_port.hpp]
|
||||
* [repo_file example/server-framework/https_ports.hpp]
|
||||
* [repo_file example/server-framework/main.cpp]
|
||||
* [repo_file example/server-framework/multi_port.hpp]
|
||||
* [repo_file example/server-framework/server.hpp]
|
||||
* [repo_file example/server-framework/service_list.hpp]
|
||||
* [repo_file example/server-framework/ssl_certificate.hpp]
|
||||
* [repo_file example/server-framework/ws_async_port.hpp]
|
||||
* [repo_file example/server-framework/ws_sync_port.hpp]
|
||||
* [repo_file example/server-framework/ws_upgrade_service.hpp]
|
||||
* [repo_file example/server-framework/wss_ports.hpp]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[endsect]
|
||||
33
src/beast/doc/3_0_core.qbk
Normal file
@@ -0,0 +1,33 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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:using_io Using I/O]
|
||||
|
||||
This library makes I/O primitives used by the implementation publicly
|
||||
available so users can take advantage of them in their own libraries.
|
||||
These primitives include traits, buffers, buffer algorithms, files,
|
||||
and helpers for implementing asynchronous operations compatible with
|
||||
__Asio__ and described in __N3747__. This section lists these facilities
|
||||
by group, with descriptions.
|
||||
|
||||
[important
|
||||
This documentation assumes familiarity with __Asio__. Sample
|
||||
code and identifiers used throughout are written as if the
|
||||
following declarations are in effect:
|
||||
|
||||
[snippet_core_1a]
|
||||
[snippet_core_1b]
|
||||
]
|
||||
|
||||
[include 3_1_asio.qbk]
|
||||
[include 3_2_streams.qbk]
|
||||
[include 3_3_buffers.qbk]
|
||||
[include 3_4_files.qbk]
|
||||
[include 3_5_composed.qbk]
|
||||
[include 3_6_detect_ssl.qbk]
|
||||
|
||||
[endsect]
|
||||
62
src/beast/doc/3_1_asio.qbk
Normal file
@@ -0,0 +1,62 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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 Asio Refresher]
|
||||
|
||||
[warning
|
||||
Beast does not manage sockets, make outgoing connections,
|
||||
accept incoming connections, handle timeouts, close endpoints,
|
||||
do name lookups, deal with TLS certificates, perform authentication,
|
||||
or otherwise handle any aspect of connection management. This is
|
||||
left to the interfaces already existing on the underlying streams.
|
||||
]
|
||||
|
||||
Library stream algorithms require a __socket__, __ssl_stream__, or other
|
||||
__Stream__ object that has already established communication with an
|
||||
endpoint. This example is provided as a reminder of how to work with
|
||||
sockets:
|
||||
|
||||
[snippet_core_2]
|
||||
|
||||
Throughout this documentation identifiers with the following names have
|
||||
special meaning:
|
||||
|
||||
[table Global Variables
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/io_service.html [*`ios`]]
|
||||
][
|
||||
A variable of type
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/io_service.html `boost::asio::io_service`]
|
||||
which is running on one separate thread, and upon which a
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/io_service__work.html `boost::asio::io_service::work`]
|
||||
object has been constructed.
|
||||
]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/ip__tcp/socket.html [*`sock`]]
|
||||
][
|
||||
A variable of type
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/ip__tcp/socket.html `boost::asio::ip::tcp::socket`]
|
||||
which has already been connected to a remote host.
|
||||
]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/ssl__stream.html [*`ssl_sock`]]
|
||||
][
|
||||
A variable of type
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/ssl__stream.html `boost::asio::ssl::stream<boost::asio::ip::tcp::socket>`]
|
||||
which is already connected and has handshaked with a remote host.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__websocket__stream [*`ws`]]
|
||||
][
|
||||
A variable of type
|
||||
[link beast.ref.beast__websocket__stream `websocket::stream<boost::asio::ip::tcp::socket>`]
|
||||
which is already connected with a remote host.
|
||||
]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
120
src/beast/doc/3_2_streams.qbk
Normal file
@@ -0,0 +1,120 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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 Stream Types]
|
||||
|
||||
A __Stream__ is a communication channel where data is transferred as
|
||||
an ordered sequence of octet buffers. Streams are either synchronous
|
||||
or asynchronous, and may allow reading, writing, or both. Note that
|
||||
a particular type may model more than one concept. For example, the
|
||||
Asio types __socket__ and __ssl_stream__ support both __SyncStream__
|
||||
and __AsyncStream__. All stream algorithms in Beast are declared as
|
||||
template functions using these concepts:
|
||||
|
||||
[table Stream Concepts
|
||||
[[Concept][Description]]
|
||||
[
|
||||
[__SyncReadStream__]
|
||||
[
|
||||
Supports buffer-oriented blocking reads.
|
||||
]
|
||||
][
|
||||
[__SyncWriteStream__]
|
||||
[
|
||||
Supports buffer-oriented blocking writes.
|
||||
]
|
||||
][
|
||||
[__SyncStream__]
|
||||
[
|
||||
A stream supporting buffer-oriented blocking reads and writes.
|
||||
]
|
||||
][
|
||||
[__AsyncReadStream__]
|
||||
[
|
||||
Supports buffer-oriented asynchronous reads.
|
||||
]
|
||||
][
|
||||
[__AsyncWriteStream__]
|
||||
[
|
||||
Supports buffer-oriented asynchronous writes.
|
||||
]
|
||||
][
|
||||
[__AsyncStream__]
|
||||
[
|
||||
A stream supporting buffer-oriented asynchronous reads and writes.
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
These template metafunctions check whether a given type meets the
|
||||
requirements for the various stream concepts, and some additional
|
||||
useful utilities. The library uses these type checks internally
|
||||
and also provides them as public interfaces so users may use the
|
||||
same techniques to augment their own code. The use of these type
|
||||
checks helps provide more concise errors during compilation:
|
||||
|
||||
[table Stream Type Checks
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__get_lowest_layer `get_lowest_layer`]
|
||||
][
|
||||
Returns `T::lowest_layer_type` if it exists, else returns `T`.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__has_get_io_service `has_get_io_service`]
|
||||
][
|
||||
Determine if the `get_io_service` member function is present,
|
||||
and returns an __io_service__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_async_read_stream `is_async_read_stream`]
|
||||
][
|
||||
Determine if a type meets the requirements of __AsyncReadStream__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_async_stream `is_async_stream`]
|
||||
][
|
||||
Determine if a type meets the requirements of both __AsyncReadStream__
|
||||
and __AsyncWriteStream__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_async_write_stream `is_async_write_stream`]
|
||||
][
|
||||
Determine if a type meets the requirements of __AsyncWriteStream__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_completion_handler `is_completion_handler`]
|
||||
][
|
||||
Determine if a type meets the requirements of __CompletionHandler__,
|
||||
and is callable with a specified signature.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_sync_read_stream `is_sync_read_stream`]
|
||||
][
|
||||
Determine if a type meets the requirements of __SyncReadStream__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_sync_stream `is_sync_stream`]
|
||||
][
|
||||
Determine if a type meets the requirements of both __SyncReadStream__
|
||||
and __SyncWriteStream__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_sync_write_stream `is_sync_write_stream`]
|
||||
][
|
||||
Determine if a type meets the requirements of __SyncWriteStream__.
|
||||
]]
|
||||
]
|
||||
|
||||
Using the type checks with `static_assert` on function or class template
|
||||
types will provide users with helpful error messages and prevent undefined
|
||||
behaviors. This example shows how a template function which writes to a
|
||||
synchronous stream may check its argument:
|
||||
|
||||
[snippet_core_3]
|
||||
|
||||
[endsect]
|
||||
161
src/beast/doc/3_3_buffers.qbk
Normal file
@@ -0,0 +1,161 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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 Buffer Types]
|
||||
|
||||
__Asio__ provides the __ConstBufferSequence__ and __MutableBufferSequence__
|
||||
concepts, whose models provide ranges of buffers, as well as the __streambuf__
|
||||
class which encapsulates memory storage that may be automatically resized as
|
||||
required, where the memory is divided into an input sequence followed by an
|
||||
output sequence. The Networking TS (__N4588__) generalizes this `streambuf`
|
||||
interface into the __DynamicBuffer__ concept. Beast algorithms which require
|
||||
resizable buffers accept dynamic buffer objects as templated parameters.
|
||||
These metafunctions check if types match the buffer concepts:
|
||||
|
||||
[table Buffer Type Checks
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__is_dynamic_buffer `is_dynamic_buffer`]
|
||||
][
|
||||
Determine if a type meets the requirements of __DynamicBuffer__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_const_buffer_sequence `is_const_buffer_sequence`]
|
||||
][
|
||||
Determine if a type meets the requirements of __ConstBufferSequence__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__is_mutable_buffer_sequence `is_mutable_buffer_sequence`]
|
||||
][
|
||||
Determine if a type meets the requirements of __MutableBufferSequence__.
|
||||
]]
|
||||
]
|
||||
|
||||
Beast provides several dynamic buffer implementations for a variety
|
||||
of scenarios:
|
||||
|
||||
[table Dynamic Buffer Implementations
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__buffers_adapter `buffers_adapter`]
|
||||
][
|
||||
This wrapper adapts any __MutableBufferSequence__ into a
|
||||
__DynamicBuffer__ with an upper limit on the total size of the input and
|
||||
output areas equal to the size of the underlying mutable buffer sequence.
|
||||
The implementation does not perform heap allocations.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__drain_buffer `drain_buffer`]
|
||||
][
|
||||
A drain buffer has a small internal buffer and maximum size that
|
||||
uses no dynamic allocation. It always has a size of zero, and
|
||||
silently discards its input. This buffer may be passed to functions
|
||||
which store data in a dynamic buffer when the caller wishes to
|
||||
efficiently discard the data.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__flat_buffer `flat_buffer`]
|
||||
[link beast.ref.beast__basic_flat_buffer `basic_flat_buffer`]
|
||||
][
|
||||
Guarantees that input and output areas are buffer sequences with
|
||||
length one. Upon construction an optional upper limit to the total
|
||||
size of the input and output areas may be set. The basic container
|
||||
is an
|
||||
[@http://en.cppreference.com/w/cpp/concept/AllocatorAwareContainer [*AllocatorAwareContainer]].
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__multi_buffer `multi_buffer`]
|
||||
[link beast.ref.beast__basic_multi_buffer `basic_multi_buffer`]
|
||||
][
|
||||
Uses a sequence of one or more character arrays of varying sizes.
|
||||
Additional character array objects are appended to the sequence to
|
||||
accommodate changes in the size of the character sequence. The basic
|
||||
container is an
|
||||
[@http://en.cppreference.com/w/cpp/concept/AllocatorAwareContainer [*AllocatorAwareContainer]].
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__static_buffer `static_buffer`]
|
||||
[link beast.ref.beast__static_buffer `static_buffer_n`]
|
||||
][
|
||||
Provides the facilities of a dynamic buffer, subject to an upper
|
||||
limit placed on the total size of the input and output areas defined
|
||||
by a constexpr template parameter. The storage for the sequences are
|
||||
kept in the class; the implementation does not perform heap allocations.
|
||||
]]
|
||||
]
|
||||
|
||||
Network applications frequently need to manipulate buffer sequences. To
|
||||
facilitate working with buffers the library treats these sequences as
|
||||
a special type of range. Algorithms and wrappers are provided which
|
||||
transform these ranges efficiently using lazy evaluation. No memory
|
||||
allocations are used in the transformations; instead, they create
|
||||
lightweight iterators over the existing, unmodified memory buffers.
|
||||
Control of buffers is retained by the caller; ownership is not
|
||||
transferred.
|
||||
|
||||
[table Buffer Algorithms and Types
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__buffer_cat `buffer_cat`]
|
||||
][
|
||||
This functions returns a new buffer sequence which, when iterated,
|
||||
traverses the sequence which would be formed if all of the input buffer
|
||||
sequences were concatenated. With this routine, multiple calls to a
|
||||
stream's `write_some` function may be combined into one, eliminating
|
||||
expensive system calls.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__buffer_cat_view `buffer_cat_view`]
|
||||
][
|
||||
This class represents the buffer sequence formed by concatenating
|
||||
two or more buffer sequences. This is type of object returned by
|
||||
[link beast.ref.beast__buffer_cat `buffer_cat`].
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__buffer_prefix `buffer_prefix`]
|
||||
][
|
||||
This function returns a new buffer or buffer sequence which represents
|
||||
a prefix of the original buffers.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__buffer_prefix_view `buffer_prefix_view`]
|
||||
][
|
||||
This class represents the buffer sequence formed from a prefix of
|
||||
an existing buffer sequence. This is the type of buffer returned by
|
||||
[link beast.ref.beast__buffer_prefix.overload3 `buffer_prefix`].
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__consuming_buffers `consuming_buffers`]
|
||||
][
|
||||
This class wraps the underlying memory of an existing buffer sequence
|
||||
and presents a suffix of the original sequence. The length of the suffix
|
||||
may be progressively shortened. This lets callers work with sequential
|
||||
increments of a buffer sequence.
|
||||
]]
|
||||
]
|
||||
|
||||
These two functions facilitate buffer interoperability with standard
|
||||
output streams.
|
||||
|
||||
[table Buffer Output Streams
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__buffers `buffers`]
|
||||
][
|
||||
This function wraps a __ConstBufferSequence__ so it may be
|
||||
used with `operator<<` and `std::ostream`.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__ostream `ostream`]
|
||||
][
|
||||
This function returns a `std::ostream` which wraps a dynamic buffer.
|
||||
Characters sent to the stream using `operator<<` are stored in the
|
||||
dynamic buffer.
|
||||
]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
38
src/beast/doc/3_4_files.qbk
Normal file
@@ -0,0 +1,38 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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:files Files]
|
||||
|
||||
Often when implementing network algorithms such as servers, it is necessary
|
||||
to interact with files on the system. Beast defines the __File__ concept
|
||||
and several models to facilitate cross-platform interaction with the
|
||||
underlying filesystem:
|
||||
|
||||
[table File Types
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__file_stdio `file_stdio`]
|
||||
][
|
||||
This implementation of __File__ uses the C++ standard library
|
||||
facilities obtained by including `<cstdio>`.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__file_win32 `file_win32`]
|
||||
][
|
||||
This implements a __File__ for the Win32 API. It provides low level
|
||||
access to the native file handle when necessary.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__file_posix `file_posix`]
|
||||
][
|
||||
For POSIX systems, this class provides a suitable implementation
|
||||
of __File__ which wraps the native file descriptor and provides
|
||||
it if necessary.
|
||||
]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
236
src/beast/doc/3_5_composed.qbk
Normal file
@@ -0,0 +1,236 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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 Writing Composed Operations]
|
||||
[block'''<?dbhtml stop-chunking?>''']
|
||||
|
||||
Asynchronous operations are started by calling a free function or member
|
||||
function known as an asynchronous ['__async_initfn__]. This function accepts
|
||||
parameters specific to the operation as well as a "completion token." The
|
||||
token is either a completion handler, or a type defining how the caller is
|
||||
informed of the asynchronous operation result. __Asio__ comes with the
|
||||
special tokens __use_future__ and __yield_context__ for using futures
|
||||
and coroutines respectively. This system of customizing the return value
|
||||
and method of completion notification is known as the
|
||||
['Extensible Asynchronous Model] described in __N3747__, and a built in
|
||||
to __N4588__. Here is an example of an initiating function which reads a
|
||||
line from the stream and echoes it back. This function is developed
|
||||
further in the next section:
|
||||
|
||||
[example_core_echo_op_1]
|
||||
|
||||
Authors using Beast can reuse the library's primitives to create their
|
||||
own initiating functions for performing a series of other, intermediate
|
||||
asynchronous operations before invoking a final completion handler.
|
||||
The set of intermediate actions produced by an initiating function is
|
||||
known as a
|
||||
[@http://blog.think-async.com/2009/08/composed-operations-coroutines-and-code.html ['composed operation]].
|
||||
To ensure full interoperability and well-defined behavior, __Asio__ imposes
|
||||
requirements on the implementation of composed operations. These classes
|
||||
and functions make it easier to develop initiating functions and their
|
||||
composed operations:
|
||||
|
||||
[table Asynchronous Helpers
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.beast__async_completion `async_completion`]
|
||||
][
|
||||
This class aggregates the completion handler customization point and
|
||||
the asynchronous initiation function return value customization point
|
||||
into a single object which exposes the appropriate output types for the
|
||||
given input types, and also contains boilerplate that is necessary to
|
||||
implement an initiation function using the Extensible Model.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__async_return_type `async_return_type`]
|
||||
][
|
||||
This template alias determines the return value of an asynchronous
|
||||
initiation function given the completion token and signature. It is used
|
||||
by asynchronous initiation functions to meet the requirements of the
|
||||
Extensible Asynchronous Model.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__bind_handler `bind_handler`]
|
||||
][
|
||||
This function returns a new, nullary completion handler which when
|
||||
invoked with no arguments invokes the original completion handler with a
|
||||
list of bound arguments. The invocation is made from the same implicit
|
||||
or explicit strand as that which would be used to invoke the original
|
||||
handler. This is accomplished by using the correct overload of
|
||||
`asio_handler_invoke` associated with the original completion handler.
|
||||
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__handler_alloc `handler_alloc`]
|
||||
][
|
||||
This class meets the requirements of [*Allocator], and uses any custom
|
||||
memory allocation and deallocation hooks associated with a given handler.
|
||||
It is useful for when a composed operation requires temporary dynamic
|
||||
allocations to achieve its result. Memory allocated using this allocator
|
||||
must be freed before the final completion handler is invoked.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__handler_ptr `handler_ptr`]
|
||||
][
|
||||
This is a smart pointer container used to manage the internal state of a
|
||||
composed operation. It is useful when the state is non trivial. For example
|
||||
when the state has non-copyable or expensive to copy types. The container
|
||||
takes ownership of the final completion handler, and provides boilerplate
|
||||
to invoke the final handler in a way that also deletes the internal state.
|
||||
The internal state is allocated using the final completion handler's
|
||||
associated allocator, benefiting from all handler memory management
|
||||
optimizations transparently.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.beast__handler_type `handler_type`]
|
||||
][
|
||||
This template alias converts a completion token and signature to the
|
||||
correct completion handler type. It is used in the implementation of
|
||||
asynchronous initiation functions to meet the requirements of the
|
||||
Extensible Asynchronous Model.
|
||||
]]
|
||||
]
|
||||
|
||||
|
||||
|
||||
[section Echo]
|
||||
|
||||
This example develops an initiating function called [*echo].
|
||||
The operation will read up to the first newline on a stream, and
|
||||
then write the same line including the newline back on the stream.
|
||||
The implementation performs both reading and writing, and has a
|
||||
non-trivially-copyable state.
|
||||
First we define the input parameters and results, then declare our
|
||||
initiation function. For our echo operation the only inputs are the
|
||||
stream and the completion token. The output is the error code which
|
||||
is usually included in all completion handler signatures.
|
||||
|
||||
[example_core_echo_op_2]
|
||||
|
||||
Now that we have a declaration, we will define the body of the function.
|
||||
We want to achieve the following goals: perform static type checking on
|
||||
the input parameters, set up the return value as per __N3747__, and launch
|
||||
the composed operation by constructing the object and invoking it.
|
||||
|
||||
[example_core_echo_op_3]
|
||||
|
||||
The initiating function contains a few relatively simple parts. There is
|
||||
the customization of the return value type, static type checking, building
|
||||
the return value type using the helper, and creating and launching the
|
||||
composed operation object. The [*`echo_op`] object does most of the work
|
||||
here, and has a somewhat non-trivial structure. This structure is necessary
|
||||
to meet the stringent requirements of composed operations (described in more
|
||||
detail in the __Asio__ documentation). We will touch on these requirements
|
||||
without explaining them in depth.
|
||||
|
||||
Here is the boilerplate present in all composed operations written
|
||||
in this style:
|
||||
|
||||
[example_core_echo_op_4]
|
||||
|
||||
Next is to implement the function call operator. Our strategy is to make our
|
||||
composed object meet the requirements of a completion handler by being copyable
|
||||
(also movable), and by providing the function call operator with the correct
|
||||
signature. Rather than using `std::bind` or `boost::bind`, which destroys
|
||||
the type information and therefore breaks the allocation and invocation
|
||||
hooks, we will simply pass `std::move(*this)` as the completion handler
|
||||
parameter for any operations that we initiate. For the move to work correctly,
|
||||
care must be taken to ensure that no access to data members are made after the
|
||||
move takes place. Here is the implementation of the function call operator for
|
||||
this echo operation:
|
||||
|
||||
[example_core_echo_op_5]
|
||||
|
||||
This is the most important element of writing a composed operation, and
|
||||
the part which is often neglected or implemented incorrectly. It is the
|
||||
declaration and definition of the "handler hooks". There are four hooks:
|
||||
|
||||
[table Handler Hooks
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/asio_handler_invoke.html `asio_handler_invoke`]
|
||||
][
|
||||
Default invoke function for handlers. This hooking function ensures
|
||||
that the invoked method used for the final handler is accessible at
|
||||
each intermediate step.
|
||||
]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/asio_handler_allocate.html `asio_handler_allocate`]
|
||||
][
|
||||
Default allocation function for handlers. Implement `asio_handler_allocate`
|
||||
and `asio_handler_deallocate` for your own handlers to provide custom
|
||||
allocation for temporary objects.
|
||||
]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/asio_handler_deallocate.html `asio_handler_deallocate`]
|
||||
][
|
||||
Default deallocation function for handlers. Implement `asio_handler_allocate`
|
||||
and `asio_handler_deallocate` for your own handlers to provide custom
|
||||
allocation for temporary objects.
|
||||
]]
|
||||
[[
|
||||
[@http://www.boost.org/doc/html/boost_asio/reference/asio_handler_is_continuation.html `asio_handler_is_continuation`]
|
||||
][
|
||||
Default continuation function for handlers. Implement
|
||||
`asio_handler_is_continuation` for your own handlers to indicate when
|
||||
a handler represents a continuation.
|
||||
]]
|
||||
]
|
||||
|
||||
Our composed operation stores the final handler and performs its own
|
||||
intermediate asynchronous operations. To ensure that I/O objects, in this
|
||||
case the stream, are accessed safely it is important to use the same method
|
||||
to invoke intermediate handlers as that used to invoke the final handler.
|
||||
Similarly, for the memory allocation hooks our composed operation should use
|
||||
the same hooks as those used by the final handler. And finally for the
|
||||
`asio_is_continuation` hook, we want to return `true` for any intermediate
|
||||
asynchronous operations we perform after the first one, since those represent
|
||||
continuations. For the first asynchronous operation we perform, the hook should
|
||||
return `true` only if the final handler also represents a continuation. Our
|
||||
implementation of the hooks will forward the call to the corresponding
|
||||
overloads of the final handler:
|
||||
|
||||
[example_core_echo_op_6]
|
||||
|
||||
There are some common mistakes that should be avoided when writing
|
||||
composed operations:
|
||||
|
||||
* Type erasing the final handler. This will cause undefined behavior.
|
||||
|
||||
* Not using `std::addressof` to get the address of the handler.
|
||||
|
||||
* Forgetting to include a return statement after calling an
|
||||
initiating function.
|
||||
|
||||
* Calling a synchronous function by accident. In general composed
|
||||
operations should not block for long periods of time, since this
|
||||
ties up a thread running on the __io_service__.
|
||||
|
||||
* Forgetting to overload `asio_handler_invoke` for the composed
|
||||
operation. This will cause undefined behavior if someone calls
|
||||
the initiating function with a strand-wrapped function object,
|
||||
and there is more than thread running on the `io_service`.
|
||||
|
||||
* For operations which complete immediately (i.e. without calling an
|
||||
intermediate initiating function), forgetting to use `io_service::post`
|
||||
to invoke the final handler. This breaks the following initiating
|
||||
function guarantee: ['Regardless of whether the asynchronous operation
|
||||
completes immediately or not, the handler will not be invoked from
|
||||
within this function. Invocation of the handler will be performed
|
||||
in a manner equivalent to using `boost::asio::io_service::post`].
|
||||
The function
|
||||
[link beast.ref.beast__bind_handler `bind_handler`]
|
||||
is provided for this purpose.
|
||||
|
||||
A complete, runnable version of this example may be found in the examples
|
||||
directory.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
|
||||
[endsect]
|
||||
67
src/beast/doc/3_6_detect_ssl.qbk
Normal file
@@ -0,0 +1,67 @@
|
||||
[/
|
||||
Copyright (c) 2013-2017 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 Example: Detect SSL]
|
||||
|
||||
In this example we will build a simple function to detect the presence
|
||||
of the SSL handshake given an input buffer sequence. Then we build on
|
||||
the example by adding a synchronous stream algorithm. Finally, we
|
||||
implemement an asynchronous detection function using a composed operation.
|
||||
This SSL detector may be used to allow a server to accept both SSL/TLS and
|
||||
unencrypted connections at the same port.
|
||||
|
||||
Here is the declaration for a function to detect the SSL client handshake.
|
||||
The input to the function is simply a buffer sequence, no stream. This
|
||||
allows the detection algorithm to be used elsewhere.
|
||||
|
||||
[example_core_detect_ssl_1]
|
||||
|
||||
The implementation checks the buffer for the presence of the SSL
|
||||
Handshake message octet sequence and returns an apporopriate value:
|
||||
|
||||
[example_core_detect_ssl_2]
|
||||
|
||||
Now we define a stream operation. We start with the simple,
|
||||
synchronous version which takes the stream and buffer as input:
|
||||
|
||||
[example_core_detect_ssl_3]
|
||||
|
||||
The synchronous algorithm is the model for building the asynchronous
|
||||
operation which has more boilerplate. First, we declare the asynchronous
|
||||
initiating function:
|
||||
|
||||
[example_core_detect_ssl_4]
|
||||
|
||||
The implementation of the initiating function is straightforward
|
||||
and contains mostly boilerplate. It is to construct the return
|
||||
type customization helper to obtain the actual handler, and
|
||||
then create the composed operation and launch it. The actual
|
||||
code for interacting with the stream is in the composed operation,
|
||||
which is written as a separate class.
|
||||
|
||||
[example_core_detect_ssl_5]
|
||||
|
||||
Now we will declare our composed operation. There is a considerable
|
||||
amount of necessary boilerplate to get this right, but the result
|
||||
is worth the effort.
|
||||
|
||||
[example_core_detect_ssl_6]
|
||||
|
||||
The boilerplate is all done, and now we need to implement the function
|
||||
call operator that turns this composed operation a completion handler
|
||||
with the signature `void(error_code, std::size_t)` which is exactly
|
||||
the signature needed when performing asynchronous reads. This function
|
||||
is a transformation of the synchronous version of `detect_ssl` above,
|
||||
but with the inversion of flow that characterizes code written in the
|
||||
callback style:
|
||||
|
||||
[example_core_detect_ssl_7]
|
||||
|
||||
This SSL detector is used by the server framework in the example
|
||||
directory.
|
||||
|
||||
[endsect]
|
||||