Compare commits
238
Commits
NLSR-0.3.1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd1e940648 | ||
|
|
5849ee7582 | ||
|
|
2ecb059eb9 | ||
|
|
20377645fb | ||
|
|
6593a43fa3 | ||
|
|
931ca9f576 | ||
|
|
cd77aabaa9 | ||
|
|
eed3209c8d | ||
|
|
5110a8a4ee | ||
|
|
52f16644ab | ||
|
|
43f37a08fc | ||
|
|
ecb0b7180e | ||
|
|
771a0de40c | ||
|
|
907675bd06 | ||
|
|
7543f590a3 | ||
|
|
a2599dafa9 | ||
|
|
f7ea150405 | ||
|
|
658fd85bc7 | ||
|
|
070ee3b52d | ||
|
|
e0ad5808e3 | ||
|
|
fa54ee99b4 | ||
|
|
1e9faf1d1b | ||
|
|
1b640fd092 | ||
|
|
fcef058206 | ||
|
|
7d2d689d89 | ||
|
|
65ee992149 | ||
|
|
69904fcb73 | ||
|
|
1954a0c5ce | ||
|
|
d1cb063482 | ||
|
|
ede5963845 | ||
|
|
c1d0e8e34d | ||
|
|
0c87b12458 | ||
|
|
fabe9729b9 | ||
|
|
135288cf4f | ||
|
|
8de8a8b37a | ||
|
|
b032fcb38f | ||
|
|
583473a76f | ||
|
|
e28d8756ce | ||
|
|
d1f1df802c | ||
|
|
a3a63975d1 | ||
|
|
ea94f83039 | ||
|
|
cf14807f7d | ||
|
|
7bc3d438e7 | ||
|
|
ba8a4ed2d2 | ||
|
|
7ae8b08fc2 | ||
|
|
6f0f35d96d | ||
|
|
3781c7ebc1 | ||
|
|
22520e68f5 | ||
|
|
6184c2088b | ||
|
|
e63b7fa7dc | ||
|
|
04bfe0465a | ||
|
|
30d96e4875 | ||
|
|
6002e6ab4b | ||
|
|
5d93aa5b04 | ||
|
|
d90338d230 | ||
|
|
cf06444860 | ||
|
|
214032e7ac | ||
|
|
0af4627ad7 | ||
|
|
e4edb3952c | ||
|
|
d8d6bbcbe6 | ||
|
|
4a90b9ae52 | ||
|
|
7a231c0dc1 | ||
|
|
57a8717ec7 | ||
|
|
0421bc6bcd | ||
|
|
0ad01f3834 | ||
|
|
96ebd9b7c3 | ||
|
|
a122abf5f6 | ||
|
|
4b9d30f8e2 | ||
|
|
f6be8e37f6 | ||
|
|
0db4d4d8fc | ||
|
|
f89878c12c | ||
|
|
fd021d5e3d | ||
|
|
1158c55878 | ||
|
|
427e012304 | ||
|
|
4a5334cba7 | ||
|
|
55d1b5c2c0 | ||
|
|
cb065f1773 | ||
|
|
328fc11217 | ||
|
|
6b388fc36d | ||
|
|
f75bfdaa34 | ||
|
|
842b1cf1f0 | ||
|
|
d21d83d892 | ||
|
|
4187857a9a | ||
|
|
d0816a3ced | ||
|
|
c64bed22a8 | ||
|
|
9ea3639be2 | ||
|
|
cf22053914 | ||
|
|
348321368d | ||
|
|
08bce9c325 | ||
|
|
0b1b7d9ff4 | ||
|
|
15052408e9 | ||
|
|
dec85d2da4 | ||
|
|
af7a2113e4 | ||
|
|
0b0eddd60c | ||
|
|
9ecbdc95c5 | ||
|
|
b2fea6d79f | ||
|
|
d3b60a8b24 | ||
|
|
0da3eab4da | ||
|
|
82a34c2cd8 | ||
|
|
85998a1dc9 | ||
|
|
7e3f6d75c8 | ||
|
|
e3c741da9a | ||
|
|
5859ed3dfb | ||
|
|
e556991595 | ||
|
|
72b2b25cd2 | ||
|
|
7c13ba5448 | ||
|
|
008c9b18a5 | ||
|
|
7526cee087 | ||
|
|
939b6f8652 | ||
|
|
e5002b3fc4 | ||
|
|
32ec3fd51e | ||
|
|
2fa23ea104 | ||
|
|
744e481642 | ||
|
|
8433cfeace | ||
|
|
2e6c8bb896 | ||
|
|
3494f7366a | ||
|
|
05cb728c63 | ||
|
|
057005460e | ||
|
|
e8d8bd5276 | ||
|
|
481010723b | ||
|
|
a08dc3f1f1 | ||
|
|
301220346e | ||
|
|
8df15986ef | ||
|
|
f3c79a6f87 | ||
|
|
cba0ae2f56 | ||
|
|
f1a8ee66de | ||
|
|
d65786a0ea | ||
|
|
e6ba9158e0 | ||
|
|
aa41b04807 | ||
|
|
67758b1fba | ||
|
|
350d58489b | ||
|
|
8c6d8c831a | ||
|
|
0b27c1ff5c | ||
|
|
39cf81a110 | ||
|
|
b0bf8df1bd | ||
|
|
a073e2e23e | ||
|
|
9da6aa7fce | ||
|
|
304bebf64f | ||
|
|
982a58fae5 | ||
|
|
7afe22f410 | ||
|
|
f7da9c542c | ||
|
|
c3ea26f000 | ||
|
|
0d2c38299e | ||
|
|
563611eb20 | ||
|
|
af87575012 | ||
|
|
4964870e9d | ||
|
|
b2ef6adbd3 | ||
|
|
cf8d0eda75 | ||
|
|
437adfeed6 | ||
|
|
357318540d | ||
|
|
14ab329746 | ||
|
|
ed473c6c47 | ||
|
|
ac4b65664f | ||
|
|
d88c1dfdc2 | ||
|
|
9e955bcec7 | ||
|
|
f04f98943d | ||
|
|
2f62338d12 | ||
|
|
ae0a047c41 | ||
|
|
5bcb39e255 | ||
|
|
0fa4c77987 | ||
|
|
22cc1a8d17 | ||
|
|
96861ca49c | ||
|
|
faf49f4c32 | ||
|
|
9212bd43bb | ||
|
|
727d4830d7 | ||
|
|
ff9a62713b | ||
|
|
e18296c270 | ||
|
|
2a1ac616b3 | ||
|
|
a47255c2c5 | ||
|
|
ffb62fa3fb | ||
|
|
114537f6e0 | ||
|
|
922714a0d9 | ||
|
|
5867b5233f | ||
|
|
d40a588e25 | ||
|
|
8f23b5d58e | ||
|
|
9eac4d9830 | ||
|
|
6ebfd7c182 | ||
|
|
b7b5839197 | ||
|
|
813df80e20 | ||
|
|
0bd37314fe | ||
|
|
6a81b77260 | ||
|
|
c0c6bcf7e2 | ||
|
|
098aae410a | ||
|
|
e40377d570 | ||
|
|
7afcab4652 | ||
|
|
e98480b5d1 | ||
|
|
d0a7df337f | ||
|
|
e0d2048d5f | ||
|
|
f14ec357d5 | ||
|
|
c58cc7f596 | ||
|
|
22b5c957c0 | ||
|
|
90173ad966 | ||
|
|
608061b95d | ||
|
|
793e8707a1 | ||
|
|
54a43f06e1 | ||
|
|
820bb66350 | ||
|
|
9b71bbc970 | ||
|
|
3909aa160a | ||
|
|
d5c1a378d1 | ||
|
|
f6bfb14def | ||
|
|
d22da51783 | ||
|
|
a75fdb27c5 | ||
|
|
cd7ca05378 | ||
|
|
b00dc2acea | ||
|
|
0f1bf1dfcd | ||
|
|
8bfd124212 | ||
|
|
7600c90882 | ||
|
|
e9733ed876 | ||
|
|
b9e2c650e6 | ||
|
|
494de4033d | ||
|
|
56d1fae10a | ||
|
|
adad2490e5 | ||
|
|
b23f279353 | ||
|
|
3e105a0493 | ||
|
|
b9c5cecfb2 | ||
|
|
f8852c2d27 | ||
|
|
9461afb721 | ||
|
|
2108808ae3 | ||
|
|
6fa00d923c | ||
|
|
b4567f40fb | ||
|
|
415676b6cc | ||
|
|
c780a6986b | ||
|
|
9eaf3f4417 | ||
|
|
c2c3ae0fd2 | ||
|
|
812af97447 | ||
|
|
e689dd6d8b | ||
|
|
4d2c6c07ae | ||
|
|
30096b8f37 | ||
|
|
3be6466a85 | ||
|
|
f023a88ec1 | ||
|
|
4c2bb361ae | ||
|
|
1de901f161 | ||
|
|
9f93666519 | ||
|
|
48daea20d7 | ||
|
|
218aaef118 | ||
|
|
87911dacd5 | ||
|
|
54e726cf5e | ||
|
|
a4cf402084 |
No files matched your search
@@ -0,0 +1,16 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '*.md'
|
||||
- '.mailmap'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
Ubuntu:
|
||||
uses: named-data/actions/.github/workflows/jenkins-script-ubuntu.yml@v1
|
||||
macOS:
|
||||
uses: named-data/actions/.github/workflows/jenkins-script-macos.yml@v1
|
||||
@@ -0,0 +1,21 @@
|
||||
name: Docs
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip-deploy:
|
||||
description: 'Skip deployment?'
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
html:
|
||||
uses: named-data/actions/.github/workflows/docs-html.yml@v1
|
||||
with:
|
||||
# Deploy only the master branch and release tags
|
||||
deploy: ${{ !inputs.skip-deploy && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/NLSR-')) }}
|
||||
secrets: inherit
|
||||
man:
|
||||
uses: named-data/actions/.github/workflows/docs-man.yml@v1
|
||||
+32
-7
@@ -1,7 +1,32 @@
|
||||
.DS*
|
||||
.waf-1*
|
||||
.waf3-*
|
||||
.lock*
|
||||
**/*.pyc
|
||||
build/
|
||||
VERSION
|
||||
# Emacs
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
.\#*
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
# KDevelop
|
||||
*.kdev*
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
._*
|
||||
|
||||
# Waf build system
|
||||
/build/
|
||||
.waf-*-*/
|
||||
.waf3-*-*/
|
||||
.lock-waf*
|
||||
|
||||
# Compiled python code
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# Other
|
||||
/VERSION.info
|
||||
@@ -1,10 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -eo pipefail
|
||||
|
||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
case $(uname) in
|
||||
Linux)
|
||||
if [[ -e /etc/os-release ]]; then
|
||||
source /etc/os-release
|
||||
else
|
||||
source /usr/lib/os-release
|
||||
fi
|
||||
export ID VERSION_ID
|
||||
export ID_LIKE="${ID} ${ID_LIKE} linux"
|
||||
export PATH="${HOME}/.local/bin${PATH:+:}${PATH}"
|
||||
;;
|
||||
Darwin)
|
||||
# Emulate a subset of os-release(5)
|
||||
export ID=macos
|
||||
export VERSION_ID=$(sw_vers -productVersion)
|
||||
export PATH="/usr/local/bin${PATH:+:}${PATH}"
|
||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
elif [[ -x /usr/local/bin/brew ]]; then
|
||||
eval "$(/usr/local/bin/brew shellenv)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
for file in "$DIR"/.jenkins.d/*; do
|
||||
export CACHE_DIR=${CACHE_DIR:-/tmp}
|
||||
|
||||
if [[ $JOB_NAME == *"code-coverage" ]]; then
|
||||
export DISABLE_ASAN=yes
|
||||
export DISABLE_HEADERS_CHECK=yes
|
||||
fi
|
||||
|
||||
# https://reproducible-builds.org/docs/source-date-epoch/
|
||||
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
|
||||
|
||||
for file in .jenkins.d/*; do
|
||||
[[ -f $file && -x $file ]] || continue
|
||||
echo "Run: $file"
|
||||
|
||||
if [[ -n $GITHUB_ACTIONS ]]; then
|
||||
label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
|
||||
echo "::group::${label}"
|
||||
fi
|
||||
|
||||
echo "\$ $file"
|
||||
"$file"
|
||||
|
||||
if [[ -n $GITHUB_ACTIONS ]]; then
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
done
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
APT_PKGS=(build-essential pkg-config python3-minimal
|
||||
libboost-all-dev libssl-dev libsqlite3-dev)
|
||||
FORMULAE=(boost openssl pkg-config)
|
||||
PIP_PKGS=()
|
||||
case $JOB_NAME in
|
||||
*code-coverage)
|
||||
APT_PKGS+=(lcov python3-pip)
|
||||
PIP_PKGS+=('gcovr~=5.2')
|
||||
;;
|
||||
*Docs)
|
||||
APT_PKGS+=(doxygen graphviz python3-pip)
|
||||
FORMULAE+=(doxygen graphviz)
|
||||
PIP_PKGS+=(sphinx sphinxcontrib-doxylink)
|
||||
;;
|
||||
esac
|
||||
|
||||
set -x
|
||||
|
||||
if [[ $ID == macos ]]; then
|
||||
if [[ -n $GITHUB_ACTIONS ]]; then
|
||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
||||
fi
|
||||
brew update
|
||||
brew install --formula "${FORMULAE[@]}"
|
||||
elif [[ $ID_LIKE == *debian* ]]; then
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get -qy install "${APT_PKGS[@]}"
|
||||
elif [[ $ID_LIKE == *fedora* ]]; then
|
||||
sudo dnf -y install gcc-c++ libasan lld pkgconf-pkg-config python3 \
|
||||
boost-devel openssl-devel sqlite-devel
|
||||
fi
|
||||
|
||||
if (( ${#PIP_PKGS[@]} )); then
|
||||
pip3 install --user --upgrade --upgrade-strategy=eager "${PIP_PKGS[@]}"
|
||||
fi
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "$JDIR"/util.sh
|
||||
|
||||
if has OSX $NODE_LABELS && ! has OSX-10.8-c++11-64bit $NODE_LABELS; then
|
||||
# OSX 10.8 requires special handling of dependencies
|
||||
set -x
|
||||
brew update
|
||||
brew upgrade
|
||||
brew install boost pkg-config sqlite cryptopp log4cxx protobuf openssl
|
||||
brew link --force openssl log4cxx protobuf
|
||||
brew cleanup
|
||||
fi
|
||||
|
||||
if has Ubuntu $NODE_LABELS; then
|
||||
BOOST_PKG=libboost-all-dev
|
||||
if has Ubuntu-12.04 $NODE_LABELS; then
|
||||
BOOST_PKG=libboost1.48-all-dev
|
||||
fi
|
||||
|
||||
set -x
|
||||
sudo apt-get update -qq -y
|
||||
sudo apt-get -qq -y install build-essential pkg-config $BOOST_PKG \
|
||||
libcrypto++-dev libsqlite3-dev \
|
||||
liblog4cxx10-dev protobuf-compiler libprotobuf-dev libssl-dev
|
||||
fi
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
set -exo pipefail
|
||||
|
||||
pushd "$CACHE_DIR" >/dev/null
|
||||
|
||||
INSTALLED_VERSION=
|
||||
if [[ $ID == macos ]]; then
|
||||
BOOST=$(brew list --formula --versions boost)
|
||||
OLD_BOOST=$(cat boost.txt || :)
|
||||
if [[ $OLD_BOOST != $BOOST ]]; then
|
||||
echo "$BOOST" > boost.txt
|
||||
INSTALLED_VERSION=NONE
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z $INSTALLED_VERSION ]]; then
|
||||
INSTALLED_VERSION=$(git -C ndn-cxx rev-parse HEAD 2>/dev/null || echo NONE)
|
||||
fi
|
||||
|
||||
sudo rm -rf ndn-cxx-latest
|
||||
git clone --depth 1 https://github.com/named-data/ndn-cxx.git ndn-cxx-latest
|
||||
LATEST_VERSION=$(git -C ndn-cxx-latest rev-parse HEAD 2>/dev/null || echo UNKNOWN)
|
||||
|
||||
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
|
||||
sudo rm -rf ndn-cxx
|
||||
mv ndn-cxx-latest ndn-cxx
|
||||
else
|
||||
sudo rm -rf ndn-cxx-latest
|
||||
fi
|
||||
|
||||
sudo rm -f /usr/local/bin/ndnsec*
|
||||
sudo rm -fr /usr/local/include/ndn-cxx
|
||||
sudo rm -f /usr/local/lib{,64}/libndn-cxx*
|
||||
sudo rm -f /usr/local/lib{,64}/pkgconfig/libndn-cxx.pc
|
||||
|
||||
pushd ndn-cxx >/dev/null
|
||||
|
||||
./waf --color=yes configure --without-osx-keychain
|
||||
./waf --color=yes build
|
||||
sudo ./waf --color=yes install
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if [[ $ID_LIKE == *fedora* ]]; then
|
||||
sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
|
||||
fi
|
||||
if [[ $ID_LIKE == *linux* ]]; then
|
||||
sudo ldconfig
|
||||
fi
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -exo pipefail
|
||||
|
||||
PROJ=ChronoSync
|
||||
|
||||
pushd "$CACHE_DIR" >/dev/null
|
||||
|
||||
INSTALLED_VERSION=
|
||||
NDN_CXX=$(ndnsec version)
|
||||
OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :)
|
||||
if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
|
||||
echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt"
|
||||
INSTALLED_VERSION=NONE
|
||||
fi
|
||||
|
||||
if [[ -z $INSTALLED_VERSION ]]; then
|
||||
INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE)
|
||||
fi
|
||||
|
||||
sudo rm -rf "$PROJ-latest"
|
||||
git clone --depth 1 "https://github.com/named-data/$PROJ.git" "$PROJ-latest"
|
||||
LATEST_VERSION=$(git -C "$PROJ-latest" rev-parse HEAD 2>/dev/null || echo UNKNOWN)
|
||||
|
||||
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
|
||||
sudo rm -rf "$PROJ"
|
||||
mv "$PROJ-latest" "$PROJ"
|
||||
else
|
||||
sudo rm -rf "$PROJ-latest"
|
||||
fi
|
||||
|
||||
sudo rm -fr /usr/local/include/"$PROJ"
|
||||
sudo rm -f /usr/local/lib{,64}/lib"$PROJ"*
|
||||
sudo rm -f /usr/local/lib{,64}/pkgconfig/"$PROJ".pc
|
||||
|
||||
pushd "$PROJ" >/dev/null
|
||||
|
||||
./waf --color=yes configure
|
||||
./waf --color=yes build
|
||||
sudo ./waf --color=yes install
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if [[ $ID_LIKE == *fedora* ]]; then
|
||||
sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
|
||||
fi
|
||||
if [[ $ID_LIKE == *linux* ]]; then
|
||||
sudo ldconfig
|
||||
fi
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -exo pipefail
|
||||
|
||||
PROJ=PSync
|
||||
|
||||
pushd "$CACHE_DIR" >/dev/null
|
||||
|
||||
INSTALLED_VERSION=
|
||||
NDN_CXX=$(ndnsec version)
|
||||
OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :)
|
||||
if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
|
||||
echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt"
|
||||
INSTALLED_VERSION=NONE
|
||||
fi
|
||||
|
||||
if [[ -z $INSTALLED_VERSION ]]; then
|
||||
INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE)
|
||||
fi
|
||||
|
||||
sudo rm -rf "$PROJ-latest"
|
||||
git clone --depth 1 "https://github.com/named-data/$PROJ.git" "$PROJ-latest"
|
||||
LATEST_VERSION=$(git -C "$PROJ-latest" rev-parse HEAD 2>/dev/null || echo UNKNOWN)
|
||||
|
||||
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
|
||||
sudo rm -rf "$PROJ"
|
||||
mv "$PROJ-latest" "$PROJ"
|
||||
else
|
||||
sudo rm -rf "$PROJ-latest"
|
||||
fi
|
||||
|
||||
sudo rm -fr /usr/local/include/"$PROJ"
|
||||
sudo rm -f /usr/local/lib{,64}/lib"$PROJ"*
|
||||
sudo rm -f /usr/local/lib{,64}/pkgconfig/"$PROJ".pc
|
||||
|
||||
pushd "$PROJ" >/dev/null
|
||||
|
||||
./waf --color=yes configure
|
||||
./waf --color=yes build
|
||||
sudo ./waf --color=yes install
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if [[ $ID_LIKE == *fedora* ]]; then
|
||||
sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
|
||||
fi
|
||||
if [[ $ID_LIKE == *linux* ]]; then
|
||||
sudo ldconfig
|
||||
fi
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -exo pipefail
|
||||
|
||||
PROJ=ndn-svs
|
||||
|
||||
pushd "$CACHE_DIR" >/dev/null
|
||||
|
||||
INSTALLED_VERSION=
|
||||
NDN_CXX=$(ndnsec version)
|
||||
OLD_NDN_CXX=$(cat "$PROJ-ndn-cxx.txt" || :)
|
||||
if [[ $OLD_NDN_CXX != $NDN_CXX ]]; then
|
||||
echo "$NDN_CXX" > "$PROJ-ndn-cxx.txt"
|
||||
INSTALLED_VERSION=NONE
|
||||
fi
|
||||
|
||||
if [[ -z $INSTALLED_VERSION ]]; then
|
||||
INSTALLED_VERSION=$(git -C "$PROJ" rev-parse HEAD 2>/dev/null || echo NONE)
|
||||
fi
|
||||
|
||||
sudo rm -rf "$PROJ-latest"
|
||||
git clone --depth 1 "https://github.com/named-data/$PROJ.git" "$PROJ-latest"
|
||||
LATEST_VERSION=$(git -C "$PROJ-latest" rev-parse HEAD 2>/dev/null || echo UNKNOWN)
|
||||
|
||||
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
|
||||
sudo rm -rf "$PROJ"
|
||||
mv "$PROJ-latest" "$PROJ"
|
||||
else
|
||||
sudo rm -rf "$PROJ-latest"
|
||||
fi
|
||||
|
||||
sudo rm -fr /usr/local/include/"$PROJ"
|
||||
sudo rm -f /usr/local/lib{,64}/lib"$PROJ"*
|
||||
sudo rm -f /usr/local/lib{,64}/pkgconfig/"$PROJ".pc
|
||||
|
||||
pushd "$PROJ" >/dev/null
|
||||
|
||||
./waf --color=yes configure
|
||||
./waf --color=yes build
|
||||
sudo ./waf --color=yes install
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if [[ $ID_LIKE == *fedora* ]]; then
|
||||
sudo tee /etc/ld.so.conf.d/ndn.conf >/dev/null <<< /usr/local/lib64
|
||||
fi
|
||||
if [[ $ID_LIKE == *linux* ]]; then
|
||||
sudo ldconfig
|
||||
fi
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
if [[ -z $DISABLE_ASAN ]]; then
|
||||
ASAN="--with-sanitizer=address"
|
||||
fi
|
||||
if [[ $JOB_NAME == *"code-coverage" ]]; then
|
||||
COVERAGE="--with-coverage"
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
|
||||
# Build in release mode with tests
|
||||
./waf --color=yes configure --with-tests
|
||||
./waf --color=yes build
|
||||
|
||||
# Cleanup
|
||||
./waf --color=yes distclean
|
||||
|
||||
# Build in release mode without tests
|
||||
./waf --color=yes configure
|
||||
./waf --color=yes build
|
||||
|
||||
# Cleanup
|
||||
./waf --color=yes distclean
|
||||
fi
|
||||
|
||||
# Build in debug mode with tests
|
||||
./waf --color=yes configure --debug --with-chronosync --with-psync --with-svs --with-tests $ASAN $COVERAGE
|
||||
./waf --color=yes build
|
||||
|
||||
# (tests will be run against the debug version)
|
||||
|
||||
# Install
|
||||
sudo ./waf --color=yes install
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
|
||||
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source "$JDIR"/util.sh
|
||||
|
||||
pushd /tmp >/dev/null
|
||||
|
||||
INSTALLED_VERSION=$((cd ndn-cxx && git rev-parse HEAD) 2>/dev/null || echo NONE)
|
||||
|
||||
sudo rm -Rf ndn-cxx-latest
|
||||
|
||||
git clone --depth 1 git://github.com/named-data/ndn-cxx ndn-cxx-latest
|
||||
|
||||
LATEST_VERSION=$((cd ndn-cxx-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN)
|
||||
|
||||
if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then
|
||||
sudo rm -Rf ndn-cxx
|
||||
mv ndn-cxx-latest ndn-cxx
|
||||
else
|
||||
sudo rm -Rf ndn-cxx-latest
|
||||
fi
|
||||
|
||||
sudo rm -Rf /usr/local/include/ndn-cxx
|
||||
sudo rm -f /usr/local/lib/libndn-cxx*
|
||||
sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
|
||||
|
||||
pushd ndn-cxx >/dev/null
|
||||
|
||||
./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
|
||||
./waf -j1 --color=yes
|
||||
sudo ./waf install -j1 --color=yes
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
|
||||
if has Linux $NODE_LABELS; then
|
||||
sudo ldconfig
|
||||
elif has FreeBSD $NODE_LABELS; then
|
||||
sudo ldconfig -a
|
||||
fi
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
|
||||
git submodule init
|
||||
git submodule sync
|
||||
git submodule update
|
||||
|
||||
COVERAGE=$( python -c "print '--with-coverage' if 'code-coverage' in '$JOB_NAME' else ''" )
|
||||
|
||||
# Cleanup
|
||||
sudo ./waf -j1 --color=yes distclean
|
||||
|
||||
# Configure/build in debug mode
|
||||
./waf -j1 --color=yes configure --with-tests --debug
|
||||
./waf -j1 --color=yes build
|
||||
|
||||
# Cleanup
|
||||
sudo ./waf -j1 --color=yes distclean
|
||||
|
||||
# Configure/build in optimized mode without tests
|
||||
./waf -j1 --color=yes configure
|
||||
./waf -j1 --color=yes build
|
||||
|
||||
# Cleanup
|
||||
sudo ./waf -j1 --color=yes distclean
|
||||
|
||||
# Configure/build in optimized mode with tests
|
||||
./waf -j1 --color=yes configure --with-tests $COVERAGE
|
||||
./waf -j1 --color=yes build
|
||||
|
||||
# (tests will be run against optimized version)
|
||||
|
||||
./waf configure --color=yes --with-tests $COVERAGE
|
||||
|
||||
./waf -j1 --color=yes
|
||||
sudo ./waf install --color=yes
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
|
||||
ASAN_OPTIONS="color=always"
|
||||
ASAN_OPTIONS+=":check_initialization_order=1"
|
||||
ASAN_OPTIONS+=":detect_stack_use_after_return=1"
|
||||
ASAN_OPTIONS+=":strict_init_order=1"
|
||||
ASAN_OPTIONS+=":strict_string_checks=1"
|
||||
ASAN_OPTIONS+=":detect_invalid_pointer_pairs=2"
|
||||
ASAN_OPTIONS+=":detect_container_overflow=0"
|
||||
ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
|
||||
export ASAN_OPTIONS
|
||||
|
||||
# https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/runtime_config/summary.html
|
||||
export BOOST_TEST_BUILD_INFO=1
|
||||
export BOOST_TEST_COLOR_OUTPUT=1
|
||||
export BOOST_TEST_DETECT_MEMORY_LEAK=0
|
||||
export BOOST_TEST_LOGGER=HRF,test_suite,stdout:XML,all,build/xunit-log.xml
|
||||
|
||||
set -x
|
||||
|
||||
# Prepare environment
|
||||
rm -rf ~/.ndn
|
||||
|
||||
# Run unit tests
|
||||
./build/unit-tests-nlsr
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -exo pipefail
|
||||
|
||||
if [[ $JOB_NAME == *"code-coverage" ]]; then
|
||||
# Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
|
||||
# Note: trailing slashes are important in the paths below. Do not remove them!
|
||||
gcovr --object-directory build \
|
||||
--filter src/ \
|
||||
--exclude-throw-branches \
|
||||
--exclude-unreachable-branches \
|
||||
--cobertura build/coverage.xml \
|
||||
--html-details build/gcovr/ \
|
||||
--print-summary
|
||||
|
||||
# Generate a detailed HTML report using lcov
|
||||
lcov --quiet \
|
||||
--capture \
|
||||
--directory . \
|
||||
--exclude "$PWD/tests/*" \
|
||||
--no-external \
|
||||
--rc lcov_branch_coverage=1 \
|
||||
--output-file build/coverage.info
|
||||
|
||||
genhtml --branch-coverage \
|
||||
--demangle-cpp \
|
||||
--legend \
|
||||
--output-directory build/lcov \
|
||||
--title "NLSR unit tests" \
|
||||
build/coverage.info
|
||||
fi
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
|
||||
rm -Rf ~/.ndn
|
||||
|
||||
./build/unit-tests-nlsr -l test_suite
|
||||
@@ -0,0 +1,36 @@
|
||||
# Continuous Integration Scripts
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `ID`: lower-case string that identifies the operating system, for example: `ID=ubuntu`,
|
||||
`ID=centos`. See [os-release(5)] for more information. On macOS, where `os-release` is
|
||||
not available, we emulate it by setting `ID=macos`.
|
||||
|
||||
- `ID_LIKE`: space-separated list of operating system identifiers that are closely related
|
||||
to the running OS. See [os-release(5)] for more information. The listed values are used
|
||||
by the CI scripts to select the proper behavior for different platforms and OS flavors.
|
||||
|
||||
Examples:
|
||||
|
||||
- On CentOS, `ID_LIKE="centos rhel fedora linux"`
|
||||
- On Ubuntu, `ID_LIKE="ubuntu debian linux"`
|
||||
|
||||
- `VERSION_ID`: identifies the operating system version, excluding any release code names.
|
||||
See [os-release(5)] for more information. Examples: `VERSION_ID=42`, `VERSION_ID=22.04`.
|
||||
|
||||
- `JOB_NAME`: defines the type of the current CI job. Depending on the job type, the CI
|
||||
scripts can perform different tasks.
|
||||
|
||||
Supported values:
|
||||
|
||||
- empty: default build task
|
||||
- `code-coverage`: debug build with tests and code coverage analysis
|
||||
- `limited-build`: only a single debug build with tests
|
||||
|
||||
- `CACHE_DIR`: directory containing cached files from previous builds, e.g., a compiled
|
||||
version of ndn-cxx. If not set, `/tmp` is used.
|
||||
|
||||
- `DISABLE_ASAN`: disable building with AddressSanitizer. This is automatically set for
|
||||
the `code-coverage` job type.
|
||||
|
||||
[os-release(5)]: https://www.freedesktop.org/software/systemd/man/os-release.html
|
||||
@@ -1,9 +0,0 @@
|
||||
has() {
|
||||
local p=$1
|
||||
shift
|
||||
local x
|
||||
for x in "$@"; do
|
||||
[[ "${x}" == "${p}" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
A K M Mahmudul Hoque <akmhoque@gmail.com>
|
||||
<agawande@memphis.edu> <ashu2493@gmail.com>
|
||||
Nick Gordon <nmgordon@memphis.edu>
|
||||
Laqin Fan <lfan1@memphis.edu>
|
||||
Syed Obaid Amin <soamin@memphis.edu>
|
||||
Syed Obaid Amin <soamin@memphis.edu> <obaidasyed@gmail.com>
|
||||
Syed Obaid Amin <soamin@memphis.edu> <obaid@Obaids-MacBook.local>
|
||||
Syed Obaid Amin <soamin@memphis.edu> <obaid@obaids-macbook.memphis.edu>
|
||||
Syed Obaid Amin <soamin@memphis.edu> <soamin@mira.cs.memphis.edu>
|
||||
Syed Obaid Amin <soamin@memphis.edu> <soamin@wd222yx4.memphis.edu>
|
||||
Muktadir R Chowdhury <mrchwdhr@memphis.edu>
|
||||
Muktadir R Chowdhury <mrchwdhr@memphis.edu> <muktadir.rahman.c@gmail.com>
|
||||
<aa@cs.fiu.edu> <alexander.afanasyev@ucla.edu>
|
||||
<davidepesa@gmail.com> <davide.pesavento@lip6.fr>
|
||||
<enewberry@email.arizona.edu> <enewberry@cs.arizona.edu>
|
||||
Md Ashiqur Rahman <marahman@email.arizona.edu>
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
sudo: required
|
||||
language: generic
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
env:
|
||||
- CXX=g++
|
||||
- NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
|
||||
- os: linux
|
||||
dist: trusty
|
||||
env:
|
||||
- CXX=clang++
|
||||
- NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
|
||||
- os: osx
|
||||
osx_image: xcode8.2
|
||||
env:
|
||||
- CXX=clang++
|
||||
- NODE_LABELS="OSX OSX-10.12"
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
||||
on_failure: always
|
||||
script:
|
||||
- ./.jenkins
|
||||
+252
-97
@@ -30,15 +30,15 @@ When using this tool, the wscript will look like:
|
||||
|
||||
Options are generated, in order to specify the location of boost includes/libraries.
|
||||
The `check_boost` configuration function allows to specify the used boost libraries.
|
||||
It can also provide default arguments to the --boost-static and --boost-mt command-line arguments.
|
||||
It can also provide default arguments to the --boost-mt command-line arguments.
|
||||
Everything will be packaged together in a BOOST component that you can use.
|
||||
|
||||
When using MSVC, a lot of compilation flags need to match your BOOST build configuration:
|
||||
- you may have to add /EHsc to your CXXFLAGS or define boost::throw_exception if BOOST_NO_EXCEPTIONS is defined.
|
||||
Errors: C4530
|
||||
- boost libraries will try to be smart and use the (pretty but often not useful) auto-linking feature of MSVC
|
||||
So before calling `conf.check_boost` you might want to disabling by adding:
|
||||
conf.env.DEFINES_BOOST += ['BOOST_ALL_NO_LIB']
|
||||
So before calling `conf.check_boost` you might want to disabling by adding
|
||||
conf.env.DEFINES_BOOST += ['BOOST_ALL_NO_LIB']
|
||||
Errors:
|
||||
- boost might also be compiled with /MT, which links the runtime statically.
|
||||
If you have problems with redefined symbols,
|
||||
@@ -52,24 +52,60 @@ import sys
|
||||
import re
|
||||
from waflib import Utils, Logs, Errors
|
||||
from waflib.Configure import conf
|
||||
from waflib.TaskGen import feature, after_method
|
||||
|
||||
BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/homebrew/lib', '/opt/local/lib', '/sw/lib', '/lib']
|
||||
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/homebrew/include', '/opt/local/include', '/sw/include']
|
||||
|
||||
BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib', '/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu', '/usr/local/ndn/lib']
|
||||
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include', '/usr/local/ndn/include']
|
||||
BOOST_VERSION_FILE = 'boost/version.hpp'
|
||||
BOOST_VERSION_CODE = '''
|
||||
#include <iostream>
|
||||
#include <boost/version.hpp>
|
||||
int main() { std::cout << BOOST_LIB_VERSION << ":" << BOOST_VERSION << std::endl; }
|
||||
'''
|
||||
BOOST_SYSTEM_CODE = '''
|
||||
|
||||
BOOST_ERROR_CODE = '''
|
||||
#include <boost/system/error_code.hpp>
|
||||
int main() { boost::system::error_code c; }
|
||||
'''
|
||||
|
||||
PTHREAD_CODE = '''
|
||||
#include <pthread.h>
|
||||
static void* f(void*) { return 0; }
|
||||
int main() {
|
||||
pthread_t th;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_create(&th, &attr, &f, 0);
|
||||
pthread_join(th, 0);
|
||||
pthread_cleanup_push(0, 0);
|
||||
pthread_cleanup_pop(0);
|
||||
pthread_attr_destroy(&attr);
|
||||
}
|
||||
'''
|
||||
|
||||
BOOST_THREAD_CODE = '''
|
||||
#include <boost/thread.hpp>
|
||||
int main() { boost::thread t; }
|
||||
'''
|
||||
|
||||
BOOST_LOG_CODE = '''
|
||||
#include <boost/log/trivial.hpp>
|
||||
int main() { BOOST_LOG_TRIVIAL(info) << "boost_log is working"; }
|
||||
'''
|
||||
|
||||
BOOST_LOG_SETUP_CODE = '''
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/log/utility/setup/console.hpp>
|
||||
#include <boost/log/utility/setup/common_attributes.hpp>
|
||||
int main() {
|
||||
using namespace boost::log;
|
||||
add_common_attributes();
|
||||
add_console_log(std::clog, keywords::format = "%Message%");
|
||||
BOOST_LOG_TRIVIAL(info) << "boost_log_setup is working";
|
||||
}
|
||||
'''
|
||||
|
||||
# toolsets from {boost_dir}/tools/build/v2/tools/common.jam
|
||||
PLATFORM = Utils.unversioned_sys_platform()
|
||||
detect_intel = lambda env: (PLATFORM == 'win32') and 'iw' or 'il'
|
||||
@@ -101,34 +137,37 @@ BOOST_TOOLSETS = {
|
||||
|
||||
def options(opt):
|
||||
opt = opt.add_option_group('Boost Options')
|
||||
|
||||
opt.add_option('--boost-includes', type='string',
|
||||
default='', dest='boost_includes',
|
||||
help='''path to the directory where the boost includes are, e.g., /path/to/boost_1_55_0/stage/include''')
|
||||
help='''path to the directory where the boost includes are,
|
||||
e.g., /path/to/boost_1_55_0/stage/include''')
|
||||
opt.add_option('--boost-libs', type='string',
|
||||
default='', dest='boost_libs',
|
||||
help='''path to the directory where the boost libs are, e.g., /path/to/boost_1_55_0/stage/lib''')
|
||||
opt.add_option('--boost-static', action='store_true',
|
||||
default=False, dest='boost_static',
|
||||
help='link with static boost libraries (.lib/.a)')
|
||||
help='''path to the directory where the boost libs are,
|
||||
e.g., path/to/boost_1_55_0/stage/lib''')
|
||||
opt.add_option('--boost-mt', action='store_true',
|
||||
default=False, dest='boost_mt',
|
||||
help='select multi-threaded libraries')
|
||||
opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
|
||||
help='''select libraries with tags (dgsyp, d for debug), see doc Boost, Getting Started, chapter 6.1''')
|
||||
opt.add_option('--boost-linkage_autodetect', action="store_true", dest='boost_linkage_autodetect',
|
||||
help='''select libraries with tags (gd for debug, static is automatically added),
|
||||
see doc Boost, Getting Started, chapter 6.1''')
|
||||
opt.add_option('--boost-linkage_autodetect', action='store_true', dest='boost_linkage_autodetect',
|
||||
help="auto-detect boost linkage options (don't get used to it / might break other stuff)")
|
||||
opt.add_option('--boost-toolset', type='string',
|
||||
default='', dest='boost_toolset',
|
||||
help='force a toolset e.g. msvc, vc90, gcc, mingw, mgw45 (default: auto)')
|
||||
help='force a toolset e.g. msvc, vc90, \
|
||||
gcc, mingw, mgw45 (default: auto)')
|
||||
py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])
|
||||
opt.add_option('--boost-python', type='string',
|
||||
default=py_version, dest='boost_python',
|
||||
help='select the lib python with this version (default: %s)' % py_version)
|
||||
help='select the lib python with this version \
|
||||
(default: %s)' % py_version)
|
||||
|
||||
|
||||
@conf
|
||||
def __boost_get_version_file(self, d):
|
||||
if not d:
|
||||
return None
|
||||
dnode = self.root.find_dir(d)
|
||||
if dnode:
|
||||
return dnode.find_node(BOOST_VERSION_FILE)
|
||||
@@ -141,33 +180,30 @@ def boost_get_version(self, d):
|
||||
if node:
|
||||
try:
|
||||
txt = node.read()
|
||||
except (OSError, IOError):
|
||||
Logs.error("Could not read the file %r" % node.abspath())
|
||||
except EnvironmentError:
|
||||
Logs.error('Could not read the file %r' % node.abspath())
|
||||
else:
|
||||
re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.+)"', re.M)
|
||||
m1 = re_but1.search(txt)
|
||||
|
||||
re_but2 = re.compile('^#define\\s+BOOST_VERSION\\s+(\\d+)', re.M)
|
||||
m2 = re_but2.search(txt)
|
||||
|
||||
if m1 and m2:
|
||||
return (m1.group(1), m2.group(1))
|
||||
|
||||
return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(":")
|
||||
return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(':')
|
||||
|
||||
@conf
|
||||
def boost_get_includes(self, *k, **kw):
|
||||
includes = k and k[0] or kw.get('includes', None)
|
||||
if includes and self.__boost_get_version_file(includes):
|
||||
return includes
|
||||
for d in Utils.to_list(self.environ.get('INCLUDE', '')) + BOOST_INCLUDES:
|
||||
for d in self.environ.get('INCLUDE', '').split(';') + BOOST_INCLUDES:
|
||||
if self.__boost_get_version_file(d):
|
||||
return d
|
||||
if includes:
|
||||
self.end_msg('headers not found in %s' % includes)
|
||||
self.end_msg('headers not found in %s' % includes, 'YELLOW')
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
self.end_msg('headers not found, please provide a --boost-includes argument (see help)')
|
||||
self.end_msg('headers not found, please provide a --boost-includes argument (see help)', 'YELLOW')
|
||||
self.fatal('The configuration failed')
|
||||
|
||||
|
||||
@@ -195,7 +231,9 @@ def __boost_get_libs_path(self, *k, **kw):
|
||||
path = self.root.find_dir(libs)
|
||||
files = path.ant_glob('*boost_*')
|
||||
if not libs or not files:
|
||||
for d in Utils.to_list(self.environ.get('LIB', [])) + BOOST_LIBS:
|
||||
for d in self.environ.get('LIB', '').split(';') + BOOST_LIBS:
|
||||
if not d:
|
||||
continue
|
||||
path = self.root.find_dir(d)
|
||||
if path:
|
||||
files = path.ant_glob('*boost_*')
|
||||
@@ -208,10 +246,10 @@ def __boost_get_libs_path(self, *k, **kw):
|
||||
break
|
||||
if not path:
|
||||
if libs:
|
||||
self.end_msg('libs not found in %s' % libs)
|
||||
self.end_msg('libs not found in %s' % libs, 'YELLOW')
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
self.end_msg('libs not found, please provide a --boost-libs argument (see help)')
|
||||
self.end_msg('libs not found, please provide a --boost-libs argument (see help)', 'YELLOW')
|
||||
self.fatal('The configuration failed')
|
||||
|
||||
self.to_log('Found the boost path in %r with the libraries:' % path)
|
||||
@@ -226,15 +264,10 @@ def boost_get_libs(self, *k, **kw):
|
||||
according to the parameters
|
||||
'''
|
||||
path, files = self.__boost_get_libs_path(**kw)
|
||||
t = []
|
||||
if kw.get('mt', False):
|
||||
t.append('mt')
|
||||
if kw.get('abi', None):
|
||||
t.append(kw['abi'])
|
||||
tags = t and '(-%s)+' % '-'.join(t) or ''
|
||||
files = sorted(files, key=lambda f: (len(f.name), f.name), reverse=True)
|
||||
toolset = self.boost_get_toolset(kw.get('toolset', ''))
|
||||
toolset_pat = '(-%s[0-9]{0,3})+' % toolset
|
||||
version = '(-%s)+' % self.env.BOOST_VERSION
|
||||
toolset_pat = '(-%s[0-9]{0,3})' % toolset
|
||||
version = '-%s' % self.env.BOOST_VERSION
|
||||
|
||||
def find_lib(re_lib, files):
|
||||
for file in files:
|
||||
@@ -248,28 +281,109 @@ def boost_get_libs(self, *k, **kw):
|
||||
name = name[3:]
|
||||
return name[:name.rfind('.')]
|
||||
|
||||
libs = []
|
||||
for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):
|
||||
py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''
|
||||
# Trying libraries, from most strict match to least one
|
||||
for pattern in ['boost_%s%s%s%s%s' % (lib, toolset_pat, tags, py, version),
|
||||
'boost_%s%s%s%s' % (lib, tags, py, version),
|
||||
'boost_%s%s%s' % (lib, tags, version),
|
||||
# Give up trying to find the right version
|
||||
'boost_%s%s%s%s' % (lib, toolset_pat, tags, py),
|
||||
'boost_%s%s%s' % (lib, tags, py),
|
||||
'boost_%s%s' % (lib, tags)]:
|
||||
self.to_log('Trying pattern %s' % pattern)
|
||||
file = find_lib(re.compile(pattern), files)
|
||||
if file:
|
||||
libs.append(format_lib_name(file.name))
|
||||
break
|
||||
else:
|
||||
self.end_msg('lib %s not found in %s' % (lib, path.abspath()))
|
||||
self.fatal('The configuration failed')
|
||||
def match_libs(lib_names, is_static):
|
||||
libs = []
|
||||
lib_names = Utils.to_list(lib_names)
|
||||
if not lib_names:
|
||||
return libs
|
||||
t = []
|
||||
if kw.get('mt', False):
|
||||
t.append('-mt')
|
||||
if kw.get('abi', None):
|
||||
t.append('%s%s' % (is_static and '-s' or '-', kw['abi']))
|
||||
elif is_static:
|
||||
t.append('-s')
|
||||
tags_pat = t and ''.join(t) or ''
|
||||
ext = is_static and self.env.cxxstlib_PATTERN or self.env.cxxshlib_PATTERN
|
||||
ext = ext.partition('%s')[2] # remove '%s' or 'lib%s' from PATTERN
|
||||
|
||||
return path.abspath(), libs
|
||||
for lib in lib_names:
|
||||
if lib == 'python':
|
||||
# for instance, with python='27',
|
||||
# accepts '-py27', '-py2', '27' and '2'
|
||||
# but will reject '-py3', '-py26', '26' and '3'
|
||||
tags = '({0})?((-py{2})|(-py{1}(?=[^0-9]))|({2})|({1}(?=[^0-9]))|(?=[^0-9])(?!-py))'.format(tags_pat, kw['python'][0], kw['python'])
|
||||
else:
|
||||
tags = tags_pat
|
||||
# Trying libraries, from most strict match to least one
|
||||
for pattern in ['boost_%s%s%s%s%s$' % (lib, toolset_pat, tags, version, ext),
|
||||
'boost_%s%s%s%s$' % (lib, tags, version, ext),
|
||||
# Give up trying to find the right version
|
||||
'boost_%s%s%s%s$' % (lib, toolset_pat, tags, ext),
|
||||
'boost_%s%s%s$' % (lib, tags, ext),
|
||||
'boost_%s%s$' % (lib, ext),
|
||||
'boost_%s' % lib]:
|
||||
self.to_log('Trying pattern %s' % pattern)
|
||||
file = find_lib(re.compile(pattern), files)
|
||||
if file:
|
||||
libs.append(format_lib_name(file.name))
|
||||
break
|
||||
else:
|
||||
self.end_msg('lib %s not found in %s' % (lib, path.abspath()), 'YELLOW')
|
||||
self.fatal('The configuration failed')
|
||||
return libs
|
||||
|
||||
return path.abspath(), match_libs(kw.get('lib', None), False), match_libs(kw.get('stlib', None), True)
|
||||
|
||||
@conf
|
||||
def _check_pthread_flag(self, *k, **kw):
|
||||
'''
|
||||
Computes which flags should be added to CXXFLAGS and LINKFLAGS to compile in multi-threading mode
|
||||
|
||||
Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
|
||||
boost/thread.hpp will trigger a #error if -pthread isn't used:
|
||||
boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
|
||||
is not turned on. Please set the correct command line options for
|
||||
threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
|
||||
|
||||
Based on _BOOST_PTHREAD_FLAG(): https://github.com/tsuna/boost.m4/blob/master/build-aux/boost.m4
|
||||
'''
|
||||
|
||||
var = kw.get('uselib_store', 'BOOST')
|
||||
|
||||
self.start_msg('Checking the flags needed to use pthreads')
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
# (none): in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -lpthreads: AIX (must check this before -lpthread)
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
|
||||
# -pthreads: Solaris/GCC
|
||||
# -mthreads: MinGW32/GCC, Lynx/GCC
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# -lpthread: GNU Linux, etc.
|
||||
# --thread-safe: KAI C++
|
||||
if Utils.unversioned_sys_platform() == 'sunos':
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
boost_pthread_flags = ['-pthreads', '-lpthread', '-mt', '-pthread']
|
||||
else:
|
||||
boost_pthread_flags = ['', '-lpthreads', '-Kthread', '-kthread', '-llthread', '-pthread',
|
||||
'-pthreads', '-mthreads', '-lpthread', '--thread-safe', '-mt']
|
||||
|
||||
for boost_pthread_flag in boost_pthread_flags:
|
||||
try:
|
||||
self.env.stash()
|
||||
self.env['CXXFLAGS_%s' % var] += [boost_pthread_flag]
|
||||
self.env['LINKFLAGS_%s' % var] += [boost_pthread_flag]
|
||||
self.check_cxx(code=PTHREAD_CODE, msg=None, use=var, execute=False, quiet=True)
|
||||
self.end_msg(boost_pthread_flag)
|
||||
return
|
||||
except self.errors.ConfigurationError:
|
||||
self.env.revert()
|
||||
self.end_msg('none')
|
||||
|
||||
@conf
|
||||
def check_boost(self, *k, **kw):
|
||||
@@ -282,7 +396,10 @@ def check_boost(self, *k, **kw):
|
||||
if not self.env['CXX']:
|
||||
self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
|
||||
|
||||
params = {'lib': k and k[0] or kw.get('lib', None)}
|
||||
params = {
|
||||
'lib': k and k[0] or kw.get('lib', None),
|
||||
'stlib': kw.get('stlib', None)
|
||||
}
|
||||
for key, value in self.options.__dict__.items():
|
||||
if not key.startswith('boost_'):
|
||||
continue
|
||||
@@ -291,48 +408,70 @@ def check_boost(self, *k, **kw):
|
||||
|
||||
var = kw.get('uselib_store', 'BOOST')
|
||||
|
||||
self.start_msg('Checking boost includes')
|
||||
self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
|
||||
versions = self.boost_get_version(inc)
|
||||
self.env.BOOST_VERSION = versions[0]
|
||||
self.env.BOOST_VERSION_NUMBER = int(versions[1])
|
||||
self.end_msg("%d.%d.%d" % (int(versions[1]) / 100000,
|
||||
int(versions[1]) / 100 % 1000,
|
||||
int(versions[1]) % 100))
|
||||
if Logs.verbose:
|
||||
Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
|
||||
if not self.env.DONE_FIND_BOOST_COMMON:
|
||||
self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False)
|
||||
if self.env.DPKG_ARCHITECTURE:
|
||||
deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH'])
|
||||
BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip())
|
||||
|
||||
if not params['lib']:
|
||||
self.start_msg('Checking boost includes')
|
||||
self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
|
||||
versions = self.boost_get_version(inc)
|
||||
self.env.BOOST_VERSION = versions[0]
|
||||
self.env.BOOST_VERSION_NUMBER = int(versions[1])
|
||||
self.end_msg('%d.%d.%d' % (int(versions[1]) / 100000,
|
||||
int(versions[1]) / 100 % 1000,
|
||||
int(versions[1]) % 100))
|
||||
if Logs.verbose:
|
||||
Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
|
||||
|
||||
self.env.DONE_FIND_BOOST_COMMON = True
|
||||
|
||||
if not params['lib'] and not params['stlib']:
|
||||
return
|
||||
if 'static' in kw or 'static' in params:
|
||||
Logs.warn('boost: static parameter is deprecated, use stlib instead.')
|
||||
self.start_msg('Checking boost libs')
|
||||
suffix = params.get('static', None) and 'ST' or ''
|
||||
path, libs = self.boost_get_libs(**params)
|
||||
self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
|
||||
self.env['%sLIB_%s' % (suffix, var)] = libs
|
||||
self.end_msg('ok')
|
||||
path, libs, stlibs = self.boost_get_libs(**params)
|
||||
self.env['LIBPATH_%s' % var] = [path]
|
||||
self.env['STLIBPATH_%s' % var] = [path]
|
||||
self.env['LIB_%s' % var] = libs
|
||||
self.env['STLIB_%s' % var] = stlibs
|
||||
self.end_msg(' '.join(libs + stlibs))
|
||||
if Logs.verbose:
|
||||
Logs.pprint('CYAN', ' path : %s' % path)
|
||||
Logs.pprint('CYAN', ' libs : %s' % libs)
|
||||
Logs.pprint('CYAN', ' shared libs : %s' % libs)
|
||||
Logs.pprint('CYAN', ' static libs : %s' % stlibs)
|
||||
|
||||
def has_shlib(lib):
|
||||
return params['lib'] and lib in params['lib']
|
||||
def has_stlib(lib):
|
||||
return params['stlib'] and lib in params['stlib']
|
||||
def has_lib(lib):
|
||||
return has_shlib(lib) or has_stlib(lib)
|
||||
if has_lib('thread'):
|
||||
# not inside try_link to make check visible in the output
|
||||
self._check_pthread_flag(k, kw)
|
||||
|
||||
def try_link():
|
||||
if 'system' in params['lib']:
|
||||
self.check_cxx(
|
||||
fragment=BOOST_SYSTEM_CODE,
|
||||
use=var,
|
||||
execute=False,
|
||||
)
|
||||
if 'thread' in params['lib']:
|
||||
self.check_cxx(
|
||||
fragment=BOOST_THREAD_CODE,
|
||||
use=var,
|
||||
execute=False,
|
||||
)
|
||||
if has_lib('system'):
|
||||
self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False)
|
||||
if has_lib('thread'):
|
||||
self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False)
|
||||
if has_lib('log') or has_lib('log_setup'):
|
||||
if not has_lib('thread'):
|
||||
self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
|
||||
if has_shlib('log') or has_shlib('log_setup'):
|
||||
self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
|
||||
if has_lib('log_setup'):
|
||||
self.check_cxx(fragment=BOOST_LOG_SETUP_CODE, use=var, execute=False)
|
||||
else:
|
||||
self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
|
||||
|
||||
if params.get('linkage_autodetect', False):
|
||||
self.start_msg("Attempting to detect boost linkage flags")
|
||||
self.start_msg('Attempting to detect boost linkage flags')
|
||||
toolset = self.boost_get_toolset(kw.get('toolset', ''))
|
||||
if toolset in ['vc']:
|
||||
if toolset in ('vc',):
|
||||
# disable auto-linking feature, causing error LNK1181
|
||||
# because the code wants to be linked against
|
||||
self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
|
||||
@@ -352,27 +491,43 @@ def check_boost(self, *k, **kw):
|
||||
# we attempt to play with some known-to-work CXXFLAGS combinations
|
||||
for cxxflags in (['/MD', '/EHsc'], []):
|
||||
self.env.stash()
|
||||
self.env["CXXFLAGS_%s" % var] += cxxflags
|
||||
self.env['CXXFLAGS_%s' % var] += cxxflags
|
||||
try:
|
||||
try_link()
|
||||
self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
|
||||
e = None
|
||||
self.end_msg('ok: winning cxxflags combination: %s' % (self.env['CXXFLAGS_%s' % var]))
|
||||
exc = None
|
||||
break
|
||||
except Errors.ConfigurationError as exc:
|
||||
except Errors.ConfigurationError as e:
|
||||
self.env.revert()
|
||||
e = exc
|
||||
exc = e
|
||||
|
||||
if e is not None:
|
||||
self.end_msg("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=e)
|
||||
if exc is not None:
|
||||
self.end_msg('Could not auto-detect boost linking flags combination, you may report it to boost.py author', ex=exc)
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
self.end_msg("Boost linkage flags auto-detection not implemented (needed ?) for this toolchain")
|
||||
self.end_msg('Boost linkage flags auto-detection not implemented (needed ?) for this toolchain')
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
self.start_msg('Checking for boost linkage')
|
||||
try:
|
||||
try_link()
|
||||
except Errors.ConfigurationError as e:
|
||||
self.end_msg("Could not link against boost libraries using supplied options")
|
||||
self.end_msg('Could not link against boost libraries using supplied options', 'YELLOW')
|
||||
self.fatal('The configuration failed')
|
||||
self.end_msg('ok')
|
||||
|
||||
|
||||
@feature('cxx')
|
||||
@after_method('apply_link')
|
||||
def install_boost(self):
|
||||
if install_boost.done or not Utils.is_win32 or not self.bld.cmd.startswith('install'):
|
||||
return
|
||||
install_boost.done = True
|
||||
inst_to = getattr(self, 'install_path', '${BINDIR}')
|
||||
for lib in self.env.LIB_BOOST:
|
||||
try:
|
||||
file = self.bld.find_file(self.env.cxxshlib_PATTERN % lib, self.env.LIBPATH_BOOST)
|
||||
self.bld.install_files(inst_to, self.bld.root.find_node(file))
|
||||
except:
|
||||
continue
|
||||
install_boost.done = False
|
||||
@@ -1,17 +1,15 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
#
|
||||
# Copyright (c) 2014, Regents of the University of California
|
||||
#
|
||||
# GPL 3.0 license, see the COPYING.md file for more information
|
||||
|
||||
from waflib import TaskGen
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
|
||||
help='''Set compiler flags for gcc to enable code coverage information''')
|
||||
opt.add_option('--with-coverage', action='store_true', default=False,
|
||||
help='Add compiler flags to enable code coverage information')
|
||||
|
||||
def configure(conf):
|
||||
if conf.options.with_coverage:
|
||||
if not conf.options.debug:
|
||||
conf.fatal('Code coverage flags require debug mode compilation (add --debug)')
|
||||
conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
|
||||
linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
|
||||
|
||||
|
||||
@@ -1,53 +1,91 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
from waflib import Logs, Configure, Utils
|
||||
import platform
|
||||
from waflib import Configure, Logs, Utils
|
||||
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
|
||||
help='''Compile in debugging mode without optimizations (-O0 or -Og)''')
|
||||
opt.add_option('--debug', '--with-debug', action='store_true', default=False,
|
||||
help='Compile in debugging mode with minimal optimizations (-Og)')
|
||||
|
||||
|
||||
def configure(conf):
|
||||
cxx = conf.env['CXX_NAME'] # CXX_NAME represents generic name of the compiler
|
||||
conf.start_msg('Checking C++ compiler version')
|
||||
|
||||
cxx = conf.env.CXX_NAME # generic name of the compiler
|
||||
ccver = tuple(int(i) for i in conf.env.CC_VERSION)
|
||||
ccverstr = '.'.join(conf.env.CC_VERSION)
|
||||
errmsg = ''
|
||||
warnmsg = ''
|
||||
if cxx == 'gcc':
|
||||
flags = GccFlags()
|
||||
if ccver < (7, 4, 0):
|
||||
errmsg = ('The version of gcc you are using is too old.\n'
|
||||
'The minimum supported gcc version is 9.3.')
|
||||
elif ccver < (9, 3, 0):
|
||||
warnmsg = ('Using a version of gcc older than 9.3 is not '
|
||||
'officially supported and may result in build failures.')
|
||||
conf.flags = GccFlags()
|
||||
elif cxx == 'clang':
|
||||
flags = ClangFlags()
|
||||
if Utils.unversioned_sys_platform() == 'darwin':
|
||||
if ccver < (10, 0, 0):
|
||||
errmsg = ('The version of Xcode you are using is too old.\n'
|
||||
'The minimum supported Xcode version is 12.4.')
|
||||
elif ccver < (12, 0, 0):
|
||||
warnmsg = ('Using a version of Xcode older than 12.4 is not '
|
||||
'officially supported and may result in build failures.')
|
||||
elif ccver < (7, 0, 0):
|
||||
errmsg = ('The version of clang you are using is too old.\n'
|
||||
'The minimum supported clang version is 7.0.')
|
||||
conf.flags = ClangFlags()
|
||||
else:
|
||||
flags = CompilerFlags()
|
||||
Logs.warn('The code has not yet been tested with %s compiler' % cxx)
|
||||
warnmsg = f'{cxx} compiler is unsupported'
|
||||
conf.flags = CompilerFlags()
|
||||
|
||||
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
|
||||
if errmsg:
|
||||
conf.end_msg(ccverstr, color='RED')
|
||||
conf.fatal(errmsg)
|
||||
elif warnmsg:
|
||||
conf.end_msg(ccverstr, color='YELLOW')
|
||||
Logs.warn('WARNING: ' + warnmsg)
|
||||
else:
|
||||
conf.end_msg(ccverstr)
|
||||
|
||||
# General flags are always applied (e.g., selecting C++11 mode)
|
||||
generalFlags = flags.getGeneralFlags(conf)
|
||||
conf.areCustomCxxflagsPresent = len(conf.env.CXXFLAGS) > 0
|
||||
|
||||
# General flags are always applied (e.g., selecting C++ language standard)
|
||||
generalFlags = conf.flags.getGeneralFlags(conf)
|
||||
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
|
||||
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
|
||||
conf.env.DEFINES += generalFlags['DEFINES']
|
||||
|
||||
|
||||
@Configure.conf
|
||||
def check_compiler_flags(conf):
|
||||
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
|
||||
# corresponding environment variables are not set.
|
||||
# DEFINES are always applied.
|
||||
if conf.options.debug:
|
||||
extraFlags = flags.getDebugFlags(conf)
|
||||
if areCustomCxxflagsPresent:
|
||||
extraFlags = conf.flags.getDebugFlags(conf)
|
||||
if conf.areCustomCxxflagsPresent:
|
||||
missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS]
|
||||
if len(missingFlags) > 0:
|
||||
Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
|
||||
% " ".join(conf.env.CXXFLAGS))
|
||||
Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
|
||||
if missingFlags:
|
||||
Logs.warn('Selected debug mode, but CXXFLAGS is set to a custom value "%s"'
|
||||
% ' '.join(conf.env.CXXFLAGS))
|
||||
Logs.warn('Default flags "%s" will not be used' % ' '.join(missingFlags))
|
||||
else:
|
||||
extraFlags = flags.getOptimizedFlags(conf)
|
||||
extraFlags = conf.flags.getOptimizedFlags(conf)
|
||||
|
||||
if not areCustomCxxflagsPresent:
|
||||
if not conf.areCustomCxxflagsPresent:
|
||||
conf.add_supported_cxxflags(extraFlags['CXXFLAGS'])
|
||||
conf.add_supported_linkflags(extraFlags['LINKFLAGS'])
|
||||
|
||||
conf.env.DEFINES += extraFlags['DEFINES']
|
||||
|
||||
|
||||
@Configure.conf
|
||||
def add_supported_cxxflags(self, cxxflags):
|
||||
"""
|
||||
Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
|
||||
Check which cxxflags are supported by the active compiler and add them to env.CXXFLAGS variable.
|
||||
"""
|
||||
if len(cxxflags) == 0:
|
||||
return
|
||||
@@ -55,17 +93,19 @@ def add_supported_cxxflags(self, cxxflags):
|
||||
self.start_msg('Checking supported CXXFLAGS')
|
||||
|
||||
supportedFlags = []
|
||||
for flag in cxxflags:
|
||||
if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False):
|
||||
supportedFlags += [flag]
|
||||
for flags in cxxflags:
|
||||
flags = Utils.to_list(flags)
|
||||
if self.check_cxx(cxxflags=['-Werror'] + flags, mandatory=False):
|
||||
supportedFlags += flags
|
||||
|
||||
self.end_msg(' '.join(supportedFlags))
|
||||
self.env.CXXFLAGS = supportedFlags + self.env.CXXFLAGS
|
||||
self.env.prepend_value('CXXFLAGS', supportedFlags)
|
||||
|
||||
|
||||
@Configure.conf
|
||||
def add_supported_linkflags(self, linkflags):
|
||||
"""
|
||||
Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
|
||||
Check which linkflags are supported by the active compiler and add them to env.LINKFLAGS variable.
|
||||
"""
|
||||
if len(linkflags) == 0:
|
||||
return
|
||||
@@ -73,18 +113,26 @@ def add_supported_linkflags(self, linkflags):
|
||||
self.start_msg('Checking supported LINKFLAGS')
|
||||
|
||||
supportedFlags = []
|
||||
for flag in linkflags:
|
||||
if self.check_cxx(linkflags=['-Werror', flag], mandatory=False):
|
||||
supportedFlags += [flag]
|
||||
for flags in linkflags:
|
||||
flags = Utils.to_list(flags)
|
||||
if self.check_cxx(linkflags=['-Werror'] + flags, mandatory=False):
|
||||
supportedFlags += flags
|
||||
|
||||
self.end_msg(' '.join(supportedFlags))
|
||||
self.env.LINKFLAGS = supportedFlags + self.env.LINKFLAGS
|
||||
self.env.prepend_value('LINKFLAGS', supportedFlags)
|
||||
|
||||
|
||||
class CompilerFlags(object):
|
||||
class CompilerFlags:
|
||||
def getCompilerVersion(self, conf):
|
||||
return tuple(int(i) for i in conf.env.CC_VERSION)
|
||||
|
||||
def getGeneralFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
|
||||
return {
|
||||
'CXXFLAGS': [],
|
||||
'LINKFLAGS': [],
|
||||
'DEFINES': ['BOOST_ASIO_NO_DEPRECATED', 'BOOST_FILESYSTEM_NO_DEPRECATED'],
|
||||
}
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
|
||||
@@ -94,99 +142,99 @@ class CompilerFlags(object):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
|
||||
|
||||
class GccBasicFlags(CompilerFlags):
|
||||
|
||||
class GccClangCommonFlags(CompilerFlags):
|
||||
"""
|
||||
This class defines basic flags that work for both gcc and clang compilers
|
||||
This class defines common flags that work for both gcc and clang compilers.
|
||||
"""
|
||||
|
||||
def getGeneralFlags(self, conf):
|
||||
flags = super().getGeneralFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-std=c++17']
|
||||
if Utils.unversioned_sys_platform() != 'darwin':
|
||||
flags['LINKFLAGS'] += ['-fuse-ld=lld']
|
||||
return flags
|
||||
|
||||
__cxxFlags = [
|
||||
'-fdiagnostics-color',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wpedantic',
|
||||
'-Wenum-conversion',
|
||||
'-Wextra-semi',
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
__linkFlags = ['-Wl,-O1']
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
flags = super(GccBasicFlags, self).getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-O0',
|
||||
'-g3',
|
||||
'-pedantic',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Werror',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-error=maybe-uninitialized', # Bug #1615
|
||||
'-Wno-error=deprecated-declarations', # Bug #3795
|
||||
]
|
||||
flags = super().getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-Og', '-g'] + self.__cxxFlags + [
|
||||
'-Werror',
|
||||
'-Wno-error=deprecated-declarations', # Bug #3795
|
||||
'-Wno-error=maybe-uninitialized', # Bug #1615
|
||||
]
|
||||
flags['LINKFLAGS'] += self.__linkFlags
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-O2',
|
||||
'-g',
|
||||
'-pedantic',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
flags = super().getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-O2', '-g1'] + self.__cxxFlags
|
||||
flags['LINKFLAGS'] += self.__linkFlags
|
||||
return flags
|
||||
|
||||
class GccFlags(GccBasicFlags):
|
||||
def getGeneralFlags(self, conf):
|
||||
flags = super(GccFlags, self).getGeneralFlags(conf)
|
||||
version = tuple(int(i) for i in conf.env['CC_VERSION'])
|
||||
if version < (4, 6, 0):
|
||||
conf.fatal('The version of gcc you are using (%s) is too old.\n' %
|
||||
'.'.join(conf.env['CC_VERSION']) +
|
||||
'The minimum supported gcc version is 4.6.0.')
|
||||
elif version < (4, 7, 0):
|
||||
flags['CXXFLAGS'] += ['-std=c++0x']
|
||||
else:
|
||||
flags['CXXFLAGS'] += ['-std=c++11']
|
||||
if version < (4, 8, 0):
|
||||
flags['DEFINES'] += ['_GLIBCXX_USE_NANOSLEEP'] # Bug #2499
|
||||
return flags
|
||||
|
||||
class GccFlags(GccClangCommonFlags):
|
||||
__cxxFlags = [
|
||||
'-Wcatch-value=2',
|
||||
'-Wcomma-subscript', # enabled by default in C++20
|
||||
'-Wduplicated-branches',
|
||||
'-Wduplicated-cond',
|
||||
'-Wlogical-op',
|
||||
'-Wredundant-tags',
|
||||
'-Wvolatile', # enabled by default in C++20
|
||||
]
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
flags = super(GccFlags, self).getDebugFlags(conf)
|
||||
version = tuple(int(i) for i in conf.env['CC_VERSION'])
|
||||
if version < (5, 1, 0):
|
||||
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
|
||||
flags['CXXFLAGS'] += ['-Og', # gcc >= 4.8
|
||||
'-fdiagnostics-color', # gcc >= 4.9
|
||||
]
|
||||
flags = super().getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
if platform.machine() == 'armv7l':
|
||||
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(GccFlags, self).getOptimizedFlags(conf)
|
||||
version = tuple(int(i) for i in conf.env['CC_VERSION'])
|
||||
if version < (5, 1, 0):
|
||||
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
|
||||
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
|
||||
flags = super().getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
if platform.machine() == 'armv7l':
|
||||
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
|
||||
return flags
|
||||
|
||||
class ClangFlags(GccBasicFlags):
|
||||
|
||||
class ClangFlags(GccClangCommonFlags):
|
||||
def getGeneralFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getGeneralFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-std=c++11']
|
||||
flags = super().getGeneralFlags(conf)
|
||||
if Utils.unversioned_sys_platform() == 'darwin':
|
||||
flags['CXXFLAGS'] += ['-stdlib=libc++']
|
||||
flags['LINKFLAGS'] += ['-stdlib=libc++']
|
||||
# Bug #4296
|
||||
brewdir = '/opt/homebrew' if platform.machine() == 'arm64' else '/usr/local'
|
||||
flags['CXXFLAGS'] += [
|
||||
['-isystem', f'{brewdir}/include'], # for Homebrew
|
||||
['-isystem', '/opt/local/include'], # for MacPorts
|
||||
]
|
||||
elif Utils.unversioned_sys_platform() == 'freebsd':
|
||||
# Bug #4790
|
||||
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
|
||||
return flags
|
||||
|
||||
__cxxFlags = [
|
||||
'-Wundefined-func-template',
|
||||
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
|
||||
]
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
|
||||
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
|
||||
'-Wno-error=unneeded-internal-declaration', # Bug #1588
|
||||
'-Wno-error=deprecated-register',
|
||||
'-Wno-error=keyword-macro', # Bug #3235
|
||||
'-Wno-nested-anon-types',
|
||||
'-Wno-sign-compare',
|
||||
'-Wno-keyword-macro',
|
||||
'-Wno-error=ignored-qualifiers',
|
||||
'-Wno-error=infinite-recursion',
|
||||
]
|
||||
flags = super().getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
|
||||
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
|
||||
'-Wno-nested-anon-types',
|
||||
'-Wno-sign-compare',
|
||||
'-Wno-keyword-macro',
|
||||
]
|
||||
flags = super().getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
return flags
|
||||
@@ -85,7 +85,7 @@ class doxygen(Task.Task):
|
||||
|
||||
# Override with any parameters passed to the task generator
|
||||
if getattr(self.generator, 'pars', None):
|
||||
for k, v in self.generator.pars.iteritems():
|
||||
for k, v in self.generator.pars.items():
|
||||
self.pars[k] = v
|
||||
|
||||
self.doxy_inputs = getattr(self, 'doxy_inputs', [])
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
'''
|
||||
|
||||
When using this tool, the wscript will look like:
|
||||
|
||||
def options(opt):
|
||||
opt.tool_options('openssl')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx openssl')
|
||||
conf.check_openssl()
|
||||
|
||||
def build(bld):
|
||||
bld(source='main.cpp', target='app', use='OPENSSL')
|
||||
|
||||
'''
|
||||
|
||||
from waflib import Options
|
||||
from waflib.Configure import conf
|
||||
|
||||
@conf
|
||||
def check_openssl(self,*k,**kw):
|
||||
root = k and k[0] or kw.get('path', None) or Options.options.with_openssl
|
||||
mandatory = kw.get('mandatory', True)
|
||||
var = kw.get('uselib_store', 'OPENSSL')
|
||||
|
||||
if root:
|
||||
libcrypto = self.check_cxx(lib=['ssl', 'crypto'],
|
||||
msg='Checking for OpenSSL library',
|
||||
define_name='HAVE_%s' % var,
|
||||
global_define=True,
|
||||
uselib_store=var,
|
||||
mandatory=mandatory,
|
||||
includes="%s/include" % root,
|
||||
libpath="%s/lib" % root)
|
||||
else:
|
||||
libcrypto = self.check_cxx(lib=['ssl', 'crypto'],
|
||||
msg='Checking for OpenSSL library',
|
||||
define_name='HAVE_%s' % var,
|
||||
uselib_store=var,
|
||||
mandatory=mandatory)
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--with-openssl', type='string', default=None,
|
||||
dest='with_openssl', help='''Path to OpenSSL''')
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# Philipp Bender, 2012
|
||||
# Matt Clarkson, 2012
|
||||
|
||||
from waflib.Task import Task
|
||||
from waflib.TaskGen import extension
|
||||
|
||||
"""
|
||||
A simple tool to integrate protocol buffers into your build system.
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx cxx protoc')
|
||||
|
||||
def build(bld):
|
||||
bld(
|
||||
features = 'cxx cxxprogram'
|
||||
source = 'main.cpp file1.proto proto/file2.proto',
|
||||
include = '. proto',
|
||||
target = 'executable')
|
||||
|
||||
"""
|
||||
|
||||
class protoc(Task):
|
||||
run_str = '${PROTOC} ${PROTOC_FLAGS} ${PROTOC_ST:INCPATHS} ${SRC[0].abspath()}'
|
||||
color = 'BLUE'
|
||||
ext_out = ['.h', 'pb.cc']
|
||||
|
||||
@extension('.proto')
|
||||
def process_protoc(self, node):
|
||||
cpp_node = node.change_ext('.pb.cc')
|
||||
hpp_node = node.change_ext('.pb.h')
|
||||
self.create_task('protoc', node, [cpp_node, hpp_node])
|
||||
self.source.append(cpp_node)
|
||||
|
||||
if 'cxx' in self.features and not self.env.PROTOC_FLAGS:
|
||||
self.env.PROTOC_FLAGS = '--cpp_out=%s' % node.parent.get_bld().abspath()
|
||||
|
||||
use = getattr(self, 'use', '')
|
||||
if not 'PROTOBUF' in use:
|
||||
self.use = self.to_list(use) + ['PROTOBUF']
|
||||
|
||||
def configure(conf):
|
||||
conf.check_cfg(package="protobuf", uselib_store="PROTOBUF", args=['--cflags', '--libs'])
|
||||
conf.find_program('protoc', var='PROTOC')
|
||||
conf.env.PROTOC_ST = '-I%s'
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--with-sanitizer', action='store', default='', dest='sanitizers',
|
||||
help='Comma-separated list of compiler sanitizers to enable [default=none]')
|
||||
|
||||
def configure(conf):
|
||||
for san in conf.options.sanitizers.split(','):
|
||||
if not san:
|
||||
continue
|
||||
|
||||
sanflag = '-fsanitize=%s' % san
|
||||
conf.start_msg('Checking if compiler supports %s' % sanflag)
|
||||
|
||||
if conf.check_cxx(cxxflags=['-Werror', sanflag, '-fno-omit-frame-pointer'],
|
||||
linkflags=[sanflag], mandatory=False):
|
||||
conf.end_msg('yes')
|
||||
conf.env.append_unique('CXXFLAGS', [sanflag, '-fno-omit-frame-pointer'])
|
||||
conf.env.append_unique('LINKFLAGS', [sanflag])
|
||||
else:
|
||||
conf.end_msg('no', color='RED')
|
||||
conf.fatal('%s sanitizer is not supported by the current compiler' % san)
|
||||
@@ -44,28 +44,28 @@ def apply_sphinx(self):
|
||||
task.inputs.append(conf)
|
||||
|
||||
confdir = conf.parent.abspath()
|
||||
buildername = getattr(self, "builder", "html")
|
||||
srcdir = getattr(self, "srcdir", confdir)
|
||||
outdir = self.path.find_or_declare(getattr(self, "outdir", buildername)).get_bld()
|
||||
doctreedir = getattr(self, "doctreedir", os.path.join(outdir.abspath(), ".doctrees"))
|
||||
buildername = getattr(self, 'builder', 'html')
|
||||
srcdir = getattr(self, 'srcdir', confdir)
|
||||
outdir = self.path.find_or_declare(getattr(self, 'outdir', buildername)).get_bld()
|
||||
doctreedir = getattr(self, 'doctreedir', os.path.join(outdir.abspath(), '.doctrees'))
|
||||
|
||||
task.env['BUILDERNAME'] = buildername
|
||||
task.env['SRCDIR'] = srcdir
|
||||
task.env['DOCTREEDIR'] = doctreedir
|
||||
task.env['OUTDIR'] = outdir.abspath()
|
||||
task.env['VERSION'] = "version=%s" % self.VERSION
|
||||
task.env['RELEASE'] = "release=%s" % self.VERSION
|
||||
task.env['VERSION'] = 'version=%s' % self.version
|
||||
task.env['RELEASE'] = 'release=%s' % getattr(self, 'release', self.version)
|
||||
|
||||
import imp
|
||||
confData = imp.load_source('sphinx_conf', conf.abspath())
|
||||
|
||||
if buildername == "man":
|
||||
if buildername == 'man':
|
||||
for i in confData.man_pages:
|
||||
target = outdir.find_or_declare('%s.%d' % (i[1], i[4]))
|
||||
task.outputs.append(target)
|
||||
|
||||
if self.install_path:
|
||||
self.bld.install_files("%s/man%d/" % (self.install_path, i[4]), target)
|
||||
self.bld.install_files('%s/man%d/' % (self.install_path, i[4]), target)
|
||||
else:
|
||||
task.outputs.append(outdir)
|
||||
|
||||
|
||||
+34
-46
@@ -1,50 +1,38 @@
|
||||
NLSR Authors
|
||||
===========
|
||||
# NLSR Authors
|
||||
|
||||
NLSR is an open source project includes contributions from the members of the
|
||||
[NDN project team](http://named-data.net/project/participants/).
|
||||
The following lists maintainers, primary developers, and all much-appreciated contributors to NLSR in alphabetical order.
|
||||
The specific contributions of individual authors can be obtained from the git history of the [official NLSR repository](https://github.com/named-data/NLSR).
|
||||
If you would like to become a contributor to the official repository, please follow the recommendations in <https://github.com/named-data/.github/blob/main/CONTRIBUTING.md>.
|
||||
|
||||
## Project lead:
|
||||
* Alexander Afanasyev <https://users.cs.fiu.edu/~afanasyev>
|
||||
* Adam Alyyan <https://github.com/a64adam>
|
||||
* Syed Obaid Amin <http://obaidamin.weebly.com/>
|
||||
* Pedro David Arjona Villicaña <https://github.com/david-arjona>
|
||||
* Muktadir R. Chowdhury <https://github.com/alvyC>
|
||||
* Damian Coomes <https://github.com/dmcoomes>
|
||||
* ***(Maintainer)*** Saurab Dulal <https://dulalsaurab.github.io>
|
||||
* Laqin Fan <https://github.com/laqinfan>
|
||||
* Simon Fayer <https://github.com/sfayer>
|
||||
* ***(Former Maintainer)*** Ashlesh Gawande <https://www.linkedin.com/in/agawande>
|
||||
* ***(Former Maintainer)*** Nicholas Gordon <https://github.com/gorgonical>
|
||||
* ***(Former Maintainer)*** A. K. M. Mahmudul Hoque <https://sites.google.com/site/akmhoque/home>
|
||||
* ***(Former Maintainer)*** Vince Lehman <http://vslehman.com>
|
||||
* Tianxing Ma <https://github.com/matianxing1992>
|
||||
* Spyridon Mastorakis <https://sites.google.com/site/spyridonmastorakis>
|
||||
* Eric Newberry <https://ericnewberry.com>
|
||||
* João Pereira <http://website.jpereira.co.uk>
|
||||
* Davide Pesavento <https://github.com/Pesa>
|
||||
* Md Ashiqur Rahman <https://ashiqrahman.com>
|
||||
* Junxiao Shi <https://cs.arizona.edu/~shijunxiao>
|
||||
* Salvatore Signorello <https://wwwen.uni.lu/snt/people/salvatore_signorello>
|
||||
* Jiewen Tan <https://www.linkedin.com/in/jiewentan>
|
||||
* Alejandro Gil Torres <https://github.com/gltorres>
|
||||
* Ryan Wickman <http://rwickman.github.io>
|
||||
* Yingdi Yu <https://irl.cs.ucla.edu/~yingdi>
|
||||
* Minsheng Zhang <https://www.linkedin.com/in/minsheng-zhang-032023a1>
|
||||
|
||||
* Vince Lehman <http://vslehman.com>
|
||||
## Technical Advisors
|
||||
|
||||
## Past project leads:
|
||||
|
||||
* A K M Mahmudul Hoque <https://sites.google.com/site/akmhoque/home>
|
||||
|
||||
## Technical advisors:
|
||||
|
||||
* Lan Wang <http://www.cs.memphis.edu/~lanwang/>
|
||||
* Beichuan Zhang <http://www.cs.arizona.edu/~bzhang/>
|
||||
* Lixia Zhang <http://www.cs.ucla.edu/~lixia/>
|
||||
|
||||
|
||||
## All project authors, contributors and their affiliations:
|
||||
|
||||
* The University of Memphis
|
||||
|
||||
* A K M Mahmudul Hoque <https://sites.google.com/site/akmhoque/home>
|
||||
* Ashlesh Gawande <agawande@memphis.edu>
|
||||
* Minsheng Zhang <mzhang4@memphis.edu>
|
||||
* Syed Obaid Amin <http://obaidamin.weebly.com/>
|
||||
* Vince Lehman <http://vslehman.com>
|
||||
* Muktadir R Chowdhury <mrchwdhr@memphis.edu>
|
||||
* Nicholas Gordon <nmgordon@memphis.edu>
|
||||
* Laqin Fan <lfan1@memphis.edu>
|
||||
|
||||
* University of California, Los Angeles
|
||||
|
||||
* Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/web/index.html>
|
||||
* Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
|
||||
* Spyridon Mastorakis <http://cs.ucla.edu/~mastorakis/>
|
||||
* Jiewen Tan <alanwake@ucla.edu>
|
||||
|
||||
* University of Arizona
|
||||
|
||||
* Junxiao Shi <https://www.cs.arizona.edu/people/shijunxiao/>
|
||||
|
||||
|
||||
## Queries about NLSR
|
||||
|
||||
Any question related to NLSR should be directed to Ashlesh Gawande (agawande@memphis.edu),
|
||||
Muktadir R Chowdhury (mrchwdhr@memphis.edu), and Nicholas Gordon (nmgordon@memphis.edu).
|
||||
* Lan Wang <http://www.cs.memphis.edu/~lanwang>
|
||||
* Beichuan Zhang <https://cs.arizona.edu/~bzhang>
|
||||
* Lixia Zhang <https://web.cs.ucla.edu/~lixia>
|
||||
+371
-390
File diff suppressed because it is too large.
Load diff
+19
-16
@@ -1,15 +1,17 @@
|
||||
Requirements
|
||||
------------
|
||||
# Notes for NLSR developers
|
||||
|
||||
Contributions to NLSR must be licensed under GPL 3.0 or compatible license. If you are
|
||||
choosing GPL 3.0, please use the following license boilerplate in all `.hpp` and `.cpp`
|
||||
files:
|
||||
If you are new to the NDN software community, please read our
|
||||
[Contributor's Guide](https://github.com/named-data/.github/blob/main/CONTRIBUTING.md).
|
||||
|
||||
Include the following header in all `.hpp` and `.cpp` files:
|
||||
## Licensing requirements
|
||||
|
||||
Contributions to NLSR must be licensed under the GPL v3 or a compatible license.
|
||||
If you choose the GPL v3, please use the following license boilerplate in all `.hpp`
|
||||
and `.cpp` files:
|
||||
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) [Year(s)], [Copyright Holder(s)].
|
||||
/*
|
||||
* Copyright (c) [Year(s)], [Copyright Holder(s)].
|
||||
*
|
||||
* This file is part of NLSR (Named-data Link State Routing).
|
||||
* See AUTHORS.md for complete list of NLSR authors and contributors.
|
||||
@@ -24,14 +26,15 @@ Include the following header in all `.hpp` and `.cpp` files:
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
|
||||
**/
|
||||
*/
|
||||
|
||||
If you are affiliated with an NSF-supported NDN project institution,
|
||||
please use the [NDN Team License Boilerplate]
|
||||
(http://redmine.named-data.net/projects/nlsr/wiki/NDN_Team_License_Boilerplate_(NLSR)).
|
||||
If you are affiliated with an NSF-supported NDN project institution, please use the [NDN Team License
|
||||
Boilerplate](https://redmine.named-data.net/projects/nlsr/wiki/NDN_Team_License_Boilerplate_(NLSR)).
|
||||
|
||||
Recommendations
|
||||
---------------
|
||||
## Recommendations
|
||||
|
||||
NSLR code is subject to the code style, defined here:
|
||||
http://redmine.named-data.net/projects/nfd/wiki/CodeStyle
|
||||
NLSR code is subject to the code style defined
|
||||
[here](https://redmine.named-data.net/projects/nfd/wiki/CodeStyle).
|
||||
|
||||
NLSR Developer's guide can be found
|
||||
[here](https://github.com/named-data/NLSR/blob/developers-guide/NLSR-Developers-Guide.pdf).
|
||||
@@ -1,43 +1,51 @@
|
||||
NLSR - Named Data Link State Routing Protocol
|
||||
=============================================
|
||||
# NLSR: Named Data Link State Routing Protocol
|
||||
|
||||
For complete documentation and more extensive information,
|
||||
please visit the [NLSR homepage](http://named-data.net/doc/NLSR/current/).
|
||||
[](https://github.com/named-data/NLSR/actions/workflows/ci.yml)
|
||||
[](https://github.com/named-data/NLSR/actions/workflows/docs.yml)
|
||||

|
||||

|
||||
|
||||
> For more extensive documentation, please visit the [NLSR homepage](https://docs.named-data.net/NLSR/current/).
|
||||
|
||||
## Overview
|
||||
|
||||
NLSR is a routing protocol in NDN that populates NDN's Routing Information Base. NLSR
|
||||
will continue to evolve alongside the Named Data Networking [protocol](http://named-data.net/doc/ndn-tlv/).
|
||||
NLSR is a routing protocol for Named Data Networking (NDN) that populates the Routing Information
|
||||
Base (RIB) of an NDN router, such as [NFD](https://github.com/named-data/NFD). NLSR continues to
|
||||
evolve alongside the core [NDN protocol](https://docs.named-data.net/NDN-packet-spec/current/).
|
||||
|
||||
NLSR is an open and free software package licensed under the GPL 3.0 license and free to all
|
||||
Internet users and developers. For more information about the licensing details and
|
||||
limitations, refer to [COPYING.md](https://github.com/named-data/NLSR/blob/master/COPYING.md).
|
||||
|
||||
NLSR is developed by the members of the [NSF-sponsored NDN project team](http://named-data.net/project/participants/).
|
||||
For more details, please refer to [AUTHORS.md](https://github.com/named-data/NLSR/blob/master/AUTHORS.md).
|
||||
Bug reports and feedback are highly appreciated and can be made through the
|
||||
[Redmine site](http://redmine.named-data.net/projects/nlsr).
|
||||
|
||||
The main design goal of NLSR is to provide a routing protocol to populate NDN's FIB.
|
||||
The main design goal of NLSR is to provide a routing protocol to populate NDN's RIB.
|
||||
NLSR calculates the routing table using link-state or hyperbolic routing and produces
|
||||
multiple faces for each reachable name prefix in a single authoritative domain. NLSR
|
||||
will continue to evolve over time to include neighbor discovery and to become a full
|
||||
fledged inter-domain routing protocol for NDN.
|
||||
|
||||
NLSR was mainly developed by members of the NSF-sponsored [NDN project team](
|
||||
https://named-data.net/project/participants/). See [`AUTHORS.md`](AUTHORS.md) for details.
|
||||
|
||||
Source releases
|
||||
---------------
|
||||
## Source releases
|
||||
|
||||
The source code and source-code installation instructions are always available at
|
||||
the following links:
|
||||
The source code and installation instructions are available at the following locations:
|
||||
|
||||
- [Installation](http://named-data.net/doc/NLSR/current/INSTALL.html)
|
||||
- [Getting Started with NLSR](http://named-data.net/doc/NLSR/current/GETTING-STARTED.html)
|
||||
- [GitHub NLSR repository](https://github.com/named-data/NLSR)
|
||||
- [Installation](https://docs.named-data.net/NLSR/current/INSTALL.html)
|
||||
- [Getting started with NLSR](https://docs.named-data.net/NLSR/current/GETTING-STARTED.html)
|
||||
- [NLSR GitHub repository](https://github.com/named-data/NLSR)
|
||||
|
||||
Additional information
|
||||
----------------------
|
||||
## Reporting bugs
|
||||
|
||||
- [NLSR Wiki](http://redmine.named-data.net/projects/nlsr/wiki/)
|
||||
- Feature requests and bug reports are welcome on our
|
||||
[NLSR on NDN Redmine](http://redmine.named-data.net/projects/nlsr)
|
||||
Please submit any bug reports or feature requests to the
|
||||
[NLSR issue tracker](https://redmine.named-data.net/projects/nlsr/issues).
|
||||
|
||||
## Additional resources
|
||||
|
||||
- [Contributor's Guide](https://github.com/named-data/.github/blob/main/CONTRIBUTING.md)
|
||||
- [NLSR Wiki](https://redmine.named-data.net/projects/nlsr/wiki)
|
||||
- [NLSR Issue Tracker](https://redmine.named-data.net/projects/nlsr/issues)
|
||||
- [NLSR Mailing List Sign Up](https://listserv.memphis.edu/scripts/wa.exe?GETPW1)
|
||||
- [NLSR Mailing List](https://listserv.memphis.edu/scripts/wa.exe?SUBED1=NLSR-HELP-L&A=1)
|
||||
- [NLSR Mailing List Archives](https://listserv.memphis.edu/scripts/wa.exe?A0=NLSR-HELP-L)
|
||||
- [NLSR Developer's guide](https://github.com/named-data/NLSR/blob/developers-guide/NLSR-Developers-Guide.pdf)
|
||||
|
||||
## License
|
||||
|
||||
NLSR is free software distributed under the GNU General Public License version 3.
|
||||
See [`COPYING.md`](COPYING.md) for details.
|
||||
@@ -7,13 +7,25 @@ Getting Started with NLSR
|
||||
Getting Source
|
||||
--------------
|
||||
|
||||
- `GitHub NLSR repository <https://github.com/named-data/NLSR>`_
|
||||
- `GitHub NLSR repository <https://github.com/named-data/NLSR>`__
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
:doc:`INSTALL`
|
||||
|
||||
Important Notes About Configuration
|
||||
-----------------------------------
|
||||
|
||||
Since v0.4.0, NLSR no longer creates Faces for the neighbors that are
|
||||
specified in ``nlsr.conf``. Instead, it relies on the pre-existence of
|
||||
the Faces in NFD. NLSR will obtain this information from NFD, and
|
||||
configure its neighbors using this information.
|
||||
|
||||
For users who were relying on NLSR to automagically configure their networks,
|
||||
this must now be done with ``nfdc``. See ``man nfdc`` for its documentation
|
||||
(`online version <https://docs.named-data.net/NFD/current/manpages/nfdc.html>`__).
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
@@ -39,8 +51,37 @@ You can also run ``nlsr -f`` with the absolute path of the configuration file:
|
||||
|
||||
nlsr -f /usr/local/etc/ndn/nlsr.conf
|
||||
|
||||
To run NLSR as daemon, use the ``-d`` flag:
|
||||
Logging
|
||||
-------
|
||||
|
||||
NLSR uses the ndn-cxx logging facility. All levels listed below the selected log-level
|
||||
value are enabled.
|
||||
|
||||
::
|
||||
|
||||
nlsr -d
|
||||
Valid values:
|
||||
|
||||
TRACE trace messages (most verbose)
|
||||
DEBUG debugging messages
|
||||
INFO informational messages
|
||||
WARN warning messages
|
||||
ERROR error messages
|
||||
FATAL fatal (will be logged unconditionally)
|
||||
|
||||
To obtain logs for NLSR, set the ``NDN_LOG`` environment variable with the correct prefix
|
||||
and log-level settings. For example, running the following command will display all log
|
||||
messages in NLSR with a DEBUG level or below.
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
NDN_LOG='nlsr.*=DEBUG' nlsr
|
||||
|
||||
If the user is presented with an error message "User does not have read and write
|
||||
permission on the directory" it can be circumvented by running the application with sudo:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
sudo env NDN_LOG='nlsr.*=DEBUG' nlsr
|
||||
|
||||
See ``man ndn-log`` for more details (`online version
|
||||
<https://docs.named-data.net/ndn-cxx/current/manpages/ndn-log.html>`__).
|
||||
+28
-45
@@ -7,72 +7,55 @@ NLSR Installation Instructions
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
- `NFD <http://named-data.net/doc/NFD/current/>`_ and its requirements:
|
||||
- `NFD <https://github.com/named-data/NFD>`__ and its dependencies.
|
||||
|
||||
Refer to `Getting started with NFD <http://named-data.net/doc/NFD/current/INSTALL.html>`_
|
||||
for detailed installation and running instruction.
|
||||
Check out the `documentation <https://docs.named-data.net/NFD/current/INSTALL.html>`__
|
||||
for detailed installation and running instructions.
|
||||
|
||||
- log4cxx library
|
||||
- PSync library [optional but recommended, enabled by default]
|
||||
|
||||
On Ubuntu Linux:
|
||||
Download the PSync library and build it according to the instructions available at
|
||||
https://github.com/named-data/PSync#build
|
||||
|
||||
::
|
||||
- ChronoSync library [optional, deprecated]
|
||||
|
||||
sudo apt-get install liblog4cxx10-dev
|
||||
For testing purposes, NLSR can be optionally built with ChronoSync support. Download
|
||||
the ChronoSync library and build it according to the instructions available at
|
||||
https://github.com/named-data/ChronoSync#build
|
||||
|
||||
On OS X with MacPorts:
|
||||
- SVS library [optional]
|
||||
|
||||
::
|
||||
NLSR can be used with State Vector Sync as the underlying Sync protocol. Download
|
||||
the ndn-svs library and build it according to the instructions available at
|
||||
https://github.com/named-data/ndn-svs#installation
|
||||
|
||||
sudo port install log4cxx
|
||||
|
||||
- protobuf
|
||||
|
||||
On Ubuntu Linux:
|
||||
|
||||
::
|
||||
|
||||
sudo apt-get install libprotobuf-dev protobuf-compiler
|
||||
|
||||
On OS X with MacPorts:
|
||||
|
||||
::
|
||||
|
||||
sudo port install protobuf-cpp
|
||||
|
||||
- openssl
|
||||
|
||||
On Ubuntu Linux:
|
||||
|
||||
::
|
||||
|
||||
sudo apt-get install libssl-dev
|
||||
|
||||
On OS X with MacPorts:
|
||||
|
||||
::
|
||||
|
||||
sudo port install openssl
|
||||
Note that at least one Sync library must be enabled.
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
Execute the following commands to build NLSR:
|
||||
|
||||
::
|
||||
.. code-block:: sh
|
||||
|
||||
./waf configure
|
||||
./waf
|
||||
sudo ./waf install
|
||||
|
||||
Refer to ``./waf –help`` for more options that can be used during the configure stage and
|
||||
Refer to ``./waf --help`` for more options that can be used during the configure stage and
|
||||
how to properly configure NLSR.
|
||||
|
||||
If your pkgconfig path is not set properly you can do the following before running ``./waf
|
||||
configure``
|
||||
If your pkgconfig path is not set properly, you can do the following before running ``./waf
|
||||
configure``:
|
||||
|
||||
::
|
||||
.. code-block:: sh
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
|
||||
or
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||
# or
|
||||
export PKG_CONFIG_PATH=/path/to/pkgconfig/on/your/machine
|
||||
|
||||
If ChronoSync support is desired, NLSR needs to be configured with the following option:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
./waf configure --with-chronosync
|
||||
@@ -1,221 +0,0 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
NLSR version 0.3.1 (changes since version 0.3.0)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: January 22, 2016
|
||||
|
||||
**Changes**
|
||||
|
||||
- **breaking change** Sync uses /localhop component in prefix to reduce duplicate NACKs (:issue:`3627`)
|
||||
|
||||
- **breaking change** LSA uses /localhop component in prefix to reduce duplicate NACKs (:issue:`3899`)
|
||||
|
||||
**Code Changes**:
|
||||
|
||||
- Fib and FaceMap use std::map instead of std::list (:issue:`2781`)
|
||||
|
||||
- NamePrefixTableEntries store RoutingTableEntries using a pointer (:issue:`2863`)
|
||||
|
||||
- Namespace closing comments are now consistent with ndn-cxx guidelines (:issue:`3735`)
|
||||
|
||||
- Update copyright date across all files (:issue:`3736`, `3909`, `3923`)
|
||||
|
||||
- Improve formatting of FaceMap and FaceMapEntry (:issue:`3737`)
|
||||
|
||||
- Sort NextHops on NexthopList insertion (:issue:`2721`)
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- HR now recalculates paths after status change of a neighbor (:issue:`3874`)
|
||||
|
||||
- NLSR no longer sets strategies multiple times (:issue:`3743`)
|
||||
|
||||
- NLSR should enable use of ndn-cxx dispatcher (:issue:`3930`)
|
||||
|
||||
- Fix typos in the sample configuration file (:issue:`3113`)
|
||||
|
||||
NLSR version 0.3.0 (changes since version 0.2.2)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: August 1, 2016
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Updated validation checker for LSA rule in the configuration file (:issue:`2965`)
|
||||
|
||||
- Do not advertise Adjacency LSAs when hyperbolic routing is enabled (:issue:`2402`)
|
||||
|
||||
- Do not distribute coordinate LSAs when using link-state routing. (:issue:`3661`)
|
||||
|
||||
- LSAs should be segmented before they are published (:issue:`2965`)
|
||||
|
||||
- Don't use DummyClientFace::sentDatas (:issue:`3383`)
|
||||
|
||||
- Remove disabled security files (:issue:`2960`)
|
||||
|
||||
- Lsa type should be argument for base class LSA constructor (:issue:`2788`)
|
||||
|
||||
- Use ndn-cxx/DummyClientFace (:issue:`2637`)
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- Unit tests cases are installed with `./waf install` (:issue:`3359`)
|
||||
|
||||
|
||||
NLSR version 0.2.2 (changes since version 0.2.1)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: January 5, 2016
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Adapt code to changes in NFD/ndn-cxx version 0.4.0 release
|
||||
|
||||
NLSR version 0.2.1 (changes since version 0.2.0)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: June 30, 2015
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Using a configuration file without ``prefix-update-validator`` disables runtime advertise/withdraw instead of exiting (:issue:`2814`)
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- Prevent incomplete removal of NPT entry (:issue:`2785`)
|
||||
|
||||
- Correct bidirectional links with differing costs (:issue:`2801`)
|
||||
|
||||
- Fix non-incrementing Adjacency number in AdjLsa::writeLog (:issue:`2594`)
|
||||
|
||||
- Remove FaceDestroyEvent test's reliance on nlsrSeqNo.txt (:issue:`2881`)
|
||||
|
||||
- Test ACTIVE/INACTIVE Adjacencies in LSA construction (:issue:`2735`)
|
||||
|
||||
NLSR version 0.2.0 (changes since version 0.1.0)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: April 30, 2015
|
||||
|
||||
**Build**:
|
||||
|
||||
- The code now requires C++11. The minimum supported gcc version is 4.6, as earlier versions do not have proper support for C++11 features. (:issue:`1930`)
|
||||
|
||||
- Require OpenSSL (:issue:`2375`)
|
||||
|
||||
**New features**:
|
||||
|
||||
- Add nlsrc command-line tool (:issue:`1834`)
|
||||
|
||||
- Advertise/Withdraw name prefixes at runtime (:issue:`1834`)
|
||||
|
||||
- Assign zero cost to hyperbolic direct neighbors (:issue:`1975`)
|
||||
|
||||
- Only hyperbolic costs are adjusted before registering (:issue:`1974`)
|
||||
|
||||
- Add ability to specify different logging levels (:issue:`1935`)
|
||||
|
||||
- Add LSDB dataset publishers (:issue:`2280`)
|
||||
|
||||
- Add LSDB dataset tlv abstractions (:issue:`2280`)
|
||||
|
||||
- Allow zero cost neighbors for hyperbolic routing table calculation (:issue:`1982`)
|
||||
|
||||
- Faces are now created with canonical Face URI (:issue:`1911`)
|
||||
|
||||
- Add configurable router event intervals (:issue:`2071`)
|
||||
|
||||
- Add router-dead-interval configuration setting (:issue:`1878`)
|
||||
|
||||
- Add log formatting specified by log4cxx configuration file (:issue:`1950`)
|
||||
|
||||
- Face URIs in configuration file are checked for validity on load (:issue:`2070`)
|
||||
|
||||
- Configuration variables with default values are now optional (:issue:`1949`)
|
||||
|
||||
- Recalculate routing table after face destroy event (:issue:`2635`)
|
||||
|
||||
- Add Travis-CI build script
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Change adjacency status from uint32_t to enum (:issue:`1946`)
|
||||
|
||||
- Remove scheduler from NLSR class (:issue:`1981`)
|
||||
|
||||
- Change hyperbolic cost adjustment factor from 100 to 1000 (:issue:`1974`)
|
||||
|
||||
- Remove use of outdated namespace ``ndn::Tlv`` (:issue:`2079`)
|
||||
|
||||
- Remove use of deprecated ``ndn::nfd::Controller(Face&)`` constructor (:issue:`2133`)
|
||||
|
||||
- Routing update publishing is abstracted to SyncLogicHandler (:issue:`2289`)
|
||||
|
||||
- Make ConfParameter variable types consistent with min and max values (:issue:`2084`)
|
||||
|
||||
- Replace LSA string literals with constants (:issue:`2310`)
|
||||
|
||||
- Subscribe to FaceMonitor notifications using connect (:issue:`2350`)
|
||||
|
||||
- Log exceptions thrown in event loop
|
||||
|
||||
- Change ``ndn::ptr_lib::shared_ptr`` to ``std::shared_ptr`` (:issue:`2110`)
|
||||
|
||||
- Avoid deprecated ``ndn::Name::set`` method (:issue:`2505`)
|
||||
|
||||
- Update waf to version 1.8.8-dev
|
||||
|
||||
- Add sorting tiebreaker to NexthopList (:issue:`2715`)
|
||||
|
||||
- Update Jenkins-CI build scripts
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- Fix python3 build error (:issue:`1956`)
|
||||
|
||||
- Fix typos in nlsr.conf security section (:issue:`1985`)
|
||||
|
||||
- Stop SyncLogicHandler from fetching a router’s own LSAs (:issue:`2005`)
|
||||
|
||||
- Fix Name LSA comparison which could cause incorrect advertised names to be removed (:issue:`2029`)
|
||||
|
||||
- Fix issue where more faces than max-faces-per-prefix could be applied to a prefix (:issue:`2018`)
|
||||
|
||||
- Stop LSDB from retrieving and out of date LSA when a new one is detected (:issue:`1987`)
|
||||
|
||||
- Correct mistakes in documentation
|
||||
|
||||
- Correct bitmask used to copy Name LSA sequence number (:issue:`2323`)
|
||||
|
||||
NLSR version 0.1.0 (initial release)
|
||||
++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: August 25, 2014
|
||||
|
||||
The main design goal of NLSR is to provide a routing protocol to populate `NFD's
|
||||
<http://named-data.net/doc/NFD/current/>`_ RIB. NLSR calculates the routing table using
|
||||
link-state or hyperbolic routing and produces multiple faces for each reachable name
|
||||
prefix in a single authoritative domain.
|
||||
|
||||
**Included features**:
|
||||
|
||||
- Advertise availability of content through the configured router
|
||||
|
||||
- Use `ChronoSync <https://github.com/named-data/ChronoSync>`_ to synchronize routers' LSA sequence numbers and Interest/Data to retrieve LSAs
|
||||
|
||||
- Produce a list of ranked forwarding options for each name prefix to facilitate NDN's adaptive forwarding strategies
|
||||
|
||||
- Configure maximum number of faces per prefix in NFD’s RIB
|
||||
|
||||
- Set up NFD tunnels to neighbors automatically and maintain the tunnels to neighbors
|
||||
|
||||
- Provide two routing protocols:
|
||||
|
||||
+ Link State routing: calculate route cost based on link costs
|
||||
+ Hyperbolic routing: calculate route cost based on hyperbolic coordinates
|
||||
|
||||
- Use a hierarchical trust model for routing within a single administrative domain
|
||||
|
||||
- Keep NFD’s RIB updated on failure and recovery
|
||||
+102
-26
@@ -35,6 +35,9 @@ The number represents the connecting face id. For example,
|
||||
We will walk through setting up the faces and creating the configuration file for
|
||||
``/ndn/edu/memphis/%C1.Router/router1``.
|
||||
|
||||
It is recommended to configure security as described at :doc:`SECURITY-CONFIG`, before
|
||||
starting router configuration.
|
||||
|
||||
Step 1. Ensuring nfd is running
|
||||
-------------------------------
|
||||
|
||||
@@ -42,11 +45,19 @@ Type the following in the terminal:
|
||||
|
||||
::
|
||||
|
||||
nfd-status -f
|
||||
nfd-status
|
||||
|
||||
If you see ``ERROR: error while connecting to the forwarder (No such file or directory)``,
|
||||
If you see ``error while connecting to the forwarder (No such file or directory)``,
|
||||
``nfd`` is not running. Follow the instructions in `Getting started with NFD
|
||||
<http://named-data.net/doc/NFD/current/INSTALL.html>`_ to run nfd.
|
||||
<https://docs.named-data.net/NFD/current/INSTALL.html>`_ to run nfd.
|
||||
|
||||
Since v0.4.0, NLSR no longer creates Faces for the neighbors that are
|
||||
specified in ``nlsr.conf``. Instead, it relies on the pre-existence of
|
||||
the Faces in NFD. NLSR will obtain this information from NFD, and
|
||||
configure its neighbors using this information.
|
||||
|
||||
To create faces it is now necessary to use the ``nfdc`` command. See ``man nfdc`` for
|
||||
its documentation (`online version <https://docs.named-data.net/NFD/current/manpages/nfdc.html>`__).
|
||||
|
||||
Step 2. Determining FaceUri
|
||||
---------------------------
|
||||
@@ -83,11 +94,7 @@ configuration commands follows:
|
||||
; InterestLifetime (in seconds) for LSA fetching
|
||||
lsa-interest-lifetime 4 ; default value 4. Valid values 1-60
|
||||
|
||||
; log-level is to set the levels of log for NLSR
|
||||
log-level INFO ; default value INFO, valid value DEBUG, INFO
|
||||
log-dir /var/log/nlsr/
|
||||
seq-dir /var/lib/nlsr/
|
||||
; log4cxx-conf /path/to/log4cxx-conf
|
||||
state-dir /var/lib/nlsr/ ; state directory to store all dynamic changes to NLSR
|
||||
}
|
||||
|
||||
; the neighbors section contains the configuration for router's neighbors and hello's behavior
|
||||
@@ -106,11 +113,12 @@ configuration commands follows:
|
||||
hello-interval 60 ; interest sending interval in seconds. Default value 60
|
||||
; valid values 30-90
|
||||
|
||||
; adj-lsa-build-interval is the time to wait in seconds after an Adjacency LSA build is scheduled
|
||||
; before actually building the Adjacency LSA
|
||||
; adj-lsa-build-interval is the time to wait in seconds after an Adjacency LSA
|
||||
; build is scheduled before actually building the Adjacency LSA
|
||||
|
||||
adj-lsa-build-interval 5 ; default value 5. Valid values 0-5. It is recommended that
|
||||
; adj-lsa-build-interval have a lower value than routing-calc-interval
|
||||
; adj-lsa-build-interval have a lower value than
|
||||
; routing-calc-interval
|
||||
|
||||
; first-hello-interval is the time to wait in seconds before sending the first Hello Interest
|
||||
|
||||
@@ -121,8 +129,8 @@ configuration commands follows:
|
||||
|
||||
neighbor
|
||||
{
|
||||
name /ndn/edu/arizona/%C1.Router/router3 ; name prefix of the neighbor router consists
|
||||
; of network, site-name and router-name
|
||||
name /ndn/edu/arizona/%C1.Router/router3 ; name prefix of the neighbor router consists
|
||||
; of network, site-name and router-name
|
||||
|
||||
face-uri udp4://router3.arizona.edu ; face uri of the face connected to the neighbor
|
||||
link-cost 25 ; cost of the connecting link to neighbor
|
||||
@@ -130,7 +138,7 @@ configuration commands follows:
|
||||
|
||||
neighbor
|
||||
{
|
||||
name /ndn/edu/colostate/%C1.Router/router2 ; name prefix of the neighbor router consists
|
||||
name /ndn/edu/colostate/%C1.Router/router2 ; name prefix of the neighbor router consists
|
||||
; of network, site-name and router-name
|
||||
|
||||
face-uri udp4://79.123.10.145 ; face uri of the face connected to the neighbor
|
||||
@@ -147,9 +155,9 @@ configuration commands follows:
|
||||
; commands in this section follows a strict order
|
||||
; the switch is used to set hyperbolic routing calculation in NLSR
|
||||
|
||||
state off ; default value 'off', set value 'on' to enable hyperbolic routing table
|
||||
; calculation which turns link state routing 'off'. set value to 'dry-run'
|
||||
; to test hyperbolic routing and compare with link state routing.
|
||||
state off ; default value 'off', set value 'on' to enable hyperbolic routing table
|
||||
; calculation which turns link state routing 'off'. set value to 'dry-run'
|
||||
; to test hyperbolic routing and compare with link state routing.
|
||||
|
||||
|
||||
radius 123.456 ; radius of the router in hyperbolic coordinate system
|
||||
@@ -164,8 +172,8 @@ configuration commands follows:
|
||||
; the max-faces-per-prefix is used to limit the number of faces for each name prefixes
|
||||
; by NLSR in ndn FIB
|
||||
|
||||
max-faces-per-prefix 3 ; default value 0. Valid value 0-60. By default (value 0) NLSR adds
|
||||
; all available faces for each reachable name prefixes in NDN FIB
|
||||
max-faces-per-prefix 3 ; default value 0. Valid value 0-60. By default (value 0) NLSR adds
|
||||
; all available faces for each reachable name prefixes in NDN FIB
|
||||
|
||||
}
|
||||
|
||||
@@ -182,10 +190,78 @@ configuration commands follows:
|
||||
prefix /ndn/news/memphis/politics/lutherking
|
||||
}
|
||||
|
||||
.. note::
|
||||
By default NLSR's sequence file directory is set to ``/var/lib/nlsr/``. User must create this
|
||||
directory before starting NLSR. Since this is a system directory, NLSR must either be executed
|
||||
as root, or NLSR can be run as user "nlsr" after configuring the filesystem to grant "nlsr"
|
||||
read and write permissions. If user lacks permissions, the following error will occur:
|
||||
|
||||
Security configuration is discussed in :doc:`SECURITY-CONFIG`, which will be also part
|
||||
of this configuration file
|
||||
::
|
||||
|
||||
User does not have read and write permission on the directory
|
||||
Error in configuration file processing! Exiting from NLSR
|
||||
|
||||
To avoid this, the directory can be set in a user-owned directory. For example:
|
||||
|
||||
::
|
||||
|
||||
general
|
||||
{
|
||||
...
|
||||
|
||||
state-dir /home/username/nlsr/log ; path for sequence directory and other dynamic changes (Absolute path)
|
||||
|
||||
}
|
||||
...
|
||||
|
||||
The user will encounter errors such as the following if security is not configured:
|
||||
|
||||
::
|
||||
|
||||
Cannot read certificate from file: /home/username/NLSR/root.cert
|
||||
|
||||
To get rid of this and similar errors relating to security one has to configure security
|
||||
as described in :doc:`SECURITY-CONFIG`. Security can be disabled for testing purposes as follows:
|
||||
|
||||
::
|
||||
|
||||
...
|
||||
trust-anchor
|
||||
{
|
||||
type any
|
||||
;file-name "root.cert"
|
||||
}
|
||||
...
|
||||
trust-anchor
|
||||
{
|
||||
type any
|
||||
;file-name "site.cert"
|
||||
}
|
||||
; cert-to-publish "root.cert"
|
||||
; cert-to-publish "router.cert"
|
||||
; cert-to-publish "site.cert"
|
||||
; cert-to-publish "router.cert"
|
||||
|
||||
Or by simply replacing the whole security section with:
|
||||
|
||||
::
|
||||
|
||||
security
|
||||
{
|
||||
validator
|
||||
{
|
||||
trust-anchor
|
||||
{
|
||||
type any
|
||||
}
|
||||
}
|
||||
prefix-update-validator
|
||||
{
|
||||
trust-anchor
|
||||
{
|
||||
type any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Step 4: Running NLSR on /ndn/memphis.edu/router1
|
||||
-------------------------------------------------
|
||||
@@ -207,9 +283,9 @@ The same process needs to be followed for ``/ndn/arizona.edu/router3`` and
|
||||
Expected Output
|
||||
----------------
|
||||
|
||||
Assuming that all three routers are configured correctly and routing has converged, ``nfd-status`` in
|
||||
``/ndn/edu/colostate/%C1.Router/router2`` will have the following entries for the name
|
||||
advertised by ``/ndn/edu/memphis/%C1.Router/router1``:
|
||||
Assuming that all three routers are configured correctly and routing has converged,
|
||||
``nfd-status`` in ``/ndn/edu/colostate/%C1.Router/router2`` will have the following (or similar)
|
||||
entries for the name advertised by ``/ndn/edu/memphis/%C1.Router/router1``:
|
||||
|
||||
RIB:
|
||||
|
||||
@@ -219,7 +295,7 @@ RIB:
|
||||
/ndn/memphis/sports/basketball/grizzlies route={faceid=17 (origin=128 cost=25 ChildInherit), faceid=7 (origin=128 cost=58 ChildInherit)}
|
||||
/ndn/news/memphis/politics/lutherking route={faceid=17 (origin=128 cost=25 ChildInherit, faceid=7 (origin=128 cost=58 ChildInherit)}
|
||||
|
||||
This output can be seen by typing ``nfd-status -r`` in the terminal. Please refer to the
|
||||
This output can be seen by typing ``nfdc route list`` in the terminal. Please refer to the
|
||||
network figure for face IDs.
|
||||
|
||||
.. _hyperbolic routing table calculation: http://arxiv.org/abs/0805.1266
|
||||
@@ -20,7 +20,7 @@ The trust model of NLSR is semi-hierarchical. An example certificate signing hie
|
||||
router1 router2 router3 router4 router5 router6 router7
|
||||
| | | | | | |
|
||||
+ + + + + + +
|
||||
NLSR NSLR NSLR NSLR NSLR NSLR NSLR
|
||||
NLSR NLSR NLSR NLSR NLSR NLSR NLSR
|
||||
|
||||
Each entity's name and corresponding certificate name follow the
|
||||
convention below:
|
||||
@@ -28,14 +28,22 @@ convention below:
|
||||
======== ===================================================== ================================= ===============================================
|
||||
Entity Identity Name Example Certificate Name Example
|
||||
-------- ----------------------------------------------------- --------------------------------- -----------------------------------------------
|
||||
root /\<network\> /ndn /ndn/KEY/ksk-1/ID-CERT/%01
|
||||
site /\<network\>/\<site\> /ndn/edu/ucla /ndn/edu/ucla/KEY/ksk-2/ID-CERT/%01
|
||||
operator /\<network\>/\<site\>/%C1.Operator/\<operator-name\> /ndn/edu/ucla/%C1.Operator/op1 /ndn/edu/ucla/%C1.Operator/op1/KEY/ksk-3/ID-CERT/%01
|
||||
router /\<network\>/\<site\>/%C1.Router/\<router-name\> /ndn/edu/ucla/%C1.Router/rt1 /ndn/edu/ucla/%C1.Router/rt1/KEY/ksk-4/ID-CERT/%01
|
||||
NLSR /\<network\>/\<site\>/%C1.Router/\<router-name\>/NLSR /ndn/edu/ucla/%C1.Router/rt1/NLSR /ndn/edu/ucla/%C1.Router/rt1/NLSR/KEY/ksk-5/ID-CERT/%01
|
||||
root /\<network\> /ndn /ndn/KEY/1/%00/%01
|
||||
site /\<network\>/\<site\> /ndn/edu/ucla /ndn/edu/ucla/KEY/2/%00/%01
|
||||
operator /\<network\>/\<site\>/%C1.Operator/\<operator-name\> /ndn/edu/ucla/%C1.Operator/op1 /ndn/edu/ucla/%C1.Operator/op1/KEY/3/%00/%01
|
||||
router /\<network\>/\<site\>/%C1.Router/\<router-name\> /ndn/edu/ucla/%C1.Router/rt1 /ndn/edu/ucla/%C1.Router/rt1/KEY/4/%00/%01
|
||||
NLSR /\<network\>/\<site\>/%C1.Router/\<router-name\>/NLSR /ndn/edu/ucla/%C1.Router/rt1/NLSR /ndn/edu/ucla/%C1.Router/rt1/NLSR/KEY/5/%00/%01
|
||||
======== ===================================================== ================================= ===============================================
|
||||
|
||||
Users should create keys according to the naming and signing hierarchies above.
|
||||
Users should create keys according to the naming and signing hierarchies above. The
|
||||
``%C1.Operator`` and ``%C1.Router`` labels are NDN keywords that should not be modified
|
||||
by the user.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Detailed information about key setup is given in NLSR Developer's Guide and the
|
||||
:doc:`beginners-guide`.
|
||||
|
||||
Certificate Publishing
|
||||
----------------------
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,887 @@
|
||||
==========================================================
|
||||
A beginners guide to installing and testing NLSR on Fedora
|
||||
==========================================================
|
||||
|
||||
:Authors: David Arjona-Villicaña, Octavio Renteria-Vidales, Ashlesh Gawande
|
||||
:Date: November, 2018
|
||||
:Abstract: This is an easy to follow guide on how to install and test the NLSR routing protocol for NDN using two Fedora 28 machines. The commands and the paths used in this guide have been tested only in Fedora, although a similar procedure should be used for other linux systems. Specifically, the testing section (§ `5 <#test>`__) is platform independent. Therefore users who have NLSR already installed may skip to this section. Since neither NDN, NLSR nor Fedora are static software developments, it is expected that some commands and features in this guide will change over time. However, this guide is as accurate as it could be at the time it was published.
|
||||
|
||||
.. role:: raw-latex(raw)
|
||||
:format: latex
|
||||
|
||||
|
||||
.. _intro:
|
||||
|
||||
1. Introduction
|
||||
===============
|
||||
|
||||
The following instructions are based on the information provided at the
|
||||
Named Data Networking project web page [NDNmain]_.
|
||||
Before installing NLSR it is necessary to install different libraries and
|
||||
programs: ndn-cxx, NFD, ChronoSync [optional], ndn-svs [optional] and PSync.
|
||||
This document describes the necessary steps to correctly install these
|
||||
programs (§ `2 <#ndncxx>`__, `3 <#nfd>`__ and `4 <#nlsr>`__) and a brief
|
||||
guide on how to configure and test NLSR using a simple two-node
|
||||
network (§ `5 <#test>`__).
|
||||
|
||||
Many of the commands in this guide need to be executed as *root*.
|
||||
Starting from Fedora 28, there is no need to set a root user
|
||||
[Kolman2018]_. However it is possible to define it,
|
||||
using the following command:
|
||||
|
||||
::
|
||||
|
||||
$ sudo -i
|
||||
|
||||
And then using the ``passwd`` command to set up a password. After setting
|
||||
up the root user, it is possible to become root by employing the
|
||||
following command and providing the root password when prompted:
|
||||
|
||||
::
|
||||
|
||||
$ su -
|
||||
|
||||
Fedora employs the ``dnf`` command to install and verify installed
|
||||
packages. The following commands may become useful during the
|
||||
installation process and should be executed as root:
|
||||
|
||||
- To verify that all installed packages are up to date
|
||||
|
||||
::
|
||||
|
||||
$ dnf update
|
||||
|
||||
- To verify if a package is already installed in the system
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed <package-name>
|
||||
|
||||
- To search for information about a package or family of packages (not
|
||||
necessarily installed in the system).
|
||||
|
||||
::
|
||||
|
||||
$ dnf info <package-name>
|
||||
|
||||
- To install a package in the system.
|
||||
|
||||
::
|
||||
|
||||
$ dnf install <package-name>
|
||||
|
||||
It is also a good installation practice to download and install all the
|
||||
NDN programs in a common directory. Therefore, it is recommended to
|
||||
create a directory at the home directory where all the following
|
||||
programs may get installed. The name of this directory is not important.
|
||||
However, the following are provided as suggestions: project, NDNproject,
|
||||
NDNprograms. Each of the programs in the following sections should be
|
||||
downloaded to their own directory using the ``git`` command, and then
|
||||
compiled in this directory.
|
||||
|
||||
.. _ndncxx:
|
||||
|
||||
2. Installing ndn-cxx
|
||||
=====================
|
||||
|
||||
2.1 Before installing ndn-cxx
|
||||
-----------------------------
|
||||
|
||||
An updated list of the packages and programs that need to be installed
|
||||
before installing ndn-cxx, is provided at [NDN-cxx]_.
|
||||
This list is also reproduced below with the commands to verify that all
|
||||
the packages have been installed in the system. The following commands
|
||||
should be run as root:
|
||||
|
||||
#. gcc and gcc-c++
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed gcc
|
||||
$ dnf list --installed gcc-c++
|
||||
|
||||
#. Python version 3.8 or later
|
||||
|
||||
::
|
||||
|
||||
$ python3 -V
|
||||
|
||||
#. SQLite 3.x
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed sqlite-devel
|
||||
|
||||
#. OpenSSL version 1.1.1 or later
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed openssl-devel
|
||||
|
||||
#. pkgconf that replaces pkg-config
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed pkgconf*
|
||||
|
||||
#. Boost libraries version 1.71.0 or later
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed boost-devel
|
||||
|
||||
#. git
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed git
|
||||
|
||||
#. doxygen (optional)
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed doxygen
|
||||
|
||||
#. graphviz (optional)
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed graphviz
|
||||
|
||||
#. python3-pip (optional)
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed python3-pip
|
||||
|
||||
#. After verifying that the python3-pip package has been installed, it
|
||||
is necessary to run the following command:
|
||||
|
||||
::
|
||||
|
||||
$ pip install sphinx sphinxcontrib-doxylink
|
||||
|
||||
2.2 Downloading and installing ndn-cxx
|
||||
--------------------------------------
|
||||
|
||||
The ``git`` command allows to download the ndn-cxx library in its own
|
||||
folder, also called *ndn-cxx*. Therefore it is recommended to execute
|
||||
this command at the directory created at § `1 <#intro>`__:
|
||||
|
||||
::
|
||||
|
||||
$ git clone --depth 1 https://github.com/named-data/ndn-cxx.git
|
||||
|
||||
Move to the ndn-cxx directory:
|
||||
|
||||
::
|
||||
|
||||
$ cd ndn-cxx
|
||||
|
||||
Use the following command to verify that everything is ready to compile.
|
||||
If an error message displays, it is necessary to fix it before
|
||||
continuing:
|
||||
|
||||
::
|
||||
|
||||
$ ./waf configure --with-examples
|
||||
|
||||
Compile the ndn-cxx library and install the compiled files at the
|
||||
system's directories:
|
||||
|
||||
::
|
||||
|
||||
$ ./waf
|
||||
$ sudo ./waf install
|
||||
|
||||
2.3 Configuring ndn-cxx
|
||||
-----------------------
|
||||
|
||||
The commands in this subsection need to be run as root. First, it is
|
||||
necessary to create file *local.conf*, which contains a line with the
|
||||
location for the ndn-cxx library:
|
||||
|
||||
::
|
||||
|
||||
$ echo /usr/local/lib64 >> /etc/ld.so.conf.d/local.conf
|
||||
|
||||
The following command configures the libraries:
|
||||
|
||||
::
|
||||
|
||||
$ ldconfig -v | grep ndn
|
||||
|
||||
This command should display a line similar to the following:
|
||||
|
||||
::
|
||||
|
||||
libndn-cxx.so.0.6.1 -> libndn-cxx.so.0.6.1
|
||||
|
||||
Configure the NDN path:
|
||||
|
||||
::
|
||||
|
||||
$ echo export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig >> /etc/profile.d/ndn.sh
|
||||
|
||||
After this command has been executed, it is necessary to apply the
|
||||
changes by either logging out and back in, and then running the
|
||||
following command:
|
||||
|
||||
::
|
||||
|
||||
$ printenv | grep PKG
|
||||
|
||||
Or by executing the following command:
|
||||
|
||||
::
|
||||
|
||||
$ ./etc/profile.d/ndn.sh
|
||||
|
||||
For more information and examples about how to compile and configure
|
||||
this library, users should read the ndn-cxx guide at
|
||||
[NDN-cxx]_.
|
||||
|
||||
.. _nfd:
|
||||
|
||||
3. Installing NFD
|
||||
=================
|
||||
|
||||
3.1 Before installing NFD
|
||||
-------------------------
|
||||
|
||||
An updated list of the packages and programs that need to be installed
|
||||
before NFD is provided at [NDNNFD]_. Before installing
|
||||
NFD it is necessary to verify that the following packages are installed:
|
||||
|
||||
#. pcap library
|
||||
|
||||
::
|
||||
|
||||
$ dnf list --installed libpcap-devel
|
||||
|
||||
3.2 Downloading and installing NFD
|
||||
----------------------------------
|
||||
|
||||
This software is downloaded and installed in a folder called *NFD*, which
|
||||
should be created at the directory defined at § `1 <#intro>`__. The
|
||||
following commands need to be run as a regular user:
|
||||
|
||||
::
|
||||
|
||||
$ git clone --depth 1 https://github.com/named-data/NFD.git
|
||||
$ cd NFD
|
||||
$ ./waf configure
|
||||
|
||||
If the previous command prints an error message saying that waf cannot
|
||||
find WebSocket, it is necessary to follow the instructions provided by
|
||||
this same output, which tells the user to run the following command:
|
||||
|
||||
::
|
||||
|
||||
$ git submodule update --init
|
||||
|
||||
After executing these instructions, complete the configuration by running
|
||||
``./waf configure`` again. Then complete the installation by means of the
|
||||
following commands:
|
||||
|
||||
::
|
||||
|
||||
$ ./waf
|
||||
$ sudo ./waf install
|
||||
|
||||
3.3 Configuring NFD
|
||||
-------------------
|
||||
|
||||
Create a configuration file by running the following command as root:
|
||||
|
||||
::
|
||||
|
||||
$ cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf
|
||||
|
||||
After the configuration file has been created, NFD's behavior may be
|
||||
changed by modifying this file. Once the configuration file has been
|
||||
created, it is recommended to start NFD by using the following command:
|
||||
|
||||
::
|
||||
|
||||
$ nfd-start
|
||||
|
||||
This command does not properly allow to employ the command window to
|
||||
enter new commands; however it displays the NFD logs. Therefore, it is
|
||||
recommended to open a new command window. This second window may be used
|
||||
to verify NDF's status and then stop NFD by using the following
|
||||
commands:
|
||||
|
||||
::
|
||||
|
||||
$ nfd-status
|
||||
$ nfd-stop
|
||||
|
||||
.. _nlsr:
|
||||
|
||||
4. Installing NLSR
|
||||
==================
|
||||
|
||||
4.1 Installing PSync
|
||||
--------------------
|
||||
|
||||
Before installing NLSR, it is also necessary to download and install
|
||||
PSync. PSync is a synchronization library which allows NLSR to synchronize LSAs
|
||||
similar to ChronoSync. More information about PSync may be found at [PSync]_.
|
||||
This library may be installed by running the following commands as a regular
|
||||
user and at the directory defined at § `1 <#intro>`__:
|
||||
|
||||
::
|
||||
|
||||
$ git clone --depth 1 https://github.com/named-data/PSync.git
|
||||
$ cd PSync
|
||||
$ ./waf configure
|
||||
$ ./waf
|
||||
$ sudo ./waf install
|
||||
|
||||
The following command needs to be used again to configure the libraries:
|
||||
|
||||
::
|
||||
|
||||
$ sudo ldconfig -v | grep -i psync
|
||||
|
||||
This command should display a line similar to the following:
|
||||
|
||||
::
|
||||
|
||||
libPSync.so.0.1.0 -> libPSync.so.0.1.0
|
||||
|
||||
4.2 [Optional] Installing ChronoSync
|
||||
------------------------------------
|
||||
|
||||
By default NLSR no longer builds with ChronoSync support.
|
||||
Since ChronoSync is deprecated, only install it for testing purposes.
|
||||
|
||||
Before installing NLSR, it is necessary to first download and install
|
||||
ChronoSync, which is a synchronization library which allows NLSR routers
|
||||
to synchronize Link State Advertisements (LSAs). More information about
|
||||
ChronoSync may be found at [Chronosync]_. This library may be
|
||||
installed by running the following commands as a regular user and at the
|
||||
directory defined at § `1 <#intro>`__:
|
||||
|
||||
::
|
||||
|
||||
$ git clone --depth 1 https://github.com/named-data/ChronoSync.git
|
||||
$ cd ChronoSync
|
||||
$ ./waf configure
|
||||
$ ./waf
|
||||
$ sudo ./waf install
|
||||
|
||||
The following command needs to be used again to configure the libraries:
|
||||
|
||||
::
|
||||
|
||||
$ sudo ldconfig -v | grep -i chronosync
|
||||
|
||||
This command should display a line similar to the following:
|
||||
|
||||
::
|
||||
|
||||
libChronoSync.so.0.5.0 -> libChronoSync.so.0.5.0
|
||||
|
||||
4.3 [Optional] Installing SVS
|
||||
-----------------------------
|
||||
|
||||
NLSR can also use State Vector Sync as the underlying Sync protocol,
|
||||
using the ndn-svs library.
|
||||
|
||||
This library may be installed by running the following commands as a
|
||||
regular user and at the directory defined at § `1 <#intro>`__:
|
||||
|
||||
::
|
||||
|
||||
$ git clone --depth 1 https://github.com/named-data/ndn-svs.git
|
||||
$ cd ndn-svs
|
||||
$ ./waf configure
|
||||
$ ./waf
|
||||
$ sudo ./waf install
|
||||
|
||||
The following command needs to be used again to configure the libraries:
|
||||
|
||||
::
|
||||
|
||||
$ sudo ldconfig -v | grep ndn-svs
|
||||
|
||||
This command should display a line similar to the following:
|
||||
|
||||
::
|
||||
|
||||
libndn-svs.so.0.0.1 -> libndn-svs.so.0.0.1
|
||||
|
||||
4.4 Downloading and installing NLSR
|
||||
-----------------------------------
|
||||
|
||||
NLSR is downloaded and installed in a folder called *NLSR* which should
|
||||
be created at the directory defined at § `1 <#intro>`__. The following
|
||||
commands need to be run as a regular user:
|
||||
|
||||
::
|
||||
|
||||
$ git clone --depth 1 https://github.com/named-data/NLSR.git
|
||||
$ cd NLSR
|
||||
$ ./waf configure
|
||||
$ ./waf
|
||||
$ sudo ./waf install
|
||||
|
||||
If ChronoSync support is needed for testing, please configure NLSR with:
|
||||
|
||||
::
|
||||
|
||||
$ ./waf configure --with-chronosync
|
||||
|
||||
4.5 Configuring NLSR
|
||||
--------------------
|
||||
|
||||
Create and configure the following directory by running the following
|
||||
commands as root:
|
||||
|
||||
::
|
||||
|
||||
$ mkdir /var/lib/nlsr
|
||||
$ chmod 777 /var/lib/nlsr
|
||||
|
||||
.. _test:
|
||||
|
||||
5. Configuring and Testing NLSR
|
||||
===============================
|
||||
|
||||
To test NLSR, the first step is to configure the keys and certificates
|
||||
that implement a secure communication between the routers. Then it is
|
||||
necessary to verify that the computers in the test network are
|
||||
connected, that NFD is running and the faces between the computers are
|
||||
configured. Finally, the NLSR configuration file has to be edited before
|
||||
running NLSR. The following subsections are provided as a guide to
|
||||
define and configure a simple computer network between two computers:
|
||||
router1 and router2.
|
||||
|
||||
.. _security:
|
||||
|
||||
5.1 Setting up the security
|
||||
---------------------------
|
||||
|
||||
Configuring security in an NDN network requires to generate, exchange
|
||||
and install, keys and certificates between the root, site, operator and
|
||||
router computers that form the network
|
||||
[NLSRsecconf]_, [NLSRdevguide]_, although in practice, it
|
||||
is possible to keep more than one of these entities in a single machine.
|
||||
The following example and *Figure 1* show how to configure security
|
||||
for a single router, called Router X. In this example, the root, site,
|
||||
operator and Router X are in different computers:
|
||||
|
||||
.. figure:: security_comp.png
|
||||
:alt: Security configuration example for Router X.
|
||||
:width: 19cm
|
||||
:align: center
|
||||
|
||||
Fig. 1. Security configuration example for Router X.
|
||||
|
||||
|
||||
#. At the root server, generate the root key:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-key-gen /ndn/ > root.key
|
||||
|
||||
#. Generate the certificate for the root key at the root server:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-dump -i /ndn/ > root.cert
|
||||
|
||||
#. Install the root certificate at the root server:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-install -f root.cert
|
||||
|
||||
#. At the site server, generate the site key:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-key-gen /ndn/edu/uaslp > site.key
|
||||
|
||||
#. Copy the site key to the root server and generate the certificate for
|
||||
the site server:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-gen -s /ndn/ site.key > site.cert
|
||||
|
||||
#. Copy the site certificate to the site server and install it:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-install -f site.cert
|
||||
|
||||
#. At the operator server, generate the operator key:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-key-gen /ndn/edu/uaslp/%C1.Operator/op > op.key
|
||||
|
||||
#. Copy the operator key to the site server and generate the certificate
|
||||
for the operator server:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-gen -s /ndn/edu/uaslp op.key > op.cert
|
||||
|
||||
#. Copy the operator certificate to the operator server and install it:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-install -f op.cert
|
||||
|
||||
#. At the router, generate the router key:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-key-gen /ndn/edu/uaslp/%C1.Router/routerX > routerX.key
|
||||
|
||||
#. Copy the router key to the operator server and generate the
|
||||
certificate for the router:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-gen -s /ndn/edu/uaslp/%C1.Operator/op routerX.key >
|
||||
routerX.cert
|
||||
|
||||
#. Copy the router certificate to the router and install it:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-cert-install -f routerX.cert
|
||||
|
||||
In the previous steps, the *%C1.Router* and *%C1.Operator* labels are
|
||||
NDN keywords and should not be changed. These labels will be also used
|
||||
by the configuration file (§ `5.4 <#configfile>`__)
|
||||
|
||||
The following command may be used to verify that the certificates have
|
||||
been installed in a computer:
|
||||
|
||||
::
|
||||
|
||||
$ ndnsec-list
|
||||
|
||||
This guide recommends that one machine functions as the root, site,
|
||||
operator and router1, while a different computer only functions as
|
||||
router2. *Figure 2* shows this
|
||||
configuration. For router1, the twelve steps described before need to be
|
||||
executed except for exchanging files between computers. For the router2,
|
||||
only steps 10 to 12 are needed to generate this router's certificate.
|
||||
|
||||
Additionally, the following command may be used to print a list and a
|
||||
brief description of all the ``ndnsec`` commands:
|
||||
|
||||
::
|
||||
|
||||
$ man ndnsec
|
||||
|
||||
|
||||
.. figure:: netwk1.png
|
||||
:alt: Example network.
|
||||
:width: 19cm
|
||||
:align: center
|
||||
|
||||
Fig. 2. Example network.
|
||||
|
||||
|
||||
5.2 Configuring the network
|
||||
---------------------------
|
||||
|
||||
The first step is to configure the physical network. If two computers
|
||||
are going to get connected using a single Ethernet cable, it is
|
||||
necessary to verify that this cable is a crossover. The other option is
|
||||
to employ a switch between two computers that are then connected using
|
||||
two regular Ethernet cables.
|
||||
|
||||
After the physical network has been assembled, it is necessary to
|
||||
configure the network addresses and cards for all the computers in the
|
||||
network. It is important to remember that computers that are connected
|
||||
to each other should use the same subnetwork address. It is possible to
|
||||
verify the network configuration in a Linux computer by means of the
|
||||
``ip addr`` command.
|
||||
|
||||
Once the physical network and network cards have been configured, it is
|
||||
necessary to verify that the computers can communicate with each other.
|
||||
The simplest way to do this is by using the ``ping`` command:
|
||||
|
||||
::
|
||||
|
||||
$ ping <remote-ip-address>
|
||||
|
||||
5.3 Starting and configuring NFD
|
||||
--------------------------------
|
||||
|
||||
To start and configure NFD it is necessary to open two terminal windows.
|
||||
The first one will be used to start NFD by means of the ``nfd-start``
|
||||
command. This terminal will also display the logs that NFD generates. By
|
||||
default, NFD only generates informational logs (INFO). However, it is
|
||||
possible to obtain different levels of verbosity for these logs. These
|
||||
levels can be set before NFD starts by editing the
|
||||
*/usr/local/etc/ndn/nfd.conf* file. Open this file using a regular text
|
||||
editor, read the information provided about logging and then modify the
|
||||
*default-level* variable at the *log* section according to the
|
||||
instructions provided in the file. Additional information about NFD
|
||||
configuration may be found at [NDNNFDusage]_.
|
||||
|
||||
The second terminal will be used to monitor the NFD status:
|
||||
|
||||
::
|
||||
|
||||
$ nfd-status
|
||||
|
||||
Employ the following command to configure each face that a computer uses
|
||||
to connect to a neighboring computer:
|
||||
|
||||
::
|
||||
|
||||
$ nfdc face create udp4://<remote-ip-address>
|
||||
|
||||
The face id may be displayed by running:
|
||||
|
||||
::
|
||||
|
||||
$ nfdc face list
|
||||
|
||||
The status of the face may be verified by using the following command:
|
||||
|
||||
::
|
||||
|
||||
$ nfdc face show id <face-id>
|
||||
|
||||
After finishing NLSR testing, it is necessary to destroy the face before
|
||||
stopping NFD. This operation is described at § `5.6 <#turn_off>`__. For
|
||||
the two computer network provided as an example (*Figure 2*), it is necessary that both
|
||||
machines run NFD and that each one configures a face that connects to
|
||||
the other machine.
|
||||
|
||||
.. _configfile:
|
||||
|
||||
5.4 Setting up the configuration file
|
||||
-------------------------------------
|
||||
|
||||
Instructions on how to use the configuration file are already provided
|
||||
at the NLSR's Router Configuration page [NLSRrtrconf]_.
|
||||
Read the information in this page to understand NLSR router
|
||||
configuration. The following text describes the instructions that have
|
||||
been modified at the default nlsr.conf file for router1:
|
||||
|
||||
::
|
||||
|
||||
; AT general SECTION:
|
||||
{
|
||||
network /ndn/ ; name of the network
|
||||
site /edu/uaslp ; name of the site
|
||||
router /%C1.Router/router1 ; name of the router: router1
|
||||
}
|
||||
|
||||
;AT neighbors SECTION:
|
||||
neighbors
|
||||
{
|
||||
neighbor
|
||||
{
|
||||
name /ndn/edu/uaslp/%C1.Router/router2 ; Neighbor router: router2
|
||||
face-uri udp://140.220.80.124 ; face to the neighbor
|
||||
link-cost 30 ; cost of the link
|
||||
}
|
||||
}
|
||||
|
||||
; AT advertising SECTION:
|
||||
advertising
|
||||
{
|
||||
prefix /ndn/edu/uaslp/office/bldg1 ; Advertising destinations
|
||||
prefix /ndn/edu/uaslp/office/bldg2 ; for router1
|
||||
}
|
||||
|
||||
; AT security SECTION:
|
||||
security
|
||||
{
|
||||
validator
|
||||
{
|
||||
...
|
||||
trust-anchor
|
||||
{
|
||||
type file
|
||||
file-name "root.cert" ; root certificate file
|
||||
}
|
||||
}
|
||||
|
||||
prefix-update-validator
|
||||
{
|
||||
...
|
||||
trust-anchor
|
||||
{
|
||||
type file
|
||||
file-name "site.cert" ; site certificate file
|
||||
}
|
||||
}
|
||||
|
||||
cert-to-publish "root.cert" ; root certificate file
|
||||
|
||||
cert-to-publish "site.cert" ; site certificate file
|
||||
|
||||
cert-to-publish "op.cert" ; operator certificate file
|
||||
|
||||
cert-to-publish "router1.cert" ; router1 certificate file
|
||||
}
|
||||
|
||||
The following text shows the modified instructions for router2:
|
||||
|
||||
::
|
||||
|
||||
; AT general SECTION:
|
||||
{
|
||||
network /ndn/ ; name of the network
|
||||
site /edu/uaslp ; name of the site
|
||||
router /%C1.Router/router2 ; name of the router: router2
|
||||
}
|
||||
|
||||
;AT neighbors SECTION:
|
||||
neighbors
|
||||
{
|
||||
neighbor
|
||||
{
|
||||
name /ndn/edu/uaslp/%C1.Router/router1 ; Neighbor router: router1
|
||||
face-uri udp://140.220.80.121 ; face to the neighbor
|
||||
link-cost 30 ; cost of the link
|
||||
}
|
||||
}
|
||||
|
||||
; AT advertising SECTION:
|
||||
advertising
|
||||
{
|
||||
prefix /ndn/edu/uaslp/labs/networks ; Advertising destinations
|
||||
prefix /ndn/edu/uaslp/labs/hardware ; for router2
|
||||
}
|
||||
|
||||
; AT security SECTION:
|
||||
security
|
||||
{
|
||||
validator
|
||||
{
|
||||
...
|
||||
trust-anchor
|
||||
{
|
||||
type file
|
||||
file-name "root.cert" ; root certificate file
|
||||
} ; this file needs to be copied to
|
||||
} ; router2
|
||||
|
||||
prefix-update-validator
|
||||
{
|
||||
...
|
||||
trust-anchor
|
||||
{
|
||||
type file
|
||||
file-name "site.cert" ; site certificate file
|
||||
} ; this file needs to be copied to
|
||||
} ; router2
|
||||
|
||||
...
|
||||
cert-to-publish "router2.cert" ; router2 certificate file
|
||||
}
|
||||
|
||||
Notice that files *root.cert* and *site.cert*, which were generated at
|
||||
router1, need to be copied to router2. Also notice that the *%C1.Router*
|
||||
and *%C1.Operator* keywords employed at § `5.1 <#security>`__ are also
|
||||
referenced by these configuration files.
|
||||
|
||||
.. _starting_nlsr:
|
||||
|
||||
5.5 Starting NLSR
|
||||
-----------------
|
||||
|
||||
It is recommended to open a third command terminal and run NLSR in this
|
||||
window. After the NLSR configuration file has been edited and saved as
|
||||
*nlsr.conf*, it is possible to start NLSR by running either of the
|
||||
following two commands:
|
||||
|
||||
::
|
||||
|
||||
$ nlsr
|
||||
$ nlsr -f <configuration-file>
|
||||
|
||||
However, to verify what is NLSR doing, it becomes necessary to employ
|
||||
NLSR's logging facility [NLSRstarting]_. A brief
|
||||
description on how to use NDN's logging facility may be displayed by
|
||||
entering the ``man ndn-log`` command. This guide recommends using one
|
||||
of the following two instructions to start NLSR:
|
||||
|
||||
::
|
||||
|
||||
$ export NDN_LOG=nlsr.*=TRACE && nlsr
|
||||
$ export NDN_LOG=nlsr.*=TRACE && nlsr -f <configuration-file>
|
||||
|
||||
The second terminal window may be used to run ``nfd-status`` again and
|
||||
it should be possible to verify that the status has changed, specially
|
||||
at the FIB and RIB sections of the generated report.
|
||||
|
||||
.. _turn_off:
|
||||
|
||||
5.6 Turning everything off
|
||||
--------------------------
|
||||
|
||||
In order to stop NLSR and NFD, the following sequence of events is
|
||||
recommended:
|
||||
|
||||
#. Stop NLSR by pressing the Ctrl+C keys at the third terminal window.
|
||||
|
||||
#. Destroy the face to the remote computers using either of the
|
||||
following two commands at the second terminal window:
|
||||
|
||||
::
|
||||
|
||||
$ nfdc face destroy <face-id>
|
||||
$ nfdc face destroy udp4://<remote-ip-address>
|
||||
|
||||
#. Stop NFD by entering the following command at the second terminal
|
||||
window:
|
||||
|
||||
::
|
||||
|
||||
$ nfd-stop
|
||||
|
||||
#. The crossover Ethernet cable may be unplugged and the computers'
|
||||
network configuration restored to its original settings.
|
||||
|
||||
5.7 Where to go from here
|
||||
-------------------------
|
||||
|
||||
Users interested in building and configuring larger networks may want to
|
||||
take a look at the NDN Ansible repository
|
||||
[NDNAnsible]_. This repository uses Ansible, which is a
|
||||
configuration management tool, to manage the official NDN testbed
|
||||
deployment [NDNTestbed]_.
|
||||
|
||||
|
||||
.. [NDNmain] *Named Data Networking*, https://named-data.net/, March 2018.
|
||||
|
||||
.. [Kolman2018] M. Kolman. *Anaconda improvements in Fedora 28*, Fedora Magazine, June 2018.
|
||||
|
||||
.. [NDN-cxx] *Getting started with ndn-cxx*, https://docs.named-data.net/ndn-cxx/current/INSTALL.html, April 2018.
|
||||
|
||||
.. [NDNNFD] *Getting started with NFD*, https://docs.named-data.net/NFD/current/INSTALL.html, April 2018.
|
||||
|
||||
.. [NDNNFDusage] *NFD usage*, https://docs.named-data.net/NFD/current/manpages/nfd.html, May 2018.
|
||||
|
||||
.. [Chronosync] Z. Zhu and A. Afanasyev. *Let's ChronoSync: Decentralized dataset state synchronization in Named Data Networking*, in IEEE ICNP, October 2013.
|
||||
|
||||
.. [PSync] M. Zhang, V. Lehman, and L. Wang. *Scalable Name-based Data Synchronization for Named Data Networking*, in IEEE INFOCOM, May 2017.
|
||||
|
||||
.. [NLSRsecconf] *NLSR Security Configuration*, https://docs.named-data.net/NLSR/current/SECURITY-CONFIG.html June 2018.
|
||||
|
||||
.. [NLSRdevguide] V. Lehman, M. Chowdhury, N. Gordon, A. Gawande. *NLSR Developer's Guide*, University of Memphis, November 2017.
|
||||
|
||||
.. [NLSRrtrconf] *NLSR Router Configuration*, https://docs.named-data.net/NLSR/current/ROUTER-CONFIG.html, April 2018.
|
||||
|
||||
.. [NLSRstarting] *Getting Started with NLSR*, https://docs.named-data.net/NLSR/current/GETTING-STARTED.html, May 2018.
|
||||
|
||||
.. [NDNAnsible] *NDN Ansible repository*, https://github.com/WU-ARL/NDN_Ansible, October 2018.
|
||||
|
||||
.. [NDNTestbed] *NDN Testbed*, https://named-data.net/ndn-testbed/, October 2018.
|
||||
+58
-220
@@ -1,254 +1,92 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# NLSR - Named Data Link State Routing Protocol documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Apr 6 19:58:22 2014.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
# For the full list of built-in configuration values, see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
import os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
# -- Project information -----------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
project = 'Named Data Link State Routing Protocol (NLSR)'
|
||||
copyright = 'Copyright © 2014-2023 Named Data Networking Project.'
|
||||
author = 'Named Data Networking Project'
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
# The short X.Y version.
|
||||
#version = ''
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.todo',
|
||||
'redmine_issue',
|
||||
]
|
||||
|
||||
def addExtensionIfExists(extension):
|
||||
try:
|
||||
__import__(extension)
|
||||
extensions.append(extension)
|
||||
except ImportError:
|
||||
sys.stderr.write("Extension '%s' in not available. "
|
||||
"Some documentation may not build correctly.\n" % extension)
|
||||
sys.stderr.write("To install, use \n"
|
||||
" sudo pip install %s\n" % extension.replace('.', '-'))
|
||||
|
||||
if os.getenv('GOOGLE_ANALYTICS', None):
|
||||
addExtensionIfExists('sphinxcontrib.googleanalytics')
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'NLSR - Named Data Link State Routing Protocol'
|
||||
copyright = u'2014-2015, Named Data Networking Project'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
#release = ''
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
today_fmt = '%Y-%m-%d'
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
needs_sphinx = '4.0'
|
||||
extensions = [
|
||||
'sphinx.ext.extlinks',
|
||||
'sphinx.ext.todo',
|
||||
]
|
||||
|
||||
def addExtensionIfExists(extension: str):
|
||||
try:
|
||||
if importlib.util.find_spec(extension) is None:
|
||||
raise ModuleNotFoundError(extension)
|
||||
except (ImportError, ValueError):
|
||||
sys.stderr.write(f'WARNING: Extension {extension!r} not found. '
|
||||
'Some documentation may not build correctly.\n')
|
||||
else:
|
||||
extensions.append(extension)
|
||||
|
||||
addExtensionIfExists('sphinxcontrib.doxylink')
|
||||
|
||||
templates_path = ['_templates']
|
||||
exclude_patterns = ['Thumbs.db', '.DS_Store']
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
# html_theme = 'default'
|
||||
html_theme = 'named_data_theme'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
html_theme_path = ['./']
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
html_theme_path = ['.']
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
html_copy_source = False
|
||||
html_show_sourcelink = False
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
html_file_suffix = ".html"
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'nlsr-docs'
|
||||
# Disable syntax highlighting of code blocks by default.
|
||||
highlight_language = 'none'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'nlsr-docs.tex', u'NLSR - Named Data Link State Routing Protocol Documentation',
|
||||
u'Named Data Networking Project', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
# -- Options for manual page output ------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-manual-page-output
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('manpages/nlsr', 'nlsr', u'Named Data Link State Routing Protocol Daemon', None, 1),
|
||||
('manpages/nlsr.conf', 'nlsr.conf', u'Named Data Link State Routing Protocol Daemon config file', None, 5),
|
||||
('manpages/nlsrc', 'nlsrc', u'Command-line utility to interact with and collect statistics from NLSR', None, 1),
|
||||
('manpages/nlsr', 'nlsr', 'Named Data Link State Routing daemon', [], 1),
|
||||
('manpages/nlsr.conf', 'nlsr.conf', 'Named Data Link State Routing daemon configuration file', [], 5),
|
||||
('manpages/nlsrc', 'nlsrc', 'command-line utility to interact with and collect statistics from NLSR', [], 1),
|
||||
]
|
||||
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
# -- Misc options ------------------------------------------------------------
|
||||
|
||||
if os.getenv('GOOGLE_ANALYTICS', None):
|
||||
googleanalytics_id = os.environ['GOOGLE_ANALYTICS']
|
||||
googleanalytics_enabled = True
|
||||
doxylink = {
|
||||
'nlsr': ('NLSR.tag', 'doxygen/'),
|
||||
}
|
||||
|
||||
redmine_project_url = "http://redmine.named-data.net/"
|
||||
extlinks = {
|
||||
'issue': ('https://redmine.named-data.net/issues/%s', 'issue #%s'),
|
||||
}
|
||||
+16
-103
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
|
||||
# title of most generated pages and in a few other places.
|
||||
# The default value is: My Project.
|
||||
|
||||
PROJECT_NAME = "NLSR - Named Data Link State Routing Protocol"
|
||||
PROJECT_NAME = "NLSR: Named Data Link State Routing Protocol"
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
@@ -68,7 +68,7 @@ OUTPUT_DIRECTORY = docs/doxygen
|
||||
# performance problems for the file system.
|
||||
# The default value is: NO.
|
||||
|
||||
CREATE_SUBDIRS = YES
|
||||
CREATE_SUBDIRS = NO
|
||||
|
||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
@@ -220,19 +220,13 @@ TAB_SIZE = 4
|
||||
|
||||
ALIASES =
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
||||
TCL_SUBST =
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C. For
|
||||
# instance, some of the names that are used will be different. The list of all
|
||||
# members will be omitted, etc.
|
||||
# The default value is: NO.
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
|
||||
# Python sources only. Doxygen will then generate output that is more tailored
|
||||
@@ -408,7 +402,7 @@ EXTRACT_PRIVATE = NO
|
||||
# scope will be included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_PACKAGE = YES
|
||||
EXTRACT_PACKAGE = NO
|
||||
|
||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
|
||||
# included in the documentation.
|
||||
@@ -422,7 +416,7 @@ EXTRACT_STATIC = YES
|
||||
# for Java sources.
|
||||
# The default value is: YES.
|
||||
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
|
||||
# This flag is only useful for Objective-C code. When set to YES local methods,
|
||||
# which are defined in the implementation section but not in the interface are
|
||||
@@ -485,7 +479,7 @@ INTERNAL_DOCS = NO
|
||||
# and Mac users are advised to set this option to NO.
|
||||
# The default value is: system dependent.
|
||||
|
||||
CASE_SENSE_NAMES = YES
|
||||
CASE_SENSE_NAMES = NO
|
||||
|
||||
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
|
||||
# their full class and namespace scopes in the documentation. If set to YES the
|
||||
@@ -524,7 +518,7 @@ SORT_MEMBER_DOCS = YES
|
||||
# name. If set to NO the members will appear in declaration order.
|
||||
# The default value is: NO.
|
||||
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BRIEF_DOCS = YES
|
||||
|
||||
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
|
||||
# (brief and detailed) documentation of class members so that constructors and
|
||||
@@ -536,7 +530,7 @@ SORT_BRIEF_DOCS = NO
|
||||
# detailed member documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_MEMBERS_CTORS_1ST = YES
|
||||
|
||||
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
|
||||
# of group names into alphabetical order. If set to NO the group names will
|
||||
@@ -968,13 +962,6 @@ VERBATIM_HEADERS = YES
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
||||
# which the alphabetical index list will be split.
|
||||
# Minimum value: 1, maximum value: 20, default value: 5.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all classes will
|
||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||
@@ -1103,21 +1090,13 @@ HTML_COLORSTYLE_SAT = 0
|
||||
|
||||
HTML_COLORSTYLE_GAMMA = 91
|
||||
|
||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to NO can help when comparing the output of multiple runs.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = YES
|
||||
|
||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||
# documentation will contain sections that can be hidden and shown after the
|
||||
# page has loaded.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_DYNAMIC_SECTIONS = YES
|
||||
|
||||
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
|
||||
# shown in the various tree structured indices initially; the user can expand
|
||||
@@ -1355,7 +1334,7 @@ GENERATE_TREEVIEW = YES
|
||||
# Minimum value: 0, maximum value: 20, default value: 4.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
ENUM_VALUES_PER_LINE = 1
|
||||
|
||||
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
|
||||
# to set the initial width (in pixels) of the frame in which the tree is shown.
|
||||
@@ -1380,17 +1359,6 @@ EXT_LINKS_IN_WINDOW = NO
|
||||
|
||||
FORMULA_FONTSIZE = 10
|
||||
|
||||
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
|
||||
# generated for formulas are transparent PNGs. Transparent PNGs are not
|
||||
# supported properly for IE 6.0, but are supported on all modern browsers.
|
||||
#
|
||||
# Note that when changing this option you need to delete any form_*.png files in
|
||||
# the HTML output directory before the changes have effect.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
||||
@@ -1653,16 +1621,6 @@ LATEX_BATCHMODE = NO
|
||||
|
||||
LATEX_HIDE_INDICES = NO
|
||||
|
||||
# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
|
||||
# code with syntax highlighting in the LaTeX output.
|
||||
#
|
||||
# Note that which sources are shown also depends on other settings such as
|
||||
# SOURCE_BROWSER.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_SOURCE_CODE = NO
|
||||
|
||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||
# bibliography, e.g. plainnat, or ieeetr. See
|
||||
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
@@ -1916,18 +1874,14 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED = DOXYGEN=1 \
|
||||
PREDEFINED = DOXYGEN \
|
||||
INIT_LOGGER(x)= \
|
||||
BOOST_STATIC_ASSERT(x)= \
|
||||
BOOST_CONCEPT_ASSERT(x)= \
|
||||
BOOST_CONCEPT_REQUIRES(x)= \
|
||||
DECL_OVERRIDE=override \
|
||||
PUBLIC_WITH_TESTS_ELSE_PRIVATE=private \
|
||||
PUBLIC_WITH_TESTS_ELSE_PROTECTED=protected \
|
||||
PROTECTED_WITH_TESTS_ELSE_PRIVATE=private \
|
||||
VIRTUAL_WITH_TESTS \
|
||||
DECL_CLASS_FINAL=final \
|
||||
DECL_FINAL=final
|
||||
VIRTUAL_WITH_TESTS=
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@@ -1993,34 +1947,10 @@ EXTERNAL_GROUPS = YES
|
||||
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of 'which perl').
|
||||
# The default file (with absolute path) is: /usr/bin/perl.
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
|
||||
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
|
||||
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
|
||||
# disabled, but it is recommended to install and use dot, since it yields more
|
||||
# powerful graphs.
|
||||
# The default value is: YES.
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see:
|
||||
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
|
||||
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
# The default value is: YES.
|
||||
@@ -2034,7 +1964,7 @@ HIDE_UNDOC_RELATIONS = NO
|
||||
# set to NO
|
||||
# The default value is: NO.
|
||||
|
||||
HAVE_DOT = YES
|
||||
HAVE_DOT = @HAVE_DOT@
|
||||
|
||||
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
|
||||
# to run in parallel. When set to 0 doxygen will base this on the number of
|
||||
@@ -2046,23 +1976,6 @@ HAVE_DOT = YES
|
||||
|
||||
DOT_NUM_THREADS = 0
|
||||
|
||||
# When you want a differently looking font n the dot files that doxygen
|
||||
# generates you can specify the font name using DOT_FONTNAME. You need to make
|
||||
# sure dot is able to find the font, which can be done by putting it in a
|
||||
# standard location or by setting the DOTFONTPATH environment variable or by
|
||||
# setting DOT_FONTPATH to the directory containing the font.
|
||||
# The default value is: Helvetica.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTNAME = Helvetica
|
||||
|
||||
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
|
||||
# dot graphs.
|
||||
# Minimum value: 4, maximum value: 24, default value: 10.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_FONTSIZE = 10
|
||||
|
||||
# By default doxygen will tell dot to use the default font as specified with
|
||||
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
|
||||
# the path where dot can find it using this tag.
|
||||
@@ -2150,7 +2063,7 @@ INCLUDED_BY_GRAPH = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
CALL_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
|
||||
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
|
||||
# dependency graph for every global function or class method.
|
||||
@@ -2161,7 +2074,7 @@ CALL_GRAPH = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
CALLER_GRAPH = YES
|
||||
CALLER_GRAPH = NO
|
||||
|
||||
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
|
||||
# hierarchy of all classes instead of a textual one.
|
||||
@@ -2264,7 +2177,7 @@ DOT_TRANSPARENT = YES
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_MULTI_TARGETS = NO
|
||||
DOT_MULTI_TARGETS = YES
|
||||
|
||||
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
|
||||
# explaining the meaning of the various boxes and arrows in the dot generated
|
||||
|
||||
+66
-38
@@ -1,19 +1,22 @@
|
||||
NLSR - Named Data Link State Routing Protocol
|
||||
=============================================
|
||||
NLSR: Named Data Link State Routing Protocol
|
||||
============================================
|
||||
|
||||
NLSR is a routing protocol in NDN that populates NDN's Routing Information Base. NLSR will
|
||||
continue to evolve alongside the Named Data Networking `protocol
|
||||
<http://named-data.net/doc/ndn-tlv/>`_.
|
||||
.. toctree::
|
||||
:hidden:
|
||||
:maxdepth: 2
|
||||
|
||||
NLSR is an open and free software package licensed under the GPL 3.0 license and free to
|
||||
all Internet users and developers. For more information about the licensing details and
|
||||
limitations, refer to `COPYING.md
|
||||
<https://github.com/named-data/NLSR/blob/master/COPYING.md>`_.
|
||||
GETTING-STARTED
|
||||
INSTALL
|
||||
SECURITY-CONFIG
|
||||
ROUTER-CONFIG
|
||||
beginners-guide
|
||||
manpages
|
||||
release-notes
|
||||
releases
|
||||
|
||||
NLSR is developed by the members of the `NSF-sponsored NDN project team
|
||||
<http://named-data.net/project/participants/>`_. For more details, please refer to
|
||||
`AUTHORS.md <https://github.com/named-data/NLSR/blob/master/AUTHORS.md>`_. Bug reports and
|
||||
feedback are highly appreciated and can be made through the `NLSR Wiki`_.
|
||||
**NLSR** is a routing protocol for Named Data Networking (NDN) that populates the Routing
|
||||
Information Base (RIB) of an NDN router, such as `NFD`_. NLSR continues to evolve alongside
|
||||
the core `NDN protocol`_.
|
||||
|
||||
The main design goal of NLSR is to provide a routing protocol to populate NDN's FIB. NLSR
|
||||
calculates the routing table using link-state or hyperbolic routing and produces multiple
|
||||
@@ -22,40 +25,65 @@ to evolve over time to include neighbor discovery and to become a full fledged
|
||||
inter-domain routing protocol for NDN. The protocol design is presented in full detail in
|
||||
the `NLSR Paper`_.
|
||||
|
||||
NLSR Documentation
|
||||
-------------------
|
||||
NLSR was mainly developed by members of the NSF-sponsored `NDN project team
|
||||
<https://named-data.net/project/participants/>`__. See `AUTHORS.md
|
||||
<https://github.com/named-data/NLSR/blob/master/AUTHORS.md>`__ for details.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
:maxdepth: 3
|
||||
Bug reports and feedback are highly appreciated and can be made through the `NLSR Redmine`_.
|
||||
|
||||
RELEASE-NOTES
|
||||
GETTING-STARTED
|
||||
INSTALL
|
||||
ROUTER-CONFIG
|
||||
SECURITY-CONFIG
|
||||
manpages
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
- :doc:`GETTING-STARTED`
|
||||
- :doc:`INSTALL`
|
||||
- :doc:`ROUTER-CONFIG`
|
||||
- :doc:`SECURITY-CONFIG`
|
||||
- :doc:`RELEASE-NOTES`
|
||||
- :doc:`manpages`
|
||||
- :doc:`GETTING-STARTED`
|
||||
- :doc:`INSTALL`
|
||||
- :doc:`SECURITY-CONFIG`
|
||||
- :doc:`ROUTER-CONFIG`
|
||||
- :doc:`beginners-guide`
|
||||
- :doc:`manpages`
|
||||
- :doc:`release-notes`
|
||||
- :doc:`releases`
|
||||
|
||||
Downloading
|
||||
-----------
|
||||
|
||||
- `GitHub NLSR repository <https://github.com/named-data/NLSR>`_
|
||||
- `Source code git repository <https://github.com/named-data/NLSR>`__
|
||||
|
||||
Additional information
|
||||
----------------------
|
||||
NLSR mailing list
|
||||
-----------------
|
||||
|
||||
- `NLSR Wiki`_
|
||||
- `NLSR Mailing List`_
|
||||
- `NLSR Mailing List Archives`_
|
||||
|
||||
- `NLSR Paper`_
|
||||
Detailed explanation of the NLSR design
|
||||
`Sign up`_ is needed to post to the list or access the archives.
|
||||
|
||||
Additional resources
|
||||
--------------------
|
||||
|
||||
.. _NLSR Wiki: http://redmine.named-data.net/projects/nlsr
|
||||
.. _NLSR Paper: http://www.cs.memphis.edu/~lanwang/paper/nlsr-final.pdf
|
||||
- `NLSR Wiki`_
|
||||
|
||||
- `NLSR Redmine`_
|
||||
Feature requests and bug reports
|
||||
|
||||
- `NLSR Paper`_
|
||||
Detailed explanation of NLSR's design
|
||||
|
||||
- `NLSR Developer's Guide`_
|
||||
For NLSR development
|
||||
|
||||
- `API documentation (doxygen) <doxygen/annotated.html>`__
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
NLSR is free software distributed under the GNU General Public License version 3.
|
||||
See `COPYING.md <https://github.com/named-data/NLSR/blob/master/COPYING.md>`__ for details.
|
||||
|
||||
.. _NDN protocol: https://docs.named-data.net/NDN-packet-spec/current/
|
||||
.. _NFD: https://github.com/named-data/NFD
|
||||
.. _NLSR Wiki: https://redmine.named-data.net/projects/nlsr/wiki
|
||||
.. _NLSR Paper: https://named-data.net/wp-content/uploads/2016/01/ndn-0037-1-nlsr.pdf
|
||||
.. _NLSR Mailing List: https://listserv.memphis.edu/scripts/wa.exe?SUBED1=NLSR-HELP-L&A=1
|
||||
.. _NLSR Mailing List Archives: https://listserv.memphis.edu/scripts/wa.exe?A0=NLSR-HELP-L
|
||||
.. _NLSR Developer's Guide: https://github.com/named-data/NLSR/blob/developers-guide/NLSR-Developers-Guide.pdf
|
||||
.. _Sign up: https://listserv.memphis.edu/scripts/wa.exe?GETPW1
|
||||
.. _NLSR Redmine: https://redmine.named-data.net/projects/nlsr
|
||||
+5
-7
@@ -1,10 +1,8 @@
|
||||
.. _Manpages:
|
||||
|
||||
Manpages
|
||||
========
|
||||
Man pages
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
manpages/nlsr
|
||||
manpages/nlsr.conf
|
||||
manpages/nlsrc
|
||||
:glob:
|
||||
:maxdepth: 1
|
||||
|
||||
manpages/*
|
||||
+2
-12
@@ -12,16 +12,12 @@ Usage
|
||||
Description
|
||||
-----------
|
||||
|
||||
``nlsr`` is a daemon that implements routing protocol in NDN to populates NDN's Routing
|
||||
``nlsr`` is a process that implements routing protocol in NDN to populate NDN's Routing
|
||||
Information Base.
|
||||
|
||||
Options:
|
||||
--------
|
||||
|
||||
|
||||
``-d``
|
||||
Run in daemon mode
|
||||
|
||||
``-f <FILE>``
|
||||
Specify configuration file name (default: ``./nlsr.conf``)
|
||||
|
||||
@@ -34,14 +30,8 @@ Options:
|
||||
Examples
|
||||
--------
|
||||
|
||||
To run NLSR daemon and use a configuration file from the ``/path/to`` directory.
|
||||
To run NLSR and use a configuration file from the ``/path/to`` directory.
|
||||
|
||||
::
|
||||
|
||||
nlsr -f /path/to/nlsr.conf
|
||||
|
||||
To run NLSR as daemon, use the ``-d`` flag:
|
||||
|
||||
::
|
||||
|
||||
nlsr -d
|
||||
+44
-5
@@ -6,7 +6,8 @@ Usage
|
||||
|
||||
::
|
||||
|
||||
nlsrc [-h] [-V] COMMAND [<Command Options>]
|
||||
nlsrc [-h | -V]
|
||||
nlsrc [-R <router prefix> [-c <nlsr.conf path> | -k]] COMMAND [<Command Options>]
|
||||
|
||||
|
||||
Description
|
||||
@@ -24,11 +25,28 @@ Options
|
||||
``-V``
|
||||
Show NLSRC version information
|
||||
|
||||
``-R <router prefix>``
|
||||
Target a remote NLSR instance.
|
||||
The default is the local NLSR instance ``/localhost``.
|
||||
|
||||
``-c <nlsr.conf path>``
|
||||
Verify remote status information with the trust schema loaded from ``security.validator`` section of specified nlsr.conf config file.
|
||||
The default is loading from ``/etc/ndn/nlsr.conf``.
|
||||
|
||||
``-k``
|
||||
Insecure: do not verify signature on status information retrieved from remote router.
|
||||
|
||||
``COMMAND``
|
||||
|
||||
``status``
|
||||
``lsdb``
|
||||
Retrieve LSDB status information
|
||||
|
||||
``routing``
|
||||
Retrieve routing table status information
|
||||
|
||||
``status``
|
||||
Retrieve LSDB status and routing table status information
|
||||
|
||||
``advertise``
|
||||
Add a Name prefix to be advertised by NLSR
|
||||
|
||||
@@ -37,6 +55,11 @@ Options
|
||||
``name``
|
||||
The Name prefix to be advertised
|
||||
|
||||
``advertise <name> save``
|
||||
|
||||
``save``
|
||||
Advertise a prefix and also save it to the nlsr.conf file residing in the state-dir for the next start of NLSR that operator may copy and use for the next start of NLSR
|
||||
|
||||
``withdraw``
|
||||
Remove a Name prefix advertised through NLSR
|
||||
|
||||
@@ -45,11 +68,27 @@ Options
|
||||
``name``
|
||||
The Name prefix to be withdrawn
|
||||
|
||||
``withdraw <name> delete``
|
||||
|
||||
``delete``
|
||||
Withdraw a prefix and also delete it from the nlsr.conf file residing in the state-dir
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
When security is enabled, NLSR will not be allowed to successfully
|
||||
advertise/withdraw names without first setting a default identity of operator.
|
||||
If default identity is not set as operator, the user will be presented with the
|
||||
error message: "Name prefix update error (code: 403)". To remedy this
|
||||
issue, use the command ``ndnsec set-default``. Example::
|
||||
|
||||
ndnsec set-default /ndn/a-site/%C1.Operator/op
|
||||
|
||||
Exit Status
|
||||
-----------
|
||||
|
||||
nlsrc exits with one of the following values:
|
||||
::
|
||||
nlsrc exits with one of the following values::
|
||||
|
||||
0 nlsrc exited successfully
|
||||
>0 An error occurred
|
||||
1 generic error
|
||||
2 bad command line
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="row">
|
||||
<div class="three columns">
|
||||
<div id="logo">
|
||||
<a href="http://named-data.net" title="A Future Internet Architecture"><img src="http://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
|
||||
<a href="https://named-data.net" title="A Future Internet Architecture"><img src="https://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
|
||||
</div><!--logo end-->
|
||||
</div>
|
||||
|
||||
@@ -38,12 +38,13 @@
|
||||
<h3>{{ _('Table Of Contents') }}</h3>
|
||||
{{ toctree(includehidden=True) }}
|
||||
|
||||
<h3>{{ _('Additional documenation') }}</h3>
|
||||
<h3>{{ _('Developer documentation') }}</h3>
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference external" href="http://redmine.named-data.net/projects/nlsr/wiki">NLSR Wiki</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="doxygen/annotated.html">API documentation (doxygen)</a></li>
|
||||
<li class="toctree-l1"><a class="reference external" href="https://redmine.named-data.net/projects/nlsr/wiki">NLSR Wiki</a></li>
|
||||
</ul>
|
||||
{%- endblock %}
|
||||
|
||||
{%- block sidebarsearch %}
|
||||
<h3 style="margin-top: 1.5em;">{{ _('Search') }}</h3>
|
||||
<form class="search" action="{{ pathto('search') }}" method="get">
|
||||
@@ -74,22 +75,11 @@
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
|
||||
<div id="copyright">This research is partially supported by NSF (Award <a href="http://www.nsf.gov/awardsearch/showAward?AWD_ID=1040868" target="_blank>">CNS-1040868</a>)<br/><br/><a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US" target="_blank">Creative Commons Attribution 3.0 Unported License</a> except where noted.</div>
|
||||
<div id="copyright">This research is partially supported by NSF (Award <a href="https://www.nsf.gov/awardsearch/showAward?AWD_ID=1040868" target="_blank>">CNS-1040868</a>)<br/><br/><a rel="license" href="https://creativecommons.org/licenses/by/3.0/deed.en_US" target="_blank">Creative Commons Attribution 3.0 Unported License</a> except where noted.</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!--footer info end-->
|
||||
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-22320603-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block relbar1 %}{% endblock %}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<!-- start footer part -->
|
||||
<!--BEGIN GENERATE_TREEVIEW-->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
$navpath
|
||||
<li class="footer">$generatedby
|
||||
<a href="https://www.doxygen.org/index.html">
|
||||
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--END GENERATE_TREEVIEW-->
|
||||
<!--BEGIN !GENERATE_TREEVIEW-->
|
||||
<hr class="footer"/>
|
||||
<address class="footer"><small>
|
||||
$generatedby  <a href="http://www.doxygen.org/index.html">
|
||||
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/>
|
||||
</a> $doxygenversion
|
||||
</small></address>
|
||||
<!--END !GENERATE_TREEVIEW-->
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '@GOOGLE_ANALYTICS@', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,7 +4,7 @@
|
||||
<ul>
|
||||
$navpath
|
||||
<li class="footer">$generatedby
|
||||
<a href="http://www.doxygen.org/index.html">
|
||||
<a href="https://www.doxygen.org/index.html">
|
||||
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -18,5 +18,7 @@ $generatedby  <a href="http://www.doxygen.org/index.html">
|
||||
</small></address>
|
||||
<!--END !GENERATE_TREEVIEW-->
|
||||
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="https://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
@@ -26,13 +26,13 @@ $mathjax
|
||||
<div class="row">
|
||||
<div class="three columns">
|
||||
<div id="logo">
|
||||
<a href="http://named-data.net" title="A Future Internet Architecture"><img src="http://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
|
||||
<a href="https://named-data.net" title="A Future Internet Architecture"><img src="https://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
|
||||
</div><!--logo end-->
|
||||
</div>
|
||||
|
||||
<!--top menu-->
|
||||
<div class="nine columns" id="menu_container" >
|
||||
<h1><a href="http://named-data.net/doc/NFD/$projectnumber/">$projectname $projectnumber documentation</a></h1>
|
||||
<h1><a href="https://named-data.net/doc/NLSR/$projectnumber/">$projectname $projectnumber documentation</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--header container end-->
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -1,70 +0,0 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
# Based on http://doughellmann.com/2010/05/09/defining-custom-roles-in-sphinx.html
|
||||
|
||||
"""Integration of Sphinx with Redmine.
|
||||
"""
|
||||
|
||||
from docutils import nodes, utils
|
||||
from docutils.parsers.rst.roles import set_classes
|
||||
|
||||
def redmine_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||
"""Link to a Redmine issue.
|
||||
|
||||
Returns 2 part tuple containing list of nodes to insert into the
|
||||
document and a list of system messages. Both are allowed to be
|
||||
empty.
|
||||
|
||||
:param name: The role name used in the document.
|
||||
:param rawtext: The entire markup snippet, with role.
|
||||
:param text: The text marked with the role.
|
||||
:param lineno: The line number where rawtext appears in the input.
|
||||
:param inliner: The inliner instance that called us.
|
||||
:param options: Directive options for customization.
|
||||
:param content: The directive content for customization.
|
||||
"""
|
||||
try:
|
||||
issue_num = int(text)
|
||||
if issue_num <= 0:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
msg = inliner.reporter.error(
|
||||
'Redmine issue number must be a number greater than or equal to 1; '
|
||||
'"%s" is invalid.' % text, line=lineno)
|
||||
prb = inliner.problematic(rawtext, rawtext, msg)
|
||||
return [prb], [msg]
|
||||
app = inliner.document.settings.env.app
|
||||
node = make_link_node(rawtext, app, 'issues', str(issue_num), options)
|
||||
return [node], []
|
||||
|
||||
def make_link_node(rawtext, app, type, slug, options):
|
||||
"""Create a link to a Redmine resource.
|
||||
|
||||
:param rawtext: Text being replaced with link node.
|
||||
:param app: Sphinx application context
|
||||
:param type: Link type (issue, changeset, etc.)
|
||||
:param slug: ID of the thing to link to
|
||||
:param options: Options dictionary passed to role func.
|
||||
"""
|
||||
#
|
||||
try:
|
||||
base = app.config.redmine_project_url
|
||||
if not base:
|
||||
raise AttributeError
|
||||
except AttributeError, err:
|
||||
raise ValueError('redmine_project_url configuration value is not set (%s)' % str(err))
|
||||
#
|
||||
slash = '/' if base[-1] != '/' else ''
|
||||
ref = base + slash + type + '/' + slug + '/'
|
||||
set_classes(options)
|
||||
node = nodes.reference(rawtext, 'Issue #' + utils.unescape(slug), refuri=ref,
|
||||
**options)
|
||||
return node
|
||||
|
||||
def setup(app):
|
||||
"""Install the plugin.
|
||||
|
||||
:param app: Sphinx application context.
|
||||
"""
|
||||
app.add_role('issue', redmine_role)
|
||||
app.add_config_value('redmine_project_url', None, 'env')
|
||||
return
|
||||
@@ -0,0 +1,4 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
.. include:: release-notes/release-notes-0.7.0.rst
|
||||
@@ -0,0 +1,31 @@
|
||||
NLSR version 0.1.0 (initial release)
|
||||
++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: August 25, 2014
|
||||
|
||||
The main design goal of NLSR is to provide a routing protocol to populate `NFD's
|
||||
<https://github.com/named-data/NFD>`__ RIB. NLSR calculates the routing table using
|
||||
link-state or hyperbolic routing and produces multiple faces for each reachable name
|
||||
prefix in a single authoritative domain.
|
||||
|
||||
Included features
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Advertise availability of content through the configured router
|
||||
|
||||
- Use `ChronoSync <https://github.com/named-data/ChronoSync>`__ to synchronize routers' LSA sequence numbers and Interest/Data to retrieve LSAs
|
||||
|
||||
- Produce a list of ranked forwarding options for each name prefix to facilitate NDN's adaptive forwarding strategies
|
||||
|
||||
- Configure maximum number of faces per prefix in NFD's RIB
|
||||
|
||||
- Set up NFD tunnels to neighbors automatically and maintain the tunnels to neighbors
|
||||
|
||||
- Provide two routing protocols:
|
||||
|
||||
+ Link State routing: calculate route cost based on link costs
|
||||
+ Hyperbolic routing: calculate route cost based on hyperbolic coordinates
|
||||
|
||||
- Use a hierarchical trust model for routing within a single administrative domain
|
||||
|
||||
- Keep NFD's RIB updated on failure and recovery
|
||||
@@ -0,0 +1,94 @@
|
||||
NLSR version 0.2.0 (changes since version 0.1.0)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: April 30, 2015
|
||||
|
||||
**Build**:
|
||||
|
||||
- The code now requires C++11. The minimum supported gcc version is 4.6, as earlier versions do not have proper support for C++11 features. (:issue:`1930`)
|
||||
|
||||
- Require OpenSSL (:issue:`2375`)
|
||||
|
||||
**New features**:
|
||||
|
||||
- Add nlsrc command-line tool (:issue:`1834`)
|
||||
|
||||
- Advertise/Withdraw name prefixes at runtime (:issue:`1834`)
|
||||
|
||||
- Assign zero cost to hyperbolic direct neighbors (:issue:`1975`)
|
||||
|
||||
- Only hyperbolic costs are adjusted before registering (:issue:`1974`)
|
||||
|
||||
- Add ability to specify different logging levels (:issue:`1935`)
|
||||
|
||||
- Add LSDB dataset publishers (:issue:`2280`)
|
||||
|
||||
- Add LSDB dataset tlv abstractions (:issue:`2280`)
|
||||
|
||||
- Allow zero cost neighbors for hyperbolic routing table calculation (:issue:`1982`)
|
||||
|
||||
- Faces are now created with canonical Face URI (:issue:`1911`)
|
||||
|
||||
- Add configurable router event intervals (:issue:`2071`)
|
||||
|
||||
- Add router-dead-interval configuration setting (:issue:`1878`)
|
||||
|
||||
- Add log formatting specified by log4cxx configuration file (:issue:`1950`)
|
||||
|
||||
- Face URIs in configuration file are checked for validity on load (:issue:`2070`)
|
||||
|
||||
- Configuration variables with default values are now optional (:issue:`1949`)
|
||||
|
||||
- Recalculate routing table after face destroy event (:issue:`2635`)
|
||||
|
||||
- Add Travis-CI build script
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Change adjacency status from uint32_t to enum (:issue:`1946`)
|
||||
|
||||
- Remove scheduler from NLSR class (:issue:`1981`)
|
||||
|
||||
- Change hyperbolic cost adjustment factor from 100 to 1000 (:issue:`1974`)
|
||||
|
||||
- Remove use of outdated namespace ``ndn::Tlv`` (:issue:`2079`)
|
||||
|
||||
- Remove use of deprecated ``ndn::nfd::Controller(Face&)`` constructor (:issue:`2133`)
|
||||
|
||||
- Routing update publishing is abstracted to SyncLogicHandler (:issue:`2289`)
|
||||
|
||||
- Make ConfParameter variable types consistent with min and max values (:issue:`2084`)
|
||||
|
||||
- Replace LSA string literals with constants (:issue:`2310`)
|
||||
|
||||
- Subscribe to FaceMonitor notifications using connect (:issue:`2350`)
|
||||
|
||||
- Log exceptions thrown in event loop
|
||||
|
||||
- Change ``ndn::ptr_lib::shared_ptr`` to ``std::shared_ptr`` (:issue:`2110`)
|
||||
|
||||
- Avoid deprecated ``ndn::Name::set`` method (:issue:`2505`)
|
||||
|
||||
- Update waf to version 1.8.8-dev
|
||||
|
||||
- Add sorting tiebreaker to NexthopList (:issue:`2715`)
|
||||
|
||||
- Update Jenkins-CI build scripts
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- Fix python3 build error (:issue:`1956`)
|
||||
|
||||
- Fix typos in nlsr.conf security section (:issue:`1985`)
|
||||
|
||||
- Stop SyncLogicHandler from fetching a router’s own LSAs (:issue:`2005`)
|
||||
|
||||
- Fix Name LSA comparison which could cause incorrect advertised names to be removed (:issue:`2029`)
|
||||
|
||||
- Fix issue where more faces than max-faces-per-prefix could be applied to a prefix (:issue:`2018`)
|
||||
|
||||
- Stop LSDB from retrieving and out of date LSA when a new one is detected (:issue:`1987`)
|
||||
|
||||
- Correct mistakes in documentation
|
||||
|
||||
- Correct bitmask used to copy Name LSA sequence number (:issue:`2323`)
|
||||
@@ -0,0 +1,20 @@
|
||||
NLSR version 0.2.1 (changes since version 0.2.0)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: June 30, 2015
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Using a configuration file without ``prefix-update-validator`` disables runtime advertise/withdraw instead of exiting (:issue:`2814`)
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- Prevent incomplete removal of NPT entry (:issue:`2785`)
|
||||
|
||||
- Correct bidirectional links with differing costs (:issue:`2801`)
|
||||
|
||||
- Fix non-incrementing Adjacency number in AdjLsa::writeLog (:issue:`2594`)
|
||||
|
||||
- Remove FaceDestroyEvent test's reliance on nlsrSeqNo.txt (:issue:`2881`)
|
||||
|
||||
- Test ACTIVE/INACTIVE Adjacencies in LSA construction (:issue:`2735`)
|
||||
@@ -0,0 +1,8 @@
|
||||
NLSR version 0.2.2 (changes since version 0.2.1)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: January 5, 2016
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Adapt code to changes in NFD/ndn-cxx version 0.4.0 release
|
||||
@@ -0,0 +1,26 @@
|
||||
NLSR version 0.3.0 (changes since version 0.2.2)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: August 1, 2016
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- Updated validation checker for LSA rule in the configuration file (:issue:`2965`)
|
||||
|
||||
- Do not advertise Adjacency LSAs when hyperbolic routing is enabled (:issue:`2402`)
|
||||
|
||||
- Do not distribute coordinate LSAs when using link-state routing. (:issue:`3661`)
|
||||
|
||||
- LSAs should be segmented before they are published (:issue:`2965`)
|
||||
|
||||
- Don't use DummyClientFace::sentDatas (:issue:`3383`)
|
||||
|
||||
- Remove disabled security files (:issue:`2960`)
|
||||
|
||||
- Lsa type should be argument for base class LSA constructor (:issue:`2788`)
|
||||
|
||||
- Use ndn-cxx/DummyClientFace (:issue:`2637`)
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- Unit tests cases are installed with `./waf install` (:issue:`3359`)
|
||||
@@ -0,0 +1,34 @@
|
||||
NLSR version 0.3.1 (changes since version 0.3.0)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: January 22, 2017
|
||||
|
||||
**Changes**
|
||||
|
||||
- **breaking change** Sync uses /localhop component in prefix to reduce duplicate NACKs (:issue:`3627`)
|
||||
|
||||
- **breaking change** LSA uses /localhop component in prefix to reduce duplicate NACKs (:issue:`3899`)
|
||||
|
||||
**Code Changes**:
|
||||
|
||||
- Fib and FaceMap use std::map instead of std::list (:issue:`2781`)
|
||||
|
||||
- NamePrefixTableEntries store RoutingTableEntries using a pointer (:issue:`2863`)
|
||||
|
||||
- Namespace closing comments are now consistent with ndn-cxx guidelines (:issue:`3735`)
|
||||
|
||||
- Update copyright date across all files (:issue:`3736`, `3909`, `3923`)
|
||||
|
||||
- Improve formatting of FaceMap and FaceMapEntry (:issue:`3737`)
|
||||
|
||||
- Sort NextHops on NexthopList insertion (:issue:`2721`)
|
||||
|
||||
**Bug fixes**:
|
||||
|
||||
- HR now recalculates paths after status change of a neighbor (:issue:`3874`)
|
||||
|
||||
- NLSR no longer sets strategies multiple times (:issue:`3743`)
|
||||
|
||||
- NLSR should enable use of ndn-cxx dispatcher (:issue:`3930`)
|
||||
|
||||
- Fix typos in the sample configuration file (:issue:`3113`)
|
||||
@@ -0,0 +1,20 @@
|
||||
NLSR version 0.3.2 (changes since version 0.3.1)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: March 15, 2017
|
||||
|
||||
**Changes**
|
||||
|
||||
- NLSR constructor now accept a KeyChain argument. (:issue:`3742`)
|
||||
|
||||
- Fix security rule for /localhop LSA prefix (:issue:`3899`)
|
||||
|
||||
- Use ndn::nfd::ROUTE_ORIGIN_NLSR instead of a magic number. (:issue:`3903`)
|
||||
|
||||
- Handle "Face Already Exists" error (error code 409) in NFD. (:issue:`3976`)
|
||||
|
||||
- Enable NLSR to register localhost prefix with dispatcher before top-level prefix. (:issue:`3938`)
|
||||
|
||||
- Don't use ndn aliases provided by ndn-cxx/common.hpp. (:issue:`3983`)
|
||||
|
||||
- Remove use of deprecated code. (:issue:`3988`)
|
||||
@@ -0,0 +1,79 @@
|
||||
NLSR version 0.4.0
|
||||
++++++++++++++++++
|
||||
|
||||
**New features**:
|
||||
|
||||
- **breaking change** Discover Faces from NFD (:issue:`2954`)
|
||||
|
||||
- **breaking change** Accommodate n-Dimensional HR coordinates (:issue:`3751`)
|
||||
|
||||
**Changes**:
|
||||
|
||||
- **breaking change** Make chronosync a dependency (:issue:`2400`)
|
||||
|
||||
- **breaking change** Use separate name prefix and sequence number
|
||||
for each LSA type (:issue:`3964`)
|
||||
|
||||
- **breaking change** Convert to ``v2::security`` and adapt to ndn-cxx changes (:issue:`3964`)
|
||||
|
||||
- Use unix timestamp as default (:issue:`4187`)
|
||||
|
||||
**Bug Fixes**:
|
||||
|
||||
- Add support for sources to NamePrefixList (:issue:`4177`)
|
||||
|
||||
- Fix incorrect error on face-dataset-fetch-interval valid values (:issue:`4211`)
|
||||
|
||||
- Fix prefix advertise runtime error (:issue:`4215`)
|
||||
|
||||
- Fix heap buffer overflow error (:issue:`4217`)
|
||||
|
||||
**Code Changes**:
|
||||
|
||||
- LSA getData() now uses ostream instead of manually building the string (:issue:`2346`)
|
||||
|
||||
- Refresh FIB entries independently of routing table calculation (:issue:`2778`)
|
||||
|
||||
- Change configuration parameter output level to info (:issue:`2850`)
|
||||
|
||||
- Updates to name prefixes are more efficient (:issue:`2864`)
|
||||
|
||||
- Implement statistics collector/recorder (:issue:`2956`)
|
||||
|
||||
- Implement ``NameLsa::isEqualContent`` (:issue:`2962`)
|
||||
|
||||
- Refactor ``Fib::removeOldNextHopsFromFibEntryAndNfd()`` for simplicity, readability. (:issue:`3820`)
|
||||
|
||||
- Improve logging throughout lsdb.cpp and others (:issue:`3934`)
|
||||
|
||||
- Enable dispatcher for LOCALHOST_PREFIX (:issue:`3938`)
|
||||
|
||||
- Don't use ndn aliases provided by ndn-cxx/common.hpp (:issue:`3983`)
|
||||
|
||||
- Canonize Adjacent FaceURIs on startup (:issue:`4063`)
|
||||
|
||||
- Refactor AdjacencyList to use iterators instead of bare ptrs (:issue:`4068`)
|
||||
|
||||
- Merge redundant functions (:issue:`4105`)
|
||||
|
||||
- Remove writeLog in NamePrefixList (:issue:`4131`)
|
||||
|
||||
- Check for self in ChronoSync updates (:issue:`4134`)
|
||||
|
||||
- Install nlsr.conf as sample in the system (:issue:`4197`)
|
||||
|
||||
- Enable AddressSanitizer and LeakSanitizer for unit tests (:issue:`4206`)
|
||||
|
||||
- Resolve all ASan errors in unit tests (:issue:`4230`)
|
||||
|
||||
- Simplified LSDB dataset interest handler. (:issue:`4235`)
|
||||
|
||||
- Made map more container-agnostic (:issue:`4239`)
|
||||
|
||||
- Improved routing map data structure. (:issue:`4240`)
|
||||
|
||||
- Increased independence of SyncLogicHandler (:issue:`4264`)
|
||||
|
||||
- Use unique_ptr for signal container (:issue:`4268`)
|
||||
|
||||
- Use network name in sync prefix to avoid sync leaks from other networks (:issue:`4101`)
|
||||
@@ -0,0 +1,24 @@
|
||||
NLSR version 0.4.1
|
||||
++++++++++++++++++
|
||||
|
||||
**New features**:
|
||||
|
||||
- The routing table dataset publisher (:issue:`3630`)
|
||||
|
||||
- Use ndn-cxx logging facility, remove log4cxx dependency (:issue:`3949`)
|
||||
|
||||
- Automatic serving of other routers' certificates (:issue:`4448`)
|
||||
|
||||
**Bug Fixes**:
|
||||
|
||||
- Hard-code a fixed session name for ChronoSync sockets (:issue:`4513`)
|
||||
|
||||
- Fix encoding bug in the routing table publisher (:issue:`4453`)
|
||||
|
||||
- Fix NLSR not converging without content store (:issue:`4430`)
|
||||
|
||||
**Miscellaneous Changes**:
|
||||
|
||||
- Make ChronoSync's sync interest lifetime configurable (:issue:`4490`)
|
||||
|
||||
- Print labels on adjacency matrix when logging (:issue:`2045`)
|
||||
@@ -0,0 +1,6 @@
|
||||
NLSR version 0.4.2
|
||||
++++++++++++++++++
|
||||
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fix segfault in scheduled erase of lsa segment (:issue:`4520`)
|
||||
@@ -0,0 +1,14 @@
|
||||
NLSR version 0.4.3
|
||||
++++++++++++++++++
|
||||
|
||||
**Changes**:
|
||||
|
||||
- **breaking change** Change NLSR to nlsr for various prefixes (:issue:`4543`)
|
||||
|
||||
**Bug Fixes**:
|
||||
|
||||
- Fix dry-run mode not working (:issue:`4394`)
|
||||
- Fix convergence w/o content store (:issue:`4430`)
|
||||
- Register router prefix to fix remote requests (:issue:`4543`)
|
||||
- Fix build with clang-5.0 (:issue:`4547`)
|
||||
- Avoid misaligned memory access (:issue:`4609`)
|
||||
@@ -0,0 +1,35 @@
|
||||
NLSR version 0.5.0
|
||||
++++++++++++++++++
|
||||
|
||||
**New Features**
|
||||
|
||||
- Set CanBePrefix to false on Hello Interest (:issue:`4581`)
|
||||
- Optionally write prefixes to a copy of config file via nlsrc advertise (:issue:`4303`)
|
||||
- Use SegmentPublisher utility from PSync to publish LSA data (:issue:`4760`)
|
||||
- Add PSync as a dependency and switch it as default in conf file. (:issue:`4082`)
|
||||
|
||||
**Changes**
|
||||
|
||||
- Decouple classes from Nlsr object for easier unit testing (:issue:`1952`)
|
||||
- Set sequence number file in SequencingManager constructor. (:issue:`4288`)
|
||||
- Read conf file in test prefix update processor instead of static string (:issue:`3960`)
|
||||
- Canonize FaceUri in conf file processor (:issue:`4817`)
|
||||
- Remove redundant function "calculateHypDryRoutingTable" (:issue:`4811`)
|
||||
- In dry run mode, print HR and LS routing table in nlsrc separately (:issue:`4452`)
|
||||
- Fix ASan memory leaks in unit tests (:issue:`4682`)
|
||||
- Systemd service files dependency corrections for Ubuntu 18.04 (:issue:`4594`)
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Fix processing of interest w/ segments for segmented LSA data (:issue:`4784`)
|
||||
- Fib: don't refresh neighbor router's FIB entry (:issue:`4799`)
|
||||
- Disable Interest filter loopback where ever not needed (:issue:`4768`)
|
||||
- Avoid crash when ndn-cxx is compiled with tests by setting canBePrefix (:issue:`4691`)
|
||||
- Make sure NLSR is not using any deprecated API (:issue:`4679`)
|
||||
- Fix crash in equals operator of adjacency-list (:issue:`4705`)
|
||||
- Fix error handling and normalize exit codes
|
||||
|
||||
**Miscellaneous**
|
||||
|
||||
- Improving documentation for NLSR
|
||||
- A beginners' guide to installing and testing on Fedora
|
||||
@@ -0,0 +1,15 @@
|
||||
NLSR version 0.5.1
|
||||
++++++++++++++++++
|
||||
|
||||
**Changes**
|
||||
|
||||
- Set best-route strategy for certificate prefixes (:issue:`4881`)
|
||||
- Use ndn-cxx InMemoryStorage for LsaSegmentStorage (:issue:`4788`)
|
||||
- Switch from ndn::EventId to ndn::scheduler::EventId (:issue:`4883`)
|
||||
- Add FreshnessPeriod where MustBeFresh is used (:issue:`4913`)
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- Fix canonization by resetting io service after each neighbor (:issue:`4872`)
|
||||
- Disable network interest in while fetching NLSR certificate (:issue:`4879`)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
NLSR version 0.5.2
|
||||
++++++++++++++++++
|
||||
|
||||
**Breaking Changes**
|
||||
|
||||
The following breaking changes make this release incompatible with the previous version.
|
||||
|
||||
- Use PSync version 0.2.0, sync data compression in full sync is enabled by default (:issue:`5061`, :issue:`4917`)
|
||||
- Use the floating point encoding/decoding functions for hyperbolic coordinates (:issue:`4615`)
|
||||
|
||||
**New Features**
|
||||
|
||||
- Handle zero cost links in Link State Routing (:issue:`4978`)
|
||||
|
||||
**Improvements and Bug Fixes**
|
||||
|
||||
- Remove support for old combined seq no file (:issue:`4143`)
|
||||
- Sync common test infrastructure with ndn-cxx
|
||||
- Refactor Certificate Storage class (:issue:`5075`)
|
||||
- Avoid crashing NLSR if identity cannot be created
|
||||
- Change init order to register sync routes after hello data has been verified (:issue:`5009`)
|
||||
- Fix empty file creation if conf file is same as dynamic (:issue:`5071`)
|
||||
- On face event notification, only proceed if face id was zero or updated (:issue:`4394`)
|
||||
@@ -0,0 +1,12 @@
|
||||
NLSR version 0.6.0
|
||||
------------------
|
||||
|
||||
Improvements and bug fixes
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- *(breaking change)* Major changes in the TLV structure and classes. Reduced codebase size and
|
||||
improved compilation times. LSA de/serialize functions are replaced by wireEncode/Decode.
|
||||
Updated LSA wire formats and TLV assignments. Updated nlsrc to print using the new encoding.
|
||||
(:issue:`4787`, :issue:`5116`)
|
||||
- LSDB refactor: switch to ``boost::multi_index`` to replace 3 LSA lists (:issue:`4127`)
|
||||
- Fix wrong reaction on hello Interest timeout (:issue:`5139`)
|
||||
@@ -0,0 +1,44 @@
|
||||
NLSR version 0.7.0
|
||||
------------------
|
||||
|
||||
Release date: August 18, 2023
|
||||
|
||||
New features
|
||||
^^^^^^^^^^^^
|
||||
|
||||
- Add experimental support for State Vector Sync (SVS) (:issue:`5248`)
|
||||
- ``nlsrc``: Add an option to query the status from remote routers (:issue:`4544`)
|
||||
|
||||
Notable changes and improvements
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- **Deprecate ChronoSync support**: ChronoSync support is now optional and excluded from the
|
||||
default build; it remains available mainly for testing purposes (:issue:`5147`)
|
||||
- Switched to the C++17 standard
|
||||
- The minimum build requirements have been increased as follows:
|
||||
|
||||
- Either GCC >= 7.4.0 or Clang >= 6.0 is required on Linux
|
||||
- On macOS, Xcode 11.3 or later is recommended; older versions may still work but are not
|
||||
officially supported
|
||||
- Boost >= 1.65.1 and ndn-cxx >= 0.8.1 are required on all platforms
|
||||
- Sphinx 4.0 or later is required to build the documentation
|
||||
|
||||
- Refactor LSDB for readability and add signals to notify of modifications (:issue:`4127`)
|
||||
- Retrieve LSA from the face that triggered the notification of LSA changes
|
||||
- Accommodate certificate name in ``KeyLocator`` (:issue:`5195`)
|
||||
- Change ``sig-type`` to ``ecdsa-sha256`` in ``nlsr.conf`` as ndn-cxx now has strict checking for it
|
||||
- Improve error handling and reporting
|
||||
- Stop using the ``gold`` linker on Linux; prefer instead linking with ``lld`` if installed
|
||||
- Update waf build system to version 2.0.24
|
||||
- Various test suite and documentation improvements
|
||||
|
||||
Bug fixes
|
||||
^^^^^^^^^
|
||||
|
||||
- lsdb: Fix for issues involving incorrect retransmission behavior in segment fetcher
|
||||
- Prevent NLSR from unregistering route during update for router that advertised it initially
|
||||
(:issue:`5179`)
|
||||
- NameLsa: fix LSDB update bug by sorting the NPLs before difference
|
||||
- Fix recurring sync prefix registration on every hello data (:issue:`5157`)
|
||||
- Return the appropriate exit codes when executing ``nlsrc`` advertise/withdraw commands
|
||||
(:issue:`5271`)
|
||||
@@ -0,0 +1,106 @@
|
||||
All NLSR Releases
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:hidden:
|
||||
:maxdepth: 1
|
||||
:reversed:
|
||||
|
||||
release-notes/*
|
||||
|
||||
* **NLSR version 0.7.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.7.0>`, `Documentation <https://docs.named-data.net/NLSR/0.7.0/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.7.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.7.0.tar.xz>`__ (`checksum <https://named-data.net/downloads/nlsr-0.7.0.tar.xz.sha256>`__)
|
||||
|
||||
* **NLSR version 0.6.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.6.0>`, `Documentation <https://docs.named-data.net/NLSR/0.6.0/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.6.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.6.0.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.6.0.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.5.2**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.5.2>`, `Documentation <https://docs.named-data.net/NLSR/0.5.2/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.5.2>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.5.2.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.5.2.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.5.1**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.5.1>`, `Documentation <https://docs.named-data.net/NLSR/0.5.1/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.5.1>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.5.1.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.5.1.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.5.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.5.0>`, `Documentation <https://docs.named-data.net/NLSR/0.5.0/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.5.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.5.0.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.5.0.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.4.3**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.4.3>`, `Documentation <https://docs.named-data.net/NLSR/0.4.3/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.4.3>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.4.3.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.4.3.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.4.2**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.4.2>`, `Documentation <https://docs.named-data.net/NLSR/0.4.2/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.4.2>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.4.2.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.4.2.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.4.1**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.4.1>`, `Documentation <https://docs.named-data.net/NLSR/0.4.1/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.4.1>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.4.1.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.4.1.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.4.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.4.0>`, `Documentation <https://docs.named-data.net/NLSR/0.4.0/>`__)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.4.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.4.0.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.4.0.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.3.2**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.3.2>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.3.2>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.3.2.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.3.2.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.3.1**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.3.1>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.3.1>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.3.1.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.3.1.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.3.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.3.0>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.3.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.3.0.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.3.0.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.2.2**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.2.2>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.2.2>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.2.2.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.2.2.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.2.1**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.2.1>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.2.1>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.2.1.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.2.1.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.2.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.2.0>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.2.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.2.0.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.2.0.tar.bz2.sha256>`__)
|
||||
|
||||
* **NLSR version 0.1.0**
|
||||
(:doc:`Release Notes <release-notes/release-notes-0.1.0>`)
|
||||
|
||||
`src (git) <https://github.com/named-data/NLSR/releases/tag/NLSR-0.1.0>`__,
|
||||
`src (tarball) <https://named-data.net/downloads/nlsr-0.1.0.tar.bz2>`__ (`checksum <https://named-data.net/downloads/nlsr-0.1.0.tar.bz2.sha256>`__)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -1,11 +0,0 @@
|
||||
log4j.rootLogger=DEBUG, Rolling
|
||||
|
||||
log4j.appender.Rolling=org.apache.log4j.rolling.RollingFileAppender
|
||||
log4j.appender.Rolling.File=/tmp/testnlsrproperties.log
|
||||
log4j.appender.Rolling.MaxSize=1MB
|
||||
log4j.appender.Rolling.MaxBackupIndex=10
|
||||
|
||||
log4j.appender.Rolling.layout=PatternLayout
|
||||
log4j.appender.Rolling.layout.ContextPrinting=enabled
|
||||
log4j.appender.Rolling.layout.DateFormat=ISO8601
|
||||
log4j.appender.Rolling.layout.ConversionPattern=%date{yyyyMMddHHmmssSSS} %p: [%c] %m%n
|
||||
@@ -4,14 +4,14 @@ general
|
||||
{
|
||||
; mandatory configuration command section network, site and router
|
||||
|
||||
network /ndn/ ; name of the network the router belongs to in ndn URI format
|
||||
network /ndn ; name of the network the router belongs to in ndn URI format
|
||||
site /edu/memphis ; name of the site the router belongs to in ndn URI format
|
||||
router /%C1.Router/cs/pollux ; name of the router in ndn URI format
|
||||
|
||||
; lsa-refresh-time is the time in seconds, after which router will refresh its LSAs
|
||||
lsa-refresh-time 1800 ; default value 1800. Valid values 240-7200
|
||||
|
||||
; router-dead-interval is the time in seconds after which an inactive router's
|
||||
; router-dead-interval is the time in seconds after which an inactive routers
|
||||
; LSAs are removed
|
||||
;router-dead-interval 3600 ; default value: 2*lsa-refresh-time. Value must be larger
|
||||
; than lsa-refresh-time
|
||||
@@ -19,27 +19,16 @@ general
|
||||
; InterestLifetime (in seconds) for LSA fetching
|
||||
lsa-interest-lifetime 4 ; default value 4. Valid values 1-60
|
||||
|
||||
; log-level is used to set the logging level for NLSR.
|
||||
; All debugging levels listed above the selected value are enabled.
|
||||
;
|
||||
; Valid values:
|
||||
;
|
||||
; NONE ; no messages
|
||||
; ERROR ; error messages
|
||||
; WARN ; warning messages
|
||||
; INFO ; informational messages (default)
|
||||
; DEBUG ; debugging messages
|
||||
; TRACE ; trace messages (most verbose)
|
||||
; ALL ; all messages
|
||||
; select sync protocol: chronosync / psync / svs
|
||||
sync-protocol psync
|
||||
|
||||
log-level INFO
|
||||
; sync interest lifetime of ChronoSync/PSync in milliseconds
|
||||
sync-interest-lifetime 60000 ; default value 60000. Valid values 1000-120,000
|
||||
|
||||
log-dir /var/log/nlsr/ ; path for log directory (Absolute path)
|
||||
seq-dir /var/lib/nlsr/ ; path for sequence directory (Absolute path)
|
||||
;log4cxx-conf /path/to/log4cxx-conf ; path for log4cxx configuration file (Absolute path)
|
||||
state-dir /var/lib/nlsr ; path for intermediate state files including sequence directory (Absolute path)
|
||||
}
|
||||
|
||||
; the neighbors section contains the configuration for router's neighbors and hello's behavior
|
||||
; the neighbors section contains the configuration for router's neighbors and hello protocol behavior
|
||||
|
||||
neighbors
|
||||
{
|
||||
@@ -49,7 +38,7 @@ neighbors
|
||||
hello-retries 3 ; interest retries number in integer. Default value 3
|
||||
; valid values 1-10
|
||||
|
||||
hello-timeout 1 ; interest time out value in integer. Default value 1
|
||||
hello-timeout 1 ; interest time out value in seconds. Default value 1
|
||||
; Valid values 1-15
|
||||
|
||||
hello-interval 60 ; interest sending interval in seconds. Default value 60
|
||||
@@ -58,12 +47,17 @@ neighbors
|
||||
; adj-lsa-build-interval is the time to wait in seconds after an Adjacency LSA build is scheduled
|
||||
; before actually building the Adjacency LSA
|
||||
|
||||
adj-lsa-build-interval 5 ; default value 5. Valid values 0-5. It is recommended that
|
||||
; adj-lsa-build-interval have a lower value than routing-calc-interval
|
||||
adj-lsa-build-interval 10 ; default value 10. Valid values 5-30.
|
||||
|
||||
; first-hello-interval is the time to wait in seconds before sending the first Hello Interest
|
||||
face-dataset-fetch-tries 3 ; default is 3. Valid values 1-10. The FaceDataset is
|
||||
; gotten from NFD, and is needed to configure NLSR
|
||||
; correctly. It is recommended not to set this
|
||||
; variable too high, because it could cause
|
||||
; congestion for NFD.
|
||||
|
||||
first-hello-interval 10 ; Default value 10. Valid values 0-10
|
||||
face-dataset-fetch-interval 3600 ; default is 3600. Valid values 1800-5400.
|
||||
; This controls how often (in seconds) NLSR will attempt to
|
||||
; fetch a FaceStatus dataset from NFD.
|
||||
|
||||
; neighbor command is used to configure router's neighbor. Each neighbor will need
|
||||
; one block of neighbor command
|
||||
@@ -101,11 +95,11 @@ hyperbolic
|
||||
|
||||
|
||||
radius 123.456 ; radius of the router in hyperbolic coordinate system
|
||||
angle 1.45 ; angle of the router in hyperbolic coordinate system
|
||||
angle 1.45,2.36 ; angle of the router in hyperbolic coordinate system
|
||||
}
|
||||
|
||||
|
||||
; the fib section is used to configure fib entry's type to ndn FIB updated by NLSR
|
||||
; the fib section is used to configure fib entrys type to ndn FIB updated by NLSR
|
||||
|
||||
fib
|
||||
{
|
||||
@@ -145,21 +139,21 @@ security
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<NLSR><INFO>]*<NLSR><INFO><><>$
|
||||
regex ^[^<nlsr><INFO>]*<nlsr><INFO><><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
sig-type ecdsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><ksk-.*><ID-CERT>$
|
||||
k-regex ^([^<KEY><nlsr>]*)<nlsr><KEY><>{1,3}$
|
||||
k-expand \\1
|
||||
h-relation equal
|
||||
p-regex ^([^<NLSR><INFO>]*)<NLSR><INFO><><>$
|
||||
p-regex ^([^<nlsr><INFO>]*)<nlsr><INFO><><>$
|
||||
p-expand \\1
|
||||
}
|
||||
}
|
||||
@@ -173,28 +167,56 @@ security
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<NLSR><LSA>]*<NLSR><LSA>
|
||||
regex ^[^<nlsr><LSA>]*<nlsr><LSA>
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
sig-type ecdsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><ksk-.*><ID-CERT>$
|
||||
k-regex ^([^<KEY><nlsr>]*)<nlsr><KEY><>{1,3}$
|
||||
k-expand \\1
|
||||
h-relation equal
|
||||
; the last four components in the prefix should be <lsaType><seqNo><version><segmentNo>
|
||||
p-regex ^([^<NLSR><LSA>]*)<NLSR><LSA>(<>*)<><><><>$
|
||||
p-regex ^<localhop>([^<nlsr><LSA>]*)<nlsr><LSA>(<>*)<><><><>$
|
||||
p-expand \\1\\2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule
|
||||
{
|
||||
id "NLSR datasets"
|
||||
for data
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<nlsr>]*<nlsr>[<lsdb><routing-table>]
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type ecdsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY>]*)<KEY><>{1,3}$ ; router key or certificate
|
||||
k-expand \\1
|
||||
h-relation equal
|
||||
p-regex ^([^<nlsr>]*)<nlsr>[<lsdb><routing-table>]
|
||||
p-expand \\1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule
|
||||
{
|
||||
id "NLSR Hierarchy Exception Rule"
|
||||
@@ -202,21 +224,21 @@ security
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<KEY><%C1.Router>]*<%C1.Router>[^<KEY><NLSR>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
regex ^[^<KEY><%C1.Router>]*<%C1.Router>[^<KEY><nlsr>]*<KEY><><><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
sig-type ecdsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
|
||||
k-regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><>{1,3}$
|
||||
k-expand \\1
|
||||
h-relation equal
|
||||
p-regex ^([^<KEY><%C1.Router>]*)<%C1.Router>[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
p-regex ^([^<KEY><%C1.Router>]*)<%C1.Router>[^<KEY>]*<KEY><><><>$
|
||||
p-expand \\1
|
||||
}
|
||||
}
|
||||
@@ -230,12 +252,12 @@ security
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
regex ^[^<KEY>]*<KEY><><><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type hierarchical
|
||||
sig-type rsa-sha256
|
||||
sig-type ecdsa-sha256
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,16 +277,18 @@ security
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^<localhost><nlsr><prefix-update>[<advertise><withdraw>]<>$
|
||||
; /<prefix>/<management-module>/<command-verb>/<control-parameters>
|
||||
; /<timestamp>/<random-value>/<signed-interests-components>
|
||||
regex ^<localhost><nlsr><prefix-update>[<advertise><withdraw>]<><><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
sig-type ecdsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
|
||||
regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><>{1,3}$
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,12 +300,12 @@ security
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
regex ^[^<KEY>]*<KEY><><><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type hierarchical
|
||||
sig-type rsa-sha256
|
||||
sig-type ecdsa-sha256
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +315,7 @@ security
|
||||
file-name "site.cert"
|
||||
}
|
||||
}
|
||||
|
||||
; cert-to-publish "root.cert" ; optional, a file containing the root certificate
|
||||
; Only the router that is designated to publish the root cert
|
||||
; needs to specify this
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
nsync is a copy of ChronoSync (https://github.com/bruinfish/ChronoSync/tree/master).
|
||||
|
||||
ChonoSync's license is GPL2.
|
||||
@@ -1,15 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2016, The University of Memphis,
|
||||
* Regents of the University of California
|
||||
*
|
||||
* See COPYING.md for copyright and distribution information.
|
||||
*/
|
||||
|
||||
// suppress Boost::archive warnings
|
||||
#pragma GCC system_header
|
||||
#pragma clang system_header
|
||||
|
||||
#include <boost/archive/iterators/transform_width.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef NSYNC_OPENSSL_H
|
||||
#define NSYNC_OPENSSL_H
|
||||
|
||||
// suppress deprecation warnings in OSX >= 10.7
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif // __clang__
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif // __GNUC__
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#endif // NSYNC_OPENSSL_H
|
||||
@@ -1,49 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014-2016, The University of Memphis,
|
||||
* Regents of the University of California
|
||||
*
|
||||
* This file is part of NLSR (Named-data Link State Routing).
|
||||
* See AUTHORS.md for complete list of NLSR authors and contributors.
|
||||
*
|
||||
* NLSR is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Foundation,
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef NSYNC_SYNC_COMMON_HPP
|
||||
#define NSYNC_SYNC_COMMON_HPP
|
||||
|
||||
#include <boost/exception/all.hpp>
|
||||
|
||||
#include <ndn-cxx/common.hpp>
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace Sync {
|
||||
|
||||
using std::bind;
|
||||
using std::function;
|
||||
|
||||
using std::make_shared;
|
||||
using std::shared_ptr;
|
||||
using std::weak_ptr;
|
||||
|
||||
using std::dynamic_pointer_cast;
|
||||
using std::static_pointer_cast;
|
||||
|
||||
using std::tuple;
|
||||
using std::make_tuple;
|
||||
using std::tie;
|
||||
|
||||
} // namespace Sync
|
||||
|
||||
#endif // NSYNC_SYNC_COMMON_HPP
|
||||
@@ -1,74 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-diff-leaf.h"
|
||||
#include <boost/throw_exception.hpp>
|
||||
typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info;
|
||||
|
||||
using namespace Sync::Error;
|
||||
|
||||
namespace Sync {
|
||||
|
||||
DiffLeaf::DiffLeaf (NameInfoConstPtr info, const SeqNo &seq)
|
||||
: Leaf (info, seq)
|
||||
, m_op (UPDATE)
|
||||
{
|
||||
}
|
||||
|
||||
DiffLeaf::DiffLeaf (NameInfoConstPtr info)
|
||||
: Leaf (info, SeqNo (0,0))
|
||||
, m_op (REMOVE)
|
||||
{
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
operator << (std::ostream &os, Operation op)
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case UPDATE:
|
||||
os << "update";
|
||||
break;
|
||||
case REMOVE:
|
||||
os << "remove";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
std::istream &
|
||||
operator >> (std::istream &is, Operation &op)
|
||||
{
|
||||
std::string operation;
|
||||
is >> operation;
|
||||
if (operation == "update")
|
||||
op = UPDATE;
|
||||
else if (operation == "remove")
|
||||
op = REMOVE;
|
||||
else
|
||||
BOOST_THROW_EXCEPTION (SyncDiffLeafOperationParseError () << errmsg_info (operation));
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_DIFF_LEAF_H
|
||||
#define SYNC_DIFF_LEAF_H
|
||||
|
||||
#include "sync-leaf.h"
|
||||
#include <boost/exception/all.hpp>
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/**
|
||||
* @ingroup sync
|
||||
* @brief Annotation for SYNC leaf
|
||||
*/
|
||||
enum Operation
|
||||
{
|
||||
UPDATE, ///< @brief Leaf was added or updated
|
||||
REMOVE ///< @brief Leaf was removed
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup sync
|
||||
* @brief Annotated SYNC leaf
|
||||
*/
|
||||
class DiffLeaf : public Leaf
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor to create an UPDATE diff leaf
|
||||
* @param info Smart pointer to leaf's name
|
||||
* @param seq Initial sequence number of the pointer
|
||||
*/
|
||||
DiffLeaf (NameInfoConstPtr info, const SeqNo &seq);
|
||||
|
||||
/**
|
||||
* @brief Constructor to create an REMOVE diff leaf
|
||||
* @param info Smart pointer to leaf's name
|
||||
*
|
||||
* This constructor creates a leaf with phony sequence number
|
||||
* with 0 session ID and 0 sequence number
|
||||
*/
|
||||
DiffLeaf (NameInfoConstPtr info);
|
||||
|
||||
virtual ~DiffLeaf () { }
|
||||
|
||||
/**
|
||||
* @brief Get diff leaf type
|
||||
*/
|
||||
Operation
|
||||
getOperation () const { return m_op; }
|
||||
|
||||
private:
|
||||
Operation m_op;
|
||||
};
|
||||
|
||||
typedef shared_ptr<DiffLeaf> DiffLeafPtr;
|
||||
typedef shared_ptr<const DiffLeaf> DiffLeafConstPtr;
|
||||
|
||||
std::ostream &
|
||||
operator << (std::ostream &os, Operation op);
|
||||
|
||||
std::istream &
|
||||
operator >> (std::istream &is, Operation &op);
|
||||
|
||||
namespace Error {
|
||||
struct SyncDiffLeafOperationParseError : virtual boost::exception, virtual std::exception { };
|
||||
} // Error
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_DIFF_LEAF_H
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_DIFF_STATE_CONTAINER_H
|
||||
#define SYNC_DIFF_STATE_CONTAINER_H
|
||||
|
||||
#include "sync-diff-state.h"
|
||||
#include "sync-digest.h"
|
||||
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
// #include <boost/multi_index/ordered_index.hpp>
|
||||
// #include <boost/multi_index/composite_key.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
// #include <boost/multi_index/random_access_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/mem_fun.hpp>
|
||||
|
||||
namespace mi = boost::multi_index;
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/// @cond include_hidden
|
||||
struct sequenced { };
|
||||
struct timed { };
|
||||
/// @endcond
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief Container for differential states
|
||||
*/
|
||||
struct DiffStateContainer : public mi::multi_index_container<
|
||||
DiffStatePtr,
|
||||
mi::indexed_by<
|
||||
// For fast access to elements using DiffState hashes
|
||||
mi::hashed_unique<
|
||||
mi::tag<hashed>,
|
||||
mi::const_mem_fun<DiffState, DigestConstPtr, &DiffState::getDigest>,
|
||||
DigestPtrHash,
|
||||
DigestPtrEqual
|
||||
>
|
||||
,
|
||||
// sequenced index to access older/newer element (like in list)
|
||||
mi::sequenced<mi::tag<sequenced> >
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_DIFF_STATE_CONTAINER_H
|
||||
@@ -1,98 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-diff-state.h"
|
||||
#include "sync-diff-leaf.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace Sync {
|
||||
|
||||
DiffState::DiffState ()
|
||||
{
|
||||
}
|
||||
|
||||
DiffState::~DiffState ()
|
||||
{
|
||||
}
|
||||
|
||||
DiffStatePtr
|
||||
DiffState::diff () const
|
||||
{
|
||||
DiffStatePtr ret = make_shared<DiffState> ();
|
||||
|
||||
DiffStatePtr state = m_next;
|
||||
while (state != 0)
|
||||
{
|
||||
*ret += *state;
|
||||
state = state->m_next;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
DiffState &
|
||||
DiffState::operator += (const DiffState &state)
|
||||
{
|
||||
BOOST_FOREACH (LeafConstPtr _leaf, state.getLeaves ())
|
||||
{
|
||||
DiffLeafConstPtr leaf = dynamic_pointer_cast<const DiffLeaf> (_leaf);
|
||||
BOOST_ASSERT (leaf != 0);
|
||||
|
||||
if (leaf->getOperation () == UPDATE)
|
||||
update (leaf->getInfo (), leaf->getSeq ());
|
||||
else if (leaf->getOperation () == REMOVE)
|
||||
remove (leaf->getInfo ());
|
||||
else
|
||||
{
|
||||
BOOST_ASSERT (false);
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// from State
|
||||
tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
|
||||
DiffState::update (NameInfoConstPtr info, const SeqNo &seq)
|
||||
{
|
||||
m_leaves.erase (info);
|
||||
|
||||
DiffLeafPtr leaf = make_shared<DiffLeaf> (info, seq);
|
||||
m_leaves.insert (leaf);
|
||||
|
||||
return make_tuple (true, false, SeqNo ());
|
||||
}
|
||||
|
||||
bool
|
||||
DiffState::remove (NameInfoConstPtr info)
|
||||
{
|
||||
m_leaves.erase (info);
|
||||
|
||||
DiffLeafPtr leaf = make_shared<DiffLeaf> (info);
|
||||
m_leaves.insert (leaf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // ns3
|
||||
@@ -1,102 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_DIFF_STATE_H
|
||||
#define SYNC_DIFF_STATE_H
|
||||
|
||||
#include "sync-state.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace Sync {
|
||||
|
||||
class DiffState;
|
||||
typedef shared_ptr<DiffState> DiffStatePtr;
|
||||
typedef shared_ptr<DiffState> DiffStateConstPtr;
|
||||
|
||||
/**
|
||||
* @ingroup ccnx
|
||||
* @brief Differential SYNC state
|
||||
*/
|
||||
class DiffState : public State
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @see Default constructor
|
||||
*/
|
||||
DiffState ();
|
||||
virtual ~DiffState ();
|
||||
|
||||
/**
|
||||
* @brief Set successor for the diff state
|
||||
* @param next successor state
|
||||
*/
|
||||
void
|
||||
setNext (DiffStatePtr next)
|
||||
{
|
||||
m_next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set digest for the diff state (obtained from a corresponding full state)
|
||||
* @param digest A read only smart pointer to a digest object (that should be unmodified anywhere else)
|
||||
*/
|
||||
void
|
||||
setDigest (DigestConstPtr digest) { m_digest = digest; }
|
||||
|
||||
/**
|
||||
* @brief Get digest for the diff state
|
||||
*/
|
||||
DigestConstPtr
|
||||
getDigest () const { return m_digest; }
|
||||
|
||||
/**
|
||||
* @brief Accumulate differences from `this' state to the most current state
|
||||
* @returns Accumulated differences from `this' state to the most current state
|
||||
*/
|
||||
DiffStatePtr
|
||||
diff () const;
|
||||
|
||||
/**
|
||||
* @brief Combine differences from `this' and `state'
|
||||
* @param state Differential state to combine with
|
||||
* @return Combined differences
|
||||
*
|
||||
* In case of collisions, `this' leaf will be replaced with the leaf of `state'
|
||||
*/
|
||||
DiffState&
|
||||
operator += (const DiffState &state);
|
||||
|
||||
// from State
|
||||
virtual tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
|
||||
update (NameInfoConstPtr info, const SeqNo &seq);
|
||||
|
||||
virtual bool
|
||||
remove (NameInfoConstPtr info);
|
||||
|
||||
private:
|
||||
DiffStatePtr m_next;
|
||||
DigestConstPtr m_digest;
|
||||
};
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_DIFF_STATE_H
|
||||
@@ -1,262 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-digest.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str;
|
||||
typedef boost::error_info<struct tag_errmsg, int> errmsg_info_int;
|
||||
|
||||
// for printing, may be disabled in optimized build
|
||||
|
||||
// #ifdef DIGEST_BASE64
|
||||
// #include <boost/archive/iterators/base64_from_binary.hpp>
|
||||
// #include <boost/archive/iterators/binary_from_base64.hpp>
|
||||
// #endif
|
||||
|
||||
#include "boost-archive.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace boost::archive::iterators;
|
||||
using namespace std;
|
||||
|
||||
// Other options: VP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_sha256, EVP_dss, EVP_dss1, EVP_mdc2, EVP_ripemd160
|
||||
#define HASH_FUNCTION EVP_sha256
|
||||
#define HASH_FUNCTION_LEN 32
|
||||
|
||||
|
||||
// #ifndef DIGEST_BASE64
|
||||
|
||||
template<class CharType>
|
||||
struct hex_from_4_bit
|
||||
{
|
||||
typedef CharType result_type;
|
||||
CharType operator () (CharType ch) const
|
||||
{
|
||||
const char *lookup_table = "0123456789abcdef";
|
||||
// cout << "New character: " << (int) ch << " (" << (char) ch << ")" << "\n";
|
||||
BOOST_ASSERT (ch < 16);
|
||||
return lookup_table[static_cast<size_t>(ch)];
|
||||
}
|
||||
};
|
||||
|
||||
typedef transform_iterator<hex_from_4_bit<std::vector<uint8_t>::const_iterator::value_type>,
|
||||
transform_width<std::vector<uint8_t>::const_iterator, 4, 8, std::vector<uint8_t>::const_iterator::value_type> > string_from_binary;
|
||||
|
||||
|
||||
template<class CharType>
|
||||
struct hex_to_4_bit
|
||||
{
|
||||
typedef CharType result_type;
|
||||
CharType operator () (CharType ch) const
|
||||
{
|
||||
const signed char lookup_table [] = {
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1,
|
||||
-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
};
|
||||
|
||||
// cout << "New character: " << hex << (int) ch << " (" << (char) ch << ")" << "\n";
|
||||
signed char value = -1;
|
||||
if ((unsigned)ch < 128)
|
||||
value = lookup_table [(unsigned)ch];
|
||||
if (value == -1)
|
||||
BOOST_THROW_EXCEPTION (Sync::Error::DigestCalculationError () << errmsg_info_int ((int)ch));
|
||||
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
typedef transform_width<transform_iterator<hex_to_4_bit<string::const_iterator::value_type>, string::const_iterator>, 8, 4> string_to_binary;
|
||||
|
||||
namespace Sync {
|
||||
|
||||
Digest::Digest ()
|
||||
{
|
||||
m_context = EVP_MD_CTX_create ();
|
||||
|
||||
reset ();
|
||||
}
|
||||
|
||||
Digest::~Digest ()
|
||||
{
|
||||
EVP_MD_CTX_destroy (m_context);
|
||||
}
|
||||
|
||||
bool
|
||||
Digest::empty () const
|
||||
{
|
||||
return m_buffer.empty ();
|
||||
}
|
||||
|
||||
bool
|
||||
Digest::isZero () const
|
||||
{
|
||||
if (m_buffer.empty ())
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Digest has not been yet finalized"));
|
||||
|
||||
return (m_buffer.size () == 1 && m_buffer[0] == 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Digest::reset ()
|
||||
{
|
||||
m_buffer.clear ();
|
||||
|
||||
int ok = EVP_DigestInit_ex (m_context, HASH_FUNCTION (), 0);
|
||||
if (!ok)
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("EVP_DigestInit_ex returned error")
|
||||
<< errmsg_info_int (ok));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Digest::finalize ()
|
||||
{
|
||||
if (!m_buffer.empty ()) return;
|
||||
|
||||
m_buffer.resize (HASH_FUNCTION_LEN);
|
||||
|
||||
unsigned int tmp;
|
||||
int ok = EVP_DigestFinal_ex (m_context,
|
||||
&m_buffer[0], &tmp);
|
||||
if (!ok)
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("EVP_DigestFinal_ex returned error")
|
||||
<< errmsg_info_int (ok));
|
||||
}
|
||||
|
||||
std::size_t
|
||||
Digest::getHash () const
|
||||
{
|
||||
if (isZero ()) return 0;
|
||||
|
||||
if (sizeof (std::size_t) > m_buffer.size ())
|
||||
{
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Hash is not zero and length is less than size_t")
|
||||
<< errmsg_info_int (m_buffer.size ()));
|
||||
}
|
||||
|
||||
// just getting first sizeof(std::size_t) bytes
|
||||
// not ideal, but should work pretty well
|
||||
return *(reinterpret_cast<const std::size_t*> (&m_buffer[0]));
|
||||
}
|
||||
|
||||
bool
|
||||
Digest::operator == (const Digest &digest) const
|
||||
{
|
||||
if (m_buffer.empty ())
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Digest1 is empty"));
|
||||
|
||||
if (digest.m_buffer.empty ())
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Digest2 is empty"));
|
||||
|
||||
return m_buffer == digest.m_buffer;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Digest::update (const uint8_t *buffer, size_t size)
|
||||
{
|
||||
// cout << "Update: " << (void*)buffer << " / size: " << size << "\n";
|
||||
|
||||
// cannot update Digest when it has been finalized
|
||||
if (!m_buffer.empty ())
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Digest has been already finalized"));
|
||||
|
||||
bool ok = EVP_DigestUpdate (m_context, buffer, size);
|
||||
if (!ok)
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("EVP_DigestUpdate returned error")
|
||||
<< errmsg_info_int (ok));
|
||||
}
|
||||
|
||||
|
||||
Digest &
|
||||
Digest::operator << (const Digest &src)
|
||||
{
|
||||
if (src.m_buffer.empty ())
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Digest has not been yet finalized"));
|
||||
|
||||
update (&src.m_buffer[0], src.m_buffer.size ());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
operator << (std::ostream &os, const Digest &digest)
|
||||
{
|
||||
BOOST_ASSERT (!digest.m_buffer.empty ());
|
||||
|
||||
ostreambuf_iterator<char> out_it (os); // ostream iterator
|
||||
// need to encode to base64
|
||||
copy (string_from_binary (digest.m_buffer.begin ()),
|
||||
string_from_binary (digest.m_buffer.end ()),
|
||||
out_it);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
std::istream &
|
||||
operator >> (std::istream &is, Digest &digest)
|
||||
{
|
||||
string str;
|
||||
is >> str; // read string first
|
||||
|
||||
if (str.size () == 0)
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Input is empty"));
|
||||
|
||||
// uint8_t padding = (3 - str.size () % 3) % 3;
|
||||
// for (uint8_t i = 0; i < padding; i++) str.push_back ('=');
|
||||
|
||||
// only empty digest object can be used for reading
|
||||
if (!digest.m_buffer.empty ())
|
||||
BOOST_THROW_EXCEPTION (Error::DigestCalculationError ()
|
||||
<< errmsg_info_str ("Digest has been already finalized"));
|
||||
|
||||
digest.m_buffer.clear ();
|
||||
|
||||
copy (string_to_binary (str.begin ()),
|
||||
string_to_binary (str.end ()),
|
||||
std::back_inserter (digest.m_buffer));
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
} // Sync
|
||||
@@ -1,199 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_DIGEST_H
|
||||
#define SYNC_DIGEST_H
|
||||
|
||||
#include "sync-common.h"
|
||||
|
||||
#include <vector>
|
||||
#include "openssl.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/**
|
||||
* @ingroup sync
|
||||
* @brief A simple wrapper for libcrypto hash functions
|
||||
*/
|
||||
class Digest
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor. Will initialize internal libssl structures
|
||||
*/
|
||||
Digest ();
|
||||
|
||||
/**
|
||||
* @brief Check if digest is empty
|
||||
*/
|
||||
bool
|
||||
empty () const;
|
||||
|
||||
/**
|
||||
* @brief Reset digest to the initial state
|
||||
*/
|
||||
void
|
||||
reset ();
|
||||
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~Digest ();
|
||||
|
||||
/**
|
||||
* @brief Obtain a short version of the hash (just first sizeof(size_t) bytes
|
||||
*
|
||||
* Side effect: finalize() will be called on `this'
|
||||
*/
|
||||
std::size_t
|
||||
getHash () const;
|
||||
|
||||
/**
|
||||
* @brief Finalize digest. All subsequent calls to "operator <<" will fire an exception
|
||||
*/
|
||||
void
|
||||
finalize ();
|
||||
|
||||
/**
|
||||
* @brief Compare two full digests
|
||||
*
|
||||
* Side effect: Finalize will be called on `this' and `digest'
|
||||
*/
|
||||
bool
|
||||
operator == (const Digest &digest) const;
|
||||
|
||||
bool
|
||||
operator != (const Digest &digest) const
|
||||
{ return ! (*this == digest); }
|
||||
|
||||
|
||||
/**
|
||||
* @brief Add existing digest to digest calculation
|
||||
* @param src digest to combine with
|
||||
*
|
||||
* The result of this combination is hash (hash (...))
|
||||
*/
|
||||
Digest &
|
||||
operator << (const Digest &src);
|
||||
|
||||
/**
|
||||
* @brief Add string to digest calculation
|
||||
* @param str string to put into digest
|
||||
*/
|
||||
inline Digest &
|
||||
operator << (const std::string &str);
|
||||
|
||||
/**
|
||||
* @brief Add uint64_t value to digest calculation
|
||||
* @param value uint64_t value to put into digest
|
||||
*/
|
||||
inline Digest &
|
||||
operator << (uint64_t value);
|
||||
|
||||
/**
|
||||
* @brief Checks if the stored hash is zero-root hash
|
||||
*
|
||||
* Zero-root hash is a valid hash that optimally represents an empty state
|
||||
*/
|
||||
bool
|
||||
isZero () const;
|
||||
|
||||
private:
|
||||
Digest &
|
||||
operator = (Digest &digest) { (void)digest; return *this; }
|
||||
|
||||
/**
|
||||
* @brief Add size bytes of buffer to the hash
|
||||
*/
|
||||
void
|
||||
update (const uint8_t *buffer, size_t size);
|
||||
|
||||
friend std::ostream &
|
||||
operator << (std::ostream &os, const Digest &digest);
|
||||
|
||||
friend std::istream &
|
||||
operator >> (std::istream &is, Digest &digest);
|
||||
|
||||
private:
|
||||
EVP_MD_CTX *m_context;
|
||||
std::vector<uint8_t> m_buffer;
|
||||
};
|
||||
|
||||
namespace Error {
|
||||
struct DigestCalculationError : virtual boost::exception, virtual std::exception { };
|
||||
}
|
||||
|
||||
typedef shared_ptr<Digest> DigestPtr;
|
||||
typedef shared_ptr<const Digest> DigestConstPtr;
|
||||
|
||||
Digest &
|
||||
Digest::operator << (const std::string &str)
|
||||
{
|
||||
update (reinterpret_cast<const uint8_t*> (str.c_str ()), str.size ());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Digest &
|
||||
Digest::operator << (uint64_t value)
|
||||
{
|
||||
update (reinterpret_cast<const uint8_t*> (&value), sizeof (uint64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
operator << (std::ostream &os, const Digest &digest);
|
||||
|
||||
std::istream &
|
||||
operator >> (std::istream &is, Digest &digest);
|
||||
|
||||
// template<class INT>
|
||||
// Digest &
|
||||
// Digest::operator << (INT value)
|
||||
// {
|
||||
// update (&value, sizeof (INT));
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
struct DigestPtrHash : public std::unary_function<Digest, std::size_t>
|
||||
{
|
||||
std::size_t
|
||||
operator() (DigestConstPtr digest) const
|
||||
{
|
||||
// std::cout << "digest->getHash: " << digest->getHash () << " (" << *digest << ")" << std::endl;
|
||||
return digest->getHash ();
|
||||
}
|
||||
};
|
||||
|
||||
struct DigestPtrEqual : public std::unary_function<Digest, std::size_t>
|
||||
{
|
||||
bool
|
||||
operator() (DigestConstPtr digest1, DigestConstPtr digest2) const
|
||||
{
|
||||
// std::cout << boost::cref(*digest1) << " == " << boost::cref(*digest2) << " : " << (*digest1 == *digest2) << std::endl;
|
||||
return *digest1 == *digest2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_DIGEST_H
|
||||
@@ -1,35 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_EVENT_H
|
||||
#define SYNC_EVENT_H
|
||||
|
||||
#include "sync-common.h"
|
||||
|
||||
namespace Sync
|
||||
{
|
||||
|
||||
typedef function< void ( ) > Event;
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_EVENT_H
|
||||
@@ -1,49 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-full-leaf.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
FullLeaf::FullLeaf (NameInfoConstPtr info, const SeqNo &seq)
|
||||
: Leaf (info, seq)
|
||||
{
|
||||
updateDigest ();
|
||||
}
|
||||
|
||||
void
|
||||
FullLeaf::updateDigest ()
|
||||
{
|
||||
m_digest.reset ();
|
||||
m_digest << getInfo ()->getDigest () << *getSeq ().getDigest ();
|
||||
m_digest.finalize ();
|
||||
}
|
||||
|
||||
// from Leaf
|
||||
void
|
||||
FullLeaf::setSeq (const SeqNo &seq)
|
||||
{
|
||||
Leaf::setSeq (seq);
|
||||
updateDigest ();
|
||||
}
|
||||
|
||||
} // Sync
|
||||
@@ -1,71 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_FULL_LEAF_H
|
||||
#define SYNC_FULL_LEAF_H
|
||||
|
||||
#include "sync-leaf.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/**
|
||||
* @ingroup sync
|
||||
* @brief SYNC leaf for the full state (with support of Digest calculation)
|
||||
*/
|
||||
class FullLeaf : public Leaf
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor to create an UPDATE diff leaf
|
||||
* @param info Smart pointer to leaf's name
|
||||
* @param seq Initial sequence number of the pointer
|
||||
*/
|
||||
FullLeaf (NameInfoConstPtr info, const SeqNo &seq);
|
||||
virtual ~FullLeaf () { }
|
||||
|
||||
/**
|
||||
* @brief Get hash digest of the leaf
|
||||
*
|
||||
* The underlying Digest object is recalculated on every update or removal
|
||||
* (including updates of child classes)
|
||||
*/
|
||||
const Digest &
|
||||
getDigest () const { return m_digest; }
|
||||
|
||||
// from Leaf
|
||||
virtual void
|
||||
setSeq (const SeqNo &seq);
|
||||
|
||||
private:
|
||||
void
|
||||
updateDigest ();
|
||||
|
||||
private:
|
||||
Digest m_digest;
|
||||
};
|
||||
|
||||
typedef shared_ptr<FullLeaf> FullLeafPtr;
|
||||
typedef shared_ptr<const FullLeaf> FullLeafConstPtr;
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_FULL_LEAF_H
|
||||
@@ -1,118 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-full-state.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include "sync-full-leaf.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
|
||||
FullState::FullState ()
|
||||
// m_lastUpdated is initialized to "not_a_date_time" in normal lib mode and to "0" time in NS-3 mode
|
||||
{
|
||||
}
|
||||
|
||||
FullState::~FullState ()
|
||||
{
|
||||
}
|
||||
|
||||
ndn::time::system_clock::Duration
|
||||
FullState::getTimeFromLastUpdate () const
|
||||
{
|
||||
return ndn::time::system_clock::now() - m_lastUpdated;
|
||||
}
|
||||
|
||||
DigestConstPtr
|
||||
FullState::getDigest ()
|
||||
{
|
||||
if (!m_digest)
|
||||
{
|
||||
m_digest = make_shared<Digest> ();
|
||||
if (m_leaves.get<ordered> ().size () > 0)
|
||||
{
|
||||
for (LeafConstPtr leaf : m_leaves.get<ordered> ())
|
||||
{
|
||||
FullLeafConstPtr fullLeaf = dynamic_pointer_cast<const FullLeaf> (leaf);
|
||||
BOOST_ASSERT (fullLeaf != 0);
|
||||
*m_digest << fullLeaf->getDigest ();
|
||||
}
|
||||
m_digest->finalize ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::istringstream is ("00"); //zero state
|
||||
is >> *m_digest;
|
||||
}
|
||||
}
|
||||
|
||||
return m_digest;
|
||||
}
|
||||
|
||||
// from State
|
||||
tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
|
||||
FullState::update (NameInfoConstPtr info, const SeqNo &seq)
|
||||
{
|
||||
m_lastUpdated = ndn::time::system_clock::now();
|
||||
|
||||
|
||||
m_digest.reset ();
|
||||
|
||||
LeafContainer::iterator item = m_leaves.find (info);
|
||||
if (item == m_leaves.end ())
|
||||
{
|
||||
m_leaves.insert (make_shared<FullLeaf> (info, seq));
|
||||
return make_tuple (true, false, SeqNo ());
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*item)->getSeq () == seq || seq < (*item)->getSeq ())
|
||||
{
|
||||
return make_tuple (false, false, SeqNo ());
|
||||
}
|
||||
|
||||
SeqNo old = (*item)->getSeq ();
|
||||
m_leaves.modify (item, [&seq](LeafPtr data){ data->setSeq(seq); });
|
||||
return make_tuple (false, true, old);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
FullState::remove (NameInfoConstPtr info)
|
||||
{
|
||||
m_lastUpdated = ndn::time::system_clock::now();
|
||||
|
||||
m_digest.reset ();
|
||||
|
||||
LeafContainer::iterator item = m_leaves.find (info);
|
||||
if (item != m_leaves.end ())
|
||||
{
|
||||
m_leaves.erase (item);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} // Sync
|
||||
@@ -1,79 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_FULL_STATE_H
|
||||
#define SYNC_FULL_STATE_H
|
||||
|
||||
#include <ndn-cxx/util/time.hpp>
|
||||
#include "sync-state.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
class FullState;
|
||||
typedef shared_ptr<FullState> FullStatePtr;
|
||||
typedef shared_ptr<FullState> FullStateConstPtr;
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief Cumulative SYNC state
|
||||
*/
|
||||
class FullState : public State
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Default constructor
|
||||
*/
|
||||
FullState ();
|
||||
virtual ~FullState ();
|
||||
|
||||
/**
|
||||
* @brief Get time period since last state update
|
||||
*
|
||||
* This value can be used to randomize reconciliation waiting time in SyncApp
|
||||
*/
|
||||
ndn::time::system_clock::Duration
|
||||
getTimeFromLastUpdate () const;
|
||||
|
||||
/**
|
||||
* @brief Obtain a read-only copy of the digest
|
||||
*
|
||||
* If m_digest is 0, then it is automatically created. On every update and removal, m_digest is reset to 0
|
||||
*/
|
||||
DigestConstPtr
|
||||
getDigest ();
|
||||
|
||||
// from State
|
||||
virtual tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
|
||||
update (NameInfoConstPtr info, const SeqNo &seq);
|
||||
|
||||
virtual bool
|
||||
remove (NameInfoConstPtr info);
|
||||
|
||||
private:
|
||||
ndn::time::system_clock::TimePoint m_lastUpdated; ///< @brief Time when state was updated last time
|
||||
DigestPtr m_digest;
|
||||
};
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_STATE_H
|
||||
@@ -1,99 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_INTEREST_CONTAINER_H
|
||||
#define SYNC_INTEREST_CONTAINER_H
|
||||
|
||||
#include <ndn-cxx/util/time.hpp>
|
||||
|
||||
#include "sync-digest.h"
|
||||
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
// #include <boost/multi_index/ordered_index.hpp>
|
||||
// #include <boost/multi_index/composite_key.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
// #include <boost/multi_index/random_access_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/mem_fun.hpp>
|
||||
|
||||
namespace mi = boost::multi_index;
|
||||
|
||||
namespace Sync {
|
||||
|
||||
struct Interest
|
||||
{
|
||||
Interest (DigestConstPtr digest, const std::string &name, bool unknown=false)
|
||||
: m_digest (digest)
|
||||
, m_name (name)
|
||||
, m_time (ndn::time::system_clock::now())
|
||||
, m_unknown (unknown)
|
||||
{
|
||||
}
|
||||
|
||||
DigestConstPtr m_digest;
|
||||
std::string m_name;
|
||||
ndn::time::system_clock::TimePoint m_time;
|
||||
bool m_unknown;
|
||||
};
|
||||
|
||||
/// @cond include_hidden
|
||||
struct named { };
|
||||
struct hashed;
|
||||
struct timed;
|
||||
/// @endcond
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief Container for interests (application PIT)
|
||||
*/
|
||||
struct InterestContainer : public mi::multi_index_container<
|
||||
Interest,
|
||||
mi::indexed_by<
|
||||
mi::hashed_unique<
|
||||
mi::tag<named>,
|
||||
BOOST_MULTI_INDEX_MEMBER(Interest, std::string, m_name)
|
||||
>
|
||||
,
|
||||
|
||||
mi::hashed_non_unique<
|
||||
mi::tag<hashed>,
|
||||
BOOST_MULTI_INDEX_MEMBER(Interest, DigestConstPtr, m_digest),
|
||||
DigestPtrHash,
|
||||
DigestPtrEqual
|
||||
>
|
||||
,
|
||||
|
||||
mi::ordered_non_unique<
|
||||
mi::tag<timed>,
|
||||
BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::system_clock::TimePoint, m_time)
|
||||
>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_INTEREST_CONTAINER_H
|
||||
@@ -1,126 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-interest-table.h"
|
||||
#include "sync-logging.h"
|
||||
using namespace std;
|
||||
|
||||
INIT_LOGGER("SyncInterestTable");
|
||||
|
||||
namespace Sync
|
||||
{
|
||||
|
||||
SyncInterestTable::SyncInterestTable(boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime)
|
||||
: m_entryLifetime(lifetime)
|
||||
, m_scheduler(io)
|
||||
{
|
||||
m_scheduler.scheduleEvent(ndn::time::seconds(4),
|
||||
ndn::bind(&SyncInterestTable::expireInterests, this));
|
||||
}
|
||||
|
||||
SyncInterestTable::~SyncInterestTable()
|
||||
{
|
||||
}
|
||||
|
||||
Interest
|
||||
SyncInterestTable::pop()
|
||||
{
|
||||
if (m_table.size() == 0)
|
||||
BOOST_THROW_EXCEPTION(Error::InterestTableIsEmpty());
|
||||
|
||||
Interest ret = *m_table.begin();
|
||||
m_table.erase(m_table.begin());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
SyncInterestTable::insert(DigestConstPtr digest, const string &name, bool unknownState/*=false*/)
|
||||
{
|
||||
bool existent = false;
|
||||
|
||||
InterestContainer::index<named>::type::iterator it = m_table.get<named>().find(name);
|
||||
if (it != m_table.end())
|
||||
{
|
||||
existent = true;
|
||||
m_table.erase(it);
|
||||
}
|
||||
m_table.insert(Interest(digest, name, unknownState));
|
||||
|
||||
return existent;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SyncInterestTable::size() const
|
||||
{
|
||||
return m_table.size();
|
||||
}
|
||||
|
||||
bool
|
||||
SyncInterestTable::remove(const string &name)
|
||||
{
|
||||
InterestContainer::index<named>::type::iterator item = m_table.get<named>().find(name);
|
||||
if (item != m_table.get<named>().end())
|
||||
{
|
||||
m_table.get<named>().erase(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
SyncInterestTable::remove(DigestConstPtr digest)
|
||||
{
|
||||
InterestContainer::index<hashed>::type::iterator item = m_table.get<hashed>().find(digest);
|
||||
if (item != m_table.get<hashed>().end())
|
||||
{
|
||||
m_table.get<hashed>().erase(digest); // erase all records associated with the digest
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SyncInterestTable::expireInterests()
|
||||
{
|
||||
uint32_t count = 0;
|
||||
ndn::time::system_clock::TimePoint expireTime = ndn::time::system_clock::now() - m_entryLifetime;
|
||||
|
||||
while (m_table.size() > 0)
|
||||
{
|
||||
InterestContainer::index<timed>::type::iterator item = m_table.get<timed>().begin();
|
||||
|
||||
if (item->m_time <= expireTime)
|
||||
{
|
||||
m_table.get<timed>().erase(item);
|
||||
count ++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
m_scheduler.scheduleEvent(ndn::time::seconds(4),
|
||||
ndn::bind(&SyncInterestTable::expireInterests, this));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_INTEREST_TABLE_H
|
||||
#define SYNC_INTEREST_TABLE_H
|
||||
|
||||
#include <ndn-cxx/util/scheduler.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "sync-digest.h"
|
||||
#include "sync-interest-container.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief A table to keep unanswered Sync Interest
|
||||
* all access operation to the table should grab the
|
||||
* mutex first
|
||||
*/
|
||||
class SyncInterestTable
|
||||
{
|
||||
public:
|
||||
SyncInterestTable (boost::asio::io_service& io, ndn::time::system_clock::Duration lifetime);
|
||||
~SyncInterestTable ();
|
||||
|
||||
/**
|
||||
* @brief Insert an interest, if interest already exists, update the
|
||||
* timestamp
|
||||
*/
|
||||
bool
|
||||
insert (DigestConstPtr interest, const std::string &name, bool unknownState=false);
|
||||
|
||||
/**
|
||||
* @brief Remove interest by digest (e.g., when it was satisfied)
|
||||
*/
|
||||
bool
|
||||
remove (DigestConstPtr interest);
|
||||
|
||||
/**
|
||||
* @brief Remove interest by name (e.g., when it was satisfied)
|
||||
*/
|
||||
bool
|
||||
remove (const std::string &name);
|
||||
|
||||
/**
|
||||
* @brief pop a non-expired Interest from PIT
|
||||
*/
|
||||
Interest
|
||||
pop ();
|
||||
|
||||
uint32_t
|
||||
size () const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief periodically called to expire Interest
|
||||
*/
|
||||
void
|
||||
expireInterests ();
|
||||
|
||||
private:
|
||||
ndn::time::system_clock::Duration m_entryLifetime;
|
||||
InterestContainer m_table;
|
||||
|
||||
ndn::Scheduler m_scheduler;
|
||||
};
|
||||
|
||||
namespace Error {
|
||||
struct InterestTableIsEmpty : virtual boost::exception, virtual std::exception { };
|
||||
}
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_INTEREST_TABLE_H
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-leaf.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
Leaf::Leaf (NameInfoConstPtr info, const SeqNo &seq)
|
||||
: m_info (info)
|
||||
, m_seq (seq)
|
||||
{
|
||||
}
|
||||
|
||||
Leaf::~Leaf ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Leaf::setSeq (const SeqNo &seq)
|
||||
{
|
||||
m_seq = std::max (m_seq, seq);
|
||||
}
|
||||
|
||||
} // Sync
|
||||
@@ -1,84 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_LEAF_H
|
||||
#define SYNC_LEAF_H
|
||||
|
||||
#include "sync-seq-no.h"
|
||||
#include "sync-name-info.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief Sync tree leaf
|
||||
*/
|
||||
class Leaf
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param info Smart pointer to leaf's name
|
||||
* @param seq Initial sequence number of the pointer
|
||||
*/
|
||||
Leaf (NameInfoConstPtr info, const SeqNo &seq);
|
||||
virtual ~Leaf ();
|
||||
|
||||
/**
|
||||
* @brief Get name of the leaf
|
||||
*/
|
||||
NameInfoConstPtr
|
||||
getInfo () const { return m_info; }
|
||||
|
||||
/**
|
||||
* @brief Get sequence number of the leaf
|
||||
*/
|
||||
const SeqNo&
|
||||
getSeq () const { return m_seq; }
|
||||
|
||||
/**
|
||||
* @brief Update sequence number of the leaf
|
||||
* @param seq Sequence number
|
||||
*
|
||||
* Sequence number is updated to the largest value among this->m_seq and seq
|
||||
*/
|
||||
virtual void
|
||||
setSeq (const SeqNo &seq);
|
||||
|
||||
private:
|
||||
NameInfoConstPtr m_info;
|
||||
SeqNo m_seq;
|
||||
};
|
||||
|
||||
typedef shared_ptr<Leaf> LeafPtr;
|
||||
typedef shared_ptr<const Leaf> LeafConstPtr;
|
||||
|
||||
inline std::ostream &
|
||||
operator << (std::ostream &os, const Leaf &leaf)
|
||||
{
|
||||
os << *leaf.getInfo () << "(" << leaf.getSeq () << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_LEAF_H
|
||||
@@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-logging.h"
|
||||
|
||||
#ifdef HAVE_LOG4CXX
|
||||
|
||||
#include <log4cxx/logger.h>
|
||||
#include <log4cxx/basicconfigurator.h>
|
||||
#include <log4cxx/consoleappender.h>
|
||||
#include <log4cxx/patternlayout.h>
|
||||
#include <log4cxx/level.h>
|
||||
#include <log4cxx/propertyconfigurator.h>
|
||||
#include <log4cxx/defaultconfigurator.h>
|
||||
#include <log4cxx/helpers/exception.h>
|
||||
using namespace log4cxx;
|
||||
using namespace log4cxx::helpers;
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void
|
||||
INIT_LOGGERS ()
|
||||
{
|
||||
static bool configured = false;
|
||||
|
||||
if (configured) return;
|
||||
|
||||
if (access ("log4cxx.properties", R_OK)==0)
|
||||
PropertyConfigurator::configureAndWatch ("log4cxx.properties");
|
||||
else
|
||||
{
|
||||
PatternLayoutPtr layout (new PatternLayout ("%d{HH:mm:ss} %p %c{1} - %m%n"));
|
||||
ConsoleAppenderPtr appender (new ConsoleAppender (layout));
|
||||
|
||||
BasicConfigurator::configure( appender );
|
||||
Logger::getRootLogger()->setLevel (log4cxx::Level::getInfo ());
|
||||
}
|
||||
|
||||
configured = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_LOG_H
|
||||
#define SYNC_LOG_H
|
||||
|
||||
#ifdef HAVE_LOG4CXX
|
||||
|
||||
#include <log4cxx/logger.h>
|
||||
|
||||
#define INIT_LOGGER(name) \
|
||||
static log4cxx::LoggerPtr staticModuleLogger = log4cxx::Logger::getLogger (name)
|
||||
|
||||
#define _LOG_DEBUG(x) \
|
||||
LOG4CXX_DEBUG(staticModuleLogger, x);
|
||||
|
||||
#define _LOG_TRACE(x) \
|
||||
LOG4CXX_TRACE(staticModuleLogger, x);
|
||||
|
||||
#define _LOG_FUNCTION(x) \
|
||||
LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "(" << x << ")");
|
||||
|
||||
#define _LOG_FUNCTION_NOARGS \
|
||||
LOG4CXX_TRACE(staticModuleLogger, __FUNCTION__ << "()");
|
||||
|
||||
#define _LOG_ERROR(x) \
|
||||
LOG4CXX_ERROR(staticModuleLogger, x);
|
||||
|
||||
void
|
||||
INIT_LOGGERS ();
|
||||
|
||||
#else
|
||||
|
||||
#define INIT_LOGGER(name)
|
||||
#define _LOG_FUNCTION(x)
|
||||
#define _LOG_FUNCTION_NOARGS
|
||||
#define _LOG_TRACE(x)
|
||||
#define INIT_LOGGERS(x)
|
||||
#define _LOG_ERROR(x)
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#define _LOG_DEBUG(x) \
|
||||
std::clog << boost::get_system_time () << " " << boost::this_thread::get_id () << " " << x << endl;
|
||||
|
||||
#else
|
||||
#define _LOG_DEBUG(x)
|
||||
#endif
|
||||
|
||||
#endif // HAVE_LOG4CXX
|
||||
|
||||
#endif // SYNC_LOG_H
|
||||
@@ -1,84 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_LOGIC_EVENT_CONTAINER_H
|
||||
#define SYNC_LOGIC_EVENT_CONTAINER_H
|
||||
|
||||
#include "sync-event.h"
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
||||
#include <boost/multi_index_container.hpp>
|
||||
// #include <boost/multi_index/tag.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
// #include <boost/multi_index/composite_key.hpp>
|
||||
// #include <boost/multi_index/hashed_index.hpp>
|
||||
// #include <boost/multi_index/random_access_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
// #include <boost/multi_index/mem_fun.hpp>
|
||||
|
||||
namespace mi = boost::multi_index;
|
||||
|
||||
namespace Sync
|
||||
{
|
||||
|
||||
struct LogicEvent
|
||||
{
|
||||
LogicEvent (const boost::system_time &_time, Event _event, uint32_t _label)
|
||||
: time (_time)
|
||||
, event (_event)
|
||||
, lbl (_label)
|
||||
{ }
|
||||
|
||||
boost::system_time time;
|
||||
Event event;
|
||||
uint32_t lbl;
|
||||
};
|
||||
|
||||
/// @cond include_hidden
|
||||
struct byLabel { } ;
|
||||
/// @endcond
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief ???
|
||||
*/
|
||||
struct EventsContainer : public mi::multi_index_container<
|
||||
LogicEvent,
|
||||
mi::indexed_by<
|
||||
|
||||
mi::ordered_non_unique<
|
||||
mi::member<LogicEvent, boost::system_time, &LogicEvent::time>
|
||||
>,
|
||||
|
||||
mi::ordered_non_unique<
|
||||
mi::tag<byLabel>,
|
||||
mi::member<LogicEvent, uint32_t, &LogicEvent::lbl>
|
||||
>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_LOGIC_EVENT_CONTAINER_H
|
||||
@@ -1,750 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
* Yingdi Yu <yingdi@cs.ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-logic.h"
|
||||
#include "sync-diff-leaf.h"
|
||||
#include "sync-full-leaf.h"
|
||||
#include "sync-logging.h"
|
||||
#include "sync-state.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
using ndn::Data;
|
||||
using ndn::EventId;
|
||||
using ndn::KeyChain;
|
||||
using ndn::Face;
|
||||
using ndn::Name;
|
||||
using ndn::OnDataValidated;
|
||||
using ndn::OnDataValidationFailed;
|
||||
using ndn::Validator;
|
||||
|
||||
INIT_LOGGER ("SyncLogic");
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define _LOG_DEBUG_ID(v) _LOG_DEBUG(m_instanceId << " " << v)
|
||||
#else
|
||||
#define _LOG_DEBUG_ID(v) _LOG_DEBUG(v)
|
||||
#endif
|
||||
|
||||
#define GET_RANDOM(var) var ()
|
||||
|
||||
#define TIME_SECONDS_WITH_JITTER(sec) \
|
||||
(ndn::time::seconds(sec) + ndn::time::milliseconds(GET_RANDOM (m_reexpressionJitter)))
|
||||
|
||||
#define TIME_MILLISECONDS_WITH_JITTER(ms) \
|
||||
(ndn::time::seconds(ms) + ndn::time::milliseconds(GET_RANDOM (m_reexpressionJitter)))
|
||||
|
||||
namespace Sync {
|
||||
|
||||
using ndn::shared_ptr;
|
||||
|
||||
int SyncLogic::m_instanceCounter = 0;
|
||||
|
||||
const int SyncLogic::m_syncResponseFreshness = 1000; // MUST BE dividable by 1000!!!
|
||||
const int SyncLogic::m_syncInterestReexpress = 4; // seconds
|
||||
|
||||
SyncLogic::SyncLogic (const Name& syncPrefix,
|
||||
shared_ptr<Validator> validator,
|
||||
shared_ptr<Face> face,
|
||||
LogicUpdateCallback onUpdate,
|
||||
LogicRemoveCallback onRemove)
|
||||
: m_state (new FullState)
|
||||
, m_syncInterestTable (face->getIoService(), ndn::time::seconds(m_syncInterestReexpress))
|
||||
, m_syncPrefix (syncPrefix)
|
||||
, m_onUpdate (onUpdate)
|
||||
, m_onRemove (onRemove)
|
||||
, m_perBranch (false)
|
||||
, m_validator(validator)
|
||||
, m_keyChain(new KeyChain())
|
||||
, m_face(face)
|
||||
, m_scheduler(face->getIoService())
|
||||
, m_randomGenerator (static_cast<unsigned int> (std::time (0)))
|
||||
, m_rangeUniformRandom (m_randomGenerator, boost::uniform_int<> (200,1000))
|
||||
, m_reexpressionJitter (m_randomGenerator, boost::uniform_int<> (100,500))
|
||||
, m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
|
||||
{
|
||||
m_syncRegisteredPrefixId = m_face->setInterestFilter (m_syncPrefix,
|
||||
bind(&SyncLogic::onSyncInterest,
|
||||
this, _1, _2),
|
||||
bind(&SyncLogic::onSyncRegisterSucceed,
|
||||
this, _1),
|
||||
bind(&SyncLogic::onSyncRegisterFailed,
|
||||
this, _1, _2));
|
||||
|
||||
|
||||
m_reexpressingInterestId = m_scheduler.scheduleEvent (ndn::time::seconds (0),
|
||||
bind (&SyncLogic::sendSyncInterest, this));
|
||||
|
||||
m_instanceId = string("Instance " + boost::lexical_cast<string>(m_instanceCounter++) + " ");
|
||||
}
|
||||
|
||||
SyncLogic::SyncLogic (const Name& syncPrefix,
|
||||
shared_ptr<Validator> validator,
|
||||
shared_ptr<Face> face,
|
||||
LogicPerBranchCallback onUpdateBranch)
|
||||
: m_state (new FullState)
|
||||
, m_syncInterestTable (face->getIoService(), ndn::time::seconds (m_syncInterestReexpress))
|
||||
, m_syncPrefix (syncPrefix)
|
||||
, m_onUpdateBranch (onUpdateBranch)
|
||||
, m_perBranch(true)
|
||||
, m_validator(validator)
|
||||
, m_keyChain(new KeyChain())
|
||||
, m_face(face)
|
||||
, m_scheduler(face->getIoService())
|
||||
, m_randomGenerator (static_cast<unsigned int> (std::time (0)))
|
||||
, m_rangeUniformRandom (m_randomGenerator, boost::uniform_int<> (200,1000))
|
||||
, m_reexpressionJitter (m_randomGenerator, boost::uniform_int<> (100,500))
|
||||
, m_recoveryRetransmissionInterval (m_defaultRecoveryRetransmitInterval)
|
||||
{
|
||||
m_syncRegisteredPrefixId = m_face->setInterestFilter (m_syncPrefix,
|
||||
bind(&SyncLogic::onSyncInterest,
|
||||
this, _1, _2),
|
||||
bind(&SyncLogic::onSyncRegisterSucceed,
|
||||
this, _1),
|
||||
bind(&SyncLogic::onSyncRegisterFailed,
|
||||
this, _1, _2));
|
||||
|
||||
m_reexpressingInterestId = m_scheduler.scheduleEvent (ndn::time::seconds (0),
|
||||
bind (&SyncLogic::sendSyncInterest, this));
|
||||
}
|
||||
|
||||
SyncLogic::~SyncLogic ()
|
||||
{
|
||||
m_face->unsetInterestFilter(m_syncRegisteredPrefixId);
|
||||
m_scheduler.cancelEvent (m_reexpressingInterestId);
|
||||
m_scheduler.cancelEvent (m_delayedInterestProcessingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Two types of intersts
|
||||
*
|
||||
* Normal name: .../<hash>
|
||||
* Recovery name: .../recovery/<hash>
|
||||
*/
|
||||
tuple<DigestConstPtr, std::string>
|
||||
SyncLogic::convertNameToDigestAndType (const Name &name)
|
||||
{
|
||||
BOOST_ASSERT (m_syncPrefix.isPrefixOf(name));
|
||||
|
||||
int nameLengthDiff = name.size() - m_syncPrefix.size();
|
||||
BOOST_ASSERT (nameLengthDiff > 0);
|
||||
BOOST_ASSERT (nameLengthDiff < 3);
|
||||
|
||||
string hash = name.get(-1).toUri();
|
||||
string interestType;
|
||||
|
||||
if(nameLengthDiff == 1)
|
||||
interestType = "normal";
|
||||
else
|
||||
interestType = name.get(-2).toUri();
|
||||
|
||||
_LOG_DEBUG_ID (hash << ", " << interestType);
|
||||
|
||||
DigestPtr digest = make_shared<Digest> ();
|
||||
istringstream is (hash);
|
||||
is >> *digest;
|
||||
|
||||
return make_tuple(digest, interestType);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncInterest (const Name& prefix, const ndn::Interest& interest)
|
||||
{
|
||||
Name name = interest.getName();
|
||||
|
||||
_LOG_DEBUG_ID("respondSyncInterest: " << name);
|
||||
|
||||
try
|
||||
{
|
||||
_LOG_DEBUG_ID ("<< I " << name);
|
||||
|
||||
DigestConstPtr digest;
|
||||
string type;
|
||||
tie (digest, type) = convertNameToDigestAndType (name);
|
||||
|
||||
if (type == "normal") // kind of ineffective...
|
||||
{
|
||||
processSyncInterest (name, digest);
|
||||
}
|
||||
else if (type == "recovery")
|
||||
{
|
||||
processSyncRecoveryInterest (name, digest);
|
||||
}
|
||||
}
|
||||
catch (Error::DigestCalculationError &e)
|
||||
{
|
||||
_LOG_DEBUG_ID ("Something fishy happened...");
|
||||
// log error. ignoring it for now, later we should log it
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncRegisterSucceed(const Name& prefix)
|
||||
{
|
||||
_LOG_DEBUG_ID("Sync prefix registration succeeded! " << prefix);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncRegisterFailed(const Name& prefix, const string& msg)
|
||||
{
|
||||
_LOG_DEBUG_ID("Sync prefix registration failed! " << msg);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncData(const ndn::Interest& interest, Data& data)
|
||||
{
|
||||
OnDataValidated onValidated = bind(&SyncLogic::onSyncDataValidated, this, _1);
|
||||
OnDataValidationFailed onValidationFailed = bind(&SyncLogic::onSyncDataValidationFailed, this, _1);
|
||||
m_validator->validate(data, onValidated, onValidationFailed);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncTimeout(const ndn::Interest& interest)
|
||||
{
|
||||
// It is OK. Others will handle the time out situation.
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncDataValidationFailed(const shared_ptr<const Data>& data)
|
||||
{
|
||||
_LOG_DEBUG_ID("Sync data cannot be verified!");
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::onSyncDataValidated(const shared_ptr<const Data>& data)
|
||||
{
|
||||
Name name = data->getName();
|
||||
const char* wireData = (const char*)data->getContent().value();
|
||||
size_t len = data->getContent().value_size();
|
||||
|
||||
try
|
||||
{
|
||||
_LOG_DEBUG_ID ("<< D " << name);
|
||||
|
||||
DigestConstPtr digest;
|
||||
string type;
|
||||
tie (digest, type) = convertNameToDigestAndType (name);
|
||||
|
||||
if (type == "normal")
|
||||
{
|
||||
processSyncData (name, digest, wireData, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
// timer is always restarted when we schedule recovery
|
||||
m_scheduler.cancelEvent (m_reexpressingRecoveryInterestId);
|
||||
processSyncData (name, digest, wireData, len);
|
||||
}
|
||||
}
|
||||
catch (Error::DigestCalculationError &e)
|
||||
{
|
||||
_LOG_DEBUG_ID ("Something fishy happened...");
|
||||
// log error. ignoring it for now, later we should log it
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::processSyncInterest (const Name &name, DigestConstPtr digest,
|
||||
bool timedProcessing/*=false*/)
|
||||
{
|
||||
_LOG_DEBUG_ID("processSyncInterest");
|
||||
DigestConstPtr rootDigest;
|
||||
{
|
||||
rootDigest = m_state->getDigest();
|
||||
}
|
||||
|
||||
// Special case when state is not empty and we have received request with zero-root digest
|
||||
if (digest->isZero () && !rootDigest->isZero ())
|
||||
{
|
||||
|
||||
SyncStateMsg ssm;
|
||||
{
|
||||
ssm << (*m_state);
|
||||
}
|
||||
sendSyncData (name, digest, ssm);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*rootDigest == *digest)
|
||||
{
|
||||
_LOG_DEBUG_ID ("processSyncInterest (): Same state. Adding to PIT");
|
||||
m_syncInterestTable.insert (digest, name.toUri(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
DiffStateContainer::iterator stateInDiffLog = m_log.find (digest);
|
||||
|
||||
if (stateInDiffLog != m_log.end ())
|
||||
{
|
||||
DiffStateConstPtr stateDiff = (*stateInDiffLog)->diff ();
|
||||
|
||||
sendSyncData (name, digest, stateDiff);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!timedProcessing)
|
||||
{
|
||||
bool exists = m_syncInterestTable.insert (digest, name.toUri(), true);
|
||||
if (exists) // somebody else replied, so restart random-game timer
|
||||
{
|
||||
_LOG_DEBUG_ID("Unknown digest, but somebody may have already replied, " <<
|
||||
"so restart our timer");
|
||||
m_scheduler.cancelEvent (m_delayedInterestProcessingId);
|
||||
}
|
||||
|
||||
uint32_t waitDelay = GET_RANDOM (m_rangeUniformRandom);
|
||||
_LOG_DEBUG_ID("Digest is not in the log. Schedule processing after small delay: " <<
|
||||
ndn::time::milliseconds (waitDelay));
|
||||
|
||||
m_delayedInterestProcessingId =
|
||||
m_scheduler.scheduleEvent(ndn::time::milliseconds (waitDelay),
|
||||
bind (&SyncLogic::processSyncInterest, this, name, digest, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG_DEBUG_ID(" (timed processing)");
|
||||
|
||||
m_recoveryRetransmissionInterval = m_defaultRecoveryRetransmitInterval;
|
||||
sendSyncRecoveryInterests (digest);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::processSyncData (const Name &name, DigestConstPtr digest,
|
||||
const char *wireData, size_t len)
|
||||
{
|
||||
DiffStatePtr diffLog = make_shared<DiffState> ();
|
||||
bool ownInterestSatisfied = false;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
m_syncInterestTable.remove (name.toUri()); // Remove satisfied interest from PIT
|
||||
|
||||
ownInterestSatisfied = (name == m_outstandingInterestName);
|
||||
|
||||
DiffState diff;
|
||||
SyncStateMsg msg;
|
||||
if (!msg.ParseFromArray(wireData, len) || !msg.IsInitialized())
|
||||
{
|
||||
//Throw
|
||||
BOOST_THROW_EXCEPTION (Error::SyncStateMsgDecodingFailure () );
|
||||
}
|
||||
msg >> diff;
|
||||
|
||||
vector<MissingDataInfo> v;
|
||||
BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
|
||||
{
|
||||
DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
|
||||
BOOST_ASSERT (diffLeaf != 0);
|
||||
|
||||
NameInfoConstPtr info = diffLeaf->getInfo();
|
||||
if (diffLeaf->getOperation() == UPDATE)
|
||||
{
|
||||
SeqNo seq = diffLeaf->getSeq();
|
||||
|
||||
bool inserted = false;
|
||||
bool updated = false;
|
||||
SeqNo oldSeq;
|
||||
{
|
||||
tie (inserted, updated, oldSeq) = m_state->update (info, seq);
|
||||
}
|
||||
|
||||
if (inserted || updated)
|
||||
{
|
||||
diffLog->update (info, seq);
|
||||
if (!oldSeq.isValid())
|
||||
{
|
||||
oldSeq = SeqNo(seq.getSession(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
++oldSeq;
|
||||
}
|
||||
// there is no need for application to process update on forwarder node
|
||||
if (info->toString() != forwarderPrefix)
|
||||
{
|
||||
MissingDataInfo mdi = {info->toString(), oldSeq, seq};
|
||||
{
|
||||
ostringstream interestName;
|
||||
interestName << mdi.prefix <<
|
||||
"/" << mdi.high.getSession() <<
|
||||
"/" << mdi.high.getSeq();
|
||||
_LOG_DEBUG_ID("+++++++++++++++ " + interestName.str());
|
||||
}
|
||||
if (m_perBranch)
|
||||
{
|
||||
ostringstream interestName;
|
||||
interestName << mdi.prefix <<
|
||||
"/" << mdi.high.getSession() <<
|
||||
"/" << mdi.high.getSeq();
|
||||
m_onUpdateBranch(interestName.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
v.push_back(mdi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (diffLeaf->getOperation() == REMOVE)
|
||||
{
|
||||
if (m_state->remove (info))
|
||||
{
|
||||
diffLog->remove (info);
|
||||
if (!m_perBranch)
|
||||
{
|
||||
m_onRemove (info->toString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!v.empty())
|
||||
{
|
||||
if (!m_perBranch)
|
||||
{
|
||||
m_onUpdate(v);
|
||||
}
|
||||
}
|
||||
|
||||
insertToDiffLog (diffLog);
|
||||
}
|
||||
catch (Error::SyncStateMsgDecodingFailure &e)
|
||||
{
|
||||
_LOG_DEBUG_ID ("Something really fishy happened during state decoding " <<
|
||||
diagnostic_information (e));
|
||||
diffLog.reset ();
|
||||
// don't do anything
|
||||
}
|
||||
|
||||
if ((diffLog != 0 && diffLog->getLeaves ().size () > 0) ||
|
||||
ownInterestSatisfied)
|
||||
{
|
||||
_LOG_DEBUG_ID(" +++++++++++++++ state changed!!!");
|
||||
// Do it only if everything went fine and state changed
|
||||
|
||||
// this is kind of wrong
|
||||
// satisfyPendingSyncInterests (diffLog); // if there are interests in PIT,
|
||||
// // there is a point to satisfy them using new state
|
||||
|
||||
// if state has changed, then it is safe to express a new interest
|
||||
ndn::time::system_clock::Duration after =
|
||||
ndn::time::milliseconds(GET_RANDOM (m_reexpressionJitter));
|
||||
// cout << "------------ reexpress interest after: " << after << endl;
|
||||
EventId eventId = m_scheduler.scheduleEvent (after,
|
||||
bind (&SyncLogic::sendSyncInterest, this));
|
||||
|
||||
m_scheduler.cancelEvent (m_reexpressingInterestId);
|
||||
m_reexpressingInterestId = eventId;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::processSyncRecoveryInterest (const Name &name, DigestConstPtr digest)
|
||||
{
|
||||
_LOG_DEBUG_ID("processSyncRecoveryInterest");
|
||||
DiffStateContainer::iterator stateInDiffLog = m_log.find (digest);
|
||||
|
||||
if (stateInDiffLog == m_log.end ())
|
||||
{
|
||||
_LOG_DEBUG_ID ("Could not find " << *digest << " in digest log");
|
||||
return;
|
||||
}
|
||||
|
||||
SyncStateMsg ssm;
|
||||
{
|
||||
ssm << (*m_state);
|
||||
}
|
||||
sendSyncData (name, digest, ssm);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::satisfyPendingSyncInterests (DiffStateConstPtr diffLog)
|
||||
{
|
||||
DiffStatePtr fullStateLog = make_shared<DiffState> ();
|
||||
{
|
||||
BOOST_FOREACH (LeafConstPtr leaf, m_state->getLeaves ()/*.get<timed> ()*/)
|
||||
{
|
||||
fullStateLog->update (leaf->getInfo (), leaf->getSeq ());
|
||||
/// @todo Impose limit on how many state info should be send out
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
uint32_t counter = 0;
|
||||
while (m_syncInterestTable.size () > 0)
|
||||
{
|
||||
Sync::Interest interest = m_syncInterestTable.pop ();
|
||||
|
||||
if (!interest.m_unknown)
|
||||
{
|
||||
_LOG_DEBUG_ID (">> D " << interest.m_name);
|
||||
sendSyncData (interest.m_name, interest.m_digest, diffLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG_DEBUG_ID (">> D (unknown)" << interest.m_name);
|
||||
sendSyncData (interest.m_name, interest.m_digest, fullStateLog);
|
||||
}
|
||||
counter ++;
|
||||
}
|
||||
_LOG_DEBUG_ID ("Satisfied " << counter << " pending interests");
|
||||
}
|
||||
catch (Error::InterestTableIsEmpty &e)
|
||||
{
|
||||
// ok. not really an error
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::insertToDiffLog (DiffStatePtr diffLog)
|
||||
{
|
||||
diffLog->setDigest (m_state->getDigest());
|
||||
if (m_log.size () > 0)
|
||||
{
|
||||
m_log.get<sequenced> ().front ()->setNext (diffLog);
|
||||
}
|
||||
m_log.erase (m_state->getDigest()); // remove diff state with the same digest.
|
||||
// next pointers are still valid
|
||||
/// @todo Optimization
|
||||
m_log.get<sequenced> ().push_front (diffLog);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::addLocalNames (const Name &prefix, uint64_t session, uint64_t seq)
|
||||
{
|
||||
DiffStatePtr diff;
|
||||
{
|
||||
//cout << "Add local names" <<endl;
|
||||
NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix.toUri());
|
||||
|
||||
_LOG_DEBUG_ID ("addLocalNames (): old state " << *m_state->getDigest ());
|
||||
|
||||
SeqNo seqN (session, seq);
|
||||
m_state->update(info, seqN);
|
||||
|
||||
_LOG_DEBUG_ID ("addLocalNames (): new state " << *m_state->getDigest ());
|
||||
|
||||
diff = make_shared<DiffState>();
|
||||
diff->update(info, seqN);
|
||||
insertToDiffLog (diff);
|
||||
}
|
||||
|
||||
// _LOG_DEBUG_ID ("PIT size: " << m_syncInterestTable.size ());
|
||||
satisfyPendingSyncInterests (diff);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::remove(const Name &prefix)
|
||||
{
|
||||
DiffStatePtr diff;
|
||||
{
|
||||
NameInfoConstPtr info = StdNameInfo::FindOrCreate(prefix.toUri());
|
||||
m_state->remove(info);
|
||||
|
||||
// increment the sequence number for the forwarder node
|
||||
NameInfoConstPtr forwarderInfo = StdNameInfo::FindOrCreate(forwarderPrefix);
|
||||
|
||||
LeafContainer::iterator item = m_state->getLeaves ().find (forwarderInfo);
|
||||
SeqNo seqNo (0);
|
||||
if (item != m_state->getLeaves ().end ())
|
||||
{
|
||||
seqNo = (*item)->getSeq ();
|
||||
++seqNo;
|
||||
}
|
||||
m_state->update (forwarderInfo, seqNo);
|
||||
|
||||
diff = make_shared<DiffState>();
|
||||
diff->remove(info);
|
||||
diff->update(forwarderInfo, seqNo);
|
||||
|
||||
insertToDiffLog (diff);
|
||||
}
|
||||
|
||||
satisfyPendingSyncInterests (diff);
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::sendSyncInterest ()
|
||||
{
|
||||
_LOG_DEBUG_ID("sendSyncInterest");
|
||||
|
||||
{
|
||||
m_outstandingInterestName = m_syncPrefix;
|
||||
ostringstream os;
|
||||
os << *m_state->getDigest();
|
||||
m_outstandingInterestName.append(os.str());
|
||||
_LOG_DEBUG_ID (">> I " << m_outstandingInterestName);
|
||||
}
|
||||
|
||||
_LOG_DEBUG_ID("sendSyncInterest: " << m_outstandingInterestName);
|
||||
|
||||
EventId eventId =
|
||||
m_scheduler.scheduleEvent(ndn::time::seconds(m_syncInterestReexpress) +
|
||||
ndn::time::milliseconds(GET_RANDOM(m_reexpressionJitter)),
|
||||
bind (&SyncLogic::sendSyncInterest, this));
|
||||
m_scheduler.cancelEvent (m_reexpressingInterestId);
|
||||
m_reexpressingInterestId = eventId;
|
||||
|
||||
ndn::Interest interest(m_outstandingInterestName);
|
||||
interest.setMustBeFresh(true);
|
||||
|
||||
m_face->expressInterest(interest,
|
||||
bind(&SyncLogic::onSyncData, this, _1, _2),
|
||||
bind(&SyncLogic::onSyncTimeout, this, _1));
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::sendSyncRecoveryInterests (DigestConstPtr digest)
|
||||
{
|
||||
ostringstream os;
|
||||
os << *digest;
|
||||
|
||||
Name interestName = m_syncPrefix;
|
||||
interestName.append("recovery").append(os.str());
|
||||
|
||||
ndn::time::system_clock::Duration nextRetransmission =
|
||||
ndn::time::milliseconds(m_recoveryRetransmissionInterval + GET_RANDOM (m_reexpressionJitter));
|
||||
|
||||
m_recoveryRetransmissionInterval <<= 1;
|
||||
|
||||
m_scheduler.cancelEvent (m_reexpressingRecoveryInterestId);
|
||||
if (m_recoveryRetransmissionInterval < 100*1000) // <100 seconds
|
||||
m_reexpressingRecoveryInterestId =
|
||||
m_scheduler.scheduleEvent (nextRetransmission,
|
||||
bind (&SyncLogic::sendSyncRecoveryInterests, this, digest));
|
||||
|
||||
ndn::Interest interest(interestName);
|
||||
interest.setMustBeFresh(true);
|
||||
|
||||
m_face->expressInterest(interest,
|
||||
bind(&SyncLogic::onSyncData, this, _1, _2),
|
||||
bind(&SyncLogic::onSyncTimeout, this, _1));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SyncLogic::sendSyncData (const Name &name, DigestConstPtr digest, StateConstPtr state)
|
||||
{
|
||||
SyncStateMsg msg;
|
||||
msg << (*state);
|
||||
sendSyncData(name, digest, msg);
|
||||
}
|
||||
|
||||
// pass in state msg instead of state, so that there is no need to lock the state until
|
||||
// this function returns
|
||||
void
|
||||
SyncLogic::sendSyncData (const Name &name, DigestConstPtr digest, SyncStateMsg &ssm)
|
||||
{
|
||||
_LOG_DEBUG_ID (">> D " << name);
|
||||
int size = ssm.ByteSize();
|
||||
char *wireData = new char[size];
|
||||
ssm.SerializeToArray(wireData, size);
|
||||
|
||||
//Data syncData(name);
|
||||
ndn::shared_ptr<ndn::Data> syncData = ndn::make_shared<ndn::Data>();
|
||||
syncData->setName(name);
|
||||
syncData->setContent(reinterpret_cast<const uint8_t*>(wireData), size);
|
||||
syncData->setFreshnessPeriod(ndn::time::seconds(m_syncResponseFreshness));
|
||||
|
||||
m_keyChain->sign(*syncData);
|
||||
|
||||
m_face->put(*syncData);
|
||||
|
||||
delete []wireData;
|
||||
|
||||
// checking if our own interest got satisfied
|
||||
bool satisfiedOwnInterest = false;
|
||||
{
|
||||
satisfiedOwnInterest = (m_outstandingInterestName == name);
|
||||
}
|
||||
|
||||
if (satisfiedOwnInterest)
|
||||
{
|
||||
_LOG_DEBUG_ID ("Satisfied our own Interest. Re-expressing (hopefully with a new digest)");
|
||||
|
||||
ndn::time::system_clock::Duration after =
|
||||
ndn::time::milliseconds(GET_RANDOM(m_reexpressionJitter));
|
||||
// cout << "------------ reexpress interest after: " << after << endl;
|
||||
EventId eventId = m_scheduler.scheduleEvent (after,
|
||||
bind (&SyncLogic::sendSyncInterest, this));
|
||||
m_scheduler.cancelEvent (m_reexpressingInterestId);
|
||||
m_reexpressingInterestId = eventId;
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
SyncLogic::getRootDigest()
|
||||
{
|
||||
ostringstream os;
|
||||
os << *m_state->getDigest();
|
||||
return os.str();
|
||||
}
|
||||
|
||||
size_t
|
||||
SyncLogic::getNumberOfBranches () const
|
||||
{
|
||||
return m_state->getLeaves ().size ();
|
||||
}
|
||||
|
||||
void
|
||||
SyncLogic::printState () const
|
||||
{
|
||||
BOOST_FOREACH (const shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
|
||||
{
|
||||
std::cout << *leaf << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, bool>
|
||||
SyncLogic::getBranchPrefixes() const
|
||||
{
|
||||
std::map<std::string, bool> m;
|
||||
|
||||
BOOST_FOREACH (const shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
|
||||
{
|
||||
std::string prefix = leaf->getInfo()->toString();
|
||||
// do not return forwarder prefix
|
||||
if (prefix != forwarderPrefix)
|
||||
{
|
||||
m.insert(pair<std::string, bool>(prefix, false));
|
||||
}
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
* Yingdi Yu <yingdi@cs.ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_LOGIC_H
|
||||
#define SYNC_LOGIC_H
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include <ndn-cxx/face.hpp>
|
||||
#include <ndn-cxx/security/validator.hpp>
|
||||
#include <ndn-cxx/security/key-chain.hpp>
|
||||
#include <ndn-cxx/util/scheduler.hpp>
|
||||
|
||||
#include "sync-interest-table.h"
|
||||
#include "sync-diff-state.h"
|
||||
#include "sync-full-state.h"
|
||||
#include "sync-std-name-info.h"
|
||||
|
||||
#include "sync-diff-state-container.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifdef HAVE_LOG4CXX
|
||||
#include <log4cxx/logger.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace Sync {
|
||||
|
||||
struct MissingDataInfo {
|
||||
std::string prefix;
|
||||
SeqNo low;
|
||||
SeqNo high;
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup sync
|
||||
* @brief A wrapper for SyncApp, which handles ccnx related things (process
|
||||
* interests and data)
|
||||
*/
|
||||
|
||||
class SyncLogic
|
||||
{
|
||||
public:
|
||||
typedef function< void (const std::vector<MissingDataInfo> & ) > LogicUpdateCallback;
|
||||
typedef function< void (const std::string &/*prefix*/ ) > LogicRemoveCallback;
|
||||
typedef function< void (const std::string &)> LogicPerBranchCallback;
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param syncPrefix the name prefix to use for the Sync Interest
|
||||
* @param onUpdate function that will be called when new state is detected
|
||||
* @param onRemove function that will be called when state is removed
|
||||
* @param ccnxHandle ccnx handle
|
||||
* the app data when new remote names are learned
|
||||
*/
|
||||
SyncLogic (const ndn::Name& syncPrefix,
|
||||
ndn::shared_ptr<ndn::Validator> validator,
|
||||
ndn::shared_ptr<ndn::Face> face,
|
||||
LogicUpdateCallback onUpdate,
|
||||
LogicRemoveCallback onRemove);
|
||||
|
||||
SyncLogic (const ndn::Name& syncPrefix,
|
||||
ndn::shared_ptr<ndn::Validator> validator,
|
||||
ndn::shared_ptr<ndn::Face> face,
|
||||
LogicPerBranchCallback onUpdateBranch);
|
||||
|
||||
~SyncLogic ();
|
||||
|
||||
/**
|
||||
* a wrapper for the same func in SyncApp
|
||||
*/
|
||||
void addLocalNames (const ndn::Name &prefix, uint64_t session, uint64_t seq);
|
||||
|
||||
/**
|
||||
* @brief remove a participant's subtree from the sync tree
|
||||
* @param prefix the name prefix for the participant
|
||||
*/
|
||||
void remove (const ndn::Name &prefix);
|
||||
|
||||
std::string
|
||||
getRootDigest();
|
||||
|
||||
#ifdef _DEBUG
|
||||
ndn::Scheduler &
|
||||
getScheduler () { return m_scheduler; }
|
||||
#endif
|
||||
|
||||
void
|
||||
printState () const;
|
||||
|
||||
std::map<std::string, bool>
|
||||
getBranchPrefixes() const;
|
||||
|
||||
private:
|
||||
void
|
||||
delayedChecksLoop ();
|
||||
|
||||
void
|
||||
onSyncInterest (const ndn::Name& prefix, const ndn::Interest& interest);
|
||||
|
||||
void
|
||||
onSyncRegisterSucceed(const ndn::Name& prefix);
|
||||
|
||||
void
|
||||
onSyncRegisterFailed(const ndn::Name& prefix, const std::string& msg);
|
||||
|
||||
void
|
||||
onSyncData(const ndn::Interest& interest, ndn::Data& data);
|
||||
|
||||
void
|
||||
onSyncTimeout(const ndn::Interest& interest);
|
||||
|
||||
void
|
||||
onSyncDataValidationFailed(const ndn::shared_ptr<const ndn::Data>& data);
|
||||
|
||||
void
|
||||
onSyncDataValidated(const ndn::shared_ptr<const ndn::Data>& data);
|
||||
|
||||
void
|
||||
processSyncInterest (const ndn::Name &name,
|
||||
DigestConstPtr digest, bool timedProcessing=false);
|
||||
|
||||
void
|
||||
processSyncData (const ndn::Name &name,
|
||||
DigestConstPtr digest, const char *wireData, size_t len);
|
||||
|
||||
void
|
||||
processSyncRecoveryInterest (const ndn::Name &name,
|
||||
DigestConstPtr digest);
|
||||
|
||||
void
|
||||
insertToDiffLog (DiffStatePtr diff);
|
||||
|
||||
void
|
||||
satisfyPendingSyncInterests (DiffStateConstPtr diff);
|
||||
|
||||
tuple<DigestConstPtr, std::string>
|
||||
convertNameToDigestAndType (const ndn::Name &name);
|
||||
|
||||
void
|
||||
sendSyncInterest ();
|
||||
|
||||
void
|
||||
sendSyncRecoveryInterests (DigestConstPtr digest);
|
||||
|
||||
void
|
||||
sendSyncData (const ndn::Name &name,
|
||||
DigestConstPtr digest, StateConstPtr state);
|
||||
|
||||
void
|
||||
sendSyncData (const ndn::Name &name,
|
||||
DigestConstPtr digest, SyncStateMsg &msg);
|
||||
|
||||
size_t
|
||||
getNumberOfBranches () const;
|
||||
|
||||
private:
|
||||
FullStatePtr m_state;
|
||||
|
||||
DiffStateContainer m_log;
|
||||
|
||||
ndn::Name m_outstandingInterestName;
|
||||
SyncInterestTable m_syncInterestTable;
|
||||
|
||||
ndn::Name m_syncPrefix;
|
||||
LogicUpdateCallback m_onUpdate;
|
||||
LogicRemoveCallback m_onRemove;
|
||||
LogicPerBranchCallback m_onUpdateBranch;
|
||||
bool m_perBranch;
|
||||
std::shared_ptr<ndn::Validator> m_validator;
|
||||
std::shared_ptr<ndn::KeyChain> m_keyChain;
|
||||
std::shared_ptr<ndn::Face> m_face;
|
||||
const ndn::RegisteredPrefixId* m_syncRegisteredPrefixId;
|
||||
|
||||
ndn::Scheduler m_scheduler;
|
||||
|
||||
boost::mt19937 m_randomGenerator;
|
||||
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_rangeUniformRandom;
|
||||
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_reexpressionJitter;
|
||||
|
||||
|
||||
static const int m_unknownDigestStoreTime = 10; // seconds
|
||||
static const int m_syncResponseFreshness; // MUST BE dividable by 1000!!!
|
||||
static const int m_syncInterestReexpress; // seconds
|
||||
static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds
|
||||
|
||||
|
||||
uint32_t m_recoveryRetransmissionInterval; // milliseconds
|
||||
|
||||
ndn::EventId m_delayedInterestProcessingId;
|
||||
ndn::EventId m_reexpressingInterestId;
|
||||
ndn::EventId m_reexpressingRecoveryInterestId;
|
||||
|
||||
std::string m_instanceId;
|
||||
static int m_instanceCounter;
|
||||
};
|
||||
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_APP_WRAPPER_H
|
||||
@@ -1,32 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#include "sync-name-info.h"
|
||||
|
||||
// #include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace Sync {
|
||||
|
||||
NameInfo::NameMap NameInfo::m_names;
|
||||
size_t NameInfo::m_ids = 0;
|
||||
|
||||
} // Sync
|
||||
@@ -1,102 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of California, Los Angeles
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
|
||||
* Chaoyi Bian <bcy@pku.edu.cn>
|
||||
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
*/
|
||||
|
||||
#ifndef SYNC_NAME_INFO_H
|
||||
#define SYNC_NAME_INFO_H
|
||||
|
||||
#include "sync-common.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "sync-digest.h"
|
||||
|
||||
namespace Sync {
|
||||
|
||||
/**
|
||||
* @ingroup sync
|
||||
* @brief Templated class for the leaf name
|
||||
*/
|
||||
class NameInfo
|
||||
{
|
||||
private:
|
||||
typedef weak_ptr<const NameInfo> const_weak_ptr;
|
||||
|
||||
public:
|
||||
virtual ~NameInfo () { };
|
||||
|
||||
/**
|
||||
* @brief Get ID of the record (should be locally-unique, but not really necessary---this is be used for hashing purposes)
|
||||
*/
|
||||
size_t
|
||||
getHashId () const { return m_id; }
|
||||
|
||||
/**
|
||||
* @brief Check if two names are equal
|
||||
* @param info name to check with
|
||||
*/
|
||||
virtual bool
|
||||
operator == (const NameInfo &info) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Check if two names are in order
|
||||
* @param info name to check with
|
||||
*/
|
||||
virtual bool
|
||||
operator < (const NameInfo &info) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Calculates digest of the name
|
||||
*/
|
||||
const Digest &
|
||||
getDigest () const { return m_digest; }
|
||||
|
||||
/**
|
||||
* @brief Convert prefix to string
|
||||
* @returns string representation of prefix
|
||||
*/
|
||||
virtual std::string
|
||||
toString () const = 0;
|
||||
|
||||
protected:
|
||||
// actual stuff
|
||||
size_t m_id; ///< @brief Identifies NameInfo throughout the library (for hash container, doesn't need to be strictly unique)
|
||||
Digest m_digest;
|
||||
|
||||
// static stuff
|
||||
typedef std::map<std::string, const_weak_ptr> NameMap;
|
||||
static size_t m_ids;
|
||||
static NameMap m_names;
|
||||
};
|
||||
|
||||
typedef shared_ptr<NameInfo> NameInfoPtr;
|
||||
typedef shared_ptr<const NameInfo> NameInfoConstPtr;
|
||||
|
||||
inline std::ostream &
|
||||
operator << (std::ostream &os, const NameInfo &info)
|
||||
{
|
||||
os << info.toString ();
|
||||
return os;
|
||||
}
|
||||
|
||||
} // Sync
|
||||
|
||||
#endif // SYNC_NAME_INFO_H
|
||||
Loaded 100 of 291 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user