Compare commits
204
Commits
ccnx
...
NLSR-0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
800833b7ac | ||
|
|
e8e03ac303 | ||
|
|
5ec9ae4271 | ||
|
|
f7eec4f4c0 | ||
|
|
5c467f0ca8 | ||
|
|
aa3b085384 | ||
|
|
d02c3880d5 | ||
|
|
3ac0728e5a | ||
|
|
c778e814db | ||
|
|
af909fcc13 | ||
|
|
c69da0a350 | ||
|
|
0ff5d45ba8 | ||
|
|
5d9c0573c0 | ||
|
|
4c7caadb72 | ||
|
|
f9f3910dd2 | ||
|
|
53c0e3e9ee | ||
|
|
c57c64b633 | ||
|
|
97473d47fd | ||
|
|
5363c7946b | ||
|
|
f4772d4f21 | ||
|
|
46ccaae829 | ||
|
|
c69c9af931 | ||
|
|
d33e5bc475 | ||
|
|
dce3f18229 | ||
|
|
cae33b69f2 | ||
|
|
18df0602d3 | ||
|
|
41b173ed54 | ||
|
|
9630fbf4e0 | ||
|
|
a6f3e645f5 | ||
|
|
de5560cd3d | ||
|
|
9551edf4d8 | ||
|
|
52493c7c19 | ||
|
|
59dfac3569 | ||
|
|
c2acdcbbb6 | ||
|
|
c439d66728 | ||
|
|
d6bb3fa306 | ||
|
|
297f4163c2 | ||
|
|
9d09780605 | ||
|
|
199e9cf8d9 | ||
|
|
24ed83aa5e | ||
|
|
cec3885c43 | ||
|
|
fb2adee968 | ||
|
|
a0497d8f5c | ||
|
|
02e32996c7 | ||
|
|
50df6b7981 | ||
|
|
7a56d1c7c1 | ||
|
|
75b0ea543f | ||
|
|
c035206443 | ||
|
|
c00650f1ad | ||
|
|
6151e957cf | ||
|
|
9dce0c9445 | ||
|
|
7ccf694ae1 | ||
|
|
f814205d5c | ||
|
|
c2e51f6b6b | ||
|
|
d5a13cdaea | ||
|
|
49b1c0c23f | ||
|
|
5a45495e3e | ||
|
|
c11cc20948 | ||
|
|
0bcf9a361d | ||
|
|
f09e2633a0 | ||
|
|
b45eed2d28 | ||
|
|
a2228c6e1f | ||
|
|
93d9ec37ea | ||
|
|
fc7d5b6fc5 | ||
|
|
2fe12879bd | ||
|
|
bfa2760c57 | ||
|
|
b669f9c02d | ||
|
|
c292d18cd9 | ||
|
|
ee29a03a66 | ||
|
|
b7079a11a3 | ||
|
|
0a7da61b45 | ||
|
|
7c8882ffac | ||
|
|
1cf1e10389 | ||
|
|
7b616582ed | ||
|
|
27f1add26d | ||
|
|
92e5ffba6e | ||
|
|
5bf83175c3 | ||
|
|
20fe4a9cb0 | ||
|
|
942eb7b67d | ||
|
|
f1aa52389a | ||
|
|
0913112f4a | ||
|
|
e875d1f0e6 | ||
|
|
9a7090334d | ||
|
|
904c2413b2 | ||
|
|
9f51efdbcb | ||
|
|
7c60329b07 | ||
|
|
c0b97af1cc | ||
|
|
cb76aded0a | ||
|
|
f99b87fe07 | ||
|
|
7decbbf274 | ||
|
|
b722b10127 | ||
|
|
2afef66e23 | ||
|
|
145064a15e | ||
|
|
1884108a33 | ||
|
|
06cc3383dc | ||
|
|
bc98fcfe37 | ||
|
|
411ee4bf23 | ||
|
|
8388ec6617 | ||
|
|
db49f4e08b | ||
|
|
060d302bf2 | ||
|
|
48265996f2 | ||
|
|
191f5fa878 | ||
|
|
dcee936fe3 | ||
|
|
102aea40d6 | ||
|
|
443ad81ceb | ||
|
|
dfe615ffcb | ||
|
|
669d4a7ab7 | ||
|
|
0494c25213 | ||
|
|
b5b3b4fb18 | ||
|
|
69c9aa98f0 | ||
|
|
bf11c5f1aa | ||
|
|
393d4ffbb2 | ||
|
|
1717b24efd | ||
|
|
cc82753e8d | ||
|
|
18f861a852 | ||
|
|
8e0252bf74 | ||
|
|
c04e7270d2 | ||
|
|
dbee8e3766 | ||
|
|
e176515758 | ||
|
|
50125a90f3 | ||
|
|
778f81b61b | ||
|
|
ad5fe95854 | ||
|
|
6a3a4ddb0a | ||
|
|
a816bee305 | ||
|
|
3cb0cfc899 | ||
|
|
a7cc43e387 | ||
|
|
93f1a07547 | ||
|
|
9a18bfba1f | ||
|
|
e024803565 | ||
|
|
d57f3678c6 | ||
|
|
2f4233531e | ||
|
|
20e3a6ee3f | ||
|
|
3d06e79119 | ||
|
|
0698667cfc | ||
|
|
c7a79b2adb | ||
|
|
674b0b1ffe | ||
|
|
157b0a473a | ||
|
|
31d1d4b331 | ||
|
|
fdbddb114e | ||
|
|
eb582eb919 | ||
|
|
c8a10f762b | ||
|
|
0c21782b13 | ||
|
|
b6450b1719 | ||
|
|
53353465e9 | ||
|
|
40cd1c35c4 | ||
|
|
082403acec | ||
|
|
c8df795fe7 | ||
|
|
05d5fcf0bb | ||
|
|
6e6b7fcb8d | ||
|
|
e14bc49752 | ||
|
|
5f0e65f57e | ||
|
|
955d949d5a | ||
|
|
fa8ee9b314 | ||
|
|
5a44dd4ecd | ||
|
|
099495b524 | ||
|
|
eb764c5c0f | ||
|
|
8264f5842c | ||
|
|
ba09474389 | ||
|
|
2bb198edb8 | ||
|
|
50fda020fc | ||
|
|
d36484c43e | ||
|
|
66e661897c | ||
|
|
4e27b94a86 | ||
|
|
fdfd11abe6 | ||
|
|
1fd8c1e4a4 | ||
|
|
b1710aac0b | ||
|
|
1a4810947f | ||
|
|
92afde42b5 | ||
|
|
ee79e4671e | ||
|
|
59c53c4532 | ||
|
|
f2eef2cb10 | ||
|
|
c52a46ccf0 | ||
|
|
3f4c7b0bed | ||
|
|
85d88339de | ||
|
|
c4eb26cb09 | ||
|
|
1ec25f23e2 | ||
|
|
298385ac96 | ||
|
|
8ff29cc4e2 | ||
|
|
9d19a49f2d | ||
|
|
e77d814bb4 | ||
|
|
4768f89c6e | ||
|
|
62a8e40aa2 | ||
|
|
f7c2c7ca81 | ||
|
|
3fdf7618d1 | ||
|
|
79d355f969 | ||
|
|
dfa4a5b758 | ||
|
|
a002781aa3 | ||
|
|
c717dd30f1 | ||
|
|
da62ec425c | ||
|
|
693c970800 | ||
|
|
2e963a0c32 | ||
|
|
fcf765daf3 | ||
|
|
cd55247fad | ||
|
|
3c6bd92fb7 | ||
|
|
bd7c8e6612 | ||
|
|
faf9d9b8a6 | ||
|
|
fd1dd0a30a | ||
|
|
dbfd7912b3 | ||
|
|
a8cd6b97d9 | ||
|
|
204e754cd1 | ||
|
|
95b7c8cbff | ||
|
|
147f499cab | ||
|
|
87347a35f6 | ||
|
|
fc31641858 |
No files matched your search
@@ -0,0 +1,7 @@
|
||||
.DS*
|
||||
.waf-1*
|
||||
.waf3-*
|
||||
.lock*
|
||||
**/*.pyc
|
||||
build/
|
||||
VERSION
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
for i in $( find "$DIR/.jenkins.d" -type f -perm +111 | sort ); do
|
||||
echo "Run: $i"
|
||||
"$i"
|
||||
done
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/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
+42
@@ -0,0 +1,42 @@
|
||||
#!/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
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -x
|
||||
set -e
|
||||
|
||||
rm -Rf ~/.ndn
|
||||
|
||||
./build/unit-tests-nlsr -l test_suite
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
has() {
|
||||
local p=$1
|
||||
shift
|
||||
local x
|
||||
for x in "$@"; do
|
||||
[[ "${x}" == "${p}" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
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
|
||||
env:
|
||||
- CXX=clang++
|
||||
- NODE_LABELS="OSX OSX-10.9"
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
||||
on_failure: always
|
||||
script:
|
||||
- ./.jenkins
|
||||
@@ -0,0 +1,378 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
#
|
||||
# partially based on boost.py written by Gernot Vormayr
|
||||
# written by Ruediger Sonderfeld <ruediger@c-plusplus.de>, 2008
|
||||
# modified by Bjoern Michaelsen, 2008
|
||||
# modified by Luca Fossati, 2008
|
||||
# rewritten for waf 1.5.1, Thomas Nagy, 2008
|
||||
# rewritten for waf 1.6.2, Sylvain Rouquette, 2011
|
||||
|
||||
'''
|
||||
|
||||
This is an extra tool, not bundled with the default waf binary.
|
||||
To add the boost tool to the waf file:
|
||||
$ ./waf-light --tools=compat15,boost
|
||||
or, if you have waf >= 1.6.2
|
||||
$ ./waf update --files=boost
|
||||
|
||||
When using this tool, the wscript will look like:
|
||||
|
||||
def options(opt):
|
||||
opt.load('compiler_cxx boost')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx boost')
|
||||
conf.check_boost(lib='system filesystem')
|
||||
|
||||
def build(bld):
|
||||
bld(source='main.cpp', target='app', use='BOOST')
|
||||
|
||||
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.
|
||||
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']
|
||||
Errors:
|
||||
- boost might also be compiled with /MT, which links the runtime statically.
|
||||
If you have problems with redefined symbols,
|
||||
self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
|
||||
self.env['CXXFLAGS_%s' % var] += ['/MD', '/EHsc']
|
||||
Passing `--boost-linkage_autodetect` might help ensuring having a correct linkage in some basic cases.
|
||||
|
||||
'''
|
||||
|
||||
import sys
|
||||
import re
|
||||
from waflib import Utils, Logs, Errors
|
||||
from waflib.Configure import conf
|
||||
|
||||
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 = '''
|
||||
#include <boost/system/error_code.hpp>
|
||||
int main() { boost::system::error_code c; }
|
||||
'''
|
||||
BOOST_THREAD_CODE = '''
|
||||
#include <boost/thread.hpp>
|
||||
int main() { boost::thread t; }
|
||||
'''
|
||||
|
||||
# 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'
|
||||
detect_clang = lambda env: (PLATFORM == 'darwin') and 'clang-darwin' or 'clang'
|
||||
detect_mingw = lambda env: (re.search('MinGW', env.CXX[0])) and 'mgw' or 'gcc'
|
||||
BOOST_TOOLSETS = {
|
||||
'borland': 'bcb',
|
||||
'clang': detect_clang,
|
||||
'como': 'como',
|
||||
'cw': 'cw',
|
||||
'darwin': 'xgcc',
|
||||
'edg': 'edg',
|
||||
'g++': detect_mingw,
|
||||
'gcc': detect_mingw,
|
||||
'icpc': detect_intel,
|
||||
'intel': detect_intel,
|
||||
'kcc': 'kcc',
|
||||
'kylix': 'bck',
|
||||
'mipspro': 'mp',
|
||||
'mingw': 'mgw',
|
||||
'msvc': 'vc',
|
||||
'qcc': 'qcc',
|
||||
'sun': 'sw',
|
||||
'sunc++': 'sw',
|
||||
'tru64cxx': 'tru',
|
||||
'vacpp': 'xlc'
|
||||
}
|
||||
|
||||
|
||||
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''')
|
||||
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)')
|
||||
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="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)')
|
||||
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)
|
||||
|
||||
|
||||
@conf
|
||||
def __boost_get_version_file(self, d):
|
||||
dnode = self.root.find_dir(d)
|
||||
if dnode:
|
||||
return dnode.find_node(BOOST_VERSION_FILE)
|
||||
return None
|
||||
|
||||
@conf
|
||||
def boost_get_version(self, d):
|
||||
"""silently retrieve the boost version number"""
|
||||
node = self.__boost_get_version_file(d)
|
||||
if node:
|
||||
try:
|
||||
txt = node.read()
|
||||
except (OSError, IOError):
|
||||
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(":")
|
||||
|
||||
@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:
|
||||
if self.__boost_get_version_file(d):
|
||||
return d
|
||||
if includes:
|
||||
self.end_msg('headers not found in %s' % includes)
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
self.end_msg('headers not found, please provide a --boost-includes argument (see help)')
|
||||
self.fatal('The configuration failed')
|
||||
|
||||
|
||||
@conf
|
||||
def boost_get_toolset(self, cc):
|
||||
toolset = cc
|
||||
if not cc:
|
||||
build_platform = Utils.unversioned_sys_platform()
|
||||
if build_platform in BOOST_TOOLSETS:
|
||||
cc = build_platform
|
||||
else:
|
||||
cc = self.env.CXX_NAME
|
||||
if cc in BOOST_TOOLSETS:
|
||||
toolset = BOOST_TOOLSETS[cc]
|
||||
return isinstance(toolset, str) and toolset or toolset(self.env)
|
||||
|
||||
|
||||
@conf
|
||||
def __boost_get_libs_path(self, *k, **kw):
|
||||
''' return the lib path and all the files in it '''
|
||||
if 'files' in kw:
|
||||
return self.root.find_dir('.'), Utils.to_list(kw['files'])
|
||||
libs = k and k[0] or kw.get('libs', None)
|
||||
if libs:
|
||||
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:
|
||||
path = self.root.find_dir(d)
|
||||
if path:
|
||||
files = path.ant_glob('*boost_*')
|
||||
if files:
|
||||
break
|
||||
path = self.root.find_dir(d + '64')
|
||||
if path:
|
||||
files = path.ant_glob('*boost_*')
|
||||
if files:
|
||||
break
|
||||
if not path:
|
||||
if libs:
|
||||
self.end_msg('libs not found in %s' % libs)
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
self.end_msg('libs not found, please provide a --boost-libs argument (see help)')
|
||||
self.fatal('The configuration failed')
|
||||
|
||||
self.to_log('Found the boost path in %r with the libraries:' % path)
|
||||
for x in files:
|
||||
self.to_log(' %r' % x)
|
||||
return path, files
|
||||
|
||||
@conf
|
||||
def boost_get_libs(self, *k, **kw):
|
||||
'''
|
||||
return the lib path and the required libs
|
||||
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 ''
|
||||
toolset = self.boost_get_toolset(kw.get('toolset', ''))
|
||||
toolset_pat = '(-%s[0-9]{0,3})+' % toolset
|
||||
version = '(-%s)+' % self.env.BOOST_VERSION
|
||||
|
||||
def find_lib(re_lib, files):
|
||||
for file in files:
|
||||
if re_lib.search(file.name):
|
||||
self.to_log('Found boost lib %s' % file)
|
||||
return file
|
||||
return None
|
||||
|
||||
def format_lib_name(name):
|
||||
if name.startswith('lib') and self.env.CC_NAME != 'msvc':
|
||||
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')
|
||||
|
||||
return path.abspath(), libs
|
||||
|
||||
|
||||
@conf
|
||||
def check_boost(self, *k, **kw):
|
||||
"""
|
||||
Initialize boost libraries to be used.
|
||||
|
||||
Keywords: you can pass the same parameters as with the command line (without "--boost-").
|
||||
Note that the command line has the priority, and should preferably be used.
|
||||
"""
|
||||
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)}
|
||||
for key, value in self.options.__dict__.items():
|
||||
if not key.startswith('boost_'):
|
||||
continue
|
||||
key = key[len('boost_'):]
|
||||
params[key] = value and value or kw.get(key, '')
|
||||
|
||||
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 params['lib']:
|
||||
return
|
||||
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')
|
||||
if Logs.verbose:
|
||||
Logs.pprint('CYAN', ' path : %s' % path)
|
||||
Logs.pprint('CYAN', ' libs : %s' % libs)
|
||||
|
||||
|
||||
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 params.get('linkage_autodetect', False):
|
||||
self.start_msg("Attempting to detect boost linkage flags")
|
||||
toolset = self.boost_get_toolset(kw.get('toolset', ''))
|
||||
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']
|
||||
|
||||
# if no dlls are present, we guess the .lib files are not stubs
|
||||
has_dlls = False
|
||||
for x in Utils.listdir(path):
|
||||
if x.endswith(self.env.cxxshlib_PATTERN % ''):
|
||||
has_dlls = True
|
||||
break
|
||||
if not has_dlls:
|
||||
self.env['STLIBPATH_%s' % var] = [path]
|
||||
self.env['STLIB_%s' % var] = libs
|
||||
del self.env['LIB_%s' % var]
|
||||
del self.env['LIBPATH_%s' % var]
|
||||
|
||||
# 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
|
||||
try:
|
||||
try_link()
|
||||
self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
|
||||
e = None
|
||||
break
|
||||
except Errors.ConfigurationError as exc:
|
||||
self.env.revert()
|
||||
e = exc
|
||||
|
||||
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)
|
||||
self.fatal('The configuration failed')
|
||||
else:
|
||||
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.fatal('The configuration failed')
|
||||
self.end_msg('ok')
|
||||
@@ -0,0 +1,24 @@
|
||||
# -*- 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''')
|
||||
|
||||
def configure(conf):
|
||||
if conf.options.with_coverage:
|
||||
conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
|
||||
linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
|
||||
|
||||
@TaskGen.feature('cxx','cc')
|
||||
@TaskGen.after('process_source')
|
||||
def add_coverage(self):
|
||||
if getattr(self, 'use', ''):
|
||||
self.use += ' GCOV'
|
||||
else:
|
||||
self.use = 'GCOV'
|
||||
@@ -0,0 +1,191 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
from waflib import Logs, Configure, 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)''')
|
||||
|
||||
def configure(conf):
|
||||
cxx = conf.env['CXX_NAME'] # CXX_NAME represents generic name of the compiler
|
||||
if cxx == 'gcc':
|
||||
flags = GccFlags()
|
||||
elif cxx == 'clang':
|
||||
flags = ClangFlags()
|
||||
else:
|
||||
flags = CompilerFlags()
|
||||
Logs.warn('The code has not yet been tested with %s compiler' % cxx)
|
||||
|
||||
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
|
||||
|
||||
# General flags are always applied (e.g., selecting C++11 mode)
|
||||
generalFlags = flags.getGeneralFlags(conf)
|
||||
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
|
||||
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
|
||||
conf.env.DEFINES += generalFlags['DEFINES']
|
||||
|
||||
# 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:
|
||||
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))
|
||||
else:
|
||||
extraFlags = flags.getOptimizedFlags(conf)
|
||||
|
||||
if not 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
|
||||
"""
|
||||
if len(cxxflags) == 0:
|
||||
return
|
||||
|
||||
self.start_msg('Checking supported CXXFLAGS')
|
||||
|
||||
supportedFlags = []
|
||||
for flag in cxxflags:
|
||||
if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False):
|
||||
supportedFlags += [flag]
|
||||
|
||||
self.end_msg(' '.join(supportedFlags))
|
||||
self.env.CXXFLAGS = supportedFlags + self.env.CXXFLAGS
|
||||
|
||||
@Configure.conf
|
||||
def add_supported_linkflags(self, linkflags):
|
||||
"""
|
||||
Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
|
||||
"""
|
||||
if len(linkflags) == 0:
|
||||
return
|
||||
|
||||
self.start_msg('Checking supported LINKFLAGS')
|
||||
|
||||
supportedFlags = []
|
||||
for flag in linkflags:
|
||||
if self.check_cxx(linkflags=['-Werror', flag], mandatory=False):
|
||||
supportedFlags += [flag]
|
||||
|
||||
self.end_msg(' '.join(supportedFlags))
|
||||
self.env.LINKFLAGS = supportedFlags + self.env.LINKFLAGS
|
||||
|
||||
|
||||
class CompilerFlags(object):
|
||||
def getGeneralFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['_DEBUG']}
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
|
||||
|
||||
class GccBasicFlags(CompilerFlags):
|
||||
"""
|
||||
This class defines basic flags that work for both gcc and clang compilers
|
||||
"""
|
||||
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
|
||||
]
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-O2',
|
||||
'-g',
|
||||
'-pedantic',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
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
|
||||
|
||||
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
|
||||
]
|
||||
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
|
||||
return flags
|
||||
|
||||
class ClangFlags(GccBasicFlags):
|
||||
def getGeneralFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getGeneralFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-std=c++11']
|
||||
if Utils.unversioned_sys_platform() == 'darwin':
|
||||
flags['CXXFLAGS'] += ['-stdlib=libc++']
|
||||
flags['LINKFLAGS'] += ['-stdlib=libc++']
|
||||
return flags
|
||||
|
||||
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',
|
||||
]
|
||||
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',
|
||||
]
|
||||
return flags
|
||||
@@ -0,0 +1,214 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: UTF-8
|
||||
# Thomas Nagy 2008-2010 (ita)
|
||||
|
||||
"""
|
||||
|
||||
Doxygen support
|
||||
|
||||
Variables passed to bld():
|
||||
* doxyfile -- the Doxyfile to use
|
||||
|
||||
When using this tool, the wscript will look like:
|
||||
|
||||
def options(opt):
|
||||
opt.load('doxygen')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('doxygen')
|
||||
# check conf.env.DOXYGEN, if it is mandatory
|
||||
|
||||
def build(bld):
|
||||
if bld.env.DOXYGEN:
|
||||
bld(features="doxygen", doxyfile='Doxyfile', ...)
|
||||
|
||||
def doxygen(bld):
|
||||
if bld.env.DOXYGEN:
|
||||
bld(features="doxygen", doxyfile='Doxyfile', ...)
|
||||
"""
|
||||
|
||||
from fnmatch import fnmatchcase
|
||||
import os, os.path, re, stat
|
||||
from waflib import Task, Utils, Node, Logs, Errors, Build
|
||||
from waflib.TaskGen import feature
|
||||
|
||||
DOXY_STR = '"${DOXYGEN}" - '
|
||||
DOXY_FMTS = 'html latex man rft xml'.split()
|
||||
DOXY_FILE_PATTERNS = '*.' + ' *.'.join('''
|
||||
c cc cxx cpp c++ java ii ixx ipp i++ inl h hh hxx hpp h++ idl odl cs php php3
|
||||
inc m mm py f90c cc cxx cpp c++ java ii ixx ipp i++ inl h hh hxx
|
||||
'''.split())
|
||||
|
||||
re_rl = re.compile('\\\\\r*\n', re.MULTILINE)
|
||||
re_nl = re.compile('\r*\n', re.M)
|
||||
def parse_doxy(txt):
|
||||
tbl = {}
|
||||
txt = re_rl.sub('', txt)
|
||||
lines = re_nl.split(txt)
|
||||
for x in lines:
|
||||
x = x.strip()
|
||||
if not x or x.startswith('#') or x.find('=') < 0:
|
||||
continue
|
||||
if x.find('+=') >= 0:
|
||||
tmp = x.split('+=')
|
||||
key = tmp[0].strip()
|
||||
if key in tbl:
|
||||
tbl[key] += ' ' + '+='.join(tmp[1:]).strip()
|
||||
else:
|
||||
tbl[key] = '+='.join(tmp[1:]).strip()
|
||||
else:
|
||||
tmp = x.split('=')
|
||||
tbl[tmp[0].strip()] = '='.join(tmp[1:]).strip()
|
||||
return tbl
|
||||
|
||||
class doxygen(Task.Task):
|
||||
vars = ['DOXYGEN', 'DOXYFLAGS']
|
||||
color = 'BLUE'
|
||||
|
||||
def runnable_status(self):
|
||||
'''
|
||||
self.pars are populated in runnable_status - because this function is being
|
||||
run *before* both self.pars "consumers" - scan() and run()
|
||||
|
||||
set output_dir (node) for the output
|
||||
'''
|
||||
|
||||
for x in self.run_after:
|
||||
if not x.hasrun:
|
||||
return Task.ASK_LATER
|
||||
|
||||
if not getattr(self, 'pars', None):
|
||||
txt = self.inputs[0].read()
|
||||
self.pars = parse_doxy(txt)
|
||||
if not self.pars.get('OUTPUT_DIRECTORY'):
|
||||
self.pars['OUTPUT_DIRECTORY'] = self.inputs[0].parent.get_bld().abspath()
|
||||
|
||||
# Override with any parameters passed to the task generator
|
||||
if getattr(self.generator, 'pars', None):
|
||||
for k, v in self.generator.pars.iteritems():
|
||||
self.pars[k] = v
|
||||
|
||||
self.doxy_inputs = getattr(self, 'doxy_inputs', [])
|
||||
if not self.pars.get('INPUT'):
|
||||
self.doxy_inputs.append(self.inputs[0].parent)
|
||||
else:
|
||||
for i in self.pars.get('INPUT').split():
|
||||
if os.path.isabs(i):
|
||||
node = self.generator.bld.root.find_node(i)
|
||||
else:
|
||||
node = self.generator.path.find_node(i)
|
||||
if not node:
|
||||
self.generator.bld.fatal('Could not find the doxygen input %r' % i)
|
||||
self.doxy_inputs.append(node)
|
||||
|
||||
if not getattr(self, 'output_dir', None):
|
||||
bld = self.generator.bld
|
||||
# First try to find an absolute path, then find or declare a relative path
|
||||
self.output_dir = bld.root.find_dir(self.pars['OUTPUT_DIRECTORY'])
|
||||
if not self.output_dir:
|
||||
self.output_dir = bld.path.find_or_declare(self.pars['OUTPUT_DIRECTORY'])
|
||||
|
||||
self.signature()
|
||||
return Task.Task.runnable_status(self)
|
||||
|
||||
def scan(self):
|
||||
exclude_patterns = self.pars.get('EXCLUDE_PATTERNS','').split()
|
||||
file_patterns = self.pars.get('FILE_PATTERNS','').split()
|
||||
if not file_patterns:
|
||||
file_patterns = DOXY_FILE_PATTERNS
|
||||
if self.pars.get('RECURSIVE') == 'YES':
|
||||
file_patterns = ["**/%s" % pattern for pattern in file_patterns]
|
||||
nodes = []
|
||||
names = []
|
||||
for node in self.doxy_inputs:
|
||||
if os.path.isdir(node.abspath()):
|
||||
for m in node.ant_glob(incl=file_patterns, excl=exclude_patterns):
|
||||
nodes.append(m)
|
||||
else:
|
||||
nodes.append(node)
|
||||
return (nodes, names)
|
||||
|
||||
def run(self):
|
||||
dct = self.pars.copy()
|
||||
dct['INPUT'] = ' '.join(['"%s"' % x.abspath() for x in self.doxy_inputs])
|
||||
code = '\n'.join(['%s = %s' % (x, dct[x]) for x in self.pars])
|
||||
code = code.encode() # for python 3
|
||||
#fmt = DOXY_STR % (self.inputs[0].parent.abspath())
|
||||
cmd = Utils.subst_vars(DOXY_STR, self.env)
|
||||
env = self.env.env or None
|
||||
proc = Utils.subprocess.Popen(cmd, shell=True, stdin=Utils.subprocess.PIPE, env=env, cwd=self.generator.bld.path.get_bld().abspath())
|
||||
proc.communicate(code)
|
||||
return proc.returncode
|
||||
|
||||
def post_run(self):
|
||||
nodes = self.output_dir.ant_glob('**/*', quiet=True)
|
||||
for x in nodes:
|
||||
x.sig = Utils.h_file(x.abspath())
|
||||
self.outputs += nodes
|
||||
return Task.Task.post_run(self)
|
||||
|
||||
class tar(Task.Task):
|
||||
"quick tar creation"
|
||||
run_str = '${TAR} ${TAROPTS} ${TGT} ${SRC}'
|
||||
color = 'RED'
|
||||
after = ['doxygen']
|
||||
def runnable_status(self):
|
||||
for x in getattr(self, 'input_tasks', []):
|
||||
if not x.hasrun:
|
||||
return Task.ASK_LATER
|
||||
|
||||
if not getattr(self, 'tar_done_adding', None):
|
||||
# execute this only once
|
||||
self.tar_done_adding = True
|
||||
for x in getattr(self, 'input_tasks', []):
|
||||
self.set_inputs(x.outputs)
|
||||
if not self.inputs:
|
||||
return Task.SKIP_ME
|
||||
return Task.Task.runnable_status(self)
|
||||
|
||||
def __str__(self):
|
||||
tgt_str = ' '.join([a.nice_path(self.env) for a in self.outputs])
|
||||
return '%s: %s\n' % (self.__class__.__name__, tgt_str)
|
||||
|
||||
@feature('doxygen')
|
||||
def process_doxy(self):
|
||||
if not getattr(self, 'doxyfile', None):
|
||||
self.generator.bld.fatal('no doxyfile??')
|
||||
|
||||
node = self.doxyfile
|
||||
if not isinstance(node, Node.Node):
|
||||
node = self.path.find_resource(node)
|
||||
if not node:
|
||||
raise ValueError('doxygen file not found')
|
||||
|
||||
# the task instance
|
||||
dsk = self.create_task('doxygen', node)
|
||||
|
||||
if getattr(self, 'doxy_tar', None):
|
||||
tsk = self.create_task('tar')
|
||||
tsk.input_tasks = [dsk]
|
||||
tsk.set_outputs(self.path.find_or_declare(self.doxy_tar))
|
||||
if self.doxy_tar.endswith('bz2'):
|
||||
tsk.env['TAROPTS'] = ['cjf']
|
||||
elif self.doxy_tar.endswith('gz'):
|
||||
tsk.env['TAROPTS'] = ['czf']
|
||||
else:
|
||||
tsk.env['TAROPTS'] = ['cf']
|
||||
|
||||
def configure(conf):
|
||||
'''
|
||||
Check if doxygen and tar commands are present in the system
|
||||
|
||||
If the commands are present, then conf.env.DOXYGEN and conf.env.TAR
|
||||
variables will be set. Detection can be controlled by setting DOXYGEN and
|
||||
TAR environmental variables.
|
||||
'''
|
||||
|
||||
conf.find_program('doxygen', var='DOXYGEN', mandatory=False)
|
||||
conf.find_program('tar', var='TAR', mandatory=False)
|
||||
|
||||
# doxygen docs
|
||||
from waflib.Build import BuildContext
|
||||
class doxy(BuildContext):
|
||||
cmd = "doxygen"
|
||||
fun = "doxygen"
|
||||
@@ -0,0 +1,47 @@
|
||||
#! /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''')
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/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,79 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
# inspired by code by Hans-Martin von Gaudecker, 2012
|
||||
|
||||
import os
|
||||
from waflib import Node, Task, TaskGen, Errors, Logs, Build, Utils
|
||||
|
||||
class sphinx_build(Task.Task):
|
||||
color = 'BLUE'
|
||||
run_str = '${SPHINX_BUILD} -D ${VERSION} -D ${RELEASE} -q -b ${BUILDERNAME} -d ${DOCTREEDIR} ${SRCDIR} ${OUTDIR}'
|
||||
|
||||
def __str__(self):
|
||||
env = self.env
|
||||
src_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.inputs])
|
||||
tgt_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.outputs])
|
||||
if self.outputs: sep = ' -> '
|
||||
else: sep = ''
|
||||
return'%s [%s]: %s%s%s\n'%(self.__class__.__name__.replace('_task',''),
|
||||
self.env['BUILDERNAME'], src_str, sep, tgt_str)
|
||||
|
||||
@TaskGen.extension('.py', '.rst')
|
||||
def sig_hook(self, node):
|
||||
node.sig=Utils.h_file(node.abspath())
|
||||
|
||||
@TaskGen.feature("sphinx")
|
||||
@TaskGen.before_method("process_source")
|
||||
def apply_sphinx(self):
|
||||
"""Set up the task generator with a Sphinx instance and create a task."""
|
||||
|
||||
inputs = []
|
||||
for i in Utils.to_list(self.source):
|
||||
if not isinstance(i, Node.Node):
|
||||
node = self.path.find_node(node)
|
||||
else:
|
||||
node = i
|
||||
if not node:
|
||||
raise ValueError('[%s] file not found' % i)
|
||||
inputs.append(node)
|
||||
|
||||
task = self.create_task('sphinx_build', inputs)
|
||||
|
||||
conf = self.path.find_node(self.config)
|
||||
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"))
|
||||
|
||||
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
|
||||
|
||||
import imp
|
||||
confData = imp.load_source('sphinx_conf', conf.abspath())
|
||||
|
||||
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)
|
||||
else:
|
||||
task.outputs.append(outdir)
|
||||
|
||||
def configure(conf):
|
||||
conf.find_program('sphinx-build', var='SPHINX_BUILD', mandatory=False)
|
||||
|
||||
# sphinx docs
|
||||
from waflib.Build import BuildContext
|
||||
class sphinx(BuildContext):
|
||||
cmd = "sphinx"
|
||||
fun = "sphinx"
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
NLSR Authors
|
||||
===========
|
||||
|
||||
NLSR is an open source project includes contributions from the members of the
|
||||
[NDN project team](http://named-data.net/project/participants/).
|
||||
|
||||
## Project lead:
|
||||
|
||||
* Vince Lehman <http://vslehman.com>
|
||||
|
||||
## 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>
|
||||
|
||||
* 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).
|
||||
+722
@@ -0,0 +1,722 @@
|
||||
NLSR LICENSE
|
||||
============
|
||||
|
||||
NLSR is released under the GPL with the additional exemption that
|
||||
compiling, linking, and/or using OpenSSL is allowed.
|
||||
|
||||
NLSR relies on third-party software and libraries, licensed under the following
|
||||
licenses:
|
||||
|
||||
- Boost libraries are licensed under the conditions of
|
||||
[Boost Software License 1.0](http://www.boost.org/users/license.html)
|
||||
|
||||
- CryptoPP library is licensed under the conditions of
|
||||
[Boost Software License 1.0](http://www.boost.org/users/license.html)
|
||||
|
||||
- log4cxx is licensed under the conditions of
|
||||
[Apache License, Version 2.0](https://logging.apache.org/log4cxx/license.html)
|
||||
|
||||
- ndn-cxx is licensed under the conditions of
|
||||
[LGPL 3.0](https://github.com/named-data/ndn-cxx/blob/master/COPYING.md)
|
||||
|
||||
- protobuf is licensed under the conditions of
|
||||
[BSD license](https://github.com/google/protobuf/blob/master/LICENSE)
|
||||
|
||||
- SQLite is in [public domain](http://www.sqlite.org/copyright.html)
|
||||
|
||||
- waf build system is licensed under the conditions of
|
||||
[BSD license](https://github.com/named-data/ndn-cxx/blob/master/waf)
|
||||
|
||||
NLSR also relies on third-party libraries with non-GPL compatible licenses.
|
||||
These libraries fall into the category of "System Libraries" under GPL
|
||||
license definitions and are used in accordance with the GPL license exception
|
||||
for "System Libraries":
|
||||
|
||||
- OpenSSL is licensed under an
|
||||
[Apache-style licence](http://www.openssl.org/source/license.html)
|
||||
|
||||
- (OS X platform only) OS X Security Framework is licensed under
|
||||
[Apple Public Source License](http://www.opensource.apple.com/license/apsl/)
|
||||
|
||||
The GPL license is provided below in this file.
|
||||
For more information, see http://www.gnu.org/licenses/
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
==========================
|
||||
Version 3, 29 June 2007
|
||||
=======================
|
||||
|
||||
> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
# Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
# TERMS AND CONDITIONS
|
||||
|
||||
## 0. Definitions.
|
||||
|
||||
_"This License"_ refers to version 3 of the GNU General Public License.
|
||||
|
||||
_"Copyright"_ also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
_"The Program"_ refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as _"you"_. _"Licensees"_ and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To _"modify"_ a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a _"modified version"_ of the
|
||||
earlier work or a work _"based on"_ the earlier work.
|
||||
|
||||
A _"covered work"_ means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To _"propagate"_ a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To _"convey"_ a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
## 1. Source Code.
|
||||
|
||||
The _"source code"_ for a work means the preferred form of the work
|
||||
for making modifications to it. _"Object code"_ means any non-source
|
||||
form of a work.
|
||||
|
||||
A _"Standard Interface"_ means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The _"System Libraries"_ of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The _"Corresponding Source"_ for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
## 2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
## 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
## 4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
## 5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
## 6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A _"User Product"_ is either (1) a _"consumer product"_, which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
_"Installation Information"_ for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
## 7. Additional Terms.
|
||||
|
||||
_"Additional permissions"_ are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
## 8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
## 9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
## 10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An _"entity transaction"_ is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
## 11. Patents.
|
||||
|
||||
A _"contributor"_ is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's _"essential patent claims"_ are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
## 12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
## 13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
## 14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
## 15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
## 16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
## 17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
# END OF TERMS AND CONDITIONS
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
|
||||
# How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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.
|
||||
|
||||
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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type 'show c' for details.
|
||||
|
||||
The hypothetical commands _'show w'_ and _'show c'_ should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -1,34 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -gdwarf-2 -g3
|
||||
LIBS = -lccn -lccnsync -lcrypto
|
||||
|
||||
PROGRAMS = nlsrc nlsr
|
||||
INSTALL_PATH=/usr/local/bin/
|
||||
|
||||
NLSR_SRCS=nlsr.c nlsr_ndn.c nlsr_npl.c nlsr_adl.c nlsr_lsdb.c nlsr_route.c nlsr_npt.c nlsr_fib.c nlsr_sync.c nlsr_face.c nlsr_km.c nlsr_km_util.c utility.c
|
||||
NLSRC_SRCS=nlsrc.c
|
||||
|
||||
all: $(PROGRAMS)
|
||||
|
||||
nlsr: $(NLSR_SRCS)
|
||||
$(CC) $(CFLAGS) $(NLSR_SRCS) $(LIBS) -lm -o nlsr
|
||||
|
||||
nlsrc: $(NLSRC_SRCS)
|
||||
$(CC) $(CFLAGS) $(NLSRC_SRCS) $(LIBS) -lm -o nlsrc
|
||||
|
||||
install: $(PROGRAMS)
|
||||
cp $(PROGRAMS) $(INSTALL_PATH)
|
||||
cd $(INSTALL_PATH); chown root:0 $(PROGRAMS); chmod 755 $(PROGRAMS)
|
||||
|
||||
uninstall:
|
||||
cd $(INSTALL_PATH); rm -f $(PROGRAMS)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(PROGRAMS)
|
||||
rm -rf *.dSYM
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
.PHONY: all clean
|
||||
@@ -1,126 +0,0 @@
|
||||
Installation:
|
||||
|
||||
1: Getting NLSR:
|
||||
|
||||
https://github.com/NDN-Routing/NLSR0.0
|
||||
|
||||
2: run make to compile.
|
||||
|
||||
3: Start ccnx daemon (ccnd) and Repo (ccnr).
|
||||
|
||||
4: Add '/ndn/keys' route to your neighboring testbed nodes.
|
||||
This can be done by adding routes in your ccnd.conf to all neigbors,
|
||||
e.g.
|
||||
add /ndn/keys udp 10.0.XX.XX
|
||||
add /ndn/keys udp 10.0.YY.YY ...
|
||||
add /ndn/keys udp 10.0.ZZ.ZZ
|
||||
|
||||
5: Create your keys and publish them through repo. Please have
|
||||
a look at https://github.com/named-data/ndn-testbed-key-suite for details.
|
||||
|
||||
6: create a nlsr configuration file, have a look at
|
||||
macbook.conf and 'Configuration Parameters' section for details
|
||||
|
||||
7: start nlsr
|
||||
|
||||
|
||||
Configuration Parameter:
|
||||
|
||||
1. router-name </name/prefix/of/the/router>
|
||||
It is a required configuration parameter that is used to set the router name.
|
||||
Name prefix of the router must start with `/ndn' and followed by a strict
|
||||
hierarchical order of name components up to the hostname of the router. For
|
||||
e.g. if router has a hostname host.dept.org.edu pollux.cs.memphis.edu then the
|
||||
router name can be `/ndn/org.edu/dept/host..
|
||||
|
||||
2. ccnneighbor </name/prefix/of/neighbor> [neighbor_ip_addrr]
|
||||
This parameter is used to configure the neighboring router. Name prefix of a
|
||||
neighbor must start with `/ndn. and followed by a strict hierarchical order of
|
||||
name component as mentioned for router-name. If a router has a neighbor having
|
||||
hostname `neighbor.dept.org.edu' then configuration command would be
|
||||
`ccnneighbor /ndn/org.edu/dept/neighbor. The optional parameter,
|
||||
[neighbor_ip_addrr], can be provided for explicitly connecting to a given
|
||||
IP. This is useful if there is no entry of the hostname in the DNS.
|
||||
|
||||
3. ccnname </name/prefix/to/be/advertised>
|
||||
ccnname is used to advertise the name prefix of the services hosted by the
|
||||
router. Name prefix must follow the ccnx naming convention.
|
||||
|
||||
4. topo-prefix <name/prefix/of/repo/topo>
|
||||
It is used to configure the topological prefix of the `sync. slice created for
|
||||
nlsr in a repo. Prefix must follow the ccnx naming convention. Default value
|
||||
for topo prefix is `/ndn/routing/nlsr'
|
||||
|
||||
5. slice-prefix <name/prefix/of/repo/slice>
|
||||
This parameter is used to set the sync's slice prefix. All nlsr nodes `must'
|
||||
have the same slice prefix and must follow the ccnx naming convention. Default
|
||||
value for slice prefix is `/ndn/routing/nlsr/LSA'
|
||||
|
||||
6. lsa-refresh-time <sec>
|
||||
It is the time in seconds, after which router will refresh its LSAs. Default
|
||||
value = 1800 sec, Min = 240 sec
|
||||
|
||||
7. router-dead-interval <sec>
|
||||
It is the time after which router will consider its neighbor dead if it does
|
||||
not hear anything for that amount of time. If an LSA generated by neighbor has
|
||||
a lifetime greater than router-dead-interval then router will simply discard
|
||||
the LSA and update name prefix table, routing table and ccnd FIB accordingly.
|
||||
Default value = 3600 sec, Min = 360 sec.
|
||||
|
||||
8. interest-retry <number>
|
||||
interest-retry is maximum number of times a router will send same interest if
|
||||
the interest is timed out. Default = 3, Min =1 and Max = 10
|
||||
|
||||
9. interest-resend-time <sec>
|
||||
When an interest is timed out, NLSR waits for `interest-resend-time. before
|
||||
sending another interest. The interest is retransmitted up to the value of
|
||||
`interest-retry.. If the interest doesn.t get satisfied during this time the
|
||||
neighbor will be considered as dead. Default value = 15 sec, Min = 1 sec, Max =
|
||||
60 sec
|
||||
|
||||
10. max-faces-per-prefix <number>
|
||||
By default NLSR calculates and add faces for all available faces to a prefix.
|
||||
Number of faces can be restricted with this parameter, if this is configured
|
||||
NLSR will add <number> or faces per prefixes in ccnd FIB.
|
||||
|
||||
11. debug <on/off>
|
||||
Enable nlsr debugging by printing out detail messages on the standard output.
|
||||
By default it is off.
|
||||
|
||||
12. logdir </directory/for/logging/>
|
||||
NLSR will start writing log in logdir folder. If logdir is not configured NLSR
|
||||
will create a log directory name nlsrLog in user home directory and write log
|
||||
into that folder.
|
||||
|
||||
13. tunnel-type <udp | tcp>
|
||||
This is used to specify the tunnel type that NLSR should create for building an
|
||||
overlay network. By default NLSR creates udp tunnels.
|
||||
|
||||
**Following Commands are only required for hyperbolic routing**
|
||||
|
||||
14. hyperbolic-routing <on|dry_run>
|
||||
This option enables hyperbolic routing. With option on, link state routing
|
||||
doesn't work while with dry_run option route is calculated by Link State
|
||||
routing and hyperbolic routes are just recorded only in log file.Following
|
||||
field is required if hyperbolic routing is on.
|
||||
|
||||
15. hyperbolic-cordinate <radius> <theta>
|
||||
Polar coordinates of a node in a form of radius and theta. Currently, calculation
|
||||
of the polar coordinates is an offline process and done by
|
||||
the operator of a site.
|
||||
|
||||
** Hyperbolic Commands End here **
|
||||
|
||||
16. keystore-path </path/to/keystore/file name(.ccnx_keystore)>
|
||||
Path to the keystore. The keystore folder is usually created by
|
||||
ccninitkeystore. Keys in this folder will be used by NLSR to sign the packets.
|
||||
|
||||
17. root-key-prefix </key/prefix>
|
||||
Name prefix of the root key; the site key should be signed by this key.
|
||||
e.g. root-key-prefix /ndn/keys
|
||||
|
||||
18. site-name </name/prefix/of/site>
|
||||
Name of the site of which this router is a part.
|
||||
|
||||
19. network </name/of/network>
|
||||
Name of the networks router belongs to
|
||||
@@ -0,0 +1,37 @@
|
||||
Requirements
|
||||
------------
|
||||
|
||||
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:
|
||||
|
||||
Include the following header in all `.hpp` and `.cpp` files:
|
||||
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* 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/>.
|
||||
**/
|
||||
|
||||
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)).
|
||||
|
||||
Recommendations
|
||||
---------------
|
||||
|
||||
NSLR code is subject to the code style, defined here:
|
||||
http://redmine.named-data.net/projects/nfd/wiki/CodeStyle
|
||||
@@ -0,0 +1,43 @@
|
||||
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/).
|
||||
|
||||
## 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 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.
|
||||
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.
|
||||
|
||||
|
||||
Source releases
|
||||
---------------
|
||||
|
||||
The source code and source-code installation instructions are always available at
|
||||
the following links:
|
||||
|
||||
- [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)
|
||||
|
||||
Additional information
|
||||
----------------------
|
||||
|
||||
- [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)
|
||||
@@ -0,0 +1,46 @@
|
||||
Getting Started with NLSR
|
||||
=========================
|
||||
|
||||
.. toctree::
|
||||
..
|
||||
|
||||
Getting Source
|
||||
--------------
|
||||
|
||||
- `GitHub NLSR repository <https://github.com/named-data/NLSR>`_
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
:doc:`INSTALL`
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
After installing NLSR from source, you need to create a configuration file for
|
||||
NLSR. Please take a look at :doc:`manpages/nlsr.conf` for a sample configuration. For
|
||||
details on configuring a router, please refer to :doc:`ROUTER-CONFIG`. For details on
|
||||
security configuration, please refer to :doc:`SECURITY-CONFIG`.
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
Run nlsr with the following command:
|
||||
|
||||
::
|
||||
|
||||
nlsr
|
||||
|
||||
NLSR will look for the default configuration file, ``nlsr.conf``, in the current directory.
|
||||
|
||||
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:
|
||||
|
||||
::
|
||||
|
||||
nlsr -d
|
||||
@@ -0,0 +1,78 @@
|
||||
NLSR Installation Instructions
|
||||
==============================
|
||||
|
||||
.. toctree::
|
||||
..
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
- `NFD <http://named-data.net/doc/NFD/current/>`_ and its requirements:
|
||||
|
||||
Refer to `Getting started with NFD <http://named-data.net/doc/NFD/current/INSTALL.html>`_
|
||||
for detailed installation and running instruction.
|
||||
|
||||
- log4cxx library
|
||||
|
||||
On Ubuntu Linux:
|
||||
|
||||
::
|
||||
|
||||
sudo apt-get install liblog4cxx10-dev
|
||||
|
||||
On OS X with MacPorts:
|
||||
|
||||
::
|
||||
|
||||
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
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
Execute the following commands to build NLSR:
|
||||
|
||||
::
|
||||
|
||||
./waf configure
|
||||
./waf
|
||||
sudo ./waf install
|
||||
|
||||
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``
|
||||
|
||||
::
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
|
||||
or
|
||||
export PKG_CONFIG_PATH=/path/to/pkgconfig/on/your/machine
|
||||
@@ -0,0 +1,184 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
NLSR version 0.3.0 (changes since version 0.2.2)
|
||||
++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
Release date: August 1, 2016
|
||||
|
||||
**Code changes**:
|
||||
|
||||
- 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
|
||||
@@ -0,0 +1,225 @@
|
||||
Router Configuration
|
||||
====================
|
||||
|
||||
.. toctree::
|
||||
..
|
||||
|
||||
Example network and sample configuration
|
||||
----------------------------------------
|
||||
|
||||
Assume that three routers in the same network, but at three different sites
|
||||
(``memphis.edu``, ``arizona.edu``, and ``colostate.edu``), are connected to each other to
|
||||
construct the following topology:
|
||||
|
||||
::
|
||||
|
||||
+-------------------------------------+
|
||||
| /ndn/edu/memphis/%C1.Router/router1 |
|
||||
+-------------------------------------+
|
||||
/ 11 12\
|
||||
/ \
|
||||
route-cost = 25 / \ route-cost = 30
|
||||
/ \
|
||||
17 / \ 13
|
||||
+-----------------------------------+ 7 10 +-------------------------------------+
|
||||
|/ndn/edu/arizona/%C1.Router/router3|-------------------|/ndn/edu/colostate/%C1.Router/router2|
|
||||
+-----------------------------------+ route-cost = 28 +-------------------------------------+
|
||||
|
||||
Figure: Network Topology
|
||||
|
||||
The number represents the connecting face id. For example,
|
||||
``/ndn/edu/memphis/%C1.Router/router1`` is connected to
|
||||
``/ndn/edu/arizona/%C1.Router/router3`` via face 11 and the route cost is 25. To reach
|
||||
``/ndn/edu/colostate/%C1.Router/router2`` via face 12, the route cost is 30.
|
||||
|
||||
We will walk through setting up the faces and creating the configuration file for
|
||||
``/ndn/edu/memphis/%C1.Router/router1``.
|
||||
|
||||
Step 1. Ensuring nfd is running
|
||||
-------------------------------
|
||||
|
||||
Type the following in the terminal:
|
||||
|
||||
::
|
||||
|
||||
nfd-status -f
|
||||
|
||||
If you see ``ERROR: 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.
|
||||
|
||||
Step 2. Determining FaceUri
|
||||
---------------------------
|
||||
|
||||
Assume that ``/ndn/edu/arizona/%C1.Router/router3`` has hostname ``router3.arizona.edu`` and
|
||||
``/ndn/edu/colostate/%C1.Router/router2`` has IP address ``79.123.10.145``.
|
||||
``/ndn/edu/memphis/%C1.Router/router1`` will consider FaceUri
|
||||
``udp4://router3.arizona.edu`` for router ``/ndn/edu/arizona/%C1.Router/router3`` and
|
||||
FaceUri ``udp4://79.123.10.145`` for router ``/ndn/edu/colostate/%C1.Router/router2``.
|
||||
|
||||
Step 3: Creating configuration file
|
||||
-----------------------------------
|
||||
|
||||
Now, assume that ``/ndn/memphis.edu/router1`` wants to advertise three name prefixes
|
||||
(``/ndn/memphis/sports/basketball/grizzlies``, ``/ndn/memphis/entertainment/blues``,
|
||||
``/ndn/news/memphis/politics/lutherking``). The configuration file with the necessary
|
||||
configuration commands follows:
|
||||
|
||||
::
|
||||
|
||||
; nlsr.conf starts here
|
||||
; the general section contains all the general settings for router
|
||||
|
||||
general
|
||||
{
|
||||
; mandatory configuration command section network, site and router
|
||||
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/router1 ; name of the network the router belongs to 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
|
||||
|
||||
; 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
|
||||
}
|
||||
|
||||
; the neighbors section contains the configuration for router's neighbors and hello's behavior
|
||||
|
||||
neighbors
|
||||
{
|
||||
; in case hello interest timed out, router will try 'hello-retries' times at 'hello-time-out'
|
||||
; seconds interval before giving up for any neighbors (deciding link is down)
|
||||
|
||||
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
|
||||
; Valid values 1-15
|
||||
|
||||
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 5 ; default value 5. Valid values 0-5. It is recommended that
|
||||
; 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
|
||||
|
||||
first-hello-interval 10 ; Default value 10. Valid values 0-10
|
||||
|
||||
; neighbor command is used to configure router's neighbor. Each neighbor will need
|
||||
; one block of neighbor command
|
||||
|
||||
neighbor
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
neighbor
|
||||
{
|
||||
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
|
||||
link-cost 30 ; cost of the connecting link to neighbor
|
||||
}
|
||||
}
|
||||
|
||||
; the hyperbolic section contains the configuration settings of enabling
|
||||
a router to calculate ; routing table using `hyperbolic routing table
|
||||
calculation`_ method
|
||||
|
||||
hyperbolic
|
||||
{
|
||||
; 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.
|
||||
|
||||
|
||||
radius 123.456 ; radius of the router in hyperbolic coordinate system
|
||||
angle 1.45 ; 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
|
||||
|
||||
fib
|
||||
{
|
||||
; 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
|
||||
|
||||
}
|
||||
|
||||
; the advertising section contains the configuration settings of the
|
||||
name prefixes ; hosted by this router
|
||||
|
||||
advertising
|
||||
{
|
||||
; the ndnname is used to advertised name from the router. To advertise each name prefix
|
||||
; configure one block of ndnname configuration command for every name prefix.
|
||||
|
||||
prefix /ndn/memphis/sports/basketball/grizzlies
|
||||
prefix /ndn/memphis/entertainment/blues
|
||||
prefix /ndn/news/memphis/politics/lutherking
|
||||
}
|
||||
|
||||
.. note::
|
||||
|
||||
Security configuration is discussed in :doc:`SECURITY-CONFIG`, which will be also part
|
||||
of this configuration file
|
||||
|
||||
Step 4: Running NLSR on /ndn/memphis.edu/router1
|
||||
-------------------------------------------------
|
||||
|
||||
Assuming the configuration file is saved as ``nlsr.conf``, type the following to run nlsr:
|
||||
|
||||
::
|
||||
|
||||
$ nlsr -f nlsr.conf
|
||||
|
||||
NLSR will look for nlsr.conf in the current directory. If nlsr.conf is not in the current
|
||||
directory, please provide the absolute path with the file name as the value. If
|
||||
``nlsr.conf`` resides in ``/home/ndnuser/configuration`` directory, type ``nlsr -f
|
||||
/home/ndnuser/configuration/nlsr.conf`` to run nlsr.
|
||||
|
||||
The same process needs to be followed for ``/ndn/arizona.edu/router3`` and
|
||||
``/ndn/colostate.edu/router2`` to run NLSR on these routers.
|
||||
|
||||
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``:
|
||||
|
||||
RIB:
|
||||
|
||||
::
|
||||
|
||||
/ndn/memphis/entertainment/blues route={faceid=17 (origin=128 cost=25 ChildInherit), faceid=7 (origin=128 cost=58 ChildInherit)}
|
||||
/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
|
||||
network figure for face IDs.
|
||||
|
||||
.. _hyperbolic routing table calculation: http://arxiv.org/abs/0805.1266
|
||||
@@ -0,0 +1,62 @@
|
||||
Security Configuration
|
||||
=======================
|
||||
|
||||
.. toctree::
|
||||
..
|
||||
|
||||
The trust model of NLSR is semi-hierarchical. An example certificate signing hierarchy is:
|
||||
|
||||
::
|
||||
|
||||
root
|
||||
|
|
||||
+--------------+---------------+
|
||||
site1 site2
|
||||
| |
|
||||
+---------+---------+ +
|
||||
operator1 operator2 operator3
|
||||
| | |
|
||||
+-----+-----+ +----+-----+ +-----+-----+--------+
|
||||
router1 router2 router3 router4 router5 router6 router7
|
||||
| | | | | | |
|
||||
+ + + + + + +
|
||||
NLSR NSLR NSLR NSLR NSLR NSLR NSLR
|
||||
|
||||
Each entity's name and corresponding certificate name follow the
|
||||
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
|
||||
======== ===================================================== ================================= ===============================================
|
||||
|
||||
Users should create keys according to the naming and signing hierarchies above.
|
||||
|
||||
Certificate Publishing
|
||||
----------------------
|
||||
|
||||
In a network, every router should have the root certificate configured as a trust
|
||||
anchor. For each site, at least one router should publish the site certificate, and at
|
||||
least one router should publish the certificate of the site operator. Each router should
|
||||
publish its own certificate. All this information should be explicitly specified in the
|
||||
nlsr.conf file. For example, the following configuration file indicates that NLSR should
|
||||
publish the site certificate and the router certificate:
|
||||
|
||||
::
|
||||
|
||||
...
|
||||
security
|
||||
{
|
||||
validator
|
||||
{
|
||||
...
|
||||
}
|
||||
cert-to-publish "site.cert" ; name of the file which contains the site certificate (optional).
|
||||
cert-to-publish "router.cert" ; name of the file which contains the router certificate (required).
|
||||
...
|
||||
}
|
||||
Whitespace-only changes.
+254
@@ -0,0 +1,254 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# 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.
|
||||
|
||||
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('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
# -- 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
|
||||
|
||||
# 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 = []
|
||||
|
||||
# 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'
|
||||
|
||||
|
||||
# -- 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 ---------------------------------------
|
||||
|
||||
# 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),
|
||||
]
|
||||
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
if os.getenv('GOOGLE_ANALYTICS', None):
|
||||
googleanalytics_id = os.environ['GOOGLE_ANALYTICS']
|
||||
googleanalytics_enabled = True
|
||||
|
||||
redmine_project_url = "http://redmine.named-data.net/"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,61 @@
|
||||
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/>`_.
|
||||
|
||||
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 `NLSR Wiki`_.
|
||||
|
||||
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
|
||||
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. The protocol design is presented in full detail in
|
||||
the `NLSR Paper`_.
|
||||
|
||||
NLSR Documentation
|
||||
-------------------
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
:maxdepth: 3
|
||||
|
||||
RELEASE-NOTES
|
||||
GETTING-STARTED
|
||||
INSTALL
|
||||
ROUTER-CONFIG
|
||||
SECURITY-CONFIG
|
||||
manpages
|
||||
|
||||
- :doc:`GETTING-STARTED`
|
||||
- :doc:`INSTALL`
|
||||
- :doc:`ROUTER-CONFIG`
|
||||
- :doc:`SECURITY-CONFIG`
|
||||
- :doc:`RELEASE-NOTES`
|
||||
- :doc:`manpages`
|
||||
|
||||
Downloading
|
||||
-----------
|
||||
|
||||
- `GitHub NLSR repository <https://github.com/named-data/NLSR>`_
|
||||
|
||||
Additional information
|
||||
----------------------
|
||||
|
||||
- `NLSR Wiki`_
|
||||
|
||||
- `NLSR Paper`_
|
||||
Detailed explanation of the NLSR design
|
||||
|
||||
|
||||
.. _NLSR Wiki: http://redmine.named-data.net/projects/nlsr
|
||||
.. _NLSR Paper: http://www.cs.memphis.edu/~lanwang/paper/nlsr-final.pdf
|
||||
@@ -0,0 +1,10 @@
|
||||
.. _Manpages:
|
||||
|
||||
Manpages
|
||||
========
|
||||
|
||||
.. toctree::
|
||||
manpages/nlsr
|
||||
manpages/nlsr.conf
|
||||
manpages/nlsrc
|
||||
:maxdepth: 1
|
||||
@@ -0,0 +1,13 @@
|
||||
nlsr.conf
|
||||
=========
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
NLSR config file
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
.. literalinclude:: ../../nlsr.conf
|
||||
:linenos:
|
||||
@@ -0,0 +1,47 @@
|
||||
nlsr
|
||||
====
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
::
|
||||
|
||||
nlsr [options]
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``nlsr`` is a daemon that implements routing protocol in NDN to populates NDN's Routing
|
||||
Information Base.
|
||||
|
||||
Options:
|
||||
--------
|
||||
|
||||
|
||||
``-d``
|
||||
Run in daemon mode
|
||||
|
||||
``-f <FILE>``
|
||||
Specify configuration file name (default: ``./nlsr.conf``)
|
||||
|
||||
``-V``
|
||||
Display version information
|
||||
|
||||
``-h``
|
||||
Display this help message
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
To run NLSR daemon 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
|
||||
@@ -0,0 +1,55 @@
|
||||
nlsrc
|
||||
=====
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
::
|
||||
|
||||
nlsrc [-h] [-V] COMMAND [<Command Options>]
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``nlsrc`` is a tool to retrieve link-state database (LSDB) status information from NLSR and
|
||||
announce/withdraw Name prefixes advertised by NLSR.
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
``-h``
|
||||
Print usage information
|
||||
|
||||
``-V``
|
||||
Show NLSRC version information
|
||||
|
||||
``COMMAND``
|
||||
|
||||
``status``
|
||||
Retrieve LSDB status information
|
||||
|
||||
``advertise``
|
||||
Add a Name prefix to be advertised by NLSR
|
||||
|
||||
``advertise <name>``
|
||||
|
||||
``name``
|
||||
The Name prefix to be advertised
|
||||
|
||||
``withdraw``
|
||||
Remove a Name prefix advertised through NLSR
|
||||
|
||||
``withdraw <name>``
|
||||
|
||||
``name``
|
||||
The Name prefix to be withdrawn
|
||||
|
||||
Exit Status
|
||||
-----------
|
||||
|
||||
nlsrc exits with one of the following values:
|
||||
::
|
||||
|
||||
0 nlsrc exited successfully
|
||||
>0 An error occurred
|
||||
@@ -0,0 +1,96 @@
|
||||
{#
|
||||
named_data_theme/layout.html
|
||||
~~~~~~~~~~~~~~~~~
|
||||
#}
|
||||
{% extends "basic/layout.html" %}
|
||||
|
||||
{% block header %}
|
||||
<!--headercontainer-->
|
||||
<div id="header_container">
|
||||
|
||||
<!--header-->
|
||||
<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>
|
||||
</div><!--logo end-->
|
||||
</div>
|
||||
|
||||
<!--top menu-->
|
||||
<div class="nine columns" id="menu_container" >
|
||||
<h1><a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--header container end-->
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content-wrapper">
|
||||
<div class="content">
|
||||
<div class="document">
|
||||
{%- block document %}
|
||||
{{ super() }}
|
||||
{%- endblock %}
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
{%- block sidebartoc %}
|
||||
<h3>{{ _('Table Of Contents') }}</h3>
|
||||
{{ toctree(includehidden=True) }}
|
||||
|
||||
<h3>{{ _('Additional documenation') }}</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>
|
||||
</ul>
|
||||
{%- endblock %}
|
||||
{%- block sidebarsearch %}
|
||||
<h3 style="margin-top: 1.5em;">{{ _('Search') }}</h3>
|
||||
<form class="search" action="{{ pathto('search') }}" method="get">
|
||||
<input type="text" name="q" />
|
||||
<input type="submit" value="{{ _('Go') }}" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
{{ _('Enter search terms or a module, class or function name.') }}
|
||||
</p>
|
||||
{%- endblock %}
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<div id="footer-container">
|
||||
<!--footer container-->
|
||||
<div class="row">
|
||||
</div><!-- footer container-->
|
||||
</div>
|
||||
|
||||
<div id="footer-info">
|
||||
<!--footer container-->
|
||||
<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>
|
||||
</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 %}
|
||||
{% block relbar2 %}{% endblock %}
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- 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="http://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-->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,41 @@
|
||||
<!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">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="$relpath$jquery.js"></script>
|
||||
<script type="text/javascript" src="$relpath$dynsections.js"></script>
|
||||
$treeview
|
||||
$search
|
||||
$mathjax
|
||||
<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="$relpath$named_data_doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="$relpath$favicon.ico" rel="shortcut icon" type="image/ico" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
|
||||
<!--BEGIN TITLEAREA-->
|
||||
<!--headercontainer-->
|
||||
<div id="header_container">
|
||||
|
||||
<!--header-->
|
||||
<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>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--header container end-->
|
||||
<!--END TITLEAREA-->
|
||||
|
||||
<!-- end header part -->
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 362 B |
@@ -0,0 +1,71 @@
|
||||
* {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
html { font-size: 62.5%; }
|
||||
|
||||
body {
|
||||
font-family: "Verdana", Arial, sans-serif;
|
||||
background-color: #eeeeec;
|
||||
color: #777;
|
||||
border-top: 4px solid #fd7800;
|
||||
}
|
||||
|
||||
body { background: white; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1; color: #222222; position: relative; -webkit-font-smoothing: antialiased; }
|
||||
|
||||
.clearer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.line-block {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.line-block .line-block {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-family: "Georgia", "Times New Roman", serif;
|
||||
font-weight: normal;
|
||||
color: #3465a4;
|
||||
margin-bottom: .8em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #204a87;
|
||||
}
|
||||
|
||||
h2 {
|
||||
padding-bottom: .5em;
|
||||
border-bottom: 1px solid #3465a4;
|
||||
}
|
||||
|
||||
a.headerlink {
|
||||
visibility: hidden;
|
||||
color: #dddddd;
|
||||
padding-left: .3em;
|
||||
}
|
||||
|
||||
h1:hover > a.headerlink,
|
||||
h2:hover > a.headerlink,
|
||||
h3:hover > a.headerlink,
|
||||
h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
* {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
html { font-size: 62.5%; }
|
||||
|
||||
body {
|
||||
font-family: {{ theme_bodyfont }};
|
||||
background-color: {{ theme_bgcolor }};
|
||||
color: #777;
|
||||
border-top: 4px solid #fd7800;
|
||||
}
|
||||
|
||||
body { background: white; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1; color: #222222; position: relative; -webkit-font-smoothing: antialiased; }
|
||||
|
||||
/* Page layout */
|
||||
|
||||
div.header, div.content, div.footer {
|
||||
width: 90%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
div.header-wrapper {
|
||||
background: {{ theme_headerbg }};
|
||||
border-bottom: 3px solid #2e3436;
|
||||
}
|
||||
|
||||
|
||||
/* Default body styles */
|
||||
a {
|
||||
color: {{ theme_linkcolor }};
|
||||
}
|
||||
|
||||
div.bodywrapper a, div.footer a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.clearer {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.line-block {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.line-block .line-block {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-family: {{ theme_headerfont }};
|
||||
font-weight: normal;
|
||||
color: {{ theme_headercolor2 }};
|
||||
margin-bottom: .8em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: {{ theme_headercolor1 }};
|
||||
}
|
||||
|
||||
h2 {
|
||||
padding-bottom: .5em;
|
||||
border-bottom: 1px solid {{ theme_headercolor2 }};
|
||||
}
|
||||
|
||||
a.headerlink {
|
||||
visibility: hidden;
|
||||
color: #dddddd;
|
||||
padding-left: .3em;
|
||||
}
|
||||
|
||||
h1:hover > a.headerlink,
|
||||
h2:hover > a.headerlink,
|
||||
h3:hover > a.headerlink,
|
||||
h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
div.admonition {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 2px 7px 1px 7px;
|
||||
border-left: 0.2em solid black;
|
||||
}
|
||||
|
||||
p.admonition-title {
|
||||
margin: 0px 10px 5px 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
dt:target, .highlighted {
|
||||
background-color: #fbe54e;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
div.header {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
div.header .headertitle {
|
||||
font-family: {{ theme_headerfont }};
|
||||
font-weight: normal;
|
||||
font-size: 180%;
|
||||
letter-spacing: .08em;
|
||||
margin-bottom: .8em;
|
||||
}
|
||||
|
||||
div.header .headertitle a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.header div.rel {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
div.header div.rel a {
|
||||
color: {{ theme_headerlinkcolor }};
|
||||
letter-spacing: .1em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
p.logo {
|
||||
float: right;
|
||||
}
|
||||
|
||||
img.logo {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
||||
/* Content */
|
||||
div.content-wrapper {
|
||||
background-color: white;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
div.document {
|
||||
width: 70%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.body {
|
||||
padding-right: 2em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.document h1 {
|
||||
line-height: 120%;
|
||||
}
|
||||
|
||||
div.document ul {
|
||||
margin-left: 1.5em;
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
div.document dd {
|
||||
margin-left: 1.2em;
|
||||
margin-top: .4em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
div.document .section {
|
||||
margin-top: 1.7em;
|
||||
}
|
||||
div.document .section:first-child {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
div.document div.highlight {
|
||||
padding: 3px;
|
||||
background-color: #eeeeec;
|
||||
border-top: 2px solid #dddddd;
|
||||
border-bottom: 2px solid #dddddd;
|
||||
margin-bottom: .8em;
|
||||
}
|
||||
|
||||
div.document h2 {
|
||||
margin-top: .7em;
|
||||
}
|
||||
|
||||
div.document p {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
div.document li.toctree-l1 {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
div.document .descname {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.document .docutils.literal {
|
||||
background-color: #eeeeec;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
div.document .docutils.xref.literal {
|
||||
background-color: transparent;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
div.document ol {
|
||||
margin: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
/* Sidebar */
|
||||
|
||||
div.sidebar {
|
||||
width: 20%;
|
||||
float: right;
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
div.sidebar a, div.header a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.sidebar a:hover, div.header a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.sidebar h3 {
|
||||
color: #2e3436;
|
||||
text-transform: uppercase;
|
||||
font-size: 130%;
|
||||
letter-spacing: .1em;
|
||||
}
|
||||
|
||||
div.sidebar ul {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
div.sidebar li.toctree-l1 a {
|
||||
display: block;
|
||||
padding: 1px;
|
||||
border: 1px solid #dddddd;
|
||||
background-color: #eeeeec;
|
||||
margin-bottom: .4em;
|
||||
padding-left: 3px;
|
||||
color: #2e3436;
|
||||
}
|
||||
|
||||
div.sidebar li.toctree-l2 a {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
margin-left: 1em;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
div.sidebar li.toctree-l3 a {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
margin-left: 2em;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
div.sidebar li.toctree-l2:last-child a {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
div.sidebar li.toctree-l1.current a {
|
||||
border-right: 5px solid {{ theme_headerlinkcolor }};
|
||||
}
|
||||
|
||||
div.sidebar li.toctree-l1.current li.toctree-l2 a {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
div.sidebar input[type="text"] {
|
||||
width: 170px;
|
||||
}
|
||||
|
||||
div.sidebar input[type="submit"] {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
|
||||
/* Footer */
|
||||
|
||||
div.footer-wrapper {
|
||||
background: {{ theme_footerbg }};
|
||||
border-top: 4px solid #babdb6;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
div.footer, div.footer a {
|
||||
color: #888a85;
|
||||
}
|
||||
|
||||
div.footer .right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.footer .left {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
|
||||
/* Styles copied from basic theme */
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right {
|
||||
clear: right;
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* -- search page ----------------------------------------------------------- */
|
||||
|
||||
ul.search {
|
||||
margin: 10px 0 0 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.search li {
|
||||
padding: 5px 0 5px 20px;
|
||||
background-image: url(file.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 7px;
|
||||
}
|
||||
|
||||
ul.search li a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul.search li div.context {
|
||||
color: #888;
|
||||
margin: 2px 0 0 30px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
ul.keywordmatches li.goodmatch a {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* -- index page ------------------------------------------------------------ */
|
||||
|
||||
table.contentstable {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
table.contentstable p.biglink {
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
a.biglink {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
span.linkdescr {
|
||||
font-style: italic;
|
||||
padding-top: 5px;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
/* -- general index --------------------------------------------------------- */
|
||||
|
||||
table.indextable td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.indextable dl, table.indextable dd {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
table.indextable tr.pcap {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
table.indextable tr.cap {
|
||||
margin-top: 10px;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
img.toggler {
|
||||
margin-right: 3px;
|
||||
margin-top: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* -- viewcode extension ---------------------------------------------------- */
|
||||
|
||||
.viewcode-link {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.viewcode-back {
|
||||
float: right;
|
||||
font-family:: {{ theme_bodyfont }};
|
||||
}
|
||||
|
||||
div.viewcode-block:target {
|
||||
margin: -1px -3px;
|
||||
padding: 0 3px;
|
||||
background-color: #f4debf;
|
||||
border-top: 1px solid #ac9;
|
||||
border-bottom: 1px solid #ac9;
|
||||
}
|
||||
|
||||
td.linenos pre {
|
||||
padding: 5px 0px;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
color: #aaa;
|
||||
margin-top: -10pt;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 635 B |
@@ -0,0 +1,14 @@
|
||||
@import url("agogo.css");
|
||||
|
||||
pre {
|
||||
padding: 10px;
|
||||
background-color: #fafafa;
|
||||
color: #222;
|
||||
line-height: 1.2em;
|
||||
border: 2px solid #C6C9CB;
|
||||
font-size: 1.1em;
|
||||
/* margin: 1.5em 0 1.5em 0; */
|
||||
margin: 0;
|
||||
border-right-style: none;
|
||||
border-left-style: none;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
+788
@@ -0,0 +1,788 @@
|
||||
.c-1, .c-2, .c-3, .c-4, .c-5, .c-6, .c-7, .c-8, .c-9, .c-10, .c-11, .c-12 { float: left; }
|
||||
|
||||
.c-1, .c-2, .c-3, .c-4, .c-5, .c-6, .c-7, .c-8, .c-9, .c-10, .c-11, .c-12 { position: relative; min-height: 1px; padding: 0 15px; }
|
||||
|
||||
.c-1 { width: 8.33333%; }
|
||||
|
||||
.c-2 { width: 16.66667%; }
|
||||
|
||||
.c-3 { width: 25%; }
|
||||
|
||||
.c-4 { width: 33.33333%; }
|
||||
|
||||
.c-5 { width: 41.66667%; }
|
||||
|
||||
.c-6 { width: 50%; }
|
||||
|
||||
.c-7 { width: 58.33333%; }
|
||||
|
||||
.c-8 { width: 66.66667%; }
|
||||
|
||||
.c-9 { width: 75%; }
|
||||
|
||||
.c-10 { width: 83.33333%; }
|
||||
|
||||
.c-11 { width: 91.66667%; }
|
||||
|
||||
.c-12 { width: 100%; }
|
||||
|
||||
/* Requires: normalize.css */
|
||||
/* Global Reset & Standards ---------------------- */
|
||||
* { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
|
||||
|
||||
html { font-size: 62.5%; }
|
||||
|
||||
body { background: white; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1; color: #222222; position: relative; -webkit-font-smoothing: antialiased; }
|
||||
|
||||
/* Links ---------------------- */
|
||||
a { color: #fd7800; text-decoration: none; line-height: inherit; }
|
||||
|
||||
a:hover { color: #2795b6; }
|
||||
|
||||
a:focus { color: #fd7800; outline: none; }
|
||||
|
||||
p a, p a:visited { line-height: inherit; }
|
||||
|
||||
/* Misc ---------------------- */
|
||||
.left { float: left; }
|
||||
@media only screen and (max-width: 767px) { .left { float: none; } }
|
||||
|
||||
.right { float: right; }
|
||||
@media only screen and (max-width: 767px) { .right { float: none; } }
|
||||
|
||||
.text-left { text-align: left; }
|
||||
|
||||
.text-right { text-align: right; }
|
||||
|
||||
.text-center { text-align: center; }
|
||||
|
||||
.hide { display: none; }
|
||||
|
||||
.highlight { background: #ffff99; }
|
||||
|
||||
#googlemap img, object, embed { max-width: none; }
|
||||
|
||||
#map_canvas embed { max-width: none; }
|
||||
|
||||
#map_canvas img { max-width: none; }
|
||||
|
||||
#map_canvas object { max-width: none; }
|
||||
|
||||
/* Reset for strange margins by default on <figure> elements */
|
||||
figure { margin: 0; }
|
||||
|
||||
/* Base Type Styles Using Modular Scale ---------------------- */
|
||||
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, p, blockquote, th, td { margin: 0; padding: 0; font-size: 14px; direction: ltr; }
|
||||
|
||||
p { font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin-bottom: 17px; }
|
||||
p.lead { font-size: 17.5px; line-height: 1.6; margin-bottom: 17px; }
|
||||
|
||||
aside p { font-size: 13px; line-height: 1.35; font-style: italic; }
|
||||
|
||||
h1, h2, h3, h4, h5, h6 { font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-weight: bold; color: #222222; text-rendering: optimizeLegibility; line-height: 1.0; margin-bottom: 14px; margin-top: 14px; }
|
||||
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { font-size: 60%; color: #6f6f6f; line-height: 0; }
|
||||
|
||||
h1 { font-size: 24px; }
|
||||
|
||||
h2 { font-size: 18px; }
|
||||
|
||||
h3 { font-size: 14px; }
|
||||
|
||||
h4 { font-size: 12px; }
|
||||
|
||||
h5 { font-weight: bold; font-size: 12px; }
|
||||
|
||||
h6 { font-style: italic; font-size: 12px; }
|
||||
|
||||
hr { border: solid #c6c6c6; border-width: 1px 0 0; clear: both; margin: 22px 0 21px; height: 0; }
|
||||
|
||||
.subheader { line-height: 1.3; color: #6f6f6f; font-weight: 300; margin-bottom: 17px; }
|
||||
|
||||
em, i { font-style: italic; line-height: inherit; }
|
||||
|
||||
strong, b { font-weight: bold; line-height: inherit; }
|
||||
|
||||
small { font-size: 60%; line-height: inherit; }
|
||||
|
||||
code { font-weight: bold; background: #ffff99; }
|
||||
|
||||
/* Lists ---------------------- */
|
||||
ul, ol { font-size: 14px; line-height: 1.6; margin-bottom: 17px; list-style-position: inside; }
|
||||
|
||||
ul li ul, ul li ol { margin-left: 20px; margin-bottom: 0; }
|
||||
ul.square, ul.circle, ul.disc { margin-left: 17px; }
|
||||
ul.square { list-style-type: square; }
|
||||
ul.square li ul { list-style: inherit; }
|
||||
ul.circle { list-style-type: circle; }
|
||||
ul.circle li ul { list-style: inherit; }
|
||||
ul.disc { list-style-type: disc; }
|
||||
ul.disc li ul { list-style: inherit; }
|
||||
ul.no-bullet { list-style: none; }
|
||||
ul.large li { line-height: 21px; }
|
||||
|
||||
ol li ul, ol li ol { margin-left: 20px; margin-bottom: 0; }
|
||||
|
||||
/* Blockquotes ---------------------- */
|
||||
blockquote, blockquote p { line-height: 1.5; }
|
||||
|
||||
blockquote { margin: 0 0 17px; padding: 9px 20px 0 19px; }
|
||||
blockquote cite { display: block; font-size: 13pt; color: #555555; }
|
||||
blockquote cite:before { content: "\2014 \0020"; }
|
||||
blockquote cite a, blockquote cite a:visited { color: #555555; }
|
||||
|
||||
abbr, acronym { text-transform: uppercase; font-size: 90%; color: #222222; border-bottom: 1px solid #ddd; cursor: help; }
|
||||
|
||||
abbr { text-transform: none; }
|
||||
|
||||
/* Print styles. Inlined to avoid required HTTP connection: www.phpied.com/delay-loading-your-print-css/ Credit to Paul Irish and HTML5 Boilerplate (html5boilerplate.com)
|
||||
*/
|
||||
.print-only { display: none !important; }
|
||||
|
||||
@media print { * { background: transparent !important; color: black !important; box-shadow: none !important; text-shadow: none !important; filter: none !important; -ms-filter: none !important; }
|
||||
/* Black prints faster: h5bp.com/s */
|
||||
a, a:visited { text-decoration: underline; }
|
||||
a[href]:after { content: " (" attr(href) ")"; }
|
||||
abbr[title]:after { content: " (" attr(title) ")"; }
|
||||
.ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; }
|
||||
/* Don't show links for images, or javascript/internal links */
|
||||
pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
|
||||
thead { display: table-header-group; }
|
||||
/* h5bp.com/t */
|
||||
tr, img { page-break-inside: avoid; }
|
||||
img { max-width: 100% !important; }
|
||||
@page { margin: 0.5cm; }
|
||||
p, h2, h3 { orphans: 3; widows: 3; }
|
||||
h2, h3 { page-break-after: avoid; }
|
||||
.hide-on-print { display: none !important; }
|
||||
.print-only { display: block !important; } }
|
||||
/* Requires globals.css */
|
||||
/* Standard Forms ---------------------- */
|
||||
form { margin: 0 0 19.41641px; }
|
||||
|
||||
.row form .row { margin: 0 -6px; }
|
||||
.row form .row .column, .row form .row .columns { padding: 0 6px; }
|
||||
.row form .row.collapse { margin: 0; }
|
||||
.row form .row.collapse .column, .row form .row.collapse .columns { padding: 0; }
|
||||
|
||||
label { font-size: 14px; color: #4d4d4d; cursor: pointer; display: block; font-weight: 500; margin-bottom: 3px; }
|
||||
label.right { float: none; text-align: right; }
|
||||
label.inline { line-height: 32px; margin: 0 0 12px 0; }
|
||||
|
||||
@media only screen and (max-width: 767px) { label.right { text-align: left; } }
|
||||
.prefix, .postfix { display: block; position: relative; z-index: 2; text-align: center; width: 100%; padding-top: 0; padding-bottom: 0; height: 32px; line-height: 31px; }
|
||||
|
||||
a.button.prefix, a.button.postfix { padding-left: 0; padding-right: 0; text-align: center; }
|
||||
|
||||
span.prefix, span.postfix { background: #f2f2f2; border: 1px solid #cccccc; }
|
||||
|
||||
.prefix { left: 2px; -moz-border-radius-topleft: 2px; -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; -moz-border-radius-bottomleft: 2px; -webkit-border-bottom-left-radius: 2px; border-bottom-left-radius: 2px; overflow: hidden; }
|
||||
|
||||
.postfix { right: 2px; -moz-border-radius-topright: 2px; -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; -moz-border-radius-bottomright: 2px; -webkit-border-bottom-right-radius: 2px; border-bottom-right-radius: 2px; }
|
||||
|
||||
input[type="text"], input[type="password"], input[type="date"], input[type="datetime"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], input[type="time"], input[type="url"], textarea { font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; border: 1px solid #cccccc; -webkit-border-radius: 2px; -moz-border-radius: 2px; -ms-border-radius: 2px; -o-border-radius: 2px; border-radius: 2px; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); color: rgba(0, 0, 0, 0.75); display: block; font-size: 14px; margin: 0 0 12px 0; padding: 6px; height: 32px; width: 100%; -webkit-transition: all 0.15s linear; -moz-transition: all 0.15s linear; -o-transition: all 0.15s linear; transition: all 0.15s linear; }
|
||||
input[type="text"].oversize, input[type="password"].oversize, input[type="date"].oversize, input[type="datetime"].oversize, input[type="email"].oversize, input[type="number"].oversize, input[type="search"].oversize, input[type="tel"].oversize, input[type="time"].oversize, input[type="url"].oversize, textarea.oversize { font-size: 17px; padding: 4px 6px; }
|
||||
input[type="text"]:focus, input[type="password"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="time"]:focus, input[type="url"]:focus, textarea:focus { background: #fafafa; outline: none !important; border-color: #b3b3b3; }
|
||||
input[type="text"][disabled], input[type="password"][disabled], input[type="date"][disabled], input[type="datetime"][disabled], input[type="email"][disabled], input[type="number"][disabled], input[type="search"][disabled], input[type="tel"][disabled], input[type="time"][disabled], input[type="url"][disabled], textarea[disabled] { background-color: #ddd; }
|
||||
|
||||
textarea { height: auto; }
|
||||
|
||||
select { width: 100%; }
|
||||
|
||||
/* Fieldsets */
|
||||
fieldset { border: solid 1px #ddd; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; padding: 12px 12px 0; margin: 18px 0; }
|
||||
fieldset legend { font-weight: bold; background: white; padding: 0 3px; margin: 0; margin-left: -3px; }
|
||||
|
||||
/* Errors */
|
||||
.error input, input.error, .error textarea, textarea.error { border-color: #c60f13; background-color: rgba(198, 15, 19, 0.1); }
|
||||
|
||||
.error label, label.error { color: #c60f13; }
|
||||
|
||||
.error small, small.error { display: block; padding: 6px 4px; margin-top: -13px; margin-bottom: 12px; background: #c60f13; color: #fff; font-size: 12px; font-size: 1.2rem; font-weight: bold; -moz-border-radius-bottomleft: 2px; -webkit-border-bottom-left-radius: 2px; border-bottom-left-radius: 2px; -moz-border-radius-bottomright: 2px; -webkit-border-bottom-right-radius: 2px; border-bottom-right-radius: 2px; }
|
||||
|
||||
@media only screen and (max-width: 767px) { input[type="text"].one, input[type="password"].one, input[type="date"].one, input[type="datetime"].one, input[type="email"].one, input[type="number"].one, input[type="search"].one, input[type="tel"].one, input[type="time"].one, input[type="url"].one, textarea.one, .row textarea.one { width: 100% !important; }
|
||||
input[type="text"].two, .row input[type="text"].two, input[type="password"].two, .row input[type="password"].two, input[type="date"].two, .row input[type="date"].two, input[type="datetime"].two, .row input[type="datetime"].two, input[type="email"].two, .row input[type="email"].two, input[type="number"].two, .row input[type="number"].two, input[type="search"].two, .row input[type="search"].two, input[type="tel"].two, .row input[type="tel"].two, input[type="time"].two, .row input[type="time"].two, input[type="url"].two, .row input[type="url"].two, textarea.two, .row textarea.two { width: 100% !important; }
|
||||
input[type="text"].three, .row input[type="text"].three, input[type="password"].three, .row input[type="password"].three, input[type="date"].three, .row input[type="date"].three, input[type="datetime"].three, .row input[type="datetime"].three, input[type="email"].three, .row input[type="email"].three, input[type="number"].three, .row input[type="number"].three, input[type="search"].three, .row input[type="search"].three, input[type="tel"].three, .row input[type="tel"].three, input[type="time"].three, .row input[type="time"].three, input[type="url"].three, .row input[type="url"].three, textarea.three, .row textarea.three { width: 100% !important; }
|
||||
input[type="text"].four, .row input[type="text"].four, input[type="password"].four, .row input[type="password"].four, input[type="date"].four, .row input[type="date"].four, input[type="datetime"].four, .row input[type="datetime"].four, input[type="email"].four, .row input[type="email"].four, input[type="number"].four, .row input[type="number"].four, input[type="search"].four, .row input[type="search"].four, input[type="tel"].four, .row input[type="tel"].four, input[type="time"].four, .row input[type="time"].four, input[type="url"].four, .row input[type="url"].four, textarea.four, .row textarea.four { width: 100% !important; }
|
||||
input[type="text"].five, .row input[type="text"].five, input[type="password"].five, .row input[type="password"].five, input[type="date"].five, .row input[type="date"].five, input[type="datetime"].five, .row input[type="datetime"].five, input[type="email"].five, .row input[type="email"].five, input[type="number"].five, .row input[type="number"].five, input[type="search"].five, .row input[type="search"].five, input[type="tel"].five, .row input[type="tel"].five, input[type="time"].five, .row input[type="time"].five, input[type="url"].five, .row input[type="url"].five, textarea.five, .row textarea.five { width: 100% !important; }
|
||||
input[type="text"].six, .row input[type="text"].six, input[type="password"].six, .row input[type="password"].six, input[type="date"].six, .row input[type="date"].six, input[type="datetime"].six, .row input[type="datetime"].six, input[type="email"].six, .row input[type="email"].six, input[type="number"].six, .row input[type="number"].six, input[type="search"].six, .row input[type="search"].six, input[type="tel"].six, .row input[type="tel"].six, input[type="time"].six, .row input[type="time"].six, input[type="url"].six, .row input[type="url"].six, textarea.six, .row textarea.six { width: 100% !important; }
|
||||
input[type="text"].seven, .row input[type="text"].seven, input[type="password"].seven, .row input[type="password"].seven, input[type="date"].seven, .row input[type="date"].seven, input[type="datetime"].seven, .row input[type="datetime"].seven, input[type="email"].seven, .row input[type="email"].seven, input[type="number"].seven, .row input[type="number"].seven, input[type="search"].seven, .row input[type="search"].seven, input[type="tel"].seven, .row input[type="tel"].seven, input[type="time"].seven, .row input[type="time"].seven, input[type="url"].seven, .row input[type="url"].seven, textarea.seven, .row textarea.seven { width: 100% !important; }
|
||||
input[type="text"].eight, .row input[type="text"].eight, input[type="password"].eight, .row input[type="password"].eight, input[type="date"].eight, .row input[type="date"].eight, input[type="datetime"].eight, .row input[type="datetime"].eight, input[type="email"].eight, .row input[type="email"].eight, input[type="number"].eight, .row input[type="number"].eight, input[type="search"].eight, .row input[type="search"].eight, input[type="tel"].eight, .row input[type="tel"].eight, input[type="time"].eight, .row input[type="time"].eight, input[type="url"].eight, .row input[type="url"].eight, textarea.eight, .row textarea.eight { width: 100% !important; }
|
||||
input[type="text"].nine, .row input[type="text"].nine, input[type="password"].nine, .row input[type="password"].nine, input[type="date"].nine, .row input[type="date"].nine, input[type="datetime"].nine, .row input[type="datetime"].nine, input[type="email"].nine, .row input[type="email"].nine, input[type="number"].nine, .row input[type="number"].nine, input[type="search"].nine, .row input[type="search"].nine, input[type="tel"].nine, .row input[type="tel"].nine, input[type="time"].nine, .row input[type="time"].nine, input[type="url"].nine, .row input[type="url"].nine, textarea.nine, .row textarea.nine { width: 100% !important; }
|
||||
input[type="text"].ten, .row input[type="text"].ten, input[type="password"].ten, .row input[type="password"].ten, input[type="date"].ten, .row input[type="date"].ten, input[type="datetime"].ten, .row input[type="datetime"].ten, input[type="email"].ten, .row input[type="email"].ten, input[type="number"].ten, .row input[type="number"].ten, input[type="search"].ten, .row input[type="search"].ten, input[type="tel"].ten, .row input[type="tel"].ten, input[type="time"].ten, .row input[type="time"].ten, input[type="url"].ten, .row input[type="url"].ten, textarea.ten, .row textarea.ten { width: 100% !important; }
|
||||
input[type="text"].eleven, .row input[type="text"].eleven, input[type="password"].eleven, .row input[type="password"].eleven, input[type="date"].eleven, .row input[type="date"].eleven, input[type="datetime"].eleven, .row input[type="datetime"].eleven, input[type="email"].eleven, .row input[type="email"].eleven, input[type="number"].eleven, .row input[type="number"].eleven, input[type="search"].eleven, .row input[type="search"].eleven, input[type="tel"].eleven, .row input[type="tel"].eleven, input[type="time"].eleven, .row input[type="time"].eleven, input[type="url"].eleven, .row input[type="url"].eleven, textarea.eleven, .row textarea.eleven { width: 100% !important; }
|
||||
input[type="text"].twelve, .row input[type="text"].twelve, input[type="password"].twelve, .row input[type="password"].twelve, input[type="date"].twelve, .row input[type="date"].twelve, input[type="datetime"].twelve, .row input[type="datetime"].twelve, input[type="email"].twelve, .row input[type="email"].twelve, input[type="number"].twelve, .row input[type="number"].twelve, input[type="search"].twelve, .row input[type="search"].twelve, input[type="tel"].twelve, .row input[type="tel"].twelve, input[type="time"].twelve, .row input[type="time"].twelve, input[type="url"].twelve, .row input[type="url"].twelve, textarea.twelve, .row textarea.twelve { width: 100% !important; } }
|
||||
/* Custom Forms ---------------------- */
|
||||
form.custom { /* Custom input, disabled */ }
|
||||
form.custom span.custom { display: inline-block; width: 16px; height: 16px; position: relative; top: 2px; border: solid 1px #ccc; background: #fff; }
|
||||
form.custom span.custom.radio { -webkit-border-radius: 100px; -moz-border-radius: 100px; -ms-border-radius: 100px; -o-border-radius: 100px; border-radius: 100px; }
|
||||
form.custom span.custom.checkbox:before { content: ""; display: block; line-height: 0.8; height: 14px; width: 14px; text-align: center; position: absolute; top: 0; left: 0; font-size: 14px; color: #fff; }
|
||||
form.custom span.custom.radio.checked:before { content: ""; display: block; width: 8px; height: 8px; -webkit-border-radius: 100px; -moz-border-radius: 100px; -ms-border-radius: 100px; -o-border-radius: 100px; border-radius: 100px; background: #222; position: relative; top: 3px; left: 3px; }
|
||||
form.custom span.custom.checkbox.checked:before { content: "\00d7"; color: #222; }
|
||||
form.custom div.custom.dropdown { display: block; position: relative; width: auto; height: 28px; margin-bottom: 9px; margin-top: 2px; }
|
||||
form.custom div.custom.dropdown a.current { display: block; width: auto; line-height: 26px; min-height: 28px; padding: 0; padding-left: 6px; padding-right: 38px; border: solid 1px #ddd; color: #141414; background-color: #fff; white-space: nowrap; }
|
||||
form.custom div.custom.dropdown a.selector { position: absolute; width: 27px; height: 28px; display: block; right: 0; top: 0; border: solid 1px #ddd; }
|
||||
form.custom div.custom.dropdown a.selector:after { content: ""; display: block; content: ""; display: block; width: 0; height: 0; border: solid 5px; border-color: #aaaaaa transparent transparent transparent; position: absolute; left: 50%; top: 50%; margin-top: -2px; margin-left: -5px; }
|
||||
form.custom div.custom.dropdown:hover a.selector:after, form.custom div.custom.dropdown.open a.selector:after { content: ""; display: block; width: 0; height: 0; border: solid 5px; border-color: #222222 transparent transparent transparent; }
|
||||
form.custom div.custom.dropdown.open ul { display: block; z-index: 10; }
|
||||
form.custom div.custom.dropdown.small { width: 134px !important; }
|
||||
form.custom div.custom.dropdown.medium { width: 254px !important; }
|
||||
form.custom div.custom.dropdown.large { width: 434px !important; }
|
||||
form.custom div.custom.dropdown.expand { width: 100% !important; }
|
||||
form.custom div.custom.dropdown.open.small ul { width: 134px !important; }
|
||||
form.custom div.custom.dropdown.open.medium ul { width: 254px !important; }
|
||||
form.custom div.custom.dropdown.open.large ul { width: 434px !important; }
|
||||
form.custom div.custom.dropdown.open.expand ul { width: 100% !important; }
|
||||
form.custom div.custom.dropdown ul { position: absolute; width: auto; display: none; margin: 0; left: 0; top: 27px; margin: 0; padding: 0; background: #fff; background: rgba(255, 255, 255, 0.95); border: solid 1px #cccccc; }
|
||||
form.custom div.custom.dropdown ul li { color: #555; font-size: 13px; cursor: pointer; padding: 3px; padding-left: 6px; padding-right: 38px; min-height: 18px; line-height: 18px; margin: 0; white-space: nowrap; list-style: none; }
|
||||
form.custom div.custom.dropdown ul li.selected { background: #cdebf5; color: #000; }
|
||||
form.custom div.custom.dropdown ul li.selected:after { content: "\2013"; position: absolute; right: 10px; }
|
||||
form.custom div.custom.dropdown ul li:hover { background-color: #e3f4f9; color: #222; }
|
||||
form.custom div.custom.dropdown ul li:hover:after { content: "\2013"; position: absolute; right: 10px; color: #8ed3e7; }
|
||||
form.custom div.custom.dropdown ul li.selected:hover { background: #cdebf5; cursor: default; color: #000; }
|
||||
form.custom div.custom.dropdown ul li.selected:hover:after { color: #000; }
|
||||
form.custom div.custom.dropdown ul.show { display: block; }
|
||||
form.custom .custom.disabled { background-color: #ddd; }
|
||||
|
||||
/* Correct FF custom dropdown height */
|
||||
@-moz-document url-prefix() { form.custom div.custom.dropdown a.selector { height: 30px; } }
|
||||
|
||||
.lt-ie9 form.custom div.custom.dropdown a.selector { height: 30px; }
|
||||
|
||||
/* The Grid ---------------------- */
|
||||
.row { width: 1000px; max-width: 100%; min-width: 768px; margin: 0 auto; }
|
||||
.row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
|
||||
.row.collapse .column, .row.collapse .columns { padding: 0; }
|
||||
.row .row { width: auto; max-width: none; min-width: 0; margin: 0 -15px; }
|
||||
.row .row.collapse { margin: 0; }
|
||||
|
||||
.column, .columns { float: left; min-height: 1px; padding: 0 15px; position: relative; }
|
||||
.column.centered, .columns.centered { float: none; margin: 0 auto; }
|
||||
|
||||
[class*="column"] + [class*="column"]:last-child { float: right; }
|
||||
|
||||
[class*="column"] + [class*="column"].end { float: left; }
|
||||
|
||||
.one, .row .one { width: 8.33333%; }
|
||||
|
||||
.two, .row .two { width: 16.66667%; }
|
||||
|
||||
.three, .row .three { width: 25%; }
|
||||
|
||||
.four, .row .four { width: 33.33333%; }
|
||||
|
||||
.five, .row .five { width: 41.66667%; }
|
||||
|
||||
.six, .row .six { width: 50%; }
|
||||
|
||||
.seven, .row .seven { width: 58.33333%; }
|
||||
|
||||
.eight, .row .eight { width: 66.66667%; }
|
||||
|
||||
.nine, .row .nine { width: 75%; }
|
||||
|
||||
.ten, .row .ten { width: 83.33333%; }
|
||||
|
||||
.eleven, .row .eleven { width: 91.66667%; }
|
||||
|
||||
.twelve, .row .twelve { width: 100%; }
|
||||
|
||||
.row .offset-by-one { margin-left: 8.33333%; }
|
||||
|
||||
.row .offset-by-two { margin-left: 16.66667%; }
|
||||
|
||||
.row .offset-by-three { margin-left: 25%; }
|
||||
|
||||
.row .offset-by-four { margin-left: 33.33333%; }
|
||||
|
||||
.row .offset-by-five { margin-left: 41.66667%; }
|
||||
|
||||
.row .offset-by-six { margin-left: 50%; }
|
||||
|
||||
.row .offset-by-seven { margin-left: 58.33333%; }
|
||||
|
||||
.row .offset-by-eight { margin-left: 66.66667%; }
|
||||
|
||||
.row .offset-by-nine { margin-left: 75%; }
|
||||
|
||||
.row .offset-by-ten { margin-left: 83.33333%; }
|
||||
|
||||
.push-two { left: 16.66667%; }
|
||||
|
||||
.pull-two { right: 16.66667%; }
|
||||
|
||||
.push-three { left: 25%; }
|
||||
|
||||
.pull-three { right: 25%; }
|
||||
|
||||
.push-four { left: 33.33333%; }
|
||||
|
||||
.pull-four { right: 33.33333%; }
|
||||
|
||||
.push-five { left: 41.66667%; }
|
||||
|
||||
.pull-five { right: 41.66667%; }
|
||||
|
||||
.push-six { left: 50%; }
|
||||
|
||||
.pull-six { right: 50%; }
|
||||
|
||||
.push-seven { left: 58.33333%; }
|
||||
|
||||
.pull-seven { right: 58.33333%; }
|
||||
|
||||
.push-eight { left: 66.66667%; }
|
||||
|
||||
.pull-eight { right: 66.66667%; }
|
||||
|
||||
.push-nine { left: 75%; }
|
||||
|
||||
.pull-nine { right: 75%; }
|
||||
|
||||
.push-ten { left: 83.33333%; }
|
||||
|
||||
.pull-ten { right: 83.33333%; }
|
||||
|
||||
img, object, embed { max-width: 100%; height: auto; }
|
||||
|
||||
object, embed { height: 100%; }
|
||||
|
||||
img { -ms-interpolation-mode: bicubic; }
|
||||
|
||||
#map_canvas img, .map_canvas img { max-width: none!important; }
|
||||
|
||||
/* Nicolas Gallagher's micro clearfix */
|
||||
.row { *zoom: 1; }
|
||||
.row:before, .row:after { content: ""; display: table; }
|
||||
.row:after { clear: both; }
|
||||
|
||||
/* Mobile Grid and Overrides ---------------------- */
|
||||
@media only screen and (max-width: 767px) { body { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; width: 100%; min-width: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
|
||||
.row { width: auto; min-width: 0; margin-left: 0; margin-right: 0; }
|
||||
.column, .columns { width: auto !important; float: none; }
|
||||
.column:last-child, .columns:last-child { float: none; }
|
||||
[class*="column"] + [class*="column"]:last-child { float: none; }
|
||||
.column:before, .columns:before, .column:after, .columns:after { content: ""; display: table; }
|
||||
.column:after, .columns:after { clear: both; }
|
||||
.offset-by-one, .offset-by-two, .offset-by-three, .offset-by-four, .offset-by-five, .offset-by-six, .offset-by-seven, .offset-by-eight, .offset-by-nine, .offset-by-ten { margin-left: 0 !important; }
|
||||
.push-two, .push-three, .push-four, .push-five, .push-six, .push-seven, .push-eight, .push-nine, .push-ten { left: auto; }
|
||||
.pull-two, .pull-three, .pull-four, .pull-five, .pull-six, .pull-seven, .pull-eight, .pull-nine, .pull-ten { right: auto; }
|
||||
/* Mobile 4-column Grid */
|
||||
.row .mobile-one { width: 25% !important; float: left; padding: 0 15px; }
|
||||
.row .mobile-one:last-child { float: right; }
|
||||
.row.collapse .mobile-one { padding: 0; }
|
||||
.row .mobile-two { width: 50% !important; float: left; padding: 0 15px; }
|
||||
.row .mobile-two:last-child { float: right; }
|
||||
.row.collapse .mobile-two { padding: 0; }
|
||||
.row .mobile-three { width: 75% !important; float: left; padding: 0 15px; }
|
||||
.row .mobile-three:last-child { float: right; }
|
||||
.row.collapse .mobile-three { padding: 0; }
|
||||
.row .mobile-four { width: 100% !important; float: left; padding: 0 15px; }
|
||||
.row .mobile-four:last-child { float: right; }
|
||||
.row.collapse .mobile-four { padding: 0; }
|
||||
.push-one-mobile { left: 25%; }
|
||||
.pull-one-mobile { right: 25%; }
|
||||
.push-two-mobile { left: 50%; }
|
||||
.pull-two-mobile { right: 50%; }
|
||||
.push-three-mobile { left: 75%; }
|
||||
.pull-three-mobile { right: 75%; } }
|
||||
/* Block Grids ---------------------- */
|
||||
/* These are 2-up, 3-up, 4-up and 5-up ULs, suited
|
||||
for repeating blocks of content. Add 'mobile' to
|
||||
them to switch them just like the layout grid
|
||||
(one item per line) on phones
|
||||
|
||||
For IE7/8 compatibility block-grid items need to be
|
||||
the same height. You can optionally uncomment the
|
||||
lines below to support arbitrary height, but know
|
||||
that IE7/8 do not support :nth-child.
|
||||
-------------------------------------------------- */
|
||||
.block-grid { display: block; overflow: hidden; padding: 0; }
|
||||
.block-grid > li { display: block; height: auto; float: left; }
|
||||
.block-grid.one-up { margin: 0; }
|
||||
.block-grid.one-up > li { width: 100%; padding: 0 0 15px; }
|
||||
.block-grid.two-up { margin: 0 -15px; }
|
||||
.block-grid.two-up > li { width: 50%; padding: 0 15px 15px; }
|
||||
.block-grid.two-up > li:nth-child(2n+1) { clear: both; }
|
||||
.block-grid.three-up { margin: 0 -12px; }
|
||||
.block-grid.three-up > li { width: 33.33%; padding: 0 12px 12px; }
|
||||
.block-grid.three-up > li:nth-child(3n+1) { clear: both; }
|
||||
.block-grid.four-up { margin: 0 -10px; }
|
||||
.block-grid.four-up > li { width: 25%; padding: 0 10px 10px; }
|
||||
.block-grid.four-up > li:nth-child(4n+1) { clear: both; }
|
||||
.block-grid.five-up { margin: 0 -8px; }
|
||||
.block-grid.five-up > li { width: 20%; padding: 0 8px 8px; }
|
||||
.block-grid.five-up > li:nth-child(5n+1) { clear: both; }
|
||||
|
||||
/* Mobile Block Grids */
|
||||
@media only screen and (max-width: 767px) { .block-grid.mobile > li { float: none; width: 100%; margin-left: 0; }
|
||||
.block-grid > li { clear: none !important; }
|
||||
.block-grid.mobile-two-up > li { width: 50%; }
|
||||
.block-grid.mobile-two-up > li:nth-child(2n+1) { clear: both; }
|
||||
.block-grid.mobile-three-up > li { width: 33.33%; }
|
||||
.block-grid.mobile-three-up > li:nth-child(3n+1) { clear: both !important; }
|
||||
.block-grid.mobile-four-up > li { width: 25%; }
|
||||
.block-grid.mobile-four-up > li:nth-child(4n+1) { clear: both; }
|
||||
.block-grid.mobile-five-up > li:nth-child(5n+1) { clear: both; } }
|
||||
/* Requires globals.css */
|
||||
/* Normal Buttons ---------------------- */
|
||||
.button { width: auto; background: #fd7800; border: 1px solid #ce6200; -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; color: white; cursor: pointer; display: inline-block; font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold; line-height: 1; margin: 0; outline: none; padding: 10px 20px 11px; position: relative; text-align: center; text-decoration: none; -webkit-transition: background-color 0.15s ease-in-out; -moz-transition: background-color 0.15s ease-in-out; -o-transition: background-color 0.15s ease-in-out; transition: background-color 0.15s ease-in-out; /* Hovers */ /* Sizes */ /* Colors */ /* Radii */ /* Layout */ /* Disabled ---------- */ }
|
||||
.button:hover { color: white; background-color: #ce6200; }
|
||||
.button:active { -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) inset; -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) inset; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) inset; }
|
||||
.button:focus { -webkit-box-shadow: 0 0 4px #fd7800, 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 0 4px #fd7800, 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 0 4px #fd7800, 0 1px 0 rgba(255, 255, 255, 0.5) inset; color: white; }
|
||||
.button.large { font-size: 17px; padding: 15px 30px 16px; }
|
||||
.button.medium { font-size: 14px; }
|
||||
.button.small { font-size: 11px; padding: 7px 14px 8px; }
|
||||
.button.tiny { font-size: 10px; padding: 5px 10px 6px; }
|
||||
.button.expand { width: 100%; text-align: center; }
|
||||
.button.primary { background-color: #fd7800; border: 1px solid #1e728c; }
|
||||
.button.primary:hover { background-color: #2284a1; }
|
||||
.button.primary:focus { -webkit-box-shadow: 0 0 4px #fd7800, 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 0 4px #fd7800, 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 0 4px #fd7800, 0 1px 0 rgba(255, 255, 255, 0.5) inset; }
|
||||
.button.success { background-color: #5da423; border: 1px solid #396516; }
|
||||
.button.success:hover { background-color: #457a1a; }
|
||||
.button.success:focus { -webkit-box-shadow: 0 0 5px #5da423, 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 0 5px #5da423, 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 0 5px #5da423, 0 1px 0 rgba(255, 255, 255, 0.5) inset; }
|
||||
.button.alert { background-color: #c60f13; border: 1px solid #7f0a0c; }
|
||||
.button.alert:hover { background-color: #970b0e; }
|
||||
.button.alert:focus { -webkit-box-shadow: 0 0 4px #c60f13, 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 0 4px #c60f13, 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 0 4px #c60f13, 0 1px 0 rgba(255, 255, 255, 0.5) inset; }
|
||||
.button.secondary { background-color: #e9e9e9; color: #1d1d1d; border: 1px solid #c3c3c3; }
|
||||
.button.secondary:hover { background-color: #d0d0d0; }
|
||||
.button.secondary:focus { -webkit-box-shadow: 0 0 5px #e9e9e9, 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 0 5px #e9e9e9, 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 0 5px #e9e9e9, 0 1px 0 rgba(255, 255, 255, 0.5) inset; }
|
||||
.button.radius { -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
.button.round { -webkit-border-radius: 1000px; -moz-border-radius: 1000px; -ms-border-radius: 1000px; -o-border-radius: 1000px; border-radius: 1000px; }
|
||||
.button.full-width { width: 100%; text-align: center; padding-left: 0px !important; padding-right: 0px !important; }
|
||||
.button.left-align { text-align: left; text-indent: 12px; }
|
||||
.button.disabled, .button[disabled] { opacity: 0.6; cursor: default; background: #fd7800; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; }
|
||||
.button.disabled :hover, .button[disabled] :hover { background: #fd7800; }
|
||||
.button.disabled.success, .button[disabled].success { background-color: #5da423; }
|
||||
.button.disabled.success:hover, .button[disabled].success:hover { background-color: #5da423; }
|
||||
.button.disabled.alert, .button[disabled].alert { background-color: #c60f13; }
|
||||
.button.disabled.alert:hover, .button[disabled].alert:hover { background-color: #c60f13; }
|
||||
.button.disabled.secondary, .button[disabled].secondary { background-color: #e9e9e9; }
|
||||
.button.disabled.secondary:hover, .button[disabled].secondary:hover { background-color: #e9e9e9; }
|
||||
|
||||
/* Don't use native buttons on iOS */
|
||||
input[type=submit].button, button.button { -webkit-appearance: none; }
|
||||
|
||||
@media only screen and (max-width: 767px) { .button { display: block; }
|
||||
button.button, input[type="submit"].button { width: 100%; padding-left: 0; padding-right: 0; } }
|
||||
/* Correct FF button padding */
|
||||
@-moz-document url-prefix() { button::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner, input[type="file"] > input[type="button"]::-moz-focus-inner { border: none; padding: 0; }
|
||||
input[type="submit"].tiny.button { padding: 3px 10px 4px; }
|
||||
input[type="submit"].small.button { padding: 5px 14px 6px; }
|
||||
input[type="submit"].button, input[type=submit].medium.button { padding: 8px 20px 9px; }
|
||||
input[type="submit"].large.button { padding: 13px 30px 14px; } }
|
||||
|
||||
/* Buttons with Dropdowns ---------------------- */
|
||||
.button.dropdown { position: relative; padding-right: 44px; /* Sizes */ /* Triangles */ /* Flyout List */ /* Split Dropdown Buttons */ }
|
||||
.button.dropdown.large { padding-right: 60px; }
|
||||
.button.dropdown.small { padding-right: 28px; }
|
||||
.button.dropdown.tiny { padding-right: 20px; }
|
||||
.button.dropdown:after { content: ""; display: block; width: 0; height: 0; border: solid 6px; border-color: white transparent transparent transparent; position: absolute; top: 50%; right: 20px; margin-top: -2px; }
|
||||
.button.dropdown.large:after { content: ""; display: block; width: 0; height: 0; border: solid 7px; border-color: white transparent transparent transparent; margin-top: -3px; right: 30px; }
|
||||
.button.dropdown.small:after { content: ""; display: block; width: 0; height: 0; border: solid 5px; border-color: white transparent transparent transparent; margin-top: -2px; right: 14px; }
|
||||
.button.dropdown.tiny:after { content: ""; display: block; width: 0; height: 0; border: solid 4px; border-color: white transparent transparent transparent; margin-top: -1px; right: 10px; }
|
||||
.button.dropdown > ul { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; display: none; position: absolute; left: -1px; background: #fff; background: rgba(255, 255, 255, 0.95); list-style: none; margin: 0; padding: 0; border: 1px solid #cccccc; border-top: none; min-width: 100%; z-index: 40; }
|
||||
.button.dropdown > ul li { width: 100%; cursor: pointer; padding: 0; min-height: 18px; line-height: 18px; margin: 0; white-space: nowrap; list-style: none; }
|
||||
.button.dropdown > ul li a { display: block; color: #555; font-size: 13px; font-weight: normal; padding: 6px 14px; text-align: left; }
|
||||
.button.dropdown > ul li:hover { background-color: #e3f4f9; color: #222; }
|
||||
.button.dropdown > ul li.divider { min-height: 0; padding: 0; height: 1px; margin: 4px 0; background: #ededed; }
|
||||
.button.dropdown.up > ul { border-top: 1px solid #cccccc; border-bottom: none; }
|
||||
.button.dropdown ul.no-hover.show-dropdown { display: block !important; }
|
||||
.button.dropdown:hover > ul.no-hover { display: none; }
|
||||
.button.dropdown.split { padding: 0; position: relative; /* Sizes */ /* Triangle Spans */ /* Colors */ }
|
||||
.button.dropdown.split:after { display: none; }
|
||||
.button.dropdown.split:hover { background-color: #fd7800; }
|
||||
.button.dropdown.split.alert:hover { background-color: #c60f13; }
|
||||
.button.dropdown.split.success:hover { background-color: #5da423; }
|
||||
.button.dropdown.split.secondary:hover { background-color: #e9e9e9; }
|
||||
.button.dropdown.split > a { color: white; display: block; padding: 10px 50px 11px 20px; padding-left: 20px; padding-right: 50px; -webkit-transition: background-color 0.15s ease-in-out; -moz-transition: background-color 0.15s ease-in-out; -o-transition: background-color 0.15s ease-in-out; transition: background-color 0.15s ease-in-out; }
|
||||
.button.dropdown.split > a:hover { background-color: #2284a1; }
|
||||
.button.dropdown.split.large > a { padding: 15px 75px 16px 30px; padding-left: 30px; padding-right: 75px; }
|
||||
.button.dropdown.split.small > a { padding: 7px 35px 8px 14px; padding-left: 14px; padding-right: 35px; }
|
||||
.button.dropdown.split.tiny > a { padding: 5px 25px 6px 10px; padding-left: 10px; padding-right: 25px; }
|
||||
.button.dropdown.split > span { background-color: #fd7800; position: absolute; right: 0; top: 0; height: 100%; width: 30px; border-left: 1px solid #1e728c; -webkit-box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5) inset; -webkit-transition: background-color 0.15s ease-in-out; -moz-transition: background-color 0.15s ease-in-out; -o-transition: background-color 0.15s ease-in-out; transition: background-color 0.15s ease-in-out; }
|
||||
.button.dropdown.split > span:hover { background-color: #2284a1; }
|
||||
.button.dropdown.split > span:after { content: ""; display: block; width: 0; height: 0; border: solid 6px; border-color: white transparent transparent transparent; position: absolute; top: 50%; left: 50%; margin-left: -6px; margin-top: -2px; }
|
||||
.button.dropdown.split.secondary > span:after { content: ""; display: block; width: 0; height: 0; border: solid 6px; border-color: #1d1d1d transparent transparent transparent; }
|
||||
.button.dropdown.split.large span { width: 45px; }
|
||||
.button.dropdown.split.small span { width: 21px; }
|
||||
.button.dropdown.split.tiny span { width: 15px; }
|
||||
.button.dropdown.split.large span:after { content: ""; display: block; width: 0; height: 0; border: solid 7px; border-color: white transparent transparent transparent; margin-top: -3px; margin-left: -7px; }
|
||||
.button.dropdown.split.small span:after { content: ""; display: block; width: 0; height: 0; border: solid 4px; border-color: white transparent transparent transparent; margin-top: -1px; margin-left: -4px; }
|
||||
.button.dropdown.split.tiny span:after { content: ""; display: block; width: 0; height: 0; border: solid 3px; border-color: white transparent transparent transparent; margin-top: -1px; margin-left: -3px; }
|
||||
.button.dropdown.split.alert > span { background-color: #c60f13; border-left-color: #7f0a0c; }
|
||||
.button.dropdown.split.success > span { background-color: #5da423; border-left-color: #396516; }
|
||||
.button.dropdown.split.secondary > span { background-color: #e9e9e9; border-left-color: #c3c3c3; }
|
||||
.button.dropdown.split.secondary > a { color: #1d1d1d; }
|
||||
.button.dropdown.split.alert > a:hover, .button.dropdown.split.alert > span:hover { background-color: #970b0e; }
|
||||
.button.dropdown.split.success > a:hover, .button.dropdown.split.success > span:hover { background-color: #457a1a; }
|
||||
.button.dropdown.split.secondary > a:hover, .button.dropdown.split.secondary > span:hover { background-color: #d0d0d0; }
|
||||
|
||||
/* Button Groups ---------------------- */
|
||||
ul.button-group { list-style: none; padding: 0; margin: 0 0 12px; *zoom: 1; }
|
||||
ul.button-group:before, ul.button-group:after { content: ""; display: table; }
|
||||
ul.button-group:after { clear: both; }
|
||||
ul.button-group li { padding: 0; margin: 0 0 0 -1px; float: left; }
|
||||
ul.button-group li:first-child { margin-left: 0; }
|
||||
ul.button-group.radius li a.button, ul.button-group.radius li a.button.radius, ul.button-group.radius li a.button-rounded { -webkit-border-radius: 0px; -moz-border-radius: 0px; -ms-border-radius: 0px; -o-border-radius: 0px; border-radius: 0px; }
|
||||
ul.button-group.radius li:first-child a.button, ul.button-group.radius li:first-child a.button.radius { -moz-border-radius-left3px: 5px; -webkit-border-left-3px-radius: 5px; border-left-3px-radius: 5px; }
|
||||
ul.button-group.radius li:first-child a.button.rounded { -moz-border-radius-left1000px: 5px; -webkit-border-left-1000px-radius: 5px; border-left-1000px-radius: 5px; }
|
||||
ul.button-group.radius li:last-child a.button, ul.button-group.radius li:last-child a.button.radius { -moz-border-radius-right3px: 5px; -webkit-border-right-3px-radius: 5px; border-right-3px-radius: 5px; }
|
||||
ul.button-group.radius li:last-child a.button.rounded { -moz-border-radius-right1000px: 5px; -webkit-border-right-1000px-radius: 5px; border-right-1000px-radius: 5px; }
|
||||
ul.button-group.even a.button { width: 100%; }
|
||||
ul.button-group.even.two-up li { width: 50%; }
|
||||
ul.button-group.even.three-up li { width: 33.3%; }
|
||||
ul.button-group.even.three-up li:first-child { width: 33.4%; }
|
||||
ul.button-group.even.four-up li { width: 25%; }
|
||||
ul.button-group.even.five-up li { width: 20%; }
|
||||
|
||||
@media only screen and (max-width: 767px) { .button-group button.button, .button-group input[type="submit"].button { width: auto; padding: 10px 20px 11px; }
|
||||
.button-group button.button.large, .button-group input[type="submit"].button.large { padding: 15px 30px 16px; }
|
||||
.button-group button.button.medium, .button-group input[type="submit"].button.medium { padding: 10px 20px 11px; }
|
||||
.button-group button.button.small, .button-group input[type="submit"].button.small { padding: 7px 14px 8px; }
|
||||
.button-group button.button.tiny, .button-group input[type="submit"].button.tiny { padding: 5px 10px 6px; }
|
||||
.button-group.even button.button, .button-group.even input[type="submit"].button { width: 100%; padding-left: 0; padding-right: 0; } }
|
||||
div.button-bar { overflow: hidden; }
|
||||
div.button-bar ul.button-group { float: left; margin-right: 8px; }
|
||||
div.button-bar ul.button-group:last-child { margin-left: 0; }
|
||||
|
||||
/* CSS for jQuery Reveal Plugin Maintained for Foundation. foundation.zurb.com Free to use under the MIT license. http://www.opensource.org/licenses/mit-license.php */
|
||||
/* Reveal Modals ---------------------- */
|
||||
.reveal-modal-bg { position: fixed; height: 100%; width: 100%; background: #000; background: rgba(0, 0, 0, 0.45); z-index: 40; display: none; top: 0; left: 0; }
|
||||
|
||||
.reveal-modal { background: white; visibility: hidden; display: none; top: 100px; left: 50%; margin-left: -260px; width: 520px; position: absolute; z-index: 41; padding: 30px; -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); }
|
||||
.reveal-modal *:first-child { margin-top: 0; }
|
||||
.reveal-modal *:last-child { margin-bottom: 0; }
|
||||
.reveal-modal .close-reveal-modal { font-size: 22px; font-size: 2.2rem; line-height: .5; position: absolute; top: 8px; right: 11px; color: #aaa; text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6); font-weight: bold; cursor: pointer; }
|
||||
.reveal-modal.small { width: 30%; margin-left: -15%; }
|
||||
.reveal-modal.medium { width: 40%; margin-left: -20%; }
|
||||
.reveal-modal.large { width: 60%; margin-left: -30%; }
|
||||
.reveal-modal.xlarge { width: 70%; margin-left: -35%; }
|
||||
.reveal-modal.expand { width: 90%; margin-left: -45%; }
|
||||
.reveal-modal .row { min-width: 0; margin-bottom: 10px; }
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-width: 767px) { .reveal-modal-bg { position: absolute; }
|
||||
.reveal-modal, .reveal-modal.small, .reveal-modal.medium, .reveal-modal.large, .reveal-modal.xlarge { width: 80%; top: 15px; left: 50%; margin-left: -40%; padding: 20px; height: auto; } }
|
||||
/* NOTES Close button entity is ×
|
||||
Example markup <div id="myModal" class="reveal-modal"> <h2>Awesome. I have it.</h2> <p class="lead">Your couch. I it's mine.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultrices aliquet placerat. Duis pulvinar orci et nisi euismod vitae tempus lorem consectetur. Duis at magna quis turpis mattis venenatis eget id diam. </p> <a class="close-reveal-modal">×</a> </div> */
|
||||
/* Requires -globals.css -app.js */
|
||||
/* Tabs ---------------------- */
|
||||
dl.tabs { border-bottom: solid 1px #e6e6e6; display: block; height: 40px; padding: 0; margin-bottom: 20px; }
|
||||
dl.tabs.contained { margin-bottom: 0; }
|
||||
dl.tabs dt { color: #b3b3b3; cursor: default; display: block; float: left; font-size: 12px; height: 40px; line-height: 40px; padding: 0; padding-right: 9px; padding-left: 20px; width: auto; text-transform: uppercase; }
|
||||
dl.tabs dt:first-child { padding: 0; padding-right: 9px; }
|
||||
dl.tabs dd { display: block; float: left; padding: 0; margin: 0; }
|
||||
dl.tabs dd a { color: #6f6f6f; display: block; font-size: 14px; height: 40px; line-height: 40px; padding: 0px 23.8px; }
|
||||
dl.tabs dd a:focus { font-weight: bold; color: #fd7800; }
|
||||
dl.tabs dd.active { border-top: 3px solid #fd7800; margin-top: -3px; }
|
||||
dl.tabs dd.active a { cursor: default; color: #3c3c3c; background: #fff; border-left: 1px solid #e6e6e6; border-right: 1px solid #e6e6e6; font-weight: bold; }
|
||||
dl.tabs dd:first-child { margin-left: 0; }
|
||||
dl.tabs.vertical { height: auto; border-bottom: 1px solid #e6e6e6; }
|
||||
dl.tabs.vertical dt, dl.tabs.vertical dd { float: none; height: auto; }
|
||||
dl.tabs.vertical dd { border-left: 3px solid #cccccc; }
|
||||
dl.tabs.vertical dd a { background: #f2f2f2; border: none; border: 1px solid #e6e6e6; border-width: 1px 1px 0 0; color: #555; display: block; font-size: 14px; height: auto; line-height: 1; padding: 15px 20px; -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; }
|
||||
dl.tabs.vertical dd.active { margin-top: 0; border-top: 1px solid #4d4d4d; border-left: 4px solid #1a1a1a; }
|
||||
dl.tabs.vertical dd.active a { background: #4d4d4d; border: none; color: #fff; height: auto; margin: 0; position: static; top: 0; -webkit-box-shadow: 0 0 0; -moz-box-shadow: 0 0 0; box-shadow: 0 0 0; }
|
||||
dl.tabs.vertical dd:first-child a.active { margin: 0; }
|
||||
dl.tabs.pill { border-bottom: none; margin-bottom: 10px; }
|
||||
dl.tabs.pill dd { margin-right: 10px; }
|
||||
dl.tabs.pill dd:last-child { margin-right: 0; }
|
||||
dl.tabs.pill dd a { -webkit-border-radius: 1000px; -moz-border-radius: 1000px; -ms-border-radius: 1000px; -o-border-radius: 1000px; border-radius: 1000px; background: #e6e6e6; height: 26px; line-height: 26px; color: #666; }
|
||||
dl.tabs.pill dd.active { border: none; margin-top: 0; }
|
||||
dl.tabs.pill dd.active a { background-color: #fd7800; border: none; color: #fff; }
|
||||
dl.tabs.pill.contained { border-bottom: solid 1px #eee; margin-bottom: 0; }
|
||||
dl.tabs.pill.two-up dd, dl.tabs.pill.three-up dd, dl.tabs.pill.four-up dd, dl.tabs.pill.five-up dd { margin-right: 0; }
|
||||
dl.tabs.two-up dt a, dl.tabs.two-up dd a, dl.tabs.three-up dt a, dl.tabs.three-up dd a, dl.tabs.four-up dt a, dl.tabs.four-up dd a, dl.tabs.five-up dt a, dl.tabs.five-up dd a { padding: 0 17px; text-align: center; overflow: hidden; }
|
||||
dl.tabs.two-up dt, dl.tabs.two-up dd { width: 50%; }
|
||||
dl.tabs.three-up dt, dl.tabs.three-up dd { width: 33.33%; }
|
||||
dl.tabs.four-up dt, dl.tabs.four-up dd { width: 25%; }
|
||||
dl.tabs.five-up dt, dl.tabs.five-up dd { width: 20%; }
|
||||
|
||||
ul.tabs-content { display: block; margin: 0 0 20px; padding: 0; }
|
||||
ul.tabs-content > li { display: none; }
|
||||
ul.tabs-content > li.active { display: block; }
|
||||
ul.tabs-content.contained { padding: 0; }
|
||||
ul.tabs-content.contained > li { border: solid 0 #e6e6e6; border-width: 0 1px 1px 1px; padding: 20px; }
|
||||
ul.tabs-content.contained.vertical > li { border-width: 1px 1px 1px 1px; }
|
||||
|
||||
.no-js ul.tabs-content > li { display: block; }
|
||||
|
||||
@media only screen and (max-width: 767px) { dl.tabs.mobile { width: auto; margin: 20px -20px 40px; height: auto; }
|
||||
dl.tabs.mobile dt, dl.tabs.mobile dd { float: none; height: auto; }
|
||||
dl.tabs.mobile dd a { display: block; width: auto; height: auto; padding: 18px 20px; line-height: 1; border: solid 0 #ccc; border-width: 1px 0 0; margin: 0; color: #555; background: #eee; font-size: 15px; font-size: 1.5rem; }
|
||||
dl.tabs.mobile dd a.active { height: auto; margin: 0; border-width: 1px 0 0; }
|
||||
.tabs.mobile { border-bottom: solid 1px #ccc; height: auto; }
|
||||
.tabs.mobile dd a { padding: 18px 20px; border: none; border-left: none; border-right: none; border-top: 1px solid #ccc; background: #fff; }
|
||||
.tabs.mobile dd a.active { border: none; background: #fd7800; color: #fff; margin: 0; position: static; top: 0; height: auto; }
|
||||
.tabs.mobile dd:first-child a.active { margin: 0; }
|
||||
dl.contained.mobile { margin-bottom: 0; }
|
||||
dl.contained.tabs.mobile dd a { padding: 18px 20px; }
|
||||
dl.tabs.mobile + ul.contained { margin-left: -20px; margin-right: -20px; border-width: 0 0 1px 0; } }
|
||||
/* Requires: globals.css */
|
||||
/* Table of Contents
|
||||
|
||||
:: Visibility
|
||||
:: Alerts
|
||||
:: Labels
|
||||
:: Tooltips
|
||||
:: Panels
|
||||
:: Accordion
|
||||
:: Side Nav
|
||||
:: Sub Nav
|
||||
:: Pagination
|
||||
:: Breadcrumbs
|
||||
:: Lists
|
||||
:: Link Lists
|
||||
:: Keystroke Chars
|
||||
:: Image Thumbnails
|
||||
:: Video
|
||||
:: Tables
|
||||
:: Microformats
|
||||
:: Progress Bars
|
||||
|
||||
*/
|
||||
/* Visibility Classes ---------------------- */
|
||||
/* Standard (large) display targeting */
|
||||
.show-for-small, .show-for-medium, .show-for-medium-down, .hide-for-large, .hide-for-large-up, .show-for-xlarge { display: none !important; }
|
||||
|
||||
.hide-for-xlarge, .show-for-large, .show-for-large-up, .hide-for-small, .hide-for-medium, .hide-for-medium-down { display: block !important; }
|
||||
|
||||
/* Very large display targeting */
|
||||
@media only screen and (min-width: 1441px) { .hide-for-small, .hide-for-medium, .hide-for-medium-down, .hide-for-large, .show-for-large-up, .show-for-xlarge { display: block !important; }
|
||||
.show-for-small, .show-for-medium, .show-for-medium-down, .show-for-large, .hide-for-large-up, .hide-for-xlarge { display: none !important; } }
|
||||
/* Medium display targeting */
|
||||
@media only screen and (max-width: 1279px) and (min-width: 768px) { .hide-for-small, .show-for-medium, .show-for-medium-down, .hide-for-large, .hide-for-large-up, .hide-for-xlarge { display: block !important; }
|
||||
.show-for-small, .hide-for-medium, .hide-for-medium-down, .show-for-large, .show-for-large-up, .show-for-xlarge { display: none !important; } }
|
||||
/* Small display targeting */
|
||||
@media only screen and (max-width: 767px) { .show-for-small, .hide-for-medium, .show-for-medium-down, .hide-for-large, .hide-for-large-up, .hide-for-xlarge { display: block !important; }
|
||||
.hide-for-small, .show-for-medium, .hide-for-medium-down, .show-for-large, .show-for-large-up, .show-for-xlarge { display: none !important; } }
|
||||
/* Orientation targeting */
|
||||
.show-for-landscape, .hide-for-portrait { display: block !important; }
|
||||
|
||||
.hide-for-landscape, .show-for-portrait { display: none !important; }
|
||||
|
||||
@media screen and (orientation: landscape) { .show-for-landscape, .hide-for-portrait { display: block !important; }
|
||||
.hide-for-landscape, .show-for-portrait { display: none !important; } }
|
||||
@media screen and (orientation: portrait) { .show-for-portrait, .hide-for-landscape { display: block !important; }
|
||||
.hide-for-portrait, .show-for-landscape { display: none !important; } }
|
||||
/* Touch-enabled device targeting */
|
||||
.show-for-touch { display: none !important; }
|
||||
|
||||
.hide-for-touch { display: block !important; }
|
||||
|
||||
.touch .show-for-touch { display: block !important; }
|
||||
|
||||
.touch .hide-for-touch { display: none !important; }
|
||||
|
||||
/* Specific overrides for elements that require something other than display: block */
|
||||
table.show-for-xlarge, table.show-for-large, table.hide-for-small, table.hide-for-medium { display: table !important; }
|
||||
|
||||
@media only screen and (max-width: 1279px) and (min-width: 768px) { .touch table.hide-for-xlarge, .touch table.hide-for-large, .touch table.hide-for-small, .touch table.show-for-medium { display: table !important; } }
|
||||
@media only screen and (max-width: 767px) { table.hide-for-xlarge, table.hide-for-large, table.hide-for-medium, table.show-for-small { display: table !important; } }
|
||||
/* Alerts ---------------------- */
|
||||
div.alert-box { display: block; padding: 6px 7px 7px; font-weight: bold; font-size: 14px; color: white; background-color: #fd7800; border: 1px solid rgba(0, 0, 0, 0.1); margin-bottom: 12px; -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); position: relative; }
|
||||
div.alert-box.success { background-color: #5da423; color: #fff; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); }
|
||||
div.alert-box.alert { background-color: #c60f13; color: #fff; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); }
|
||||
div.alert-box.secondary { background-color: #e9e9e9; color: #505050; text-shadow: 0 1px rgba(255, 255, 255, 0.3); }
|
||||
div.alert-box a.close { color: #333; position: absolute; right: 4px; top: -1px; font-size: 17px; opacity: 0.2; padding: 4px; }
|
||||
div.alert-box a.close:hover, div.alert-box a.close:focus { opacity: 0.4; }
|
||||
|
||||
/* Labels ---------------------- */
|
||||
|
||||
|
||||
/* Tooltips ---------------------- */
|
||||
.has-tip { border-bottom: dotted 1px #cccccc; cursor: help; font-weight: bold; color: #333333; }
|
||||
.has-tip:hover { border-bottom: dotted 1px #196177; color: #fd7800; }
|
||||
.has-tip.tip-left, .has-tip.tip-right { float: none !important; }
|
||||
|
||||
.tooltip { display: none; background: black; background: rgba(0, 0, 0, 0.85); position: absolute; color: white; font-weight: bold; font-size: 12px; font-size: 1.2rem; padding: 5px; z-index: 999; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; line-height: normal; }
|
||||
.tooltip > .nub { display: block; width: 0; height: 0; border: solid 5px; border-color: transparent transparent black transparent; border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent; position: absolute; top: -10px; left: 10px; }
|
||||
.tooltip.tip-override > .nub { border-color: transparent transparent black transparent !important; border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent !important; top: -10px !important; }
|
||||
.tooltip.tip-top > .nub { border-color: black transparent transparent transparent; border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent; top: auto; bottom: -10px; }
|
||||
.tooltip.tip-left, .tooltip.tip-right { float: none !important; }
|
||||
.tooltip.tip-left > .nub { border-color: transparent transparent transparent black; border-color: transparent transparent transparent rgba(0, 0, 0, 0.85); right: -10px; left: auto; }
|
||||
.tooltip.tip-right > .nub { border-color: transparent black transparent transparent; border-color: transparent rgba(0, 0, 0, 0.85) transparent transparent; right: auto; left: -10px; }
|
||||
.tooltip.noradius { -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; }
|
||||
.tooltip.opened { color: #fd7800 !important; border-bottom: dotted 1px #196177 !important; }
|
||||
|
||||
.tap-to-close { display: block; font-size: 10px; font-size: 1rem; color: #888888; font-weight: normal; }
|
||||
|
||||
@media only screen and (max-width: 767px) { .tooltip { font-size: 14px; font-size: 1.4rem; line-height: 1.4; padding: 7px 10px 9px 10px; }
|
||||
.tooltip > .nub, .tooltip.top > .nub, .tooltip.left > .nub, .tooltip.right > .nub { border-color: transparent transparent black transparent; border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent; top: -12px; left: 10px; } }
|
||||
/* Panels ---------------------- */
|
||||
.panel { background: #f2f2f2; border: solid 1px #e6e6e6; margin: 0 0 22px 0; padding: 20px; }
|
||||
.panel > :first-child { margin-top: 0; }
|
||||
.panel > :last-child { margin-bottom: 0; }
|
||||
.panel.callout { background: #fd7800; color: #fff; border-color: #2284a1; -webkit-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.5); -moz-box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.5); box-shadow: inset 0px 1px 0px rgba(255, 255, 255, 0.5); }
|
||||
.panel.callout a { color: #fff; }
|
||||
.panel.callout .button { background: white; border: none; color: #fd7800; text-shadow: none; }
|
||||
.panel.callout .button:hover { background: rgba(255, 255, 255, 0.8); }
|
||||
.panel.radius { -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
|
||||
/* Accordion ---------------------- */
|
||||
ul.accordion { margin: 0 0 22px 0; border-bottom: 1px solid #e9e9e9; }
|
||||
ul.accordion > li { list-style: none; margin: 0; padding: 0; border-top: 1px solid #e9e9e9; }
|
||||
ul.accordion > li .title { cursor: pointer; background: #f6f6f6; padding: 15px; margin: 0; position: relative; border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; -webkit-transition: 0.15s background linear; -moz-transition: 0.15s background linear; -o-transition: 0.15s background linear; transition: 0.15s background linear; }
|
||||
ul.accordion > li .title h1, ul.accordion > li .title h2, ul.accordion > li .title h3, ul.accordion > li .title h4, ul.accordion > li .title h5 { margin: 0; }
|
||||
ul.accordion > li .title:after { content: ""; display: block; width: 0; height: 0; border: solid 6px; border-color: transparent #9d9d9d transparent transparent; position: absolute; right: 15px; top: 21px; }
|
||||
ul.accordion > li .content { display: none; padding: 15px; }
|
||||
ul.accordion > li.active { border-top: 3px solid #fd7800; }
|
||||
ul.accordion > li.active .title { background: white; padding-top: 13px; }
|
||||
ul.accordion > li.active .title:after { content: ""; display: block; width: 0; height: 0; border: solid 6px; border-color: #9d9d9d transparent transparent transparent; }
|
||||
ul.accordion > li.active .content { background: white; display: block; border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; }
|
||||
|
||||
/* Side Nav ---------------------- */
|
||||
ul.side-nav { display: block; list-style: none; margin: 0; padding: 17px 0; }
|
||||
ul.side-nav li { display: block; list-style: none; margin: 0 0 7px 0; }
|
||||
ul.side-nav li a { display: block; }
|
||||
ul.side-nav li.active a { color: #4d4d4d; font-weight: bold; }
|
||||
ul.side-nav li.divider { border-top: 1px solid #e6e6e6; height: 0; padding: 0; }
|
||||
|
||||
/* Sub Navs http://www.zurb.com/article/292/how-to-create-simple-and-effective-sub-na ---------------------- */
|
||||
dl.sub-nav { display: block; width: auto; overflow: hidden; margin: -4px 0 18px; margin-right: 0; margin-left: -9px; padding-top: 4px; }
|
||||
dl.sub-nav dt, dl.sub-nav dd { float: left; display: inline; margin-left: 9px; margin-bottom: 10px; }
|
||||
dl.sub-nav dt { color: #999; font-weight: normal; }
|
||||
dl.sub-nav dd a { text-decoration: none; -webkit-border-radius: 1000px; -moz-border-radius: 1000px; -ms-border-radius: 1000px; -o-border-radius: 1000px; border-radius: 1000px; }
|
||||
dl.sub-nav dd.active a { font-weight: bold; background: #fd7800; color: #fff; padding: 3px 9px; cursor: default; }
|
||||
|
||||
/* Pagination ---------------------- */
|
||||
ul.pagination { display: block; height: 24px; margin-left: -5px; }
|
||||
ul.pagination li { float: left; display: block; height: 24px; color: #999; font-size: 14px; margin-left: 5px; }
|
||||
ul.pagination li a { display: block; padding: 1px 7px 1px; color: #555; }
|
||||
ul.pagination li:hover a, ul.pagination li a:focus { background: #e6e6e6; }
|
||||
ul.pagination li.unavailable a { cursor: default; color: #999; }
|
||||
ul.pagination li.unavailable:hover a, ul.pagination li.unavailable a:focus { background: transparent; }
|
||||
ul.pagination li.current a { background: #fd7800; color: white; font-weight: bold; cursor: default; }
|
||||
ul.pagination li.current a:hover { background: #fd7800; }
|
||||
|
||||
/* Breadcrums ---------------------- */
|
||||
ul.breadcrumbs { display: block; background: #f6f6f6; padding: 6px 10px 7px; border: 1px solid #e9e9e9; -webkit-border-radius: 2px; -moz-border-radius: 2px; -ms-border-radius: 2px; -o-border-radius: 2px; border-radius: 2px; overflow: hidden; }
|
||||
ul.breadcrumbs li { margin: 0; padding: 0 12px 0 0; float: left; list-style: none; }
|
||||
ul.breadcrumbs li a, ul.breadcrumbs li span { text-transform: uppercase; font-size: 11px; font-size: 1.1rem; padding-left: 12px; }
|
||||
ul.breadcrumbs li:first-child a, ul.breadcrumbs li:first-child span { padding-left: 0; }
|
||||
ul.breadcrumbs li:before { content: "/"; color: #aaa; }
|
||||
ul.breadcrumbs li:first-child:before { content: " "; }
|
||||
ul.breadcrumbs li.current a { cursor: default; color: #333; }
|
||||
ul.breadcrumbs li:hover a, ul.breadcrumbs li a:focus { text-decoration: underline; }
|
||||
ul.breadcrumbs li.current:hover a, ul.breadcrumbs li.current a:focus { text-decoration: none; }
|
||||
ul.breadcrumbs li.unavailable a { color: #999; }
|
||||
ul.breadcrumbs li.unavailable:hover a, ul.breadcrumbs li.unavailable a:focus { text-decoration: none; color: #999; cursor: default; }
|
||||
|
||||
/* Link List */
|
||||
ul.link-list { margin: 0 0 17px -22px; padding: 0; list-style: none; overflow: hidden; }
|
||||
ul.link-list li { list-style: none; float: left; margin-left: 22px; display: block; }
|
||||
ul.link-list li a { display: block; }
|
||||
|
||||
/* Keytroke Characters ---------------------- */
|
||||
.keystroke, kbd { font-family: "Consolas", "Menlo", "Courier", monospace; font-size: 13px; padding: 2px 4px 0px; margin: 0; background: #ededed; border: solid 1px #dbdbdb; -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
|
||||
|
||||
/* Image Thumbnails ---------------------- */
|
||||
.th { display: block; }
|
||||
.th img { display: block; border: solid 4px #fff; -webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; -webkit-transition-property: border, box-shadow; -moz-transition-property: border, box-shadow; -o-transition-property: border, box-shadow; transition-property: border, box-shadow; -webkit-transition-duration: 300ms; -moz-transition-duration: 300ms; -o-transition-duration: 300ms; transition-duration: 300ms; }
|
||||
.th:hover img { -webkit-box-shadow: 0 0 6px 1px rgba(43, 166, 203, 0.5); -moz-box-shadow: 0 0 6px 1px rgba(43, 166, 203, 0.5); box-shadow: 0 0 6px 1px rgba(43, 166, 203, 0.5); }
|
||||
|
||||
/* Video - Mad props to http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ ---------------------- */
|
||||
.flex-video { position: relative; padding-top: 25px; padding-bottom: 67.5%; height: 0; margin-bottom: 16px; overflow: hidden; }
|
||||
.flex-video.widescreen { padding-bottom: 57.25%; }
|
||||
.flex-video.vimeo { padding-top: 0; }
|
||||
.flex-video iframe, .flex-video object, .flex-video embed, .flex-video video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||
@@ -0,0 +1,776 @@
|
||||
@import url("base.css");
|
||||
|
||||
@import url("foundation.css");
|
||||
|
||||
table {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 10px;
|
||||
background-color: #fafafa;
|
||||
color: #222;
|
||||
line-height: 1.0em;
|
||||
border: 2px solid #C6C9CB;
|
||||
font-size: 0.9em;
|
||||
/* margin: 1.5em 0 1.5em 0; */
|
||||
margin: 0;
|
||||
border-right-style: none;
|
||||
border-left-style: none;
|
||||
}
|
||||
|
||||
/* General */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:active,
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
color: #000;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
h1 { font-weight: normal; font-size: 24px; line-height: 24px; }
|
||||
h2 { font-weight: normal; font-size: 18px; line-height: 18px; }
|
||||
h3 { font-weight: bold; font-size: 18px; line-height: 18px; }
|
||||
h4 { font-weight: normal; font-size: 18px; line-height: 178px; }
|
||||
|
||||
hr {
|
||||
background-color: #c6c6c6;
|
||||
border:0;
|
||||
height: 1px;
|
||||
margin-bottom: 18px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
div.hr {
|
||||
height: 1px;
|
||||
background: #c6c6c6;
|
||||
}
|
||||
|
||||
div.hr2 {
|
||||
height: 1px;
|
||||
background: #c6c6c6;
|
||||
}
|
||||
|
||||
div.hr hr, div.hr2 hr {
|
||||
display: none;
|
||||
}
|
||||
|
||||
p {
|
||||
padding: 0 0 0.5em;
|
||||
line-height:1.6em;
|
||||
}
|
||||
ul {
|
||||
list-style: square;
|
||||
margin: 0 0 18px 0;
|
||||
}
|
||||
ol {
|
||||
list-style: decimal;
|
||||
margin: 0 0 18px 1.5em;
|
||||
}
|
||||
ol ol {
|
||||
list-style:upper-alpha;
|
||||
}
|
||||
ol ol ol {
|
||||
list-style:lower-roman;
|
||||
}
|
||||
ol ol ol ol {
|
||||
list-style:lower-alpha;
|
||||
}
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
margin-bottom:0;
|
||||
}
|
||||
dl {
|
||||
margin:0 0 24px 0;
|
||||
}
|
||||
dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
dd {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
strong {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
}
|
||||
cite,
|
||||
em,
|
||||
i {
|
||||
font-style: italic;
|
||||
border: none;
|
||||
}
|
||||
big {
|
||||
font-size: 131.25%;
|
||||
}
|
||||
ins {
|
||||
background: #FFFFCC;
|
||||
border: none;
|
||||
color: #333;
|
||||
}
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
color: #555;
|
||||
}
|
||||
blockquote {
|
||||
font-style: italic;
|
||||
padding: 0 3em;
|
||||
}
|
||||
blockquote cite,
|
||||
blockquote em,
|
||||
blockquote i {
|
||||
font-style: normal;
|
||||
}
|
||||
pre {
|
||||
background: #f7f7f7;
|
||||
color: #222;
|
||||
padding: 1.5em;
|
||||
}
|
||||
abbr,
|
||||
acronym {
|
||||
border-bottom: 1px solid #666;
|
||||
cursor: help;
|
||||
}
|
||||
ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
sup,
|
||||
sub {
|
||||
height: 0;
|
||||
line-height: 1;
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
}
|
||||
sup {
|
||||
bottom: 1ex;
|
||||
}
|
||||
sub {
|
||||
top: .5ex;
|
||||
}
|
||||
|
||||
p,
|
||||
ul,
|
||||
ol,
|
||||
dd,
|
||||
hr {
|
||||
margin-bottom:10px;
|
||||
}
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
margin-bottom:0;
|
||||
}
|
||||
pre,
|
||||
kbd,
|
||||
tt,
|
||||
var {
|
||||
}
|
||||
code {
|
||||
font-size: 13px;
|
||||
}
|
||||
strong,
|
||||
b,
|
||||
dt,
|
||||
th {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
|
||||
/* main_container */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#wrapper {
|
||||
padding: 0px 0px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* header*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#search-header{
|
||||
margin-top:15px;
|
||||
padding-bottom:13px;
|
||||
}
|
||||
|
||||
#search-header #search{
|
||||
background: #222;
|
||||
|
||||
}
|
||||
|
||||
#search-header #search #s{
|
||||
background: #222;
|
||||
font-size:12px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
#header_container{
|
||||
padding-bottom: 25px;
|
||||
padding-top: 0px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#header {
|
||||
|
||||
}
|
||||
|
||||
#header2 {
|
||||
|
||||
}
|
||||
|
||||
#content_container{
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
#left-col {
|
||||
padding: 10px 20px;
|
||||
padding-left: 0px;
|
||||
background: #fff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*footer*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
#footer {
|
||||
padding: 5px 20px;
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
#footer-container{
|
||||
padding: 5px 20px;
|
||||
background: #303030;
|
||||
border-top: 8px solid #000;
|
||||
font-size:11px;
|
||||
}
|
||||
|
||||
#footer-info {
|
||||
color:#ccc;
|
||||
text-align:left;
|
||||
background: #1b1b1b;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
|
||||
#footer-info a{
|
||||
text-decoration:none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#footer-info a:hover{
|
||||
color: #ebebeb;
|
||||
}
|
||||
|
||||
#copyright{float: left;}
|
||||
|
||||
.scroll-top {
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
#footer-widget{
|
||||
padding: 8px 0px 8px 0px;
|
||||
color:#6f6f6f;
|
||||
}
|
||||
|
||||
#footer-widget #search {
|
||||
width:120px;
|
||||
height:28px;
|
||||
background: #222;
|
||||
margin-left: 0px;
|
||||
position: relative;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
#footer-widget #search #s {
|
||||
width:110px;
|
||||
height:23px;
|
||||
border:0px;
|
||||
margin-left:7px;
|
||||
margin-right:10px;
|
||||
margin-top:3px;
|
||||
color:#fff;
|
||||
display: inline;
|
||||
background: #222;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#footer-widget #calendar_wrap {
|
||||
padding: 8px 0px;
|
||||
}
|
||||
|
||||
#footer-widget #wp-calendar td{
|
||||
padding:2px;
|
||||
}
|
||||
|
||||
|
||||
#footer-widget .textwidget {
|
||||
padding: 5px 0px;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
|
||||
#footer-widget .widget_tag_cloud a{
|
||||
text-decoration: none;
|
||||
margin: 5px;
|
||||
line-height: 24px;
|
||||
margin-left: 0px;
|
||||
color: #6f6f6f;
|
||||
}
|
||||
|
||||
#footer-widget .widget_tag_cloud a:hover{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container ul li a {
|
||||
color:#fd7800;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container ul li a:hover {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container h3 {
|
||||
color: #a5a5a5;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 0px;
|
||||
padding-top: 10px;
|
||||
padding-left: 0px;
|
||||
font-size: 25px;
|
||||
padding-bottom: 8px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container ul li {
|
||||
padding: 5px 0px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
#footer-widget ul {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
#footer-bar1 {
|
||||
padding-right: 40px;
|
||||
}
|
||||
#footer-bar2 {
|
||||
padding-right: 40px;
|
||||
}
|
||||
#footer-bar3 {
|
||||
}
|
||||
#footer-bar4 {
|
||||
}
|
||||
|
||||
span#follow-box{
|
||||
position: absolute;
|
||||
right: 100px;
|
||||
}
|
||||
|
||||
span#follow-box img{
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
||||
/*logo*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#logo {
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#logo2 {
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#logo img{
|
||||
border: none;
|
||||
}
|
||||
|
||||
#logo2{
|
||||
text-decoration: none;
|
||||
font-size: 42px;
|
||||
letter-spacing: -1pt;
|
||||
font-weight: bold;
|
||||
font-family:arial, "Times New Roman", Times, serif;
|
||||
text-align: left;
|
||||
line-height: 57px;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
#logo2 a, #slogan{
|
||||
color: #fd7800;
|
||||
}
|
||||
|
||||
#slogan{
|
||||
text-align: left;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
/*search*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#search {
|
||||
width:180px;
|
||||
height:28px;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#sidebar #search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#search #searchsubmit {
|
||||
background:url(images/go-btn.png) no-repeat top right;
|
||||
width:28px;
|
||||
height:28px;
|
||||
border:0px;
|
||||
position:absolute;
|
||||
right: -35px;
|
||||
}
|
||||
|
||||
#search #s {
|
||||
width:170px;
|
||||
height:23px;
|
||||
border:0px;
|
||||
margin-left:7px;
|
||||
margin-right:10px;
|
||||
margin-top:3px;
|
||||
color:#000;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/*menu bar*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#menu_container{
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
|
||||
/*responsive menu*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
/* default style */
|
||||
.selectnav { display: none; }
|
||||
|
||||
/* small screen */
|
||||
@media screen and (max-width: 600px) {
|
||||
.js #nav { display: none; }
|
||||
.js #nav2 { display: none; }
|
||||
.js .selectnav { display: block; }
|
||||
}
|
||||
|
||||
|
||||
/*welcome*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
#welcome_container h1{
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
/*homepage boxes*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#box_container{
|
||||
padding-top: 35px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.box-head {
|
||||
float: left;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.box-head img{
|
||||
|
||||
}
|
||||
|
||||
.title-head{
|
||||
padding-top:2px;
|
||||
}
|
||||
|
||||
.title-box{
|
||||
color: #333;
|
||||
line-height: 15px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.title-box h1 {
|
||||
font-size: 18px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.box-content {
|
||||
float: left;
|
||||
padding-top: 10px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
|
||||
/* POST */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
.post {
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
.post-shadow{
|
||||
background: url("images/post_shadow.png") no-repeat bottom;
|
||||
height: 9px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.post ol{
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.post ul {
|
||||
margin-left: 15px;
|
||||
}
|
||||
.post-entry ul { margin: 0 0 10px 10px; }
|
||||
.post-entry ul li {
|
||||
display: block;
|
||||
margin: 5px 0;
|
||||
padding: 0 0 0 20px;
|
||||
/*background: url(images/bullet.png) no-repeat 0 7px;*/
|
||||
}
|
||||
|
||||
.post-entry ol {
|
||||
list-style: decimal;
|
||||
margin: 0 0 18px 1.6em;
|
||||
}
|
||||
.post-entry ol li {
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
.post-entry {
|
||||
padding-bottom: 10px;
|
||||
padding-top: 10px;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
.post-head {
|
||||
margin-bottom: 5px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.post-head h1 a, .post-head h1 {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
margin: 0px;
|
||||
font-size: 27px;
|
||||
}
|
||||
|
||||
.post-head h1 a:hover {
|
||||
color:#777;
|
||||
}
|
||||
|
||||
|
||||
.post-head-notfound h1, .post-head-404 h1, .post-head-archive h1, .post-head-search h1 {
|
||||
margin-bottom: 10px;
|
||||
font-weight:normal;
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
font-size: 27px;
|
||||
}
|
||||
|
||||
.post-thumb img {
|
||||
border: 0px solid #ebebeb;
|
||||
}
|
||||
|
||||
.post-entry img{
|
||||
margin-bottom: 10px;
|
||||
height:auto;
|
||||
max-width:100% !important;
|
||||
}
|
||||
|
||||
.meta-data{
|
||||
line-height: 16px;
|
||||
padding: 6px 3px;
|
||||
margin-bottom: 3px;
|
||||
font-size: 11px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.meta-data a{
|
||||
color: #fd7800;
|
||||
}
|
||||
|
||||
.meta-data a:hover{
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.read-more {
|
||||
color: #000;
|
||||
background: #fff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 3px;
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-transform: capitalize;
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.read-more:hover{
|
||||
background: #fff;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.sticky {
|
||||
|
||||
}
|
||||
|
||||
/* content */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
#content_container table {
|
||||
border: 1px solid #e7e7e7;
|
||||
margin: 0 -1px 24px 0;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
#content_container tr th,
|
||||
#content_container thead th {
|
||||
color: #888;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
line-height: 18px;
|
||||
padding: 9px 10px;
|
||||
}
|
||||
#content_container tr td {
|
||||
|
||||
padding: 6px 10px;
|
||||
}
|
||||
#content_container tr.odd td {
|
||||
background: #f2f7fc;
|
||||
}
|
||||
|
||||
/*--navigation--*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
.navigation {
|
||||
float: left;
|
||||
width: 100%;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
|
||||
.navigation .alignleft a {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navigation .alignright a {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#nav-single {
|
||||
overflow:hidden;
|
||||
margin-top:20px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.nav-previous {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
.nav-next {
|
||||
float: right;
|
||||
text-align: right;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/*--sub head and breadcrumbs--*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#subhead_container{
|
||||
padding: 7px 0px;
|
||||
}
|
||||
|
||||
#subhead h1{
|
||||
color: #000;
|
||||
padding-top: 10px;
|
||||
padding-left: 0px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
#breadcrumbs {
|
||||
padding-left: 25px;
|
||||
margin-bottom: 15px;
|
||||
color: #9e9e9e;
|
||||
margin:0 auto;
|
||||
width: 964px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
#breadcrumbs a{
|
||||
text-decoration: none;
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
||||
/*Alignments */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
.alignleft,
|
||||
img.alignleft {
|
||||
display: inline;
|
||||
float: left;
|
||||
margin-right: 22px;
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
.alignright,
|
||||
img.alignright {
|
||||
display: inline;
|
||||
float: right;
|
||||
margin-left: 22px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.aligncenter,
|
||||
img.aligncenter {
|
||||
clear: both;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.alignleft,
|
||||
.alignright,
|
||||
.aligncenter,
|
||||
img.alignleft,
|
||||
img.alignright,
|
||||
img.aligncenter
|
||||
{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
a img.aligncenter {
|
||||
display:block;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
img { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; }
|
||||
@@ -0,0 +1,813 @@
|
||||
@import url("base.css");
|
||||
|
||||
@import url("foundation.css");
|
||||
|
||||
table {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 10px;
|
||||
background-color: #fafafa;
|
||||
color: #222;
|
||||
/* line-height: 1.0em; */
|
||||
border: 2px solid #C6C9CB;
|
||||
font-size: 0.9em;
|
||||
/* margin: 1.5em 0 1.5em 0; */
|
||||
margin: 0;
|
||||
border-right-style: none;
|
||||
border-left-style: none;
|
||||
}
|
||||
|
||||
/* General */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:active,
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
color: #000;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
h1 { font-weight: bold; font-size: 24px; }
|
||||
h2 { font-weight: bold; font-size: 18px; }
|
||||
h3 { font-weight: bold; font-size: 16px; }
|
||||
h4 { font-weight: bold; font-size: 14px; }
|
||||
|
||||
hr {
|
||||
background-color: #c6c6c6;
|
||||
border:0;
|
||||
height: 1px;
|
||||
margin-bottom: 18px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
div.hr {
|
||||
height: 1px;
|
||||
background: #c6c6c6;
|
||||
}
|
||||
|
||||
div.hr2 {
|
||||
height: 1px;
|
||||
background: #c6c6c6;
|
||||
}
|
||||
|
||||
div.hr hr, div.hr2 hr {
|
||||
display: none;
|
||||
}
|
||||
|
||||
p {
|
||||
padding: 0;
|
||||
line-height:1.6em;
|
||||
}
|
||||
ul {
|
||||
list-style: square;
|
||||
margin: 0 0 18px 0;
|
||||
}
|
||||
ol {
|
||||
list-style: decimal;
|
||||
margin: 0 0 18px 1.5em;
|
||||
}
|
||||
ol ol {
|
||||
list-style:upper-alpha;
|
||||
}
|
||||
ol ol ol {
|
||||
list-style:lower-roman;
|
||||
}
|
||||
ol ol ol ol {
|
||||
list-style:lower-alpha;
|
||||
}
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
margin-bottom:0;
|
||||
}
|
||||
dl {
|
||||
margin:0 0 24px 0;
|
||||
}
|
||||
dt {
|
||||
font-weight: bold;
|
||||
}
|
||||
dd {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
strong {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
}
|
||||
cite,
|
||||
em,
|
||||
i {
|
||||
font-style: italic;
|
||||
border: none;
|
||||
}
|
||||
big {
|
||||
font-size: 131.25%;
|
||||
}
|
||||
ins {
|
||||
background: #FFFFCC;
|
||||
border: none;
|
||||
color: #333;
|
||||
}
|
||||
del {
|
||||
text-decoration: line-through;
|
||||
color: #555;
|
||||
}
|
||||
blockquote {
|
||||
padding: 0 3em;
|
||||
}
|
||||
blockquote cite,
|
||||
blockquote em,
|
||||
blockquote i {
|
||||
font-style: normal;
|
||||
}
|
||||
pre {
|
||||
background: #f7f7f7;
|
||||
color: #222;
|
||||
padding: 1.5em;
|
||||
}
|
||||
abbr,
|
||||
acronym {
|
||||
border-bottom: 1px solid #666;
|
||||
cursor: help;
|
||||
}
|
||||
ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
sup,
|
||||
sub {
|
||||
height: 0;
|
||||
line-height: 1;
|
||||
vertical-align: baseline;
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
}
|
||||
sup {
|
||||
bottom: 1ex;
|
||||
}
|
||||
sub {
|
||||
top: .5ex;
|
||||
}
|
||||
|
||||
p,
|
||||
ul,
|
||||
ol,
|
||||
dd,
|
||||
hr {
|
||||
margin-bottom:10px;
|
||||
}
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
margin-bottom:0;
|
||||
}
|
||||
pre,
|
||||
kbd,
|
||||
tt,
|
||||
var {
|
||||
}
|
||||
code {
|
||||
font-size: 13px;
|
||||
}
|
||||
strong,
|
||||
b,
|
||||
dt,
|
||||
th {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
|
||||
/* main_container */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#wrapper {
|
||||
padding: 0px 0px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* header*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#search-header{
|
||||
margin-top:15px;
|
||||
padding-bottom:13px;
|
||||
}
|
||||
|
||||
#search-header #search{
|
||||
background: #222;
|
||||
|
||||
}
|
||||
|
||||
#search-header #search #s{
|
||||
background: #222;
|
||||
font-size:12px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
#header_container{
|
||||
padding-bottom: 25px;
|
||||
padding-top: 0px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#header {
|
||||
|
||||
}
|
||||
|
||||
#header2 {
|
||||
|
||||
}
|
||||
|
||||
#content_container{
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
#left-col {
|
||||
padding: 10px 20px;
|
||||
padding-left: 0px;
|
||||
background: #fff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*footer*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
#footer {
|
||||
padding: 5px 20px;
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
#footer-container{
|
||||
padding: 5px 20px;
|
||||
background: #303030;
|
||||
border-top: 8px solid #000;
|
||||
font-size:11px;
|
||||
}
|
||||
|
||||
#footer-info {
|
||||
color:#ccc;
|
||||
text-align:left;
|
||||
background: #1b1b1b;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
|
||||
#footer-info a{
|
||||
text-decoration:none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#footer-info a:hover{
|
||||
color: #ebebeb;
|
||||
}
|
||||
|
||||
#copyright{float: left;}
|
||||
|
||||
.scroll-top {
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
#footer-widget{
|
||||
padding: 8px 0px 8px 0px;
|
||||
color:#6f6f6f;
|
||||
}
|
||||
|
||||
#footer-widget #search {
|
||||
width:120px;
|
||||
height:28px;
|
||||
background: #222;
|
||||
margin-left: 0px;
|
||||
position: relative;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
#footer-widget #search #s {
|
||||
width:110px;
|
||||
height:23px;
|
||||
border:0px;
|
||||
margin-left:7px;
|
||||
margin-right:10px;
|
||||
margin-top:3px;
|
||||
color:#fff;
|
||||
display: inline;
|
||||
background: #222;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#footer-widget #calendar_wrap {
|
||||
padding: 8px 0px;
|
||||
}
|
||||
|
||||
#footer-widget #wp-calendar td{
|
||||
padding:2px;
|
||||
}
|
||||
|
||||
|
||||
#footer-widget .textwidget {
|
||||
padding: 5px 0px;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
|
||||
#footer-widget .widget_tag_cloud a{
|
||||
text-decoration: none;
|
||||
margin: 5px;
|
||||
line-height: 24px;
|
||||
margin-left: 0px;
|
||||
color: #6f6f6f;
|
||||
}
|
||||
|
||||
#footer-widget .widget_tag_cloud a:hover{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container ul li a {
|
||||
color:#fd7800;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container ul li a:hover {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container h3 {
|
||||
color: #a5a5a5;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 0px;
|
||||
padding-top: 10px;
|
||||
padding-left: 0px;
|
||||
font-size: 25px;
|
||||
padding-bottom: 8px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#footer-widget .widget-container ul li {
|
||||
padding: 5px 0px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
#footer-widget ul {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
#footer-bar1 {
|
||||
padding-right: 40px;
|
||||
}
|
||||
#footer-bar2 {
|
||||
padding-right: 40px;
|
||||
}
|
||||
#footer-bar3 {
|
||||
}
|
||||
#footer-bar4 {
|
||||
}
|
||||
|
||||
span#follow-box{
|
||||
position: absolute;
|
||||
right: 100px;
|
||||
}
|
||||
|
||||
span#follow-box img{
|
||||
margin: 0 2px;
|
||||
}
|
||||
|
||||
/*logo*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#logo {
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#logo2 {
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#logo img{
|
||||
border: none;
|
||||
}
|
||||
|
||||
#logo2{
|
||||
text-decoration: none;
|
||||
font-size: 42px;
|
||||
letter-spacing: -1pt;
|
||||
font-weight: bold;
|
||||
font-family:arial, "Times New Roman", Times, serif;
|
||||
text-align: left;
|
||||
line-height: 57px;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
#logo2 a, #slogan{
|
||||
color: #fd7800;
|
||||
}
|
||||
|
||||
#slogan{
|
||||
text-align: left;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
/*search*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#search {
|
||||
width:180px;
|
||||
height:28px;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#sidebar #search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#search #searchsubmit {
|
||||
background:url(images/go-btn.png) no-repeat top right;
|
||||
width:28px;
|
||||
height:28px;
|
||||
border:0px;
|
||||
position:absolute;
|
||||
right: -35px;
|
||||
}
|
||||
|
||||
#search #s {
|
||||
width:170px;
|
||||
height:23px;
|
||||
border:0px;
|
||||
margin-left:7px;
|
||||
margin-right:10px;
|
||||
margin-top:3px;
|
||||
color:#000;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/*menu bar*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#menu_container{
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
|
||||
/*responsive menu*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
/* default style */
|
||||
.selectnav { display: none; }
|
||||
|
||||
/* small screen */
|
||||
@media screen and (max-width: 600px) {
|
||||
.js #nav { display: none; }
|
||||
.js #nav2 { display: none; }
|
||||
.js .selectnav { display: block; }
|
||||
}
|
||||
|
||||
|
||||
/*welcome*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
#welcome_container h1{
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
/*homepage boxes*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#box_container{
|
||||
padding-top: 35px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.box-head {
|
||||
float: left;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.box-head img{
|
||||
|
||||
}
|
||||
|
||||
.title-head{
|
||||
padding-top:2px;
|
||||
}
|
||||
|
||||
.title-box{
|
||||
color: #333;
|
||||
line-height: 15px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.title-box h1 {
|
||||
font-size: 18px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.box-content {
|
||||
float: left;
|
||||
padding-top: 10px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
|
||||
/* POST */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
.post {
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
.post-shadow{
|
||||
background: url("images/post_shadow.png") no-repeat bottom;
|
||||
height: 9px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.post ol{
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.post ul {
|
||||
margin-left: 15px;
|
||||
}
|
||||
.post-entry ul { margin: 0 0 10px 10px; }
|
||||
.post-entry ul li {
|
||||
display: block;
|
||||
margin: 5px 0;
|
||||
padding: 0 0 0 20px;
|
||||
/*background: url(images/bullet.png) no-repeat 0 7px;*/
|
||||
}
|
||||
|
||||
.post-entry ol {
|
||||
list-style: decimal;
|
||||
margin: 0 0 18px 1.6em;
|
||||
}
|
||||
.post-entry ol li {
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
.post-entry {
|
||||
padding-bottom: 10px;
|
||||
padding-top: 10px;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
.post-head {
|
||||
margin-bottom: 5px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.post-head h1 a, .post-head h1 {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
margin: 0px;
|
||||
font-size: 27px;
|
||||
}
|
||||
|
||||
.post-head h1 a:hover {
|
||||
color:#777;
|
||||
}
|
||||
|
||||
|
||||
.post-head-notfound h1, .post-head-404 h1, .post-head-archive h1, .post-head-search h1 {
|
||||
margin-bottom: 10px;
|
||||
font-weight:normal;
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
font-size: 27px;
|
||||
}
|
||||
|
||||
.post-thumb img {
|
||||
border: 0px solid #ebebeb;
|
||||
}
|
||||
|
||||
.post-entry img{
|
||||
margin-bottom: 10px;
|
||||
height:auto;
|
||||
max-width:100% !important;
|
||||
}
|
||||
|
||||
.meta-data{
|
||||
line-height: 16px;
|
||||
padding: 6px 3px;
|
||||
margin-bottom: 3px;
|
||||
font-size: 11px;
|
||||
border-bottom: 1px solid #e9e9e9;
|
||||
}
|
||||
|
||||
.meta-data a{
|
||||
color: #fd7800;
|
||||
}
|
||||
|
||||
.meta-data a:hover{
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.read-more {
|
||||
color: #000;
|
||||
background: #fff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 3px;
|
||||
display: inline-block;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-transform: capitalize;
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.read-more:hover{
|
||||
background: #fff;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.sticky {
|
||||
|
||||
}
|
||||
|
||||
/* content */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
#content_container table {
|
||||
border: 1px solid #e7e7e7;
|
||||
margin: 0 -1px 24px 0;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
#content_container tr th,
|
||||
#content_container thead th {
|
||||
color: #888;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
line-height: 18px;
|
||||
padding: 9px 10px;
|
||||
}
|
||||
#content_container tr td {
|
||||
|
||||
padding: 6px 10px;
|
||||
}
|
||||
#content_container tr.odd td {
|
||||
background: #f2f7fc;
|
||||
}
|
||||
|
||||
/* sidebar*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#sidebar {
|
||||
padding:0px 20px 20px 0px;
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#sidebar { word-wrap: break-word;}
|
||||
|
||||
|
||||
/*--navigation--*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
.navigation {
|
||||
float: left;
|
||||
width: 100%;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
|
||||
.navigation .alignleft a {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navigation .alignright a {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#nav-single {
|
||||
overflow:hidden;
|
||||
margin-top:20px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.nav-previous {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
.nav-next {
|
||||
float: right;
|
||||
text-align: right;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/*--slider--*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#slider_container {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.flex-caption{
|
||||
background: #232323;
|
||||
color: #fff;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.flexslider p{
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/*--sub head and breadcrumbs--*/
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#subhead_container{
|
||||
padding: 7px 0px;
|
||||
}
|
||||
|
||||
#subhead h1{
|
||||
color: #000;
|
||||
padding-top: 10px;
|
||||
padding-left: 0px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
#breadcrumbs {
|
||||
padding-left: 25px;
|
||||
margin-bottom: 15px;
|
||||
color: #9e9e9e;
|
||||
margin:0 auto;
|
||||
width: 964px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
#breadcrumbs a{
|
||||
text-decoration: none;
|
||||
color: #9e9e9e;
|
||||
}
|
||||
|
||||
/*Alignments */
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
.alignleft,
|
||||
img.alignleft {
|
||||
display: inline;
|
||||
float: left;
|
||||
margin-right: 22px;
|
||||
margin-top: 9px;
|
||||
}
|
||||
|
||||
.alignright,
|
||||
img.alignright {
|
||||
display: inline;
|
||||
float: right;
|
||||
margin-left: 22px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.aligncenter,
|
||||
img.aligncenter {
|
||||
clear: both;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.alignleft,
|
||||
.alignright,
|
||||
.aligncenter,
|
||||
img.alignleft,
|
||||
img.alignright,
|
||||
img.aligncenter
|
||||
{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
a img.aligncenter {
|
||||
display:block;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
|
||||
table {
|
||||
border-collapse:collapse;
|
||||
}
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
padding: 5px;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 134 B |
Binary file not shown.
|
After Width: | Height: | Size: 146 B |
@@ -0,0 +1,15 @@
|
||||
[theme]
|
||||
inherit = agogo
|
||||
stylesheet = named_data_style.css
|
||||
# pygments_style = sphinx
|
||||
|
||||
theme_bodyfont = "normal 12px Verdana, sans-serif"
|
||||
theme_bgcolor = "#ccc"
|
||||
|
||||
theme_documentwidth = "100%"
|
||||
theme_textalign = "left"
|
||||
|
||||
[options]
|
||||
|
||||
stickysidebar = true
|
||||
collapsiblesidebar = true
|
||||
@@ -0,0 +1,70 @@
|
||||
# -*- 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
|
||||
@@ -1,75 +0,0 @@
|
||||
#Use this script to setup your keys.
|
||||
#!/bin/bash
|
||||
|
||||
EXPECTED_ARGS=3 #site, operator, router
|
||||
E_BADARGS=65
|
||||
if [ $# -ne $EXPECTED_ARGS ]
|
||||
then
|
||||
echo "Usage: `basename $0` <site name> <operator name> <router name>"
|
||||
echo "Example: `basename $0` memphis.edu user1 memphis.edu/cs/rtr1 (full router name without /ndn/ prefix"
|
||||
exit $E_BADARGS
|
||||
fi
|
||||
|
||||
|
||||
RESULT=`ps -a | sed -n /ccnr/p`
|
||||
|
||||
if [ "${RESULT:-null}" = null ]; then
|
||||
echo "ccnr not running, quitting"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
KSUITE=${HOME}/ndn-testbed-key-suite
|
||||
echo $KSUITE
|
||||
if [ ! -d ${KSUITE} ]; then
|
||||
echo "This script requires key signing suite available at:"
|
||||
echo "git://github.com/named-data/ndn-testbed-key-suite.git"
|
||||
echo "If you already have it, set the variable KSUITE of the script accordingly"
|
||||
exit
|
||||
fi
|
||||
|
||||
SITE=$1
|
||||
OP=$2
|
||||
RTR=$3
|
||||
|
||||
if [ ! -d ${SITE}_key ]; then
|
||||
mkdir ${SITE}_key
|
||||
ccninitkeystore ${SITE}_key
|
||||
fi
|
||||
|
||||
if [ ! -d ${OP}_key ]; then
|
||||
mkdir ${OP}_key
|
||||
ccninitkeystore ${OP}_key
|
||||
fi
|
||||
|
||||
if [ ! -d "router_key" ]; then
|
||||
mkdir router_key
|
||||
ccninitkeystore router_key
|
||||
fi
|
||||
|
||||
if [ ! -d "nlsr_key" ]; then
|
||||
mkdir nlsr_key
|
||||
ccninitkeystore nlsr_key
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
$KSUITE/bin/ndn-extract-public-key.sh -i ${SITE}_key/.ccnx/.ccnx_keystore -o ${SITE}_key/$SITE.pem
|
||||
$KSUITE/bin/ndn-extract-public-key.sh -i ${OP}_key/.ccnx/.ccnx_keystore -o ${OP}_key/$OP.pem
|
||||
$KSUITE/bin/ndn-extract-public-key.sh -i router_key/.ccnx/.ccnx_keystore -o router_key/router.pem
|
||||
$KSUITE/bin/ndn-extract-public-key.sh -i nlsr_key/.ccnx/.ccnx_keystore -o nlsr_key/nlsr.pem
|
||||
|
||||
.$KSUITE/sign.sh -s
|
||||
|
||||
#signing operator key
|
||||
echo "$KSUITE/bin/ndn-publish-key.sh -i "$OP" -a "$SITE" -f ${OP}_key/$OP.pem -F ${SITE}_key/.ccnx/ -P /ndn/keys/$SITE -p /ndn/keys/$SITE/%C1.O.N.Start/$OP -x 365"
|
||||
$KSUITE/bin/ndn-publish-key.sh -i "$OP" -a "$SITE" -f ${OP}_key/$OP.pem -F ${SITE}_key/.ccnx/ -P /ndn/keys/$SITE -p /ndn/keys/$SITE/%C1.O.N.Start/$OP -x 365
|
||||
|
||||
#signing routing key
|
||||
echo "$KSUITE/bin/ndn-publish-key.sh -i "$RTR" -a "$SITE" -f router_key/router.pem -F ${OP}_key/.ccnx/ -P /ndn/keys/$SITE/%C1.O.N.Start/$OP -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR -x 365"
|
||||
$KSUITE/bin/ndn-publish-key.sh -i "$RTR" -a "$SITE" -f router_key/router.pem -F ${OP}_key/.ccnx/ -P /ndn/keys/$SITE/%C1.O.N.Start/$OP -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR -x 365
|
||||
|
||||
#signing nlsr key
|
||||
echo "$KSUITE/bin/ndn-publish-key.sh -i "NLSR" -a "$RTR" -f nlsr_key/nlsr.pem -F router_key/.ccnx/ -P /ndn/keys/$SITE/%C1.R.N.Start/ndn/$SITE/$RTR -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR/nlsr -x 365"
|
||||
$KSUITE/bin/ndn-publish-key.sh -i "NLSR" -a "$RTR" -f nlsr_key/nlsr.pem -F router_key/.ccnx/ -P /ndn/keys/$SITE/%C1.R.N.Start/ndn/$SITE/$RTR -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR/nlsr -x 365
|
||||
@@ -0,0 +1,11 @@
|
||||
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
|
||||
@@ -1,28 +0,0 @@
|
||||
#----configuration file for macbook----------
|
||||
#
|
||||
router-name /ndn/memphis.edu/cs/pollux
|
||||
ccnneighbor /ndn/memphis.edu/cs/gemeni
|
||||
ccnneighbor /ndn/memphis.edu/cs/altair
|
||||
#ccnneighbor /ndn/memphis.edu/cs/pollux 141.225.11.132
|
||||
ccnname /ndn/memphis.edu/macbook/patterson
|
||||
ccnname /ndn/memphis.edu/macbook/houston/
|
||||
#------lsdb-synch-interval-----
|
||||
#lsdb-synch-interval 350
|
||||
interest-retry 2
|
||||
interest-resend-time 5
|
||||
lsa-refresh-time 600
|
||||
router-dead-interval 900
|
||||
max-faces-per-prefix 1
|
||||
debug on
|
||||
#hyperbolic-routing on
|
||||
hyperbolic-cordinate 1234.0 0.875
|
||||
tunnel-type udp
|
||||
|
||||
keystore-path /Users/akmhoque/CCN_KEY/nlsr_key_store/.ccnx/.ccnx_keystore
|
||||
root-key-prefix /ndn/keys
|
||||
site-name memphis.edu
|
||||
|
||||
topo-prefix /ndn/routing/nlsr/
|
||||
slice-prefix /ndn/routing/nlsr/LSA
|
||||
|
||||
logdir /Users/akmhoque/NLSR2.0
|
||||
@@ -1,10 +1,307 @@
|
||||
router-name /ndn/memphis.edu/netlab/macbook
|
||||
ccnneighbor /ndn/memphis.edu/netlab/pollux face2 10
|
||||
ccnneighbor /ndn/memphis.edu/netlab/castor face3 8
|
||||
ccnname /ndn/memphis.edu/netlab/macbook/name1
|
||||
ccnname /ndn/memphis.edu/netlab/macbook/test
|
||||
lsdb-synch-interval 310
|
||||
interest-retry 4
|
||||
interest-resend-time 5
|
||||
; the general section contains all the general settings for router
|
||||
|
||||
general
|
||||
{
|
||||
; mandatory configuration command section network, site and router
|
||||
|
||||
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
|
||||
; LSAs are removed
|
||||
;router-dead-interval 3600 ; default value: 2*lsa-refresh-time. Value must be larger
|
||||
; than lsa-refresh-time
|
||||
|
||||
; 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
|
||||
|
||||
log-level INFO
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
; the neighbors section contains the configuration for router's neighbors and hello's behavior
|
||||
|
||||
neighbors
|
||||
{
|
||||
; in case hello interest timed out, router will try 'hello-retries' times at 'hello-timeout'
|
||||
; seconds interval before giving up for any neighbors (deciding link is down)
|
||||
|
||||
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
|
||||
; Valid values 1-15
|
||||
|
||||
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 5 ; default value 5. Valid values 0-5. It is recommended that
|
||||
; 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
|
||||
|
||||
first-hello-interval 10 ; Default value 10. Valid values 0-10
|
||||
|
||||
; neighbor command is used to configure router's neighbor. Each neighbor will need
|
||||
; one block of neighbor command
|
||||
|
||||
neighbor
|
||||
{
|
||||
name /ndn/edu/memphis/%C1.Router/cs/castor ; name prefix of the neighbor router consists
|
||||
; of network, site-name and router-name
|
||||
|
||||
face-uri udp://castor.cs.memphis.edu ; face uri of the face connected to the neighbor
|
||||
link-cost 25 ; cost of the connecting link to neighbor
|
||||
}
|
||||
|
||||
neighbor
|
||||
{
|
||||
name /ndn/edu/memphis/%C1.Router/cs/mira ; name prefix of the neighbor router consists
|
||||
; of network, site-name and router-name
|
||||
|
||||
face-uri udp://mira.cs.memphis.edu ; face uri of the face connected to the neighbor
|
||||
link-cost 30 ; cost of the connecting link to neighbor
|
||||
}
|
||||
}
|
||||
|
||||
; the hyperbolic section contains the configuration settings of enabling a router to calculate
|
||||
; routing table using [hyperbolic routing table calculation](http://arxiv.org/abs/0805.1266) method
|
||||
|
||||
hyperbolic
|
||||
{
|
||||
; 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.
|
||||
|
||||
|
||||
radius 123.456 ; radius of the router in hyperbolic coordinate system
|
||||
angle 1.45 ; 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
|
||||
|
||||
fib
|
||||
{
|
||||
; 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
|
||||
|
||||
; routing-calc-interval is the time to wait in seconds after a routing table calculation is
|
||||
; scheduled before actually performing the routing table calculation
|
||||
|
||||
routing-calc-interval 15 ; default value 15. Valid values 0-15. It is recommended that
|
||||
; routing-calc-interval have a higher value than adj-lsa-build-interval
|
||||
}
|
||||
|
||||
; the advertising section contains the configuration settings of the name prefixes
|
||||
; hosted by this router
|
||||
|
||||
advertising
|
||||
{
|
||||
; the ndnname is used to advertised name from the router. To advertise each name prefix
|
||||
; configure one block of ndnname configuration command for every name prefix.
|
||||
|
||||
prefix /ndn/edu/memphis/cs/netlab ; name in ndn URI format
|
||||
prefix /ndn/edu/memphis/sports/basketball
|
||||
}
|
||||
|
||||
security
|
||||
{
|
||||
validator
|
||||
{
|
||||
rule
|
||||
{
|
||||
id "NSLR Hello Rule"
|
||||
for data
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<NLSR><INFO>]*<NLSR><INFO><><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><ksk-.*><ID-CERT>$
|
||||
k-expand \\1
|
||||
h-relation equal
|
||||
p-regex ^([^<NLSR><INFO>]*)<NLSR><INFO><><>$
|
||||
p-expand \\1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule
|
||||
{
|
||||
id "NSLR LSA Rule"
|
||||
for data
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<NLSR><LSA>]*<NLSR><LSA>
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY><NLSR>]*)<NLSR><KEY><ksk-.*><ID-CERT>$
|
||||
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-expand \\1\\2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule
|
||||
{
|
||||
id "NSLR Hierarchy Exception Rule"
|
||||
for data
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<KEY><%C1.Router>]*<%C1.Router>[^<KEY><NLSR>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
hyper-relation
|
||||
{
|
||||
k-regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
|
||||
k-expand \\1
|
||||
h-relation equal
|
||||
p-regex ^([^<KEY><%C1.Router>]*)<%C1.Router>[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
p-expand \\1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule
|
||||
{
|
||||
id "NSLR Hierarchical Rule"
|
||||
for data
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type hierarchical
|
||||
sig-type rsa-sha256
|
||||
}
|
||||
}
|
||||
|
||||
trust-anchor
|
||||
{
|
||||
type file
|
||||
file-name "root.cert"
|
||||
}
|
||||
}
|
||||
|
||||
prefix-update-validator
|
||||
{
|
||||
rule
|
||||
{
|
||||
id "NLSR ControlCommand Rule"
|
||||
for interest
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^<localhost><nlsr><prefix-update>[<advertise><withdraw>]<>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type customized
|
||||
sig-type rsa-sha256
|
||||
key-locator
|
||||
{
|
||||
type name
|
||||
regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rule
|
||||
{
|
||||
id "NLSR Hierarchy Rule"
|
||||
for data
|
||||
filter
|
||||
{
|
||||
type name
|
||||
regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
|
||||
}
|
||||
checker
|
||||
{
|
||||
type hierarchical
|
||||
sig-type rsa-sha256
|
||||
}
|
||||
}
|
||||
|
||||
trust-anchor
|
||||
{
|
||||
type file
|
||||
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
|
||||
|
||||
; cert-to-publish "site.cert" ; optional, a file containing the site certificate
|
||||
; Only the router that is designated to publish the site cert
|
||||
; needs to specify this
|
||||
|
||||
; cert-to-publish "operator.cert" ; optional, a file containing the operator certificate
|
||||
; Only the router that is designated to publish the operator
|
||||
; cert needs to specify this
|
||||
|
||||
cert-to-publish "router.cert" ; required, a file containing the router certificate.
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
#ifndef _NLSR_H_
|
||||
#define _NLSR_H_
|
||||
|
||||
|
||||
#define LSDB_SYNCH_INTERVAL 300
|
||||
#define INTEREST_RETRY 3
|
||||
#define INTEREST_RESEND_TIME 15
|
||||
#define NLSR_LOCKED 1
|
||||
#define NLSR_UNLOCKED 0
|
||||
#define LSA_REFRESH_TIME 1800
|
||||
#define ROUTER_DEAD_INTERVAL 3600
|
||||
#define MAX_FACES_PER_PREFIX 0
|
||||
|
||||
#define LINK_METRIC 10
|
||||
|
||||
#define NAME_LSA_VALID 1
|
||||
#define NAME_LSA_INVALID 0
|
||||
|
||||
#define API_PORT 9999
|
||||
|
||||
|
||||
struct name_prefix
|
||||
{
|
||||
char *name;
|
||||
int length;
|
||||
};
|
||||
|
||||
struct linkStateDatabase
|
||||
{
|
||||
struct hashtb *name_lsdb;
|
||||
struct hashtb *adj_lsdb;
|
||||
struct hashtb *cor_lsdb;
|
||||
|
||||
char *lsdb_version;
|
||||
};
|
||||
|
||||
struct pending_interest
|
||||
{
|
||||
char *int_name;
|
||||
int timed_out;
|
||||
};
|
||||
|
||||
struct nlsr
|
||||
{
|
||||
|
||||
struct ccn_closure in_interest;
|
||||
struct ccn_closure in_content;
|
||||
|
||||
struct ccns_name_closure *closure;
|
||||
struct ccns_slice *slice;
|
||||
struct ccns_handle *ccns;
|
||||
|
||||
struct ccn_schedule *sched;
|
||||
struct ccn_scheduled_event *event;
|
||||
struct ccn_scheduled_event *event_send_info_interest;
|
||||
struct ccn_scheduled_event *event_send_lsdb_interest;
|
||||
struct ccn_scheduled_event *event_build_adj_lsa;
|
||||
struct ccn_scheduled_event *event_calculate_route;
|
||||
|
||||
struct hashtb *adl;
|
||||
struct hashtb *npl;
|
||||
struct hashtb *map;
|
||||
struct hashtb *rev_map;
|
||||
struct hashtb *npt;
|
||||
struct hashtb *routing_table;
|
||||
struct hashtb *keys;
|
||||
|
||||
|
||||
struct linkStateDatabase *lsdb;
|
||||
|
||||
struct ccn *ccn;
|
||||
char *router_name;
|
||||
|
||||
|
||||
|
||||
int is_synch_init;
|
||||
long int nlsa_id;
|
||||
int adj_build_flag;
|
||||
long int adj_build_count;
|
||||
int is_build_adj_lsa_sheduled;
|
||||
int is_send_lsdb_interest_scheduled;
|
||||
int is_route_calculation_scheduled;
|
||||
|
||||
int interest_retry;
|
||||
long int interest_resend_time;
|
||||
long int lsa_refresh_time;
|
||||
long int router_dead_interval;
|
||||
|
||||
long int max_faces_per_prefix;
|
||||
char *logDir;
|
||||
int detailed_logging;
|
||||
int debugging;
|
||||
|
||||
int semaphor;
|
||||
|
||||
int nlsr_api_server_sock_fd;
|
||||
fd_set readfds;
|
||||
int api_port;
|
||||
|
||||
char *topo_prefix;
|
||||
char *slice_prefix;
|
||||
|
||||
char *root_key_prefix;
|
||||
char *keystore_path;
|
||||
char *keystore_passphrase;
|
||||
char *site_name;
|
||||
|
||||
int is_hyperbolic_calc;
|
||||
double cor_r;
|
||||
double cor_theta;
|
||||
|
||||
int isStrictHierchicalKeyCheck;
|
||||
|
||||
int tunnel_type;
|
||||
|
||||
|
||||
};
|
||||
|
||||
struct nlsr *nlsr;
|
||||
|
||||
void process_command_ccnneighbor(char *command);
|
||||
void process_command_ccnname(char *command);
|
||||
void process_command_lsdb_synch_interval(char *command);
|
||||
void process_command_interest_retry(char *command);
|
||||
void process_command_interest_resend_time(char *command);
|
||||
void process_conf_command(char *command);
|
||||
int readConfigFile(const char *filename);
|
||||
|
||||
void nlsr_lock(void);
|
||||
void nlsr_unlock(void);
|
||||
|
||||
int init_nlsr(void);
|
||||
void nlsr_destroy( void );
|
||||
void nlsr_stop_signal_handler(int sig);
|
||||
|
||||
#endif
|
||||
-769
@@ -1,769 +0,0 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#include<math.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/keystore.h>
|
||||
#include <ccn/signing.h>
|
||||
#include <ccn/schedule.h>
|
||||
#include <ccn/hashtb.h>
|
||||
|
||||
#include "nlsr.h"
|
||||
#include "nlsr_npl.h"
|
||||
#include "nlsr_adl.h"
|
||||
#include "utility.h"
|
||||
#include "nlsr_npt.h"
|
||||
|
||||
void
|
||||
add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip)
|
||||
{
|
||||
struct ndn_neighbor *nbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
int res;
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, new_nbr->name, new_nbr->length, 0);
|
||||
|
||||
if(res == HT_NEW_ENTRY )
|
||||
{
|
||||
|
||||
nbr = e->data;
|
||||
|
||||
nbr->neighbor=(struct name_prefix *)malloc(sizeof( struct name_prefix ));
|
||||
nbr->neighbor->name=(char *)malloc(new_nbr->length);
|
||||
memcpy(nbr->neighbor->name,new_nbr->name,new_nbr->length);
|
||||
nbr->neighbor->length=new_nbr->length;
|
||||
nbr->face=face;
|
||||
nbr->status=NBR_DOWN;
|
||||
nbr->info_interest_timed_out=0;
|
||||
nbr->lsdb_interest_timed_out=0;
|
||||
nbr->lsdb_random_time_component=(int)(LSDB_SYNCH_INTERVAL/2);
|
||||
nbr->lsdb_synch_interval=LSDB_SYNCH_INTERVAL;
|
||||
nbr->metric=LINK_METRIC;
|
||||
nbr->is_lsdb_send_interest_scheduled=0;
|
||||
|
||||
nbr->ip_address=(char *)calloc(strlen(ip)+1,sizeof(char));
|
||||
memcpy(nbr->ip_address,ip,strlen(ip)+1);
|
||||
|
||||
char *time_stamp=(char *)malloc(20);
|
||||
get_current_timestamp_micro(time_stamp);
|
||||
nbr->last_lsdb_version=(char *)calloc(strlen(time_stamp)+1,sizeof(char));
|
||||
memcpy(nbr->last_lsdb_version,"0000000000000000",16);
|
||||
nbr->last_info_version=(char *)calloc(strlen(time_stamp)+1,sizeof(char));
|
||||
memcpy(nbr->last_info_version,"0000000000000000",16);
|
||||
free(time_stamp);
|
||||
|
||||
nbr->last_lsdb_requested=0;
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
print_adjacent(struct ndn_neighbor *nbr)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf("print_adjacent called\n");
|
||||
printf("--------Neighbor---------------------------\n");
|
||||
printf(" Neighbor: %s \n",nbr->neighbor->name);
|
||||
printf(" Length : %d \n",nbr->neighbor->length);
|
||||
printf(" Ip Address: %s \n",nbr->ip_address);
|
||||
printf(" Face : %d \n",nbr->face);
|
||||
printf(" Metric : %d \n",nbr->metric);
|
||||
printf(" Status : %d \n",nbr->status);
|
||||
printf(" LSDB Version: %s \n",nbr->last_lsdb_version);
|
||||
printf(" Info Version: %s \n",nbr->last_info_version);
|
||||
printf(" Info Interest Timed Out : %d \n",nbr->info_interest_timed_out);
|
||||
printf(" LSDB Interest Timed Out : %d \n",nbr->lsdb_interest_timed_out);
|
||||
printf(" LSDB Synch Interval : %ld \n",nbr->lsdb_synch_interval);
|
||||
printf(" LSDB Random Time comp : %d \n",nbr->lsdb_random_time_component);
|
||||
printf(" Las Time LSDB Requested: %ld \n",nbr->last_lsdb_requested);
|
||||
printf(" IS_lsdb_send_interest_scheduled : %d \n",nbr->is_lsdb_send_interest_scheduled);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if ( nlsr->detailed_logging )
|
||||
{
|
||||
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_adjacent called\n");
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"--------Neighbor---------------------------\n");
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Neighbor: %s \n",nbr->neighbor->name);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Length : %d \n",nbr->neighbor->length);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Face : %d \n",nbr->face);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Metric : %d \n",nbr->metric);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Status : %d \n",nbr->status);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," LSDB Version: %s \n",nbr->last_lsdb_version);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Info Version: %s \n",nbr->last_info_version);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Info Interest Timed Out : %d \n",nbr->info_interest_timed_out);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," LSDB Interest Timed Out : %d \n",nbr->lsdb_interest_timed_out);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," LSDB Synch Interval : %ld \n",nbr->lsdb_synch_interval);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," LSDB Random Time comp : %d \n",nbr->lsdb_random_time_component);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," Las Time LSDB Requested: %ld \n",nbr->last_lsdb_requested);
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__," IS_lsdb_send_interest_scheduled : %d \n",nbr->is_lsdb_send_interest_scheduled);
|
||||
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
print_adjacent_from_adl(void)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("print_adjacent_from_adl called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_adjacent_from_adl called \n");
|
||||
|
||||
int i, adl_element;
|
||||
struct ndn_neighbor *nbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
adl_element=hashtb_n(nlsr->adl);
|
||||
|
||||
for(i=0;i<adl_element;i++)
|
||||
{
|
||||
nbr=e->data;
|
||||
print_adjacent(nbr);
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
get_adjacent_status(struct name_prefix *nbr)
|
||||
{
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("get_adjacent_status called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adjacent_status called \n");
|
||||
|
||||
int res;
|
||||
int status=-1;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
if (res == HT_OLD_ENTRY)
|
||||
{
|
||||
nnbr=e->data;
|
||||
status=nnbr->status;
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
get_timed_out_number(struct name_prefix *nbr)
|
||||
{
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("get_timed_out_number called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_timed_out_number called \n");
|
||||
|
||||
|
||||
int res,ret=-1;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
nnbr=e->data;
|
||||
ret=nnbr->info_interest_timed_out;
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
get_lsdb_interest_timed_out_number(struct name_prefix *nbr)
|
||||
{
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("get_lsdb_interest_timed_out_number called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_lsdb_interest_timed_out_number called \n");
|
||||
|
||||
int res,ret=-1;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
nnbr=e->data;
|
||||
ret=nnbr->lsdb_interest_timed_out;
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
update_adjacent_timed_out_to_adl(struct name_prefix *nbr, int increment)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("update_adjacent_timed_out_to_adl called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_to_adl called \n");
|
||||
|
||||
int res;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
nnbr=e->data;
|
||||
nnbr->info_interest_timed_out += increment;
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
void
|
||||
update_adjacent_timed_out_zero_to_adl(struct name_prefix *nbr)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("update_adjacent_timed_out_zero_to_adl called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_zero_to_adl called \n");
|
||||
|
||||
int time_out_number=get_timed_out_number(nbr);
|
||||
update_adjacent_timed_out_to_adl(nbr,-time_out_number);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
update_lsdb_interest_timed_out_to_adl(struct name_prefix *nbr, int increment)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("update_lsdb_interest_timed_out_to_adl called\n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_lsdb_interest_timed_out_to_adl called \n");
|
||||
|
||||
int res;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
nnbr=e->data;
|
||||
nnbr->lsdb_interest_timed_out += increment;
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
void
|
||||
update_lsdb_interest_timed_out_zero_to_adl(struct name_prefix *nbr)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("update_adjacent_timed_out_zero_to_adl called\n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_zero_to_adl called\n");
|
||||
|
||||
int time_out_number=get_lsdb_interest_timed_out_number(nbr);
|
||||
update_lsdb_interest_timed_out_to_adl(nbr,-time_out_number);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
update_adjacent_status_to_adl(struct name_prefix *nbr, int status)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("update_adjacent_status_to_adl called\n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_status_to_adl called \n");
|
||||
|
||||
int res;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
|
||||
if (res == HT_OLD_ENTRY)
|
||||
{
|
||||
nnbr=e->data;
|
||||
if ( nnbr->status!=status )
|
||||
{
|
||||
nnbr->status=status;
|
||||
nlsr->adj_build_flag++;
|
||||
}
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
delete_nbr_from_adl(struct name_prefix *nbr)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("delete_nbr_from_adl called\n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_nbr_from_adl called \n");
|
||||
|
||||
int res;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
|
||||
if (res == HT_OLD_ENTRY)
|
||||
{
|
||||
struct ndn_neighbor *nbr=e->data;
|
||||
/*free(nbr->neighbor->name);
|
||||
free(nbr->neighbor);
|
||||
free(nbr->last_lsdb_version);
|
||||
free(nbr->last_info_version);
|
||||
free(nbr->ip_address);
|
||||
*/
|
||||
destroy_nbr_component(nbr);
|
||||
hashtb_delete(e);
|
||||
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
void
|
||||
update_lsdb_synch_interval_to_adl(struct name_prefix *nbr, long int interval)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("update_lsdb_synch_interval_to_adl called\n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_lsdb_synch_interval_to_adl called \n");
|
||||
|
||||
int res;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr->name, nbr->length, 0);
|
||||
|
||||
|
||||
if (res == HT_OLD_ENTRY)
|
||||
{
|
||||
nnbr=e->data;
|
||||
if ( nnbr->lsdb_synch_interval!= interval )
|
||||
{
|
||||
nnbr->lsdb_synch_interval=interval;
|
||||
nnbr->lsdb_random_time_component=(int)(interval/2);
|
||||
|
||||
}
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
no_active_nbr(void)
|
||||
{
|
||||
int i, adl_element;
|
||||
int no_link=0;
|
||||
struct ndn_neighbor *nbr;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
hashtb_start(nlsr->adl, e);
|
||||
adl_element=hashtb_n(nlsr->adl);
|
||||
|
||||
for(i=0;i<adl_element;i++)
|
||||
{
|
||||
nbr=e->data;
|
||||
if( nbr->status == 1 )
|
||||
no_link++;
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
return no_link;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
is_adj_lsa_build(void)
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
int nbr_count=0;
|
||||
|
||||
int i, adl_element;
|
||||
struct ndn_neighbor *nbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
adl_element=hashtb_n(nlsr->adl);
|
||||
|
||||
for(i=0;i<adl_element;i++)
|
||||
{
|
||||
nbr=e->data;
|
||||
if(nbr->status == 1 )
|
||||
{
|
||||
nbr_count++;
|
||||
}
|
||||
else if ( (nbr->status == 0) && (nbr->info_interest_timed_out >= nlsr->interest_retry || nbr->lsdb_interest_timed_out >= nlsr->interest_retry))
|
||||
{
|
||||
nbr_count++;
|
||||
}
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
if(nbr_count == adl_element)
|
||||
ret=1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_active_nbr_adj_data(struct ccn_charbuf *c)
|
||||
{
|
||||
|
||||
int i, adl_element;
|
||||
struct ndn_neighbor *nbr;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
hashtb_start(nlsr->adl, e);
|
||||
adl_element=hashtb_n(nlsr->adl);
|
||||
|
||||
for(i=0;i<adl_element;i++)
|
||||
{
|
||||
nbr=e->data;
|
||||
if( nbr->status == 1 )
|
||||
{
|
||||
ccn_charbuf_append_string(c,nbr->neighbor->name);
|
||||
ccn_charbuf_append_string(c,"|");
|
||||
|
||||
char *temp_length=(char *)malloc(20);
|
||||
memset(temp_length,0,20);
|
||||
sprintf(temp_length,"%d",nbr->neighbor->length);
|
||||
ccn_charbuf_append_string(c,temp_length);
|
||||
free(temp_length);
|
||||
ccn_charbuf_append_string(c,"|");
|
||||
|
||||
char *temp_metric=(char *)malloc(20);
|
||||
memset(temp_metric,0,20);
|
||||
sprintf(temp_metric,"%d",nbr->metric);
|
||||
ccn_charbuf_append_string(c,temp_metric);
|
||||
free(temp_metric);
|
||||
ccn_charbuf_append_string(c,"|");
|
||||
|
||||
}
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
get_next_hop_face_from_adl(char *nbr)
|
||||
{
|
||||
int res;
|
||||
int connecting_face=NO_FACE;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
nnbr=e->data;
|
||||
connecting_face=nnbr->face;
|
||||
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
return connecting_face;
|
||||
}
|
||||
|
||||
void
|
||||
update_face_to_adl_for_nbr(char *nbr, int face)
|
||||
{
|
||||
int res;
|
||||
struct ndn_neighbor *nnbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
nnbr=e->data;
|
||||
nnbr->face=face;
|
||||
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
int
|
||||
is_neighbor(char *nbr)
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
int res;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
ret=1;
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
is_active_neighbor(char *nbr)
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
int res;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
|
||||
|
||||
if( res == HT_OLD_ENTRY )
|
||||
{
|
||||
struct ndn_neighbor *nnbr;
|
||||
nnbr=e->data;
|
||||
if (nnbr->status == NBR_ACTIVE )
|
||||
{
|
||||
ret=1;
|
||||
}
|
||||
}
|
||||
else if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_host_name_from_command_string(struct name_prefix *name_part,
|
||||
char *nbr_name_uri, int offset)
|
||||
{
|
||||
|
||||
|
||||
|
||||
int res,i;
|
||||
int len=0;
|
||||
const unsigned char *comp_ptr1;
|
||||
size_t comp_size;
|
||||
|
||||
struct ccn_charbuf *name=ccn_charbuf_create();
|
||||
res = ccn_name_from_uri(name,nbr_name_uri);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Bad ccn URI: %s\n", nbr_name_uri);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//struct ccn_indexbuf cid={0};
|
||||
|
||||
//struct ccn_indexbuf *components=&cid;
|
||||
struct ccn_indexbuf *components=ccn_indexbuf_create();
|
||||
ccn_name_split (name, components);
|
||||
|
||||
for(i=components->n-2;i> (0+offset);i--)
|
||||
{
|
||||
res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
|
||||
len+=1;
|
||||
len+=(int)comp_size;
|
||||
}
|
||||
len++;
|
||||
|
||||
char *neighbor=(char *)malloc(len);
|
||||
memset(neighbor,0,len);
|
||||
|
||||
for(i=components->n-2;i> (0+offset);i--)
|
||||
{
|
||||
res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
|
||||
if ( i != components->n-2)
|
||||
memcpy(neighbor+strlen(neighbor),".",1);
|
||||
memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,
|
||||
strlen((char *)comp_ptr1));
|
||||
|
||||
}
|
||||
|
||||
name_part->name=(char *)calloc(strlen(neighbor)+1,sizeof(char));
|
||||
memcpy(name_part->name,neighbor,strlen(neighbor)+1);
|
||||
name_part->length=strlen(neighbor)+1;
|
||||
|
||||
// 01/31/2013
|
||||
free(neighbor);
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_indexbuf_destroy(&components);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
destroy_nbr_component(struct ndn_neighbor *nbr)
|
||||
{
|
||||
if ( nbr->neighbor->name )
|
||||
free(nbr->neighbor->name);
|
||||
if ( nbr->neighbor )
|
||||
free(nbr->neighbor);
|
||||
if ( nbr->last_lsdb_version)
|
||||
free(nbr->last_lsdb_version);
|
||||
if ( nbr->last_info_version)
|
||||
free(nbr->last_info_version);
|
||||
if ( nbr->ip_address)
|
||||
free(nbr->ip_address);
|
||||
}
|
||||
|
||||
void
|
||||
destroy_adl(void)
|
||||
{
|
||||
int i, adl_element;
|
||||
struct ndn_neighbor *nbr;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->adl, e);
|
||||
adl_element=hashtb_n(nlsr->adl);
|
||||
|
||||
for(i=0;i<adl_element;i++)
|
||||
{
|
||||
nbr=e->data;
|
||||
destroy_nbr_component(nbr);
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
if( nlsr->adl )
|
||||
hashtb_destroy(&nlsr->adl);
|
||||
|
||||
}
|
||||
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
#ifndef _NLSR_ADL_H_
|
||||
#define _NLSR_ADL_H_
|
||||
|
||||
#define NBR_DOWN 0
|
||||
#define NBR_ACTIVE 1
|
||||
|
||||
struct ndn_neighbor
|
||||
{
|
||||
struct name_prefix *neighbor;
|
||||
int face;
|
||||
int status;
|
||||
char * last_lsdb_version;
|
||||
char * last_info_version;
|
||||
char *ip_address;
|
||||
int info_interest_timed_out;
|
||||
int lsdb_interest_timed_out;
|
||||
int lsdb_random_time_component;
|
||||
long int lsdb_synch_interval;
|
||||
long int last_lsdb_requested;
|
||||
int is_lsdb_send_interest_scheduled;
|
||||
int metric;
|
||||
};
|
||||
|
||||
void add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip);
|
||||
void delete_nbr_from_adl(struct name_prefix *nbr);
|
||||
void print_adjacent(struct ndn_neighbor *nbr);
|
||||
void print_adjacent_from_adl(void);
|
||||
int get_adjacent_status(struct name_prefix *nbr);
|
||||
int get_timed_out_number(struct name_prefix *nbr);
|
||||
int get_lsdb_interest_timed_out_number(struct name_prefix *nbr);
|
||||
void update_adjacent_timed_out_to_adl(struct name_prefix *nbr, int increment);
|
||||
void update_adjacent_timed_out_zero_to_adl(struct name_prefix *nbr);
|
||||
void update_lsdb_interest_timed_out_to_adl(struct name_prefix *nbr, int increment);
|
||||
void update_lsdb_interest_timed_out_zero_to_adl(struct name_prefix *nbr);
|
||||
void update_adjacent_status_to_adl(struct name_prefix *nbr, int status);
|
||||
void update_lsdb_synch_interval_to_adl(struct name_prefix *nbr, long int interval);
|
||||
int no_active_nbr(void);
|
||||
int is_adj_lsa_build(void);
|
||||
void get_active_nbr_adj_data(struct ccn_charbuf *c);
|
||||
long int get_nbr_time_diff_lsdb_req(char *nbr);
|
||||
long int get_nbr_last_lsdb_requested(char *nbr);
|
||||
long int get_nbr_last_lsdb_requested(char *nbr);
|
||||
long int get_lsdb_synch_interval(char *nbr);
|
||||
int get_nbr_random_time_component(char *nbr);
|
||||
char * get_nbr_lsdb_version(char *nbr);
|
||||
void update_adjacent_last_lsdb_requested_to_adl(char *nbr, long int timestamp);
|
||||
void set_is_lsdb_send_interest_scheduled_to_zero(char *nbr);
|
||||
void update_adjacent_lsdb_version_to_adl(struct name_prefix *nbr, char *version);
|
||||
void adjust_adjacent_last_lsdb_requested_to_adl(char *nbr, long int sec);
|
||||
int get_next_hop_face_from_adl(char *nbr);
|
||||
int is_neighbor(char *nbr);
|
||||
int is_active_neighbor(char *nbr);
|
||||
void update_face_to_adl_for_nbr(char *nbr, int face);
|
||||
|
||||
void get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset);
|
||||
void destroy_nbr_component(struct ndn_neighbor *nbr);
|
||||
void destroy_adl(void);
|
||||
#endif
|
||||
-410
@@ -1,410 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/face_mgmt.h>
|
||||
#include <ccn/reg_mgmt.h>
|
||||
#include <ccn/charbuf.h>
|
||||
|
||||
|
||||
|
||||
#include "nlsr_face.h"
|
||||
|
||||
static void
|
||||
ccn_fib_warn(int lineno, const char *format, ...)
|
||||
{
|
||||
struct timeval t;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
gettimeofday(&t, NULL);
|
||||
fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
ccn_fib_fatal(int lineno, const char *format, ...)
|
||||
{
|
||||
struct timeval t;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
gettimeofday(&t, NULL);
|
||||
fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#define ON_ERROR_EXIT(resval, msg) on_error_exit((resval), __LINE__, msg)
|
||||
|
||||
static void
|
||||
on_error_exit(int res, int lineno, const char *msg)
|
||||
{
|
||||
if (res >= 0)
|
||||
return;
|
||||
ccn_fib_fatal(lineno, "fatal error, res = %d, %s\n", res, msg);
|
||||
}
|
||||
|
||||
#define ON_ERROR_CLEANUP(resval) \
|
||||
{ \
|
||||
if ((resval) < 0) { \
|
||||
ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ON_NULL_CLEANUP(resval) \
|
||||
{ \
|
||||
if ((resval) == NULL) { \
|
||||
ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Bind a prefix to a face
|
||||
*
|
||||
*/
|
||||
static int
|
||||
register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
|
||||
struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,
|
||||
struct ccn_face_instance *face_instance, int operation)
|
||||
{
|
||||
struct ccn_charbuf *temp = NULL;
|
||||
struct ccn_charbuf *resultbuf = NULL;
|
||||
struct ccn_charbuf *signed_info = NULL;
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_charbuf *prefixreg = NULL;
|
||||
struct ccn_parsed_ContentObject pcobuf = {0};
|
||||
struct ccn_forwarding_entry forwarding_entry_storage = {0};
|
||||
struct ccn_forwarding_entry *forwarding_entry = &forwarding_entry_storage;
|
||||
struct ccn_forwarding_entry *new_forwarding_entry;
|
||||
const unsigned char *ptr = NULL;
|
||||
size_t length = 0;
|
||||
int res;
|
||||
|
||||
/* Register or unregister the prefix */
|
||||
forwarding_entry->action = (operation == OP_REG) ? "prefixreg" : "unreg";
|
||||
forwarding_entry->name_prefix = name_prefix;
|
||||
forwarding_entry->ccnd_id = face_instance->ccnd_id;
|
||||
forwarding_entry->ccnd_id_size = face_instance->ccnd_id_size;
|
||||
forwarding_entry->faceid = face_instance->faceid;
|
||||
forwarding_entry->flags = -1;
|
||||
forwarding_entry->lifetime = (~0U) >> 1;
|
||||
|
||||
prefixreg = ccn_charbuf_create();
|
||||
ccnb_append_forwarding_entry(prefixreg, forwarding_entry);
|
||||
temp = ccn_charbuf_create();
|
||||
res = ccn_sign_content(h, temp, no_name, NULL, prefixreg->buf, prefixreg->length);
|
||||
resultbuf = ccn_charbuf_create();
|
||||
|
||||
/* construct Interest containing prefixreg request */
|
||||
name = ccn_charbuf_create();
|
||||
ccn_name_init(name);
|
||||
ccn_name_append_str(name, "ccnx");
|
||||
ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
|
||||
ccn_name_append_str(name, (operation == OP_REG) ? "prefixreg" : "unreg");
|
||||
ccn_name_append(name, temp->buf, temp->length);
|
||||
|
||||
/* send Interest, get Data */
|
||||
res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
/* extract new forwarding entry from Data */
|
||||
new_forwarding_entry = ccn_forwarding_entry_parse(ptr, length);
|
||||
ON_NULL_CLEANUP(new_forwarding_entry);
|
||||
|
||||
res = new_forwarding_entry->faceid;
|
||||
|
||||
ccn_forwarding_entry_destroy(&new_forwarding_entry);
|
||||
ccn_charbuf_destroy(&signed_info);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_charbuf_destroy(&prefixreg);
|
||||
|
||||
return res;
|
||||
|
||||
cleanup:
|
||||
ccn_forwarding_entry_destroy(&new_forwarding_entry);
|
||||
ccn_charbuf_destroy(&signed_info);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_charbuf_destroy(&prefixreg);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Create new face by sending out a request Interest
|
||||
* The actual new face instance is returned
|
||||
*
|
||||
*/
|
||||
static
|
||||
struct ccn_face_instance *create_face(struct ccn *h, struct ccn_charbuf *local_scope_template,
|
||||
struct ccn_charbuf *no_name, struct ccn_face_instance *face_instance)
|
||||
{
|
||||
struct ccn_charbuf *newface = NULL;
|
||||
struct ccn_charbuf *signed_info = NULL;
|
||||
struct ccn_charbuf *temp = NULL;
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_charbuf *resultbuf = NULL;
|
||||
struct ccn_parsed_ContentObject pcobuf = {0};
|
||||
struct ccn_face_instance *new_face_instance = NULL;
|
||||
const unsigned char *ptr = NULL;
|
||||
size_t length = 0;
|
||||
int res = 0;
|
||||
|
||||
/* Encode the given face instance */
|
||||
newface = ccn_charbuf_create();
|
||||
ccnb_append_face_instance(newface, face_instance);
|
||||
|
||||
temp = ccn_charbuf_create();
|
||||
res = ccn_sign_content(h, temp, no_name, NULL, newface->buf, newface->length);
|
||||
resultbuf = ccn_charbuf_create();
|
||||
|
||||
/* Construct the Interest name that will create the face */
|
||||
name = ccn_charbuf_create();
|
||||
ccn_name_init(name);
|
||||
ccn_name_append_str(name, "ccnx");
|
||||
ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
|
||||
ccn_name_append_str(name, face_instance->action);
|
||||
ccn_name_append(name, temp->buf, temp->length);
|
||||
|
||||
/* send Interest to retrieve Data that contains the newly created face */
|
||||
res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
/* decode Data to get the actual face instance */
|
||||
res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
new_face_instance = ccn_face_instance_parse(ptr, length);
|
||||
|
||||
ccn_charbuf_destroy(&newface);
|
||||
ccn_charbuf_destroy(&signed_info);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&name);
|
||||
|
||||
return new_face_instance;
|
||||
|
||||
cleanup:
|
||||
ccn_charbuf_destroy(&newface);
|
||||
ccn_charbuf_destroy(&signed_info);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get ccnd id
|
||||
*
|
||||
*/
|
||||
static int
|
||||
get_ccndid(struct ccn *h, struct ccn_charbuf *local_scope_template,
|
||||
unsigned char *ccndid)
|
||||
{
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_charbuf *resultbuf = NULL;
|
||||
struct ccn_parsed_ContentObject pcobuf = {0};
|
||||
char ccndid_uri[] = "ccnx:/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY";
|
||||
const unsigned char *ccndid_result;
|
||||
static size_t ccndid_result_size;
|
||||
int res;
|
||||
|
||||
name = ccn_charbuf_create();
|
||||
resultbuf = ccn_charbuf_create();
|
||||
|
||||
res = ccn_name_from_uri(name, ccndid_uri);
|
||||
ON_ERROR_EXIT(res, "Unable to parse service locator URI for ccnd key\n");
|
||||
|
||||
/* get Data */
|
||||
res = ccn_get(h, name, local_scope_template, 4500, resultbuf, &pcobuf, NULL, 0);
|
||||
ON_ERROR_EXIT(res, "Unable to get key from ccnd\n");
|
||||
|
||||
/* extract from Data */
|
||||
res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest,
|
||||
resultbuf->buf,
|
||||
pcobuf.offset[CCN_PCO_B_PublisherPublicKeyDigest],
|
||||
pcobuf.offset[CCN_PCO_E_PublisherPublicKeyDigest],
|
||||
&ccndid_result, &ccndid_result_size);
|
||||
ON_ERROR_EXIT(res, "Unable to parse ccnd response for ccnd id\n");
|
||||
|
||||
memcpy((void *)ccndid, ccndid_result, ccndid_result_size);
|
||||
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
|
||||
return (ccndid_result_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new face instance based on the given address and port
|
||||
* This face instance is only used to send new face request
|
||||
*/
|
||||
static struct
|
||||
ccn_face_instance *construct_face(const unsigned char *ccndid, size_t ccndid_size,
|
||||
const char *address, const char *port, unsigned int tunnel_proto)
|
||||
{
|
||||
struct ccn_face_instance *fi = calloc(1, sizeof(*fi));
|
||||
char rhostnamebuf[NI_MAXHOST];
|
||||
char rhostportbuf[NI_MAXSERV];
|
||||
struct addrinfo hints = {.ai_family = AF_UNSPEC, .ai_flags = (AI_ADDRCONFIG),
|
||||
.ai_socktype = SOCK_DGRAM};
|
||||
struct addrinfo *raddrinfo = NULL;
|
||||
struct ccn_charbuf *store = ccn_charbuf_create();
|
||||
int host_off = -1;
|
||||
int port_off = -1;
|
||||
int res;
|
||||
|
||||
res = getaddrinfo(address, port, &hints, &raddrinfo);
|
||||
if (res != 0 || raddrinfo == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error: getaddrinfo\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = getnameinfo(raddrinfo->ai_addr, raddrinfo->ai_addrlen,
|
||||
rhostnamebuf, sizeof(rhostnamebuf),
|
||||
rhostportbuf, sizeof(rhostportbuf),
|
||||
NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
freeaddrinfo(raddrinfo);
|
||||
if (res != 0)
|
||||
{
|
||||
fprintf(stderr, "Error: getnameinfo\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fi->store = store;
|
||||
fi->descr.ipproto = tunnel_proto;
|
||||
fi->descr.mcast_ttl = CCN_FIB_MCASTTTL;
|
||||
fi->lifetime = CCN_FIB_LIFETIME;
|
||||
|
||||
ccn_charbuf_append(store, "newface", strlen("newface") + 1);
|
||||
host_off = store->length;
|
||||
ccn_charbuf_append(store, rhostnamebuf, strlen(rhostnamebuf) + 1);
|
||||
port_off = store->length;
|
||||
ccn_charbuf_append(store, rhostportbuf, strlen(rhostportbuf) + 1);
|
||||
|
||||
char *b = (char *)store->buf;
|
||||
fi->action = b;
|
||||
fi->descr.address = b + host_off;
|
||||
fi->descr.port = b + port_off;
|
||||
fi->descr.source_address = NULL;
|
||||
fi->ccnd_id = ccndid;
|
||||
fi->ccnd_id_size = ccndid_size;
|
||||
|
||||
return fi;
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize local data
|
||||
*/
|
||||
static void
|
||||
init_data(struct ccn_charbuf *local_scope_template,
|
||||
struct ccn_charbuf *no_name)
|
||||
{
|
||||
ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Interest, CCN_DTAG);
|
||||
ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Name, CCN_DTAG);
|
||||
ccn_charbuf_append_closer(local_scope_template); /* </Name> */
|
||||
ccnb_tagged_putf(local_scope_template, CCN_DTAG_Scope, "1");
|
||||
ccn_charbuf_append_closer(local_scope_template); /* </Interest> */
|
||||
|
||||
ccn_name_init(no_name);
|
||||
}
|
||||
|
||||
static int
|
||||
add_delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int p, int operation,unsigned int tunnel_proto)
|
||||
{
|
||||
struct ccn_charbuf *prefix;
|
||||
char port[6];
|
||||
struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
|
||||
struct ccn_charbuf *no_name = ccn_charbuf_create();
|
||||
unsigned char ccndid_storage[32] = {0};
|
||||
unsigned char *ccndid = ccndid_storage;
|
||||
size_t ccndid_size = 0;
|
||||
struct ccn_face_instance *fi;
|
||||
struct ccn_face_instance *nfi;
|
||||
int res;
|
||||
|
||||
prefix = ccn_charbuf_create();
|
||||
res = ccn_name_from_uri(prefix, uri);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
memset(port, 0, 6);
|
||||
sprintf(port, "%d", p);
|
||||
|
||||
init_data(local_scope_template, no_name);
|
||||
|
||||
ccndid_size = get_ccndid(h, local_scope_template, ccndid);
|
||||
if (ccndid_size != sizeof(ccndid_storage))
|
||||
{
|
||||
fprintf(stderr, "Incorrect size for ccnd id in response\n");
|
||||
ON_ERROR_CLEANUP(-1);
|
||||
}
|
||||
|
||||
/* construct a face instance for new face request */
|
||||
fi = construct_face(ccndid, ccndid_size, address, port,tunnel_proto);
|
||||
ON_NULL_CLEANUP(fi);
|
||||
|
||||
/* send new face request to actually create a new face */
|
||||
nfi = create_face(h, local_scope_template, no_name, fi);
|
||||
ON_NULL_CLEANUP(nfi);
|
||||
|
||||
|
||||
res = register_unregister_prefix(h, local_scope_template, no_name, prefix, nfi, operation);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
int faceid=nfi->faceid;
|
||||
|
||||
ccn_charbuf_destroy(&local_scope_template);
|
||||
ccn_charbuf_destroy(&no_name);
|
||||
ccn_face_instance_destroy(&fi);
|
||||
ccn_face_instance_destroy(&nfi);
|
||||
ccn_charbuf_destroy(&prefix);
|
||||
|
||||
|
||||
return faceid;
|
||||
|
||||
cleanup:
|
||||
ccn_charbuf_destroy(&prefix);
|
||||
ccn_charbuf_destroy(&local_scope_template);
|
||||
ccn_charbuf_destroy(&no_name);
|
||||
ccn_face_instance_destroy(&fi);
|
||||
ccn_face_instance_destroy(&nfi);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port, unsigned int tunnel_proto)
|
||||
{
|
||||
return add_delete_ccn_face(h, uri, address, port, OP_REG,tunnel_proto);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto)
|
||||
{
|
||||
return add_delete_ccn_face(h, uri, address, port, OP_UNREG,tunnel_proto);
|
||||
}
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
#ifndef _NLSR_FACE_H_
|
||||
#define _NLSR_FACE_H_
|
||||
|
||||
#define CCN_FIB_LIFETIME ((~0U) >> 1)
|
||||
#define CCN_FIB_MCASTTTL (-1)
|
||||
#define OP_REG 0
|
||||
#define OP_UNREG 1
|
||||
|
||||
int add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto);
|
||||
int delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto);
|
||||
|
||||
#endif
|
||||
-236
@@ -1,236 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/face_mgmt.h>
|
||||
#include <ccn/reg_mgmt.h>
|
||||
#include <ccn/charbuf.h>
|
||||
|
||||
#include "nlsr_fib.h"
|
||||
#include "nlsr.h"
|
||||
|
||||
|
||||
static void
|
||||
ccn_fib_warn(int lineno, const char *format, ...)
|
||||
{
|
||||
struct timeval t;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
gettimeofday(&t, NULL);
|
||||
fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#define ON_ERROR_CLEANUP(resval) \
|
||||
{ \
|
||||
if ((resval) < 0) { \
|
||||
ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ON_NULL_CLEANUP(resval) \
|
||||
{ \
|
||||
if ((resval) == NULL) { \
|
||||
ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
|
||||
goto cleanup; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
|
||||
struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,
|
||||
const unsigned char *ccndid, size_t ccnd_id_size, int faceid,
|
||||
int operation, long int lifetime)
|
||||
{
|
||||
struct ccn_charbuf *temp = NULL;
|
||||
struct ccn_charbuf *resultbuf = NULL;
|
||||
struct ccn_charbuf *signed_info = NULL;
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_charbuf *prefixreg = NULL;
|
||||
struct ccn_parsed_ContentObject pcobuf = {0};
|
||||
struct ccn_forwarding_entry forwarding_entry_storage = {0};
|
||||
struct ccn_forwarding_entry *forwarding_entry = &forwarding_entry_storage;
|
||||
struct ccn_forwarding_entry *new_forwarding_entry;
|
||||
const unsigned char *ptr = NULL;
|
||||
size_t length = 0;
|
||||
int res;
|
||||
|
||||
/* Register or unregister the prefix */
|
||||
forwarding_entry->action = (operation == OP_REG) ? "prefixreg" : "unreg";
|
||||
forwarding_entry->name_prefix = name_prefix;
|
||||
forwarding_entry->ccnd_id = ccndid;
|
||||
forwarding_entry->ccnd_id_size =ccnd_id_size;
|
||||
forwarding_entry->faceid = faceid;
|
||||
forwarding_entry->flags = -1;
|
||||
forwarding_entry->lifetime = lifetime;
|
||||
|
||||
prefixreg = ccn_charbuf_create();
|
||||
ccnb_append_forwarding_entry(prefixreg, forwarding_entry);
|
||||
temp = ccn_charbuf_create();
|
||||
res = ccn_sign_content(h, temp, no_name, NULL, prefixreg->buf, prefixreg->length);
|
||||
resultbuf = ccn_charbuf_create();
|
||||
|
||||
/* construct Interest containing prefixreg request */
|
||||
name = ccn_charbuf_create();
|
||||
ccn_name_init(name);
|
||||
ccn_name_append_str(name, "ccnx");
|
||||
ccn_name_append(name, ccndid, ccnd_id_size);
|
||||
ccn_name_append_str(name, (operation == OP_REG) ? "prefixreg" : "unreg");
|
||||
ccn_name_append(name, temp->buf, temp->length);
|
||||
|
||||
/* send Interest, get Data */
|
||||
res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
/* extract new forwarding entry from Data */
|
||||
new_forwarding_entry = ccn_forwarding_entry_parse(ptr, length);
|
||||
ON_NULL_CLEANUP(new_forwarding_entry);
|
||||
|
||||
res = new_forwarding_entry->faceid;
|
||||
|
||||
ccn_forwarding_entry_destroy(&new_forwarding_entry);
|
||||
ccn_charbuf_destroy(&signed_info);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_charbuf_destroy(&prefixreg);
|
||||
|
||||
return res;
|
||||
|
||||
cleanup:
|
||||
if ( signed_info )
|
||||
ccn_charbuf_destroy(&signed_info);
|
||||
if ( temp )
|
||||
ccn_charbuf_destroy(&temp);
|
||||
if ( resultbuf )
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&name);
|
||||
if ( prefixreg )
|
||||
ccn_charbuf_destroy(&prefixreg);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
get_ccndid(struct ccn *h, struct ccn_charbuf *local_scope_template,
|
||||
unsigned char *ccndid)
|
||||
{
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_charbuf *resultbuf = NULL;
|
||||
struct ccn_parsed_ContentObject pcobuf = {0};
|
||||
char ccndid_uri[] = "ccnx:/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY";
|
||||
const unsigned char *ccndid_result;
|
||||
static size_t ccndid_result_size;
|
||||
int res;
|
||||
|
||||
name = ccn_charbuf_create();
|
||||
resultbuf = ccn_charbuf_create();
|
||||
|
||||
res = ccn_name_from_uri(name, ccndid_uri);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
/* get Data */
|
||||
res = ccn_get(h, name, local_scope_template, 4500, resultbuf, &pcobuf, NULL, 0);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
/* extract from Data */
|
||||
res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest,
|
||||
resultbuf->buf,
|
||||
pcobuf.offset[CCN_PCO_B_PublisherPublicKeyDigest],
|
||||
pcobuf.offset[CCN_PCO_E_PublisherPublicKeyDigest],
|
||||
&ccndid_result, &ccndid_result_size);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
memcpy((void *)ccndid, ccndid_result, ccndid_result_size);
|
||||
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
|
||||
return (ccndid_result_size);
|
||||
|
||||
cleanup:
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
init_data(struct ccn_charbuf *local_scope_template,
|
||||
struct ccn_charbuf *no_name)
|
||||
{
|
||||
ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Interest, CCN_DTAG);
|
||||
ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Name, CCN_DTAG);
|
||||
ccn_charbuf_append_closer(local_scope_template); /* </Name> */
|
||||
ccnb_tagged_putf(local_scope_template, CCN_DTAG_Scope, "1");
|
||||
ccn_charbuf_append_closer(local_scope_template); /* </Interest> */
|
||||
|
||||
ccn_name_init(no_name);
|
||||
}
|
||||
|
||||
int
|
||||
add_delete_ccn_face_by_face_id(struct ccn *h, const char *uri, int operation, int faceid, long int lifetime)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf("add_delete_ccn_face_by_face_id called\n");
|
||||
printf("Uri: %s Face: %d Operation: %s \n",(char *)uri , faceid, operation == OP_REG ? "Registration" : "Unregistration");
|
||||
}
|
||||
|
||||
struct ccn_charbuf *prefix;
|
||||
struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
|
||||
struct ccn_charbuf *no_name = ccn_charbuf_create();
|
||||
unsigned char ccndid_storage[32] = {0};
|
||||
unsigned char *ccndid = ccndid_storage;
|
||||
size_t ccndid_size = 0;
|
||||
int res;
|
||||
|
||||
prefix = ccn_charbuf_create();
|
||||
res = ccn_name_from_uri(prefix, uri);
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
|
||||
init_data(local_scope_template, no_name);
|
||||
|
||||
ccndid_size = get_ccndid(h, local_scope_template, ccndid);
|
||||
if (ccndid_size != sizeof(ccndid_storage))
|
||||
{
|
||||
fprintf(stderr, "Incorrect size for ccnd id in response\n");
|
||||
ON_ERROR_CLEANUP(-1);
|
||||
}
|
||||
|
||||
res = register_unregister_prefix(h, local_scope_template, no_name, prefix,ccndid, ccndid_size,faceid, operation,lifetime);
|
||||
|
||||
ON_ERROR_CLEANUP(res);
|
||||
|
||||
ccn_charbuf_destroy(&local_scope_template);
|
||||
ccn_charbuf_destroy(&no_name);
|
||||
ccn_charbuf_destroy(&prefix);
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
ccn_charbuf_destroy(&prefix);
|
||||
ccn_charbuf_destroy(&local_scope_template);
|
||||
ccn_charbuf_destroy(&no_name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
#ifndef _NLSR_FIB_H_
|
||||
#define _NLSR_FIB_H_
|
||||
|
||||
#define CCN_FIB_LIFETIME ((~0U) >> 1)
|
||||
#define CCN_FIB_MCASTTTL (-1)
|
||||
#define OP_REG 0
|
||||
#define OP_UNREG 1
|
||||
|
||||
int add_delete_ccn_face_by_face_id(struct ccn *h, const char *uri, int operation,
|
||||
int faceid, long int lifetime);
|
||||
|
||||
#endif
|
||||
@@ -1,564 +0,0 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/keystore.h>
|
||||
#include <ccn/signing.h>
|
||||
#include <ccn/schedule.h>
|
||||
#include <ccn/hashtb.h>
|
||||
|
||||
#include "nlsr.h"
|
||||
#include "nlsr_km.h"
|
||||
#include "nlsr_km_util.h"
|
||||
#include "utility.h"
|
||||
|
||||
int
|
||||
sign_content_with_user_defined_keystore(struct ccn_charbuf *content_name,
|
||||
struct ccn_charbuf *resultbuf,
|
||||
const void *data,
|
||||
size_t data_size,
|
||||
char *keystore_path,
|
||||
char *keystore_passphrase,
|
||||
char *key_repo_name,
|
||||
char *site_name,
|
||||
char *router_name,
|
||||
long int freshness){
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("sign_content_with_user_defined_keystore called\n");
|
||||
|
||||
|
||||
int res;
|
||||
|
||||
|
||||
struct ccn_charbuf * pubid_out=ccn_charbuf_create();
|
||||
struct ccn_charbuf * keyname;
|
||||
|
||||
|
||||
struct ccn_keystore *keystore = NULL;
|
||||
keystore=ccn_keystore_create();
|
||||
res=ccn_keystore_init(keystore, keystore_path,keystore_passphrase );
|
||||
if ( res < 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Error in initiating keystore :(\n");
|
||||
ccn_keystore_destroy(&keystore);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
res=ccn_load_private_key (nlsr->ccn,
|
||||
keystore_path,
|
||||
keystore_passphrase,
|
||||
pubid_out);
|
||||
|
||||
if(res < 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Error in loading keystore :( \n");
|
||||
ccn_charbuf_destroy(&pubid_out);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *baseuri=(char *)calloc(strlen(key_repo_name)+strlen(site_name)+
|
||||
strlen(router_name)+strlen("/%C1.R.N.Start")+5,sizeof(char));
|
||||
memcpy(baseuri,key_repo_name,strlen(key_repo_name)+1);
|
||||
if ( site_name[0] != '/')
|
||||
memcpy(baseuri+strlen(baseuri),"/",1);
|
||||
memcpy(baseuri+strlen(baseuri),site_name,strlen(site_name)+1);
|
||||
memcpy(baseuri+strlen(baseuri),"/%C1.R.N.Start",strlen("/%C1.R.N.Start"));
|
||||
memcpy(baseuri+strlen(baseuri),router_name,strlen(router_name)+1);
|
||||
baseuri[strlen(baseuri)]='\0';
|
||||
|
||||
|
||||
keyname=ccn_charbuf_create();
|
||||
if(keyname == NULL ){
|
||||
ccn_charbuf_destroy(&pubid_out);
|
||||
free(baseuri);
|
||||
return -1;
|
||||
}
|
||||
ccn_name_from_uri(keyname,baseuri);
|
||||
if ( res < 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Bad URI format: %s\n",baseuri);
|
||||
ccn_charbuf_destroy(&pubid_out);
|
||||
ccn_charbuf_destroy(&keyname);
|
||||
free(baseuri);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ccn_name_append_str(keyname,"nlsr");
|
||||
struct ccn_charbuf *keyid = ccn_charbuf_create();
|
||||
ccn_charbuf_append_value(keyid, CCN_MARKER_CONTROL, 1);
|
||||
ccn_charbuf_append_string(keyid, ".M.K");
|
||||
ccn_charbuf_append_value(keyid, 0, 1);
|
||||
ccn_charbuf_append_charbuf(keyid, pubid_out);
|
||||
ccn_name_append(keyname, keyid->buf, keyid->length);
|
||||
|
||||
|
||||
|
||||
struct ccn_charbuf *uri = ccn_charbuf_create();
|
||||
ccn_uri_append(uri, keyname->buf, keyname->length, 0);
|
||||
if ( nlsr->debugging )
|
||||
printf("Key Name Included when processing content: %s\n", ccn_charbuf_as_string(uri));
|
||||
ccn_charbuf_destroy(&uri);
|
||||
|
||||
struct ccn_signing_params sp = CCN_SIGNING_PARAMS_INIT;
|
||||
sp.type = CCN_CONTENT_DATA;
|
||||
sp.template_ccnb = ccn_charbuf_create();
|
||||
ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_SignedInfo, CCN_DTAG);
|
||||
ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_KeyLocator, CCN_DTAG);
|
||||
ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_KeyName, CCN_DTAG);
|
||||
ccn_charbuf_append(sp.template_ccnb, keyname->buf, keyname->length);
|
||||
ccn_charbuf_append_closer(sp.template_ccnb); // KeyName closer
|
||||
ccn_charbuf_append_closer(sp.template_ccnb); // KeyLocator closer
|
||||
ccn_charbuf_append_closer(sp.template_ccnb); // SignedInfo closer
|
||||
|
||||
|
||||
sp.sp_flags |= CCN_SP_TEMPL_KEY_LOCATOR;
|
||||
sp.sp_flags |= CCN_SP_FINAL_BLOCK;
|
||||
sp.freshness = freshness;
|
||||
|
||||
|
||||
if (pubid_out->length != sizeof(sp.pubid)){
|
||||
if ( nlsr->debugging )
|
||||
printf("Size of pubid and sp.pubid is not equal");
|
||||
ccn_charbuf_destroy(&keyname);
|
||||
ccn_charbuf_destroy(&pubid_out);
|
||||
free(baseuri);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(sp.pubid, pubid_out->buf, pubid_out->length);
|
||||
|
||||
|
||||
|
||||
res=ccn_sign_content(nlsr->ccn,resultbuf,content_name,&sp,data,data_size);
|
||||
if( res < 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content signing error \n");
|
||||
ccn_charbuf_destroy(&sp.template_ccnb);
|
||||
ccn_charbuf_destroy(&keyid);
|
||||
ccn_charbuf_destroy(&keyname);
|
||||
ccn_charbuf_destroy(&pubid_out);
|
||||
free(baseuri);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ccn_keystore_destroy(&keystore);
|
||||
ccn_charbuf_destroy(&sp.template_ccnb);
|
||||
ccn_charbuf_destroy(&keyid);
|
||||
ccn_charbuf_destroy(&keyname);
|
||||
ccn_charbuf_destroy(&pubid_out);
|
||||
|
||||
free(baseuri);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
get_orig_router_from_lsa_name(struct ccn_charbuf * content_name)
|
||||
{
|
||||
int start=0;
|
||||
|
||||
size_t comp_size;
|
||||
const unsigned char *second_last_comp;
|
||||
char *second_comp_type;
|
||||
char *sep=".";
|
||||
char *rem;
|
||||
|
||||
struct ccn_indexbuf *components=ccn_indexbuf_create();
|
||||
struct ccn_charbuf *name=ccn_charbuf_create();
|
||||
ccn_name_from_uri(name,nlsr->slice_prefix);
|
||||
ccn_name_split (name, components);
|
||||
start=components->n-2;
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_indexbuf_destroy(&components);
|
||||
|
||||
struct ccn_indexbuf *comps=ccn_indexbuf_create();
|
||||
ccn_name_split (content_name, comps);
|
||||
ccn_name_comp_get( content_name->buf, comps,
|
||||
comps->n-1-2, &second_last_comp, &comp_size);
|
||||
|
||||
second_comp_type=strtok_r((char *)second_last_comp, sep, &rem);
|
||||
if ( strcmp( second_comp_type, "lsId" ) == 0 ){
|
||||
ccn_name_chop(content_name,comps,-3);
|
||||
}
|
||||
else{
|
||||
ccn_name_chop(content_name,comps,-2);
|
||||
}
|
||||
|
||||
|
||||
struct ccn_charbuf *temp=ccn_charbuf_create();
|
||||
ccn_name_init(temp);
|
||||
ccn_name_append_components( temp, content_name->buf,
|
||||
comps->buf[start+1],
|
||||
comps->buf[comps->n - 1]);
|
||||
|
||||
struct ccn_charbuf *temp1=ccn_charbuf_create();
|
||||
ccn_uri_append(temp1, temp->buf, temp->length, 0);
|
||||
|
||||
char *orig_router=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
|
||||
sizeof(char));
|
||||
memcpy(orig_router,ccn_charbuf_as_string(temp1),
|
||||
strlen(ccn_charbuf_as_string(temp1)));
|
||||
orig_router[strlen(orig_router)]='\0';
|
||||
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
ccn_indexbuf_destroy(&comps);
|
||||
return orig_router;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
get_orig_router_from_info_content_name(struct ccn_charbuf * content_name)
|
||||
{
|
||||
int start,end;
|
||||
|
||||
start=0;
|
||||
|
||||
struct ccn_indexbuf *comps=ccn_indexbuf_create();
|
||||
ccn_name_split (content_name, comps);
|
||||
|
||||
end=check_for_name_component_in_name(content_name,comps,"nlsr");
|
||||
|
||||
|
||||
struct ccn_charbuf *temp=ccn_charbuf_create();
|
||||
ccn_name_init(temp);
|
||||
ccn_name_append_components( temp, content_name->buf,
|
||||
comps->buf[start],
|
||||
comps->buf[end]);
|
||||
|
||||
struct ccn_charbuf *temp1=ccn_charbuf_create();
|
||||
ccn_uri_append(temp1, temp->buf, temp->length, 0);
|
||||
|
||||
char *orig_router=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
|
||||
sizeof(char));
|
||||
memcpy(orig_router,ccn_charbuf_as_string(temp1),
|
||||
strlen(ccn_charbuf_as_string(temp1)));
|
||||
orig_router[strlen(orig_router)]='\0';
|
||||
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
ccn_indexbuf_destroy(&comps);
|
||||
return orig_router;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
check_key_name_hierarchy(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco,
|
||||
int key_type, int content_type){
|
||||
if ( nlsr->debugging )
|
||||
printf("check_key_name_hierarchy called\n");
|
||||
if (key_type == UNKNOWN_KEY ){
|
||||
return 1;
|
||||
}
|
||||
//int res;
|
||||
struct ccn_charbuf *key_name=get_key_name(ccnb, pco);
|
||||
|
||||
struct ccn_charbuf *key_uri = ccn_charbuf_create();
|
||||
ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
|
||||
if ( nlsr->debugging )
|
||||
printf("Key Name: %s\n",ccn_charbuf_as_string(key_uri));
|
||||
ccn_charbuf_destroy(&key_uri);
|
||||
|
||||
struct ccn_charbuf *content_name=ccn_charbuf_create();
|
||||
ccn_charbuf_append(content_name, ccnb + pco->offset[CCN_PCO_B_Name],
|
||||
pco->offset[CCN_PCO_E_Name] - pco->offset[CCN_PCO_B_Name]);
|
||||
|
||||
struct ccn_charbuf *content_uri = ccn_charbuf_create();
|
||||
ccn_uri_append(content_uri, content_name->buf, content_name->length, 0);
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Name: %s\n",ccn_charbuf_as_string(content_uri));
|
||||
ccn_charbuf_destroy(&content_uri);
|
||||
|
||||
if ( key_type == NLSR_KEY){
|
||||
char *orig_router_key_name=get_orig_router_from_key_name(key_name,0,0);
|
||||
char *orig_router_content_name;
|
||||
if ( content_type == 1 ){
|
||||
orig_router_content_name=get_orig_router_from_lsa_name(content_name);
|
||||
}
|
||||
else if ( content_type == 0 ){
|
||||
orig_router_content_name=get_orig_router_from_info_content_name(content_name);
|
||||
}
|
||||
if ( nlsr->debugging ){
|
||||
printf("Orig Router (Key Name):%s\n",orig_router_key_name);
|
||||
printf("Orig Router (Content Name):%s\n",orig_router_content_name);
|
||||
}
|
||||
|
||||
if (strcmp(orig_router_key_name,orig_router_content_name) == 0 ){
|
||||
free(orig_router_key_name);
|
||||
free(orig_router_content_name);
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( key_type == ROUTING_KEY){
|
||||
char *orig_router_key_name=get_orig_router_from_key_name(key_name,1,0);
|
||||
char *orig_router_content_name=get_orig_router_from_key_name(content_name,1,1);
|
||||
if ( nlsr->debugging ){
|
||||
printf("Orig Router (Key Name):%s\n",orig_router_key_name);
|
||||
printf("Orig Router (Content Name):%s\n",orig_router_content_name);
|
||||
}
|
||||
|
||||
if (strcmp(orig_router_key_name,orig_router_content_name) == 0 ){
|
||||
free(orig_router_key_name);
|
||||
free(orig_router_content_name);
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if ( key_type == OPERATOR_KEY){
|
||||
struct ccn_indexbuf *key_name_comps;
|
||||
key_name_comps = ccn_indexbuf_create();
|
||||
ccn_name_split(key_name, key_name_comps);
|
||||
int last_indx=check_for_tag_component_in_name(key_name,key_name_comps,"O.N.Start");
|
||||
char *site_key_prefix_key=get_name_segments_from_name(key_name,0,last_indx);
|
||||
if ( nlsr->debugging )
|
||||
printf("Site key prefix(key Name):%s\n",site_key_prefix_key);
|
||||
ccn_indexbuf_destroy(&key_name_comps);
|
||||
|
||||
struct ccn_indexbuf *content_name_comps;
|
||||
content_name_comps = ccn_indexbuf_create();
|
||||
ccn_name_split(content_name, content_name_comps);
|
||||
int last_indx_rtr=check_for_tag_component_in_name(content_name,content_name_comps,"R.N.Start");
|
||||
char *site_key_prefix_content=get_name_segments_from_name(key_name,0,last_indx_rtr);
|
||||
if ( nlsr->debugging )
|
||||
printf("Site key prefix(Content Name):%s\n",site_key_prefix_content);
|
||||
ccn_indexbuf_destroy(&content_name_comps);
|
||||
|
||||
if( strcmp(site_key_prefix_key,site_key_prefix_content) == 0 ){
|
||||
free(site_key_prefix_key);
|
||||
free(site_key_prefix_content);
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( key_type == SITE_KEY){
|
||||
struct ccn_indexbuf *key_name_comps;
|
||||
key_name_comps = ccn_indexbuf_create();
|
||||
ccn_name_split(key_name, key_name_comps);
|
||||
int last_indx=check_for_tag_component_in_name(key_name,key_name_comps,"M.K");
|
||||
char *site_key_prefix_key=get_name_segments_from_name(key_name,0,last_indx);
|
||||
if ( nlsr->debugging )
|
||||
printf("Site key prefix(key Name):%s\n",site_key_prefix_key);
|
||||
ccn_indexbuf_destroy(&key_name_comps);
|
||||
|
||||
struct ccn_indexbuf *content_name_comps;
|
||||
content_name_comps = ccn_indexbuf_create();
|
||||
ccn_name_split(content_name, content_name_comps);
|
||||
int last_indx_rtr=check_for_tag_component_in_name(content_name,content_name_comps,"O.N.Start");
|
||||
char *site_key_prefix_content=get_name_segments_from_name(key_name,0,last_indx_rtr);
|
||||
if ( nlsr->debugging )
|
||||
printf("Site key prefix(Content Name):%s\n",site_key_prefix_content);
|
||||
ccn_indexbuf_destroy(&content_name_comps);
|
||||
|
||||
if( strcmp(site_key_prefix_key,site_key_prefix_content) == 0 ){
|
||||
free(site_key_prefix_key);
|
||||
free(site_key_prefix_content);
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( key_type == ROOT_KEY){
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
verify_key(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco,
|
||||
int content_type){
|
||||
if ( nlsr->debugging )
|
||||
printf("verify key called\n");
|
||||
int ret=-1;
|
||||
|
||||
if ( contain_key_name(ccnb, pco) == 1){
|
||||
|
||||
struct ccn_charbuf *key_name=get_key_name(ccnb, pco);
|
||||
struct ccn_charbuf *key_uri = ccn_charbuf_create();
|
||||
ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
|
||||
if ( nlsr->debugging )
|
||||
printf("Key Name from Incoming Content: %s\n",ccn_charbuf_as_string(key_uri));
|
||||
int key_type=get_key_type_from_key_name(key_name);
|
||||
if ( nlsr->debugging )
|
||||
printf("Key Type: %d \n",key_type);
|
||||
|
||||
struct ccn_charbuf *result = ccn_charbuf_create();
|
||||
struct ccn_parsed_ContentObject temp_pco = {0};
|
||||
int get_flags = 0;
|
||||
get_flags |= CCN_GET_NOKEYWAIT;
|
||||
int counter = 0;
|
||||
while(ccn_get(nlsr->ccn, key_name, NULL, 500, result, &temp_pco, NULL,
|
||||
get_flags) < 0 && counter < 3) counter++;
|
||||
|
||||
int chk_verify=ccn_verify_content(nlsr->ccn,ccnb,pco);
|
||||
|
||||
if ( chk_verify == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content verification Successful :)\n");
|
||||
|
||||
if ( counter == 3){
|
||||
if ( nlsr->debugging )
|
||||
printf("Could not retrieve key by name !!!\n");
|
||||
}
|
||||
else{
|
||||
if ( key_type == ROOT_KEY ){
|
||||
ret=0;
|
||||
}
|
||||
else{
|
||||
if ( nlsr->isStrictHierchicalKeyCheck ){
|
||||
int key_name_test=check_key_name_hierarchy(ccnb,
|
||||
pco,
|
||||
key_type,
|
||||
content_type);
|
||||
if ( key_name_test == 1){
|
||||
ret=verify_key(result->buf,&temp_pco,content_type);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ret=verify_key(result->buf,&temp_pco,content_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ccn_charbuf_destroy(&result);
|
||||
ccn_charbuf_destroy(&key_uri);
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
destroy_keys(void)
|
||||
{
|
||||
int i, key_element;
|
||||
struct nlsr_key *key;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->keys, e);
|
||||
key_element=hashtb_n(nlsr->keys);
|
||||
|
||||
for(i=0;i<key_element;i++)
|
||||
{
|
||||
key=e->data;
|
||||
free(key->key_name);
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
if( nlsr->keys )
|
||||
hashtb_destroy(&nlsr->keys);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
print_keys(void){
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("print_keys called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_keys called \n");
|
||||
|
||||
int i, key_element;
|
||||
struct nlsr_key *key;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->keys, e);
|
||||
key_element=hashtb_n(nlsr->keys);
|
||||
|
||||
for(i=0;i<key_element;i++)
|
||||
{
|
||||
key=e->data;
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("Key : %s \n",key->key_name);
|
||||
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
does_key_exist(char *keyname){
|
||||
if (nlsr->debugging)
|
||||
{
|
||||
printf("does_key_exist called\n");
|
||||
printf("Keyname : %s \n",keyname);
|
||||
}
|
||||
|
||||
int ret=0;
|
||||
|
||||
unsigned *v;
|
||||
v = hashtb_lookup(nlsr->keys, keyname, strlen(keyname));
|
||||
if (v != NULL){
|
||||
ret = 1;
|
||||
if (nlsr->debugging)
|
||||
printf("Key Found\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
add_key(char *keyname){
|
||||
if (nlsr->debugging)
|
||||
{
|
||||
printf("add_key called\n");
|
||||
printf("Keyname : %s \n",keyname);
|
||||
}
|
||||
|
||||
struct nlsr_key *key;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
int res;
|
||||
|
||||
hashtb_start(nlsr->keys, e);
|
||||
res = hashtb_seek(e, keyname, strlen(keyname), 0);
|
||||
|
||||
if(res == HT_NEW_ENTRY )
|
||||
{
|
||||
key=e->data;
|
||||
key->key_name=(char *)calloc(strlen(keyname)+1,sizeof(char));
|
||||
memcpy(key->key_name,keyname,strlen(keyname)+1);
|
||||
}
|
||||
|
||||
if (nlsr->debugging)
|
||||
print_keys();
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#ifndef _NLSR_KM_H_
|
||||
#define _NLSR_KM_H_
|
||||
|
||||
enum key_type{
|
||||
ROOT_KEY, //0
|
||||
SITE_KEY, //1
|
||||
OPERATOR_KEY,//2
|
||||
ROUTING_KEY,//3
|
||||
NLSR_KEY,//4
|
||||
UNKNOWN_KEY//5
|
||||
};
|
||||
|
||||
|
||||
struct nlsr_key{
|
||||
char *key_name;
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
sign_content_with_user_defined_keystore(struct ccn_charbuf *content_name,
|
||||
struct ccn_charbuf *resultbuf,
|
||||
const void *data,
|
||||
size_t data_size,
|
||||
char *keystore_path,
|
||||
char *keystore_passphrase,
|
||||
char *key_repo_name,
|
||||
char *site_name,
|
||||
char *router_name,
|
||||
long int freshness);
|
||||
|
||||
int contain_key_name(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco);
|
||||
struct ccn_charbuf * get_key_name(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco);
|
||||
|
||||
int verify_key(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco,
|
||||
int content_type);
|
||||
|
||||
void add_key(char *keyname);
|
||||
int does_key_exist(char *keyname);
|
||||
|
||||
void destroy_keys(void);
|
||||
|
||||
#endif
|
||||
-265
@@ -1,265 +0,0 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/keystore.h>
|
||||
#include <ccn/signing.h>
|
||||
#include <ccn/schedule.h>
|
||||
#include <ccn/hashtb.h>
|
||||
|
||||
|
||||
#include "nlsr.h"
|
||||
#include "nlsr_km_util.h"
|
||||
#include "nlsr_km.h"
|
||||
|
||||
int
|
||||
appendLifetime(struct ccn_charbuf *cb, int lifetime)
|
||||
{
|
||||
unsigned char buf[sizeof(int32_t)];
|
||||
int32_t dreck = lifetime << 12;
|
||||
int pos = sizeof(int32_t);
|
||||
int res = 0;
|
||||
while (dreck > 0 && pos > 0)
|
||||
{
|
||||
pos--;
|
||||
buf[pos] = dreck & 255;
|
||||
dreck = dreck >> 8;
|
||||
}
|
||||
res |= ccnb_append_tagged_blob(cb, CCN_DTAG_InterestLifetime, buf+pos,
|
||||
sizeof(buf)-pos);
|
||||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
contain_key_name(const unsigned char *ccnb, struct ccn_parsed_ContentObject *pco)
|
||||
{
|
||||
if (pco->offset[CCN_PCO_B_KeyLocator] == pco->offset[CCN_PCO_E_KeyLocator])
|
||||
return -1;
|
||||
|
||||
struct ccn_buf_decoder decoder;
|
||||
struct ccn_buf_decoder *d;
|
||||
d = ccn_buf_decoder_start(&decoder, ccnb +
|
||||
pco->offset[CCN_PCO_B_Key_Certificate_KeyName],
|
||||
pco->offset[CCN_PCO_E_Key_Certificate_KeyName] -
|
||||
pco->offset[CCN_PCO_B_Key_Certificate_KeyName]);
|
||||
if (ccn_buf_match_dtag(d, CCN_DTAG_KeyName))
|
||||
return 1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ccn_charbuf *
|
||||
get_key_name(const unsigned char *ccnb, struct ccn_parsed_ContentObject *pco)
|
||||
{
|
||||
struct ccn_charbuf *key_name = ccn_charbuf_create();
|
||||
ccn_charbuf_append(key_name, ccnb + pco->offset[CCN_PCO_B_KeyName_Name],
|
||||
pco->offset[CCN_PCO_E_KeyName_Name] - pco->offset[CCN_PCO_B_KeyName_Name]);
|
||||
|
||||
return key_name;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
check_for_name_component_in_name(const struct ccn_charbuf *name,
|
||||
const struct ccn_indexbuf *indx,
|
||||
const char *component){
|
||||
|
||||
int res,i;
|
||||
int result_position=0;
|
||||
int name_comps=(int)indx->n;
|
||||
|
||||
for(i=0;i<name_comps;i++){
|
||||
res=ccn_name_comp_strcmp(name->buf,indx,i,component);
|
||||
if( res == 0){
|
||||
|
||||
result_position=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result_position;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
check_for_tag_component_in_name(const struct ccn_charbuf *name,
|
||||
const struct ccn_indexbuf *indx,
|
||||
const char *component){
|
||||
|
||||
int res,i;
|
||||
int result_position=0;
|
||||
int name_comps=(int)indx->n;
|
||||
|
||||
for(i=0;i<name_comps;i++){
|
||||
const unsigned char *comp_ptr;
|
||||
size_t comp_size;
|
||||
res=ccn_name_comp_get(name->buf, indx,i,&comp_ptr, &comp_size);
|
||||
if( res == 0){
|
||||
if ( strstr((char *)comp_ptr,component) != NULL ){
|
||||
result_position=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result_position;
|
||||
}
|
||||
|
||||
enum key_type
|
||||
get_key_type_from_key_name(struct ccn_charbuf *keyname)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("get_key_type_from_key_name called\n");
|
||||
|
||||
int res;
|
||||
int return_key=UNKNOWN_KEY;
|
||||
|
||||
struct ccn_indexbuf *indx=ccn_indexbuf_create();
|
||||
if ( indx == NULL ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Error in creating index for key name \n");
|
||||
return UNKNOWN_KEY;
|
||||
}
|
||||
|
||||
res=ccn_name_split(keyname,indx);
|
||||
if ( res < 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Error in parsing key name \n");
|
||||
ccn_indexbuf_destroy(&indx);
|
||||
return UNKNOWN_KEY;
|
||||
}
|
||||
else if ( res == 3){
|
||||
int chk_ndn=check_for_name_component_in_name(keyname,indx,"ndn");
|
||||
int chk_key=check_for_name_component_in_name(keyname,indx,"keys");
|
||||
if ( chk_ndn == 0 && chk_key == 1)
|
||||
return_key=ROOT_KEY;
|
||||
}
|
||||
else{
|
||||
int check_op,check_rt;
|
||||
check_op=check_for_tag_component_in_name(keyname,indx,
|
||||
"O.N.Start");
|
||||
check_rt=check_for_tag_component_in_name(keyname,indx,
|
||||
"R.N.Start");
|
||||
if ( check_op > 0){
|
||||
return_key=OPERATOR_KEY;
|
||||
}
|
||||
else if(check_rt >0){
|
||||
int check_nlsr;
|
||||
check_nlsr=check_for_name_component_in_name(keyname,indx,
|
||||
"nlsr");
|
||||
if ( check_rt > 0 ){
|
||||
if ( check_nlsr > 0){
|
||||
return_key=NLSR_KEY;
|
||||
}
|
||||
else{
|
||||
return_key=ROUTING_KEY;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( check_rt == 0 && check_op == 0 && res > 3){
|
||||
return_key=SITE_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
ccn_indexbuf_destroy(&indx);
|
||||
return return_key;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
get_name_segments_from_name(struct ccn_charbuf *name, int start_indx, int end_indx)
|
||||
{
|
||||
int res;
|
||||
struct ccn_indexbuf *name_comps;
|
||||
struct ccn_charbuf *orig_router;
|
||||
char *name_seg=NULL;
|
||||
|
||||
name_comps = ccn_indexbuf_create();
|
||||
res = ccn_name_split(name, name_comps);
|
||||
if ( res < 0 ){
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
return name_seg;
|
||||
}
|
||||
else{
|
||||
orig_router=ccn_charbuf_create();
|
||||
ccn_name_init(orig_router);
|
||||
ccn_name_append_components(orig_router,name->buf,
|
||||
name_comps->buf[start_indx],
|
||||
name_comps->buf[end_indx]);
|
||||
struct ccn_charbuf *temp1=ccn_charbuf_create();
|
||||
ccn_uri_append(temp1, orig_router->buf, orig_router->length, 0);
|
||||
|
||||
name_seg=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
|
||||
sizeof(char));
|
||||
memcpy(name_seg,ccn_charbuf_as_string(temp1),
|
||||
strlen(ccn_charbuf_as_string(temp1)));
|
||||
name_seg[strlen(name_seg)]='\0';
|
||||
ccn_charbuf_destroy(&orig_router);
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
|
||||
}
|
||||
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
return name_seg;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
get_orig_router_from_key_name(struct ccn_charbuf *name, int more, int type)
|
||||
{
|
||||
int res;
|
||||
struct ccn_indexbuf *name_comps;
|
||||
struct ccn_charbuf *orig_router;
|
||||
char *router=NULL;
|
||||
|
||||
name_comps = ccn_indexbuf_create();
|
||||
res = ccn_name_split(name, name_comps);
|
||||
if ( res < 0 ){
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
return router;
|
||||
}
|
||||
else{
|
||||
res=ccn_name_chop(name, name_comps, -(2-more));
|
||||
if ( more > 0 && type==1)
|
||||
res=ccn_name_chop(name, name_comps, -3);
|
||||
if ( res < 0 ){
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
res=check_for_tag_component_in_name(name,name_comps,"R.N.Start");
|
||||
if ( res > 0 ){
|
||||
orig_router=ccn_charbuf_create();
|
||||
ccn_name_init(orig_router);
|
||||
ccn_name_append_components(orig_router,name->buf,
|
||||
name_comps->buf[res+1],
|
||||
name_comps->buf[name_comps->n - 1]);
|
||||
struct ccn_charbuf *temp1=ccn_charbuf_create();
|
||||
ccn_uri_append(temp1, orig_router->buf, orig_router->length, 0);
|
||||
|
||||
router=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
|
||||
sizeof(char));
|
||||
memcpy(router,ccn_charbuf_as_string(temp1),
|
||||
strlen(ccn_charbuf_as_string(temp1)));
|
||||
router[strlen(router)]='\0';
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
ccn_charbuf_destroy(&orig_router);
|
||||
}
|
||||
else{
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef _NLSR_KM_UTIL_H_
|
||||
#define _NLSR_KM_UTIL_H_
|
||||
|
||||
int
|
||||
contain_key_name(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco);
|
||||
|
||||
struct ccn_charbuf *
|
||||
get_key_name(const unsigned char *ccnb,
|
||||
struct ccn_parsed_ContentObject *pco);
|
||||
|
||||
int
|
||||
check_for_name_component_in_name(const struct ccn_charbuf *name,
|
||||
const struct ccn_indexbuf *indx,
|
||||
const char *component);
|
||||
int
|
||||
check_for_tag_component_in_name(const struct ccn_charbuf *name,
|
||||
const struct ccn_indexbuf *indx,
|
||||
const char *component);
|
||||
enum key_type
|
||||
get_key_type_from_key_name(struct ccn_charbuf *keyname);
|
||||
|
||||
|
||||
int
|
||||
appendLifetime(struct ccn_charbuf *cb, int lifetime);
|
||||
|
||||
char *
|
||||
get_orig_router_from_key_name(struct ccn_charbuf *name, int more, int type);
|
||||
|
||||
|
||||
|
||||
char *
|
||||
get_name_segments_from_name(struct ccn_charbuf *name,
|
||||
int start_indx, int end_indx);
|
||||
|
||||
#endif
|
||||
-2862
File diff suppressed because it is too large.
Load diff
-110
@@ -1,110 +0,0 @@
|
||||
#ifndef _NLSR_LSDB_H_
|
||||
#define _NLSR_LSDB_H_
|
||||
|
||||
#define LS_TYPE_ADJ 1
|
||||
#define LS_TYPE_NAME 2
|
||||
#define LS_TYPE_COR 3
|
||||
|
||||
struct link
|
||||
{
|
||||
struct name_prefix *nbr;
|
||||
int face;
|
||||
int metric;
|
||||
};
|
||||
|
||||
|
||||
struct alsa_header
|
||||
{
|
||||
unsigned int ls_type;
|
||||
char *orig_time;
|
||||
struct name_prefix *orig_router;
|
||||
|
||||
};
|
||||
|
||||
struct alsa
|
||||
{
|
||||
struct alsa_header *header;
|
||||
int no_link;
|
||||
struct link *links;
|
||||
char * body;
|
||||
};
|
||||
|
||||
struct nlsa_header
|
||||
{
|
||||
unsigned int ls_type;
|
||||
char *orig_time;
|
||||
long int ls_id;
|
||||
struct name_prefix *orig_router;
|
||||
unsigned int isValid;
|
||||
|
||||
};
|
||||
|
||||
struct nlsa
|
||||
{
|
||||
struct nlsa_header *header;
|
||||
struct name_prefix *name_prefix;
|
||||
};
|
||||
|
||||
struct clsa
|
||||
{
|
||||
struct alsa_header *header;
|
||||
double cor_r;
|
||||
double cor_theta;
|
||||
};
|
||||
|
||||
|
||||
void set_new_lsdb_version(void);
|
||||
void build_and_install_name_lsas(void);
|
||||
void build_and_install_single_name_lsa(struct name_prefix *np);
|
||||
void build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np);
|
||||
void install_name_lsa(struct nlsa *name_lsa);
|
||||
void print_name_lsa(struct nlsa *name_lsa);
|
||||
void write_log_for_name_lsa(struct nlsa *name_lsa);
|
||||
void print_name_lsdb(void);
|
||||
void build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np);
|
||||
void build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id, char *orig_time, int isValid, char *np);
|
||||
void make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id);
|
||||
int refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
|
||||
|
||||
int build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
|
||||
void build_adj_lsa(struct alsa * adj_lsa);
|
||||
void install_adj_lsa(struct alsa * adj_lsa);
|
||||
void print_adj_lsa_body(const char *body, int no_link);
|
||||
void print_adj_lsa(struct alsa * adj_lsa);
|
||||
void write_log_for_adj_lsa(struct alsa * adj_lsa);
|
||||
void print_adj_lsdb(void);
|
||||
void make_adj_lsa_key(char *key,struct alsa *adj_lsa);
|
||||
void build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data);
|
||||
void build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data);
|
||||
|
||||
long int get_name_lsdb_num_element(void);
|
||||
long int get_adj_lsdb_num_element(void);
|
||||
|
||||
int check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time);
|
||||
int check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time);
|
||||
int check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time);
|
||||
|
||||
void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
|
||||
void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
|
||||
|
||||
void make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id);
|
||||
|
||||
void build_and_install_cor_lsa();
|
||||
void print_cor_lsdb();
|
||||
|
||||
void write_name_lsdb_to_repo(char *slice_prefix);
|
||||
void write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
|
||||
void make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix);
|
||||
void write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
|
||||
|
||||
void write_cor_lsa_to_repo(struct clsa *cor_lsa);
|
||||
void build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta);
|
||||
double get_hyperbolic_r(char *router);
|
||||
double get_hyperbolic_theta(char *router);
|
||||
|
||||
void destroy_lsdb(void);
|
||||
|
||||
void
|
||||
get_lsdb_summary(struct ccn_charbuf *lsdb_data);
|
||||
|
||||
#endif
|
||||
-1301
File diff suppressed because it is too large.
Load diff
-31
@@ -1,31 +0,0 @@
|
||||
#ifndef _NLSR_NDN_H_
|
||||
#define _NLSR_NDN_H_
|
||||
|
||||
int appendLifetime(struct ccn_charbuf *cb, int lifetime);
|
||||
void get_nbr(struct name_prefix *nbr,struct ccn_closure *selfp, struct ccn_upcall_info *info);
|
||||
void get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp, struct ccn_upcall_info *info,int offset);
|
||||
//void get_lsdb_version(char *lsdb_version,struct ccn_closure *selfp, struct ccn_upcall_info *info );
|
||||
//int get_ls_type(struct ccn_closure *selfp, struct ccn_upcall_info *info);
|
||||
|
||||
enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info);
|
||||
void process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info);
|
||||
void process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info);
|
||||
|
||||
enum ccn_upcall_res incoming_content(struct ccn_closure* selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info* info);
|
||||
void process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info);
|
||||
void process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info);
|
||||
|
||||
void process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info);
|
||||
void process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info);
|
||||
|
||||
int send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
|
||||
void send_info_interest_to_neighbor(struct name_prefix *nbr);
|
||||
|
||||
|
||||
|
||||
void process_incoming_interest_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info *info);
|
||||
void process_incoming_interest_lsa(struct ccn_closure *selfp, struct ccn_upcall_info *info);
|
||||
|
||||
int send_lsdb_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
|
||||
|
||||
#endif
|
||||
-199
@@ -1,199 +0,0 @@
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/keystore.h>
|
||||
#include <ccn/signing.h>
|
||||
#include <ccn/schedule.h>
|
||||
#include <ccn/hashtb.h>
|
||||
|
||||
#include "nlsr.h"
|
||||
#include "nlsr_npl.h"
|
||||
#include "utility.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
add_name_to_npl(struct name_prefix *np)
|
||||
{
|
||||
struct name_prefix_list_entry *npe;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
int res;
|
||||
|
||||
hashtb_start(nlsr->npl, e);
|
||||
res = hashtb_seek(e, np->name, np->length, 0);
|
||||
|
||||
if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
npe=e->data;
|
||||
npe->np=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
|
||||
npe->np->length=np->length;
|
||||
npe->np->name=(char *)calloc(np->length,sizeof(char));
|
||||
memcpy(npe->np->name,np->name,np->length);
|
||||
npe->name_lsa_id=0;
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
does_name_exist_in_npl(struct name_prefix *np)
|
||||
{
|
||||
int ret=0;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
int res;
|
||||
|
||||
hashtb_start(nlsr->npl, e);
|
||||
res = hashtb_seek(e, np->name, np->length, 0);
|
||||
|
||||
if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
ret=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret=1;
|
||||
}
|
||||
hashtb_end(e);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
long int
|
||||
get_lsa_id_from_npl(struct name_prefix *np)
|
||||
{
|
||||
int ret=0;
|
||||
|
||||
struct name_prefix_list_entry *npe;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
int res;
|
||||
|
||||
hashtb_start(nlsr->npl, e);
|
||||
res = hashtb_seek(e, np->name, np->length, 0);
|
||||
|
||||
if(res == HT_NEW_ENTRY)
|
||||
{
|
||||
hashtb_delete(e);
|
||||
ret=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
npe=e->data;
|
||||
ret=npe->name_lsa_id;
|
||||
}
|
||||
hashtb_end(e);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
print_name_prefix_from_npl(void)
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("print_name_prefix_from_npl called \n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_name_prefix_from_npl called\n");
|
||||
int i, npl_element;
|
||||
//struct name_prefix *np;
|
||||
struct name_prefix_list_entry *npe;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->npl, e);
|
||||
npl_element=hashtb_n(nlsr->npl);
|
||||
|
||||
for(i=0;i<npl_element;i++)
|
||||
{
|
||||
npe=e->data;
|
||||
if ( nlsr->debugging )
|
||||
printf("Name Prefix: %s and Length: %d and LSA Id: %ld\n",npe->np->name,npe->np->length,npe->name_lsa_id);
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"Name Prefix: %s and Length: %d \n",npe->np->name,npe->np->length);
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("\n");
|
||||
if ( nlsr->detailed_logging )
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
|
||||
}
|
||||
|
||||
void
|
||||
update_nlsa_id_for_name_in_npl(struct name_prefix *np, long int nlsa_id)
|
||||
{
|
||||
struct name_prefix_list_entry *npe;
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
int res;
|
||||
|
||||
hashtb_start(nlsr->npl, e);
|
||||
res = hashtb_seek(e, np->name, np->length, 0);
|
||||
|
||||
if(res == HT_OLD_ENTRY)
|
||||
{
|
||||
npe=e->data;
|
||||
npe->name_lsa_id=nlsa_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
hashtb_delete(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
}
|
||||
|
||||
void
|
||||
destroy_npl_entry_component(struct name_prefix_list_entry *npe)
|
||||
{
|
||||
if (npe->np->name)
|
||||
free(npe->np->name);
|
||||
if(npe->np)
|
||||
free(npe->np);
|
||||
}
|
||||
|
||||
void
|
||||
destroy_npl(void)
|
||||
{
|
||||
int i, npl_element;
|
||||
struct name_prefix_list_entry *npe;
|
||||
|
||||
struct hashtb_enumerator ee;
|
||||
struct hashtb_enumerator *e = ⅇ
|
||||
|
||||
hashtb_start(nlsr->npl, e);
|
||||
npl_element=hashtb_n(nlsr->npl);
|
||||
|
||||
for(i=0;i<npl_element;i++)
|
||||
{
|
||||
npe=e->data;
|
||||
destroy_npl_entry_component(npe);
|
||||
hashtb_next(e);
|
||||
}
|
||||
|
||||
hashtb_end(e);
|
||||
|
||||
if ( nlsr->npl)
|
||||
hashtb_destroy(&nlsr->npl);
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
#ifndef _NLSR_NPL_H_
|
||||
#define _NLSR_NPL_H_
|
||||
|
||||
struct name_prefix_list_entry
|
||||
{
|
||||
struct name_prefix *np;
|
||||
long int name_lsa_id;
|
||||
};
|
||||
|
||||
void add_name_to_npl(struct name_prefix *np);
|
||||
void print_name_prefix_from_npl(void);
|
||||
int does_name_exist_in_npl(struct name_prefix *np);
|
||||
void update_nlsa_id_for_name_in_npl(struct name_prefix *np, long int nlsa_id);
|
||||
long int get_lsa_id_from_npl(struct name_prefix *np);
|
||||
void destroy_npl(void);
|
||||
void destroy_npl_entry_component(struct name_prefix_list_entry *npe);
|
||||
#endif
|
||||
-1152
File diff suppressed because it is too large.
Load diff
-33
@@ -1,33 +0,0 @@
|
||||
#ifndef _NLSR_NPT_H_
|
||||
#define _NLSR_NPT_H_
|
||||
|
||||
#define NO_FACE -12345
|
||||
#define ZERO_FACE 0
|
||||
|
||||
struct npt_entry
|
||||
{
|
||||
char *orig_router;
|
||||
struct hashtb *name_list;
|
||||
struct hashtb *face_list;
|
||||
};
|
||||
|
||||
struct name_list_entry
|
||||
{
|
||||
char *name;
|
||||
};
|
||||
|
||||
|
||||
int add_npt_entry(char *orig_router, char *name_prefix, int num_face, int *faces, int *route_costs);
|
||||
int delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix);
|
||||
void print_npt(void);
|
||||
void delete_orig_router_from_npt(char *orig_router);
|
||||
void update_npt_with_new_route(void);
|
||||
void destroy_all_face_by_nlsr(void);
|
||||
void sort_faces_by_distance(int *faces,int *route_costs,int start,int element);
|
||||
void update_ccnd_fib_for_orig_router(char *orig_router);
|
||||
void get_all_faces_for_orig_router_from_npt(char *orig_router, int *faces, int *route_costs, int num_faces);
|
||||
void destroy_name_list(struct hashtb *name_list);
|
||||
void destroy_face_list(struct hashtb *face_list);
|
||||
void destroy_npt(void);
|
||||
|
||||
#endif
|
||||
-1489
File diff suppressed because it is too large.
Load diff
@@ -1,76 +0,0 @@
|
||||
#ifndef _NLSR_ROUTE_H_
|
||||
#define _NLSR_ROUTE_H_
|
||||
|
||||
#define EMPTY_PARENT -12345
|
||||
#define INF_DISTANCE 2147483647
|
||||
|
||||
#define NO_NEXT_HOP -12345
|
||||
#define NO_MAPPING_NUM -1
|
||||
|
||||
struct map_entry
|
||||
{
|
||||
char *router;
|
||||
int mapping;
|
||||
};
|
||||
|
||||
|
||||
struct routing_table_entry
|
||||
{
|
||||
char *dest_router;
|
||||
struct hashtb *face_list;
|
||||
};
|
||||
|
||||
struct face_list_entry
|
||||
{
|
||||
int next_hop_face;
|
||||
double route_cost;
|
||||
};
|
||||
|
||||
int route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
|
||||
void make_map(void);
|
||||
void add_map_entry(char *router);
|
||||
void add_adj_data_to_map(char *orig_router, char *body, int no_link);
|
||||
void print_map(void);
|
||||
void assign_mapping_number(void);
|
||||
void make_adj_matrix(int **adj_matrix,int map_element);
|
||||
void init_adj_matrix(int **adj_matrix,int map_element);
|
||||
void print_adj_matrix(int **adj_matrix, int map_element);
|
||||
int get_mapping_no(char *router);
|
||||
void calculate_path(int **adj_matrix, long int *parent,long int *dist, long int V, long int S);
|
||||
void sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element);
|
||||
int is_not_explored(long int *Q, long int u,long int start, long int element);
|
||||
void print_path(long int *parent, long int dest);
|
||||
void print_all_path_from_source(long int *parent,long int source);
|
||||
void add_rev_map_entry(long int mapping_number, char *router);
|
||||
void print_rev_map(void);
|
||||
char * get_router_from_rev_map(long int mapping_number);
|
||||
int get_no_link_from_adj_matrix(int **adj_matrix,long int V, long int S);
|
||||
void get_links_from_adj_matrix(int **adj_matrix, long int V ,long int *links, long int *link_costs,long int S);
|
||||
void adjust_adj_matrix(int **adj_matrix, long int V, long int S, long int link,long int link_cost);
|
||||
|
||||
/* Routing Table Relates function */
|
||||
|
||||
int get_next_hop(char *dest_router,int *faces, int *route_costs);
|
||||
int get_number_of_next_hop(char *dest_router);
|
||||
void add_next_hop_router(char *dest_router);
|
||||
void add_next_hop_from_lsa_adj_body(char *body, int no_link);
|
||||
void print_routing_table(void);
|
||||
void do_old_routing_table_updates(void);
|
||||
void clear_old_routing_table(void);
|
||||
void update_routing_table_with_new_route(long int *parent,long int *dist, long int source);
|
||||
|
||||
long int get_next_hop_from_calculation(long int *parent, long int dest,long int source);
|
||||
void print_all_next_hop(long int *parent,long int source);
|
||||
int does_face_exist_for_router(char *dest_router, int face_id);
|
||||
|
||||
double get_hyperbolic_distance(long int source, long int dest);
|
||||
void sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element);
|
||||
void update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist);
|
||||
|
||||
void destroy_routing_table_entry_comp(struct routing_table_entry *rte);
|
||||
void destroy_routing_table_entry(struct routing_table_entry *rte);
|
||||
void destroy_routing_table(void);
|
||||
void destroy_map(void);
|
||||
void destroy_rev_map(void);
|
||||
|
||||
#endif
|
||||
-874
@@ -1,874 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ccn/ccn.h>
|
||||
#include <ccn/uri.h>
|
||||
#include <ccn/keystore.h>
|
||||
#include <ccn/signing.h>
|
||||
#include <ccn/schedule.h>
|
||||
#include <ccn/hashtb.h>
|
||||
#include <ccn/sync.h>
|
||||
#include <ccn/seqwriter.h>
|
||||
|
||||
#include "nlsr.h"
|
||||
#include "nlsr_sync.h"
|
||||
#include "nlsr_lsdb.h"
|
||||
#include "utility.h"
|
||||
#include "nlsr_km.h"
|
||||
#include "nlsr_km_util.h"
|
||||
|
||||
|
||||
char *
|
||||
hex_string(unsigned char *s, size_t l)
|
||||
{
|
||||
const char *hex_digits = "0123456789abcdef";
|
||||
char *r;
|
||||
int i;
|
||||
r = calloc(1, 1 + 2 * l);
|
||||
for (i = 0; i < l; i++) {
|
||||
r[2*i] = hex_digits[(s[i]>>4) & 0xf];
|
||||
r[1+2*i] = hex_digits[s[i] & 0xf];
|
||||
}
|
||||
return(r);
|
||||
}
|
||||
|
||||
/**
|
||||
* call back function from sync. Receive notification of updates in sync.
|
||||
* This function calls process_content_from_sync to handle incoming content
|
||||
* from sync.
|
||||
*/
|
||||
|
||||
int
|
||||
sync_cb(struct ccns_name_closure *nc,
|
||||
struct ccn_charbuf *lhash,
|
||||
struct ccn_charbuf *rhash,
|
||||
struct ccn_charbuf *name)
|
||||
{
|
||||
nlsr_lock();
|
||||
int res;
|
||||
struct ccn_charbuf *content_name;
|
||||
struct ccn_indexbuf *content_comps;
|
||||
struct ccn_indexbuf *name_comps;
|
||||
|
||||
content_comps = ccn_indexbuf_create();
|
||||
res = ccn_name_split(name, content_comps);
|
||||
if ( res < 0 )
|
||||
return 0;
|
||||
|
||||
if (content_comps->n < 2)
|
||||
return 0;
|
||||
|
||||
content_name = ccn_charbuf_create();
|
||||
ccn_name_init(content_name);
|
||||
|
||||
res = ccn_name_append_components( content_name, name->buf,
|
||||
content_comps->buf[0], content_comps->buf[content_comps->n - 1]);
|
||||
|
||||
if ( res < 0)
|
||||
return 0;
|
||||
|
||||
// for debugging
|
||||
struct ccn_charbuf *temp=ccn_charbuf_create();
|
||||
ccn_uri_append(temp, content_name->buf, content_name->length, 0);
|
||||
if ( nlsr->debugging )
|
||||
printf("Name before chopping: %s \n",ccn_charbuf_as_string(temp));
|
||||
ccn_charbuf_destroy(&temp);
|
||||
|
||||
name_comps = ccn_indexbuf_create();
|
||||
res=ccn_name_split (content_name, name_comps);
|
||||
if (res < 0)
|
||||
return 0;
|
||||
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf("Number of components in name = %d \n",res);
|
||||
printf("Number of components in name as indexbuf->n = %d \n",
|
||||
(int)name_comps->n);
|
||||
}
|
||||
|
||||
ccn_name_chop(content_name, name_comps, -3);
|
||||
if ( nlsr->debugging )
|
||||
printf("Number of components in name as indexbuf->n after chopping= %d \n"
|
||||
, (int)name_comps->n);
|
||||
|
||||
//for debugging
|
||||
struct ccn_charbuf *temp1=ccn_charbuf_create();
|
||||
ccn_uri_append(temp1, content_name->buf, content_name->length, 0);
|
||||
if ( nlsr->debugging )
|
||||
printf("Name after chopping: %s \n",ccn_charbuf_as_string(temp1));
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
|
||||
//main method that processes contents from the sync
|
||||
process_content_from_sync(content_name, name_comps);
|
||||
|
||||
ccn_charbuf_destroy(&content_name);
|
||||
ccn_indexbuf_destroy(&content_comps);
|
||||
ccn_indexbuf_destroy(&name_comps);
|
||||
|
||||
nlsr_unlock();
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* this function retrieve part of name from interest name and put it in name_part
|
||||
*/
|
||||
|
||||
void
|
||||
get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb,
|
||||
struct ccn_indexbuf *interest_comps, int offset)
|
||||
{
|
||||
int lsa_position=0;
|
||||
|
||||
struct ccn_indexbuf *components=ccn_indexbuf_create();
|
||||
struct ccn_charbuf *name=ccn_charbuf_create();
|
||||
ccn_name_from_uri(name,nlsr->slice_prefix);
|
||||
ccn_name_split (name, components);
|
||||
lsa_position=components->n-2;
|
||||
ccn_charbuf_destroy(&name);
|
||||
|
||||
struct ccn_charbuf *temp=ccn_charbuf_create();
|
||||
ccn_name_init(temp);
|
||||
ccn_name_append_components( temp, interest_ccnb->buf,
|
||||
interest_comps->buf[lsa_position+1],
|
||||
interest_comps->buf[interest_comps->n - 1]);
|
||||
|
||||
struct ccn_charbuf *temp1=ccn_charbuf_create();
|
||||
ccn_uri_append(temp1, temp->buf, temp->length, 0);
|
||||
|
||||
name_part->name=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
|
||||
sizeof(char));
|
||||
memcpy(name_part->name,ccn_charbuf_as_string(temp1),
|
||||
strlen(ccn_charbuf_as_string(temp1)));
|
||||
name_part->name[strlen(ccn_charbuf_as_string(temp1))]='\0';
|
||||
name_part->length=strlen(ccn_charbuf_as_string(temp1))+1;
|
||||
|
||||
ccn_charbuf_destroy(&temp1);
|
||||
ccn_charbuf_destroy(&temp);
|
||||
ccn_indexbuf_destroy(&components);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("Name Part: %s \n",name_part->name);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get content value by content name and put the content value in content_data
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
get_content_by_content_name(char *content_name, unsigned char **content_data,
|
||||
char *orig_router)
|
||||
{
|
||||
|
||||
int ret=-1;
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_charbuf *templ = NULL;
|
||||
struct ccn_charbuf *resultbuf = NULL;
|
||||
struct ccn_parsed_ContentObject pcobuf = { 0 };
|
||||
int res;
|
||||
int allow_stale = 1;
|
||||
int content_only = 1;
|
||||
int scope = -1;
|
||||
const unsigned char *ptr,*ptr_in;
|
||||
size_t length,length_in;
|
||||
int resolve_version = CCN_V_HIGHEST;
|
||||
int timeout_ms = 3000;
|
||||
const unsigned lifetime_default = CCN_INTEREST_LIFETIME_SEC << 12;
|
||||
unsigned lifetime_l12 = lifetime_default;
|
||||
int get_flags = 0;
|
||||
|
||||
name = ccn_charbuf_create();
|
||||
res = ccn_name_from_uri(name,content_name);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Bad ccn URI: %s\n", content_name);
|
||||
ccn_charbuf_destroy(&name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (allow_stale || lifetime_l12 != lifetime_default || scope != -1) {
|
||||
templ = ccn_charbuf_create();
|
||||
ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
|
||||
ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
|
||||
ccn_charbuf_append_closer(templ); /* </Name> */
|
||||
if (allow_stale) {
|
||||
ccn_charbuf_append_tt(templ, CCN_DTAG_AnswerOriginKind, CCN_DTAG);
|
||||
ccnb_append_number(templ,
|
||||
CCN_AOK_DEFAULT | CCN_AOK_STALE);
|
||||
ccn_charbuf_append_closer(templ); /* </AnswerOriginKind> */
|
||||
}
|
||||
if (scope != -1) {
|
||||
ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
|
||||
}
|
||||
if (lifetime_l12 != lifetime_default) {
|
||||
/*
|
||||
* Choose the interest lifetime so there are at least 3
|
||||
* expressions (in the unsatisfied case).
|
||||
*/
|
||||
unsigned char buf[3] = { 0 };
|
||||
int i;
|
||||
for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8)
|
||||
buf[i] = lifetime_l12 & 0xff;
|
||||
ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf,
|
||||
sizeof(buf));
|
||||
}
|
||||
ccn_charbuf_append_closer(templ); /* </Interest> */
|
||||
}
|
||||
resultbuf = ccn_charbuf_create();
|
||||
if (resolve_version != 0) {
|
||||
res = ccn_resolve_version(nlsr->ccn, name, resolve_version, 500);
|
||||
if (res >= 0) {
|
||||
ccn_uri_append(resultbuf, name->buf, name->length, 1);
|
||||
resultbuf->length = 0;
|
||||
}
|
||||
}
|
||||
res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL,
|
||||
get_flags);
|
||||
if (res >= 0) {
|
||||
ptr = resultbuf->buf;
|
||||
length = resultbuf->length;
|
||||
if (content_only){
|
||||
ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length);
|
||||
struct ccn_parsed_ContentObject pcobuf1 = { 0 };
|
||||
int chk_cont=ccn_parse_ContentObject(ptr,length,&pcobuf1,NULL);
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Parsing result: %d\n",chk_cont);
|
||||
if ( contain_key_name(ptr, &pcobuf1) == 1){
|
||||
int res_verify=-1;
|
||||
int key_exists=0;
|
||||
struct ccn_charbuf *key_name=get_key_name(ptr, &pcobuf1);
|
||||
struct ccn_charbuf *key_uri = ccn_charbuf_create();
|
||||
ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
|
||||
key_exists=does_key_exist(ccn_charbuf_as_string(key_uri));
|
||||
int key_type=get_key_type_from_key_name(key_name);
|
||||
|
||||
if ( key_exists == 1 && key_type == NLSR_KEY ){
|
||||
res_verify=0;
|
||||
}
|
||||
else{
|
||||
res_verify=verify_key(ptr,&pcobuf1,1);
|
||||
}
|
||||
|
||||
if ( res_verify != 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Error in verfiying keys !! :( \n");
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&key_uri);
|
||||
}
|
||||
else{
|
||||
if ( key_exists == 0 )
|
||||
add_key(ccn_charbuf_as_string(key_uri));
|
||||
ccn_charbuf_destroy(&key_name);
|
||||
ccn_charbuf_destroy(&key_uri);
|
||||
if ( nlsr->debugging )
|
||||
printf("Key verification is successful :)\n");
|
||||
ptr_in=ptr;
|
||||
length_in=length;
|
||||
ccn_content_get_value(ptr_in, length_in, &pcobuf1,
|
||||
&ptr_in, &length_in);
|
||||
*content_data = (unsigned char *) calloc(length_in+1,
|
||||
sizeof(char *));
|
||||
memcpy (*content_data, ptr_in, length_in);
|
||||
ret=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
ccn_charbuf_destroy(&templ);
|
||||
ccn_charbuf_destroy(&name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle incoming lsa content, Calls functions to install lsa into lsdb
|
||||
*/
|
||||
|
||||
void
|
||||
process_incoming_sync_content_lsa( unsigned char *content_data)
|
||||
{
|
||||
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("process_incoming_sync_content_lsa called \n");
|
||||
|
||||
char *sep="|";
|
||||
char *rem;
|
||||
char *orig_router;
|
||||
char *orl;
|
||||
int orig_router_length;
|
||||
char *lst;
|
||||
int ls_type;
|
||||
char *lsid;
|
||||
long int ls_id;
|
||||
char *isvld;
|
||||
int isValid;
|
||||
char *num_link;
|
||||
int no_link;
|
||||
char *np;
|
||||
char *np_length;
|
||||
int name_length;
|
||||
char *data;
|
||||
char *orig_time;
|
||||
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("LSA Data \n");
|
||||
|
||||
if( strlen((char *)content_data ) > 0 )
|
||||
{
|
||||
|
||||
orig_router=strtok_r((char *)content_data,sep,&rem);
|
||||
orl=strtok_r(NULL,sep,&rem);
|
||||
orig_router_length=atoi(orl);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf(" Orig Router Name : %s\n",orig_router);
|
||||
printf(" Orig Router Length: %d\n",orig_router_length);
|
||||
}
|
||||
|
||||
lst=strtok_r(NULL,sep,&rem);
|
||||
ls_type=atoi(lst);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf(" LS Type : %d\n",ls_type);
|
||||
|
||||
if ( ls_type == LS_TYPE_NAME )
|
||||
{
|
||||
lsid=strtok_r(NULL,sep,&rem);
|
||||
ls_id=atoi(lsid);
|
||||
orig_time=strtok_r(NULL,sep,&rem);
|
||||
isvld=strtok_r(NULL,sep,&rem);
|
||||
isValid=atoi(isvld);
|
||||
np=strtok_r(NULL,sep,&rem);
|
||||
np_length=strtok_r(NULL,sep,&rem);
|
||||
name_length=atoi(np_length);
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf(" LS ID : %ld\n",ls_id);
|
||||
printf(" isValid : %d\n",isValid);
|
||||
printf(" Name Prefix : %s\n",np);
|
||||
printf(" Orig Time : %s\n",orig_time);
|
||||
printf(" Name Prefix length: %d\n",name_length);
|
||||
}
|
||||
|
||||
build_and_install_others_name_lsa(orig_router,ls_type,ls_id,
|
||||
orig_time,isValid,np);
|
||||
|
||||
print_name_lsdb();
|
||||
|
||||
}
|
||||
else if ( ls_type == LS_TYPE_ADJ )
|
||||
{
|
||||
orig_time=strtok_r(NULL,sep,&rem);
|
||||
num_link=strtok_r(NULL,sep,&rem);
|
||||
no_link=atoi(num_link);
|
||||
data=rem;
|
||||
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf(" Orig Time : %s\n",orig_time);
|
||||
printf(" No Link : %d\n",no_link);
|
||||
printf(" Data : %s\n",data);
|
||||
}
|
||||
build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,
|
||||
no_link,data);
|
||||
}
|
||||
else if ( ls_type == LS_TYPE_COR )
|
||||
{
|
||||
orig_time=strtok_r(NULL,sep,&rem);
|
||||
char *cor_r=strtok_r(NULL,sep,&rem);
|
||||
char *cor_theta=strtok_r(NULL,sep,&rem);
|
||||
|
||||
double r, theta;
|
||||
r=strtod(cor_r,NULL);
|
||||
theta=strtod(cor_theta,NULL);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf(" Orig Time : %s\n",orig_time);
|
||||
printf(" Cor R : %f\n",r);
|
||||
printf(" Cor Theta : %f\n",theta);
|
||||
}
|
||||
build_and_install_others_cor_lsa(orig_router,ls_type,orig_time,
|
||||
(double)r, (double)theta);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check LSA whether its new. If new retrieve the LSA content and call
|
||||
* process_incoming_sync_content_lsa with content_data
|
||||
*/
|
||||
|
||||
void
|
||||
process_content_from_sync (struct ccn_charbuf *content_name,
|
||||
struct ccn_indexbuf *components)
|
||||
{
|
||||
if (nlsr->debugging)
|
||||
printf("process_content_from_sync called \n");
|
||||
size_t comp_size;
|
||||
char *lst;
|
||||
char *lsid;
|
||||
const unsigned char *second_last_comp;
|
||||
const unsigned char *third_last_comp;
|
||||
const unsigned char *origtime;
|
||||
char *sep=".";
|
||||
char *rem;
|
||||
char *second_comp_type;
|
||||
|
||||
int ls_type;
|
||||
long int ls_id=0;
|
||||
|
||||
unsigned char *content_data = NULL;
|
||||
|
||||
char *time_stamp=get_current_timestamp_micro_v2();
|
||||
|
||||
struct ccn_charbuf *uri = ccn_charbuf_create();
|
||||
ccn_uri_append(uri, content_name->buf, content_name->length, 0);
|
||||
|
||||
struct name_prefix *orig_router=(struct name_prefix *)
|
||||
calloc( 1, sizeof(struct name_prefix));
|
||||
|
||||
ccn_name_comp_get( content_name->buf, components,
|
||||
components->n-1-2, &second_last_comp, &comp_size);
|
||||
|
||||
if (nlsr->debugging)
|
||||
printf("2nd Last Component: %s \n", second_last_comp);
|
||||
|
||||
second_comp_type=strtok_r((char *)second_last_comp, sep, &rem);
|
||||
if (second_comp_type == NULL || rem == NULL)
|
||||
{
|
||||
printf ("Error: unable to tokenize the string: %s, calling exit()\n",
|
||||
(char *)second_last_comp);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ( strcmp( second_comp_type, "lsId" ) == 0 )
|
||||
{
|
||||
lsid=rem;
|
||||
ls_id=atoi(rem);
|
||||
ccn_name_comp_get(content_name->buf, components,components->n-2-2,
|
||||
&third_last_comp, &comp_size);
|
||||
lst=strtok_r((char *)third_last_comp,sep,&rem);
|
||||
lst=rem;
|
||||
ls_type=atoi(lst);
|
||||
ccn_name_comp_get(content_name->buf, components,components->n-2,
|
||||
&origtime, &comp_size);
|
||||
ccn_name_chop(content_name,components,-3);
|
||||
get_name_part(orig_router,content_name,components,0);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("Orig Router: %s Ls Type: %d Ls id: %ld Orig Time: %s\n",
|
||||
orig_router->name,ls_type,ls_id,origtime);
|
||||
|
||||
int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
|
||||
if ( nlsr->debugging )
|
||||
printf("LSA Life time: %d\n",lsa_life_time);
|
||||
|
||||
if ( strcmp(orig_router->name,nlsr->router_name) != 0
|
||||
&& (lsa_life_time < nlsr->router_dead_interval) )
|
||||
{
|
||||
int is_new_name_lsa=check_is_new_name_lsa(orig_router->name,
|
||||
(char *)lst,(char *)lsid,(char *)origtime);
|
||||
if ( is_new_name_lsa == 1 )
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("New NAME LSA.....\n");
|
||||
int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri),
|
||||
&content_data,orig_router->name);
|
||||
if ( chk_con == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Data: %s \n",content_data);
|
||||
process_incoming_sync_content_lsa(content_data);
|
||||
}
|
||||
else{
|
||||
if ( nlsr->debugging )
|
||||
printf("Verification failed. No content given back\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("Name LSA / Newer Name LSA already xists in LSDB\n");
|
||||
int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri)
|
||||
, &content_data,orig_router->name);
|
||||
|
||||
if ( chk_con == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Data: %s \n",content_data);
|
||||
process_incoming_sync_content_lsa(content_data);
|
||||
}
|
||||
else{
|
||||
if ( nlsr->debugging )
|
||||
printf("Verification failed. No content given back\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ls_type=atoi(rem);
|
||||
lst=rem;
|
||||
if(ls_type == LS_TYPE_ADJ)
|
||||
{
|
||||
ccn_name_comp_get(content_name->buf, components,components->n-2,
|
||||
&origtime, &comp_size);
|
||||
ccn_name_chop(content_name,components,-2);
|
||||
get_name_part(orig_router,content_name,components,0);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",
|
||||
orig_router->name,ls_type,origtime);
|
||||
|
||||
int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
|
||||
if ( nlsr->debugging )
|
||||
printf("LSA Life time: %d\n",lsa_life_time);
|
||||
|
||||
if ( strcmp(orig_router->name,nlsr->router_name) != 0
|
||||
&& (lsa_life_time < nlsr->router_dead_interval) )
|
||||
{
|
||||
int is_new_adj_lsa = check_is_new_adj_lsa( orig_router->name,
|
||||
(char *)lst, (char *)origtime);
|
||||
if ( is_new_adj_lsa == 1 )
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("New Adj LSA.....\n");
|
||||
int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri),
|
||||
&content_data,orig_router->name);
|
||||
|
||||
if ( chk_con == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Data: %s \n",content_data);
|
||||
process_incoming_sync_content_lsa(content_data);
|
||||
}
|
||||
else{
|
||||
if ( nlsr->debugging )
|
||||
printf("Verification failed. No content given back\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("Adj LSA / Newer Adj LSA already exists in LSDB\n");
|
||||
int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri),
|
||||
&content_data,orig_router->name);
|
||||
if ( chk_con == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Data: %s \n",content_data);
|
||||
process_incoming_sync_content_lsa(content_data);
|
||||
}
|
||||
else{
|
||||
if ( nlsr->debugging )
|
||||
printf("Verification failed. No content given back\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
|
||||
}
|
||||
}
|
||||
else if(ls_type == LS_TYPE_COR)
|
||||
{
|
||||
ccn_name_comp_get(content_name->buf, components, components->n-2,
|
||||
&origtime, &comp_size);
|
||||
ccn_name_chop(content_name,components,-2);
|
||||
get_name_part(orig_router,content_name,components,0);
|
||||
|
||||
if ( nlsr->debugging )
|
||||
printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",
|
||||
orig_router->name,ls_type,origtime);
|
||||
|
||||
int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
|
||||
if ( nlsr->debugging )
|
||||
printf("LSA Life time: %d\n",lsa_life_time);
|
||||
|
||||
if ( strcmp(orig_router->name,nlsr->router_name) != 0
|
||||
&& (lsa_life_time < nlsr->router_dead_interval) )
|
||||
{
|
||||
int is_new_cor_lsa=check_is_new_cor_lsa( orig_router->name,
|
||||
(char *)lst,(char *) origtime);
|
||||
if ( is_new_cor_lsa == 1 )
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("New Cor LSA.....\n");
|
||||
int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri),
|
||||
&content_data,
|
||||
orig_router->name);
|
||||
|
||||
if ( chk_con == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Data: %s \n",content_data);
|
||||
process_incoming_sync_content_lsa(content_data);
|
||||
}
|
||||
else{
|
||||
if ( nlsr->debugging )
|
||||
printf("Verification failed. No content given back\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("Cor LSA / Newer Cor LSA already exists in LSDB\n");
|
||||
int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri),
|
||||
&content_data,orig_router->name);
|
||||
if ( chk_con == 0 ){
|
||||
if ( nlsr->debugging )
|
||||
printf("Content Data: %s \n",content_data);
|
||||
process_incoming_sync_content_lsa(content_data);
|
||||
}
|
||||
else{
|
||||
if ( nlsr->debugging )
|
||||
printf("Verification failed. No content given back\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nlsr->debugging )
|
||||
printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(content_data)
|
||||
free(content_data);
|
||||
|
||||
if (orig_router->name)
|
||||
free(orig_router->name);
|
||||
if (orig_router)
|
||||
free(orig_router);
|
||||
ccn_charbuf_destroy(&uri);
|
||||
//01/31/2013
|
||||
free(time_stamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function performs same functionality as ccnsyncwatch
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
sync_monitor(char *topo_prefix, char *slice_prefix)
|
||||
{
|
||||
|
||||
struct ccn_charbuf *prefix = ccn_charbuf_create();
|
||||
struct ccn_charbuf *topo = ccn_charbuf_create();
|
||||
|
||||
nlsr->closure=(struct ccns_name_closure *)
|
||||
calloc(1,sizeof(struct ccns_name_closure)); // leak
|
||||
|
||||
nlsr->slice = ccns_slice_create();
|
||||
|
||||
ccn_charbuf_reset(prefix);
|
||||
ccn_name_from_uri(prefix, slice_prefix);
|
||||
|
||||
ccn_charbuf_reset(topo);
|
||||
ccn_name_from_uri(topo, topo_prefix);
|
||||
|
||||
ccns_slice_set_topo_prefix(nlsr->slice, topo, prefix);
|
||||
nlsr->closure->callback = &sync_cb;
|
||||
nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, NULL, NULL);
|
||||
|
||||
ccn_charbuf_destroy(&prefix);
|
||||
ccn_charbuf_destroy(&topo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ccn_charbuf *
|
||||
make_template(int scope)
|
||||
{
|
||||
struct ccn_charbuf *templ = NULL;
|
||||
templ = ccn_charbuf_create();
|
||||
ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
|
||||
ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
|
||||
ccn_charbuf_append_closer(templ); /* </Name> */
|
||||
if (0 <= scope && scope <= 2)
|
||||
ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
|
||||
ccn_charbuf_append_closer(templ); /* </Interest> */
|
||||
return(templ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write signed data to repo
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
write_data_to_repo(char *data, char *name_prefix)
|
||||
{
|
||||
|
||||
nlsr_lock();
|
||||
if ( nlsr->debugging )
|
||||
{
|
||||
printf("write_data_to_repo called\n");
|
||||
printf("Content Name: %s \n",name_prefix);
|
||||
printf("Content Data: %s \n",data);
|
||||
}
|
||||
|
||||
struct ccn *temp_ccn;
|
||||
temp_ccn=ccn_create();
|
||||
int ccn_fd=ccn_connect(temp_ccn, NULL);
|
||||
if(ccn_fd == -1)
|
||||
{
|
||||
fprintf(stderr,"Could not connect to ccnd for Data Writing\n");
|
||||
writeLogg(__FILE__,__FUNCTION__,__LINE__,
|
||||
"Could not connect to ccnd for Data Writing\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ccn_charbuf *name = NULL;
|
||||
struct ccn_seqwriter *w = NULL;
|
||||
int blocksize = 4096;
|
||||
int freshness = -1;
|
||||
int scope = 1;
|
||||
int res;
|
||||
size_t blockread;
|
||||
struct ccn_charbuf *templ;
|
||||
|
||||
name = ccn_charbuf_create();
|
||||
res = ccn_name_from_uri(name, name_prefix);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "bad CCN URI: %s\n",name_prefix);
|
||||
return -1;
|
||||
}
|
||||
|
||||
w = ccn_seqw_create(temp_ccn, name);
|
||||
if (w == NULL) {
|
||||
fprintf(stderr, "ccn_seqw_create failed\n");
|
||||
return -1;
|
||||
}
|
||||
ccn_seqw_set_block_limits(w, blocksize, blocksize);
|
||||
if (freshness > -1)
|
||||
ccn_seqw_set_freshness(w, freshness);
|
||||
|
||||
struct ccn_charbuf *name_v = ccn_charbuf_create();
|
||||
ccn_seqw_get_name(w, name_v);
|
||||
ccn_name_from_uri(name_v, "%C1.R.sw");
|
||||
ccn_name_append_nonce(name_v);
|
||||
templ = make_template(scope);
|
||||
res = ccn_get(temp_ccn, name_v, templ, 60000, NULL, NULL, NULL, 0);
|
||||
ccn_charbuf_destroy(&templ);
|
||||
ccn_charbuf_destroy(&name_v);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "No response from repository\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ccn_charbuf *resultbuf=ccn_charbuf_create();
|
||||
|
||||
sign_content_with_user_defined_keystore(name,
|
||||
resultbuf,
|
||||
data,
|
||||
strlen(data),
|
||||
nlsr->keystore_path,
|
||||
nlsr->keystore_passphrase,
|
||||
nlsr->root_key_prefix,
|
||||
nlsr->site_name,
|
||||
nlsr->router_name,
|
||||
60);
|
||||
|
||||
|
||||
blockread=resultbuf->length;
|
||||
|
||||
if (blockread > 0) {
|
||||
res = ccn_seqw_write(w, resultbuf->buf, resultbuf->length);
|
||||
while (res == -1) {
|
||||
ccn_run(temp_ccn,1);
|
||||
res = ccn_seqw_write(w, resultbuf->buf, resultbuf->length);
|
||||
}
|
||||
}
|
||||
|
||||
ccn_seqw_close(w);
|
||||
ccn_run(temp_ccn, 1);
|
||||
ccn_charbuf_destroy(&name);
|
||||
ccn_destroy(&temp_ccn);
|
||||
ccn_charbuf_destroy(&resultbuf);
|
||||
|
||||
nlsr_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create slice for sync/repo
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
create_sync_slice(char *topo_prefix, char *slice_prefix)
|
||||
{
|
||||
int res;
|
||||
struct ccn *handle;
|
||||
struct ccns_slice *slice;
|
||||
struct ccn_charbuf *prefix = ccn_charbuf_create();
|
||||
struct ccn_charbuf *topo = ccn_charbuf_create();
|
||||
struct ccn_charbuf *clause = ccn_charbuf_create();
|
||||
struct ccn_charbuf *slice_name = ccn_charbuf_create();
|
||||
struct ccn_charbuf *slice_uri = ccn_charbuf_create();
|
||||
|
||||
if (prefix == NULL || topo == NULL || clause == NULL ||
|
||||
slice_name == NULL || slice_uri == NULL) {
|
||||
fprintf(stderr, "Unable to allocate required memory.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
handle = ccn_create();
|
||||
res = ccn_connect(handle, NULL);
|
||||
if (0 > res) {
|
||||
fprintf(stderr, "Unable to connect to ccnd.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
slice = ccns_slice_create();
|
||||
|
||||
ccn_charbuf_reset(topo);
|
||||
ccn_name_from_uri(topo, topo_prefix);
|
||||
ccn_charbuf_reset(prefix);
|
||||
ccn_name_from_uri(prefix,slice_prefix );
|
||||
ccns_slice_set_topo_prefix(slice, topo, prefix);
|
||||
|
||||
|
||||
res = ccns_write_slice(handle, slice, slice_name);
|
||||
|
||||
//01/31/2013
|
||||
ccns_slice_destroy(&slice);
|
||||
ccn_destroy(&handle);
|
||||
ccn_charbuf_destroy(&prefix);
|
||||
ccn_charbuf_destroy(&topo);
|
||||
ccn_charbuf_destroy(&clause);
|
||||
ccn_charbuf_destroy(&slice_name);
|
||||
ccn_charbuf_destroy(&slice_uri);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
#ifndef _NLSR_SYNC_H_
|
||||
#define _NLSR_SYNC_H_
|
||||
|
||||
struct ccn_charbuf * make_template(int scope);
|
||||
int sync_monitor(char *topo_prefix, char *slice_prefix);
|
||||
int write_data_to_repo(char *data,char *name_prefix);
|
||||
int create_sync_slice(char *topo_prefix, char *slice_prefix);
|
||||
void process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components);
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
.TH NLSRC 1 "JANUARY 2013" Linux "nlsrc Manual"
|
||||
.SH NAME
|
||||
nlsrc \- allows the addition or removal of names and/or neighbors while nlsr is running
|
||||
.SH SYNOPSIS
|
||||
.B nlsrc -s
|
||||
.I server
|
||||
.B -p
|
||||
.I port
|
||||
.B add|del name|neighbor prefix
|
||||
.SH DESCRIPTION
|
||||
.B nlsrc
|
||||
allows operators to add or remove names or neighbors while nlsr is running. Names and neighbors can be modified on the localhost or from a remote host.
|
||||
.SH OPTIONS
|
||||
.IP -s server
|
||||
specifies the server you would like to make changes to
|
||||
.IP -p port
|
||||
specifies the port you are connecting to on the server, default port is 9696
|
||||
.IP add|del
|
||||
specifies whether you are performing an add or delete operation
|
||||
.IP name|neighbor
|
||||
specifies whether you are modifying a name or a neighbor
|
||||
.IP prefix
|
||||
specifies the prefix for the name or neighbor
|
||||
.SH AUTHOR
|
||||
A K M Mahmudul Hoque
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
//1. Make the necessary includes and set up the variables:
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <getopt.h>
|
||||
|
||||
struct option longopts[] =
|
||||
{
|
||||
{ "server_ip", required_argument, NULL, 's'},
|
||||
{ "server_port", required_argument, NULL, 'p'},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static int
|
||||
usage(char *progname)
|
||||
{
|
||||
printf("Usage: %s [OPTIONS...]\n\
|
||||
NLSR API client....\n\
|
||||
nlsrc -s server_ip -p server_port add|del name|neighbor name_prefix [faceX] \n\
|
||||
option -- description\n\n\
|
||||
add|del -- specify whether you want to add or delete.\n\
|
||||
name|neighbor -- specify whether you are adding a name or a neighbor.\n\
|
||||
name_prefix -- name of the prefix for the name|neighbor.\n\
|
||||
faceX -- face ID for neighbor if the third argument is neighbor.\n\n\
|
||||
Examples:\n\
|
||||
1) nlsrc -s 127.0.0.1 -p 9696 add name /ndn/memphis.edu/test \n", progname);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int sockfd;
|
||||
int len;
|
||||
struct sockaddr_in address;
|
||||
int result;
|
||||
int bytesSent;
|
||||
char *server_address, *server_port;
|
||||
|
||||
int command_len=0;
|
||||
int i;
|
||||
|
||||
if (argc < 8)
|
||||
usage(argv[0]);
|
||||
|
||||
if (strcmp(argv[6], "neighbor") == 0 && argc < 9)
|
||||
usage(argv[0]);
|
||||
|
||||
if (strcmp(argv[6], "name") != 0 && strcmp(argv[6], "neighbor") != 0)
|
||||
usage(argv[0]);
|
||||
|
||||
while ((result = getopt_long(argc, argv, "s:p:", longopts, 0)) != -1)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case 's':
|
||||
server_address = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
server_port = optarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char recv_buffer[1024];
|
||||
bzero(recv_buffer,1024);
|
||||
|
||||
for(i=5;i<argc;i++)
|
||||
command_len+=(strlen(argv[i])+1);
|
||||
char *command=malloc(command_len);
|
||||
memset(command, 0, command_len);
|
||||
for(i=5;i<argc;i++)
|
||||
{
|
||||
memcpy(command+strlen(command),argv[i],strlen(argv[i]));
|
||||
if ( i < argc-1 )
|
||||
memcpy(command+strlen(command)," ",1);
|
||||
}
|
||||
|
||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
//address.sun_family = AF_UNIX;
|
||||
//strcpy(address.sun_path, "/tmp/nlsr_api_server_socket");
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr = inet_addr(server_address);
|
||||
address.sin_port = htons(atoi(server_port));
|
||||
|
||||
len = sizeof(address);
|
||||
result = connect(sockfd, (struct sockaddr *)&address, len);
|
||||
if(result == -1)
|
||||
{
|
||||
perror("oops nlsrc ");
|
||||
exit(1);
|
||||
}
|
||||
printf("Command to send: %s \n",command);
|
||||
bytesSent=send(sockfd, command, strlen(command),0);
|
||||
printf("Command len: %d, Bytes sent: %d \n",(int)strlen(command), bytesSent);
|
||||
recv(sockfd, recv_buffer, 1024, 0);
|
||||
printf("%s\n",recv_buffer);
|
||||
free(command);
|
||||
close(sockfd);
|
||||
exit(0);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
nsync is a copy of ChronoSync (https://github.com/bruinfish/ChronoSync/tree/master).
|
||||
|
||||
ChonoSync's license is GPL2.
|
||||
@@ -0,0 +1,15 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014 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>
|
||||
@@ -0,0 +1,21 @@
|
||||
#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
|
||||
@@ -0,0 +1,49 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/**
|
||||
* Copyright (c) 2014 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
|
||||
@@ -0,0 +1,74 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,72 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,98 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,102 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,262 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,199 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,35 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,49 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,71 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,118 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,79 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,99 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,126 @@
|
||||
/* -*- 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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/* -*- 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
|
||||
@@ -0,0 +1,43 @@
|
||||
/* -*- 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
|
||||
Loaded 100 of 256 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user