bug+codestyle: Fix compile bugs and adjust code style
Change-Id: I008bb538441c099fa25b8b967fbf23ffce13a220
diff --git a/.gitmodules b/.gitmodules
index ef6b513..aa05731 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "ChronoSync"]
path = ChronoSync
url = https://github.com/bruinfish/ChronoSync.git
- branch = security
+ branch = master
diff --git a/ChronoSync b/ChronoSync
index 7c64e5c..cb5c551 160000
--- a/ChronoSync
+++ b/ChronoSync
@@ -1 +1 @@
-Subproject commit 7c64e5c3a81dbe7167d3a3736bded6ded1de0c92
+Subproject commit cb5c551fa9f95a283e8e1988ff2034c454321ab8
diff --git a/debug-tools/create-cert.cc b/debug-tools/create-cert.cc
index 282c07e..09861d3 100644
--- a/debug-tools/create-cert.cc
+++ b/debug-tools/create-cert.cc
@@ -5,25 +5,25 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp-dev/security/key-chain.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
using namespace ndn;
-int
+int
main()
{
- KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+ KeyChain keyChain("sqlite3", "file");
std::vector<CertificateSubjectDescription> subjectDescription;
Name root("/ndn");
Name rootCertName = keyChain.createIdentity(root);
Name test("/ndn/test");
- Name testKeyName = keyChain.generateRSAKeyPairAsDefault(test, true);
- shared_ptr<IdentityCertificate> testCert =
- keyChain.prepareUnsignedIdentityCertificate(testKeyName, root,
+ Name testKeyName = keyChain.generateRsaKeyPairAsDefault(test, true);
+ shared_ptr<IdentityCertificate> testCert =
+ keyChain.prepareUnsignedIdentityCertificate(testKeyName, root,
time::system_clock::now(),
- time::system_clock::now() + time::days(7300),
+ time::system_clock::now() + time::days(7300),
subjectDescription);
keyChain.signByIdentity(*testCert, root);
keyChain.addCertificateAsIdentityDefault(*testCert);
@@ -31,11 +31,11 @@
Name alice("/ndn/test/alice");
if(!keyChain.doesIdentityExist(alice))
{
- Name aliceKeyName = keyChain.generateRSAKeyPairAsDefault(alice, true);
- shared_ptr<IdentityCertificate> aliceCert =
- keyChain.prepareUnsignedIdentityCertificate(aliceKeyName, test,
+ Name aliceKeyName = keyChain.generateRsaKeyPairAsDefault(alice, true);
+ shared_ptr<IdentityCertificate> aliceCert =
+ keyChain.prepareUnsignedIdentityCertificate(aliceKeyName, test,
time::system_clock::now(),
- time::system_clock::now() + time::days(7300),
+ time::system_clock::now() + time::days(7300),
subjectDescription);
keyChain.signByIdentity(*aliceCert, test);
keyChain.addCertificateAsIdentityDefault(*aliceCert);
@@ -44,9 +44,12 @@
Name bob("/ndn/test/bob");
if(!keyChain.doesIdentityExist(bob))
{
- Name bobKeyName = keyChain.generateRSAKeyPairAsDefault(bob, true);
- shared_ptr<IdentityCertificate> bobCert =
- keyChain.prepareUnsignedIdentityCertificate(bobKeyName, test, getNow(), getNow() + 630720000, subjectDescription);
+ Name bobKeyName = keyChain.generateRsaKeyPairAsDefault(bob, true);
+ shared_ptr<IdentityCertificate> bobCert =
+ keyChain.prepareUnsignedIdentityCertificate(bobKeyName, test,
+ time::system_clock::now(),
+ time::system_clock::now() + time::days(7300),
+ subjectDescription);
keyChain.signByIdentity(*bobCert, test);
keyChain.addCertificateAsIdentityDefault(*bobCert);
}
@@ -54,9 +57,12 @@
Name cathy("/ndn/test/cathy");
if(!keyChain.doesIdentityExist(cathy))
{
- Name cathyKeyName = keyChain.generateRSAKeyPairAsDefault(cathy, true);
- shared_ptr<IdentityCertificate> cathyCert =
- keyChain.prepareUnsignedIdentityCertificate(cathyKeyName, test, getNow(), getNow() + 630720000, subjectDescription);
+ Name cathyKeyName = keyChain.generateRsaKeyPairAsDefault(cathy, true);
+ shared_ptr<IdentityCertificate> cathyCert =
+ keyChain.prepareUnsignedIdentityCertificate(cathyKeyName, test,
+ time::system_clock::now(),
+ time::system_clock::now() + time::days(7300),
+ subjectDescription);
keyChain.signByIdentity(*cathyCert, test);
keyChain.addCertificateAsIdentityDefault(*cathyCert);
}
diff --git a/debug-tools/dump-cert.cc b/debug-tools/dump-cert.cc
index 6022940..7050175 100644
--- a/debug-tools/dump-cert.cc
+++ b/debug-tools/dump-cert.cc
@@ -5,12 +5,13 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/face.hpp>
+#include "common.hpp"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/face.hpp>
using namespace ndn;
-int
+int
main()
{
Name root("/ndn");
@@ -19,23 +20,21 @@
Name bob("/ndn/test/bob");
Name cathy("/ndn/test/cathy");
- KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+ KeyChain keyChain("sqlite3", "file");
- if(!keyChain.doesIdentityExist(root)
- || !keyChain.doesIdentityExist(test)
- || !keyChain.doesIdentityExist(alice)
- || !keyChain.doesIdentityExist(bob)
- || !keyChain.doesIdentityExist(cathy))
+ if (!keyChain.doesIdentityExist(root) ||
+ !keyChain.doesIdentityExist(test) ||
+ !keyChain.doesIdentityExist(alice) ||
+ !keyChain.doesIdentityExist(bob) ||
+ !keyChain.doesIdentityExist(cathy))
return 1;
- shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
- shared_ptr<Face> face = shared_ptr<Face>(new Face(ioService));
- // shared_ptr<Face> face = make_shared<Face>();
-
- face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(test)));
- face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(alice)));
- face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(bob)));
- face->put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(cathy)));
+ Face face;
- ioService->run();
+ face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(test)));
+ face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(alice)));
+ face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(bob)));
+ face.put(*keyChain.getCertificate(keyChain.getDefaultCertificateNameForIdentity(cathy)));
+
+ face.getIoService().run();
}
diff --git a/debug-tools/dump-local-prefix.cc b/debug-tools/dump-local-prefix.cc
index ba67ac4..7f3af3f 100644
--- a/debug-tools/dump-local-prefix.cc
+++ b/debug-tools/dump-local-prefix.cc
@@ -5,23 +5,23 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/face.hpp>
+#include "common.hpp"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/face.hpp>
using namespace ndn;
-int
+int
main()
{
Name root("/ndn");
- KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+ KeyChain keyChain("sqlite3", "file");
if(!keyChain.doesIdentityExist(root))
return 1;
- shared_ptr<boost::asio::io_service> ioService = make_shared<boost::asio::io_service>();
- shared_ptr<Face> face = shared_ptr<Face>(new Face(ioService));
+ Face face;
Name name("/local/ndn/prefix");
name.appendVersion().appendSegment(0);
@@ -30,8 +30,8 @@
std::string prefix("/ndn/test");
data.setContent(reinterpret_cast<const uint8_t*>(prefix.c_str()), prefix.size());
keyChain.signByIdentity(data, root);
-
- face->put(data);
- ioService->run();
+ face.put(data);
+
+ face.getIoService().run();
}
diff --git a/docs/DesignDoc.rst b/docs/DesignDoc.rst
new file mode 100644
index 0000000..6fd0acf
--- /dev/null
+++ b/docs/DesignDoc.rst
@@ -0,0 +1,2 @@
+Design Document
+===============
diff --git a/docs/FAQ.rst b/docs/FAQ.rst
new file mode 100644
index 0000000..cde88d8
--- /dev/null
+++ b/docs/FAQ.rst
@@ -0,0 +1,2 @@
+FAQ
+===
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..2c11bec
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,256 @@
+# -*- coding: utf-8 -*-
+#
+# NFD - Named Data Networking Forwarding Daemon 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
+import re
+
+# 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',
+]
+
+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('.', '-'))
+
+addExtensionIfExists('sphinxcontrib.doxylink')
+
+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'ChronoChat: A Serverless Chat Application in NDN'
+copyright = u'2014, Named Data Networking Project'
+
+# 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 = 'ChronoChat-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', 'ChronoChat-docs.tex', u'A Serverless Chat Application in NDN',
+ 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 = [
+]
+
+
+# If true, show URL addresses after external links.
+man_show_urls = True
+
+
+# ---- Custom options --------
+
+doxylink = {
+ 'ChronoChat' : ('ChronoChat.tag', 'doxygen/'),
+}
+
+if os.getenv('GOOGLE_ANALYTICS', None):
+ googleanalytics_id = os.environ['GOOGLE_ANALYTICS']
+ googleanalytics_enabled = True
+
+exclude_patterns = ['RELEASE_NOTES.rst']
diff --git a/docs/doxygen.conf.in b/docs/doxygen.conf.in
new file mode 100644
index 0000000..bda1ca8
--- /dev/null
+++ b/docs/doxygen.conf.in
@@ -0,0 +1,2283 @@
+# Doxyfile 1.8.5
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "ChronoChat"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER = @VERSION@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = docs/doxygen
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = YES
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-
+# Traditional, Croatian, Czech, Danish, Dutch, English, Esperanto, Farsi,
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en,
+# Korean, Korean-en, Latvian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
+# Turkish, Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = YES
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = NO
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = YES
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= NO
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = src/
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = ./
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER = ../docs/named_data_theme/named_data_header.html
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER = ../docs/named_data_theme/named_data_footer.html
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET = ../docs/named_data_theme/static/named_data_doxygen.css
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES = ../docs/named_data_theme/static/doxygen.css \
+ ../docs/named_data_theme/static/base.css \
+ ../docs/named_data_theme/static/foundation.css \
+ ../docs/named_data_theme/static/bar-top.png
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 0
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 0
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 91
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = YES
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE = ChronoChat.tag
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = YES
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = YES
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = YES
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = svg
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..7ca80bd
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,43 @@
+ChronoChat - A Serverless Chat Application in NDN
+=================================================
+
+..
+ NFD is a network forwarder that implements and evolves together with the Named Data
+ Networking (NDN) `protocol <http://named-data.net/doc/ndn-tlv/>`__. After the initial
+ release, NFD will become a core component of the `NDN Platform
+ <http://named-data.net/codebase/platform/>`__ and will follow the same release cycle.
+
+ChronoChat Documentation
+------------------------
+
+.. toctree::
+ :hidden:
+ :maxdepth: 3
+
+ DesignDoc
+ FAQ
+
+..
+ INSTALL
+
+* :doc:`DesignDoc`
+
+* :doc:`FAQ`
+
+**Additional documentation**
+
+* `API documentation (doxygen) <doxygen/annotated.html>`_
+
+Downloading
+-----------
+
+* `Source code GitHub git repository <https://github.com/named-data/ChronoSync>`_.
+
+License
+-------
+
+..
+ NFD is an open and free software package licensed under GPL 3.0 license and is the
+ centerpiece of our committement to making NDN's core technology open and free to all
+ Internet users and developers. For more information about the licensing details and
+ limitation, refer to `COPYING.md <https://github.com/named-data/NFD/blob/master/COPYING.md>`_.
diff --git a/docs/named_data_theme/layout.html b/docs/named_data_theme/layout.html
new file mode 100644
index 0000000..78b6477
--- /dev/null
+++ b/docs/named_data_theme/layout.html
@@ -0,0 +1,86 @@
+{#
+ 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>{{ _('Developer documentation') }}</h3>
+ <ul>
+ <li class="toctree-l1"><a class="reference internal" href="doxygen/annotated.html">API documentation (doxygen)</a></li>
+ <li class="toctree-l1"><a class="reference internal" href="code-style.html">ndn-cxx Code Style and Coding Guidelines</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-->
+{% endblock %}
+
+{% block relbar1 %}{% endblock %}
+{% block relbar2 %}{% endblock %}
diff --git a/docs/named_data_theme/named_data_footer-with-analytics.html.in b/docs/named_data_theme/named_data_footer-with-analytics.html.in
new file mode 100644
index 0000000..b05c1f2
--- /dev/null
+++ b/docs/named_data_theme/named_data_footer-with-analytics.html.in
@@ -0,0 +1,37 @@
+<!-- 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-->
+
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', '@GOOGLE_ANALYTICS@']);
+ _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>
+
+<script type="text/javascript">
+</script>
+</body>
+</html>
diff --git a/docs/named_data_theme/named_data_footer.html b/docs/named_data_theme/named_data_footer.html
new file mode 100644
index 0000000..77fc327
--- /dev/null
+++ b/docs/named_data_theme/named_data_footer.html
@@ -0,0 +1,24 @@
+<!-- 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-->
+
+<script type="text/javascript">
+</script>
+</body>
+</html>
diff --git a/docs/named_data_theme/named_data_header.html b/docs/named_data_theme/named_data_header.html
new file mode 100644
index 0000000..c84397c
--- /dev/null
+++ b/docs/named_data_theme/named_data_header.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/ndn-cxx/$projectnumber/">$projectname $projectnumber documentation</a></h1>
+ </div>
+ </div>
+</div><!--header container end-->
+<!--END TITLEAREA-->
+
+<!-- end header part -->
diff --git a/docs/named_data_theme/static/bar-top.png b/docs/named_data_theme/static/bar-top.png
new file mode 100644
index 0000000..07cafb6
--- /dev/null
+++ b/docs/named_data_theme/static/bar-top.png
Binary files differ
diff --git a/docs/named_data_theme/static/base.css b/docs/named_data_theme/static/base.css
new file mode 100644
index 0000000..164d1c1
--- /dev/null
+++ b/docs/named_data_theme/static/base.css
@@ -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;
+}
diff --git a/docs/named_data_theme/static/base.css_t b/docs/named_data_theme/static/base.css_t
new file mode 100644
index 0000000..eed3973
--- /dev/null
+++ b/docs/named_data_theme/static/base.css_t
@@ -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;
+}
\ No newline at end of file
diff --git a/docs/named_data_theme/static/bc_s.png b/docs/named_data_theme/static/bc_s.png
new file mode 100644
index 0000000..eebf862
--- /dev/null
+++ b/docs/named_data_theme/static/bc_s.png
Binary files differ
diff --git a/docs/named_data_theme/static/default.css_t b/docs/named_data_theme/static/default.css_t
new file mode 100644
index 0000000..b582768
--- /dev/null
+++ b/docs/named_data_theme/static/default.css_t
@@ -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;
+}
diff --git a/docs/named_data_theme/static/doxygen.css b/docs/named_data_theme/static/doxygen.css
new file mode 100644
index 0000000..e5c796e
--- /dev/null
+++ b/docs/named_data_theme/static/doxygen.css
@@ -0,0 +1,1157 @@
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 13px;
+ line-height: 1.3;
+}
+
+/* @group Heading Levels */
+
+h1 {
+ font-size: 150%;
+}
+
+.title {
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+}
+
+h2 {
+ font-size: 120%;
+}
+
+h3 {
+ font-size: 100%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ -webkit-transition: text-shadow 0.5s linear;
+ -moz-transition: text-shadow 0.5s linear;
+ -ms-transition: text-shadow 0.5s linear;
+ -o-transition: text-shadow 0.5s linear;
+ transition: text-shadow 0.5s linear;
+ margin-right: 15px;
+}
+
+h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow {
+ text-shadow: 0 0 15px cyan;
+}
+
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
+}
+
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+ font-weight: bold;
+}
+
+span.legend {
+ font-size: 70%;
+ text-align: center;
+}
+
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+
+div.qindex, div.navtab{
+ background-color: #EFEFEF;
+ border: 1px solid #B5B5B5;
+ text-align: center;
+}
+
+div.qindex, div.navpath {
+ width: 100%;
+ line-height: 140%;
+}
+
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #585858;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+/*.contents a:visited {
+ color: #686868;
+}*/
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #B0B0B0;
+ color: #ffffff;
+ border: 1px double #9F9F9F;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code, a.code:visited {
+ color: #4665A2;
+}
+
+a.codeRef, a.codeRef:visited {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
+
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+
+div.fragment {
+ padding: 4px;
+ margin: 4px;
+ background-color: #FCFCFC;
+ border: 1px solid #D0D0D0;
+}
+
+div.line {
+ font-family: monospace, fixed;
+ font-size: 13px;
+ min-height: 13px;
+ line-height: 1.0;
+ text-wrap: unrestricted;
+ white-space: -moz-pre-wrap; /* Moz */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ white-space: pre-wrap; /* CSS3 */
+ word-wrap: break-word; /* IE 5.5+ */
+ text-indent: -53px;
+ padding-left: 53px;
+ padding-bottom: 0px;
+ margin: 0px;
+ -webkit-transition-property: background-color, box-shadow;
+ -webkit-transition-duration: 0.5s;
+ -moz-transition-property: background-color, box-shadow;
+ -moz-transition-duration: 0.5s;
+ -ms-transition-property: background-color, box-shadow;
+ -ms-transition-duration: 0.5s;
+ -o-transition-property: background-color, box-shadow;
+ -o-transition-duration: 0.5s;
+ transition-property: background-color, box-shadow;
+ transition-duration: 0.5s;
+}
+
+div.line.glow {
+ background-color: cyan;
+ box-shadow: 0 0 10px cyan;
+}
+
+
+span.lineno {
+ padding-right: 4px;
+ text-align: right;
+ border-right: 2px solid #0F0;
+ background-color: #E8E8E8;
+ white-space: pre;
+}
+span.lineno a {
+ background-color: #D8D8D8;
+}
+
+span.lineno a:hover {
+ background-color: #C8C8C8;
+}
+
+div.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
+}
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
+
+body {
+ background-color: white;
+ color: black;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 12px;
+ margin-right: 8px;
+}
+
+td.indexkey {
+ background-color: #EFEFEF;
+ font-weight: bold;
+ border: 1px solid #D0D0D0;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
+ white-space: nowrap;
+ vertical-align: top;
+}
+
+td.indexvalue {
+ background-color: #EFEFEF;
+ border: 1px solid #D0D0D0;
+ padding: 2px 10px;
+ margin: 2px 0px;
+}
+
+tr.memlist {
+ background-color: #F1F1F1;
+}
+
+p.formulaDsp {
+ text-align: center;
+}
+
+img.formulaDsp {
+
+}
+
+img.formulaInl {
+ vertical-align: middle;
+}
+
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+
+div.center img {
+ border: 0px;
+}
+
+address.footer {
+ text-align: right;
+ padding-right: 12px;
+}
+
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+blockquote {
+ background-color: #F8F8F8;
+ border-left: 2px solid #B0B0B0;
+ margin: 0 24px 0 4px;
+ padding: 0 12px 0 16px;
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #B5B5B5;
+}
+
+th.dirtab {
+ background: #EFEFEF;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #6E6E6E;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.memberdecls td {
+ -webkit-transition-property: background-color, box-shadow;
+ -webkit-transition-duration: 0.5s;
+ -moz-transition-property: background-color, box-shadow;
+ -moz-transition-duration: 0.5s;
+ -ms-transition-property: background-color, box-shadow;
+ -ms-transition-duration: 0.5s;
+ -o-transition-property: background-color, box-shadow;
+ -o-transition-duration: 0.5s;
+ transition-property: background-color, box-shadow;
+ transition-duration: 0.5s;
+}
+
+.memberdecls td.glow {
+ background-color: cyan;
+ box-shadow: 0 0 15px cyan;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #FAFAFA;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memItemLeft, .memItemRight, .memTemplParams {
+ border-top: 1px solid #D0D0D0;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memItemRight {
+ width: 100%;
+}
+
+.memTemplParams {
+ color: #686868;
+ white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtemplate {
+ font-size: 80%;
+ color: #686868;
+ font-weight: normal;
+ margin-left: 9px;
+}
+
+.memnav {
+ background-color: #EFEFEF;
+ border: 1px solid #B5B5B5;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+
+.mempage {
+ width: 100%;
+}
+
+.memitem {
+ padding: 0;
+ margin-bottom: 10px;
+ margin-right: 5px;
+ -webkit-transition: box-shadow 0.5s linear;
+ -moz-transition: box-shadow 0.5s linear;
+ -ms-transition: box-shadow 0.5s linear;
+ -o-transition: box-shadow 0.5s linear;
+ transition: box-shadow 0.5s linear;
+ display: table !important;
+ width: 100%;
+}
+
+.memitem.glow {
+ box-shadow: 0 0 15px cyan;
+}
+
+.memname {
+ font-weight: bold;
+ margin-left: 6px;
+}
+
+.memname td {
+ vertical-align: bottom;
+}
+
+.memproto, dl.reflist dt {
+ border-top: 1px solid #B9B9B9;
+ border-left: 1px solid #B9B9B9;
+ border-right: 1px solid #B9B9B9;
+ padding: 6px 0px 6px 0px;
+ color: #323232;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E8E8E8;
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 4px;
+ border-top-left-radius: 4px;
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 4px;
+ -moz-border-radius-topleft: 4px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 4px;
+ -webkit-border-top-left-radius: 4px;
+
+}
+
+.memdoc, dl.reflist dd {
+ border-bottom: 1px solid #B9B9B9;
+ border-left: 1px solid #B9B9B9;
+ border-right: 1px solid #B9B9B9;
+ padding: 6px 10px 2px 10px;
+ background-color: #FCFCFC;
+ border-top-width: 0;
+ background-image:url('nav_g.png');
+ background-repeat:repeat-x;
+ background-color: #FFFFFF;
+ /* opera specific markup */
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 4px;
+ -moz-border-radius-bottomright: 4px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+dl.reflist dt {
+ padding: 5px;
+}
+
+dl.reflist dd {
+ margin: 0px 0px 10px 0px;
+ padding: 5px;
+}
+
+.paramkey {
+ text-align: right;
+}
+
+.paramtype {
+ white-space: nowrap;
+}
+
+.paramname {
+ color: #602020;
+ white-space: nowrap;
+}
+.paramname em {
+ font-style: normal;
+}
+.paramname code {
+ line-height: 14px;
+}
+
+.params, .retval, .exception, .tparams {
+ margin-left: 0px;
+ padding-left: 0px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+table.mlabels {
+ border-spacing: 0px;
+}
+
+td.mlabels-left {
+ width: 100%;
+ padding: 0px;
+}
+
+td.mlabels-right {
+ vertical-align: bottom;
+ padding: 0px;
+ white-space: nowrap;
+}
+
+span.mlabels {
+ margin-left: 8px;
+}
+
+span.mlabel {
+ background-color: #8F8F8F;
+ border-top:1px solid #787878;
+ border-left:1px solid #787878;
+ border-right:1px solid #D0D0D0;
+ border-bottom:1px solid #D0D0D0;
+ text-shadow: none;
+ color: white;
+ margin-right: 4px;
+ padding: 2px 3px;
+ border-radius: 3px;
+ font-size: 7pt;
+ white-space: nowrap;
+}
+
+
+
+/* @end */
+
+/* these are for tree view when not used as main index */
+
+div.directory {
+ margin: 10px 0px;
+ border-top: 1px solid #A8B8D9;
+ border-bottom: 1px solid #A8B8D9;
+ width: 100%;
+}
+
+.directory table {
+ border-collapse:collapse;
+ width: 100%;
+}
+
+.directory td {
+ margin: 0px;
+ padding: 0px;
+ vertical-align: top;
+}
+
+.directory td.entry {
+ width: 20%;
+ white-space: nowrap;
+ padding-right: 6px;
+}
+
+.directory td.entry a {
+ outline:none;
+}
+
+.directory td.entry a img {
+ border: none;
+}
+
+.directory td.desc {
+ width: 80%;
+ padding-left: 6px;
+ padding-right: 6px;
+ border-left: 1px solid rgba(0,0,0,0.05);
+}
+
+.directory tr.even {
+ padding-left: 6px;
+ background-color: #F8F8F8;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+.directory .levels {
+ white-space: nowrap;
+ width: 100%;
+ text-align: right;
+ font-size: 9pt;
+}
+
+.directory .levels span {
+ cursor: pointer;
+ padding-left: 2px;
+ padding-right: 2px;
+ color: #585858;
+}
+
+div.dynheader {
+ margin-top: 8px;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+address {
+ font-style: normal;
+ color: #3A3A3A;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+ margin-top: 4px;
+ margin-bottom: 4px;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #3F3F3F;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #4F4F4F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+}
+
+table.fieldtable {
+ width: 100%;
+ margin-bottom: 10px;
+ border: 1px solid #B9B9B9;
+ border-spacing: 0px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
+ box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
+}
+
+.fieldtable td, .fieldtable th {
+ padding: 3px 7px 2px;
+}
+
+.fieldtable td.fieldtype, .fieldtable td.fieldname {
+ white-space: nowrap;
+ border-right: 1px solid #B9B9B9;
+ border-bottom: 1px solid #B9B9B9;
+ vertical-align: top;
+}
+
+.fieldtable td.fielddoc {
+ border-bottom: 1px solid #B9B9B9;
+ width: 100%;
+}
+
+.fieldtable tr:last-child td {
+ border-bottom: none;
+}
+
+.fieldtable th {
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E8E8E8;
+ font-size: 90%;
+ color: #323232;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+ -moz-border-radius-topleft: 4px;
+ -moz-border-radius-topright: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ border-bottom: 1px solid #B9B9B9;
+}
+
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#A2A2A2;
+ border:solid 1px #CECECE;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#4D4D4D;
+}
+
+.navpath li.navelem a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath li.navelem a:hover
+{
+ color:#888888;
+}
+
+.navpath li.footer
+{
+ list-style-type:none;
+ float:right;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:none;
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#4D4D4D;
+ font-size: 8pt;
+}
+
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+div.ingroups
+{
+ font-size: 8pt;
+ width: 50%;
+ text-align: left;
+}
+
+div.ingroups a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #FAFAFA;
+ margin: 0px;
+ border-bottom: 1px solid #D0D0D0;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 7px;
+}
+
+dl
+{
+ padding: 0 0 0 10px;
+}
+
+/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */
+dl.section
+{
+ margin-left: 0px;
+ padding-left: 0px;
+}
+
+dl.note
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #D0C000;
+}
+
+dl.warning, dl.attention
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #00D000;
+}
+
+dl.deprecated
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #505050;
+}
+
+dl.todo
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border:4px solid;
+ border-color: #00C0E0;
+}
+
+dl.test
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #3030E0;
+}
+
+dl.bug
+{
+ margin-left:-7px;
+ padding-left: 3px;
+ border-left:4px solid;
+ border-color: #C08050;
+}
+
+dl.section dd {
+ margin-bottom: 6px;
+}
+
+
+#projectlogo
+{
+ text-align: center;
+ vertical-align: bottom;
+ border-collapse: separate;
+}
+
+#projectlogo img
+{
+ border: 0px none;
+}
+
+#projectname
+{
+ font: 300% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 2px 0px;
+}
+
+#projectbrief
+{
+ font: 120% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectnumber
+{
+ font: 50% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#titlearea
+{
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ border-bottom: 1px solid #787878;
+}
+
+.image
+{
+ text-align: center;
+}
+
+.dotgraph
+{
+ text-align: center;
+}
+
+.mscgraph
+{
+ text-align: center;
+}
+
+.caption
+{
+ font-weight: bold;
+}
+
+div.zoom
+{
+ border: 1px solid #A6A6A6;
+}
+
+dl.citelist {
+ margin-bottom:50px;
+}
+
+dl.citelist dt {
+ color:#484848;
+ float:left;
+ font-weight:bold;
+ margin-right:10px;
+ padding:5px;
+}
+
+dl.citelist dd {
+ margin:2px 0;
+ padding:5px 0;
+}
+
+div.toc {
+ padding: 14px 25px;
+ background-color: #F6F6F6;
+ border: 1px solid #DFDFDF;
+ border-radius: 7px 7px 7px 7px;
+ float: right;
+ height: auto;
+ margin: 0 20px 10px 10px;
+ width: 200px;
+}
+
+div.toc li {
+ background: url("bdwn.png") no-repeat scroll 0 5px transparent;
+ font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif;
+ margin-top: 5px;
+ padding-left: 10px;
+ padding-top: 2px;
+}
+
+div.toc h3 {
+ font: bold 12px/1.2 Arial,FreeSans,sans-serif;
+ color: #686868;
+ border-bottom: 0 none;
+ margin: 0;
+}
+
+div.toc ul {
+ list-style: none outside none;
+ border: medium none;
+ padding: 0px;
+}
+
+div.toc li.level1 {
+ margin-left: 0px;
+}
+
+div.toc li.level2 {
+ margin-left: 15px;
+}
+
+div.toc li.level3 {
+ margin-left: 30px;
+}
+
+div.toc li.level4 {
+ margin-left: 45px;
+}
+
+.inherit_header {
+ font-weight: bold;
+ color: gray;
+ cursor: pointer;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.inherit_header td {
+ padding: 6px 0px 2px 5px;
+}
+
+.inherit {
+ display: none;
+}
+
+tr.heading h2 {
+ margin-top: 12px;
+ margin-bottom: 4px;
+}
+
+@media print
+{
+ #top { display: none; }
+ #side-nav { display: none; }
+ #nav-path { display: none; }
+ body { overflow:visible; }
+ h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
+ .summary { display: none; }
+ .memitem { page-break-inside: avoid; }
+ #doc-content
+ {
+ margin-left:0 !important;
+ height:auto !important;
+ width:auto !important;
+ overflow:inherit;
+ display:inline;
+ }
+}
diff --git a/docs/named_data_theme/static/foundation.css b/docs/named_data_theme/static/foundation.css
new file mode 100644
index 0000000..ff1330e
--- /dev/null
+++ b/docs/named_data_theme/static/foundation.css
@@ -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%; }
diff --git a/docs/named_data_theme/static/named_data_doxygen.css b/docs/named_data_theme/static/named_data_doxygen.css
new file mode 100644
index 0000000..02bcbf6
--- /dev/null
+++ b/docs/named_data_theme/static/named_data_doxygen.css
@@ -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; }
diff --git a/docs/named_data_theme/static/named_data_style.css_t b/docs/named_data_theme/static/named_data_style.css_t
new file mode 100644
index 0000000..3edfb72
--- /dev/null
+++ b/docs/named_data_theme/static/named_data_style.css_t
@@ -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;
+}
\ No newline at end of file
diff --git a/docs/named_data_theme/static/nav_f.png b/docs/named_data_theme/static/nav_f.png
new file mode 100644
index 0000000..f09ac2f
--- /dev/null
+++ b/docs/named_data_theme/static/nav_f.png
Binary files differ
diff --git a/docs/named_data_theme/static/tab_b.png b/docs/named_data_theme/static/tab_b.png
new file mode 100644
index 0000000..801fb4e
--- /dev/null
+++ b/docs/named_data_theme/static/tab_b.png
Binary files differ
diff --git a/docs/named_data_theme/theme.conf b/docs/named_data_theme/theme.conf
new file mode 100644
index 0000000..aa5a7ff
--- /dev/null
+++ b/docs/named_data_theme/theme.conf
@@ -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
diff --git a/src/add-contact-panel.cpp b/src/add-contact-panel.cpp
index 639c113..9e0db74 100644
--- a/src/add-contact-panel.cpp
+++ b/src/add-contact-panel.cpp
@@ -8,12 +8,14 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "add-contact-panel.h"
+#include "add-contact-panel.hpp"
#include "ui_add-contact-panel.h"
#ifndef Q_MOC_RUN
#endif
+namespace chronos {
+
AddContactPanel::AddContactPanel(QWidget *parent)
: QDialog(parent)
, ui(new Ui::AddContactPanel)
@@ -57,7 +59,7 @@
AddContactPanel::onSearchClicked()
{
// ui->infoView->clear();
- for(int i = ui->infoView->rowCount() - 1; i >= 0 ; i--)
+ for (int i = ui->infoView->rowCount() - 1; i >= 0 ; i--)
ui->infoView->removeRow(i);
m_searchIdentity = ui->contactInput->text();
@@ -72,24 +74,28 @@
}
void
-AddContactPanel::onContactEndorseInfoReady(const chronos::EndorseInfo& endorseInfo)
+AddContactPanel::onContactEndorseInfoReady(const Chronos::EndorseInfo& endorseInfo)
{
int entrySize = endorseInfo.endorsement_size();
- for(int rowCount = 0; rowCount < entrySize; rowCount++)
- {
- ui->infoView->insertRow(rowCount);
- QTableWidgetItem* type = new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).type()));
- ui->infoView->setItem(rowCount, 0, type);
+ for (int rowCount = 0; rowCount < entrySize; rowCount++) {
+ ui->infoView->insertRow(rowCount);
+ QTableWidgetItem* type =
+ new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).type()));
+ ui->infoView->setItem(rowCount, 0, type);
- QTableWidgetItem* value = new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).value()));
- ui->infoView->setItem(rowCount, 1, value);
+ QTableWidgetItem* value =
+ new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).value()));
+ ui->infoView->setItem(rowCount, 1, value);
- QTableWidgetItem* endorse = new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).endorse()));
- ui->infoView->setItem(rowCount, 2, endorse);
- }
+ QTableWidgetItem* endorse =
+ new QTableWidgetItem(QString::fromStdString(endorseInfo.endorsement(rowCount).endorse()));
+ ui->infoView->setItem(rowCount, 2, endorse);
+ }
}
+} // namespace chronos
+
#if WAF
#include "add-contact-panel.moc"
diff --git a/src/add-contact-panel.h b/src/add-contact-panel.hpp
similarity index 75%
rename from src/add-contact-panel.h
rename to src/add-contact-panel.hpp
index 5b99558..545cd02 100644
--- a/src/add-contact-panel.h
+++ b/src/add-contact-panel.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef ADD_CONTACT_PANEL_H
-#define ADD_CONTACT_PANEL_H
+#ifndef CHRONOS_ADD_CONTACT_PANEL_HPP
+#define CHRONOS_ADD_CONTACT_PANEL_HPP
#include <QDialog>
#include <QTableWidgetItem>
@@ -22,19 +22,21 @@
class AddContactPanel;
}
+namespace chronos {
+
class AddContactPanel : public QDialog
{
Q_OBJECT
public:
explicit
- AddContactPanel(QWidget *parent = 0);
+ AddContactPanel(QWidget* parent = 0);
~AddContactPanel();
public slots:
void
- onContactEndorseInfoReady(const chronos::EndorseInfo& endorseInfo);
+ onContactEndorseInfoReady(const Chronos::EndorseInfo& endorseInfo);
private slots:
void
@@ -54,7 +56,7 @@
addContact(const QString& identity);
private:
- Ui::AddContactPanel *ui;
+ Ui::AddContactPanel* ui;
QString m_searchIdentity;
QTableWidgetItem* m_typeHeader;
@@ -62,4 +64,6 @@
QTableWidgetItem* m_endorseHeader;
};
-#endif // ADD_CONTACT_PANEL_H
+} // namespace chronos
+
+#endif // CHRONOS_ADD_CONTACT_PANEL_HPP
diff --git a/src/browse-contact-dialog.cpp b/src/browse-contact-dialog.cpp
index c12d040..f437eeb 100644
--- a/src/browse-contact-dialog.cpp
+++ b/src/browse-contact-dialog.cpp
@@ -9,15 +9,17 @@
*/
-#include "browse-contact-dialog.h"
+#include "browse-contact-dialog.hpp"
#include "ui_browse-contact-dialog.h"
#ifndef Q_MOC_RUN
-#include "profile.h"
+#include "profile.hpp"
#endif
-using namespace ndn;
-using namespace chronos;
+
+namespace chronos {
+
+using ndn::IdentityCertificate;
BrowseContactDialog::BrowseContactDialog(QWidget *parent)
: QDialog(parent)
@@ -33,8 +35,10 @@
ui->ContactList->setModel(m_contactListModel);
- connect(ui->ContactList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
- this, SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &)));
+ connect(ui->ContactList->selectionModel(),
+ SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+ this,
+ SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &)));
connect(ui->AddButton, SIGNAL(clicked()),
this, SLOT(onAddClicked()));
connect(ui->DirectAddButton, SIGNAL(clicked()),
@@ -62,8 +66,8 @@
{
QItemSelectionModel* selectionModel = ui->ContactList->selectionModel();
QModelIndexList selectedList = selectionModel->selectedIndexes();
- QModelIndexList::iterator it = selectedList.begin();
- for(; it != selectedList.end(); it++)
+
+ for (QModelIndexList::iterator it = selectedList.begin(); it != selectedList.end(); it++)
emit addContact(m_contactNameList[it->row()]);
this->close();
@@ -80,7 +84,7 @@
BrowseContactDialog::closeEvent(QCloseEvent *e)
{
ui->InfoTable->clear();
- for(int i = ui->InfoTable->rowCount() - 1; i >= 0 ; i--)
+ for (int i = ui->InfoTable->rowCount() - 1; i >= 0 ; i--)
ui->InfoTable->removeRow(i);
ui->InfoTable->horizontalHeader()->hide();
@@ -108,27 +112,27 @@
ui->InfoTable->clear();
- for(int i = ui->InfoTable->rowCount() - 1; i >= 0 ; i--)
+ for (int i = ui->InfoTable->rowCount() - 1; i >= 0 ; i--)
ui->InfoTable->removeRow(i);
ui->InfoTable->horizontalHeader()->show();
ui->InfoTable->setColumnCount(2);
- Profile::const_iterator proIt = profile.begin();
- Profile::const_iterator proEnd = profile.end();
+
int rowCount = 0;
+ for (Profile::const_iterator proIt = profile.begin();
+ proIt != profile.end(); proIt++, rowCount++) {
+ ui->InfoTable->insertRow(rowCount);
+ QTableWidgetItem* type = new QTableWidgetItem(QString::fromStdString(proIt->first));
+ ui->InfoTable->setItem(rowCount, 0, type);
- for(; proIt != proEnd; proIt++, rowCount++)
- {
- ui->InfoTable->insertRow(rowCount);
- QTableWidgetItem* type = new QTableWidgetItem(QString::fromStdString(proIt->first));
- ui->InfoTable->setItem(rowCount, 0, type);
-
- QTableWidgetItem* value = new QTableWidgetItem(QString::fromStdString(proIt->second));
- ui->InfoTable->setItem(rowCount, 1, value);
- }
+ QTableWidgetItem* value = new QTableWidgetItem(QString::fromStdString(proIt->second));
+ ui->InfoTable->setItem(rowCount, 1, value);
+ }
}
+} // namespace chronos
+
#if WAF
#include "browse-contact-dialog.moc"
#include "browse-contact-dialog.cpp.moc"
diff --git a/src/browse-contact-dialog.h b/src/browse-contact-dialog.hpp
similarity index 80%
rename from src/browse-contact-dialog.h
rename to src/browse-contact-dialog.hpp
index 54cdcb2..c1250a8 100644
--- a/src/browse-contact-dialog.h
+++ b/src/browse-contact-dialog.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef BROWSE_CONTACT_DIALOG_H
-#define BROWSE_CONTACT_DIALOG_H
+#ifndef CHRONOS_BROWSE_CONTACT_DIALOG_HPP
+#define CHRONOS_BROWSE_CONTACT_DIALOG_HPP
#include <QDialog>
#include <QStringListModel>
@@ -26,6 +26,8 @@
class BrowseContactDialog;
}
+namespace chronos {
+
class BrowseContactDialog : public QDialog
{
Q_OBJECT
@@ -38,12 +40,12 @@
protected:
void
- closeEvent(QCloseEvent *e);
+ closeEvent(QCloseEvent* e);
private slots:
void
- onSelectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected);
+ onSelectionChanged(const QItemSelection& selected,
+ const QItemSelection& deselected);
void
onAddClicked();
@@ -76,7 +78,7 @@
typedef boost::recursive_mutex RecLock;
typedef boost::unique_lock<RecLock> UniqueRecLock;
- Ui::BrowseContactDialog *ui;
+ Ui::BrowseContactDialog* ui;
QTableWidgetItem* m_typeHeader;
QTableWidgetItem* m_valueHeader;
@@ -87,4 +89,6 @@
QStringList m_contactCertNameList;
};
-#endif // BROWSE_CONTACT_DIALOG_H
+} // namespace chronos
+
+#endif // CHRONOS_BROWSE_CONTACT_DIALOG_HPP
diff --git a/src/chat-dialog.cpp b/src/chat-dialog.cpp
index aabbcc2..407349a 100644
--- a/src/chat-dialog.cpp
+++ b/src/chat-dialog.cpp
@@ -10,7 +10,7 @@
* Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "chat-dialog.h"
+#include "chat-dialog.hpp"
#include "ui_chat-dialog.h"
#include <QScrollBar>
@@ -22,26 +22,39 @@
#include <boost/random/random_device.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <ndn-cxx/util/random.hpp>
-#include <cryptopp/hex.h>
-#include <cryptopp/files.h>
+#include <ndn-cxx/encoding/buffer-stream.hpp>
+#include "cryptopp.hpp"
#include <queue>
#include "logging.h"
#endif
-using namespace ndn;
-using ndn::shared_ptr;
-using namespace chronos;
-INIT_LOGGER("ChatDialog");
-
-static const int HELLO_INTERVAL = FRESHNESS * 3 / 4;
-static const uint8_t CHRONOS_RP_SEPARATOR[2] = {0xF0, 0x2E}; // %F0.
+// INIT_LOGGER("ChatDialog");
Q_DECLARE_METATYPE(std::vector<Sync::MissingDataInfo> )
Q_DECLARE_METATYPE(ndn::shared_ptr<const ndn::Data>)
Q_DECLARE_METATYPE(ndn::Interest)
Q_DECLARE_METATYPE(size_t)
+
+namespace chronos {
+
+using std::vector;
+using std::string;
+using std::map;
+using std::queue;
+
+using ndn::IdentityCertificate;
+using ndn::SecRuleRelative;
+using ndn::Face;
+using ndn::OBufferStream;
+using ndn::OnDataValidated;
+using ndn::OnDataValidationFailed;
+
+
+static const int HELLO_INTERVAL = FRESHNESS * 3 / 4;
+static const uint8_t CHRONOS_RP_SEPARATOR[2] = {0xF0, 0x2E}; // %F0.
+
ChatDialog::ChatDialog(ContactManager* contactManager,
shared_ptr<Face> face,
const IdentityCertificate& myCertificate,
@@ -55,7 +68,7 @@
, m_contactManager(contactManager)
, m_face(face)
, m_myCertificate(myCertificate)
- , m_chatroomName(chatroomPrefix.get(-1).toEscapedString())
+ , m_chatroomName(chatroomPrefix.get(-1).toUri())
, m_chatroomPrefix(chatroomPrefix)
, m_localPrefix(localPrefix)
, m_useRoutablePrefix(false)
@@ -85,7 +98,8 @@
ui->trustTreeViewer->hide();
ui->listView->setModel(m_rosterModel);
- m_identity = IdentityCertificate::certificateNameToPublicKeyName(m_myCertificate.getName()).getPrefix(-1);
+ m_identity =
+ IdentityCertificate::certificateNameToPublicKeyName(m_myCertificate.getName()).getPrefix(-1);
updatePrefix();
updateLabels();
@@ -109,8 +123,12 @@
this, SLOT(onProcessData(const ndn::shared_ptr<const ndn::Data>&, bool, bool)));
connect(this, SIGNAL(processTreeUpdate(const std::vector<Sync::MissingDataInfo>)),
this, SLOT(onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>)));
- connect(this, SIGNAL(reply(const ndn::Interest&, const ndn::shared_ptr<const ndn::Data>&, size_t, bool)),
- this, SLOT(onReply(const ndn::Interest&, const ndn::shared_ptr<const ndn::Data>&, size_t, bool)));
+ connect(this, SIGNAL(reply(const ndn::Interest&,
+ const ndn::shared_ptr<const ndn::Data>&,
+ size_t, bool)),
+ this, SLOT(onReply(const ndn::Interest&,
+ const ndn::shared_ptr<const ndn::Data>&,
+ size_t, bool)));
connect(this, SIGNAL(replyTimeout(const ndn::Interest&, size_t)),
this, SLOT(onReplyTimeout(const ndn::Interest&, size_t)));
connect(this, SIGNAL(introCert(const ndn::Interest&, const ndn::shared_ptr<const ndn::Data>&)),
@@ -118,28 +136,26 @@
connect(this, SIGNAL(introCertTimeout(const ndn::Interest&, int, const QString&)),
this, SLOT(onIntroCertTimeout(const ndn::Interest&, int, const QString&)));
- if(withSecurity)
- {
+ if (withSecurity) {
+ m_invitationValidator = make_shared<chronos::ValidatorInvitation>();
+ m_dataRule = make_shared<SecRuleRelative>("([^<CHRONOCHAT-DATA>]*)<CHRONOCHAT-DATA><>",
+ "^([^<KEY>]*)<KEY>(<>*)<><ID-CERT>$",
+ "==", "\\1", "\\1", true);
- m_invitationValidator = make_shared<chronos::ValidatorInvitation>();
- m_dataRule = make_shared<SecRuleRelative>("([^<CHRONOCHAT-DATA>]*)<CHRONOCHAT-DATA><>",
- "^([^<KEY>]*)<KEY>(<>*)<><ID-CERT>$",
- "==", "\\1", "\\1", true);
+ ui->inviteButton->setEnabled(true);
+ ui->trustTreeButton->setEnabled(true);
- ui->inviteButton->setEnabled(true);
- ui->trustTreeButton->setEnabled(true);
-
- connect(ui->inviteButton, SIGNAL(clicked()),
- this, SLOT(onInviteListDialogRequested()));
- connect(m_inviteListDialog, SIGNAL(sendInvitation(const QString&)),
- this, SLOT(onSendInvitation(const QString&)));
- connect(this, SIGNAL(waitForContactList()),
- m_contactManager, SLOT(onWaitForContactList()));
- connect(m_contactManager, SIGNAL(contactAliasListReady(const QStringList&)),
- m_inviteListDialog, SLOT(onContactAliasListReady(const QStringList&)));
- connect(m_contactManager, SIGNAL(contactIdListReady(const QStringList&)),
- m_inviteListDialog, SLOT(onContactIdListReady(const QStringList&)));
- }
+ connect(ui->inviteButton, SIGNAL(clicked()),
+ this, SLOT(onInviteListDialogRequested()));
+ connect(m_inviteListDialog, SIGNAL(sendInvitation(const QString&)),
+ this, SLOT(onSendInvitation(const QString&)));
+ connect(this, SIGNAL(waitForContactList()),
+ m_contactManager, SLOT(onWaitForContactList()));
+ connect(m_contactManager, SIGNAL(contactAliasListReady(const QStringList&)),
+ m_inviteListDialog, SLOT(onContactAliasListReady(const QStringList&)));
+ connect(m_contactManager, SIGNAL(contactIdListReady(const QStringList&)),
+ m_inviteListDialog, SLOT(onContactIdListReady(const QStringList&)));
+ }
initializeSync();
}
@@ -147,46 +163,48 @@
ChatDialog::~ChatDialog()
{
- if(m_certListPrefixId)
+ if (m_certListPrefixId)
m_face->unsetInterestFilter(m_certListPrefixId);
- if(m_certSinglePrefixId)
+ if (m_certSinglePrefixId)
m_face->unsetInterestFilter(m_certSinglePrefixId);
- if(m_sock != NULL)
- {
- sendLeave();
- delete m_sock;
- m_sock = NULL;
- }
+ if (m_sock != NULL) {
+ sendLeave();
+ delete m_sock;
+ m_sock = NULL;
+ }
}
// public methods:
void
ChatDialog::addSyncAnchor(const Invitation& invitation)
{
- _LOG_DEBUG("Add sync anchor from invation");
+ // _LOG_DEBUG("Add sync anchor from invation");
// Add inviter certificate as trust anchor.
m_sock->addParticipant(invitation.getInviterCertificate());
plotTrustTree();
// Ask inviter for IntroCertificate
- Name inviterNameSpace = IdentityCertificate::certificateNameToPublicKeyName(invitation.getInviterCertificate().getName()).getPrefix(-1);
+ Name inviterNameSpace =
+ IdentityCertificate::certificateNameToPublicKeyName(
+ invitation.getInviterCertificate().getName()).getPrefix(-1);
fetchIntroCert(inviterNameSpace, invitation.getInviterRoutingPrefix());
}
void
-ChatDialog::processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>& v, Sync::SyncSocket *sock)
+ChatDialog::processTreeUpdateWrapper(const vector<Sync::MissingDataInfo>& v,
+ Sync::SyncSocket *sock)
{
emit processTreeUpdate(v);
- _LOG_DEBUG("<<< Tree update signal emitted");
+ // _LOG_DEBUG("<<< Tree update signal emitted");
}
void
ChatDialog::processDataWrapper(const shared_ptr<const Data>& data)
{
emit processData(data, true, false);
- _LOG_DEBUG("<<< " << data->getName() << " fetched");
+ // _LOG_DEBUG("<<< " << data->getName() << " fetched");
}
void
@@ -196,9 +214,9 @@
}
void
-ChatDialog::processRemoveWrapper(std::string prefix)
+ChatDialog::processRemoveWrapper(const string& prefix)
{
- _LOG_DEBUG("Sync REMOVE signal received for prefix: " << prefix);
+ // _LOG_DEBUG("Sync REMOVE signal received for prefix: " << prefix);
}
// protected methods:
@@ -217,11 +235,9 @@
void
ChatDialog::changeEvent(QEvent *e)
{
- switch(e->type())
- {
+ switch(e->type()) {
case QEvent::ActivationChange:
- if (isActiveWindow())
- {
+ if (isActiveWindow()) {
emit resetIcon();
}
break;
@@ -250,29 +266,35 @@
m_certSinglePrefix.clear();
m_localChatPrefix.clear();
m_chatPrefix.clear();
- m_chatPrefix.append(m_identity).append("CHRONOCHAT-DATA").append(m_chatroomName).append(getRandomString());
- if(!m_localPrefix.isPrefixOf(m_identity))
- {
- m_useRoutablePrefix = true;
- m_certListPrefix.append(m_localPrefix).append(CHRONOS_RP_SEPARATOR, 2);
- m_certSinglePrefix.append(m_localPrefix).append(CHRONOS_RP_SEPARATOR, 2);
- m_localChatPrefix.append(m_localPrefix).append(CHRONOS_RP_SEPARATOR, 2);
- }
+ m_chatPrefix.append(m_identity)
+ .append("CHRONOCHAT-DATA")
+ .append(m_chatroomName)
+ .append(getRandomString());
+ if (!m_localPrefix.isPrefixOf(m_identity)) {
+ m_useRoutablePrefix = true;
+ m_certListPrefix.append(m_localPrefix).append(CHRONOS_RP_SEPARATOR, 2);
+ m_certSinglePrefix.append(m_localPrefix).append(CHRONOS_RP_SEPARATOR, 2);
+ m_localChatPrefix.append(m_localPrefix).append(CHRONOS_RP_SEPARATOR, 2);
+ }
m_certListPrefix.append(m_identity).append("CHRONOCHAT-CERT-LIST").append(m_chatroomName);
m_certSinglePrefix.append(m_identity).append("CHRONOCHAT-CERT-SINGLE").append(m_chatroomName);
m_localChatPrefix.append(m_chatPrefix);
- if(m_certListPrefixId)
+ if (m_certListPrefixId)
m_face->unsetInterestFilter(m_certListPrefixId);
- m_certListPrefixId = m_face->setInterestFilter (m_certListPrefix,
- bind(&ChatDialog::onCertListInterest, this, _1, _2),
- bind(&ChatDialog::onCertListRegisterFailed, this, _1, _2));
+ m_certListPrefixId = m_face->setInterestFilter(m_certListPrefix,
+ bind(&ChatDialog::onCertListInterest,
+ this, _1, _2),
+ bind(&ChatDialog::onCertListRegisterFailed,
+ this, _1, _2));
- if(m_certSinglePrefixId)
+ if (m_certSinglePrefixId)
m_face->unsetInterestFilter(m_certSinglePrefixId);
- m_certSinglePrefixId = m_face->setInterestFilter (m_certSinglePrefix,
- bind(&ChatDialog::onCertSingleInterest, this, _1, _2),
- bind(&ChatDialog::onCertSingleRegisterFailed, this, _1, _2));
+ m_certSinglePrefixId = m_face->setInterestFilter(m_certSinglePrefix,
+ bind(&ChatDialog::onCertSingleInterest,
+ this, _1, _2),
+ bind(&ChatDialog::onCertSingleRegisterFailed,
+ this, _1, _2));
}
void
@@ -283,19 +305,20 @@
ui->infoLabel->setText(settingDisp);
QString prefixDisp;
Name privatePrefix("/private/local");
- if(privatePrefix.isPrefixOf(m_localChatPrefix))
- {
- prefixDisp =
- QString("<Warning: no connection to hub or hub does not support prefix autoconfig.>\n <Prefix = %1>")
- .arg(QString::fromStdString(m_localChatPrefix.toUri()));
- ui->prefixLabel->setStyleSheet("QLabel {color: red; font-size: 12px; font: bold \"Verdana\";}");
- }
- else
- {
- prefixDisp = QString("<Prefix = %1>")
- .arg(QString::fromStdString(m_localChatPrefix.toUri()));
- ui->prefixLabel->setStyleSheet("QLabel {color: Green; font-size: 12px; font: bold \"Verdana\";}");
- }
+ if (privatePrefix.isPrefixOf(m_localChatPrefix)) {
+ prefixDisp =
+ QString("<Warning: no connection to hub or hub does not support prefix autoconfig.>\n"
+ "<Prefix = %1>")
+ .arg(QString::fromStdString(m_localChatPrefix.toUri()));
+ ui->prefixLabel->setStyleSheet(
+ "QLabel {color: red; font-size: 12px; font: bold \"Verdana\";}");
+ }
+ else {
+ prefixDisp = QString("<Prefix = %1>")
+ .arg(QString::fromStdString(m_localChatPrefix.toUri()));
+ ui->prefixLabel->setStyleSheet(
+ "QLabel {color: Green; font-size: 12px; font: bold \"Verdana\";}");
+ }
ui->prefixLabel->setText(prefixDisp);
}
@@ -337,28 +360,30 @@
Interest tmpInterest(invitation.getUnsignedInterestName());
m_keyChain.sign(tmpInterest, m_myCertificate.getName());
- // Get invitee's routable prefix (ideally it will do some DNS lookup, but we assume everyone use /ndn/broadcast
+ // Get invitee's routable prefix
+ // (ideally it will do some DNS lookup, but we assume everyone use /ndn/broadcast
Name routablePrefix = getInviteeRoutablePrefix(contact->getNameSpace());
// Check if we need to prepend the routable prefix to the interest name.
bool requireRoutablePrefix = false;
Name interestName;
size_t routablePrefixOffset = 0;
- if(!routablePrefix.isPrefixOf(tmpInterest.getName()))
- {
- interestName.append(routablePrefix).append(CHRONOS_RP_SEPARATOR, 2);
- requireRoutablePrefix = true;
- routablePrefixOffset = routablePrefix.size() + 1;
- }
+ if (!routablePrefix.isPrefixOf(tmpInterest.getName())) {
+ interestName.append(routablePrefix).append(CHRONOS_RP_SEPARATOR, 2);
+ requireRoutablePrefix = true;
+ routablePrefixOffset = routablePrefix.size() + 1;
+ }
interestName.append(tmpInterest.getName());
// Send the invitation out
Interest interest(interestName);
interest.setMustBeFresh(true);
- _LOG_DEBUG("sendInvitation: " << interest.getName());
+ // _LOG_DEBUG("sendInvitation: " << interest.getName());
m_face->expressInterest(interest,
- bind(&ChatDialog::replyWrapper, this, _1, _2, routablePrefixOffset, isIntroducer),
- bind(&ChatDialog::replyTimeoutWrapper, this, _1, routablePrefixOffset));
+ bind(&ChatDialog::replyWrapper,
+ this, _1, _2, routablePrefixOffset, isIntroducer),
+ bind(&ChatDialog::replyTimeoutWrapper,
+ this, _1, routablePrefixOffset));
}
void
@@ -367,16 +392,16 @@
size_t routablePrefixOffset,
bool isIntroducer)
{
- _LOG_DEBUG("ChatDialog::replyWrapper");
+ // _LOG_DEBUG("ChatDialog::replyWrapper");
emit reply(interest, data.shared_from_this(), routablePrefixOffset, isIntroducer);
- _LOG_DEBUG("OK?");
+ // _LOG_DEBUG("OK?");
}
void
ChatDialog::replyTimeoutWrapper(const Interest& interest,
size_t routablePrefixOffset)
{
- _LOG_DEBUG("ChatDialog::replyTimeoutWrapper");
+ // _LOG_DEBUG("ChatDialog::replyTimeoutWrapper");
emit replyTimeout(interest, routablePrefixOffset);
}
@@ -385,26 +410,25 @@
size_t inviteeRoutablePrefixOffset,
bool isIntroducer)
{
- if(data->getName().size() <= inviteeRoutablePrefixOffset)
- {
- Invitation invitation(data->getName());
- invitationRejected(invitation.getInviteeNameSpace());
- }
- else
- {
- Name inviteePrefix;
- inviteePrefix.wireDecode(data->getName().get(inviteeRoutablePrefixOffset).blockFromValue());
- IdentityCertificate inviteeCert;
- inviteeCert.wireDecode(data->getContent().blockFromValue());
- invitationAccepted(inviteeCert, inviteePrefix, isIntroducer);
- }
+ if (data->getName().size() <= inviteeRoutablePrefixOffset) {
+ Invitation invitation(data->getName());
+ invitationRejected(invitation.getInviteeNameSpace());
+ }
+ else {
+ Name inviteePrefix;
+ inviteePrefix.wireDecode(data->getName().get(inviteeRoutablePrefixOffset).blockFromValue());
+ IdentityCertificate inviteeCert;
+ inviteeCert.wireDecode(data->getContent().blockFromValue());
+ invitationAccepted(inviteeCert, inviteePrefix, isIntroducer);
+ }
}
void
ChatDialog::onReplyValidationFailed(const shared_ptr<const Data>& data,
- const std::string& failureInfo)
+ const string& failureInfo)
{
- _LOG_DEBUG("Invitation reply cannot be validated: " + failureInfo + " ==> " + data->getName().toUri());
+ // _LOG_DEBUG("Invitation reply cannot be validated: " + failureInfo + " ==> " +
+ // data->getName().toUri());
}
void
@@ -424,7 +448,8 @@
plotTrustTree();
// Ask invitee for IntroCertificate.
- Name inviteeNameSpace = IdentityCertificate::certificateNameToPublicKeyName(inviteeCert.getName()).getPrefix(-1);
+ Name inviteeNameSpace =
+ IdentityCertificate::certificateNameToPublicKeyName(inviteeCert.getName()).getPrefix(-1);
fetchIntroCert(inviteeNameSpace, inviteePrefix);
}
@@ -433,7 +458,7 @@
{
Name interestName;
- if(!prefix.isPrefixOf(identity))
+ if (!prefix.isPrefixOf(identity))
interestName.append(prefix).append(CHRONOS_RP_SEPARATOR, 2);
interestName.append(identity)
@@ -454,33 +479,34 @@
ChatDialog::onIntroCertList(const Interest& interest, const Data& data)
{
Chronos::IntroCertListMsg introCertList;
- if(!introCertList.ParseFromArray(data.getContent().value(), data.getContent().value_size()))
+ if (!introCertList.ParseFromArray(data.getContent().value(), data.getContent().value_size()))
return;
- for(int i = 0; i < introCertList.certname_size(); i++)
- {
- Name certName(introCertList.certname(i));
- Interest interest(certName);
- interest.setMustBeFresh(true);
+ for (int i = 0; i < introCertList.certname_size(); i++) {
+ Name certName(introCertList.certname(i));
+ Interest interest(certName);
+ interest.setMustBeFresh(true);
- _LOG_DEBUG("onIntroCertList: to fetch " << certName);
+ // _LOG_DEBUG("onIntroCertList: to fetch " << certName);
- m_face->expressInterest(interest,
- bind(&ChatDialog::introCertWrapper, this, _1, _2),
- bind(&ChatDialog::introCertTimeoutWrapper, this, _1, 0,
- QString("IntroCert: %1").arg(introCertList.certname(i).c_str())));
- }
+ m_face->expressInterest(interest,
+ bind(&ChatDialog::introCertWrapper, this, _1, _2),
+ bind(&ChatDialog::introCertTimeoutWrapper, this, _1, 0,
+ QString("IntroCert: %1").arg(introCertList.certname(i).c_str())));
+ }
}
void
-ChatDialog::onIntroCertListTimeout(const Interest& interest, int retry, const std::string& msg)
+ChatDialog::onIntroCertListTimeout(const Interest& interest, int retry, const string& msg)
{
- if(retry > 0)
+ if (retry > 0) {
m_face->expressInterest(interest,
bind(&ChatDialog::onIntroCertList, this, _1, _2),
bind(&ChatDialog::onIntroCertListTimeout, this, _1, retry - 1, msg));
- else
- _LOG_DEBUG(msg << " TIMEOUT!");
+ }
+ else {
+ // _LOG_DEBUG(msg << " TIMEOUT!");
+ }
}
void
@@ -496,21 +522,18 @@
}
void
-ChatDialog::onCertListInterest(const Name& prefix, const ndn::Interest& interest)
+ChatDialog::onCertListInterest(const Name& prefix, const Interest& interest)
{
- std::vector<Name> certNameList;
+ vector<Name> certNameList;
m_sock->getIntroCertNames(certNameList);
Chronos::IntroCertListMsg msg;
- std::vector<Name>::const_iterator it = certNameList.begin();
- std::vector<Name>::const_iterator end = certNameList.end();
- for(; it != end; it++)
- {
- Name certName;
- certName.append(m_certSinglePrefix).append(*it);
- msg.add_certname(certName.toUri());
- }
+ for (vector<Name>::const_iterator it = certNameList.begin(); it != certNameList.end(); it++) {
+ Name certName;
+ certName.append(m_certSinglePrefix).append(*it);
+ msg.add_certname(certName.toUri());
+ }
OBufferStream os;
msg.SerializeToOstream(&os);
@@ -522,33 +545,31 @@
}
void
-ChatDialog::onCertListRegisterFailed(const Name& prefix, const std::string& msg)
+ChatDialog::onCertListRegisterFailed(const Name& prefix, const string& msg)
{
- _LOG_DEBUG("ChatDialog::onCertListRegisterFailed failed: " + msg);
+ // _LOG_DEBUG("ChatDialog::onCertListRegisterFailed failed: " + msg);
}
void
-ChatDialog::onCertSingleInterest(const Name& prefix, const ndn::Interest& interest)
+ChatDialog::onCertSingleInterest(const Name& prefix, const Interest& interest)
{
- try
- {
- Name certName = interest.getName().getSubName(prefix.size());
- const Sync::IntroCertificate& introCert = m_sock->getIntroCertificate(certName);
- Data data(interest.getName());
- data.setContent(introCert.wireEncode());
- m_keyChain.sign(data, m_myCertificate.getName());
- m_face->put(data);
- }
- catch(Sync::SyncSocket::Error& e)
- {
- return;
- }
+ try {
+ Name certName = interest.getName().getSubName(prefix.size());
+ const Sync::IntroCertificate& introCert = m_sock->getIntroCertificate(certName);
+ Data data(interest.getName());
+ data.setContent(introCert.wireEncode());
+ m_keyChain.sign(data, m_myCertificate.getName());
+ m_face->put(data);
+ }
+ catch(Sync::SyncSocket::Error& e) {
+ return;
+ }
}
void
-ChatDialog::onCertSingleRegisterFailed(const Name& prefix, const std::string& msg)
+ChatDialog::onCertSingleRegisterFailed(const Name& prefix, const string& msg)
{
- _LOG_DEBUG("ChatDialog::onCertListRegisterFailed failed: " + msg);
+ // _LOG_DEBUG("ChatDialog::onCertListRegisterFailed failed: " + msg);
}
void
@@ -558,9 +579,9 @@
OBufferStream os;
msg.SerializeToOstream(&os);
- if (!msg.IsInitialized())
- {
- _LOG_DEBUG("Errrrr.. msg was not probally initialized "<<__FILE__ <<":"<<__LINE__<<". what is happening?");
+ if (!msg.IsInitialized()) {
+ // _LOG_DEBUG("Errrrr.. msg was not probally initialized " << __FILE__ <<
+ // ":" << __LINE__ << ". what is happening?");
abort();
}
uint64_t nextSequence = m_sock->getNextSeq();
@@ -568,8 +589,10 @@
m_lastMsgTime = time::toUnixTimestamp(time::system_clock::now()).count();
- Sync::MissingDataInfo mdi = {m_localChatPrefix.toUri(), Sync::SeqNo(0), Sync::SeqNo(nextSequence)};
- std::vector<Sync::MissingDataInfo> v;
+ Sync::MissingDataInfo mdi = {m_localChatPrefix.toUri(),
+ Sync::SeqNo(0),
+ Sync::SeqNo(nextSequence)};
+ vector<Sync::MissingDataInfo> v;
v.push_back(mdi);
{
boost::recursive_mutex::scoped_lock lock(m_sceneMutex);
@@ -591,21 +614,16 @@
{
boost::recursive_mutex::scoped_lock lock(m_msgMutex);
- if (msg.type() == SyncDemo::ChatMessage::CHAT)
- {
-
- if (!msg.has_data())
- {
+ if (msg.type() == SyncDemo::ChatMessage::CHAT) {
+ if (!msg.has_data()) {
return;
}
- if (msg.from().empty() || msg.data().empty())
- {
+ if (msg.from().empty() || msg.data().empty()) {
return;
}
- if (!msg.has_timestamp())
- {
+ if (!msg.has_timestamp()) {
return;
}
@@ -639,14 +657,12 @@
nextCursor.movePosition(QTextCursor::End);
table = nextCursor.insertTable(1, 1, tableFormat);
table->cellAt(0, 0).firstCursorPosition().insertText(QString::fromUtf8(msg.data().c_str()));
- if (!isHistory)
- {
+ if (!isHistory) {
showMessage(from, QString::fromUtf8(msg.data().c_str()));
}
}
- if (msg.type() == SyncDemo::ChatMessage::JOIN || msg.type() == SyncDemo::ChatMessage::LEAVE)
- {
+ if (msg.type() == SyncDemo::ChatMessage::JOIN || msg.type() == SyncDemo::ChatMessage::LEAVE) {
QTextCharFormat nickFormat;
nickFormat.setForeground(Qt::gray);
nickFormat.setFontWeight(QFont::Bold);
@@ -659,12 +675,10 @@
tableFormat.setBorder(0);
QTextTable *table = cursor.insertTable(1, 2, tableFormat);
QString action;
- if (msg.type() == SyncDemo::ChatMessage::JOIN)
- {
+ if (msg.type() == SyncDemo::ChatMessage::JOIN) {
action = "enters room";
}
- else
- {
+ else {
action = "leaves room";
}
@@ -684,11 +698,10 @@
void
ChatDialog::processRemove(QString prefix)
{
- _LOG_DEBUG("<<< remove node for prefix" << prefix.toStdString());
+ // _LOG_DEBUG("<<< remove node for prefix" << prefix.toStdString());
bool removed = m_scene->removeNode(prefix);
- if (removed)
- {
+ if (removed) {
boost::recursive_mutex::scoped_lock lock(m_sceneMutex);
m_scene->plot(m_sock->getRootDigest().c_str());
}
@@ -697,7 +710,7 @@
Name
ChatDialog::getInviteeRoutablePrefix(const Name& invitee)
{
- return ndn::Name("/ndn/broadcast");
+ return Name("/ndn/broadcast");
}
void
@@ -705,17 +718,20 @@
msg.set_from(m_nick);
msg.set_to(m_chatroomName);
msg.set_data(text.toStdString());
- int32_t seconds = static_cast<int32_t>(time::toUnixTimestamp(time::system_clock::now()).count()/1000000000);
+ int32_t seconds =
+ static_cast<int32_t>(time::toUnixTimestamp(time::system_clock::now()).count()/1000000000);
msg.set_timestamp(seconds);
msg.set_type(SyncDemo::ChatMessage::CHAT);
}
void
-ChatDialog::formControlMessage(SyncDemo::ChatMessage &msg, SyncDemo::ChatMessage::ChatMessageType type)
+ChatDialog::formControlMessage(SyncDemo::ChatMessage &msg,
+ SyncDemo::ChatMessage::ChatMessageType type)
{
msg.set_from(m_nick);
msg.set_to(m_chatroomName);
- int32_t seconds = static_cast<int32_t>(time::toUnixTimestamp(time::system_clock::now()).count()/1000000000);
+ int32_t seconds =
+ static_cast<int32_t>(time::toUnixTimestamp(time::system_clock::now()).count()/1000000000);
msg.set_timestamp(seconds);
msg.set_type(type);
}
@@ -726,22 +742,20 @@
struct tm *tm_time = localtime(×tamp);
int hour = tm_time->tm_hour;
QString amOrPM;
- if (hour > 12)
- {
+ if (hour > 12) {
hour -= 12;
amOrPM = "PM";
}
- else
- {
+ else {
amOrPM = "AM";
- if (hour == 0)
- {
+ if (hour == 0) {
hour = 12;
}
}
char textTime[12];
- sprintf(textTime, "%d:%02d:%02d %s", hour, tm_time->tm_min, tm_time->tm_sec, amOrPM.toStdString().c_str());
+ sprintf(textTime, "%d:%02d:%02d %s",
+ hour, tm_time->tm_min, tm_time->tm_sec, amOrPM.toStdString().c_str());
return QString(textTime);
}
@@ -757,10 +771,10 @@
timeCell.firstCursorPosition().insertText(formatTime(timestamp));
}
-std::string
+string
ChatDialog::getRandomString()
{
- uint32_t r = random::generateWord32();
+ uint32_t r = ndn::random::generateWord32();
std::stringstream ss;
{
using namespace CryptoPP;
@@ -797,32 +811,27 @@
ChatDialog::summonReaper()
{
Sync::SyncLogic &logic = m_sock->getLogic ();
- std::map<std::string, bool> branches = logic.getBranchPrefixes();
+ map<string, bool> branches = logic.getBranchPrefixes();
QMap<QString, DisplayUserPtr> roster = m_scene->getRosterFull();
m_zombieList.clear();
QMapIterator<QString, DisplayUserPtr> it(roster);
- std::map<std::string, bool>::iterator mapIt;
- while(it.hasNext())
- {
+ map<string, bool>::iterator mapIt;
+ while (it.hasNext()) {
it.next();
DisplayUserPtr p = it.value();
- if (p != DisplayUserNullPtr)
- {
+ if (p != DisplayUserNullPtr) {
mapIt = branches.find(p->getPrefix().toStdString());
- if (mapIt != branches.end())
- {
+ if (mapIt != branches.end()) {
mapIt->second = true;
}
}
}
- for (mapIt = branches.begin(); mapIt != branches.end(); ++mapIt)
- {
+ for (mapIt = branches.begin(); mapIt != branches.end(); ++mapIt) {
// this is zombie. all active users should have been marked true
- if (! mapIt->second)
- {
+ if (! mapIt->second) {
m_zombieList.append(mapIt->first.c_str());
}
}
@@ -836,77 +845,70 @@
void
ChatDialog::getTree(TrustTreeNodeList& nodeList)
{
- typedef std::map<Name, shared_ptr<TrustTreeNode> > NodeMap;
+ typedef map<Name, shared_ptr<TrustTreeNode> > NodeMap;
- std::vector<Name> certNameList;
+ vector<Name> certNameList;
NodeMap nodeMap;
m_sock->getIntroCertNames(certNameList);
- std::vector<Name>::const_iterator it = certNameList.begin();
- std::vector<Name>::const_iterator end = certNameList.end();
- for(; it != end; it++)
- {
- Name introducerCertName;
- Name introduceeCertName;
+ for (vector<Name>::const_iterator it = certNameList.begin(); it != certNameList.end(); it++) {
+ Name introducerCertName;
+ Name introduceeCertName;
- introducerCertName.wireDecode(it->get(-2).blockFromValue());
- introduceeCertName.wireDecode(it->get(-3).blockFromValue());
+ introducerCertName.wireDecode(it->get(-2).blockFromValue());
+ introduceeCertName.wireDecode(it->get(-3).blockFromValue());
- Name introducerName = IdentityCertificate::certificateNameToPublicKeyName(introducerCertName).getPrefix(-1);
- Name introduceeName = IdentityCertificate::certificateNameToPublicKeyName(introduceeCertName).getPrefix(-1);
+ Name introducerName =
+ IdentityCertificate::certificateNameToPublicKeyName(introducerCertName).getPrefix(-1);
+ Name introduceeName =
+ IdentityCertificate::certificateNameToPublicKeyName(introduceeCertName).getPrefix(-1);
- NodeMap::iterator introducerIt = nodeMap.find(introducerName);
- if(introducerIt == nodeMap.end())
- {
- shared_ptr<TrustTreeNode> introducerNode(new TrustTreeNode(introducerName));
- nodeMap[introducerName] = introducerNode;
- }
- shared_ptr<TrustTreeNode> erNode = nodeMap[introducerName];
-
- NodeMap::iterator introduceeIt = nodeMap.find(introduceeName);
- if(introduceeIt == nodeMap.end())
- {
- shared_ptr<TrustTreeNode> introduceeNode(new TrustTreeNode(introduceeName));
- nodeMap[introduceeName] = introduceeNode;
- }
- shared_ptr<TrustTreeNode> eeNode = nodeMap[introduceeName];
-
- erNode->addIntroducee(eeNode);
- eeNode->addIntroducer(erNode);
+ NodeMap::iterator introducerIt = nodeMap.find(introducerName);
+ if (introducerIt == nodeMap.end()) {
+ shared_ptr<TrustTreeNode> introducerNode(new TrustTreeNode(introducerName));
+ nodeMap[introducerName] = introducerNode;
}
+ shared_ptr<TrustTreeNode> erNode = nodeMap[introducerName];
+
+ NodeMap::iterator introduceeIt = nodeMap.find(introduceeName);
+ if (introduceeIt == nodeMap.end()) {
+ shared_ptr<TrustTreeNode> introduceeNode(new TrustTreeNode(introduceeName));
+ nodeMap[introduceeName] = introduceeNode;
+ }
+ shared_ptr<TrustTreeNode> eeNode = nodeMap[introduceeName];
+
+ erNode->addIntroducee(eeNode);
+ eeNode->addIntroducer(erNode);
+ }
nodeList.clear();
- std::queue<shared_ptr<TrustTreeNode> > nodeQueue;
+ queue<shared_ptr<TrustTreeNode> > nodeQueue;
NodeMap::iterator nodeIt = nodeMap.find(m_identity);
- if(nodeIt == nodeMap.end())
+ if (nodeIt == nodeMap.end())
return;
nodeQueue.push(nodeIt->second);
nodeIt->second->setLevel(0);
- while(!nodeQueue.empty())
- {
- shared_ptr<TrustTreeNode>& node = nodeQueue.front();
- node->setVisited();
+ while (!nodeQueue.empty()) {
+ shared_ptr<TrustTreeNode>& node = nodeQueue.front();
+ node->setVisited();
- TrustTreeNodeList& introducees = node->getIntroducees();
- TrustTreeNodeList::iterator eeIt = introducees.begin();
- TrustTreeNodeList::iterator eeEnd = introducees.end();
-
- for(; eeIt != eeEnd; eeIt++)
- {
- _LOG_DEBUG("introducee: " << (*eeIt)->name() << " visited: " << boolalpha << (*eeIt)->visited());
- if(!(*eeIt)->visited())
- {
- nodeQueue.push(*eeIt);
- (*eeIt)->setLevel(node->level()+1);
- }
- }
-
- nodeList.push_back(node);
- nodeQueue.pop();
+ TrustTreeNodeList& introducees = node->getIntroducees();
+ for (TrustTreeNodeList::iterator eeIt = introducees.begin();
+ eeIt != introducees.end(); eeIt++) {
+ // _LOG_DEBUG("introducee: " << (*eeIt)->name() <<
+ // " visited: " << std::boolalpha << (*eeIt)->visited());
+ if (!(*eeIt)->visited()) {
+ nodeQueue.push(*eeIt);
+ (*eeIt)->setLevel(node->level()+1);
+ }
}
+
+ nodeList.push_back(node);
+ nodeQueue.pop();
+ }
}
void
@@ -927,53 +929,50 @@
ChatDialog::onLocalPrefixUpdated(const QString& localPrefix)
{
Name newLocalPrefix(localPrefix.toStdString());
- if(!newLocalPrefix.empty() && newLocalPrefix != m_localPrefix)
- {
- // Update localPrefix
- m_localPrefix = newLocalPrefix;
+ if (!newLocalPrefix.empty() && newLocalPrefix != m_localPrefix) {
+ // Update localPrefix
+ m_localPrefix = newLocalPrefix;
- updatePrefix();
- updateLabels();
- m_scene->setCurrentPrefix(QString(m_localChatPrefix.toUri().c_str()));
+ updatePrefix();
+ updateLabels();
+ m_scene->setCurrentPrefix(QString(m_localChatPrefix.toUri().c_str()));
- if(m_sock != NULL)
- {
- {
- boost::recursive_mutex::scoped_lock lock(m_sceneMutex);
- m_scene->clearAll();
- m_scene->plot("Empty");
- }
+ if (m_sock != NULL) {
+ {
+ boost::recursive_mutex::scoped_lock lock(m_sceneMutex);
+ m_scene->clearAll();
+ m_scene->plot("Empty");
+ }
- ui->textEdit->clear();
+ ui->textEdit->clear();
- if (m_joined)
- {
- sendLeave();
- }
+ if (m_joined) {
+ sendLeave();
+ }
- delete m_sock;
- m_sock = NULL;
+ delete m_sock;
+ m_sock = NULL;
- usleep(100000);
- m_sock = new Sync::SyncSocket(m_chatroomPrefix,
- m_chatPrefix,
- m_session,
- m_useRoutablePrefix,
- m_localPrefix,
- m_face,
- m_myCertificate,
- m_dataRule,
- bind(&ChatDialog::processTreeUpdateWrapper, this, _1, _2),
- bind(&ChatDialog::processRemoveWrapper, this, _1));
- usleep(100000);
- QTimer::singleShot(600, this, SLOT(sendJoin()));
- m_timer->start(FRESHNESS * 1000);
- disableSyncTreeDisplay();
- QTimer::singleShot(2200, this, SLOT(enableSyncTreeDisplay()));
- }
- else
- initializeSync();
+ usleep(100000);
+ m_sock = new Sync::SyncSocket(m_chatroomPrefix,
+ m_chatPrefix,
+ m_session,
+ m_useRoutablePrefix,
+ m_localPrefix,
+ m_face,
+ m_myCertificate,
+ m_dataRule,
+ bind(&ChatDialog::processTreeUpdateWrapper, this, _1, _2),
+ bind(&ChatDialog::processRemoveWrapper, this, _1));
+ usleep(100000);
+ QTimer::singleShot(600, this, SLOT(sendJoin()));
+ m_timer->start(FRESHNESS * 1000);
+ disableSyncTreeDisplay();
+ QTimer::singleShot(2200, this, SLOT(enableSyncTreeDisplay()));
}
+ else
+ initializeSync();
+ }
else
if (m_sock == NULL)
initializeSync();
@@ -999,16 +998,14 @@
ui->lineEdit->clear();
- if (text.startsWith("boruoboluomi"))
- {
+ if (text.startsWith("boruoboluomi")) {
summonReaper ();
// reapButton->show();
fitView();
return;
}
- if (text.startsWith("minimanihong"))
- {
+ if (text.startsWith("minimanihong")) {
// reapButton->hide();
fitView();
return;
@@ -1027,13 +1024,11 @@
void
ChatDialog::onSyncTreeButtonPressed()
{
- if (ui->syncTreeViewer->isVisible())
- {
+ if (ui->syncTreeViewer->isVisible()) {
ui->syncTreeViewer->hide();
ui->syncTreeButton->setText("Show ChronoSync Tree");
}
- else
- {
+ else {
ui->syncTreeViewer->show();
ui->syncTreeButton->setText("Hide ChronoSync Tree");
}
@@ -1044,13 +1039,11 @@
void
ChatDialog::onTrustTreeButtonPressed()
{
- if (ui->trustTreeViewer->isVisible())
- {
+ if (ui->trustTreeViewer->isVisible()) {
ui->trustTreeViewer->hide();
ui->trustTreeButton->setText("Show Trust Tree");
}
- else
- {
+ else {
ui->trustTreeViewer->show();
ui->trustTreeButton->setText("Hide Trust Tree");
}
@@ -1063,9 +1056,9 @@
{
SyncDemo::ChatMessage msg;
bool corrupted = false;
- if (!msg.ParseFromArray(data->getContent().value(), data->getContent().value_size()))
- {
- _LOG_DEBUG("Errrrr.. Can not parse msg with name: " << data->getName() << ". what is happening?");
+ if (!msg.ParseFromArray(data->getContent().value(), data->getContent().value_size())) {
+ // _LOG_DEBUG("Errrrr.. Can not parse msg with name: " <<
+ // data->getName() << ". what is happening?");
// nasty stuff: as a remedy, we'll form some standard msg for inparsable msgs
msg.set_from("inconnu");
msg.set_type(SyncDemo::ChatMessage::OTHER);
@@ -1077,22 +1070,18 @@
// so if we call appendMsg directly
// Qt crash as "QObject: Cannot create children for a parent that is in a different thread"
// the "cannonical" way to is use signal-slot
- if (show && !corrupted)
- {
+ if (show && !corrupted) {
appendMessage(msg, isHistory);
}
- if (!isHistory)
- {
+ if (!isHistory) {
// update the tree view
- std::string prefix = data->getName().getPrefix(-2).toUri();
- _LOG_DEBUG("<<< updating scene for" << prefix << ": " << msg.from());
- if (msg.type() == SyncDemo::ChatMessage::LEAVE)
- {
+ string prefix = data->getName().getPrefix(-2).toUri();
+ // _LOG_DEBUG("<<< updating scene for" << prefix << ": " << msg.from());
+ if (msg.type() == SyncDemo::ChatMessage::LEAVE) {
processRemove(prefix.c_str());
}
- else
- {
+ else {
boost::recursive_mutex::scoped_lock lock(m_sceneMutex);
m_scene->msgReceived(prefix.c_str(), msg.from().c_str());
}
@@ -1101,12 +1090,11 @@
}
void
-ChatDialog::onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>& v)
+ChatDialog::onProcessTreeUpdate(const vector<Sync::MissingDataInfo>& v)
{
- _LOG_DEBUG("<<< processing Tree Update");
+ // _LOG_DEBUG("<<< processing Tree Update");
- if (v.empty())
- {
+ if (v.empty()) {
return;
}
@@ -1118,24 +1106,20 @@
int n = v.size();
int totalMissingPackets = 0;
- for (int i = 0; i < n; i++)
- {
+ for (int i = 0; i < n; i++) {
totalMissingPackets += v[i].high.getSeq() - v[i].low.getSeq() + 1;
}
- for (int i = 0; i < n; i++)
- {
- if (totalMissingPackets < 4)
- {
- for (Sync::SeqNo seq = v[i].low; seq <= v[i].high; ++seq)
- {
+ for (int i = 0; i < n; i++) {
+ if (totalMissingPackets < 4) {
+ for (Sync::SeqNo seq = v[i].low; seq <= v[i].high; ++seq) {
m_sock->fetchData(v[i].prefix, seq, bind(&ChatDialog::processDataWrapper, this, _1), 2);
- _LOG_DEBUG("<<< Fetching " << v[i].prefix << "/" <<seq.getSession() <<"/" << seq.getSeq());
+ // _LOG_DEBUG("<<< Fetching " << v[i].prefix << "/" <<seq.getSession() <<"/" << seq.getSeq());
}
}
- else
- {
- m_sock->fetchData(v[i].prefix, v[i].high, bind(&ChatDialog::processDataNoShowWrapper, this, _1), 2);
+ else {
+ m_sock->fetchData(v[i].prefix, v[i].high,
+ bind(&ChatDialog::processDataNoShowWrapper, this, _1), 2);
}
}
// adjust the view
@@ -1158,9 +1142,8 @@
m_rosterModel->setStringList(rosterList);
QString user;
QStringListIterator it(staleUserList);
- while(it.hasNext())
- {
- std::string nick = it.next().toStdString();
+ while (it.hasNext()) {
+ string nick = it.next().toStdString();
if (nick.empty())
continue;
@@ -1198,8 +1181,7 @@
{
int64_t now = time::toUnixTimestamp(time::system_clock::now()).count();
int elapsed = (now - m_lastMsgTime) / 1000000000;
- if (elapsed >= m_randomizedInterval / 1000)
- {
+ if (elapsed >= m_randomizedInterval / 1000) {
SyncDemo::ChatMessage msg;
formControlMessage(msg, SyncDemo::ChatMessage::HELLO);
sendMsg(msg);
@@ -1208,8 +1190,7 @@
m_randomizedInterval = HELLO_INTERVAL * 1000 + uniform(rng);
QTimer::singleShot(m_randomizedInterval, this, SLOT(sendHello()));
}
- else
- {
+ else {
QTimer::singleShot((m_randomizedInterval - elapsed * 1000), this, SLOT(sendHello()));
}
}
@@ -1224,7 +1205,7 @@
m_sock->leave();
usleep(5000);
m_joined = false;
- _LOG_DEBUG("Sync REMOVE signal sent");
+ // _LOG_DEBUG("Sync REMOVE signal sent");
}
void ChatDialog::enableSyncTreeDisplay()
@@ -1237,11 +1218,10 @@
void
ChatDialog::reap()
{
- if (m_zombieIndex < m_zombieList.size())
- {
- std::string prefix = m_zombieList.at(m_zombieIndex).toStdString();
+ if (m_zombieIndex < m_zombieList.size()) {
+ string prefix = m_zombieList.at(m_zombieIndex).toStdString();
m_sock->remove(prefix);
- _LOG_DEBUG("Reaped: prefix = " << prefix);
+ // _LOG_DEBUG("Reaped: prefix = " << prefix);
m_zombieIndex++;
// reap again in 10 seconds
QTimer::singleShot(10000, this, SLOT(reap()));
@@ -1264,19 +1244,19 @@
{
OnDataValidated onValidated = bind(&ChatDialog::onReplyValidated,
this, _1,
- interest.getName().size()-routablePrefixOffset, //RoutablePrefix will be removed before data is passed to the validator
+ //RoutablePrefix will be removed before passing to validator
+ interest.getName().size()-routablePrefixOffset,
isIntroducer);
OnDataValidationFailed onFailed = bind(&ChatDialog::onReplyValidationFailed,
this, _1, _2);
- if(routablePrefixOffset > 0)
- {
- // It is an encapsulated packet, we only validate the inner packet.
- shared_ptr<Data> innerData = make_shared<Data>();
- innerData->wireDecode(data->getContent().blockFromValue());
- m_invitationValidator->validate(*innerData, onValidated, onFailed);
- }
+ if (routablePrefixOffset > 0) {
+ // It is an encapsulated packet, we only validate the inner packet.
+ shared_ptr<Data> innerData = make_shared<Data>();
+ innerData->wireDecode(data->getContent().blockFromValue());
+ m_invitationValidator->validate(*innerData, onValidated, onFailed);
+ }
else
m_invitationValidator->validate(*data, onValidated, onFailed);
}
@@ -1286,14 +1266,15 @@
size_t routablePrefixOffset)
{
Name interestName;
- if(routablePrefixOffset > 0)
+ if (routablePrefixOffset > 0)
interestName = interest.getName().getSubName(routablePrefixOffset);
else
interestName = interest.getName();
Invitation invitation(interestName);
- QString msg = QString::fromUtf8("Your invitation to ") + QString::fromStdString(invitation.getInviteeNameSpace().toUri()) + " times out!";
+ QString msg = QString::fromUtf8("Your invitation to ") +
+ QString::fromStdString(invitation.getInviteeNameSpace().toUri()) + " times out!";
emit inivationRejection(msg);
}
@@ -1310,9 +1291,10 @@
void
ChatDialog::onIntroCertTimeout(const Interest& interest, int retry, const QString& msg)
{
- _LOG_DEBUG("onIntroCertTimeout: " << msg.toStdString());
+ // _LOG_DEBUG("onIntroCertTimeout: " << msg.toStdString());
}
+} // namespace chronos
#if WAF
#include "chat-dialog.moc"
diff --git a/src/chat-dialog.h b/src/chat-dialog.h
deleted file mode 100644
index 7902e09..0000000
--- a/src/chat-dialog.h
+++ /dev/null
@@ -1,359 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- * Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef CHAT_DIALOG_H
-#define CHAT_DIALOG_H
-
-#include <QDialog>
-#include <QTextTable>
-#include <QStringListModel>
-#include <QSystemTrayIcon>
-#include <QMenu>
-#include <QTimer>
-
-#include "invite-list-dialog.h"
-
-#ifndef Q_MOC_RUN
-#include "contact-manager.h"
-#include "invitation.h"
-#include "contact.h"
-#include "chatbuf.pb.h"
-#include "intro-cert-list.pb.h"
-#include "digest-tree-scene.h"
-#include "trust-tree-scene.h"
-#include "trust-tree-node.h"
-#include <sync-socket.h>
-#include <sync-seq-no.h>
-#include <ndn-cxx/security/key-chain.hpp>
-#include "validator-invitation.h"
-#include <boost/thread/locks.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-#include <boost/thread/thread.hpp>
-#endif
-
-#define MAX_HISTORY_ENTRY 20
-
-namespace Ui {
-class ChatDialog;
-}
-
-class ChatDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit
- ChatDialog(chronos::ContactManager* contactManager,
- ndn::shared_ptr<ndn::Face> face,
- const ndn::IdentityCertificate& myCertificate,
- const ndn::Name& chatroomPrefix,
- const ndn::Name& localPrefix,
- const std::string& nick,
- bool witSecurity,
- QWidget* parent = 0);
-
- ~ChatDialog();
-
- void
- addSyncAnchor(const chronos::Invitation& invitation);
-
- void
- processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>&, Sync::SyncSocket *);
-
- void
- processDataWrapper(const ndn::shared_ptr<const ndn::Data>& data);
-
- void
- processDataNoShowWrapper(const ndn::shared_ptr<const ndn::Data>& data);
-
- void
- processRemoveWrapper(std::string);
-
-protected:
- void
- closeEvent(QCloseEvent *e);
-
- void
- changeEvent(QEvent *e);
-
- void
- resizeEvent(QResizeEvent *);
-
- void
- showEvent(QShowEvent *);
-
-private:
- void
- updatePrefix();
-
- void
- updateLabels();
-
- void
- initializeSync();
-
- void
- sendInvitation(ndn::shared_ptr<chronos::Contact> contact, bool isIntroducer);
-
- void
- replyWrapper(const ndn::Interest& interest,
- ndn::Data& data,
- size_t routablePrefixOffset,
- bool isIntroducer);
-
- void
- replyTimeoutWrapper(const ndn::Interest& interest,
- size_t routablePrefixOffset);
-
- void
- onReplyValidated(const ndn::shared_ptr<const ndn::Data>& data,
- size_t inviteeRoutablePrefixOffset,
- bool isIntroduce);
-
- void
- onReplyValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
- const std::string& failureInfo);
-
- void
- invitationRejected(const ndn::Name& identity);
-
- void
- invitationAccepted(const ndn::IdentityCertificate& inviteeCert,
- const ndn::Name& inviteePrefix,
- bool isIntroducer);
-
- void
- fetchIntroCert(const ndn::Name& identity, const ndn::Name& prefix);
-
- void
- onIntroCertList(const ndn::Interest& interest, const ndn::Data& data);
-
- void
- onIntroCertListTimeout(const ndn::Interest& interest, int retry, const std::string& msg);
-
- void
- introCertWrapper(const ndn::Interest& interest, ndn::Data& data);
-
- void
- introCertTimeoutWrapper(const ndn::Interest& interest, int retry, const QString& msg);
-
- void
- onCertListInterest(const ndn::Name& prefix, const ndn::Interest& interest);
-
- void
- onCertListRegisterFailed(const ndn::Name& prefix, const std::string& msg);
-
- void
- onCertSingleInterest(const ndn::Name& prefix, const ndn::Interest& interest);
-
- void
- onCertSingleRegisterFailed(const ndn::Name& prefix, const std::string& msg);
-
-
- void
- sendMsg(SyncDemo::ChatMessage &msg);
-
- void
- disableSyncTreeDisplay();
-
- void
- appendMessage(const SyncDemo::ChatMessage msg, bool isHistory = false);
-
- void
- processRemove(QString prefix);
-
- ndn::Name
- getInviteeRoutablePrefix(const ndn::Name& invitee);
-
- void
- formChatMessage(const QString &text, SyncDemo::ChatMessage &msg);
-
- void
- formControlMessage(SyncDemo::ChatMessage &msg, SyncDemo::ChatMessage::ChatMessageType type);
-
- QString
- formatTime(time_t);
-
- void
- printTimeInCell(QTextTable *, time_t);
-
- std::string
- getRandomString();
-
- void
- showMessage(const QString&, const QString&);
-
- void
- fitView();
-
- void
- summonReaper();
-
- void
- getTree(TrustTreeNodeList& nodeList);
-
- void
- plotTrustTree();
-
-signals:
- void
- processData(const ndn::shared_ptr<const ndn::Data>& data, bool show, bool isHistory);
-
- void
- processTreeUpdate(const std::vector<Sync::MissingDataInfo>);
-
- void
- closeChatDialog(const QString& chatroomName);
-
- void
- inivationRejection(const QString& msg);
-
- void
- showChatMessage(const QString& chatroomName, const QString& from, const QString& data);
-
- void
- resetIcon();
-
- void
- reply(const ndn::Interest& interest,
- const ndn::shared_ptr<const ndn::Data>& data,
- size_t routablePrefixOffset, bool isIntroducer);
-
- void
- replyTimeout(const ndn::Interest& interest,
- size_t routablePrefixOffset);
-
- void
- introCert(const ndn::Interest& interest,
- const ndn::shared_ptr<const ndn::Data>& data);
-
- void
- introCertTimeout(const ndn::Interest& interest,
- int retry, const QString& msg);
-
- void
- waitForContactList();
-
-public slots:
- void
- onLocalPrefixUpdated(const QString& localPrefix);
-
- void
- onClose();
-
-private slots:
- void
- onReturnPressed();
-
- void
- onSyncTreeButtonPressed();
-
- void
- onTrustTreeButtonPressed();
-
- void
- onProcessData(const ndn::shared_ptr<const ndn::Data>& data,
- bool show, bool isHistory);
-
- void
- onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>&);
-
- void
- onReplot();
-
- void
- onRosterChanged(QStringList);
-
- void
- onInviteListDialogRequested();
-
- void
- sendJoin();
-
- void
- sendHello();
-
- void
- sendLeave();
-
- void
- enableSyncTreeDisplay();
-
- void
- reap();
-
- void
- onSendInvitation(QString);
-
- void
- onReply(const ndn::Interest& interest,
- const ndn::shared_ptr<const ndn::Data>& data,
- size_t routablePrefixOffset, bool isIntroducer);
-
- void
- onReplyTimeout(const ndn::Interest& interest,
- size_t routablePrefixOffset);
-
- void
- onIntroCert(const ndn::Interest& interest,
- const ndn::shared_ptr<const ndn::Data>& data);
-
- void
- onIntroCertTimeout(const ndn::Interest& interest,
- int retry, const QString& msg);
-
-private:
- Ui::ChatDialog *ui;
- ndn::KeyChain m_keyChain;
-
- chronos::ContactManager* m_contactManager;
- ndn::shared_ptr<ndn::Face> m_face;
-
- ndn::IdentityCertificate m_myCertificate;
- ndn::Name m_identity;
-
- ndn::Name m_certListPrefix;
- const ndn::RegisteredPrefixId* m_certListPrefixId;
- ndn::Name m_certSinglePrefix;
- const ndn::RegisteredPrefixId* m_certSinglePrefixId;
-
- std::string m_chatroomName;
- ndn::Name m_chatroomPrefix;
- ndn::Name m_localPrefix;
- bool m_useRoutablePrefix;
- ndn::Name m_chatPrefix;
- ndn::Name m_localChatPrefix;
- std::string m_nick;
- DigestTreeScene *m_scene;
- TrustTreeScene *m_trustScene;
- QStringListModel *m_rosterModel;
- QTimer* m_timer;
-
-
- int64_t m_lastMsgTime;
- int m_randomizedInterval;
- bool m_joined;
-
- Sync::SyncSocket *m_sock;
- uint64_t m_session;
- ndn::shared_ptr<ndn::SecRuleRelative> m_dataRule;
-
- InviteListDialog* m_inviteListDialog;
- ndn::shared_ptr<chronos::ValidatorInvitation> m_invitationValidator;
-
- boost::recursive_mutex m_msgMutex;
- boost::recursive_mutex m_sceneMutex;
- QList<QString> m_zombieList;
- int m_zombieIndex;
-};
-
-#endif // CHAT_DIALOG_H
diff --git a/src/chat-dialog.hpp b/src/chat-dialog.hpp
new file mode 100644
index 0000000..12051f1
--- /dev/null
+++ b/src/chat-dialog.hpp
@@ -0,0 +1,352 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_CHAT_DIALOG_HPP
+#define CHRONOS_CHAT_DIALOG_HPP
+
+#include <QDialog>
+#include <QTextTable>
+#include <QStringListModel>
+#include <QSystemTrayIcon>
+#include <QMenu>
+#include <QTimer>
+
+#ifndef Q_MOC_RUN
+#include "common.hpp"
+#include "contact-manager.hpp"
+#include "invitation.hpp"
+#include "contact.hpp"
+#include "chatbuf.pb.h"
+#include "intro-cert-list.pb.h"
+#include "digest-tree-scene.hpp"
+#include "trust-tree-scene.hpp"
+#include "trust-tree-node.hpp"
+#include "validator-invitation.hpp"
+#include <sync-socket.h>
+#include <sync-seq-no.h>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/thread.hpp>
+#endif
+
+#include "invite-list-dialog.hpp"
+
+
+#define MAX_HISTORY_ENTRY 20
+
+namespace Ui {
+class ChatDialog;
+}
+
+namespace chronos {
+
+class ChatDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit
+ ChatDialog(ContactManager* contactManager,
+ shared_ptr<ndn::Face> face,
+ const ndn::IdentityCertificate& myCertificate,
+ const Name& chatroomPrefix,
+ const Name& localPrefix,
+ const std::string& nick,
+ bool witSecurity,
+ QWidget* parent = 0);
+
+ ~ChatDialog();
+
+ void
+ addSyncAnchor(const Invitation& invitation);
+
+ void
+ processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>&, Sync::SyncSocket *);
+
+ void
+ processDataWrapper(const shared_ptr<const Data>& data);
+
+ void
+ processDataNoShowWrapper(const shared_ptr<const Data>& data);
+
+ void
+ processRemoveWrapper(const std::string& prefix);
+
+protected:
+ void
+ closeEvent(QCloseEvent* e);
+
+ void
+ changeEvent(QEvent* e);
+
+ void
+ resizeEvent(QResizeEvent* e);
+
+ void
+ showEvent(QShowEvent* e);
+
+private:
+ void
+ updatePrefix();
+
+ void
+ updateLabels();
+
+ void
+ initializeSync();
+
+ void
+ sendInvitation(shared_ptr<Contact> contact, bool isIntroducer);
+
+ void
+ replyWrapper(const Interest& interest, Data& data,
+ size_t routablePrefixOffset, bool isIntroducer);
+
+ void
+ replyTimeoutWrapper(const Interest& interest,
+ size_t routablePrefixOffset);
+
+ void
+ onReplyValidated(const shared_ptr<const Data>& data,
+ size_t inviteeRoutablePrefixOffset,
+ bool isIntroduce);
+
+ void
+ onReplyValidationFailed(const shared_ptr<const Data>& data,
+ const std::string& failureInfo);
+
+ void
+ invitationRejected(const Name& identity);
+
+ void
+ invitationAccepted(const ndn::IdentityCertificate& inviteeCert,
+ const Name& inviteePrefix, bool isIntroducer);
+
+ void
+ fetchIntroCert(const Name& identity, const Name& prefix);
+
+ void
+ onIntroCertList(const Interest& interest, const Data& data);
+
+ void
+ onIntroCertListTimeout(const Interest& interest, int retry, const std::string& msg);
+
+ void
+ introCertWrapper(const Interest& interest, Data& data);
+
+ void
+ introCertTimeoutWrapper(const Interest& interest, int retry, const QString& msg);
+
+ void
+ onCertListInterest(const Name& prefix, const Interest& interest);
+
+ void
+ onCertListRegisterFailed(const Name& prefix, const std::string& msg);
+
+ void
+ onCertSingleInterest(const Name& prefix, const Interest& interest);
+
+ void
+ onCertSingleRegisterFailed(const Name& prefix, const std::string& msg);
+
+
+ void
+ sendMsg(SyncDemo::ChatMessage& msg);
+
+ void
+ disableSyncTreeDisplay();
+
+ void
+ appendMessage(const SyncDemo::ChatMessage msg, bool isHistory = false);
+
+ void
+ processRemove(QString prefix);
+
+ ndn::Name
+ getInviteeRoutablePrefix(const Name& invitee);
+
+ void
+ formChatMessage(const QString& text, SyncDemo::ChatMessage& msg);
+
+ void
+ formControlMessage(SyncDemo::ChatMessage &msg, SyncDemo::ChatMessage::ChatMessageType type);
+
+ QString
+ formatTime(time_t timestamp);
+
+ void
+ printTimeInCell(QTextTable* table, time_t timestamp);
+
+ std::string
+ getRandomString();
+
+ void
+ showMessage(const QString&, const QString&);
+
+ void
+ fitView();
+
+ void
+ summonReaper();
+
+ void
+ getTree(TrustTreeNodeList& nodeList);
+
+ void
+ plotTrustTree();
+
+signals:
+ void
+ processData(const shared_ptr<const Data>& data, bool show, bool isHistory);
+
+ void
+ processTreeUpdate(const std::vector<Sync::MissingDataInfo>);
+
+ void
+ closeChatDialog(const QString& chatroomName);
+
+ void
+ inivationRejection(const QString& msg);
+
+ void
+ showChatMessage(const QString& chatroomName, const QString& from, const QString& data);
+
+ void
+ resetIcon();
+
+ void
+ reply(const Interest& interest, const shared_ptr<const Data>& data,
+ size_t routablePrefixOffset, bool isIntroducer);
+
+ void
+ replyTimeout(const Interest& interest, size_t routablePrefixOffset);
+
+ void
+ introCert(const Interest& interest, const shared_ptr<const Data>& data);
+
+ void
+ introCertTimeout(const Interest& interest, int retry, const QString& msg);
+
+ void
+ waitForContactList();
+
+public slots:
+ void
+ onLocalPrefixUpdated(const QString& localPrefix);
+
+ void
+ onClose();
+
+private slots:
+ void
+ onReturnPressed();
+
+ void
+ onSyncTreeButtonPressed();
+
+ void
+ onTrustTreeButtonPressed();
+
+ void
+ onProcessData(const shared_ptr<const Data>& data, bool show, bool isHistory);
+
+ void
+ onProcessTreeUpdate(const std::vector<Sync::MissingDataInfo>&);
+
+ void
+ onReplot();
+
+ void
+ onRosterChanged(QStringList staleUserList);
+
+ void
+ onInviteListDialogRequested();
+
+ void
+ sendJoin();
+
+ void
+ sendHello();
+
+ void
+ sendLeave();
+
+ void
+ enableSyncTreeDisplay();
+
+ void
+ reap();
+
+ void
+ onSendInvitation(QString invitee);
+
+ void
+ onReply(const Interest& interest, const shared_ptr<const Data>& data,
+ size_t routablePrefixOffset, bool isIntroducer);
+
+ void
+ onReplyTimeout(const Interest& interest, size_t routablePrefixOffset);
+
+ void
+ onIntroCert(const Interest& interest, const shared_ptr<const Data>& data);
+
+ void
+ onIntroCertTimeout(const Interest& interest, int retry, const QString& msg);
+
+private:
+ Ui::ChatDialog *ui;
+ ndn::KeyChain m_keyChain;
+
+ ContactManager* m_contactManager;
+ shared_ptr<ndn::Face> m_face;
+
+ ndn::IdentityCertificate m_myCertificate;
+ Name m_identity;
+
+ Name m_certListPrefix;
+ const ndn::RegisteredPrefixId* m_certListPrefixId;
+ Name m_certSinglePrefix;
+ const ndn::RegisteredPrefixId* m_certSinglePrefixId;
+
+ std::string m_chatroomName;
+ Name m_chatroomPrefix;
+ Name m_localPrefix;
+ bool m_useRoutablePrefix;
+ Name m_chatPrefix;
+ Name m_localChatPrefix;
+ std::string m_nick;
+ DigestTreeScene *m_scene;
+ TrustTreeScene *m_trustScene;
+ QStringListModel *m_rosterModel;
+ QTimer* m_timer;
+
+
+ int64_t m_lastMsgTime;
+ int m_randomizedInterval;
+ bool m_joined;
+
+ Sync::SyncSocket *m_sock;
+ uint64_t m_session;
+ shared_ptr<ndn::SecRuleRelative> m_dataRule;
+
+ InviteListDialog* m_inviteListDialog;
+ shared_ptr<ValidatorInvitation> m_invitationValidator;
+
+ boost::recursive_mutex m_msgMutex;
+ boost::recursive_mutex m_sceneMutex;
+ QList<QString> m_zombieList;
+ int m_zombieIndex;
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_CHAT_DIALOG_HPP
diff --git a/src/common.hpp b/src/common.hpp
new file mode 100644
index 0000000..22e5de4
--- /dev/null
+++ b/src/common.hpp
@@ -0,0 +1,77 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * COPYRIGHT MSG GOES HERE...
+ */
+
+#ifndef CHRONOS_COMMON_HPP
+#define CHRONOS_COMMON_HPP
+
+#include "config.h"
+
+#ifdef WITH_TESTS
+#define VIRTUAL_WITH_TESTS virtual
+#define PUBLIC_WITH_TESTS_ELSE_PROTECTED public
+#define PUBLIC_WITH_TESTS_ELSE_PRIVATE public
+#define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
+#else
+#define VIRTUAL_WITH_TESTS
+#define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
+#define PUBLIC_WITH_TESTS_ELSE_PRIVATE private
+#define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
+#endif
+
+#include <cstddef>
+#include <list>
+#include <set>
+#include <map>
+#include <queue>
+#include <vector>
+#include <string>
+
+#include <ndn-cxx/common.hpp>
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/data.hpp>
+
+#include <boost/algorithm/string.hpp>
+#include <boost/asio.hpp>
+#include <boost/assert.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/property_tree/ptree.hpp>
+
+namespace chronos {
+
+using std::size_t;
+
+using boost::noncopyable;
+
+using ndn::shared_ptr;
+using ndn::weak_ptr;
+using ndn::enable_shared_from_this;
+using ndn::make_shared;
+using ndn::static_pointer_cast;
+using ndn::dynamic_pointer_cast;
+using ndn::const_pointer_cast;
+using ndn::function;
+using ndn::bind;
+using ndn::ref;
+using ndn::cref;
+
+using ndn::Interest;
+using ndn::Data;
+using ndn::Name;
+using ndn::Exclude;
+using ndn::Block;
+using ndn::Signature;
+using ndn::KeyLocator;
+
+namespace tlv {
+using namespace ndn::Tlv;
+}
+
+namespace name = ndn::name;
+namespace time = ndn::time;
+
+} // namespace chronos
+
+#endif // CHRONOS_COMMON_HPP
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index fb792db..7653cd0 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -12,7 +12,7 @@
#pragma clang diagnostic ignored "-Wtautological-compare"
#endif
-#include "contact-manager.h"
+#include "contact-manager.hpp"
#include <QStringList>
#include <QFile>
@@ -21,24 +21,33 @@
#include <ndn-cxx/util/io.hpp>
#include <ndn-cxx/security/sec-rule-relative.hpp>
#include <ndn-cxx/security/validator-regex.hpp>
-#include <cryptopp/base64.h>
-#include <cryptopp/files.h>
-#include <cryptopp/sha.h>
-#include <cryptopp/filters.h>
+#include "cryptopp.hpp"
#include <boost/asio.hpp>
#include <boost/tokenizer.hpp>
#include <boost/filesystem.hpp>
#include "logging.h"
#endif
-using namespace ndn;
namespace fs = boost::filesystem;
-INIT_LOGGER("chronos.ContactManager");
+// INIT_LOGGER("chronos.ContactManager");
namespace chronos{
-using ndn::shared_ptr;
+using std::string;
+using std::map;
+using std::vector;
+
+using ndn::Face;
+using ndn::OBufferStream;
+using ndn::IdentityCertificate;
+using ndn::Validator;
+using ndn::ValidatorRegex;
+using ndn::SecRuleRelative;
+using ndn::OnDataValidated;
+using ndn::OnDataValidationFailed;
+using ndn::OnInterestValidated;
+using ndn::OnInterestValidationFailed;
static const uint8_t DNS_RP_SEPARATOR[2] = {0xF0, 0x2E}; // %F0.
@@ -52,7 +61,8 @@
}
ContactManager::~ContactManager()
-{}
+{
+}
// private methods
shared_ptr<IdentityCertificate>
@@ -62,38 +72,33 @@
QFile anchorFile(":/security/anchor.cert");
- if (!anchorFile.open(QIODevice::ReadOnly))
- {
- emit warning(QString("Cannot load trust anchor!"));
-
- return anchor;
- }
+ if (!anchorFile.open(QIODevice::ReadOnly)) {
+ emit warning(QString("Cannot load trust anchor!"));
+ return anchor;
+ }
qint64 fileSize = anchorFile.size();
char* buf = new char[fileSize];
anchorFile.read(buf, fileSize);
- try
- {
- using namespace CryptoPP;
+ try {
+ using namespace CryptoPP;
- OBufferStream os;
- StringSource(reinterpret_cast<const uint8_t*>(buf), fileSize, true, new Base64Decoder(new FileSink(os)));
- anchor = make_shared<IdentityCertificate>();
- anchor->wireDecode(Block(os.buf()));
- }
- catch(CryptoPP::Exception& e)
- {
- emit warning(QString("Cannot load trust anchor!"));
- }
- catch(IdentityCertificate::Error& e)
- {
- emit warning(QString("Cannot load trust anchor!"));
- }
- catch(Block::Error& e)
- {
- emit warning(QString("Cannot load trust anchor!"));
- }
+ OBufferStream os;
+ StringSource(reinterpret_cast<const uint8_t*>(buf), fileSize, true,
+ new Base64Decoder(new FileSink(os)));
+ anchor = make_shared<IdentityCertificate>();
+ anchor->wireDecode(Block(os.buf()));
+ }
+ catch (CryptoPP::Exception& e) {
+ emit warning(QString("Cannot load trust anchor!"));
+ }
+ catch (IdentityCertificate::Error& e) {
+ emit warning(QString("Cannot load trust anchor!"));
+ }
+ catch(Block::Error& e) {
+ emit warning(QString("Cannot load trust anchor!"));
+ }
delete [] buf;
@@ -141,9 +146,12 @@
interest.setInterestLifetime(time::milliseconds(1000));
interest.setMustBeFresh(true);
- OnDataValidated onValidated = bind(&ContactManager::onDnsCollectEndorseValidated, this, _1, identity);
- OnDataValidationFailed onValidationFailed = bind(&ContactManager::onDnsCollectEndorseValidationFailed, this, _1, _2, identity);
- TimeoutNotify timeoutNotify = bind(&ContactManager::onDnsCollectEndorseTimeoutNotify, this, _1, identity);
+ OnDataValidated onValidated =
+ bind(&ContactManager::onDnsCollectEndorseValidated, this, _1, identity);
+ OnDataValidationFailed onValidationFailed =
+ bind(&ContactManager::onDnsCollectEndorseValidationFailed, this, _1, _2, identity);
+ TimeoutNotify timeoutNotify =
+ bind(&ContactManager::onDnsCollectEndorseTimeoutNotify, this, _1, identity);
sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
}
@@ -151,7 +159,8 @@
void
ContactManager::fetchEndorseCertificateInternal(const Name& identity, int certIndex)
{
- shared_ptr<EndorseCollection> endorseCollection = m_bufferedContacts[identity].m_endorseCollection;
+ shared_ptr<EndorseCollection> endorseCollection =
+ m_bufferedContacts[identity].m_endorseCollection;
if(certIndex >= endorseCollection->endorsement_size())
prepareEndorseInfo(identity);
@@ -176,58 +185,51 @@
// _LOG_DEBUG("prepareEndorseInfo");
const Profile& profile = m_bufferedContacts[identity].m_selfEndorseCert->getProfile();
- shared_ptr<EndorseInfo> endorseInfo = make_shared<EndorseInfo>();
+ shared_ptr<Chronos::EndorseInfo> endorseInfo = make_shared<Chronos::EndorseInfo>();
m_bufferedContacts[identity].m_endorseInfo = endorseInfo;
- Profile::const_iterator pIt = profile.begin();
- Profile::const_iterator pEnd = profile.end();
-
- std::map<std::string, int> endorseCount;
- for(; pIt != pEnd; pIt++)
- {
- // _LOG_DEBUG("prepareEndorseInfo: profile[" << pIt->first << "]: " << pIt->second);
- endorseCount[pIt->first] = 0;
- }
+ map<string, int> endorseCount;
+ for (Profile::const_iterator pIt = profile.begin(); pIt != profile.end(); pIt++) {
+ // _LOG_DEBUG("prepareEndorseInfo: profile[" << pIt->first << "]: " << pIt->second);
+ endorseCount[pIt->first] = 0;
+ }
int endorseCertCount = 0;
- std::vector<shared_ptr<EndorseCertificate> >::const_iterator cIt = m_bufferedContacts[identity].m_endorseCertList.begin();
- std::vector<shared_ptr<EndorseCertificate> >::const_iterator cEnd = m_bufferedContacts[identity].m_endorseCertList.end();
+ vector<shared_ptr<EndorseCertificate> >::const_iterator cIt =
+ m_bufferedContacts[identity].m_endorseCertList.begin();
+ vector<shared_ptr<EndorseCertificate> >::const_iterator cEnd =
+ m_bufferedContacts[identity].m_endorseCertList.end();
- for(; cIt != cEnd; cIt++, endorseCertCount++)
- {
- shared_ptr<Contact> contact = getContact((*cIt)->getSigner().getPrefix(-1));
- if(!static_cast<bool>(contact))
- continue;
+ for (; cIt != cEnd; cIt++, endorseCertCount++) {
+ shared_ptr<Contact> contact = getContact((*cIt)->getSigner().getPrefix(-1));
+ if (!static_cast<bool>(contact))
+ continue;
- if(!contact->isIntroducer()
- || !contact->canBeTrustedFor(profile.getIdentityName()))
- continue;
+ if (!contact->isIntroducer() ||
+ !contact->canBeTrustedFor(profile.getIdentityName()))
+ continue;
- if(!Validator::verifySignature(**cIt, contact->getPublicKey()))
- continue;
+ if (!Validator::verifySignature(**cIt, contact->getPublicKey()))
+ continue;
- const Profile& tmpProfile = (*cIt)->getProfile();
- if(tmpProfile != profile)
- continue;
+ const Profile& tmpProfile = (*cIt)->getProfile();
+ if (tmpProfile != profile)
+ continue;
- const std::vector<std::string>& endorseList = (*cIt)->getEndorseList();
- std::vector<std::string>::const_iterator eIt = endorseList.begin();
- for(; eIt != endorseList.end(); eIt++)
- endorseCount[*eIt] += 1;
- }
+ const vector<string>& endorseList = (*cIt)->getEndorseList();
+ for (vector<string>::const_iterator eIt = endorseList.begin(); eIt != endorseList.end(); eIt++)
+ endorseCount[*eIt] += 1;
+ }
- pIt = profile.begin();
- pEnd = profile.end();
- for(; pIt != pEnd; pIt++)
- {
- EndorseInfo::Endorsement* endorsement = endorseInfo->add_endorsement();
- endorsement->set_type(pIt->first);
- endorsement->set_value(pIt->second);
- std::stringstream ss;
- ss << endorseCount[pIt->first] << "/" << endorseCertCount;
- endorsement->set_endorse(ss.str());
- }
+ for (Profile::const_iterator pIt = profile.begin(); pIt != profile.end(); pIt++) {
+ Chronos::EndorseInfo::Endorsement* endorsement = endorseInfo->add_endorsement();
+ endorsement->set_type(pIt->first);
+ endorsement->set_value(pIt->second);
+ std::stringstream ss;
+ ss << endorseCount[pIt->first] << "/" << endorseCertCount;
+ endorsement->set_endorse(ss.str());
+ }
emit contactEndorseInfoReady (*endorseInfo);
}
@@ -236,36 +238,32 @@
ContactManager::onDnsSelfEndorseCertValidated(const shared_ptr<const Data>& data,
const Name& identity)
{
- try
- {
- Data plainData;
- plainData.wireDecode(data->getContent().blockFromValue());
- shared_ptr<EndorseCertificate> selfEndorseCertificate = make_shared<EndorseCertificate>(boost::cref(plainData));
- if(Validator::verifySignature(plainData, selfEndorseCertificate->getPublicKeyInfo()))
- {
- m_bufferedContacts[identity].m_selfEndorseCert = selfEndorseCertificate;
- fetchCollectEndorse(identity);
- }
- else
- emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
+ try {
+ Data plainData;
+ plainData.wireDecode(data->getContent().blockFromValue());
+ shared_ptr<EndorseCertificate> selfEndorseCertificate =
+ make_shared<EndorseCertificate>(boost::cref(plainData));
+ if (Validator::verifySignature(plainData, selfEndorseCertificate->getPublicKeyInfo())) {
+ m_bufferedContacts[identity].m_selfEndorseCert = selfEndorseCertificate;
+ fetchCollectEndorse(identity);
}
- catch(Block::Error& e)
- {
+ else
emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
- }
- catch(Data::Error& e)
- {
- emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
- }
- catch(EndorseCertificate::Error& e)
- {
- emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
- }
+ }
+ catch(Block::Error& e) {
+ emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
+ }
+ catch(Data::Error& e) {
+ emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
+ }
+ catch(EndorseCertificate::Error& e) {
+ emit contactInfoFetchFailed(QString::fromStdString(identity.toUri()));
+ }
}
void
ContactManager::onDnsSelfEndorseCertValidationFailed(const shared_ptr<const Data>& data,
- const std::string& failInfo,
+ const string& failInfo,
const Name& identity)
{
// If we cannot validate the Self-Endorse-Certificate, we may retry or fetch id-cert,
@@ -287,37 +285,33 @@
const Name& identity)
{
shared_ptr<EndorseCollection> endorseCollection = make_shared<EndorseCollection>();
- if(!endorseCollection->ParseFromArray(data->getContent().value(), data->getContent().value_size()))
- {
- m_bufferedContacts[identity].m_endorseCollection = endorseCollection;
- fetchEndorseCertificateInternal(identity, 0);
- }
+ if (!endorseCollection->ParseFromArray(data->getContent().value(),
+ data->getContent().value_size())) {
+ m_bufferedContacts[identity].m_endorseCollection = endorseCollection;
+ fetchEndorseCertificateInternal(identity, 0);
+ }
else
prepareEndorseInfo(identity);
}
void
ContactManager::onDnsCollectEndorseValidationFailed(const shared_ptr<const Data>& data,
- const std::string& failInfo,
+ const string& failInfo,
const Name& identity)
{
prepareEndorseInfo(identity);
}
void
-ContactManager::onDnsCollectEndorseTimeoutNotify(const Interest& interest,
- const Name& identity)
+ContactManager::onDnsCollectEndorseTimeoutNotify(const Interest& interest, const Name& identity)
{
// _LOG_DEBUG("onDnsCollectEndorseTimeoutNotify: " << interest.getName());
prepareEndorseInfo(identity);
}
void
-ContactManager::onEndorseCertificateInternal(const Interest& interest,
- Data& data,
- const Name& identity,
- int certIndex,
- std::string hash)
+ContactManager::onEndorseCertificateInternal(const Interest& interest, Data& data,
+ const Name& identity, int certIndex, string hash)
{
std::stringstream ss;
{
@@ -328,11 +322,11 @@
new HashFilter(hash, new FileSink(ss)));
}
- if(ss.str() == hash)
- {
- shared_ptr<EndorseCertificate> endorseCertificate = make_shared<EndorseCertificate>(boost::cref(data));
- m_bufferedContacts[identity].m_endorseCertList.push_back(endorseCertificate);
- }
+ if (ss.str() == hash) {
+ shared_ptr<EndorseCertificate> endorseCertificate =
+ make_shared<EndorseCertificate>(boost::cref(data));
+ m_bufferedContacts[identity].m_endorseCertList.push_back(endorseCertificate);
+ }
fetchEndorseCertificateInternal(identity, certIndex+1);
}
@@ -352,23 +346,20 @@
boost::recursive_mutex::scoped_lock lock(m_collectCountMutex);
m_collectCount = m_contactList.size();
- ContactList::iterator it = m_contactList.begin();
- ContactList::iterator end = m_contactList.end();
+ for (ContactList::iterator it = m_contactList.begin(); it != m_contactList.end(); it++) {
+ Name interestName = (*it)->getNameSpace();
+ interestName.append("DNS").append(m_identity.wireEncode()).append("ENDORSEE");
- for(; it != end ; it++)
- {
- Name interestName = (*it)->getNameSpace();
- interestName.append("DNS").append(m_identity.wireEncode()).append("ENDORSEE");
+ Interest interest(interestName);
+ interest.setInterestLifetime(time::milliseconds(1000));
- Interest interest(interestName);
- interest.setInterestLifetime(time::milliseconds(1000));
+ OnDataValidated onValidated = bind(&ContactManager::onDnsEndorseeValidated, this, _1);
+ OnDataValidationFailed onValidationFailed =
+ bind(&ContactManager::onDnsEndorseeValidationFailed, this, _1, _2);
+ TimeoutNotify timeoutNotify = bind(&ContactManager::onDnsEndorseeTimeoutNotify, this, _1);
- OnDataValidated onValidated = bind(&ContactManager::onDnsEndorseeValidated, this, _1);
- OnDataValidationFailed onValidationFailed = bind(&ContactManager::onDnsEndorseeValidationFailed, this, _1, _2);
- TimeoutNotify timeoutNotify = bind(&ContactManager::onDnsEndorseeTimeoutNotify, this, _1);
-
- sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
- }
+ sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
+ }
}
}
@@ -385,7 +376,8 @@
}
void
-ContactManager::onDnsEndorseeValidationFailed(const shared_ptr<const Data>& data, const std::string& failInfo)
+ContactManager::onDnsEndorseeValidationFailed(const shared_ptr<const Data>& data,
+ const string& failInfo)
{
decreaseCollectStatus();
}
@@ -441,16 +433,17 @@
}
void
-ContactManager::onIdentityCertValidationFailed(const shared_ptr<const Data>& data, const std::string& failInfo)
+ContactManager::onIdentityCertValidationFailed(const shared_ptr<const Data>& data,
+ const string& failInfo)
{
- _LOG_DEBUG("ContactManager::onIdentityCertValidationFailed " << data->getName());
+ // _LOG_DEBUG("ContactManager::onIdentityCertValidationFailed " << data->getName());
decreaseIdCertCount();
}
void
ContactManager::onIdentityCertTimeoutNotify(const Interest& interest)
{
- _LOG_DEBUG("ContactManager::onIdentityCertTimeoutNotify: " << interest.getName());
+ // _LOG_DEBUG("ContactManager::onIdentityCertTimeoutNotify: " << interest.getName());
decreaseIdCertCount();
}
@@ -464,23 +457,20 @@
count = m_idCertCount;
}
- if(count == 0)
- {
- QStringList certNameList;
- QStringList nameList;
+ if (count == 0) {
+ QStringList certNameList;
+ QStringList nameList;
- BufferedIdCerts::const_iterator it = m_bufferedIdCerts.begin();
- BufferedIdCerts::const_iterator end = m_bufferedIdCerts.end();
- for(; it != end; it++)
- {
- certNameList << QString::fromStdString(it->second->getName().toUri());
- Profile profile(*(it->second));
- nameList << QString::fromStdString(profile.get("name"));
- }
-
- emit idCertNameListReady(certNameList);
- emit nameListReady(nameList);
+ for(BufferedIdCerts::const_iterator it = m_bufferedIdCerts.begin();
+ it != m_bufferedIdCerts.end(); it++) {
+ certNameList << QString::fromStdString(it->second->getName().toUri());
+ Profile profile(*(it->second));
+ nameList << QString::fromStdString(profile.get("name"));
}
+
+ emit idCertNameListReady(certNameList);
+ emit nameListReady(nameList);
+ }
}
shared_ptr<EndorseCertificate>
@@ -490,13 +480,14 @@
shared_ptr<IdentityCertificate> signingCert = m_keyChain.getCertificate(certificateName);
- std::vector<std::string> endorseList;
- Profile::const_iterator it = profile.begin();
- for(; it != profile.end(); it++)
+ vector<string> endorseList;
+ for (Profile::const_iterator it = profile.begin(); it != profile.end(); it++)
endorseList.push_back(it->first);
shared_ptr<EndorseCertificate> selfEndorseCertificate =
- shared_ptr<EndorseCertificate>(new EndorseCertificate(*signingCert, profile, endorseList));
+ make_shared<EndorseCertificate>(boost::cref(*signingCert),
+ boost::cref(profile),
+ boost::cref(endorseList));
m_keyChain.sign(*selfEndorseCertificate, certificateName);
@@ -524,12 +515,12 @@
ContactManager::generateEndorseCertificate(const Name& identity)
{
shared_ptr<Contact> contact = getContact(identity);
- if(!static_cast<bool>(contact))
+ if (!static_cast<bool>(contact))
return shared_ptr<EndorseCertificate>();
Name signerKeyName = m_keyChain.getDefaultKeyNameForIdentity(m_identity);
- std::vector<std::string> endorseList;
+ vector<string> endorseList;
m_contactStorage->getEndorseList(identity, endorseList);
shared_ptr<EndorseCertificate> cert =
@@ -561,7 +552,7 @@
m_keyChain.signByIdentity(data, m_identity);
- m_contactStorage->updateDnsEndorseOthers(data, dnsName.get(-3).toEscapedString());
+ m_contactStorage->updateDnsEndorseOthers(data, dnsName.get(-3).toUri());
m_face->put(data);
}
@@ -597,7 +588,7 @@
const TimeoutNotify& timeoutNotify)
{
// _LOG_DEBUG("On interest timeout: " << interest.getName());
- if(retry > 0)
+ if (retry > 0)
sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, retry-1);
else
timeoutNotify(interest);
@@ -609,25 +600,23 @@
const Name& interestName = interest.getName();
shared_ptr<Data> data;
- if(interestName.size() <= prefix.size())
+ if (interestName.size() <= prefix.size())
return;
- if(interestName.size() == (prefix.size()+1))
- {
- data = m_contactStorage->getDnsData("N/A", interestName.get(prefix.size()).toEscapedString());
- if(static_cast<bool>(data))
- m_face->put(*data);
- return;
- }
+ if (interestName.size() == (prefix.size()+1)) {
+ data = m_contactStorage->getDnsData("N/A", interestName.get(prefix.size()).toUri());
+ if (static_cast<bool>(data))
+ m_face->put(*data);
+ return;
+ }
- if(interestName.size() == (prefix.size()+2))
- {
- data = m_contactStorage->getDnsData(interestName.get(prefix.size()).toEscapedString(),
- interestName.get(prefix.size()+1).toEscapedString());
- if(static_cast<bool>(data))
- m_face->put(*data);
- return;
- }
+ if (interestName.size() == (prefix.size()+2)) {
+ data = m_contactStorage->getDnsData(interestName.get(prefix.size()).toUri(),
+ interestName.get(prefix.size()+1).toUri());
+ if (static_cast<bool>(data))
+ m_face->put(*data);
+ return;
+ }
}
void
@@ -645,14 +634,16 @@
m_contactStorage = make_shared<ContactStorage>(m_identity);
- if(m_dnsListenerId)
+ if (m_dnsListenerId)
m_face->unsetInterestFilter(m_dnsListenerId);
Name dnsPrefix;
dnsPrefix.append(m_identity).append("DNS");
m_dnsListenerId = m_face->setInterestFilter(dnsPrefix,
- bind(&ContactManager::onDnsInterest, this, _1, _2),
- bind(&ContactManager::onDnsRegisterFailed, this, _1, _2));
+ bind(&ContactManager::onDnsInterest,
+ this, _1, _2),
+ bind(&ContactManager::onDnsRegisterFailed,
+ this, _1, _2));
m_contactList.clear();
m_contactStorage->getAllContacts(m_contactList);
@@ -676,9 +667,12 @@
interest.setInterestLifetime(time::milliseconds(1000));
interest.setMustBeFresh(true);
- OnDataValidated onValidated = bind(&ContactManager::onDnsSelfEndorseCertValidated, this, _1, identityName);
- OnDataValidationFailed onValidationFailed = bind(&ContactManager::onDnsSelfEndorseCertValidationFailed, this, _1, _2, identityName);
- TimeoutNotify timeoutNotify = bind(&ContactManager::onDnsSelfEndorseCertTimeoutNotify, this, _1, identityName);
+ OnDataValidated onValidated =
+ bind(&ContactManager::onDnsSelfEndorseCertValidated, this, _1, identityName);
+ OnDataValidationFailed onValidationFailed =
+ bind(&ContactManager::onDnsSelfEndorseCertValidationFailed, this, _1, _2, identityName);
+ TimeoutNotify timeoutNotify =
+ bind(&ContactManager::onDnsSelfEndorseCertTimeoutNotify, this, _1, identityName);
sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
}
@@ -691,29 +685,24 @@
Name identityName(identity.toStdString());
BufferedContacts::const_iterator it = m_bufferedContacts.find(identityName);
- if(it != m_bufferedContacts.end())
- {
- Contact contact(*(it->second.m_selfEndorseCert));
- // _LOG_DEBUG("onAddFetchedContact: contact ready");
- try
- {
- m_contactStorage->addContact(contact);
- m_bufferedContacts.erase(identityName);
+ if (it != m_bufferedContacts.end()) {
+ Contact contact(*(it->second.m_selfEndorseCert));
+ // _LOG_DEBUG("onAddFetchedContact: contact ready");
+ try {
+ m_contactStorage->addContact(contact);
+ m_bufferedContacts.erase(identityName);
- m_contactList.clear();
- m_contactStorage->getAllContacts(m_contactList);
+ m_contactList.clear();
+ m_contactStorage->getAllContacts(m_contactList);
- onWaitForContactList();
- }
- catch(ContactStorage::Error& e)
- {
- emit warning(QString::fromStdString(e.what()));
- }
+ onWaitForContactList();
}
+ catch(ContactStorage::Error& e) {
+ emit warning(QString::fromStdString(e.what()));
+ }
+ }
else
- {
- emit warning(QString("Failure: no information of %1").arg(identity));
- }
+ emit warning(QString("Failure: no information of %1").arg(identity));
}
void
@@ -721,12 +710,13 @@
{
// Get current profile;
shared_ptr<Profile> newProfile = m_contactStorage->getSelfProfile();
- if(!static_cast<bool>(newProfile))
+ if (!static_cast<bool>(newProfile))
return;
- _LOG_DEBUG("ContactManager::onUpdateProfile: getProfile");
+ // _LOG_DEBUG("ContactManager::onUpdateProfile: getProfile");
- shared_ptr<EndorseCertificate> newEndorseCertificate = getSignedSelfEndorseCertificate(*newProfile);
+ shared_ptr<EndorseCertificate> newEndorseCertificate =
+ getSignedSelfEndorseCertificate(*newProfile);
m_contactStorage->addSelfEndorseCertificate(*newEndorseCertificate);
@@ -736,102 +726,98 @@
void
ContactManager::onRefreshBrowseContact()
{
- std::vector<std::string> bufferedIdCertNames;
- try
- {
- using namespace boost::asio::ip;
- tcp::iostream request_stream;
- request_stream.expires_from_now(boost::posix_time::milliseconds(5000));
- request_stream.connect("ndncert.named-data.net","80");
- if(!request_stream)
- {
- emit warning(QString::fromStdString("Fail to fetch certificate directory! #1"));
- return;
- }
-
- request_stream << "GET /cert/list/ HTTP/1.0\r\n";
- request_stream << "Host: ndncert.named-data.net\r\n\r\n";
- request_stream.flush();
-
- std::string line1;
- std::getline(request_stream,line1);
- if (!request_stream)
- {
- emit warning(QString::fromStdString("Fail to fetch certificate directory! #2"));
- return;
- }
-
- std::stringstream response_stream(line1);
- std::string http_version;
- response_stream >> http_version;
- unsigned int status_code;
- response_stream >> status_code;
- std::string status_message;
- std::getline(response_stream,status_message);
-
- if (!response_stream||http_version.substr(0,5)!="HTTP/")
- {
- emit warning(QString::fromStdString("Fail to fetch certificate directory! #3"));
- return;
- }
- if (status_code!=200)
- {
- emit warning(QString::fromStdString("Fail to fetch certificate directory! #4"));
- return;
- }
- std::vector<std::string> headers;
- std::string header;
- while (std::getline(request_stream, header) && header != "\r")
- headers.push_back(header);
-
- std::istreambuf_iterator<char> stream_iter (request_stream);
- std::istreambuf_iterator<char> end_of_stream;
-
- typedef boost::tokenizer< boost::escaped_list_separator<char>, std::istreambuf_iterator<char> > tokenizer_t;
- tokenizer_t certItems (stream_iter, end_of_stream,boost::escaped_list_separator<char>('\\', '\n', '"'));
-
- for (tokenizer_t::iterator it = certItems.begin(); it != certItems.end (); it++)
- if (!it->empty())
- bufferedIdCertNames.push_back(*it);
+ vector<string> bufferedIdCertNames;
+ try {
+ using namespace boost::asio::ip;
+ tcp::iostream request_stream;
+ request_stream.expires_from_now(boost::posix_time::milliseconds(5000));
+ request_stream.connect("ndncert.named-data.net","80");
+ if (!request_stream) {
+ emit warning(QString::fromStdString("Fail to fetch certificate directory! #1"));
+ return;
}
- catch(std::exception &e)
- {
- emit warning(QString::fromStdString("Fail to fetch certificate directory! #N"));
+
+ request_stream << "GET /cert/list/ HTTP/1.0\r\n";
+ request_stream << "Host: ndncert.named-data.net\r\n\r\n";
+ request_stream.flush();
+
+ string line1;
+ std::getline(request_stream,line1);
+ if (!request_stream) {
+ emit warning(QString::fromStdString("Fail to fetch certificate directory! #2"));
+ return;
}
+ std::stringstream response_stream(line1);
+ string http_version;
+ response_stream >> http_version;
+ unsigned int status_code;
+ response_stream >> status_code;
+ string status_message;
+ std::getline(response_stream,status_message);
+
+ if (!response_stream ||
+ http_version.substr(0,5) != "HTTP/") {
+ emit warning(QString::fromStdString("Fail to fetch certificate directory! #3"));
+ return;
+ }
+ if (status_code!=200) {
+ emit warning(QString::fromStdString("Fail to fetch certificate directory! #4"));
+ return;
+ }
+ vector<string> headers;
+ string header;
+ while (std::getline(request_stream, header) && header != "\r")
+ headers.push_back(header);
+
+ std::istreambuf_iterator<char> stream_iter (request_stream);
+ std::istreambuf_iterator<char> end_of_stream;
+
+ typedef boost::tokenizer< boost::escaped_list_separator<char>,
+ std::istreambuf_iterator<char> > tokenizer_t;
+ tokenizer_t certItems (stream_iter,
+ end_of_stream,
+ boost::escaped_list_separator<char>('\\', '\n', '"'));
+
+ for (tokenizer_t::iterator it = certItems.begin(); it != certItems.end (); it++)
+ if (!it->empty())
+ bufferedIdCertNames.push_back(*it);
+ }
+ catch(std::exception &e) {
+ emit warning(QString::fromStdString("Fail to fetch certificate directory! #N"));
+ }
+
{
boost::recursive_mutex::scoped_lock lock(m_idCertCountMutex);
m_idCertCount = bufferedIdCertNames.size();
}
m_bufferedIdCerts.clear();
- std::vector<std::string>::const_iterator it = bufferedIdCertNames.begin();
- std::vector<std::string>::const_iterator end = bufferedIdCertNames.end();
- for(; it != end; it++)
- {
- Name certName(*it);
+ for (vector<string>::const_iterator it = bufferedIdCertNames.begin();
+ it != bufferedIdCertNames.end(); it++) {
+ Name certName(*it);
- Interest interest(certName);
- interest.setInterestLifetime(time::milliseconds(1000));
- interest.setMustBeFresh(true);
+ Interest interest(certName);
+ interest.setInterestLifetime(time::milliseconds(1000));
+ interest.setMustBeFresh(true);
- OnDataValidated onValidated = bind(&ContactManager::onIdentityCertValidated, this, _1);
- OnDataValidationFailed onValidationFailed = bind(&ContactManager::onIdentityCertValidationFailed, this, _1, _2);
- TimeoutNotify timeoutNotify = bind(&ContactManager::onIdentityCertTimeoutNotify, this, _1);
+ OnDataValidated onValidated =
+ bind(&ContactManager::onIdentityCertValidated, this, _1);
+ OnDataValidationFailed onValidationFailed =
+ bind(&ContactManager::onIdentityCertValidationFailed, this, _1, _2);
+ TimeoutNotify timeoutNotify =
+ bind(&ContactManager::onIdentityCertTimeoutNotify, this, _1);
- sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
- }
-
+ sendInterest(interest, onValidated, onValidationFailed, timeoutNotify, 0);
+ }
}
void
ContactManager::onFetchIdCert(const QString& qCertName)
{
Name certName(qCertName.toStdString());
- if(m_bufferedIdCerts.find(certName) != m_bufferedIdCerts.end())
- {
- emit idCertReady(*m_bufferedIdCerts[certName]);
- }
+ if (m_bufferedIdCerts.find(certName) != m_bufferedIdCerts.end())
+ emit idCertReady(*m_bufferedIdCerts[certName]);
}
void
@@ -841,41 +827,35 @@
Name identity = IdentityCertificate::certificateNameToPublicKeyName(certName).getPrefix(-1);
BufferedIdCerts::const_iterator it = m_bufferedIdCerts.find(certName);
- if(it != m_bufferedIdCerts.end())
- {
- Contact contact(*it->second);
- try
- {
- m_contactStorage->addContact(contact);
- m_bufferedIdCerts.erase(certName);
+ if (it != m_bufferedIdCerts.end()) {
+ Contact contact(*it->second);
+ try {
+ m_contactStorage->addContact(contact);
+ m_bufferedIdCerts.erase(certName);
- m_contactList.clear();
- m_contactStorage->getAllContacts(m_contactList);
+ m_contactList.clear();
+ m_contactStorage->getAllContacts(m_contactList);
- onWaitForContactList();
- }
- catch(ContactStorage::Error& e)
- {
- emit warning(QString::fromStdString(e.what()));
- }
+ onWaitForContactList();
}
+ catch(ContactStorage::Error& e) {
+ emit warning(QString::fromStdString(e.what()));
+ }
+ }
else
- emit warning(QString("Failure: no information of %1").arg(QString::fromStdString(identity.toUri())));
+ emit warning(QString("Failure: no information of %1")
+ .arg(QString::fromStdString(identity.toUri())));
}
void
ContactManager::onWaitForContactList()
{
- ContactList::const_iterator it = m_contactList.begin();
- ContactList::const_iterator end = m_contactList.end();
-
QStringList aliasList;
QStringList idList;
- for(; it != end; it++)
- {
- aliasList << QString((*it)->getAlias().c_str());
- idList << QString((*it)->getNameSpace().toUri().c_str());
- }
+ for (ContactList::const_iterator it = m_contactList.begin(); it != m_contactList.end(); it++) {
+ aliasList << QString((*it)->getAlias().c_str());
+ idList << QString((*it)->getNameSpace().toUri().c_str());
+ }
emit contactAliasListReady(aliasList);
emit contactIdListReady(idList);
@@ -884,11 +864,8 @@
void
ContactManager::onWaitForContactInfo(const QString& identity)
{
- ContactList::const_iterator it = m_contactList.begin();
- ContactList::const_iterator end = m_contactList.end();
-
- for(; it != end; it++)
- if((*it)->getNameSpace().toUri() == identity.toStdString())
+ for (ContactList::const_iterator it = m_contactList.begin(); it != m_contactList.end(); it++)
+ if ((*it)->getNameSpace().toUri() == identity.toStdString())
emit contactInfoReady(QString((*it)->getNameSpace().toUri().c_str()),
QString((*it)->getName().c_str()),
QString((*it)->getInstitution().c_str()),
@@ -927,7 +904,7 @@
Name identityName(identity.toStdString());
shared_ptr<EndorseCertificate> newEndorseCertificate = generateEndorseCertificate(identityName);
- if(!static_cast<bool>(newEndorseCertificate))
+ if (!static_cast<bool>(newEndorseCertificate))
return;
m_contactStorage->addEndorseCertificate(*newEndorseCertificate, identityName);
diff --git a/src/contact-manager.h b/src/contact-manager.h
deleted file mode 100644
index 8ab7e81..0000000
--- a/src/contact-manager.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef CHRONOS_CONTACT_MANAGER_H
-#define CHRONOS_CONTACT_MANAGER_H
-
-#include <QObject>
-
-#ifndef Q_MOC_RUN
-#include "contact-storage.h"
-#include "endorse-certificate.h"
-#include "profile.h"
-#include "endorse-info.pb.h"
-#include "endorse-collection.pb.h"
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/validator.hpp>
-#include <boost/thread/locks.hpp>
-#include <boost/thread/recursive_mutex.hpp>
-#endif
-
-namespace chronos{
-
-typedef ndn::function<void(const ndn::Interest&)> TimeoutNotify;
-typedef std::vector<ndn::shared_ptr<Contact> > ContactList;
-
-class ContactManager : public QObject
-{
- Q_OBJECT
-
-public:
- ContactManager(ndn::shared_ptr<ndn::Face> m_face,
- QObject* parent = 0);
-
- ~ContactManager();
-
- ndn::shared_ptr<Contact>
- getContact(const ndn::Name& identity)
- {
- return m_contactStorage->getContact(identity);
- }
-
- void
- getContactList(ContactList& contactList)
- {
- contactList.clear();
- contactList.insert(contactList.end(), m_contactList.begin(), m_contactList.end());
- }
-private:
- ndn::shared_ptr<ndn::IdentityCertificate>
- loadTrustAnchor();
-
- void
- initializeSecurity();
-
- void
- fetchCollectEndorse(const ndn::Name& identity);
-
- void
- fetchEndorseCertificateInternal(const ndn::Name& identity, int certIndex);
-
- void
- prepareEndorseInfo(const ndn::Name& identity);
-
- // PROFILE: self-endorse-certificate
- void
- onDnsSelfEndorseCertValidated(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate,
- const ndn::Name& identity);
-
- void
- onDnsSelfEndorseCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate,
- const std::string& failInfo,
- const ndn::Name& identity);
-
- void
- onDnsSelfEndorseCertTimeoutNotify(const ndn::Interest& interest,
- const ndn::Name& identity);
-
- // ENDORSED: endorse-collection
- void
- onDnsCollectEndorseValidated(const ndn::shared_ptr<const ndn::Data>& data,
- const ndn::Name& identity);
-
- void
- onDnsCollectEndorseValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
- const std::string& failInfo,
- const ndn::Name& identity);
-
- void
- onDnsCollectEndorseTimeoutNotify(const ndn::Interest& interest,
- const ndn::Name& identity);
-
- // PROFILE-CERT: endorse-certificate
- void
- onEndorseCertificateInternal(const ndn::Interest& interest,
- ndn::Data& data,
- const ndn::Name& identity,
- int certIndex,
- std::string hash);
-
- void
- onEndorseCertificateInternalTimeout(const ndn::Interest& interest,
- const ndn::Name& identity,
- int certIndex);
-
- // Collect endorsement
- void
- collectEndorsement();
-
- void
- onDnsEndorseeValidated(const ndn::shared_ptr<const ndn::Data>& data);
-
- void
- onDnsEndorseeValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
- const std::string& failInfo);
-
- void
- onDnsEndorseeTimeoutNotify(const ndn::Interest& interest);
-
- void
- decreaseCollectStatus();
-
- void
- publishCollectEndorsedDataInDNS();
-
- // Identity certificate
- void
- onIdentityCertValidated(const ndn::shared_ptr<const ndn::Data>& data);
-
- void
- onIdentityCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
- const std::string& failInfo);
-
- void
- onIdentityCertTimeoutNotify(const ndn::Interest& interest);
-
- void
- decreaseIdCertCount();
-
- // Publish self-endorse certificate
- ndn::shared_ptr<EndorseCertificate>
- getSignedSelfEndorseCertificate(const Profile& profile);
-
- void
- publishSelfEndorseCertificateInDNS(const EndorseCertificate& selfEndorseCertificate);
-
- // Publish endorse certificate
- ndn::shared_ptr<EndorseCertificate>
- generateEndorseCertificate(const ndn::Name& identity);
-
- void
- publishEndorseCertificateInDNS(const EndorseCertificate& endorseCertificate);
-
- // Communication
- void
- sendInterest(const ndn::Interest& interest,
- const ndn::OnDataValidated& onValidated,
- const ndn::OnDataValidationFailed& onValidationFailed,
- const TimeoutNotify& timeoutNotify,
- int retry = 1);
-
- void
- onTargetData(const ndn::Interest& interest,
- const ndn::Data& data,
- const ndn::OnDataValidated& onValidated,
- const ndn::OnDataValidationFailed& onValidationFailed);
-
- void
- onTargetTimeout(const ndn::Interest& interest,
- int retry,
- const ndn::OnDataValidated& onValidated,
- const ndn::OnDataValidationFailed& onValidationFailed,
- const TimeoutNotify& timeoutNotify);
-
- // DNS listener
- void
- onDnsInterest(const ndn::Name& prefix, const ndn::Interest& interest);
-
- void
- onDnsRegisterFailed(const ndn::Name& prefix, const std::string& failInfo);
-
-signals:
- void
- contactEndorseInfoReady(const chronos::EndorseInfo& endorseInfo);
-
- void
- contactInfoFetchFailed(const QString& identity);
-
- void
- idCertNameListReady(const QStringList& certNameList);
-
- void
- nameListReady(const QStringList& certNameList);
-
- void
- idCertReady(const ndn::IdentityCertificate& idCert);
-
- void
- contactAliasListReady(const QStringList& aliasList);
-
- void
- contactIdListReady(const QStringList& idList);
-
- void
- contactInfoReady(const QString& identity,
- const QString& name,
- const QString& institute,
- bool isIntro);
-
- void
- warning(const QString& msg);
-
-public slots:
- void
- onIdentityUpdated(const QString& identity);
-
- void
- onFetchContactInfo(const QString& identity);
-
- void
- onAddFetchedContact(const QString& identity);
-
- void
- onUpdateProfile();
-
- void
- onRefreshBrowseContact();
-
- void
- onFetchIdCert(const QString& certName);
-
- void
- onAddFetchedContactIdCert(const QString& identity);
-
- void
- onWaitForContactList();
-
- void
- onWaitForContactInfo(const QString& identity);
-
- void
- onRemoveContact(const QString& identity);
-
- void
- onUpdateAlias(const QString& identity, const QString& alias);
-
- void
- onUpdateIsIntroducer(const QString& identity, bool isIntro);
-
- void
- onUpdateEndorseCertificate(const QString& identity);
-
-private:
-
- class FetchedInfo {
- public:
- ndn::shared_ptr<EndorseCertificate> m_selfEndorseCert;
- ndn::shared_ptr<EndorseCollection> m_endorseCollection;
- std::vector<ndn::shared_ptr<EndorseCertificate> > m_endorseCertList;
- ndn::shared_ptr<EndorseInfo> m_endorseInfo;
- };
-
- typedef std::map<ndn::Name, FetchedInfo> BufferedContacts;
- typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > BufferedIdCerts;
-
- typedef boost::recursive_mutex RecLock;
- typedef boost::unique_lock<RecLock> UniqueRecLock;
-
- // Conf
- ndn::shared_ptr<ContactStorage> m_contactStorage;
- ndn::shared_ptr<ndn::Validator> m_validator;
- ndn::shared_ptr<ndn::Face> m_face;
- ndn::KeyChain m_keyChain;
- ndn::Name m_identity;
- ContactList m_contactList;
-
- // Buffer
- BufferedContacts m_bufferedContacts;
- BufferedIdCerts m_bufferedIdCerts;
-
- // Tmp Dns
- const ndn::RegisteredPrefixId* m_dnsListenerId;
-
- RecLock m_collectCountMutex;
- int m_collectCount;
-
- RecLock m_idCertCountMutex;
- int m_idCertCount;
-};
-
-} // namespace chronos
-
-#endif //CHRONOS_CONTACT_MANAGER_H
diff --git a/src/contact-manager.hpp b/src/contact-manager.hpp
new file mode 100644
index 0000000..d9254d9
--- /dev/null
+++ b/src/contact-manager.hpp
@@ -0,0 +1,293 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_CONTACT_MANAGER_HPP
+#define CHRONOS_CONTACT_MANAGER_HPP
+
+#include <QObject>
+
+#ifndef Q_MOC_RUN
+#include "common.hpp"
+#include "contact-storage.hpp"
+#include "endorse-certificate.hpp"
+#include "profile.hpp"
+#include "endorse-info.pb.h"
+#include "endorse-collection.pb.h"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/validator.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#endif
+
+namespace chronos{
+
+typedef function<void(const Interest&)> TimeoutNotify;
+typedef std::vector<shared_ptr<Contact> > ContactList;
+
+class ContactManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ ContactManager(shared_ptr<ndn::Face> m_face, QObject* parent = 0);
+
+ ~ContactManager();
+
+ shared_ptr<Contact>
+ getContact(const Name& identity)
+ {
+ return m_contactStorage->getContact(identity);
+ }
+
+ void
+ getContactList(ContactList& contactList)
+ {
+ contactList.clear();
+ contactList.insert(contactList.end(), m_contactList.begin(), m_contactList.end());
+ }
+private:
+ shared_ptr<ndn::IdentityCertificate>
+ loadTrustAnchor();
+
+ void
+ initializeSecurity();
+
+ void
+ fetchCollectEndorse(const Name& identity);
+
+ void
+ fetchEndorseCertificateInternal(const Name& identity, int certIndex);
+
+ void
+ prepareEndorseInfo(const Name& identity);
+
+ // PROFILE: self-endorse-certificate
+ void
+ onDnsSelfEndorseCertValidated(const shared_ptr<const Data>& selfEndorseCertificate,
+ const Name& identity);
+
+ void
+ onDnsSelfEndorseCertValidationFailed(const shared_ptr<const Data>& selfEndorseCertificate,
+ const std::string& failInfo,
+ const Name& identity);
+
+ void
+ onDnsSelfEndorseCertTimeoutNotify(const Interest& interest, const Name& identity);
+
+ // ENDORSED: endorse-collection
+ void
+ onDnsCollectEndorseValidated(const shared_ptr<const Data>& data, const Name& identity);
+
+ void
+ onDnsCollectEndorseValidationFailed(const shared_ptr<const Data>& data,
+ const std::string& failInfo,
+ const Name& identity);
+
+ void
+ onDnsCollectEndorseTimeoutNotify(const Interest& interest,
+ const Name& identity);
+
+ // PROFILE-CERT: endorse-certificate
+ void
+ onEndorseCertificateInternal(const Interest& interest, Data& data,
+ const Name& identity, int certIndex, std::string hash);
+
+ void
+ onEndorseCertificateInternalTimeout(const Interest& interest,
+ const Name& identity,
+ int certIndex);
+
+ // Collect endorsement
+ void
+ collectEndorsement();
+
+ void
+ onDnsEndorseeValidated(const shared_ptr<const Data>& data);
+
+ void
+ onDnsEndorseeValidationFailed(const shared_ptr<const Data>& data,
+ const std::string& failInfo);
+
+ void
+ onDnsEndorseeTimeoutNotify(const Interest& interest);
+
+ void
+ decreaseCollectStatus();
+
+ void
+ publishCollectEndorsedDataInDNS();
+
+ // Identity certificate
+ void
+ onIdentityCertValidated(const shared_ptr<const Data>& data);
+
+ void
+ onIdentityCertValidationFailed(const shared_ptr<const Data>& data, const std::string& failInfo);
+
+ void
+ onIdentityCertTimeoutNotify(const Interest& interest);
+
+ void
+ decreaseIdCertCount();
+
+ // Publish self-endorse certificate
+ shared_ptr<EndorseCertificate>
+ getSignedSelfEndorseCertificate(const Profile& profile);
+
+ void
+ publishSelfEndorseCertificateInDNS(const EndorseCertificate& selfEndorseCertificate);
+
+ // Publish endorse certificate
+ shared_ptr<EndorseCertificate>
+ generateEndorseCertificate(const Name& identity);
+
+ void
+ publishEndorseCertificateInDNS(const EndorseCertificate& endorseCertificate);
+
+ // Communication
+ void
+ sendInterest(const Interest& interest,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ const TimeoutNotify& timeoutNotify,
+ int retry = 1);
+
+ void
+ onTargetData(const Interest& interest,
+ const Data& data,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed);
+
+ void
+ onTargetTimeout(const Interest& interest,
+ int retry,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ const TimeoutNotify& timeoutNotify);
+
+ // DNS listener
+ void
+ onDnsInterest(const Name& prefix, const Interest& interest);
+
+ void
+ onDnsRegisterFailed(const Name& prefix, const std::string& failInfo);
+
+signals:
+ void
+ contactEndorseInfoReady(const Chronos::EndorseInfo& endorseInfo);
+
+ void
+ contactInfoFetchFailed(const QString& identity);
+
+ void
+ idCertNameListReady(const QStringList& certNameList);
+
+ void
+ nameListReady(const QStringList& certNameList);
+
+ void
+ idCertReady(const ndn::IdentityCertificate& idCert);
+
+ void
+ contactAliasListReady(const QStringList& aliasList);
+
+ void
+ contactIdListReady(const QStringList& idList);
+
+ void
+ contactInfoReady(const QString& identity,
+ const QString& name,
+ const QString& institute,
+ bool isIntro);
+
+ void
+ warning(const QString& msg);
+
+public slots:
+ void
+ onIdentityUpdated(const QString& identity);
+
+ void
+ onFetchContactInfo(const QString& identity);
+
+ void
+ onAddFetchedContact(const QString& identity);
+
+ void
+ onUpdateProfile();
+
+ void
+ onRefreshBrowseContact();
+
+ void
+ onFetchIdCert(const QString& certName);
+
+ void
+ onAddFetchedContactIdCert(const QString& identity);
+
+ void
+ onWaitForContactList();
+
+ void
+ onWaitForContactInfo(const QString& identity);
+
+ void
+ onRemoveContact(const QString& identity);
+
+ void
+ onUpdateAlias(const QString& identity, const QString& alias);
+
+ void
+ onUpdateIsIntroducer(const QString& identity, bool isIntro);
+
+ void
+ onUpdateEndorseCertificate(const QString& identity);
+
+private:
+
+ class FetchedInfo {
+ public:
+ shared_ptr<EndorseCertificate> m_selfEndorseCert;
+ shared_ptr<EndorseCollection> m_endorseCollection;
+ std::vector<shared_ptr<EndorseCertificate> > m_endorseCertList;
+ shared_ptr<Chronos::EndorseInfo> m_endorseInfo;
+ };
+
+ typedef std::map<Name, FetchedInfo> BufferedContacts;
+ typedef std::map<Name, shared_ptr<ndn::IdentityCertificate> > BufferedIdCerts;
+
+ typedef boost::recursive_mutex RecLock;
+ typedef boost::unique_lock<RecLock> UniqueRecLock;
+
+ // Conf
+ shared_ptr<ContactStorage> m_contactStorage;
+ shared_ptr<ndn::Validator> m_validator;
+ shared_ptr<ndn::Face> m_face;
+ ndn::KeyChain m_keyChain;
+ Name m_identity;
+ ContactList m_contactList;
+
+ // Buffer
+ BufferedContacts m_bufferedContacts;
+ BufferedIdCerts m_bufferedIdCerts;
+
+ // Tmp Dns
+ const ndn::RegisteredPrefixId* m_dnsListenerId;
+
+ RecLock m_collectCountMutex;
+ int m_collectCount;
+
+ RecLock m_idCertCountMutex;
+ int m_idCertCount;
+};
+
+} // namespace chronos
+
+#endif //CHRONOS_CONTACT_MANAGER_HPP
diff --git a/src/contact-panel.cpp b/src/contact-panel.cpp
index 323667b..4b8dee8 100644
--- a/src/contact-panel.cpp
+++ b/src/contact-panel.cpp
@@ -8,7 +8,7 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "contact-panel.h"
+#include "contact-panel.hpp"
#include "ui_contact-panel.h"
#include <QMenu>
@@ -22,7 +22,9 @@
#include "logging.h"
#endif
-INIT_LOGGER("ContactPanel");
+// INIT_LOGGER("ContactPanel");
+
+namespace chronos {
ContactPanel::ContactPanel(QWidget *parent)
: QDialog(parent)
@@ -38,8 +40,10 @@
m_menuAlias = new QAction("Set Alias", this);
m_menuDelete = new QAction("Delete", this);
- connect(ui->ContactList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
- this, SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &)));
+ connect(ui->ContactList->selectionModel(),
+ SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+ this,
+ SLOT(onSelectionChanged(const QItemSelection &, const QItemSelection &)));
connect(ui->ContactList, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(onContextMenuRequested(const QPoint&)));
connect(ui->isIntroducer, SIGNAL(stateChanged(int)),
@@ -58,9 +62,12 @@
ContactPanel::~ContactPanel()
{
- if(m_contactListModel) delete m_contactListModel;
- if(m_trustScopeModel) delete m_trustScopeModel;
- if(m_endorseDataModel) delete m_endorseDataModel;
+ if (m_contactListModel)
+ delete m_contactListModel;
+ if (m_trustScopeModel)
+ delete m_trustScopeModel;
+ if (m_endorseDataModel)
+ delete m_endorseDataModel;
delete m_setAliasDialog;
delete m_endorseComboBoxDelegate;
@@ -122,17 +129,15 @@
void
ContactPanel::onCloseDBModule()
{
- _LOG_DEBUG("close db module");
- if(m_trustScopeModel)
- {
- delete m_trustScopeModel;
- _LOG_DEBUG("trustScopeModel closed");
- }
- if(m_endorseDataModel)
- {
- delete m_endorseDataModel;
- _LOG_DEBUG("endorseDataModel closed");
- }
+ // _LOG_DEBUG("close db module");
+ if (m_trustScopeModel) {
+ delete m_trustScopeModel;
+ // _LOG_DEBUG("trustScopeModel closed");
+ }
+ if (m_endorseDataModel) {
+ delete m_endorseDataModel;
+ // _LOG_DEBUG("endorseDataModel closed");
+ }
}
void
@@ -177,20 +182,18 @@
ui->trustScopeList->setColumnHidden(1, true);
ui->trustScopeList->show();
- if(isIntro)
- {
- ui->isIntroducer->setChecked(true);
- ui->addScope->setEnabled(true);
- ui->deleteScope->setEnabled(true);
- ui->trustScopeList->setEnabled(true);
- }
- else
- {
- ui->isIntroducer->setChecked(false);
- ui->addScope->setEnabled(false);
- ui->deleteScope->setEnabled(false);
- ui->trustScopeList->setEnabled(false);
- }
+ if (isIntro) {
+ ui->isIntroducer->setChecked(true);
+ ui->addScope->setEnabled(true);
+ ui->deleteScope->setEnabled(true);
+ ui->trustScopeList->setEnabled(true);
+ }
+ else {
+ ui->isIntroducer->setChecked(false);
+ ui->addScope->setEnabled(false);
+ ui->deleteScope->setEnabled(false);
+ ui->trustScopeList->setEnabled(false);
+ }
QString filter2 = QString("profile_identity = '%1'").arg(identity);
m_endorseDataModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
@@ -215,21 +218,18 @@
QString alias = m_contactListModel->data(items.first(), Qt::DisplayRole).toString();
bool contactFound = false;
- for(int i = 0; i < m_contactAliasList.size(); i++)
- {
- if(alias == m_contactAliasList[i])
- {
- contactFound = true;
- m_currentSelectedContact = m_contactIdList[i];
- break;
- }
+ for (int i = 0; i < m_contactAliasList.size(); i++) {
+ if (alias == m_contactAliasList[i]) {
+ contactFound = true;
+ m_currentSelectedContact = m_contactIdList[i];
+ break;
}
+ }
- if(!contactFound)
- {
- emit warning("This should not happen: ContactPanel::updateSelection #1");
- return;
- }
+ if (!contactFound) {
+ emit warning("This should not happen: ContactPanel::updateSelection #1");
+ return;
+ }
emit waitForContactInfo(m_currentSelectedContact);
}
@@ -253,13 +253,12 @@
void
ContactPanel::onSetAliasDialogRequested()
{
- for(int i = 0; i < m_contactIdList.size(); i++)
- if(m_contactIdList[i] == m_currentSelectedContact)
- {
- m_setAliasDialog->setTargetIdentity(m_currentSelectedContact, m_contactAliasList[i]);
- m_setAliasDialog->show();
- return;
- }
+ for (int i = 0; i < m_contactIdList.size(); i++)
+ if (m_contactIdList[i] == m_currentSelectedContact) {
+ m_setAliasDialog->setTargetIdentity(m_currentSelectedContact, m_contactAliasList[i]);
+ m_setAliasDialog->show();
+ return;
+ }
}
void
@@ -267,36 +266,32 @@
{
QItemSelectionModel* selectionModel = ui->ContactList->selectionModel();
QModelIndexList selectedList = selectionModel->selectedIndexes();
- QModelIndexList::iterator it = selectedList.begin();
- for(; it != selectedList.end(); it++)
- {
- QString alias = m_contactListModel->data(*it, Qt::DisplayRole).toString();
- for(int i = 0; i < m_contactAliasList.size(); i++)
- if(m_contactAliasList[i] == alias)
- {
- emit removeContact(m_contactIdList[i]);
- return;
- }
- }
+
+ for (QModelIndexList::iterator it = selectedList.begin(); it != selectedList.end(); it++) {
+ QString alias = m_contactListModel->data(*it, Qt::DisplayRole).toString();
+ for (int i = 0; i < m_contactAliasList.size(); i++)
+ if (m_contactAliasList[i] == alias) {
+ emit removeContact(m_contactIdList[i]);
+ return;
+ }
+ }
}
void
ContactPanel::onIsIntroducerChanged(int state)
{
- if(state == Qt::Checked)
- {
- ui->addScope->setEnabled(true);
- ui->deleteScope->setEnabled(true);
- ui->trustScopeList->setEnabled(true);
- emit updateIsIntroducer(m_currentSelectedContact, true);
- }
- else
- {
- ui->addScope->setEnabled(false);
- ui->deleteScope->setEnabled(false);
- ui->trustScopeList->setEnabled(false);
- emit updateIsIntroducer(m_currentSelectedContact, false);
- }
+ if (state == Qt::Checked) {
+ ui->addScope->setEnabled(true);
+ ui->deleteScope->setEnabled(true);
+ ui->trustScopeList->setEnabled(true);
+ emit updateIsIntroducer(m_currentSelectedContact, true);
+ }
+ else {
+ ui->addScope->setEnabled(false);
+ ui->deleteScope->setEnabled(false);
+ ui->trustScopeList->setEnabled(false);
+ emit updateIsIntroducer(m_currentSelectedContact, false);
+ }
}
void
@@ -317,8 +312,7 @@
QItemSelectionModel* selectionModel = ui->trustScopeList->selectionModel();
QModelIndexList indexList = selectionModel->selectedIndexes();
- int i = indexList.size() - 1;
- for(; i >= 0; i--)
+ for (int i = indexList.size() - 1; i >= 0; i--)
m_trustScopeModel->removeRow(indexList[i].row());
m_trustScopeModel->submitAll();
@@ -343,6 +337,8 @@
emit updateAlias(identity, alias);
}
+} // namespace chronos
+
#if WAF
#include "contact-panel.moc"
#include "contact-panel.cpp.moc"
diff --git a/src/contact-panel.h b/src/contact-panel.hpp
similarity index 85%
rename from src/contact-panel.h
rename to src/contact-panel.hpp
index f47287f..a7a3241 100644
--- a/src/contact-panel.h
+++ b/src/contact-panel.hpp
@@ -8,15 +8,15 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef CONTACT_PANEL_H
-#define CONTACT_PANEL_H
+#ifndef CHRONOS_CONTACT_PANEL_HPP
+#define CHRONOS_CONTACT_PANEL_HPP
#include <QDialog>
#include <QStringListModel>
#include <QSqlTableModel>
-#include "set-alias-dialog.h"
-#include "endorse-combobox-delegate.h"
+#include "set-alias-dialog.hpp"
+#include "endorse-combobox-delegate.hpp"
#ifndef Q_MOC_RUN
#endif
@@ -25,13 +25,15 @@
class ContactPanel;
}
+namespace chronos {
+
class ContactPanel : public QDialog
{
Q_OBJECT
public:
explicit
- ContactPanel(QWidget *parent = 0);
+ ContactPanel(QWidget* parent = 0);
virtual
~ContactPanel();
@@ -83,8 +85,8 @@
private slots:
void
- onSelectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected);
+ onSelectionChanged(const QItemSelection& selected,
+ const QItemSelection& deselected);
void
onContextMenuRequested(const QPoint& pos);
@@ -137,4 +139,6 @@
QString m_currentSelectedContact;
};
-#endif // CONTACT_PANEL_H
+} // namespace chronos
+
+#endif // CHRONOS_CONTACT_PANEL_HPP
diff --git a/src/contact-storage.cpp b/src/contact-storage.cpp
index aaf8b79..8f37079 100644
--- a/src/contact-storage.cpp
+++ b/src/contact-storage.cpp
@@ -8,133 +8,168 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "contact-storage.h"
+#include "contact-storage.hpp"
#include <boost/filesystem.hpp>
-#include <cryptopp/sha.h>
-#include <cryptopp/filters.h>
-#include <cryptopp/hex.h>
-#include <cryptopp/files.h>
+#include "cryptopp.hpp"
#include "logging.h"
-using namespace ndn;
+
+// INIT_LOGGER ("chronos.ContactStorage");
+
+namespace chronos {
+
namespace fs = boost::filesystem;
-INIT_LOGGER ("chronos.ContactStorage");
+using std::string;
+using std::vector;
-namespace chronos{
+using ndn::PublicKey;
-using ndn::shared_ptr;
+// user's own profile;
+const string INIT_SP_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " SelfProfile( "
+ " profile_type BLOB NOT NULL, "
+ " profile_value BLOB NOT NULL, "
+ " PRIMARY KEY (profile_type) "
+ " ); "
+ "CREATE INDEX sp_index ON SelfProfile(profile_type); ";
-const std::string INIT_SP_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- SelfProfile( \n \
- profile_type BLOB NOT NULL, \n \
- profile_value BLOB NOT NULL, \n \
- \
- PRIMARY KEY (profile_type) \n \
- ); \n \
- \
-CREATE INDEX sp_index ON SelfProfile(profile_type); \n \
-"; // user's own profile;
+// user's self endorse cert;
+const string INIT_SE_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " SelfEndorse( "
+ " identity BLOB NOT NULL UNIQUE, "
+ " endorse_data BLOB NOT NULL, "
+ " PRIMARY KEY (identity) "
+ " ); "
+ "CREATE INDEX se_index ON SelfEndorse(identity); ";
-const std::string INIT_SE_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- SelfEndorse( \n \
- identity BLOB NOT NULL UNIQUE, \n \
- endorse_data BLOB NOT NULL, \n \
- \
- PRIMARY KEY (identity) \n \
- ); \n \
-CREATE INDEX se_index ON SelfEndorse(identity); \n \
-"; // user's self endorse cert;
+// contact's basic info
+const string INIT_CONTACT_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " Contact( "
+ " contact_namespace BLOB NOT NULL, "
+ " contact_alias BLOB NOT NULL, "
+ " contact_keyName BLOB NOT NULL, "
+ " contact_key BLOB NOT NULL, "
+ " notBefore INTEGER DEFAULT 0, "
+ " notAfter INTEGER DEFAULT 0, "
+ " is_introducer INTEGER DEFAULT 0, "
+ " PRIMARY KEY (contact_namespace) "
+ " ); "
+ "CREATE INDEX contact_index ON Contact(contact_namespace); ";
-const std::string INIT_CONTACT_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- Contact( \n \
- contact_namespace BLOB NOT NULL, \n \
- contact_alias BLOB NOT NULL, \n \
- contact_keyName BLOB NOT NULL, \n \
- contact_key BLOB NOT NULL, \n \
- notBefore INTEGER DEFAULT 0, \n \
- notAfter INTEGER DEFAULT 0, \n \
- is_introducer INTEGER DEFAULT 0, \n \
- \
- PRIMARY KEY (contact_namespace) \n \
- ); \n \
- \
-CREATE INDEX contact_index ON Contact(contact_namespace); \n \
-"; // contact's basic info
+// contact's trust scope;
+const string INIT_TS_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " TrustScope( "
+ " id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ " contact_namespace BLOB NOT NULL, "
+ " trust_scope BLOB NOT NULL "
+ " ); "
+ "CREATE INDEX ts_index ON TrustScope(contact_namespace); ";
-const std::string INIT_TS_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- TrustScope( \n \
- id INTEGER PRIMARY KEY AUTOINCREMENT, \n \
- contact_namespace BLOB NOT NULL, \n \
- trust_scope BLOB NOT NULL \n \
- ); \n \
- \
-CREATE INDEX ts_index ON TrustScope(contact_namespace); \n \
-"; // contact's trust scope;
+// contact's profile
+const string INIT_CP_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " ContactProfile( "
+ " profile_identity BLOB NOT NULL, "
+ " profile_type BLOB NOT NULL, "
+ " profile_value BLOB NOT NULL, "
+ " endorse INTEGER NOT NULL, "
+ " PRIMARY KEY (profile_identity, profile_type) "
+ " ); "
+ "CREATE INDEX cp_index ON ContactProfile(profile_identity); ";
-const std::string INIT_CP_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- ContactProfile( \n \
- profile_identity BLOB NOT NULL, \n \
- profile_type BLOB NOT NULL, \n \
- profile_value BLOB NOT NULL, \n \
- endorse INTEGER NOT NULL, \n \
- \
- PRIMARY KEY (profile_identity, profile_type) \n \
- ); \n \
- \
-CREATE INDEX cp_index ON ContactProfile(profile_identity); \n \
-"; // contact's profile
+// user's endorsement on contacts
+const string INIT_PE_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " ProfileEndorse( "
+ " identity BLOB NOT NULL UNIQUE, "
+ " endorse_data BLOB NOT NULL, "
+ " PRIMARY KEY (identity) "
+ " ); "
+ "CREATE INDEX pe_index ON ProfileEndorse(identity); ";
-const std::string INIT_PE_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- ProfileEndorse( \n \
- identity BLOB NOT NULL UNIQUE, \n \
- endorse_data BLOB NOT NULL, \n \
- \
- PRIMARY KEY (identity) \n \
- ); \n \
- \
-CREATE INDEX pe_index ON ProfileEndorse(identity); \n \
-"; // user's endorsement on contacts
+// contact's endorsements on the user
+const string INIT_CE_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " CollectEndorse( "
+ " endorser BLOB NOT NULL, "
+ " endorse_name BLOB NOT NULL, "
+ " endorse_data BLOB NOT NULL, "
+ " PRIMARY KEY (endorser) "
+ " ); ";
-const std::string INIT_CE_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- CollectEndorse( \n \
- endorser BLOB NOT NULL, \n \
- endorse_name BLOB NOT NULL, \n \
- endorse_data BLOB NOT NULL, \n \
- \
- PRIMARY KEY (endorser) \n \
- ); \n \
-"; // contact's endorsements on the user
+// dns data;
+const string INIT_DD_TABLE =
+ "CREATE TABLE IF NOT EXISTS "
+ " DnsData( "
+ " dns_name BLOB NOT NULL, "
+ " dns_type BLOB NOT NULL, "
+ " data_name BLOB NOT NULL, "
+ " dns_value BLOB NOT NULL, "
+ " PRIMARY KEY (dns_name, dns_type) "
+ " ); "
+ "CREATE INDEX dd_index ON DnsData(dns_name, dns_type); "
+ "CREATE INDEX dd_index2 ON DnsData(data_name); ";
-const std::string INIT_DD_TABLE = "\
-CREATE TABLE IF NOT EXISTS \n \
- DnsData( \n \
- dns_name BLOB NOT NULL, \n \
- dns_type BLOB NOT NULL, \n \
- data_name BLOB NOT NULL, \n \
- dns_value BLOB NOT NULL, \n \
- \
- PRIMARY KEY (dns_name, dns_type) \n \
- ); \
-CREATE INDEX dd_index ON DnsData(dns_name, dns_type); \n \
-CREATE INDEX dd_index2 ON DnsData(data_name); \n \
-"; // dns data;
+/**
+ * A utility function to call the normal sqlite3_bind_text where the value and length are
+ * value.c_str() and value.size().
+ */
+static int
+sqlite3_bind_string(sqlite3_stmt* statement,
+ int index,
+ const string& value,
+ void(*destructor)(void*))
+{
+ return sqlite3_bind_text(statement, index, value.c_str(), value.size(), destructor);
+}
+
+/**
+ * A utility function to call the normal sqlite3_bind_blob where the value and length are
+ * block.wire() and block.size().
+ */
+static int
+sqlite3_bind_block(sqlite3_stmt* statement,
+ int index,
+ const Block& block,
+ void(*destructor)(void*))
+{
+ return sqlite3_bind_blob(statement, index, block.wire(), block.size(), destructor);
+}
+
+/**
+ * A utility function to generate string by calling the normal sqlite3_column_text.
+ */
+static string
+sqlite3_column_string(sqlite3_stmt* statement, int column)
+{
+ return string(reinterpret_cast<const char*>(sqlite3_column_text(statement, column)),
+ sqlite3_column_bytes(statement, column));
+}
+
+/**
+ * A utility function to generate block by calling the normal sqlite3_column_text.
+ */
+static Block
+sqlite3_column_block(sqlite3_stmt* statement, int column)
+{
+ return Block(reinterpret_cast<const char*>(sqlite3_column_blob(statement, column)),
+ sqlite3_column_bytes(statement, column));
+}
+
ContactStorage::ContactStorage(const Name& identity)
: m_identity(identity)
{
fs::path chronosDir = fs::path(getenv("HOME")) / ".chronos";
- fs::create_directories (chronosDir);
+ fs::create_directories(chronosDir);
- int res = sqlite3_open((chronosDir / getDBName()).c_str (), &m_db);
+ int res = sqlite3_open((chronosDir / getDBName()).c_str(), &m_db);
if (res != SQLITE_OK)
throw Error("Chronos DB cannot be open/created");
@@ -149,10 +184,10 @@
}
-std::string
+string
ContactStorage::getDBName()
{
- std::string dbName("chronos-");
+ string dbName("chronos-");
std::stringstream ss;
{
@@ -168,25 +203,26 @@
}
void
-ContactStorage::initializeTable(const std::string& tableName, const std::string& sqlCreateStmt)
+ContactStorage::initializeTable(const string& tableName, const string& sqlCreateStmt)
{
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT name FROM sqlite_master WHERE type='table' And name=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, tableName.c_str(), tableName.size(), SQLITE_TRANSIENT);
- int res = sqlite3_step (stmt);
+ sqlite3_prepare_v2(m_db,
+ "SELECT name FROM sqlite_master WHERE type='table' And name=?",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, tableName, SQLITE_TRANSIENT);
+ int res = sqlite3_step(stmt);
bool tableExist = false;
if (res == SQLITE_ROW)
- tableExist = true;
- sqlite3_finalize (stmt);
+ tableExist = true;
+ sqlite3_finalize(stmt);
- if(!tableExist)
- {
- char *errmsg = 0;
- res = sqlite3_exec (m_db, sqlCreateStmt.c_str (), NULL, NULL, &errmsg);
- if (res != SQLITE_OK && errmsg != 0)
- throw Error("Init \"error\" in " + tableName);
- }
+ if (!tableExist) {
+ char *errmsg = 0;
+ res = sqlite3_exec(m_db, sqlCreateStmt.c_str (), NULL, NULL, &errmsg);
+ if (res != SQLITE_OK && errmsg != 0)
+ throw Error("Init \"error\" in " + tableName);
+ }
}
shared_ptr<Profile>
@@ -194,15 +230,13 @@
{
shared_ptr<Profile> profile = make_shared<Profile>(m_identity);
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT profile_type, profile_value FROM SelfProfile", -1, &stmt, 0);
+ sqlite3_prepare_v2(m_db, "SELECT profile_type, profile_value FROM SelfProfile", -1, &stmt, 0);
- while( sqlite3_step (stmt) == SQLITE_ROW)
- {
- std::string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
- std::string profileValue(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
- (*profile)[profileType] = profileValue;
- }
-
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ string profileType = sqlite3_column_string(stmt, 0);
+ string profileValue = sqlite3_column_string (stmt, 1);
+ (*profile)[profileType] = profileValue;
+ }
sqlite3_finalize(stmt);
return profile;
@@ -211,29 +245,31 @@
void
ContactStorage::addSelfEndorseCertificate(const EndorseCertificate& newEndorseCertificate)
{
- const Block& newEndorseCertificateBlock = newEndorseCertificate.wireEncode();
-
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO SelfEndorse (identity, endorse_data) values (?, ?)", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, m_identity.toUri().c_str(), m_identity.toUri().size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, reinterpret_cast<const char*>(newEndorseCertificateBlock.wire()), newEndorseCertificateBlock.size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "INSERT OR REPLACE INTO SelfEndorse (identity, endorse_data) values (?, ?)",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, m_identity.toUri(), SQLITE_TRANSIENT);
+ sqlite3_bind_block(stmt, 2, newEndorseCertificate.wireEncode(), SQLITE_TRANSIENT);
int res = sqlite3_step(stmt);
- sqlite3_finalize (stmt);
+ sqlite3_finalize(stmt);
}
void
-ContactStorage::addEndorseCertificate(const EndorseCertificate& endorseCertificate, const Name& identity)
+ContactStorage::addEndorseCertificate(const EndorseCertificate& endorseCertificate,
+ const Name& identity)
{
- const Block& newEndorseCertificateBlock = endorseCertificate.wireEncode();
-
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO ProfileEndorse (identity, endorse_data) values (?, ?)", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, reinterpret_cast<const char*>(newEndorseCertificateBlock.wire()), newEndorseCertificateBlock.size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "INSERT OR REPLACE INTO ProfileEndorse \
+ (identity, endorse_data) values (?, ?)",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity.toUri(), SQLITE_TRANSIENT);
+ sqlite3_bind_block(stmt, 2, endorseCertificate.wireEncode(), SQLITE_TRANSIENT);
sqlite3_step(stmt);
- sqlite3_finalize (stmt);
+ sqlite3_finalize(stmt);
}
void
@@ -243,13 +279,17 @@
Name certName = endorseCertificate.getName();
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO CollectEndorse (endorser, endorse_name, endorse_data) VALUES (?, ?, ?, ?)", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, endorserName.toUri().c_str(), endorserName.toUri().size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, certName.toUri().c_str(), certName.toUri().size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "INSERT OR REPLACE INTO CollectEndorse \
+ (endorser, endorse_name, endorse_data) \
+ VALUES (?, ?, ?, ?)",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, endorserName.toUri(), SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, certName.toUri(), SQLITE_TRANSIENT);
const Block &block = endorseCertificate.wireEncode();
- sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(block.wire()), block.size(), SQLITE_TRANSIENT);
- int res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_bind_block(stmt, 3, endorseCertificate.wireEncode(), SQLITE_TRANSIENT);
+ int res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
return;
}
@@ -257,131 +297,125 @@
ContactStorage::getCollectEndorse(EndorseCollection& endorseCollection)
{
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT endorse_name, endorse_data FROM CollectEndorse", -1, &stmt, 0);
+ sqlite3_prepare_v2(m_db, "SELECT endorse_name, endorse_data FROM CollectEndorse", -1, &stmt, 0);
- while(sqlite3_step (stmt) == SQLITE_ROW)
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ string certName = sqlite3_column_string(stmt, 0);
+ std::stringstream ss;
{
- std::string certName(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 1));
- std::stringstream ss;
- {
- using namespace CryptoPP;
- SHA256 hash;
+ using namespace CryptoPP;
+ SHA256 hash;
- StringSource(sqlite3_column_text(stmt, 1), sqlite3_column_bytes (stmt, 0), true,
- new HashFilter(hash, new FileSink(ss)));
- }
- EndorseCollection::Endorsement* endorsement = endorseCollection.add_endorsement();
- endorsement->set_certname(certName);
- endorsement->set_hash(ss.str());
+ StringSource(sqlite3_column_text(stmt, 1), sqlite3_column_bytes (stmt, 1), true,
+ new HashFilter(hash, new FileSink(ss)));
}
+ EndorseCollection::Endorsement* endorsement = endorseCollection.add_endorsement();
+ endorsement->set_certname(certName);
+ endorsement->set_hash(ss.str());
+ }
- sqlite3_finalize (stmt);
+ sqlite3_finalize(stmt);
}
void
-ContactStorage::getEndorseList(const Name& identity, std::vector<std::string>& endorseList)
+ContactStorage::getEndorseList(const Name& identity, vector<string>& endorseList)
{
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT profile_type FROM ContactProfile WHERE profile_identity=? AND endorse=1 ORDER BY profile_type", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "SELECT profile_type FROM ContactProfile \
+ WHERE profile_identity=? AND endorse=1 ORDER BY profile_type",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity.toUri(), SQLITE_TRANSIENT);
- while( sqlite3_step (stmt) == SQLITE_ROW)
- {
- std::string profileType(reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
- endorseList.push_back(profileType);
- }
- sqlite3_finalize (stmt);
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ string profileType = sqlite3_column_string(stmt, 0);
+ endorseList.push_back(profileType);
+ }
+ sqlite3_finalize(stmt);
}
void
ContactStorage::removeContact(const Name& identityName)
{
- std::string identity = identityName.toUri();
+ string identity = identityName.toUri();
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "DELETE FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
- int res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_prepare_v2(m_db, "DELETE FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
+ int res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
- sqlite3_prepare_v2 (m_db, "DELETE FROM ContactProfile WHERE profile_identity=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
- res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_prepare_v2(m_db, "DELETE FROM ContactProfile WHERE profile_identity=?", -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
+ res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
- sqlite3_prepare_v2 (m_db, "DELETE FROM TrustScope WHERE contact_namespace=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
- res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_prepare_v2(m_db, "DELETE FROM TrustScope WHERE contact_namespace=?", -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
+ res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
}
void
ContactStorage::addContact(const Contact& contact)
{
- if(doesContactExist(contact.getNameSpace()))
+ if (doesContactExist(contact.getNameSpace()))
throw Error("Normal Contact has already existed");
- std::string identity = contact.getNameSpace().toUri();
+ string identity = contact.getNameSpace().toUri();
bool isIntroducer = contact.isIntroducer();
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db,
- "INSERT INTO Contact (contact_namespace, contact_alias, contact_keyName, contact_key, notBefore, notAfter, is_introducer) values (?, ?, ?, ?, ?, ?, ?)",
- -1,
- &stmt,
- 0);
+ sqlite3_prepare_v2(m_db,
+ "INSERT INTO Contact (contact_namespace, contact_alias, contact_keyName, \
+ contact_key, notBefore, notAfter, is_introducer) \
+ values (?, ?, ?, ?, ?, ?, ?)",
+ -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, contact.getAlias().c_str(), contact.getAlias().size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 3, contact.getPublicKeyName().toUri().c_str(), contact.getPublicKeyName().toUri().size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 4, reinterpret_cast<const char*>(contact.getPublicKey().get().buf()), contact.getPublicKey().get().size(), SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, contact.getAlias(), SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 3, contact.getPublicKeyName().toUri(), SQLITE_TRANSIENT);
+ sqlite3_bind_text(stmt, 4,
+ reinterpret_cast<const char*>(contact.getPublicKey().get().buf()),
+ contact.getPublicKey().get().size(), SQLITE_TRANSIENT);
sqlite3_bind_int64(stmt, 5, time::toUnixTimestamp(contact.getNotBefore()).count());
sqlite3_bind_int64(stmt, 6, time::toUnixTimestamp(contact.getNotAfter()).count());
sqlite3_bind_int(stmt, 7, (isIntroducer ? 1 : 0));
- int res = sqlite3_step (stmt);
+ int res = sqlite3_step(stmt);
- // _LOG_DEBUG("addContact: " << res);
-
- sqlite3_finalize (stmt);
+ sqlite3_finalize(stmt);
const Profile& profile = contact.getProfile();
- Profile::const_iterator it = profile.begin();
+ for (Profile::const_iterator it = profile.begin(); it != profile.end(); it++) {
+ sqlite3_prepare_v2(m_db,
+ "INSERT INTO ContactProfile \
+ (profile_identity, profile_type, profile_value, endorse) \
+ values (?, ?, ?, 0)",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, it->first, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 3, it->second, SQLITE_TRANSIENT);
+ res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
+ }
- for(; it != profile.end(); it++)
- {
- sqlite3_prepare_v2 (m_db,
- "INSERT INTO ContactProfile (profile_identity, profile_type, profile_value, endorse) values (?, ?, ?, 0)",
- -1,
- &stmt,
- 0);
- sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, it->first.c_str(), it->first.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 3, it->second.c_str(), it->second.size(), SQLITE_TRANSIENT);
- res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ if (isIntroducer) {
+ Contact::const_iterator it = contact.trustScopeBegin();
+ Contact::const_iterator end = contact.trustScopeEnd();
+
+ while (it != end) {
+ sqlite3_prepare_v2(m_db,
+ "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, it->first.toUri(), SQLITE_TRANSIENT);
+ res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
+ it++;
}
-
- if(isIntroducer)
- {
- Contact::const_iterator it = contact.trustScopeBegin();
- Contact::const_iterator end = contact.trustScopeEnd();
-
- while(it != end)
- {
- sqlite3_prepare_v2 (m_db,
- "INSERT INTO TrustScope (contact_namespace, trust_scope) values (?, ?)",
- -1,
- &stmt,
- 0);
- sqlite3_bind_text(stmt, 1, identity.c_str(), identity.size (), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, it->first.toUri().c_str(), it->first.toUri().size(), SQLITE_TRANSIENT);
- res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
- it++;
- }
- }
+ }
}
@@ -392,46 +426,53 @@
Profile profile;
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT contact_alias, contact_keyName, contact_key, notBefore, notAfter, is_introducer FROM Contact where contact_namespace=?", -1, &stmt, 0);
- sqlite3_bind_text (stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "SELECT contact_alias, contact_keyName, contact_key, notBefore, notAfter, \
+ is_introducer FROM Contact where contact_namespace=?",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity.toUri(), SQLITE_TRANSIENT);
- if(sqlite3_step (stmt) == SQLITE_ROW)
- {
- std::string alias(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
- std::string keyName(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
- PublicKey key(sqlite3_column_text(stmt, 2), sqlite3_column_bytes (stmt, 2));
- time::system_clock::TimePoint notBefore = time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 3)));
- time::system_clock::TimePoint notAfter = time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 4)));
- int isIntroducer = sqlite3_column_int (stmt, 5);
+ if (sqlite3_step(stmt) == SQLITE_ROW) {
+ string alias = sqlite3_column_string(stmt, 0);
+ string keyName = sqlite3_column_string(stmt, 1);
+ PublicKey key(sqlite3_column_text(stmt, 2), sqlite3_column_bytes (stmt, 2));
+ time::system_clock::TimePoint notBefore =
+ time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 3)));
+ time::system_clock::TimePoint notAfter =
+ time::fromUnixTimestamp(time::milliseconds(sqlite3_column_int64 (stmt, 4)));
+ int isIntroducer = sqlite3_column_int (stmt, 5);
- contact = shared_ptr<Contact>(new Contact(identity, alias, Name(keyName), notBefore, notAfter, key, isIntroducer));
- }
- sqlite3_finalize (stmt);
+ contact = make_shared<Contact>(identity, alias, Name(keyName),
+ notBefore, notAfter, key, isIntroducer);
+ }
+ sqlite3_finalize(stmt);
- sqlite3_prepare_v2 (m_db, "SELECT profile_type, profile_value FROM ContactProfile where profile_identity=?", -1, &stmt, 0);
- sqlite3_bind_text (stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "SELECT profile_type, profile_value FROM ContactProfile \
+ where profile_identity=?",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity.toUri(), SQLITE_TRANSIENT);
- while(sqlite3_step (stmt) == SQLITE_ROW)
- {
- std::string type(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0));
- std::string value(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)), sqlite3_column_bytes (stmt, 1));
- profile[type] = value;
- }
- sqlite3_finalize (stmt);
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ string type = sqlite3_column_string(stmt, 0);
+ string value = sqlite3_column_string(stmt, 1);
+ profile[type] = value;
+ }
+ sqlite3_finalize(stmt);
contact->setProfile(profile);
- if(contact->isIntroducer())
- {
- sqlite3_prepare_v2 (m_db, "SELECT trust_scope FROM TrustScope WHERE contact_namespace=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, identity.toUri().c_str(), identity.toUri().size(), SQLITE_TRANSIENT);
+ if (contact->isIntroducer()) {
+ sqlite3_prepare_v2(m_db,
+ "SELECT trust_scope FROM TrustScope WHERE contact_namespace=?",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, identity.toUri(), SQLITE_TRANSIENT);
- while(sqlite3_step (stmt) == SQLITE_ROW)
- {
- Name scope(std::string(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
- contact->addTrustScope(scope);
- }
- sqlite3_finalize (stmt);
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ Name scope(sqlite3_column_string(stmt, 0));
+ contact->addTrustScope(scope);
}
+ sqlite3_finalize(stmt);
+ }
return contact;
}
@@ -441,23 +482,25 @@
ContactStorage::updateIsIntroducer(const Name& identity, bool isIntroducer)
{
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "UPDATE Contact SET is_introducer=? WHERE contact_namespace=?", -1, &stmt, 0);
+ sqlite3_prepare_v2(m_db, "UPDATE Contact SET is_introducer=? WHERE contact_namespace=?",
+ -1, &stmt, 0);
sqlite3_bind_int(stmt, 1, (isIntroducer ? 1 : 0));
- sqlite3_bind_text(stmt, 2, identity.toUri().c_str(), identity.toUri().size (), SQLITE_TRANSIENT);
- int res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_bind_string(stmt, 2, identity.toUri(), SQLITE_TRANSIENT);
+ int res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
return;
}
void
-ContactStorage::updateAlias(const Name& identity, std::string alias)
+ContactStorage::updateAlias(const Name& identity, const string& alias)
{
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "UPDATE Contact SET contact_alias=? WHERE contact_namespace=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, alias.c_str(), alias.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, identity.toUri().c_str(), identity.toUri().size (), SQLITE_TRANSIENT);
- int res = sqlite3_step (stmt);
- sqlite3_finalize (stmt);
+ sqlite3_prepare_v2(m_db, "UPDATE Contact SET contact_alias=? WHERE contact_namespace=?",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, alias, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, identity.toUri(), SQLITE_TRANSIENT);
+ int res = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
return;
}
@@ -467,61 +510,57 @@
bool result = false;
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT count(*) FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, name.toUri().c_str(), name.toUri().size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db, "SELECT count(*) FROM Contact WHERE contact_namespace=?", -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, name.toUri(), SQLITE_TRANSIENT);
- int res = sqlite3_step (stmt);
+ int res = sqlite3_step(stmt);
- if (res == SQLITE_ROW)
- {
- int countAll = sqlite3_column_int (stmt, 0);
- if (countAll > 0)
- result = true;
- }
- sqlite3_finalize (stmt);
+ if (res == SQLITE_ROW) {
+ int countAll = sqlite3_column_int (stmt, 0);
+ if (countAll > 0)
+ result = true;
+ }
+
+ sqlite3_finalize(stmt);
return result;
}
void
-ContactStorage::getAllContacts(std::vector<shared_ptr<Contact> >& contacts) const
+ContactStorage::getAllContacts(vector<shared_ptr<Contact> >& contacts) const
{
- std::vector<Name> contactNames;
+ vector<Name> contactNames;
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT contact_namespace FROM Contact", -1, &stmt, 0);
+ sqlite3_prepare_v2(m_db, "SELECT contact_namespace FROM Contact", -1, &stmt, 0);
- while(sqlite3_step (stmt) == SQLITE_ROW)
- {
- std::string identity(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes(stmt, 0));
- contactNames.push_back(Name(identity));
- }
- sqlite3_finalize (stmt);
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ string identity = sqlite3_column_string(stmt, 0);
+ contactNames.push_back(Name(identity));
+ }
+ sqlite3_finalize(stmt);
- std::vector<Name>::iterator it = contactNames.begin();
- std::vector<Name>::iterator end = contactNames.end();
- for(; it != end; it++)
- {
- shared_ptr<Contact> contact = getContact(*it);
- if(static_cast<bool>(contact))
- contacts.push_back(contact);
- }
+ for (vector<Name>::iterator it = contactNames.begin(); it != contactNames.end(); it++) {
+ shared_ptr<Contact> contact = getContact(*it);
+ if (static_cast<bool>(contact))
+ contacts.push_back(contact);
+ }
}
void
-ContactStorage::updateDnsData(const Block& data,
- const std::string& name,
- const std::string& type,
- const std::string& dataName)
+ContactStorage::updateDnsData(const Block& data, const string& name,
+ const string& type, const string& dataName)
{
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "INSERT OR REPLACE INTO DnsData (dns_name, dns_type, dns_value, data_name) VALUES (?, ?, ?, ?)", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, name.c_str(), name.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, type.c_str(), type.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 3, reinterpret_cast<const char*>(data.wire()), data.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 4, dataName.c_str(), dataName.size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db,
+ "INSERT OR REPLACE INTO DnsData (dns_name, dns_type, dns_value, data_name) \
+ VALUES (?, ?, ?, ?)",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, name, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, type, SQLITE_TRANSIENT);
+ sqlite3_bind_block(stmt, 3, data, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 4, dataName, SQLITE_TRANSIENT);
int res = sqlite3_step(stmt);
- // _LOG_DEBUG("updateDnsData " << res);
sqlite3_finalize(stmt);
}
@@ -531,37 +570,36 @@
shared_ptr<Data> data;
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT dns_value FROM DnsData where data_name=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, dataName.toUri().c_str(), dataName.toUri().size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db, "SELECT dns_value FROM DnsData where data_name=?", -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, dataName.toUri(), SQLITE_TRANSIENT);
- if(sqlite3_step (stmt) == SQLITE_ROW)
- {
- data = make_shared<Data>();
- data->wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
- }
+ if (sqlite3_step(stmt) == SQLITE_ROW) {
+ data = make_shared<Data>();
+ data->wireDecode(sqlite3_column_block(stmt, 0));
+ }
sqlite3_finalize(stmt);
return data;
}
shared_ptr<Data>
-ContactStorage::getDnsData(const std::string& name, const std::string& type)
+ContactStorage::getDnsData(const string& name, const string& type)
{
shared_ptr<Data> data;
sqlite3_stmt *stmt;
- sqlite3_prepare_v2 (m_db, "SELECT dns_value FROM DnsData where dns_name=? and dns_type=?", -1, &stmt, 0);
- sqlite3_bind_text(stmt, 1, name.c_str(), name.size(), SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, type.c_str(), type.size(), SQLITE_TRANSIENT);
+ sqlite3_prepare_v2(m_db, "SELECT dns_value FROM DnsData where dns_name=? and dns_type=?",
+ -1, &stmt, 0);
+ sqlite3_bind_string(stmt, 1, name, SQLITE_TRANSIENT);
+ sqlite3_bind_string(stmt, 2, type, SQLITE_TRANSIENT);
- if(sqlite3_step (stmt) == SQLITE_ROW)
- {
- data = make_shared<Data>();
- data->wireDecode(Block(reinterpret_cast<const uint8_t*>(sqlite3_column_text(stmt, 0)), sqlite3_column_bytes (stmt, 0)));
- }
+ if (sqlite3_step(stmt) == SQLITE_ROW) {
+ data = make_shared<Data>();
+ data->wireDecode(sqlite3_column_block(stmt, 0));
+ }
sqlite3_finalize(stmt);
return data;
}
-}//chronos
+} // namespace chronos
diff --git a/src/contact-storage.h b/src/contact-storage.h
deleted file mode 100644
index 1dd4804..0000000
--- a/src/contact-storage.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef CHRONOS_CONTACT_STORAGE_H
-#define CHRONOS_CONTACT_STORAGE_H
-
-#include "contact.h"
-#include "endorse-collection.pb.h"
-#include <sqlite3.h>
-
-namespace chronos{
-
-class ContactStorage
-{
-
-public:
- struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
-
- ContactStorage(const ndn::Name& identity);
-
- ~ContactStorage()
- {
- sqlite3_close(m_db);
- }
-
- ndn::shared_ptr<Profile>
- getSelfProfile();
-
- void
- addSelfEndorseCertificate(const EndorseCertificate& endorseCertificate);
-
- void
- addEndorseCertificate(const EndorseCertificate& endorseCertificate, const ndn::Name& identity);
-
- void
- updateCollectEndorse(const EndorseCertificate& endorseCertificate);
-
- void
- getCollectEndorse(EndorseCollection& endorseCollection);
-
- void
- getEndorseList(const ndn::Name& identity, std::vector<std::string>& endorseList);
-
-
-
- void
- removeContact(const ndn::Name& identity);
-
- void
- addContact(const Contact& contact);
-
- ndn::shared_ptr<Contact>
- getContact(const ndn::Name& identity) const;
-
- void
- updateIsIntroducer(const ndn::Name& identity, bool isIntroducer);
-
- void
- updateAlias(const ndn::Name& identity, std::string alias);
-
- void
- getAllContacts(std::vector<ndn::shared_ptr<Contact> >& contacts) const;
-
- void
- updateDnsSelfProfileData(const ndn::Data& data)
- {
- updateDnsData(data.wireEncode(), "N/A", "PROFILE", data.getName().toUri());
- }
-
- void
- updateDnsEndorseOthers(const ndn::Data& data, const std::string& endorsee)
- {
- updateDnsData(data.wireEncode(), endorsee, "ENDORSEE", data.getName().toUri());
- }
-
- void
- updateDnsOthersEndorse(const ndn::Data& data)
- {
- updateDnsData(data.wireEncode(), "N/A", "ENDORSED", data.getName().toUri());
- }
-
- ndn::shared_ptr<ndn::Data>
- getDnsData(const ndn::Name& name);
-
- ndn::shared_ptr<ndn::Data>
- getDnsData(const std::string& name, const std::string& type);
-
-private:
- std::string
- getDBName();
-
- void
- initializeTable(const std::string& tableName, const std::string& sqlCreateStmt);
-
- bool
- doesContactExist(const ndn::Name& name);
-
- void
- updateDnsData(const ndn::Block& data, const std::string& name, const std::string& type, const std::string& dataName);
-
-private:
- ndn::Name m_identity;
-
- sqlite3 *m_db;
-};
-
-}//chronos
-#endif
diff --git a/src/contact-storage.hpp b/src/contact-storage.hpp
new file mode 100644
index 0000000..da13d4b
--- /dev/null
+++ b/src/contact-storage.hpp
@@ -0,0 +1,124 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_CONTACT_STORAGE_HPP
+#define CHRONOS_CONTACT_STORAGE_HPP
+
+#include "contact.hpp"
+#include "endorse-collection.pb.h"
+#include <sqlite3.h>
+
+namespace chronos{
+
+class ContactStorage
+{
+
+public:
+ class Error : public std::runtime_error
+ {
+ public:
+ Error(const std::string &what)
+ : std::runtime_error(what)
+ {
+ }
+ };
+
+ ContactStorage(const Name& identity);
+
+ ~ContactStorage()
+ {
+ sqlite3_close(m_db);
+ }
+
+ shared_ptr<Profile>
+ getSelfProfile();
+
+ void
+ addSelfEndorseCertificate(const EndorseCertificate& endorseCertificate);
+
+ void
+ addEndorseCertificate(const EndorseCertificate& endorseCertificate, const Name& identity);
+
+ void
+ updateCollectEndorse(const EndorseCertificate& endorseCertificate);
+
+ void
+ getCollectEndorse(EndorseCollection& endorseCollection);
+
+ void
+ getEndorseList(const Name& identity, std::vector<std::string>& endorseList);
+
+ void
+ removeContact(const Name& identity);
+
+ void
+ addContact(const Contact& contact);
+
+ shared_ptr<Contact>
+ getContact(const Name& identity) const;
+
+ void
+ updateIsIntroducer(const Name& identity, bool isIntroducer);
+
+ void
+ updateAlias(const Name& identity, const std::string& alias);
+
+ void
+ getAllContacts(std::vector<shared_ptr<Contact> >& contacts) const;
+
+ void
+ updateDnsSelfProfileData(const Data& data)
+ {
+ updateDnsData(data.wireEncode(), "N/A", "PROFILE", data.getName().toUri());
+ }
+
+ void
+ updateDnsEndorseOthers(const Data& data, const std::string& endorsee)
+ {
+ updateDnsData(data.wireEncode(), endorsee, "ENDORSEE", data.getName().toUri());
+ }
+
+ void
+ updateDnsOthersEndorse(const Data& data)
+ {
+ updateDnsData(data.wireEncode(), "N/A", "ENDORSED", data.getName().toUri());
+ }
+
+ shared_ptr<Data>
+ getDnsData(const Name& name);
+
+ shared_ptr<Data>
+ getDnsData(const std::string& name, const std::string& type);
+
+private:
+ std::string
+ getDBName();
+
+ void
+ initializeTable(const std::string& tableName, const std::string& sqlCreateStmt);
+
+ bool
+ doesContactExist(const Name& name);
+
+ void
+ updateDnsData(const Block& data,
+ const std::string& name,
+ const std::string& type,
+ const std::string& dataName);
+
+private:
+ Name m_identity;
+
+ sqlite3 *m_db;
+};
+
+}//chronos
+
+#endif // CHRONOS_CONTACT_STORAGE_HPP
diff --git a/src/contact.h b/src/contact.hpp
similarity index 77%
rename from src/contact.h
rename to src/contact.hpp
index a95ad42..8052ac7 100644
--- a/src/contact.h
+++ b/src/contact.hpp
@@ -8,21 +8,21 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef CHRONOS_CONTACT_H
-#define CHRONOS_CONTACT_H
+#ifndef CHRONOS_CONTACT_HPP
+#define CHRONOS_CONTACT_HPP
+#include "common.hpp"
#include <ndn-cxx/security/identity-certificate.hpp>
#include <ndn-cxx/util/regex.hpp>
-#include "endorse-certificate.h"
-#include <vector>
+#include "endorse-certificate.hpp"
-namespace chronos{
+namespace chronos {
class Contact
{
public:
- typedef std::map<ndn::Name, ndn::shared_ptr<ndn::Regex> >::const_iterator const_iterator;
- typedef std::map<ndn::Name, ndn::shared_ptr<ndn::Regex> >::iterator iterator;
+ typedef std::map<Name, shared_ptr<ndn::Regex> >::const_iterator const_iterator;
+ typedef std::map<Name, shared_ptr<ndn::Regex> >::iterator iterator;
Contact(const ndn::IdentityCertificate& identityCertificate,
bool isIntroducer = false,
@@ -59,11 +59,11 @@
m_publicKey = endorseCertificate.getPublicKeyInfo();
}
- Contact(const ndn::Name& identity,
+ Contact(const Name& identity,
const std::string& alias,
- const ndn::Name& keyName,
- const ndn::time::system_clock::TimePoint& notBefore,
- const ndn::time::system_clock::TimePoint& notAfter,
+ const Name& keyName,
+ const time::system_clock::TimePoint& notBefore,
+ const time::system_clock::TimePoint& notAfter,
const ndn::PublicKey& key,
bool isIntroducer)
: m_namespace(identity)
@@ -88,13 +88,15 @@
, m_isIntroducer(contact.m_isIntroducer)
, m_profile(contact.m_profile)
, m_trustScope(contact.m_trustScope)
- {}
+ {
+ }
virtual
~Contact()
- {}
+ {
+ }
- const ndn::Name&
+ const Name&
getNameSpace() const
{
return m_namespace;
@@ -118,7 +120,7 @@
return m_institution;
}
- const ndn::Name&
+ const Name&
getPublicKeyName() const
{
return m_keyName;
@@ -130,13 +132,13 @@
return m_publicKey;
}
- const ndn::time::system_clock::TimePoint&
+ const time::system_clock::TimePoint&
getNotBefore() const
{
return m_notBefore;
}
- const ndn::time::system_clock::TimePoint&
+ const time::system_clock::TimePoint&
getNotAfter() const
{
return m_notAfter;
@@ -169,24 +171,23 @@
}
void
- addTrustScope(const ndn::Name& nameSpace)
+ addTrustScope(const Name& nameSpace)
{
m_trustScope[nameSpace] = ndn::Regex::fromName(nameSpace);
}
void
- deleteTrustScope(const ndn::Name& nameSpace)
+ deleteTrustScope(const Name& nameSpace)
{
m_trustScope.erase(nameSpace);
}
bool
- canBeTrustedFor(const ndn::Name& name)
+ canBeTrustedFor(const Name& name)
{
- std::map<ndn::Name, ndn::shared_ptr<ndn::Regex> >::iterator it = m_trustScope.begin();
-
- for(; it != m_trustScope.end(); it++)
- if(it->second->match(name))
+ for (std::map<Name, shared_ptr<ndn::Regex> >::iterator it = m_trustScope.begin();
+ it != m_trustScope.end(); it++)
+ if (it->second->match(name))
return true;
return false;
}
@@ -216,16 +217,16 @@
}
protected:
- typedef std::map<ndn::Name, ndn::shared_ptr<ndn::Regex> > TrustScopes;
+ typedef std::map<Name, shared_ptr<ndn::Regex> > TrustScopes;
- ndn::Name m_namespace;
+ Name m_namespace;
std::string m_alias;
std::string m_name;
std::string m_institution;
- ndn::Name m_keyName;
+ Name m_keyName;
ndn::PublicKey m_publicKey;
- ndn::time::system_clock::TimePoint m_notBefore;
- ndn::time::system_clock::TimePoint m_notAfter;
+ time::system_clock::TimePoint m_notBefore;
+ time::system_clock::TimePoint m_notAfter;
bool m_isIntroducer;
Profile m_profile;
@@ -235,4 +236,4 @@
} // namespace chronos
-#endif // CHRONOS_CONTACT_H
+#endif // CHRONOS_CONTACT_HPP
diff --git a/src/controller.cpp b/src/controller.cpp
index 7517a4e..915e3d8 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -12,34 +12,34 @@
#include <QMessageBox>
#include <QDir>
#include <QTimer>
-#include "controller.h"
+#include "controller.hpp"
#ifndef Q_MOC_RUN
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <ndn-cxx/util/random.hpp>
-#include <cryptopp/sha.h>
-#include <cryptopp/hex.h>
-#include <cryptopp/files.h>
-#include <cryptopp/filters.h>
+#include "cryptopp.hpp"
#include "config.pb.h"
#include "endorse-info.pb.h"
#include "logging.h"
#endif
-INIT_LOGGER("chronos.Controller");
-
-using namespace ndn;
+// INIT_LOGGER("chronos.Controller");
Q_DECLARE_METATYPE(ndn::Name)
Q_DECLARE_METATYPE(ndn::IdentityCertificate)
-Q_DECLARE_METATYPE(chronos::EndorseInfo)
+Q_DECLARE_METATYPE(Chronos::EndorseInfo)
Q_DECLARE_METATYPE(ndn::Interest)
Q_DECLARE_METATYPE(size_t)
namespace chronos {
-using ndn::shared_ptr;
+using std::string;
+
+using ndn::Face;
+using ndn::IdentityCertificate;
+using ndn::OnInterestValidated;
+using ndn::OnInterestValidationFailed;
static const uint8_t ROUTING_PREFIX_SEPARATOR[2] = {0xF0, 0x2E};
@@ -60,7 +60,7 @@
{
qRegisterMetaType<ndn::Name>("ndn.Name");
qRegisterMetaType<ndn::IdentityCertificate>("ndn.IdentityCertificate");
- qRegisterMetaType<chronos::EndorseInfo>("chronos.EndorseInfo");
+ qRegisterMetaType<Chronos::EndorseInfo>("Chronos.EndorseInfo");
qRegisterMetaType<ndn::Interest>("ndn.Interest");
qRegisterMetaType<size_t>("size_t");
@@ -110,8 +110,8 @@
&m_contactManager, SLOT(onFetchContactInfo(const QString&)));
connect(m_addContactPanel, SIGNAL(addContact(const QString&)),
&m_contactManager, SLOT(onAddFetchedContact(const QString&)));
- connect(&m_contactManager, SIGNAL(contactEndorseInfoReady(const chronos::EndorseInfo&)),
- m_addContactPanel, SLOT(onContactEndorseInfoReady(const chronos::EndorseInfo&)));
+ connect(&m_contactManager, SIGNAL(contactEndorseInfoReady(const Chronos::EndorseInfo&)),
+ m_addContactPanel, SLOT(onContactEndorseInfoReady(const Chronos::EndorseInfo&)));
// Connection to BrowseContactDialog
@@ -151,8 +151,10 @@
m_contactPanel, SLOT(onContactAliasListReady(const QStringList&)));
connect(&m_contactManager, SIGNAL(contactIdListReady(const QStringList&)),
m_contactPanel, SLOT(onContactIdListReady(const QStringList&)));
- connect(&m_contactManager, SIGNAL(contactInfoReady(const QString&, const QString&, const QString&, bool)),
- m_contactPanel, SLOT(onContactInfoReady(const QString&, const QString&, const QString&, bool)));
+ connect(&m_contactManager, SIGNAL(contactInfoReady(const QString&, const QString&,
+ const QString&, bool)),
+ m_contactPanel, SLOT(onContactInfoReady(const QString&, const QString&,
+ const QString&, bool)));
initialize();
@@ -170,10 +172,10 @@
// private methods
-std::string
+string
Controller::getDBName()
{
- std::string dbName("chronos-");
+ string dbName("chronos-");
std::stringstream ss;
{
@@ -193,11 +195,14 @@
{
m_db = QSqlDatabase::addDatabase("QSQLITE");
QString path = (QDir::home().path());
- path.append(QDir::separator()).append(".chronos").append(QDir::separator()).append(getDBName().c_str());
+ path.append(QDir::separator())
+ .append(".chronos")
+ .append(QDir::separator())
+ .append(getDBName().c_str());
m_db.setDatabaseName(path);
bool ok = m_db.open();
- _LOG_DEBUG("DB opened: " << std::boolalpha << ok );
+ // _LOG_DEBUG("DB opened: " << std::boolalpha << ok );
}
void
@@ -217,22 +222,23 @@
void
Controller::setInvitationListener()
{
- if(m_invitationListenerId != 0)
+ if (m_invitationListenerId != 0)
m_face->unsetInterestFilter(m_invitationListenerId);
Name invitationPrefix;
Name routingPrefix = getInvitationRoutingPrefix();
size_t offset = 0;
- if(!routingPrefix.isPrefixOf(m_identity))
- {
- invitationPrefix.append(routingPrefix).append(ROUTING_PREFIX_SEPARATOR, 2);
- offset = routingPrefix.size() + 1;
- }
+ if (!routingPrefix.isPrefixOf(m_identity)) {
+ invitationPrefix.append(routingPrefix).append(ROUTING_PREFIX_SEPARATOR, 2);
+ offset = routingPrefix.size() + 1;
+ }
invitationPrefix.append(m_identity).append("CHRONOCHAT-INVITATION");
m_invitationListenerId = m_face->setInterestFilter(invitationPrefix,
- bind(&Controller::onInvitationInterestWrapper, this, _1, _2, offset),
- bind(&Controller::onInvitationRegisterFailed, this, _1, _2));
+ bind(&Controller::onInvitationInterestWrapper,
+ this, _1, _2, offset),
+ bind(&Controller::onInvitationRegisterFailed,
+ this, _1, _2));
}
void
@@ -245,24 +251,22 @@
std::ifstream is((chronosDir / "config").c_str ());
ChronoChat::Conf conf;
- if(conf.ParseFromIstream(&is))
- {
- m_identity.clear();
- m_identity.append(conf.identity());
- if(conf.has_nick())
- m_nick = conf.nick();
- else
- m_nick = m_identity.get(-1).toUri();
- }
- else
- {
- m_identity.clear();
- // TODO: change below to system default;
- m_identity.append("chronochat-tmp-identity")
- .append(getRandomString());
-
+ if (conf.ParseFromIstream(&is)) {
+ m_identity.clear();
+ m_identity.append(conf.identity());
+ if (conf.has_nick())
+ m_nick = conf.nick();
+ else
m_nick = m_identity.get(-1).toUri();
- }
+ }
+ else {
+ m_identity.clear();
+ // TODO: change below to system default;
+ m_identity.append("chronochat-tmp-identity")
+ .append(getRandomString());
+
+ m_nick = m_identity.get(-1).toUri();
+ }
}
void
@@ -276,7 +280,7 @@
std::ofstream os((chronosDir / "config").c_str ());
ChronoChat::Conf conf;
conf.set_identity(m_identity.toUri());
- if(!m_nick.empty())
+ if (!m_nick.empty())
conf.set_nick(m_nick);
conf.SerializeToOstream(&os);
@@ -358,12 +362,11 @@
{
ChatActionList::const_iterator it = m_chatActionList.begin();
ChatActionList::const_iterator end = m_chatActionList.end();
- if(it != end)
- {
- for(; it != end; it++)
- menu->addAction(it->second);
- menu->addSeparator();
- }
+ if (it != end) {
+ for (; it != end; it++)
+ menu->addAction(it->second);
+ menu->addSeparator();
+ }
}
menu->addAction(m_updateLocalPrefixAction);
menu->addSeparator();
@@ -372,15 +375,11 @@
{
ChatActionList::const_iterator it = m_closeActionList.begin();
ChatActionList::const_iterator end = m_closeActionList.end();
- if(it == end)
- {
- closeMenu->setEnabled(false);
- }
+ if (it == end)
+ closeMenu->setEnabled(false);
else
- {
- for(; it != end; it++)
- closeMenu->addAction(it->second);
- }
+ for (; it != end; it++)
+ closeMenu->addAction(it->second);
}
menu->addSeparator();
menu->addAction(m_quitAction);
@@ -399,7 +398,7 @@
.trimmed();
Name localPrefix(localPrefixStr.toStdString());
- if(m_localPrefix.empty() || m_localPrefix != localPrefix)
+ if (m_localPrefix.empty() || m_localPrefix != localPrefix)
emit localPrefixUpdated(localPrefixStr);
}
@@ -409,42 +408,47 @@
QString localPrefixStr("/private/local");
Name localPrefix(localPrefixStr.toStdString());
- if(m_localPrefix.empty() || m_localPrefix != localPrefix)
+ if (m_localPrefix.empty() || m_localPrefix != localPrefix)
emit localPrefixUpdated(localPrefixStr);
}
void
-Controller::onInvitationInterestWrapper(const Name& prefix, const Interest& interest, size_t routingPrefixOffset)
+Controller::onInvitationInterestWrapper(const Name& prefix,
+ const Interest& interest,
+ size_t routingPrefixOffset)
{
emit invitationInterest(prefix, interest, routingPrefixOffset);
}
void
-Controller::onInvitationRegisterFailed(const Name& prefix, const std::string& failInfo)
+Controller::onInvitationRegisterFailed(const Name& prefix, const string& failInfo)
{
- _LOG_DEBUG("Controller::onInvitationRegisterFailed: " << failInfo);
+ // _LOG_DEBUG("Controller::onInvitationRegisterFailed: " << failInfo);
}
void
Controller::onInvitationValidated(const shared_ptr<const Interest>& interest)
{
Invitation invitation(interest->getName());
- std::string alias = invitation.getInviterCertificate().getPublicKeyName().getPrefix(-1).toUri(); // Should be obtained via a method of ContactManager.
+ // Should be obtained via a method of ContactManager.
+ string alias = invitation.getInviterCertificate().getPublicKeyName().getPrefix(-1).toUri();
m_invitationDialog->setInvitation(alias, invitation.getChatroom(), interest->getName());
m_invitationDialog->show();
}
void
-Controller::onInvitationValidationFailed(const shared_ptr<const Interest>& interest, std::string failureInfo)
+Controller::onInvitationValidationFailed(const shared_ptr<const Interest>& interest,
+ string failureInfo)
{
- _LOG_DEBUG("Invitation: " << interest->getName() << " cannot not be validated due to: " << failureInfo);
+ // _LOG_DEBUG("Invitation: " << interest->getName() <<
+ // " cannot not be validated due to: " << failureInfo);
}
-std::string
+string
Controller::getRandomString()
{
- uint32_t r = random::generateWord32();
+ uint32_t r = ndn::random::generateWord32();
std::stringstream ss;
{
using namespace CryptoPP;
@@ -452,10 +456,10 @@
new HexEncoder(new FileSink(ss), false));
}
- // for(int i = 0; i < 8; i++)
+ // for (int i = 0; i < 8; i++)
// {
// uint32_t t = r & mask;
- // if(t < 10)
+ // if (t < 10)
// ss << static_cast<char>(t + 0x30);
// else
// ss << static_cast<char>(t + 0x57);
@@ -501,11 +505,10 @@
{
Name identityName(identity.toStdString());
- while(!m_chatDialogList.empty())
- {
- ChatDialogList::const_iterator it = m_chatDialogList.begin();
- onRemoveChatDialog(QString::fromStdString(it->first));
- }
+ while (!m_chatDialogList.empty()) {
+ ChatDialogList::const_iterator it = m_chatDialogList.begin();
+ onRemoveChatDialog(QString::fromStdString(it->first));
+ }
m_identity = identityName;
m_keyChain.createIdentity(m_identity);
@@ -538,10 +541,7 @@
m_contactManager.getContactList(contactList);
m_validator.cleanTrustAnchor();
- ContactList::const_iterator it = contactList.begin();
- ContactList::const_iterator end = contactList.end();
-
- for(; it != end; it++)
+ for (ContactList::const_iterator it = contactList.begin(); it != contactList.end(); it++)
m_validator.addTrustAnchor((*it)->getPublicKeyName(), (*it)->getPublicKey());
}
@@ -561,7 +561,7 @@
void
Controller::onStartChatAction()
{
- std::string chatroom = "chatroom-" + getRandomString();
+ string chatroom = "chatroom-" + getRandomString();
m_startChatDialog->setChatroom(chatroom);
m_startChatDialog->show();
@@ -629,20 +629,19 @@
ChatDialogList::iterator it = m_chatDialogList.begin();
ChatDialogList::iterator end = m_chatDialogList.end();
- for(; it != end; it++)
+ for (; it != end; it++)
it->second->hide();
}
void
Controller::onQuitAction()
{
- while(!m_chatDialogList.empty())
- {
- ChatDialogList::const_iterator it = m_chatDialogList.begin();
- onRemoveChatDialog(QString::fromStdString(it->first));
- }
+ while (!m_chatDialogList.empty()) {
+ ChatDialogList::const_iterator it = m_chatDialogList.begin();
+ onRemoveChatDialog(QString::fromStdString(it->first));
+ }
- if(m_invitationListenerId != 0)
+ if (m_invitationListenerId != 0)
m_face->unsetInterestFilter(m_invitationListenerId);
delete m_settingDialog;
@@ -652,7 +651,7 @@
delete m_browseContactDialog;
delete m_addContactPanel;
- m_face->ioService()->stop();
+ m_face->getIoService().stop();
QApplication::quit();
}
@@ -667,13 +666,12 @@
.append(chatroomName.toStdString());
// check if the chatroom exists
- if(m_chatDialogList.find(chatroomName.toStdString()) != m_chatDialogList.end())
- {
- QMessageBox::information(this, tr("ChronoChat"),
- tr("You are creating an existing chatroom."
- "You can check it in the context memu."));
- return;
- }
+ if (m_chatDialogList.find(chatroomName.toStdString()) != m_chatDialogList.end()) {
+ QMessageBox::information(this, tr("ChronoChat"),
+ tr("You are creating an existing chatroom."
+ "You can check it in the context memu."));
+ return;
+ }
// TODO: We should create a chatroom specific key/cert (which should be created in the first half of this method, but let's use the default one for now.
shared_ptr<IdentityCertificate> idCert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
@@ -690,67 +688,62 @@
shared_ptr<IdentityCertificate> chatroomCert;
// generate reply;
- if(accepted)
- {
- Name responseName = invitationName;
- responseName.append(m_localPrefix.wireEncode());
+ if (accepted) {
+ Name responseName = invitationName;
+ responseName.append(m_localPrefix.wireEncode());
- response.setName(responseName);
+ response.setName(responseName);
- // We should create a particular certificate for this chatroom, but let's use default one for now.
- chatroomCert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
+ // We should create a particular certificate for this chatroom, but let's use default one for now.
+ chatroomCert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
- response.setContent(chatroomCert->wireEncode());
- response.setFreshnessPeriod(time::milliseconds(1000));
- }
- else
- {
- response.setName(invitationName);
- response.setFreshnessPeriod(time::milliseconds(1000));
- }
+ response.setContent(chatroomCert->wireEncode());
+ response.setFreshnessPeriod(time::milliseconds(1000));
+ }
+ else {
+ response.setName(invitationName);
+ response.setFreshnessPeriod(time::milliseconds(1000));
+ }
+
m_keyChain.signByIdentity(response, m_identity);
// Check if we need a wrapper
Name invitationRoutingPrefix = getInvitationRoutingPrefix();
- if(invitationRoutingPrefix.isPrefixOf(m_identity))
- {
- m_face->put(response);
- }
- else
- {
- Name wrappedName;
- wrappedName.append(invitationRoutingPrefix)
- .append(ROUTING_PREFIX_SEPARATOR, 2)
- .append(response.getName());
+ if (invitationRoutingPrefix.isPrefixOf(m_identity))
+ m_face->put(response);
+ else {
+ Name wrappedName;
+ wrappedName.append(invitationRoutingPrefix)
+ .append(ROUTING_PREFIX_SEPARATOR, 2)
+ .append(response.getName());
- _LOG_DEBUG("onInvitationResponded: prepare reply " << wrappedName);
+ // _LOG_DEBUG("onInvitationResponded: prepare reply " << wrappedName);
- Data wrappedData(wrappedName);
- wrappedData.setContent(response.wireEncode());
- wrappedData.setFreshnessPeriod(time::milliseconds(1000));
+ Data wrappedData(wrappedName);
+ wrappedData.setContent(response.wireEncode());
+ wrappedData.setFreshnessPeriod(time::milliseconds(1000));
- m_keyChain.signByIdentity(wrappedData, m_identity);
- m_face->put(wrappedData);
- }
+ m_keyChain.signByIdentity(wrappedData, m_identity);
+ m_face->put(wrappedData);
+ }
// create chatroom
- if(accepted)
- {
- Invitation invitation(invitationName);
- Name chatroomPrefix;
- chatroomPrefix.append("ndn")
- .append("broadcast")
- .append("ChronoChat")
- .append(invitation.getChatroom());
+ if (accepted) {
+ Invitation invitation(invitationName);
+ Name chatroomPrefix;
+ chatroomPrefix.append("ndn")
+ .append("broadcast")
+ .append("ChronoChat")
+ .append(invitation.getChatroom());
- //We should create a chatroom specific key/cert (which should be created in the first half of this method, but let's use the default one for now.
- shared_ptr<IdentityCertificate> idCert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
- ChatDialog* chatDialog = new ChatDialog(&m_contactManager, m_face, *idCert, chatroomPrefix, m_localPrefix, m_nick, true);
- chatDialog->addSyncAnchor(invitation);
+ //We should create a chatroom specific key/cert (which should be created in the first half of this method, but let's use the default one for now.
+ shared_ptr<IdentityCertificate> idCert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(m_identity));
+ ChatDialog* chatDialog = new ChatDialog(&m_contactManager, m_face, *idCert, chatroomPrefix, m_localPrefix, m_nick, true);
+ chatDialog->addSyncAnchor(invitation);
- addChatDialog(QString::fromStdString(invitation.getChatroom()), chatDialog);
- chatDialog->show();
- }
+ addChatDialog(QString::fromStdString(invitation.getChatroom()), chatDialog);
+ chatDialog->show();
+ }
}
void
@@ -773,25 +766,24 @@
{
ChatDialogList::iterator it = m_chatDialogList.find(chatroomName.toStdString());
- if(it != m_chatDialogList.end())
- {
- ChatDialog* deletedChat = it->second;
- if(deletedChat)
- delete deletedChat;
- m_chatDialogList.erase(it);
+ if (it != m_chatDialogList.end()) {
+ ChatDialog* deletedChat = it->second;
+ if (deletedChat)
+ delete deletedChat;
+ m_chatDialogList.erase(it);
- QAction* chatAction = m_chatActionList[chatroomName.toStdString()];
- QAction* closeAction = m_closeActionList[chatroomName.toStdString()];
- if(chatAction)
- delete chatAction;
- if(closeAction)
- delete closeAction;
+ QAction* chatAction = m_chatActionList[chatroomName.toStdString()];
+ QAction* closeAction = m_closeActionList[chatroomName.toStdString()];
+ if (chatAction)
+ delete chatAction;
+ if (closeAction)
+ delete closeAction;
- m_chatActionList.erase(chatroomName.toStdString());
- m_closeActionList.erase(chatroomName.toStdString());
+ m_chatActionList.erase(chatroomName.toStdString());
+ m_closeActionList.erase(chatroomName.toStdString());
- updateMenu();
- }
+ updateMenu();
+ }
}
void
@@ -808,26 +800,28 @@
}
void
-Controller::onInvitationInterest(const Name& prefix, const Interest& interest, size_t routingPrefixOffset)
+Controller::onInvitationInterest(const Name& prefix,
+ const Interest& interest,
+ size_t routingPrefixOffset)
{
- _LOG_DEBUG("onInvitationInterest: " << interest.getName());
- shared_ptr<Interest> invitationInterest = make_shared<Interest>(boost::cref(interest.getName().getSubName(routingPrefixOffset)));
+ // _LOG_DEBUG("onInvitationInterest: " << interest.getName());
+ shared_ptr<Interest> invitationInterest =
+ make_shared<Interest>(boost::cref(interest.getName().getSubName(routingPrefixOffset)));
// check if the chatroom already exists;
- try
- {
+ try {
Invitation invitation(invitationInterest->getName());
- if(m_chatDialogList.find(invitation.getChatroom()) != m_chatDialogList.end())
+ if (m_chatDialogList.find(invitation.getChatroom()) != m_chatDialogList.end())
return;
- }
- catch(Invitation::Error& e)
- {
- // Cannot parse the invitation;
- return;
- }
+ }
+ catch (Invitation::Error& e) {
+ // Cannot parse the invitation;
+ return;
+ }
OnInterestValidated onValidated = bind(&Controller::onInvitationValidated, this, _1);
- OnInterestValidationFailed onValidationFailed = bind(&Controller::onInvitationValidationFailed, this, _1, _2);
+ OnInterestValidationFailed onValidationFailed = bind(&Controller::onInvitationValidationFailed,
+ this, _1, _2);
m_validator.validate(*invitationInterest, onValidated, onValidationFailed);
}
diff --git a/src/controller.h b/src/controller.hpp
similarity index 68%
rename from src/controller.h
rename to src/controller.hpp
index 77828d0..d445171 100644
--- a/src/controller.h
+++ b/src/controller.hpp
@@ -8,27 +8,27 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef CHRONOS_CONTROLLER_H
-#define CHRONOS_CONTROLLER_H
+#ifndef CHRONOS_CONTROLLER_HPP
+#define CHRONOS_CONTROLLER_HPP
#include <QDialog>
#include <QMenu>
#include <QSystemTrayIcon>
#include <QtSql/QSqlDatabase>
-#include "setting-dialog.h"
-#include "start-chat-dialog.h"
-#include "profile-editor.h"
-#include "invitation-dialog.h"
-#include "contact-panel.h"
-#include "browse-contact-dialog.h"
-#include "add-contact-panel.h"
-#include "chat-dialog.h"
+#include "setting-dialog.hpp"
+#include "start-chat-dialog.hpp"
+#include "profile-editor.hpp"
+#include "invitation-dialog.hpp"
+#include "contact-panel.hpp"
+#include "browse-contact-dialog.hpp"
+#include "add-contact-panel.hpp"
+#include "chat-dialog.hpp"
#ifndef Q_MOC_RUN
-#include "contact-manager.h"
-#include "validator-invitation.h"
-#include <ndn-cxx/face.hpp>
+#include "common.hpp"
+#include "contact-manager.hpp"
+#include "validator-invitation.hpp"
#include <ndn-cxx/security/key-chain.hpp>
#endif
@@ -39,8 +39,7 @@
Q_OBJECT
public: // public methods
- Controller(ndn::shared_ptr<ndn::Face> face,
- QWidget* parent = 0);
+ Controller(shared_ptr<ndn::Face> face, QWidget* parent = 0);
virtual
~Controller();
@@ -74,22 +73,24 @@
updateMenu();
void
- onLocalPrefix(const ndn::Interest& interest, ndn::Data& data);
+ onLocalPrefix(const Interest& interest, Data& data);
void
- onLocalPrefixTimeout(const ndn::Interest& interest);
+ onLocalPrefixTimeout(const Interest& interest);
void
- onInvitationInterestWrapper(const ndn::Name& prefix, const ndn::Interest& interest, size_t routingPrefixOffset);
+ onInvitationInterestWrapper(const Name& prefix, const Interest& interest,
+ size_t routingPrefixOffset);
void
- onInvitationRegisterFailed(const ndn::Name& prefix, const std::string& failInfo);
+ onInvitationRegisterFailed(const Name& prefix, const std::string& failInfo);
void
- onInvitationValidated(const ndn::shared_ptr<const ndn::Interest>& interest);
+ onInvitationValidated(const shared_ptr<const Interest>& interest);
void
- onInvitationValidationFailed(const ndn::shared_ptr<const ndn::Interest>& interest, std::string failureInfo);
+ onInvitationValidationFailed(const shared_ptr<const Interest>& interest,
+ std::string failureInfo);
std::string
getRandomString();
@@ -114,7 +115,7 @@
refreshBrowseContact();
void
- invitationInterest(const ndn::Name& prefix, const ndn::Interest& interest, size_t routingPrefixOffset);
+ invitationInterest(const Name& prefix, const Interest& interest, size_t routingPrefixOffset);
private slots:
void
@@ -163,7 +164,7 @@
onStartChatroom(const QString& chatroom, bool secured);
void
- onInvitationResponded(const ndn::Name& invitationName, bool accepted);
+ onInvitationResponded(const Name& invitationName, bool accepted);
void
onShowChatMessage(const QString& chatroomName, const QString& from, const QString& data);
@@ -181,15 +182,15 @@
onError(const QString& msg);
void
- onInvitationInterest(const ndn::Name& prefix, const ndn::Interest& interest, size_t routingPrefixOffset);
+ onInvitationInterest(const Name& prefix, const Interest& interest, size_t routingPrefixOffset);
private: // private member
typedef std::map<std::string, QAction*> ChatActionList;
typedef std::map<std::string, ChatDialog*> ChatDialogList;
// Communication
- ndn::shared_ptr<ndn::Face> m_face;
- ndn::Name m_localPrefix;
+ shared_ptr<ndn::Face> m_face;
+ Name m_localPrefix;
const ndn::RegisteredPrefixId* m_invitationListenerId;
// Contact Manager
@@ -221,15 +222,15 @@
ChatDialogList m_chatDialogList;
// Conf
- ndn::Name m_identity;
+ Name m_identity;
std::string m_nick;
QSqlDatabase m_db;
// Security related;
- ndn::KeyChain m_keyChain;
- chronos::ValidatorInvitation m_validator;
+ ndn::KeyChain m_keyChain;
+ ValidatorInvitation m_validator;
};
} // namespace chronos
-#endif //CHRONOS_CONTROLLER_H
+#endif //CHRONOS_CONTROLLER_HPP
diff --git a/src/cryptopp.hpp b/src/cryptopp.hpp
new file mode 100644
index 0000000..f49ebb2
--- /dev/null
+++ b/src/cryptopp.hpp
@@ -0,0 +1,23 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_CRYPTOPP_HPP
+#define CHRONOS_CRYPTOPP_HPP
+
+// suppress CryptoPP warnings
+#pragma GCC system_header
+#pragma clang system_header
+
+#include <cryptopp/hex.h>
+#include <cryptopp/files.h>
+#include <cryptopp/base64.h>
+#include <cryptopp/sha.h>
+#include <cryptopp/filters.h>
+
+#endif // CHRONOS_CRYPTOPP_HPP
diff --git a/src/digest-tree-scene.cpp b/src/digest-tree-scene.cpp
index 88315b1..65204df 100644
--- a/src/digest-tree-scene.cpp
+++ b/src/digest-tree-scene.cpp
@@ -9,7 +9,7 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "digest-tree-scene.h"
+#include "digest-tree-scene.hpp"
#include <QtGui>
@@ -21,6 +21,8 @@
#include <memory>
#endif
+namespace chronos {
+
static const double Pi = 3.14159265358979323846264338327950288419717;
//DisplayUserPtr DisplayUserNullPtr;
@@ -36,38 +38,32 @@
{
int n = v.size();
bool rePlot = false;
- for (int i = 0; i < n; i++)
- {
+ for (int i = 0; i < n; i++) {
QString routablePrefix(v[i].prefix.c_str());
QString prefix = trimRoutablePrefix(routablePrefix);
Roster_iterator it = m_roster.find(prefix);
- if (it == m_roster.end())
- {
+ if (it == m_roster.end()) {
// std::cout << "processUpdate v[" << i << "]: " << prefix.toStdString() << std::endl;
rePlot = true;
DisplayUserPtr p(new DisplayUser());
- time_t tempTime = time(NULL) - FRESHNESS + 1;
+ time_t tempTime = ::time(NULL) - FRESHNESS + 1;
p->setReceived(tempTime);
p->setPrefix(prefix);
p->setSeq(v[i].high);
m_roster.insert(p->getPrefix(), p);
}
- else
- {
+ else {
it.value()->setSeq(v[i].high);
}
}
- if (rePlot)
- {
+ if (rePlot) {
plot(digest);
QTimer::singleShot(2100, this, SLOT(emitReplot()));
}
- else
- {
- for (int i = 0; i < n; i++)
- {
+ else {
+ for (int i = 0; i < n; i++) {
QString routablePrefix(v[i].prefix.c_str());
QString prefix = trimRoutablePrefix(routablePrefix);
@@ -80,7 +76,8 @@
item->setPlainText(s.c_str());
QRectF textBR = item->boundingRect();
QRectF rectBR = rectItem->boundingRect();
- item->setPos(rectBR.x() + (rectBR.width() - textBR.width())/2, rectBR.y() + (rectBR.height() - textBR.height())/2);
+ item->setPos(rectBR.x() + (rectBR.width() - textBR.width())/2,
+ rectBR.y() + (rectBR.height() - textBR.height())/2);
}
}
m_rootDigest->setPlainText(digest);
@@ -98,12 +95,10 @@
{
QStringList rosterList;
RosterIterator it(m_roster);
- while(it.hasNext())
- {
+ while (it.hasNext()) {
it.next();
DisplayUserPtr p = it.value();
- if (p != DisplayUserNullPtr)
- {
+ if (p != DisplayUserNullPtr) {
rosterList << "- " + p->getNick();
}
}
@@ -116,33 +111,31 @@
QString prefix = trimRoutablePrefix(routablePrefix);
Roster_iterator it = m_roster.find(prefix);
// std::cout << "msgReceived prefix: " << prefix.toStdString() << std::endl;
- if (it != m_roster.end())
- {
- // std::cout << "Updating for prefix = " << prefix.toStdString() << " nick = " << nick.toStdString() << std::endl;
- DisplayUserPtr p = it.value();
- p->setReceived(time(NULL));
- if (nick != p->getNick())
- {
- // std::cout << "old nick = " << p->getNick().toStdString() << std::endl;
- p->setNick(nick);
- QGraphicsTextItem *nickItem = p->getNickTextItem();
- QGraphicsRectItem *nickRectItem = p->getNickRectItem();
- nickItem->setPlainText(p->getNick());
- QRectF rectBR = nickRectItem->boundingRect();
- QRectF nickBR = nickItem->boundingRect();
- nickItem->setPos(rectBR.x() + (rectBR.width() - nickBR.width())/2, rectBR.y() + 5);
- emit rosterChanged(QStringList());
- }
-
- reDrawNode(p, Qt::red);
-
- if (previouslyUpdatedUser != DisplayUserNullPtr && previouslyUpdatedUser != p)
- {
- reDrawNode(previouslyUpdatedUser, Qt::darkBlue);
- }
-
- previouslyUpdatedUser = p;
+ if (it != m_roster.end()) {
+ // std::cout << "Updating for prefix = " << prefix.toStdString() <<
+ // " nick = " << nick.toStdString() << std::endl;
+ DisplayUserPtr p = it.value();
+ p->setReceived(::time(NULL));
+ if (nick != p->getNick()) {
+ // std::cout << "old nick = " << p->getNick().toStdString() << std::endl;
+ p->setNick(nick);
+ QGraphicsTextItem *nickItem = p->getNickTextItem();
+ QGraphicsRectItem *nickRectItem = p->getNickRectItem();
+ nickItem->setPlainText(p->getNick());
+ QRectF rectBR = nickRectItem->boundingRect();
+ QRectF nickBR = nickItem->boundingRect();
+ nickItem->setPos(rectBR.x() + (rectBR.width() - nickBR.width())/2, rectBR.y() + 5);
+ emit rosterChanged(QStringList());
}
+
+ reDrawNode(p, Qt::red);
+
+ if (previouslyUpdatedUser != DisplayUserNullPtr && previouslyUpdatedUser != p) {
+ reDrawNode(previouslyUpdatedUser, Qt::darkBlue);
+ }
+
+ previouslyUpdatedUser = p;
+ }
}
void
@@ -163,7 +156,7 @@
DigestTreeScene::plot(QString digest)
{
#ifdef _DEBUG
- std::cout << "Plotting at time: " << time(NULL) << std::endl;
+ std::cout << "Plotting at time: " << ::time(NULL) << std::endl;
#endif
clear();
@@ -177,14 +170,11 @@
// do some cleaning, get rid of stale member info
Roster_iterator it = m_roster.begin();
QStringList staleUserList;
- while (it != m_roster.end())
- {
+ while (it != m_roster.end()) {
DisplayUserPtr p = it.value();
- if (p != DisplayUserNullPtr)
- {
- time_t now = time(NULL);
- if (now - p->getReceived() >= FRESHNESS)
- {
+ if (p != DisplayUserNullPtr) {
+ time_t now = ::time(NULL);
+ if (now - p->getReceived() >= FRESHNESS) {
#ifdef _DEBUG
std::cout << "Removing user: " << p->getNick().toStdString() << std::endl;
std::cout << "now - last = " << now - p->getReceived() << std::endl;
@@ -193,10 +183,9 @@
p = DisplayUserNullPtr;
it = m_roster.erase(it);
}
- else
- {
- if (!m_currentPrefix.startsWith("/private/local") && p->getPrefix().startsWith("/private/local"))
- {
+ else {
+ if (!m_currentPrefix.startsWith("/private/local") &&
+ p->getPrefix().startsWith("/private/local")) {
#ifdef _DEBUG
std::cout << "erasing: " << p->getPrefix().toStdString() << std::endl;
#endif
@@ -208,8 +197,7 @@
++it;
}
}
- else
- {
+ else {
it = m_roster.erase(it);
}
}
@@ -243,19 +231,22 @@
double angle = ::acos(line.dx() / line.length());
double arrowSize = 10;
- QPointF sourceArrowP0 = src + QPointF((nodeSize/2 + 10) * line.dx() / line.length(), (nodeSize/2 +10) * line.dy() / line.length());
+ QPointF sourceArrowP0 = src + QPointF((nodeSize/2 + 10) * line.dx() / line.length(),
+ (nodeSize/2 +10) * line.dy() / line.length());
QPointF sourceArrowP1 = sourceArrowP0 + QPointF(cos(angle + Pi / 3 - Pi/2) * arrowSize,
sin(angle + Pi / 3 - Pi/2) * arrowSize);
QPointF sourceArrowP2 = sourceArrowP0 + QPointF(cos(angle + Pi - Pi / 3 - Pi/2) * arrowSize,
- sin(angle + Pi - Pi / 3 - Pi/2) * arrowSize);
+ sin(angle + Pi - Pi / 3 - Pi/2) * arrowSize);
addLine(QLineF(sourceArrowP0, dest), QPen(Qt::black));
- addPolygon(QPolygonF() << sourceArrowP0<< sourceArrowP1 << sourceArrowP2, QPen(Qt::black), QBrush(Qt::black));
+ addPolygon(QPolygonF() << sourceArrowP0<< sourceArrowP1 <<
+ sourceArrowP2, QPen(Qt::black), QBrush(Qt::black));
}
}
void
-DigestTreeScene::plotNode(const std::vector<TreeLayout::Coordinate> &childNodesCo, QString digest, int nodeSize)
+DigestTreeScene::plotNode(const std::vector<TreeLayout::Coordinate>& childNodesCo,
+ QString digest, int nodeSize)
{
RosterIterator it(m_roster);
int n = childNodesCo.size();
@@ -273,20 +264,16 @@
QRectF digestBoundingRect = digestItem->boundingRect();
digestItem->setDefaultTextColor(Qt::black);
digestItem->setFont(QFont("Cursive", 12, QFont::Bold));
- digestItem->setPos(- 4.5 * nodeSize + (12 * nodeSize - digestBoundingRect.width()) / 2, - nodeSize + 5);
+ digestItem->setPos(- 4.5 * nodeSize + (12 * nodeSize - digestBoundingRect.width()) / 2,
+ - nodeSize + 5);
m_rootDigest = digestItem;
// plot child nodes
- for (int i = 0; i < n; i++)
- {
+ for (int i = 0; i < n; i++) {
if (it.hasNext())
- {
it.next();
- }
else
- {
abort();
- }
double x = childNodesCo[i].x;
double y = childNodesCo[i].y;
@@ -296,14 +283,17 @@
QGraphicsRectItem *rectItem = addRect(boundingRect, QPen(Qt::black), QBrush(Qt::darkBlue));
p->setRimRectItem(rectItem);
- QGraphicsRectItem *innerRectItem = addRect(innerBoundingRect, QPen(Qt::black), QBrush(Qt::lightGray));
+ QGraphicsRectItem *innerRectItem = addRect(innerBoundingRect,
+ QPen(Qt::black),
+ QBrush(Qt::lightGray));
p->setInnerRectItem(innerRectItem);
std::string s = boost::lexical_cast<std::string>(p->getSeqNo().getSeq());
QGraphicsTextItem *seqItem = addText(s.c_str());
seqItem->setFont(QFont("Cursive", 12, QFont::Bold));
QRectF seqBoundingRect = seqItem->boundingRect();
- seqItem->setPos(x + nodeSize / 2 - seqBoundingRect.width() / 2, y + nodeSize / 2 - seqBoundingRect.height() / 2);
+ seqItem->setPos(x + nodeSize / 2 - seqBoundingRect.width() / 2,
+ y + nodeSize / 2 - seqBoundingRect.height() / 2);
p->setSeqTextItem(seqItem);
QRectF textRect(x - nodeSize / 2, y + nodeSize, 2 * nodeSize, 30);
@@ -331,7 +321,8 @@
seqTextItem->setPlainText(s.c_str());
QRectF textBR = seqTextItem->boundingRect();
QRectF innerBR = innerItem->boundingRect();
- seqTextItem->setPos(innerBR.x() + (innerBR.width() - textBR.width())/2, innerBR.y() + (innerBR.height() - textBR.height())/2);
+ seqTextItem->setPos(innerBR.x() + (innerBR.width() - textBR.width())/2,
+ innerBR.y() + (innerBR.height() - textBR.height())/2);
}
QString
@@ -340,27 +331,22 @@
bool encaped = false;
ndn::Name prefixName(prefix.toStdString());
- ndn::Name::const_iterator it = prefixName.begin();
- ndn::Name::const_iterator end = prefixName.end();
size_t offset = 0;
-
- for(; it != end; it++, offset++)
- {
- if(it->toEscapedString() == "%F0.")
- {
- encaped = true;
- break;
- }
+ for (ndn::Name::const_iterator it = prefixName.begin(); it != prefixName.end(); it++, offset++) {
+ if (it->toUri() == "%F0.") {
+ encaped = true;
+ break;
}
+ }
- if(!encaped)
+ if (!encaped)
return prefix;
else
- {
- return QString(prefixName.getSubName(offset+1).toUri().c_str());
- }
+ return QString(prefixName.getSubName(offset+1).toUri().c_str());
}
+} // namespace chronos
+
#if WAF
#include "digest-tree-scene.moc"
#include "digest-tree-scene.cpp.moc"
diff --git a/src/digest-tree-scene.h b/src/digest-tree-scene.h
deleted file mode 100644
index 06befa8..0000000
--- a/src/digest-tree-scene.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef DIGEST_TREE_SCENE_H
-#define DIGEST_TREE_SCENE_H
-
-#include <QtGui/QGraphicsScene>
-#include <QColor>
-#include <QMap>
-
-#ifndef Q_MOC_RUN
-#include "tree-layout.h"
-#include <sync-seq-no.h>
-#include <sync-logic.h>
-#include <ctime>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#endif
-
-const int FRESHNESS = 60;
-
-class QGraphicsTextItem;
-
-class User;
-class DisplayUser;
-typedef boost::shared_ptr<DisplayUser> DisplayUserPtr;
-static DisplayUserPtr DisplayUserNullPtr;
-
-class DigestTreeScene : public QGraphicsScene
-{
- Q_OBJECT
-
-typedef QMap<QString, DisplayUserPtr> Roster;
-typedef QMap<QString, DisplayUserPtr>::iterator Roster_iterator;
-typedef QMapIterator<QString, DisplayUserPtr> RosterIterator;
-
-public:
- DigestTreeScene(QWidget *parent = 0);
- void processUpdate(const std::vector<Sync::MissingDataInfo> &v, QString digest);
- void msgReceived(QString prefix, QString nick);
- void clearAll();
- bool removeNode(const QString prefix);
- void plot(QString digest);
- QStringList getRosterList();
- void setCurrentPrefix(QString prefix) {m_currentPrefix = prefix;}
- QMap<QString, DisplayUserPtr> getRosterFull() { return m_roster;}
-
-signals:
- void replot();
- void rosterChanged(QStringList);
-
-private slots:
- void emitReplot();
-
-private:
- void plotEdge(const std::vector<TreeLayout::Coordinate> &v, int nodeSize);
- void plotNode(const std::vector<TreeLayout::Coordinate> &v, QString digest, int nodeSize);
- void reDrawNode(DisplayUserPtr p, QColor rimColor);
-
- QString trimRoutablePrefix(QString prefix);
-
-private:
- Roster m_roster;
- QGraphicsTextItem *m_rootDigest;
- DisplayUserPtr previouslyUpdatedUser;
- QString m_currentPrefix;
-};
-
-class User
-{
-public:
- User():m_received(time(NULL)) {}
- User(QString n, QString p, QString c): m_nick(n), m_prefix(p), m_chatroom(c), m_received(time(NULL)) {}
- void setNick(QString nick) {m_nick = nick;}
- void setPrefix(QString prefix) {m_prefix = prefix;}
- void setChatroom(QString chatroom) {m_chatroom = chatroom;}
- void setSeq(Sync::SeqNo seq) {m_seq = seq;}
- void setReceived(time_t t) {m_received = t;}
- void setOriginPrefix(QString originPrefix) { m_originPrefix = originPrefix;}
- QString getNick() { return m_nick;}
- QString getPrefix() { return m_prefix;}
- QString getChatroom() { return m_chatroom;}
- QString getOriginPrefix() { return m_originPrefix;}
- Sync::SeqNo getSeqNo() { return m_seq;}
- time_t getReceived() { return m_received;}
-private:
- QString m_nick;
- QString m_prefix;
- QString m_chatroom;
- QString m_originPrefix;
- Sync::SeqNo m_seq;
- time_t m_received;
-};
-
-class DisplayUser : public User
-{
-public:
- DisplayUser():m_seqTextItem(NULL), m_nickTextItem(NULL), m_rimRectItem(NULL) {}
- DisplayUser(QString n, QString p , QString c): User(n, p, c), m_seqTextItem(NULL), m_nickTextItem(NULL), m_rimRectItem(NULL) {}
- QGraphicsTextItem *getSeqTextItem() {return m_seqTextItem;}
- QGraphicsTextItem *getNickTextItem() {return m_nickTextItem;}
- QGraphicsRectItem *getRimRectItem() {return m_rimRectItem;}
- QGraphicsRectItem *getInnerRectItem() {return m_innerRectItem;}
- QGraphicsRectItem *getNickRectItem() {return m_nickRectItem;}
- void setSeqTextItem(QGraphicsTextItem *item) { m_seqTextItem = item;}
- void setNickTextItem(QGraphicsTextItem *item) { m_nickTextItem = item;}
- void setRimRectItem(QGraphicsRectItem *item) {m_rimRectItem = item;}
- void setInnerRectItem(QGraphicsRectItem *item) {m_innerRectItem = item;}
- void setNickRectItem(QGraphicsRectItem *item) {m_nickRectItem = item;}
-private:
- QGraphicsTextItem *m_seqTextItem;
- QGraphicsTextItem *m_nickTextItem;
- QGraphicsRectItem *m_rimRectItem;
- QGraphicsRectItem *m_innerRectItem;
- QGraphicsRectItem *m_nickRectItem;
-};
-
-#endif // DIGEST_TREE_SCENE_H
diff --git a/src/digest-tree-scene.hpp b/src/digest-tree-scene.hpp
new file mode 100644
index 0000000..434ee07
--- /dev/null
+++ b/src/digest-tree-scene.hpp
@@ -0,0 +1,291 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef CHRONOS_DIGEST_TREE_SCENE_HPP
+#define CHRONOS_DIGEST_TREE_SCENE_HPP
+
+#include <QtGui/QGraphicsScene>
+#include <QColor>
+#include <QMap>
+
+#ifndef Q_MOC_RUN
+#include "tree-layout.hpp"
+#include <sync-seq-no.h>
+#include <sync-logic.h>
+#include <ctime>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#endif
+
+const int FRESHNESS = 60;
+
+class QGraphicsTextItem;
+
+namespace chronos {
+
+class User;
+class DisplayUser;
+typedef boost::shared_ptr<DisplayUser> DisplayUserPtr;
+static DisplayUserPtr DisplayUserNullPtr;
+
+class DigestTreeScene : public QGraphicsScene
+{
+ Q_OBJECT
+
+typedef QMap<QString, DisplayUserPtr> Roster;
+typedef QMap<QString, DisplayUserPtr>::iterator Roster_iterator;
+typedef QMapIterator<QString, DisplayUserPtr> RosterIterator;
+
+public:
+ DigestTreeScene(QWidget *parent = 0);
+
+ void
+ processUpdate(const std::vector<Sync::MissingDataInfo>& v, QString digest);
+
+ void
+ msgReceived(QString prefix, QString nick);
+
+ void
+ clearAll();
+
+ bool
+ removeNode(const QString prefix);
+
+ void
+ plot(QString digest);
+
+ QStringList
+ getRosterList();
+
+ void
+ setCurrentPrefix(QString prefix)
+ {
+ m_currentPrefix = prefix;
+ }
+
+ QMap<QString, DisplayUserPtr> getRosterFull()
+ {
+ return m_roster;
+ }
+
+signals:
+ void
+ replot();
+
+ void
+ rosterChanged(QStringList);
+
+private slots:
+ void
+ emitReplot();
+
+private:
+ void
+ plotEdge(const std::vector<chronos::TreeLayout::Coordinate>& v, int nodeSize);
+
+ void
+ plotNode(const std::vector<chronos::TreeLayout::Coordinate>& v, QString digest, int nodeSize);
+
+ void
+ reDrawNode(DisplayUserPtr p, QColor rimColor);
+
+ QString
+ trimRoutablePrefix(QString prefix);
+
+private:
+ Roster m_roster;
+ QGraphicsTextItem* m_rootDigest;
+ DisplayUserPtr previouslyUpdatedUser;
+ QString m_currentPrefix;
+};
+
+class User
+{
+public:
+ User()
+ :m_received(::time(NULL))
+ {
+ }
+
+ User(QString n, QString p, QString c)
+ : m_nick(n)
+ , m_prefix(p)
+ , m_chatroom(c)
+ , m_received(::time(NULL))
+ {
+ }
+
+ void
+ setNick(QString nick)
+ {
+ m_nick = nick;
+ }
+
+ void
+ setPrefix(QString prefix)
+ {
+ m_prefix = prefix;
+ }
+
+ void
+ setChatroom(QString chatroom)
+ {
+ m_chatroom = chatroom;
+ }
+
+ void
+ setSeq(Sync::SeqNo seq)
+ {
+ m_seq = seq;
+ }
+
+ void
+ setReceived(time_t t)
+ {
+ m_received = t;
+ }
+
+ void
+ setOriginPrefix(QString originPrefix)
+ {
+ m_originPrefix = originPrefix;
+ }
+
+ QString
+ getNick()
+ {
+ return m_nick;
+ }
+
+ QString getPrefix()
+ {
+ return m_prefix;
+ }
+
+ QString getChatroom()
+ {
+ return m_chatroom;
+ }
+
+ QString getOriginPrefix()
+ {
+ return m_originPrefix;
+ }
+
+ Sync::SeqNo
+ getSeqNo()
+ {
+ return m_seq;
+ }
+
+ time_t getReceived()
+ {
+ return m_received;
+ }
+
+private:
+ QString m_nick;
+ QString m_prefix;
+ QString m_chatroom;
+ QString m_originPrefix;
+ Sync::SeqNo m_seq;
+ time_t m_received;
+};
+
+class DisplayUser : public User
+{
+public:
+ DisplayUser()
+ : m_seqTextItem(NULL)
+ , m_nickTextItem(NULL)
+ , m_rimRectItem(NULL)
+ {
+ }
+
+ DisplayUser(QString n, QString p , QString c)
+ : User(n, p, c)
+ , m_seqTextItem(NULL)
+ , m_nickTextItem(NULL)
+ , m_rimRectItem(NULL)
+ {
+ }
+
+ QGraphicsTextItem*
+ getSeqTextItem()
+ {
+ return m_seqTextItem;
+ }
+
+ QGraphicsTextItem*
+ getNickTextItem()
+ {
+ return m_nickTextItem;
+ }
+
+ QGraphicsRectItem*
+ getRimRectItem()
+ {
+ return m_rimRectItem;
+ }
+
+ QGraphicsRectItem*
+ getInnerRectItem()
+ {
+ return m_innerRectItem;
+ }
+
+ QGraphicsRectItem*
+ getNickRectItem()
+ {
+ return m_nickRectItem;
+ }
+
+ void
+ setSeqTextItem(QGraphicsTextItem* item)
+ {
+ m_seqTextItem = item;
+ }
+
+ void
+ setNickTextItem(QGraphicsTextItem* item)
+ {
+ m_nickTextItem = item;
+ }
+
+ void
+ setRimRectItem(QGraphicsRectItem* item)
+ {
+ m_rimRectItem = item;
+ }
+
+ void
+ setInnerRectItem(QGraphicsRectItem* item)
+ {
+ m_innerRectItem = item;
+ }
+
+ void
+ setNickRectItem(QGraphicsRectItem* item)
+ {
+ m_nickRectItem = item;
+ }
+
+private:
+ QGraphicsTextItem* m_seqTextItem;
+ QGraphicsTextItem* m_nickTextItem;
+ QGraphicsRectItem* m_rimRectItem;
+ QGraphicsRectItem* m_innerRectItem;
+ QGraphicsRectItem* m_nickRectItem;
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_DIGEST_TREE_SCENE_HPP
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index faa0972..8fc8dec 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -8,33 +8,41 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "endorse-certificate.h"
+#include "endorse-certificate.hpp"
#include "endorse-extension.pb.h"
#include <boost/iostreams/stream.hpp>
+#include <ndn-cxx/encoding/buffer-stream.hpp>
-using namespace ndn;
+namespace chronos {
-namespace chronos{
+using std::vector;
+using std::string;
+
+using ndn::PublicKey;
+using ndn::IdentityCertificate;
+using ndn::CertificateSubjectDescription;
+using ndn::CertificateExtension;
+using ndn::OID;
+using ndn::OBufferStream;
const OID EndorseCertificate::PROFILE_EXT_OID("1.3.6.1.5.32.2.1");
const OID EndorseCertificate::ENDORSE_EXT_OID("1.3.6.1.5.32.2.2");
-const std::vector<std::string> EndorseCertificate::DEFAULT_ENDORSE_LIST = std::vector<std::string>();
+const vector<string> EndorseCertificate::DEFAULT_ENDORSE_LIST;
Chronos::EndorseExtensionMsg&
-operator << (Chronos::EndorseExtensionMsg& endorseExtension, const std::vector<std::string>& endorseList)
+operator<<(Chronos::EndorseExtensionMsg& endorseExtension, const vector<string>& endorseList)
{
- std::vector<std::string>::const_iterator it = endorseList.begin();
- for(; it != endorseList.end(); it++)
+ for (vector<string>::const_iterator it = endorseList.begin(); it != endorseList.end(); it++)
endorseExtension.add_endorseentry()->set_name(*it);
return endorseExtension;
}
Chronos::EndorseExtensionMsg&
-operator >> (Chronos::EndorseExtensionMsg& endorseExtension, std::vector<std::string>& endorseList)
+operator>>(Chronos::EndorseExtensionMsg& endorseExtension, vector<string>& endorseList)
{
- for(int i = 0; i < endorseExtension.endorseentry_size(); i ++)
+ for (int i = 0; i < endorseExtension.endorseentry_size(); i ++)
endorseList.push_back(endorseExtension.endorseentry(i).name());
return endorseExtension;
@@ -42,7 +50,7 @@
EndorseCertificate::EndorseCertificate(const IdentityCertificate& kskCertificate,
const Profile& profile,
- const std::vector<std::string>& endorseList)
+ const vector<string>& endorseList)
: Certificate()
, m_profile(profile)
, m_endorseList(endorseList)
@@ -56,7 +64,7 @@
setNotBefore(kskCertificate.getNotBefore());
setNotAfter(kskCertificate.getNotAfter());
- addSubjectDescription(CertificateSubjectDescription("2.5.4.41", m_keyName.toUri()));
+ addSubjectDescription(CertificateSubjectDescription(OID("2.5.4.41"), m_keyName.toUri()));
setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
OBufferStream profileStream;
@@ -74,7 +82,7 @@
EndorseCertificate::EndorseCertificate(const EndorseCertificate& endorseCertificate,
const Name& signer,
- const std::vector<std::string>& endorseList)
+ const vector<string>& endorseList)
: Certificate()
, m_keyName(endorseCertificate.m_keyName)
, m_signer(signer)
@@ -87,7 +95,7 @@
setNotBefore(endorseCertificate.getNotBefore());
setNotAfter(endorseCertificate.getNotAfter());
- addSubjectDescription(CertificateSubjectDescription("2.5.4.41", m_keyName.toUri()));
+ addSubjectDescription(CertificateSubjectDescription(OID("2.5.4.41"), m_keyName.toUri()));
setPublicKeyInfo(endorseCertificate.getPublicKeyInfo());
OBufferStream profileStream;
@@ -109,7 +117,7 @@
const time::system_clock::TimePoint& notAfter,
const Name& signer,
const Profile& profile,
- const std::vector<std::string>& endorseList)
+ const vector<string>& endorseList)
: Certificate()
, m_keyName(keyName)
, m_signer(signer)
@@ -122,7 +130,7 @@
setNotBefore(notBefore);
setNotAfter(notAfter);
- addSubjectDescription(CertificateSubjectDescription("2.5.4.41", m_keyName.toUri()));
+ addSubjectDescription(CertificateSubjectDescription(OID("2.5.4.41"), m_keyName.toUri()));
setPublicKeyInfo(key);
OBufferStream profileStream;
@@ -144,39 +152,37 @@
, m_signer(endorseCertificate.m_signer)
, m_profile(endorseCertificate.m_profile)
, m_endorseList(endorseCertificate.m_endorseList)
-{}
+{
+}
EndorseCertificate::EndorseCertificate(const Data& data)
: Certificate(data)
{
const Name& dataName = data.getName();
- if(dataName.size() < 3 || dataName.get(-3).toEscapedString() != "PROFILE-CERT")
+ if(dataName.size() < 3 || dataName.get(-3).toUri() != "PROFILE-CERT")
throw Error("No PROFILE-CERT component in data name!");
m_keyName = dataName.getPrefix(-3);
m_signer.wireDecode(dataName.get(-2).blockFromValue());
- ExtensionList::iterator it = m_extensionList.begin();
- for(; it != m_extensionList.end(); it++)
- {
- if(PROFILE_EXT_OID == it->getOid())
- {
- boost::iostreams::stream<boost::iostreams::array_source> is
- (reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
- m_profile.decode(is);
- }
- if(ENDORSE_EXT_OID == it->getOid())
- {
- Chronos::EndorseExtensionMsg endorseExtension;
- boost::iostreams::stream<boost::iostreams::array_source> is
- (reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
- endorseExtension.ParseFromIstream(&is);
-
- endorseExtension >> m_endorseList;
- }
+ for (ExtensionList::iterator it = m_extensionList.begin() ; it != m_extensionList.end(); it++) {
+ if (PROFILE_EXT_OID == it->getOid()) {
+ boost::iostreams::stream<boost::iostreams::array_source> is
+ (reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
+ m_profile.decode(is);
}
+ if (ENDORSE_EXT_OID == it->getOid()) {
+ Chronos::EndorseExtensionMsg endorseExtension;
+
+ boost::iostreams::stream<boost::iostreams::array_source> is
+ (reinterpret_cast<const char*>(it->getValue().buf()), it->getValue().size());
+ endorseExtension.ParseFromIstream(&is);
+
+ endorseExtension >> m_endorseList;
+ }
+ }
}
-}//chronos
+} // namespace chronos
diff --git a/src/endorse-certificate.h b/src/endorse-certificate.hpp
similarity index 61%
rename from src/endorse-certificate.h
rename to src/endorse-certificate.hpp
index 970b5b7..6a73edf 100644
--- a/src/endorse-certificate.h
+++ b/src/endorse-certificate.hpp
@@ -8,19 +8,24 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef CHRONOS_ENDORSE_CERTIFICATE_H
-#define CHRONOS_ENDORSE_CERTIFICATE_H
+#ifndef CHRONOS_ENDORSE_CERTIFICATE_HPP
+#define CHRONOS_ENDORSE_CERTIFICATE_HPP
-#include "profile.h"
-#include <vector>
-#include <ndn-cxx/security/identity-certificate.hpp>
+#include "profile.hpp"
-namespace chronos{
+namespace chronos {
class EndorseCertificate : public ndn::Certificate
{
public:
- struct Error : public ndn::Certificate::Error { Error(const std::string &what) : ndn::Certificate::Error(what) {} };
+ class Error : public ndn::Certificate::Error
+ {
+ public:
+ Error(const std::string& what)
+ : ndn::Certificate::Error(what)
+ {
+ }
+ };
static const std::vector<std::string> DEFAULT_ENDORSE_LIST;
@@ -31,51 +36,61 @@
const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
EndorseCertificate(const EndorseCertificate& endorseCertificate,
- const ndn::Name& signer,
+ const Name& signer,
const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
- EndorseCertificate(const ndn::Name& keyName,
+ EndorseCertificate(const Name& keyName,
const ndn::PublicKey& key,
- const ndn::time::system_clock::TimePoint& notBefore,
- const ndn::time::system_clock::TimePoint& notAfter,
- const ndn::Name& signer,
+ const time::system_clock::TimePoint& notBefore,
+ const time::system_clock::TimePoint& notAfter,
+ const Name& signer,
const Profile& profile,
const std::vector<std::string>& endorseList = DEFAULT_ENDORSE_LIST);
EndorseCertificate(const EndorseCertificate& endorseCertificate);
- EndorseCertificate(const ndn::Data& data);
+ EndorseCertificate(const Data& data);
virtual
~EndorseCertificate()
- {}
+ {
+ }
- const ndn::Name&
+ const Name&
getSigner() const
- { return m_signer; }
+ {
+ return m_signer;
+ }
const Profile&
getProfile() const
- { return m_profile; }
+ {
+ return m_profile;
+ }
const std::vector<std::string>&
getEndorseList() const
- { return m_endorseList; }
+ {
+ return m_endorseList;
+ }
- const ndn::Name&
+ const Name&
getPublicKeyName () const
- { return m_keyName; }
+ {
+ return m_keyName;
+ }
private:
static const ndn::OID PROFILE_EXT_OID;
static const ndn::OID ENDORSE_EXT_OID;
- ndn::Name m_keyName;
- ndn::Name m_signer; // signing key name
+ Name m_keyName;
+ Name m_signer; // signing key name
Profile m_profile;
std::vector<std::string> m_endorseList;
+
};
-}//chronos
+} // namespace chronos
-#endif
+#endif // CHRONOS_ENDORSE_CERTIFICATE_HPP
diff --git a/src/endorse-combobox-delegate.cpp b/src/endorse-combobox-delegate.cpp
index 906020a..d881f18 100644
--- a/src/endorse-combobox-delegate.cpp
+++ b/src/endorse-combobox-delegate.cpp
@@ -8,7 +8,7 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "endorse-combobox-delegate.h"
+#include "endorse-combobox-delegate.hpp"
#include <QComboBox>
#include <QApplication>
@@ -17,9 +17,9 @@
#include "logging.h"
#endif
-INIT_LOGGER("EndorseComboBoxDelegate");
+namespace chronos {
-EndorseComboBoxDelegate::EndorseComboBoxDelegate(QObject *parent)
+EndorseComboBoxDelegate::EndorseComboBoxDelegate(QObject* parent)
: QItemDelegate(parent)
{
m_items.push_back("Not Endorsed");
@@ -28,43 +28,45 @@
QWidget*
-EndorseComboBoxDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem &/* option */,
- const QModelIndex &/* index */) const
+EndorseComboBoxDelegate::createEditor(QWidget* parent,
+ const QStyleOptionViewItem& /* option */,
+ const QModelIndex& /* index */) const
{
QComboBox* editor = new QComboBox(parent);
- for(unsigned int i = 0; i < m_items.size(); ++i)
- editor->addItem(m_items[i].c_str());
+ for (unsigned int i = 0; i < m_items.size(); ++i)
+ editor->addItem(m_items[i].c_str());
return editor;
}
void
-EndorseComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+EndorseComboBoxDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
- QComboBox *comboBox = static_cast<QComboBox*>(editor);
+ QComboBox* comboBox = static_cast<QComboBox*>(editor);
int value = index.model()->data(index, Qt::EditRole).toUInt();
comboBox->setCurrentIndex(value);
}
void
-EndorseComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+EndorseComboBoxDelegate::setModelData(QWidget* editor,
+ QAbstractItemModel* model,
+ const QModelIndex& index) const
{
- QComboBox *comboBox = static_cast<QComboBox*>(editor);
+ QComboBox* comboBox = static_cast<QComboBox*>(editor);
model->setData(index, comboBox->currentIndex(), Qt::EditRole);
}
void
-EndorseComboBoxDelegate::updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option,
- const QModelIndex &/* index */) const
+EndorseComboBoxDelegate::updateEditorGeometry(QWidget* editor,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& /* index */) const
{
editor->setGeometry(option.rect);
}
void
-EndorseComboBoxDelegate::paint(QPainter *painter,
- const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+EndorseComboBoxDelegate::paint(QPainter* painter,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index) const
{
QStyleOptionViewItemV4 myOption = option;
QString text = m_items[index.model()->data(index, Qt::EditRole).toUInt()].c_str();
@@ -74,6 +76,8 @@
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &myOption, painter);
}
+} // namespace chronos
+
#if WAF
#include "endorse-combobox-delegate.moc"
#include "endorse-combobox-delegate.cpp.moc"
diff --git a/src/endorse-combobox-delegate.h b/src/endorse-combobox-delegate.h
deleted file mode 100644
index 424a8f7..0000000
--- a/src/endorse-combobox-delegate.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef ENDORSE_COMBOBOX_DELEGATE_H
-#define ENDORSE_COMBOBOX_DELEGATE_H
-
-#include <QItemDelegate>
-#include <string>
-#include <vector>
-
-class EndorseComboBoxDelegate : public QItemDelegate
-{
- Q_OBJECT
-public:
- EndorseComboBoxDelegate(QObject *parent = 0);
-
- // virtual
- // ~ComboBoxDelegate() {}
-
- QWidget*
- createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
- void
- setEditorData(QWidget *editor, const QModelIndex &index) const;
-
- void
- setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
-
- void
- updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
- void
- paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-
-private:
- std::vector<std::string> m_items;
-
-};
-
-#endif
diff --git a/src/endorse-combobox-delegate.hpp b/src/endorse-combobox-delegate.hpp
new file mode 100644
index 0000000..92e26d1
--- /dev/null
+++ b/src/endorse-combobox-delegate.hpp
@@ -0,0 +1,53 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_ENDORSE_COMBOBOX_DELEGATE_HPP
+#define CHRONOS_ENDORSE_COMBOBOX_DELEGATE_HPP
+
+#include <QItemDelegate>
+#include <string>
+#include <vector>
+
+namespace chronos {
+
+class EndorseComboBoxDelegate : public QItemDelegate
+{
+ Q_OBJECT
+public:
+ EndorseComboBoxDelegate(QObject* parent = 0);
+
+ // virtual
+ // ~ComboBoxDelegate() {}
+
+ QWidget*
+ createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+
+ void
+ setEditorData(QWidget* editor, const QModelIndex& index) const;
+
+ void
+ setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
+
+ void
+ updateEditorGeometry(QWidget* editor,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index) const;
+
+ void
+ paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+
+private:
+ std::vector<std::string> m_items;
+
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_ENDORSE_COMBOBOX_DELEGATE_HPP
diff --git a/src/endorse-info.proto b/src/endorse-info.proto
index a0612d0..41aa6f2 100644
--- a/src/endorse-info.proto
+++ b/src/endorse-info.proto
@@ -1,4 +1,4 @@
-package chronos;
+package Chronos;
message EndorseInfo
{
diff --git a/src/invitation-dialog.cpp b/src/invitation-dialog.cpp
index 17977f2..a847b93 100644
--- a/src/invitation-dialog.cpp
+++ b/src/invitation-dialog.cpp
@@ -8,12 +8,12 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "invitation-dialog.h"
+#include "invitation-dialog.hpp"
#include "ui_invitation-dialog.h"
-using namespace ndn;
+namespace chronos {
-InvitationDialog::InvitationDialog(QWidget *parent)
+InvitationDialog::InvitationDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::InvitationDialog)
{
@@ -61,6 +61,8 @@
m_invitationInterest.clear();
}
+} // namespace chronos
+
#if WAF
#include "invitation-dialog.moc"
#include "invitation-dialog.cpp.moc"
diff --git a/src/invitation-dialog.h b/src/invitation-dialog.hpp
similarity index 75%
rename from src/invitation-dialog.h
rename to src/invitation-dialog.hpp
index e6a9e97..0dab90f 100644
--- a/src/invitation-dialog.h
+++ b/src/invitation-dialog.hpp
@@ -8,25 +8,29 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef INVITATION_DIALOG_H
-#define INVITATION_DIALOG_H
+#ifndef CHRONOS_INVITATION_DIALOG_HPP
+#define CHRONOS_INVITATION_DIALOG_HPP
#include <QDialog>
#ifndef Q_MOC_RUN
-#include <ndn-cxx/name.hpp>
+#include "common.hpp"
#endif
namespace Ui {
class InvitationDialog;
}
+namespace chronos{
+
class InvitationDialog : public QDialog
{
Q_OBJECT
public:
- explicit InvitationDialog(QWidget *parent = 0);
+ explicit
+ InvitationDialog(QWidget* parent = 0);
+
~InvitationDialog();
void
@@ -47,8 +51,10 @@
private:
- Ui::InvitationDialog *ui;
+ Ui::InvitationDialog* ui;
ndn::Name m_invitationInterest;
};
-#endif // INVITATION_DIALOG_H
+} // namespace chronos
+
+#endif // CHRONOS_INVITATION_DIALOG_HPP
diff --git a/src/invitation.cpp b/src/invitation.cpp
index ae39761..97b3855 100644
--- a/src/invitation.cpp
+++ b/src/invitation.cpp
@@ -8,20 +8,18 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "invitation.h"
+#include "invitation.hpp"
-#include <ndn-cxx/security/identity-certificate.hpp>
#include <ndn-cxx/security/signature-sha256-with-rsa.hpp>
#include "logging.h"
-using namespace ndn;
-
-INIT_LOGGER("Invitation");
-
-
namespace chronos{
+using std::string;
+
+using ndn::IdentityCertificate;
+
const size_t Invitation::NAME_SIZE_MIN = 7;
const ssize_t Invitation::SIGNATURE = -1;
const ssize_t Invitation::KEY_LOCATOR = -2;
@@ -36,22 +34,22 @@
{
size_t nameSize = interestName.size();
- if(nameSize < NAME_SIZE_MIN)
+ if (nameSize < NAME_SIZE_MIN)
throw Error("Wrong Invitation Name: Wrong length");
- if(interestName.get(CHRONOCHAT_INVITATION).toEscapedString() != "CHRONOCHAT-INVITATION")
+ if (interestName.get(CHRONOCHAT_INVITATION).toUri() != "CHRONOCHAT-INVITATION")
throw Error("Wrong Invitation Name: Wrong application tags");
m_interestName = interestName.getPrefix(KEY_LOCATOR);
m_timestamp = interestName.get(TIMESTAMP).toNumber();
m_inviterCertificate.wireDecode(interestName.get(INVITER_CERT).blockFromValue());
m_inviterRoutingPrefix.wireDecode(interestName.get(INVITER_PREFIX).blockFromValue());
- m_chatroom = interestName.get(CHATROOM).toEscapedString();
+ m_chatroom = interestName.get(CHATROOM).toUri();
m_inviteeNameSpace = interestName.getPrefix(CHRONOCHAT_INVITATION);
}
Invitation::Invitation(const Name& inviteeNameSpace,
- const std::string& chatroom,
+ const string& chatroom,
const Name& inviterRoutingPrefix,
const IdentityCertificate& inviterCertificate)
: m_inviteeNameSpace(inviteeNameSpace)
@@ -78,4 +76,4 @@
{
}
-}//chronos
+} // namespace chronos
diff --git a/src/invitation.h b/src/invitation.hpp
similarity index 62%
rename from src/invitation.h
rename to src/invitation.hpp
index 6a53019..c724661 100644
--- a/src/invitation.h
+++ b/src/invitation.hpp
@@ -8,19 +8,19 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef CHRONOS_INVITATION_H
-#define CHRONOS_INVITATION_H
+#ifndef CHRONOS_INVITATION_HPP
+#define CHRONOS_INVITATION_HPP
-#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/signature.hpp>
+#include "common.hpp"
+
#include <ndn-cxx/security/identity-certificate.hpp>
-namespace chronos{
+namespace chronos {
class Invitation
{
- public:
+public:
/*
* /[invitee_namespace]
* /CHRONOCHAT-INVITATION
@@ -40,56 +40,79 @@
static const ssize_t CHATROOM;
static const ssize_t CHRONOCHAT_INVITATION;
- struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+ class Error : public std::runtime_error
+ {
+ public:
+ Error(const std::string& what)
+ : std::runtime_error(what)
+ {
+ }
+ };
- Invitation() {}
+ Invitation()
+ {
+ }
- Invitation(const ndn::Name& interestName);
+ Invitation(const Name& interestName);
- Invitation(const ndn::Name& inviteeNameSpace,
+ Invitation(const Name& inviteeNameSpace,
const std::string& chatroom,
- const ndn::Name& inviterRoutingPrefix,
+ const Name& inviterRoutingPrefix,
const ndn::IdentityCertificate& inviterCertificate);
Invitation(const Invitation& invitation);
virtual
- ~Invitation() {};
+ ~Invitation()
+ {
+ }
- const ndn::Name&
+ const Name&
getInviteeNameSpace() const
- { return m_inviteeNameSpace; }
+ {
+ return m_inviteeNameSpace;
+ }
const std::string&
getChatroom() const
- { return m_chatroom; }
+ {
+ return m_chatroom;
+ }
- const ndn::Name&
+ const Name&
getInviterRoutingPrefix() const
- { return m_inviterRoutingPrefix; }
+ {
+ return m_inviterRoutingPrefix;
+ }
const ndn::IdentityCertificate&
getInviterCertificate() const
- { return m_inviterCertificate; }
+ {
+ return m_inviterCertificate;
+ }
const uint64_t
getTimestamp() const
- { return m_timestamp; }
+ {
+ return m_timestamp;
+ }
- const ndn::Name&
+ const Name&
getUnsignedInterestName() const
- { return m_interestName; }
+ {
+ return m_interestName;
+ }
private:
- ndn::Name m_interestName;
+ Name m_interestName;
- ndn::Name m_inviteeNameSpace;
+ Name m_inviteeNameSpace;
std::string m_chatroom;
- ndn::Name m_inviterRoutingPrefix;
+ Name m_inviterRoutingPrefix;
ndn::IdentityCertificate m_inviterCertificate;
uint64_t m_timestamp;
};
-}//chronos
+} // namespace chronos
-#endif
+#endif // CHRONOS_INVITATION_HPP
diff --git a/src/invite-list-dialog.cpp b/src/invite-list-dialog.cpp
index 6f62c5a..ccac3ed 100644
--- a/src/invite-list-dialog.cpp
+++ b/src/invite-list-dialog.cpp
@@ -8,10 +8,12 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "invite-list-dialog.h"
+#include "invite-list-dialog.hpp"
#include "ui_invite-list-dialog.h"
-InviteListDialog::InviteListDialog(QWidget *parent)
+namespace chronos {
+
+InviteListDialog::InviteListDialog(QWidget* parent)
:QDialog(parent)
, ui(new Ui::InviteListDialog)
, m_contactListModel(new QStringListModel)
@@ -46,14 +48,13 @@
QModelIndexList selected = ui->contactListView->selectionModel()->selectedIndexes();
QString alias = m_contactListModel->data(selected.first(), Qt::DisplayRole).toString();
- for(int i = 0; i < m_contactAliasList.size(); i++) // TODO:: could be optimized without using for loop.
- {
- if(alias == m_contactAliasList[i])
- {
- emit sendInvitation(m_contactIdList[i]);
- break;
- }
+ // TODO:: could be optimized without using for loop.
+ for (int i = 0; i < m_contactAliasList.size(); i++) {
+ if (alias == m_contactAliasList[i]) {
+ emit sendInvitation(m_contactIdList[i]);
+ break;
}
+ }
this->close();
}
@@ -77,6 +78,8 @@
m_contactIdList = idList;
}
+} // namespace chronos
+
#if WAF
#include "invite-list-dialog.moc"
#include "invite-list-dialog.cpp.moc"
diff --git a/src/invite-list-dialog.h b/src/invite-list-dialog.hpp
similarity index 79%
rename from src/invite-list-dialog.h
rename to src/invite-list-dialog.hpp
index bf62ec0..848e07f 100644
--- a/src/invite-list-dialog.h
+++ b/src/invite-list-dialog.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef INVITE_LIST_DIALOG_H
-#define INVITE_LIST_DIALOG_H
+#ifndef CHRONOS_INVITE_LIST_DIALOG_HPP
+#define CHRONOS_INVITE_LIST_DIALOG_HPP
#include <QDialog>
#include <QStringListModel>
@@ -21,13 +21,15 @@
class InviteListDialog;
}
+namespace chronos {
+
class InviteListDialog : public QDialog
{
Q_OBJECT
public:
explicit
- InviteListDialog(QWidget *parent = 0);
+ InviteListDialog(QWidget* parent = 0);
~InviteListDialog();
@@ -53,10 +55,12 @@
onCancelClicked();
private:
- Ui::InviteListDialog *ui;
+ Ui::InviteListDialog* ui;
QStringListModel* m_contactListModel;
QStringList m_contactAliasList;
QStringList m_contactIdList;
};
-#endif // INVITE_LIST_DIALOG_H
+} // namespace chronos
+
+#endif // CHRONOS_INVITE_LIST_DIALOG_HPP
diff --git a/src/main.cpp b/src/main.cpp
index 6ad597b..afa3665 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -11,29 +11,26 @@
#include <QApplication>
// #include <QSystemTrayIcon>
-#include "controller.h"
+#include "controller.hpp"
#include "logging.h"
#include <ndn-cxx/face.hpp>
#include <boost/thread/thread.hpp>
-INIT_LOGGER("MAIN");
-
-using namespace ndn;
-using ndn::shared_ptr;
-
class NewApp : public QApplication
{
public:
- NewApp(int & argc, char ** argv)
+ NewApp(int& argc, char** argv)
: QApplication(argc, argv)
- { }
+ {
+ }
- bool notify(QObject * receiver, QEvent * event)
+ bool
+ notify(QObject* receiver, QEvent* event)
{
try {
return QApplication::notify(receiver, event);
}
- catch(std::exception& e){
+ catch (std::exception& e) {
std::cerr << "Exception thrown:" << e.what() << std::endl;
return false;
}
@@ -41,11 +38,13 @@
}
};
-void runIO(shared_ptr<boost::asio::io_service> ioService)
+void
+runIO(boost::asio::io_service& ioService)
{
- try{
- ioService->run();
- }catch(std::runtime_error& e){
+ try {
+ ioService.run();
+ }
+ catch (std::runtime_error& e) {
std::cerr << e.what() << std::endl;
}
}
@@ -54,12 +53,12 @@
{
NewApp app(argc, argv);
- shared_ptr<Face> face = make_shared<Face>();
+ ndn::shared_ptr<ndn::Face> face = ndn::make_shared<ndn::Face>();
chronos::Controller controller(face);
app.setQuitOnLastWindowClosed(false);
- boost::thread (runIO, face->ioService());
+ boost::thread(runIO, boost::ref(face->getIoService()));
return app.exec();
}
diff --git a/src/profile-editor.cpp b/src/profile-editor.cpp
index 9488f47..4e91a56 100644
--- a/src/profile-editor.cpp
+++ b/src/profile-editor.cpp
@@ -8,7 +8,7 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "profile-editor.h"
+#include "profile-editor.hpp"
#include "ui_profile-editor.h"
#include <QtSql/QSqlRecord>
#include <QtSql/QSqlField>
@@ -18,7 +18,9 @@
#include "logging.h"
#endif
-INIT_LOGGER("ProfileEditor")
+// INIT_LOGGER("ProfileEditor")
+
+namespace chronos {
ProfileEditor::ProfileEditor(QWidget *parent)
: QDialog(parent)
@@ -44,12 +46,11 @@
void
ProfileEditor::onCloseDBModule()
{
- _LOG_DEBUG("close db module");
- if(m_tableModel)
- {
- delete m_tableModel;
- _LOG_DEBUG("tableModel closed");
- }
+ // _LOG_DEBUG("close db module");
+ if (m_tableModel) {
+ delete m_tableModel;
+ // _LOG_DEBUG("tableModel closed");
+ }
}
void
@@ -85,8 +86,7 @@
QItemSelectionModel* selectionModel = ui->profileTable->selectionModel();
QModelIndexList indexList = selectionModel->selectedIndexes();
- int i = indexList.size() - 1;
- for(; i >= 0; i--)
+ for (int i = indexList.size() - 1; i >= 0; i--)
m_tableModel->removeRow(indexList[i].row());
m_tableModel->submitAll();
@@ -100,6 +100,8 @@
this->hide();
}
+} // namespace chronos
+
#if WAF
#include "profile-editor.moc"
#include "profile-editor.cpp.moc"
diff --git a/src/profile-editor.h b/src/profile-editor.hpp
similarity index 77%
rename from src/profile-editor.h
rename to src/profile-editor.hpp
index 8ec9713..1dc5f5e 100644
--- a/src/profile-editor.h
+++ b/src/profile-editor.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef PROFILE_EDITOR_H
-#define PROFILE_EDITOR_H
+#ifndef CHRONOS_PROFILE_EDITOR_HPP
+#define CHRONOS_PROFILE_EDITOR_HPP
#include <QDialog>
#include <QtSql/QSqlTableModel>
@@ -21,12 +21,14 @@
class ProfileEditor;
}
+namespace chronos {
+
class ProfileEditor : public QDialog
{
Q_OBJECT
public:
- explicit ProfileEditor(QWidget *parent = 0);
+ explicit ProfileEditor(QWidget* parent = 0);
~ProfileEditor();
@@ -52,9 +54,11 @@
updateProfile();
private:
- Ui::ProfileEditor *ui;
+ Ui::ProfileEditor* ui;
QSqlTableModel* m_tableModel;
QString m_identity;
};
-#endif // PROFILE_EDITOR_H
+} // namespace chronos
+
+#endif // CHRONOS_PROFILE_EDITOR_HPP
diff --git a/src/profile.cpp b/src/profile.cpp
index e6044fa..cd69849 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -8,15 +8,18 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "profile.h"
+#include "profile.hpp"
#include "logging.h"
-using namespace ndn;
-
-INIT_LOGGER("Profile");
-
namespace chronos{
+using std::vector;
+using std::string;
+using std::map;
+
+using ndn::IdentityCertificate;
+using ndn::CertificateSubjectDescription;
+
const std::string Profile::OID_NAME("2.5.4.41");
const std::string Profile::OID_ORG("2.5.4.11");
const std::string Profile::OID_GROUP("2.5.4.1");
@@ -28,29 +31,30 @@
{
Name keyName = IdentityCertificate::certificateNameToPublicKeyName(identityCertificate.getName());
- m_entries[std::string("IDENTITY")] = keyName.getPrefix(-1).toUri();
+ m_entries[string("IDENTITY")] = keyName.getPrefix(-1).toUri();
- const std::vector<CertificateSubjectDescription>& subList = identityCertificate.getSubjectDescriptionList();
- std::vector<CertificateSubjectDescription>::const_iterator it = subList.begin();
- for(; it != subList.end(); it++)
- {
- const std::string oidStr = it->getOidString();
- std::string valueStr = it->getValue();
- if(oidStr == OID_NAME)
- m_entries["name"] = valueStr;
- else if(oidStr == OID_ORG)
- m_entries["institution"] = valueStr;
- else if(oidStr == OID_GROUP)
- m_entries["group"] = valueStr;
- else if(oidStr == OID_HOMEPAGE)
- m_entries["homepage"] = valueStr;
- else if(oidStr == OID_ADVISOR)
- m_entries["advisor"] = valueStr;
- else if(oidStr == OID_EMAIL)
- m_entries["email"] = valueStr;
- else
- m_entries[oidStr] = valueStr;
- }
+ const vector<CertificateSubjectDescription>& subList =
+ identityCertificate.getSubjectDescriptionList();
+
+ for (vector<CertificateSubjectDescription>::const_iterator it = subList.begin();
+ it != subList.end(); it++) {
+ const string oidStr = it->getOidString();
+ string valueStr = it->getValue();
+ if (oidStr == OID_NAME)
+ m_entries["name"] = valueStr;
+ else if (oidStr == OID_ORG)
+ m_entries["institution"] = valueStr;
+ else if (oidStr == OID_GROUP)
+ m_entries["group"] = valueStr;
+ else if (oidStr == OID_HOMEPAGE)
+ m_entries["homepage"] = valueStr;
+ else if (oidStr == OID_ADVISOR)
+ m_entries["advisor"] = valueStr;
+ else if (oidStr == OID_EMAIL)
+ m_entries["email"] = valueStr;
+ else
+ m_entries[oidStr] = valueStr;
+ }
}
Profile::Profile(const Name& identityName)
@@ -59,8 +63,8 @@
}
Profile::Profile(const Name& identityName,
- const std::string& name,
- const std::string& institution)
+ const string& name,
+ const string& institution)
{
m_entries["IDENTITY"] = identityName.toUri();
m_entries["name"] = name;
@@ -69,7 +73,8 @@
Profile::Profile(const Profile& profile)
: m_entries(profile.m_entries)
-{}
+{
+}
void
Profile::encode(std::ostream& os) const
@@ -87,29 +92,50 @@
profileMsg >> (*this);
}
-Chronos::ProfileMsg&
-operator << (Chronos::ProfileMsg& profileMsg, const Profile& profile)
+bool
+Profile::operator==(const Profile& profile) const
{
- std::map<std::string, std::string>::const_iterator it = profile.begin();
- for(; it != profile.end(); it++)
- {
- Chronos::ProfileMsg::ProfileEntry* profileEntry = profileMsg.add_entry();
- profileEntry->set_oid(it->first);
- profileEntry->set_data(it->second);
- }
+ if (m_entries.size() != profile.m_entries.size())
+ return false;
+
+ for(map<string, string>::const_iterator it = m_entries.begin(); it != m_entries.end(); it++) {
+ map<string, string>::const_iterator found = profile.m_entries.find(it->first);
+ if (found == profile.m_entries.end())
+ return false;
+ if (found->second != it->second)
+ return false;
+ }
+
+ return true;
+}
+
+bool
+Profile::operator!=(const Profile& profile) const
+{
+ return !(*this == profile);
+}
+
+Chronos::ProfileMsg&
+operator<<(Chronos::ProfileMsg& profileMsg, const Profile& profile)
+{
+;
+ for (map<string, string>::const_iterator it = profile.begin(); it != profile.end(); it++) {
+ Chronos::ProfileMsg::ProfileEntry* profileEntry = profileMsg.add_entry();
+ profileEntry->set_oid(it->first);
+ profileEntry->set_data(it->second);
+ }
return profileMsg;
}
Chronos::ProfileMsg&
-operator >> (Chronos::ProfileMsg& profileMsg, Profile& profile)
+operator>>(Chronos::ProfileMsg& profileMsg, Profile& profile)
{
- for(int i = 0; i < profileMsg.entry_size(); i++)
- {
- const Chronos::ProfileMsg::ProfileEntry& profileEntry = profileMsg.entry(i);
- profile[profileEntry.oid()] = profileEntry.data();
- }
+ for (int i = 0; i < profileMsg.entry_size(); i++) {
+ const Chronos::ProfileMsg::ProfileEntry& profileEntry = profileMsg.entry(i);
+ profile[profileEntry.oid()] = profileEntry.data();
+ }
return profileMsg;
}
-}//chronos
+} // namespace chronos
diff --git a/src/profile.h b/src/profile.h
deleted file mode 100644
index 17b8d6c..0000000
--- a/src/profile.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef CHRONOS_PROFILE_H
-#define CHRONOS_PROFILE_H
-
-#include "config.h"
-#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/security/identity-certificate.hpp>
-#include <map>
-#include <string>
-#include "profile.pb.h"
-
-namespace chronos{
-
-class Profile
-{
-public:
- typedef std::map<std::string, std::string>::iterator iterator;
- typedef std::map<std::string, std::string>::const_iterator const_iterator;
-
- Profile() {}
-
- Profile(const ndn::IdentityCertificate& identityCertificate);
-
- Profile(const ndn::Name& identityName);
-
- Profile(const ndn::Name& identityName,
- const std::string& name,
- const std::string& institution);
-
- Profile(const Profile& profile);
-
- ~Profile() {}
-
- std::string&
- operator [] (const std::string& profileKey)
- { return m_entries[profileKey]; }
-
- std::string
- get (const std::string& profileKey) const
- {
- std::map<std::string, std::string>::const_iterator it = m_entries.find(profileKey);
- if(it != m_entries.end())
- return it->second;
- else
- return std::string();
- }
-
- inline Profile::iterator
- begin()
- { return m_entries.begin(); }
-
- inline Profile::const_iterator
- begin() const
- { return m_entries.begin(); }
-
- inline Profile::iterator
- end()
- { return m_entries.end(); }
-
- inline Profile::const_iterator
- end() const
- { return m_entries.end(); }
-
- void
- encode(std::ostream& os) const;
-
- void
- decode(std::istream& is);
-
- ndn::Name
- getIdentityName() const
- { return ndn::Name(m_entries.at("IDENTITY")); }
-
- inline bool
- operator == (const Profile& profile) const;
-
- inline bool
- operator != (const Profile& profile) const;
-
-private:
- static const std::string OID_NAME;
- static const std::string OID_ORG;
- static const std::string OID_GROUP;
- static const std::string OID_HOMEPAGE;
- static const std::string OID_ADVISOR;
- static const std::string OID_EMAIL;
-
- std::map<std::string, std::string> m_entries;
-};
-
-Chronos::ProfileMsg&
-operator << (Chronos::ProfileMsg& msg, const Profile& profile);
-
-Chronos::ProfileMsg&
-operator >> (Chronos::ProfileMsg& msg, Profile& profile);
-
-inline bool
-Profile::operator == (const Profile& profile) const
-{
- if(m_entries.size() != profile.m_entries.size())
- return false;
-
- std::map<std::string, std::string>::const_iterator it = m_entries.begin();
- for(; it != m_entries.end(); it++)
- {
- std::map<std::string, std::string>::const_iterator found = profile.m_entries.find(it->first);
- if(found == profile.m_entries.end())
- return false;
- if(found->second != it->second)
- return false;
- }
-
- return true;
-}
-
-inline bool
-Profile::operator != (const Profile& profile) const
-{
- return !(*this == profile);
-}
-
-}//chronos
-
-#endif
diff --git a/src/profile.hpp b/src/profile.hpp
new file mode 100644
index 0000000..2f4b2cf
--- /dev/null
+++ b/src/profile.hpp
@@ -0,0 +1,122 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_PROFILE_HPP
+#define CHRONOS_PROFILE_HPP
+
+#include "common.hpp"
+
+#include <ndn-cxx/security/identity-certificate.hpp>
+#include "profile.pb.h"
+
+namespace chronos {
+
+class Profile
+{
+public:
+ typedef std::map<std::string, std::string>::iterator iterator;
+ typedef std::map<std::string, std::string>::const_iterator const_iterator;
+
+ Profile()
+ {
+ }
+
+ Profile(const ndn::IdentityCertificate& identityCertificate);
+
+ Profile(const Name& identityName);
+
+ Profile(const Name& identityName,
+ const std::string& name,
+ const std::string& institution);
+
+ Profile(const Profile& profile);
+
+ ~Profile()
+ {
+ }
+
+ std::string&
+ operator[](const std::string& profileKey)
+ {
+ return m_entries[profileKey];
+ }
+
+ std::string
+ get(const std::string& profileKey) const
+ {
+ std::map<std::string, std::string>::const_iterator it = m_entries.find(profileKey);
+ if (it != m_entries.end())
+ return it->second;
+ else
+ return std::string();
+ }
+
+ Profile::iterator
+ begin()
+ {
+ return m_entries.begin();
+ }
+
+ Profile::const_iterator
+ begin() const
+ {
+ return m_entries.begin();
+ }
+
+ Profile::iterator
+ end()
+ {
+ return m_entries.end();
+ }
+
+ Profile::const_iterator
+ end() const
+ {
+ return m_entries.end();
+ }
+
+ void
+ encode(std::ostream& os) const;
+
+ void
+ decode(std::istream& is);
+
+ Name
+ getIdentityName() const
+ {
+ return ndn::Name(m_entries.at("IDENTITY"));
+ }
+
+ bool
+ operator==(const Profile& profile) const;
+
+ bool
+ operator!=(const Profile& profile) const;
+
+private:
+ static const std::string OID_NAME;
+ static const std::string OID_ORG;
+ static const std::string OID_GROUP;
+ static const std::string OID_HOMEPAGE;
+ static const std::string OID_ADVISOR;
+ static const std::string OID_EMAIL;
+
+ std::map<std::string, std::string> m_entries;
+};
+
+Chronos::ProfileMsg&
+operator<<(Chronos::ProfileMsg& msg, const Profile& profile);
+
+Chronos::ProfileMsg&
+operator>>(Chronos::ProfileMsg& msg, Profile& profile);
+
+} // namespace chronos
+
+#endif // CHRONOS_PROFILE_HPP
diff --git a/src/set-alias-dialog.cpp b/src/set-alias-dialog.cpp
index ef21ab7..599749c 100644
--- a/src/set-alias-dialog.cpp
+++ b/src/set-alias-dialog.cpp
@@ -8,11 +8,12 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "set-alias-dialog.h"
+#include "set-alias-dialog.hpp"
#include "ui_set-alias-dialog.h"
+namespace chronos {
-SetAliasDialog::SetAliasDialog(QWidget *parent)
+SetAliasDialog::SetAliasDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SetAliasDialog)
{
@@ -51,6 +52,7 @@
ui->aliasInput->setText(alias);
}
+} // namespace chronos
#if WAF
#include "set-alias-dialog.moc"
diff --git a/src/set-alias-dialog.h b/src/set-alias-dialog.hpp
similarity index 76%
rename from src/set-alias-dialog.h
rename to src/set-alias-dialog.hpp
index c04ea55..dc43de6 100644
--- a/src/set-alias-dialog.h
+++ b/src/set-alias-dialog.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef SETALIASDIALOG_H
-#define SETALIASDIALOG_H
+#ifndef CHRONOS_SET_ALIAS_DIALOG_HPP
+#define CHRONOS_SET_ALIAS_DIALOG_HPP
#include <QDialog>
@@ -21,13 +21,15 @@
class SetAliasDialog;
}
+namespace chronos {
+
class SetAliasDialog : public QDialog
{
Q_OBJECT
public:
explicit
- SetAliasDialog(QWidget *parent = 0);
+ SetAliasDialog(QWidget* parent = 0);
~SetAliasDialog();
@@ -46,8 +48,10 @@
onCancelClicked();
private:
- Ui::SetAliasDialog *ui;
+ Ui::SetAliasDialog* ui;
QString m_targetIdentity;
};
-#endif // SETALIASDIALOG_H
+} // namespace chronos
+
+#endif // CHRONOS_SET_ALIAS_DIALOG_HPP
diff --git a/src/setting-dialog.cpp b/src/setting-dialog.cpp
index c81bfdd..59c6b73 100644
--- a/src/setting-dialog.cpp
+++ b/src/setting-dialog.cpp
@@ -8,10 +8,12 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "setting-dialog.h"
+#include "setting-dialog.hpp"
#include "ui_setting-dialog.h"
-SettingDialog::SettingDialog(QWidget *parent)
+namespace chronos {
+
+SettingDialog::SettingDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SettingDialog)
{
@@ -68,6 +70,7 @@
this->close();
}
+} // namespace chronos
#if WAF
#include "setting-dialog.moc"
diff --git a/src/setting-dialog.h b/src/setting-dialog.hpp
similarity index 78%
rename from src/setting-dialog.h
rename to src/setting-dialog.hpp
index fc61fb4..443b87d 100644
--- a/src/setting-dialog.h
+++ b/src/setting-dialog.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef SETTING_DIALOG_H
-#define SETTING_DIALOG_H
+#ifndef CHRONOS_SETTING_DIALOG_HPP
+#define CHRONOS_SETTING_DIALOG_HPP
#include <QDialog>
@@ -20,13 +20,15 @@
class SettingDialog;
}
+namespace chronos {
+
class SettingDialog : public QDialog
{
Q_OBJECT
public:
explicit
- SettingDialog(QWidget *parent = 0);
+ SettingDialog(QWidget* parent = 0);
~SettingDialog();
@@ -52,9 +54,11 @@
onCancelClicked();
private:
- Ui::SettingDialog *ui;
+ Ui::SettingDialog* ui;
QString m_identity;
QString m_nick;
};
-#endif // SETTING_DIALOG_H
+} // namespace chronos
+
+#endif // CHRONOS_SETTING_DIALOG_HPP
diff --git a/src/start-chat-dialog.cpp b/src/start-chat-dialog.cpp
index f79e4a2..8aa7965 100644
--- a/src/start-chat-dialog.cpp
+++ b/src/start-chat-dialog.cpp
@@ -8,9 +8,11 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "start-chat-dialog.h"
+#include "start-chat-dialog.hpp"
#include "ui_start-chat-dialog.h"
+namespace chronos {
+
StartChatDialog::StartChatDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::StartChatDialog)
@@ -49,6 +51,8 @@
this->close();
}
+} // namespace chronos
+
#if WAF
#include "start-chat-dialog.moc"
#include "start-chat-dialog.cpp.moc"
diff --git a/src/start-chat-dialog.h b/src/start-chat-dialog.hpp
similarity index 73%
rename from src/start-chat-dialog.h
rename to src/start-chat-dialog.hpp
index 771c993..be7eafe 100644
--- a/src/start-chat-dialog.h
+++ b/src/start-chat-dialog.hpp
@@ -8,8 +8,8 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef START_CHAT_DIALOG_H
-#define START_CHAT_DIALOG_H
+#ifndef CHRONOS_START_CHAT_DIALOG_HPP
+#define CHRONOS_START_CHAT_DIALOG_HPP
#include <QDialog>
@@ -21,12 +21,14 @@
class StartChatDialog;
}
+namespace chronos {
+
class StartChatDialog : public QDialog
{
Q_OBJECT
public:
- explicit StartChatDialog(QWidget *parent = 0);
+ explicit StartChatDialog(QWidget* parent = 0);
~StartChatDialog();
@@ -45,7 +47,9 @@
onCancelClicked();
private:
- Ui::StartChatDialog *ui;
+ Ui::StartChatDialog* ui;
};
-#endif // START_CHAT_DIALOG_H
+} // namespace chronos
+
+#endif // CHRONOS_START_CHAT_DIALOG_HPP
diff --git a/src/tree-layout.cpp b/src/tree-layout.cpp
index 7fba509..d2c4d2c 100644
--- a/src/tree-layout.cpp
+++ b/src/tree-layout.cpp
@@ -10,23 +10,25 @@
* Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "tree-layout.h"
-
+#include "tree-layout.hpp"
#include <iostream>
+namespace chronos {
+
+using std::vector;
+using std::map;
+
void
-OneLevelTreeLayout::setOneLevelLayout(std::vector<Coordinate> &childNodesCo)
+OneLevelTreeLayout::setOneLevelLayout(vector<Coordinate>& childNodesCo)
{
if (childNodesCo.empty())
- {
return;
- }
+
double y = getLevelDistance();
double sd = getSiblingDistance();
int n = childNodesCo.size();
double x = - (n - 1) * sd / 2;
- for (int i = 0; i < n; i++)
- {
+ for (int i = 0; i < n; i++) {
childNodesCo[i].x = x;
childNodesCo[i].y = y;
x += sd;
@@ -36,36 +38,30 @@
void
MultipleLevelTreeLayout::setMultipleLevelTreeLayout(TrustTreeNodeList& nodeList)
{
- if(nodeList.empty())
+ if (nodeList.empty())
return;
double ld = getLevelDistance();
double sd = getSiblingDistance();
- std::map<int, double> layerSpan;
+ map<int, double> layerSpan;
- TrustTreeNodeList::iterator it = nodeList.begin();
- TrustTreeNodeList::iterator end = nodeList.end();
- for(; it != end; it++)
- {
- int layer = (*it)->level();
- (*it)->y = layer * ld;
- (*it)->x = layerSpan[layer];
- layerSpan[layer] += sd;
- }
+ for (TrustTreeNodeList::iterator it = nodeList.begin(); it != nodeList.end(); it++) {
+ int layer = (*it)->level();
+ (*it)->y = layer * ld;
+ (*it)->x = layerSpan[layer];
+ layerSpan[layer] += sd;
+ }
- std::map<int, double>::iterator layerIt = layerSpan.begin();
- std::map<int, double>::iterator layerEnd = layerSpan.end();
- for(; layerIt != layerEnd; layerIt++)
- {
- double shift = (layerIt->second - sd) / 2;
- layerIt->second = shift;
- }
+ for (map<int, double>::iterator layerIt = layerSpan.begin();
+ layerIt != layerSpan.end(); layerIt++) {
+ double shift = (layerIt->second - sd) / 2;
+ layerIt->second = shift;
+ }
- it = nodeList.begin();
- end = nodeList.end();
- for(; it != end; it++)
- {
- (*it)->x -= layerSpan[(*it)->level()];
- }
+ for (TrustTreeNodeList::iterator it = nodeList.begin(); it != nodeList.end(); it++) {
+ (*it)->x -= layerSpan[(*it)->level()];
+ }
}
+
+} // namespace chronos
diff --git a/src/tree-layout.h b/src/tree-layout.h
deleted file mode 100644
index aa69251..0000000
--- a/src/tree-layout.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- * Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef TREE_LAYOUT_H
-#define TREE_LAYOUT_H
-
-#include <vector>
-#include "trust-tree-node.h"
-
-class TreeLayout
-{
-public:
- struct Coordinate
- {
- double x;
- double y;
- };
- TreeLayout(){}
- virtual void setOneLevelLayout(std::vector<Coordinate> &childNodesCo){};
- void setSiblingDistance(int d) {m_siblingDistance = d;}
- void setLevelDistance(int d) {m_levelDistance = d;}
- int getSiblingDistance() {return m_siblingDistance;}
- int getLevelDistance() {return m_levelDistance;}
- virtual ~TreeLayout(){}
-private:
- int m_siblingDistance;
- int m_levelDistance;
-};
-
-class OneLevelTreeLayout : public TreeLayout
-{
-public:
- OneLevelTreeLayout(){}
- virtual void setOneLevelLayout(std::vector<Coordinate> &childNodesCo);
- virtual ~OneLevelTreeLayout(){}
-};
-
-class MultipleLevelTreeLayout : public TreeLayout
-{
-public:
- MultipleLevelTreeLayout(){}
- virtual ~MultipleLevelTreeLayout(){}
- virtual void setMultipleLevelTreeLayout(TrustTreeNodeList& nodeList);
-};
-
-#endif // TREE_LAYOUT_H
diff --git a/src/tree-layout.hpp b/src/tree-layout.hpp
new file mode 100644
index 0000000..a33142e
--- /dev/null
+++ b/src/tree-layout.hpp
@@ -0,0 +1,105 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_TREE_LAYOUT_HPP
+#define CHRONOS_TREE_LAYOUT_HPP
+
+#include "trust-tree-node.hpp"
+
+namespace chronos {
+
+class TreeLayout
+{
+public:
+ struct Coordinate
+ {
+ double x;
+ double y;
+ };
+
+ TreeLayout()
+ {
+ }
+
+ virtual
+ ~TreeLayout()
+ {
+ }
+
+ virtual void
+ setOneLevelLayout(std::vector<Coordinate>& childNodesCo)
+ {
+ }
+
+ void
+ setSiblingDistance(int d)
+ {
+ m_siblingDistance = d;
+ }
+
+ void
+ setLevelDistance(int d)
+ {
+ m_levelDistance = d;
+ }
+
+ int
+ getSiblingDistance()
+ {
+ return m_siblingDistance;
+ }
+
+ int
+ getLevelDistance()
+ {
+ return m_levelDistance;
+ }
+
+
+private:
+ int m_siblingDistance;
+ int m_levelDistance;
+};
+
+class OneLevelTreeLayout : public TreeLayout
+{
+public:
+ OneLevelTreeLayout()
+ {
+ }
+
+ virtual ~OneLevelTreeLayout()
+ {
+ }
+
+ virtual void
+ setOneLevelLayout(std::vector<Coordinate>& childNodesCo);
+
+};
+
+class MultipleLevelTreeLayout : public TreeLayout
+{
+public:
+ MultipleLevelTreeLayout()
+ {
+ }
+
+ virtual ~MultipleLevelTreeLayout()
+ {
+ }
+
+ virtual void setMultipleLevelTreeLayout(TrustTreeNodeList& nodeList);
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_TREE_LAYOUT_HPP
diff --git a/src/trust-tree-node.h b/src/trust-tree-node.hpp
similarity index 72%
rename from src/trust-tree-node.h
rename to src/trust-tree-node.hpp
index 77b62e6..2fe455a 100644
--- a/src/trust-tree-node.h
+++ b/src/trust-tree-node.hpp
@@ -8,15 +8,16 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#ifndef TRUST_TREE_NODE_H
-#define TRUST_TREE_NODE_H
+#ifndef CHRONOS_TRUST_TREE_NODE_HPP
+#define CHRONOS_TRUST_TREE_NODE_HPP
-#include <vector>
-#include <ndn-cxx/name.hpp>
+#include "common.hpp"
+
+namespace chronos {
class TrustTreeNode;
-typedef std::vector<ndn::shared_ptr<TrustTreeNode> > TrustTreeNodeList;
+typedef std::vector<shared_ptr<TrustTreeNode> > TrustTreeNodeList;
class TrustTreeNode
{
@@ -24,25 +25,28 @@
TrustTreeNode()
: m_level(-1)
, m_visited(false)
- {}
+ {
+ }
- TrustTreeNode(const ndn::Name& name)
+ TrustTreeNode(const Name& name)
: m_name(name)
, m_level(-1)
, m_visited(false)
- {}
+ {
+ }
~TrustTreeNode()
- {}
+ {
+ }
- const ndn::Name&
+ const Name&
name()
{
return m_name;
}
void
- addIntroducee(const ndn::shared_ptr<TrustTreeNode>& introducee)
+ addIntroducee(const shared_ptr<TrustTreeNode>& introducee)
{
m_introducees.push_back(introducee);
}
@@ -54,7 +58,7 @@
}
void
- addIntroducer(const ndn::shared_ptr<TrustTreeNode>& introducer)
+ addIntroducer(const shared_ptr<TrustTreeNode>& introducer)
{
m_introducers.push_back(introducer);
}
@@ -100,13 +104,13 @@
double y;
private:
- ndn::Name m_name;
+ Name m_name;
TrustTreeNodeList m_introducees;
TrustTreeNodeList m_introducers;
int m_level;
bool m_visited;
};
+} // namespace chronos
-
-#endif // TRUST_TREE_NODE_H
+#endif // CHRONOS_TRUST_TREE_NODE_HPP
diff --git a/src/trust-tree-scene.cpp b/src/trust-tree-scene.cpp
index d3f84b5..73643f2 100644
--- a/src/trust-tree-scene.cpp
+++ b/src/trust-tree-scene.cpp
@@ -8,23 +8,23 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "trust-tree-scene.h"
+#include "trust-tree-scene.hpp"
#include <QtGui>
#ifndef Q_MOC_RUN
-#include <vector>
-#include <iostream>
#include <assert.h>
-#include <boost/lexical_cast.hpp>
#include <memory>
#endif
+namespace chronos {
+
static const double Pi = 3.14159265358979323846264338327950288419717;
-TrustTreeScene::TrustTreeScene(QWidget *parent)
+TrustTreeScene::TrustTreeScene(QWidget* parent)
: QGraphicsScene(parent)
-{}
+{
+}
void
TrustTreeScene::plotTrustTree(TrustTreeNodeList& nodeList)
@@ -32,9 +32,10 @@
clear();
int nodeSize = 40;
- int siblingDistance = 100, levelDistance = 100;
+ int siblingDistance = 100;
+ int levelDistance = 100;
- boost::shared_ptr<MultipleLevelTreeLayout> layout(new MultipleLevelTreeLayout());
+ shared_ptr<MultipleLevelTreeLayout> layout(new MultipleLevelTreeLayout());
layout->setSiblingDistance(siblingDistance);
layout->setLevelDistance(levelDistance);
layout->setMultipleLevelTreeLayout(nodeList);
@@ -46,41 +47,37 @@
void
TrustTreeScene::plotEdge(const TrustTreeNodeList& nodeList, int nodeSize)
{
- TrustTreeNodeList::const_iterator it = nodeList.begin();
- TrustTreeNodeList::const_iterator end = nodeList.end();
- for(; it != end; it++)
- {
- TrustTreeNodeList& introducees = (*it)->getIntroducees();
- TrustTreeNodeList::iterator eeIt = introducees.begin();
- TrustTreeNodeList::iterator eeEnd = introducees.end();
+ for (TrustTreeNodeList::const_iterator it = nodeList.begin(); it != nodeList.end(); it++) {
+ TrustTreeNodeList& introducees = (*it)->getIntroducees();
+ for (TrustTreeNodeList::iterator eeIt = introducees.begin();
+ eeIt != introducees.end(); eeIt++) {
+ if ((*it)->level() >= (*eeIt)->level())
+ continue;
- for(; eeIt != eeEnd; eeIt++)
- {
- if((*it)->level() >= (*eeIt)->level())
- continue;
+ double x1 = (*it)->x;
+ double y1 = (*it)->y;
+ double x2 = (*eeIt)->x;
+ double y2 = (*eeIt)->y;
- double x1 = (*it)->x;
- double y1 = (*it)->y;
- double x2 = (*eeIt)->x;
- double y2 = (*eeIt)->y;
+ QPointF src(x1 + nodeSize/2, y1 + nodeSize/2);
+ QPointF dest(x2 + nodeSize/2, y2 + nodeSize/2);
+ QLineF line(src, dest);
+ double angle = ::acos(line.dx() / line.length());
- QPointF src(x1 + nodeSize/2, y1 + nodeSize/2);
- QPointF dest(x2 + nodeSize/2, y2 + nodeSize/2);
- QLineF line(src, dest);
- double angle = ::acos(line.dx() / line.length());
+ double arrowSize = 10;
+ QPointF endP0 = src + QPointF((nodeSize/2) * line.dx() / line.dy(), nodeSize/2);
+ QPointF sourceArrowP0 = dest + QPointF((-nodeSize/2) * line.dx() / line.dy(),
+ -nodeSize/2);
+ QPointF sourceArrowP1 = sourceArrowP0 + QPointF(-cos(angle - Pi / 6) * arrowSize,
+ -sin(angle - Pi / 6) * arrowSize);
+ QPointF sourceArrowP2 = sourceArrowP0 + QPointF(-cos(angle + Pi / 6) * arrowSize,
+ -sin(angle + Pi / 6) * arrowSize);
- double arrowSize = 10;
- QPointF endP0 = src + QPointF((nodeSize/2) * line.dx() / line.dy(), nodeSize/2);
- QPointF sourceArrowP0 = dest + QPointF((-nodeSize/2) * line.dx() / line.dy(), -nodeSize/2);
- QPointF sourceArrowP1 = sourceArrowP0 + QPointF(-cos(angle - Pi / 6) * arrowSize,
- -sin(angle - Pi / 6) * arrowSize);
- QPointF sourceArrowP2 = sourceArrowP0 + QPointF(-cos(angle + Pi / 6) * arrowSize,
- -sin(angle + Pi / 6) * arrowSize);
-
- addLine(QLineF(sourceArrowP0, endP0), QPen(Qt::black));
- addPolygon(QPolygonF() << sourceArrowP0 << sourceArrowP1 << sourceArrowP2, QPen(Qt::black), QBrush(Qt::black));
- }
+ addLine(QLineF(sourceArrowP0, endP0), QPen(Qt::black));
+ addPolygon(QPolygonF() << sourceArrowP0 << sourceArrowP1 << sourceArrowP2,
+ QPen(Qt::black), QBrush(Qt::black));
}
+ }
}
void
@@ -89,10 +86,7 @@
int rim = 3;
// plot nodes
- TrustTreeNodeList::const_iterator it = nodeList.begin();
- TrustTreeNodeList::const_iterator end = nodeList.end();
- for(; it != end; it++)
- {
+ for (TrustTreeNodeList::const_iterator it = nodeList.begin(); it != nodeList.end(); it++) {
double x = (*it)->x;
double y = (*it)->y;
QRectF boundingRect(x, y, nodeSize, nodeSize);
@@ -108,9 +102,10 @@
nickItem->setFont(QFont("Cursive", 8, QFont::Bold));
nickItem->setPos(x - nodeSize / 2 + 10, y + nodeSize + 5);
}
-
}
+} //namespace chronos
+
#if WAF
#include "trust-tree-scene.moc"
#include "trust-tree-scene.cpp.moc"
diff --git a/src/trust-tree-scene.h b/src/trust-tree-scene.h
deleted file mode 100644
index 384c4cc..0000000
--- a/src/trust-tree-scene.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef TRUST_TREE_SCENE_H
-#define TRUST_TREE_SCENE_H
-
-#include <QtGui/QGraphicsScene>
-#include <QColor>
-#include <QMap>
-
-#ifndef Q_MOC_RUN
-#include <vector>
-#include "trust-tree-node.h"
-#include "tree-layout.h"
-#endif
-
-class QGraphicsTextItem;
-
-class TrustTreeScene : public QGraphicsScene
-{
- Q_OBJECT
-
-public:
- TrustTreeScene(QWidget *parent = 0);
-
- void plotTrustTree(TrustTreeNodeList& nodeList);
-
-private:
- void plotEdge(const TrustTreeNodeList& nodeList, int nodeSize);
- void plotNode(const TrustTreeNodeList& nodeList, int nodeSize);
-};
-
-#endif // TRUST_TREE_SCENE_H
diff --git a/src/trust-tree-scene.hpp b/src/trust-tree-scene.hpp
new file mode 100644
index 0000000..90be20e
--- /dev/null
+++ b/src/trust-tree-scene.hpp
@@ -0,0 +1,47 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_TRUST_TREE_SCENE_HPP
+#define CHRONOS_TRUST_TREE_SCENE_HPP
+
+#include <QtGui/QGraphicsScene>
+#include <QColor>
+#include <QMap>
+
+#ifndef Q_MOC_RUN
+#include "trust-tree-node.hpp"
+#include "tree-layout.hpp"
+#endif
+
+class QGraphicsTextItem;
+
+namespace chronos {
+
+class TrustTreeScene : public QGraphicsScene
+{
+ Q_OBJECT
+
+public:
+ TrustTreeScene(QWidget* parent = 0);
+
+ void
+ plotTrustTree(chronos::TrustTreeNodeList& nodeList);
+
+private:
+ void
+ plotEdge(const chronos::TrustTreeNodeList& nodeList, int nodeSize);
+
+ void
+ plotNode(const chronos::TrustTreeNodeList& nodeList, int nodeSize);
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_TRUST_TREE_SCENE_HPP
diff --git a/src/validator-invitation.cpp b/src/validator-invitation.cpp
index e311e79..3b53e26 100644
--- a/src/validator-invitation.cpp
+++ b/src/validator-invitation.cpp
@@ -8,20 +8,28 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "validator-invitation.h"
-#include "invitation.h"
+#include "validator-invitation.hpp"
+#include "invitation.hpp"
#include "logging.h"
using namespace ndn;
-INIT_LOGGER("ValidatorInvitation");
+namespace chronos {
-namespace chronos{
+using std::vector;
-using ndn::shared_ptr;
+using ndn::CertificateCache;
+using ndn::SecRuleRelative;
+using ndn::OnDataValidated;
+using ndn::OnDataValidationFailed;
+using ndn::OnInterestValidated;
+using ndn::OnInterestValidationFailed;
+using ndn::ValidationRequest;
+using ndn::IdentityCertificate;
-const shared_ptr<CertificateCache> ValidatorInvitation::DefaultCertificateCache = shared_ptr<CertificateCache>();
+const shared_ptr<CertificateCache> ValidatorInvitation::DefaultCertificateCache =
+ shared_ptr<CertificateCache>();
ValidatorInvitation::ValidatorInvitation()
: Validator()
@@ -34,38 +42,54 @@
}
void
+ValidatorInvitation::addTrustAnchor(const Name& keyName, const ndn::PublicKey& key)
+{
+ m_trustAnchors[keyName] = key;
+}
+
+void
+ValidatorInvitation::removeTrustAnchor(const Name& keyName)
+{
+ m_trustAnchors.erase(keyName);
+}
+
+void
+ValidatorInvitation::cleanTrustAnchor()
+{
+ m_trustAnchors.clear();
+}
+
+void
ValidatorInvitation::checkPolicy (const Data& data,
int stepCount,
const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed,
- std::vector<shared_ptr<ValidationRequest> >& nextSteps)
+ vector<shared_ptr<ValidationRequest> >& nextSteps)
{
- try
- {
- SignatureSha256WithRsa sig(data.getSignature());
- const Name & keyLocatorName = sig.getKeyLocator().getName();
+ const Signature& signature = data.getSignature();
- if(!m_invitationReplyRule.satisfy(data.getName(), keyLocatorName))
- return onValidationFailed(data.shared_from_this(),
- "Does not comply with the invitation rule: "
- + data.getName().toUri() + " signed by: "
- + keyLocatorName.toUri());
+ if (signature.getKeyLocator().getType() != KeyLocator::KeyLocator_Name)
+ return onValidationFailed(data.shared_from_this(),
+ "Key Locator is not a name: " + data.getName().toUri());
- Data innerData;
- innerData.wireDecode(data.getContent().blockFromValue());
+ const Name & keyLocatorName = signature.getKeyLocator().getName();
- return internalCheck(data.wireEncode().value(),
- data.wireEncode().value_size() - data.getSignature().getValue().size(),
- sig,
- innerData,
- bind(onValidated, data.shared_from_this()),
- bind(onValidationFailed, data.shared_from_this(), _1));
- }
- catch(SignatureSha256WithRsa::Error &e)
- {
- return onValidationFailed(data.shared_from_this(),
- "Not SignatureSha256WithRsa signature: " + data.getName().toUri());
- }
+ if (!m_invitationReplyRule.satisfy(data.getName(), keyLocatorName))
+ return onValidationFailed(data.shared_from_this(),
+ "Does not comply with the invitation rule: " +
+ data.getName().toUri() + " signed by: " +
+ keyLocatorName.toUri());
+
+ Data innerData;
+ innerData.wireDecode(data.getContent().blockFromValue());
+
+ return internalCheck(data.wireEncode().value(),
+ data.wireEncode().value_size() - data.getSignature().getValue().size(),
+ signature,
+ keyLocatorName,
+ innerData,
+ bind(onValidated, data.shared_from_this()),
+ bind(onValidationFailed, data.shared_from_this(), _1));
}
void
@@ -73,74 +97,65 @@
int stepCount,
const OnInterestValidated& onValidated,
const OnInterestValidationFailed& onValidationFailed,
- std::vector<shared_ptr<ValidationRequest> >& nextSteps)
+ vector<shared_ptr<ValidationRequest> >& nextSteps)
{
- try
- {
- Name interestName = interest.getName();
+ const Name& interestName = interest.getName();
- if(!m_invitationInterestRule.match(interestName))
- return onValidationFailed(interest.shared_from_this(),
- "Invalid interest name: " + interest.getName().toUri());
+ if (!m_invitationInterestRule.match(interestName))
+ return onValidationFailed(interest.shared_from_this(),
+ "Invalid interest name: " + interest.getName().toUri());
- Name signedName = interestName.getPrefix(-1);
- Buffer signedBlob = Buffer(signedName.wireEncode().value(), signedName.wireEncode().value_size());
+ Name signedName = interestName.getPrefix(-1);
+ Buffer signedBlob = Buffer(signedName.wireEncode().value(),
+ signedName.wireEncode().value_size());
- Block signatureBlock = interestName.get(Invitation::SIGNATURE).blockFromValue();
- Block signatureInfo = interestName.get(Invitation::KEY_LOCATOR).blockFromValue();
- Signature signature(signatureInfo, signatureBlock);
- SignatureSha256WithRsa sig(signature);
+ Block signatureBlock = interestName.get(Invitation::SIGNATURE).blockFromValue();
+ Block signatureInfo = interestName.get(Invitation::KEY_LOCATOR).blockFromValue();
+ Signature signature(signatureInfo, signatureBlock);
- Data innerData;
- innerData.wireDecode(interestName.get(Invitation::INVITER_CERT).blockFromValue());
+ if (signature.getKeyLocator().getType() != KeyLocator::KeyLocator_Name)
+ return onValidationFailed(interest.shared_from_this(),
+ "KeyLocator is not a name: " + interest.getName().toUri());
- return internalCheck(signedBlob.buf(),
- signedBlob.size(),
- sig,
- innerData,
- bind(onValidated, interest.shared_from_this()),
- bind(onValidationFailed, interest.shared_from_this(), _1));
- }
- catch(SignatureSha256WithRsa::Error& e)
- {
- return onValidationFailed(interest.shared_from_this(),
- "Not SignatureSha256WithRsa signature: " + interest.getName().toUri());
- }
+ const Name & keyLocatorName = signature.getKeyLocator().getName();
+
+ Data innerData;
+ innerData.wireDecode(interestName.get(Invitation::INVITER_CERT).blockFromValue());
+
+ return internalCheck(signedBlob.buf(), signedBlob.size(),
+ signature,
+ keyLocatorName,
+ innerData,
+ bind(onValidated, interest.shared_from_this()),
+ bind(onValidationFailed, interest.shared_from_this(), _1));
}
void
ValidatorInvitation::internalCheck(const uint8_t* buf, size_t size,
- const SignatureSha256WithRsa& sig,
+ const Signature& signature,
+ const Name& keyLocatorName,
const Data& innerData,
const OnValidated& onValidated,
const OnValidationFailed& onValidationFailed)
{
- try
- {
- const Name & keyLocatorName = sig.getKeyLocator().getName();
- Name signingKeyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
+ Name signingKeyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
- if(m_trustAnchors.find(signingKeyName) == m_trustAnchors.end())
- return onValidationFailed("Cannot reach any trust anchor");
+ TrustAnchors::const_iterator keyIt = m_trustAnchors.find(signingKeyName);
+ if (keyIt == m_trustAnchors.end())
+ return onValidationFailed("Cannot reach any trust anchor");
- if(!Validator::verifySignature(buf, size, sig, m_trustAnchors[signingKeyName]))
- return onValidationFailed("Cannot verify outer signature");
+ if (!Validator::verifySignature(buf, size, signature, keyIt->second))
+ return onValidationFailed("Cannot verify outer signature");
- // Temporarily disabled, we should get it back when we create a specific key for the chatroom.
- // if(!Validator::verifySignature(innerData, m_trustAnchors[signingKeyName]))
- // return onValidationFailed("Cannot verify inner signature");
+ // Temporarily disabled, we should get it back when we create a specific key for the chatroom.
+ // if(!Validator::verifySignature(innerData, m_trustAnchors[signingKeyName]))
+ // return onValidationFailed("Cannot verify inner signature");
- if(!m_innerKeyRegex.match(innerData.getName())
- || m_innerKeyRegex.expand() != signingKeyName.getPrefix(-1))
- return onValidationFailed("Inner certificate does not comply with the rule");
+ if (!m_innerKeyRegex.match(innerData.getName()) ||
+ m_innerKeyRegex.expand() != signingKeyName.getPrefix(-1))
+ return onValidationFailed("Inner certificate does not comply with the rule");
- return onValidated();
- }
- catch(KeyLocator::Error& e)
- {
- return onValidationFailed("Key Locator is not a name");
- }
+ return onValidated();
}
-
-}//chronos
+} // namespace chronos
diff --git a/src/validator-invitation.h b/src/validator-invitation.h
deleted file mode 100644
index d7b8276..0000000
--- a/src/validator-invitation.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef CHRONOS_VALIDATOR_INVITATION_H
-#define CHRONOS_VALIDATOR_INVITATION_H
-
-#include <ndn-cxx/security/validator.hpp>
-#include <ndn-cxx/security/certificate-cache.hpp>
-#include <ndn-cxx/security/sec-rule-relative.hpp>
-#include <map>
-
-#include "endorse-certificate.h"
-
-namespace chronos{
-
-class ValidatorInvitation : public ndn::Validator
-{
- typedef ndn::function< void (const std::string&) > OnValidationFailed;
- typedef ndn::function< void () > OnValidated;
-
-public:
- struct Error : public Validator::Error { Error(const std::string &what) : Validator::Error(what) {} };
-
- static const ndn::shared_ptr<ndn::CertificateCache> DefaultCertificateCache;
-
- ValidatorInvitation();
-
- virtual
- ~ValidatorInvitation() {};
-
- void
- addTrustAnchor(const ndn::Name& keyName, const ndn::PublicKey& key)
- {
- m_trustAnchors[keyName] = key;
- }
-
- void
- removeTrustAnchor(const ndn::Name& keyName)
- {
- m_trustAnchors.erase(keyName);
- }
-
- void
- cleanTrustAnchor()
- {
- m_trustAnchors.clear();
- }
-
-protected:
- void
- checkPolicy(const ndn::Data& data,
- int stepCount,
- const ndn::OnDataValidated& onValidated,
- const ndn::OnDataValidationFailed& onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
- void
- checkPolicy(const ndn::Interest& interest,
- int stepCount,
- const ndn::OnInterestValidated& onValidated,
- const ndn::OnInterestValidationFailed& onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
-private:
- void
- internalCheck(const uint8_t* buf, size_t size,
- const ndn::SignatureSha256WithRsa& sig,
- const ndn::Data& innerData,
- const OnValidated& onValidated,
- const OnValidationFailed& onValidationFailed);
-
-private:
- typedef std::map<ndn::Name, ndn::PublicKey> TrustAnchors;
-
- ndn::SecRuleRelative m_invitationReplyRule;
- ndn::Regex m_invitationInterestRule;
- ndn::Regex m_innerKeyRegex;
- TrustAnchors m_trustAnchors;
-};
-
-}//chronos
-
-#endif //CHRONOS_VALIDATOR_INVITATION_H
diff --git a/src/validator-invitation.hpp b/src/validator-invitation.hpp
new file mode 100644
index 0000000..c2a0e5a
--- /dev/null
+++ b/src/validator-invitation.hpp
@@ -0,0 +1,92 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_VALIDATOR_INVITATION_HPP
+#define CHRONOS_VALIDATOR_INVITATION_HPP
+
+#include "common.hpp"
+
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/certificate-cache.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
+
+#include "endorse-certificate.hpp"
+
+namespace chronos {
+
+class ValidatorInvitation : public ndn::Validator
+{
+ typedef function<void(const std::string&)> OnValidationFailed;
+ typedef function<void()> OnValidated;
+
+public:
+ class Error : public ndn::Validator::Error
+ {
+ public:
+ Error(const std::string& what)
+ : ndn::Validator::Error(what)
+ {
+ }
+ };
+
+ static const shared_ptr<ndn::CertificateCache> DefaultCertificateCache;
+
+ ValidatorInvitation();
+
+ virtual
+ ~ValidatorInvitation()
+ {
+ }
+
+ void
+ addTrustAnchor(const Name& keyName, const ndn::PublicKey& key);
+
+ void
+ removeTrustAnchor(const Name& keyName);
+
+ void
+ cleanTrustAnchor();
+
+protected:
+ void
+ checkPolicy(const Data& data,
+ int stepCount,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ std::vector<shared_ptr<ndn::ValidationRequest> >& nextSteps);
+
+ void
+ checkPolicy(const Interest& interest,
+ int stepCount,
+ const ndn::OnInterestValidated& onValidated,
+ const ndn::OnInterestValidationFailed& onValidationFailed,
+ std::vector<shared_ptr<ndn::ValidationRequest> >& nextSteps);
+
+private:
+ void
+ internalCheck(const uint8_t* buf, size_t size,
+ const Signature& sig,
+ const Name& keyLocatorName,
+ const Data& innerData,
+ const OnValidated& onValidated,
+ const OnValidationFailed& onValidationFailed);
+
+private:
+ typedef std::map<Name, ndn::PublicKey> TrustAnchors;
+
+ ndn::SecRuleRelative m_invitationReplyRule;
+ ndn::Regex m_invitationInterestRule;
+ ndn::Regex m_innerKeyRegex;
+ TrustAnchors m_trustAnchors;
+};
+
+} // namespace chronos
+
+#endif //CHRONOS_VALIDATOR_INVITATION_HPP
diff --git a/src/validator-panel.cpp b/src/validator-panel.cpp
index 9caba64..2cb71f8 100644
--- a/src/validator-panel.cpp
+++ b/src/validator-panel.cpp
@@ -8,23 +8,26 @@
* Author: Yingdi Yu <yingdi@cs.ucla.edu>
*/
-#include "validator-panel.h"
+#include "validator-panel.hpp"
#include "logging.h"
-using namespace std;
-using namespace ndn;
+namespace chronos {
-INIT_LOGGER("ValidatorPanel");
+using std::vector;
-namespace chronos{
+using ndn::CertificateCache;
+using ndn::SecRuleRelative;
+using ndn::OnDataValidated;
+using ndn::OnDataValidationFailed;
+using ndn::ValidationRequest;
+using ndn::IdentityCertificate;
-using ndn::shared_ptr;
+const shared_ptr<CertificateCache> ValidatorPanel::DEFAULT_CERT_CACHE =
+ shared_ptr<CertificateCache>();
-const shared_ptr<CertificateCache> ValidatorPanel::DEFAULT_CERT_CACHE = shared_ptr<CertificateCache>();
-
-ValidatorPanel::ValidatorPanel(int stepLimit /* = 10 */,
- const shared_ptr<CertificateCache> certificateCache/* = DEFAULT_CERT_CACHE */)
+ValidatorPanel::ValidatorPanel(int stepLimit,
+ const shared_ptr<CertificateCache> certificateCache)
: m_stepLimit(stepLimit)
, m_certificateCache(certificateCache)
{
@@ -33,52 +36,54 @@
"==", "\\1", "\\1\\2", true);
}
+void
+ValidatorPanel::addTrustAnchor(const EndorseCertificate& cert)
+{
+ m_trustAnchors[cert.getPublicKeyName()] = cert.getPublicKeyInfo();
+}
+void
+ValidatorPanel::removeTrustAnchor(const Name& keyName)
+{
+ m_trustAnchors.erase(keyName);
+}
void
ValidatorPanel::checkPolicy (const Data& data,
int stepCount,
const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed,
- std::vector<shared_ptr<ValidationRequest> >& nextSteps)
+ vector<shared_ptr<ValidationRequest> >& nextSteps)
{
- if(m_stepLimit == stepCount)
- {
- _LOG_ERROR("Reach the maximum steps of verification!");
+ if (m_stepLimit == stepCount) {
+ onValidationFailed(data.shared_from_this(),
+ "Reach maximum validation steps: " + data.getName().toUri());
+ return;
+ }
+
+ const KeyLocator& keyLocator = data.getSignature().getKeyLocator();
+
+ if (keyLocator.getType() != KeyLocator::KeyLocator_Name)
+ return onValidationFailed(data.shared_from_this(),
+ "Key Locator is not a name: " + data.getName().toUri());
+
+ const Name& keyLocatorName = keyLocator.getName();
+
+ if (m_endorseeRule->satisfy(data.getName(), keyLocatorName)) {
+ Name keyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
+
+ if (m_trustAnchors.end() != m_trustAnchors.find(keyName) &&
+ Validator::verifySignature(data, data.getSignature(), m_trustAnchors[keyName]))
+ onValidated(data.shared_from_this());
+ else
onValidationFailed(data.shared_from_this(),
- "Reach maximum validation steps: " + data.getName().toUri());
- return;
- }
+ "Cannot verify signature:" + data.getName().toUri());
+ }
+ else
+ onValidationFailed(data.shared_from_this(),
+ "Does not satisfy rule: " + data.getName().toUri());
- try
- {
- SignatureSha256WithRsa sig(data.getSignature());
- const Name& keyLocatorName = sig.getKeyLocator().getName();
-
- if(m_endorseeRule->satisfy(data.getName(), keyLocatorName))
- {
- Name keyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
-
- if(m_trustAnchors.end() != m_trustAnchors.find(keyName) && Validator::verifySignature(data, sig, m_trustAnchors[keyName]))
- onValidated(data.shared_from_this());
- else
- onValidationFailed(data.shared_from_this(), "Cannot verify signature:" + data.getName().toUri());
- }
- else
- onValidationFailed(data.shared_from_this(), "Does not satisfy rule: " + data.getName().toUri());
-
- return;
- }
- catch(SignatureSha256WithRsa::Error &e)
- {
- return onValidationFailed(data.shared_from_this(),
- "Not SignatureSha256WithRsa signature: " + data.getName().toUri());
- }
- catch(KeyLocator::Error &e)
- {
- return onValidationFailed(data.shared_from_this(),
- "Key Locator is not a name: " + data.getName().toUri());
- }
+ return;
}
-}//chronos
+} // namespace chronos
diff --git a/src/validator-panel.h b/src/validator-panel.h
deleted file mode 100644
index c786c9f..0000000
--- a/src/validator-panel.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2013, Regents of the University of California
- * Yingdi Yu
- *
- * BSD license, See the LICENSE file for more information
- *
- * Author: Yingdi Yu <yingdi@cs.ucla.edu>
- */
-
-#ifndef CHRONOS_VALIDATOR_PANEL_H
-#define CHRONOS_VALIDATOR_PANEL_H
-
-#include <ndn-cxx/security/validator.hpp>
-#include <ndn-cxx/security/sec-rule-relative.hpp>
-#include <ndn-cxx/security/certificate-cache.hpp>
-#include <map>
-
-#include "endorse-certificate.h"
-
-namespace chronos{
-
-class ValidatorPanel : public ndn::Validator
-{
-public:
-
- static const ndn::shared_ptr<ndn::CertificateCache> DEFAULT_CERT_CACHE;
-
- ValidatorPanel(int stepLimit = 10,
- const ndn::shared_ptr<ndn::CertificateCache> certificateCache = DEFAULT_CERT_CACHE);
-
- ~ValidatorPanel()
- {}
-
- inline void
- addTrustAnchor(const EndorseCertificate& selfEndorseCertificate);
-
- inline void
- removeTrustAnchor(const ndn::Name& keyName);
-
-protected:
- virtual void
- checkPolicy (const ndn::Data& data,
- int stepCount,
- const ndn::OnDataValidated& onValidated,
- const ndn::OnDataValidationFailed& onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
- virtual void
- checkPolicy (const ndn::Interest& interest,
- int stepCount,
- const ndn::OnInterestValidated& onValidated,
- const ndn::OnInterestValidationFailed& onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps)
- {
- onValidationFailed(interest.shared_from_this(),
- "No rules for interest.");
- }
-
-private:
- int m_stepLimit;
- ndn::shared_ptr<ndn::CertificateCache> m_certificateCache;
- ndn::shared_ptr<ndn::SecRuleRelative> m_endorseeRule;
- std::map<ndn::Name, ndn::PublicKey> m_trustAnchors;
-
-};
-
-inline void
-ValidatorPanel::addTrustAnchor(const EndorseCertificate& cert)
-{ m_trustAnchors[cert.getPublicKeyName()] = cert.getPublicKeyInfo(); }
-
-inline void
-ValidatorPanel::removeTrustAnchor(const ndn::Name& keyName)
-{ m_trustAnchors.erase(keyName); }
-
-}//chronos
-
-#endif
diff --git a/src/validator-panel.hpp b/src/validator-panel.hpp
new file mode 100644
index 0000000..1277ffe
--- /dev/null
+++ b/src/validator-panel.hpp
@@ -0,0 +1,71 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_VALIDATOR_PANEL_HPP
+#define CHRONOS_VALIDATOR_PANEL_HPP
+
+#include "common.hpp"
+
+#include <ndn-cxx/security/validator.hpp>
+#include <ndn-cxx/security/sec-rule-relative.hpp>
+#include <ndn-cxx/security/certificate-cache.hpp>
+
+#include "endorse-certificate.hpp"
+
+namespace chronos {
+
+class ValidatorPanel : public ndn::Validator
+{
+public:
+
+ static const shared_ptr<ndn::CertificateCache> DEFAULT_CERT_CACHE;
+
+ ValidatorPanel(int stepLimit = 10,
+ const shared_ptr<ndn::CertificateCache> cache = DEFAULT_CERT_CACHE);
+
+ ~ValidatorPanel()
+ {
+ }
+
+ void
+ addTrustAnchor(const EndorseCertificate& selfEndorseCertificate);
+
+ void
+ removeTrustAnchor(const Name& keyName);
+
+protected:
+ virtual void
+ checkPolicy(const Data& data,
+ int stepCount,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ std::vector<shared_ptr<ndn::ValidationRequest> >& nextSteps);
+
+ virtual void
+ checkPolicy(const Interest& interest,
+ int stepCount,
+ const ndn::OnInterestValidated& onValidated,
+ const ndn::OnInterestValidationFailed& onValidationFailed,
+ std::vector<shared_ptr<ndn::ValidationRequest> >& nextSteps)
+ {
+ onValidationFailed(interest.shared_from_this(),
+ "No rules for interest.");
+ }
+
+private:
+ int m_stepLimit;
+ shared_ptr<ndn::CertificateCache> m_certificateCache;
+ shared_ptr<ndn::SecRuleRelative> m_endorseeRule;
+ std::map<Name, ndn::PublicKey> m_trustAnchors;
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_VALIDATOR_PANEL_HPP
diff --git a/test/main.cc b/test/main.cpp
similarity index 100%
rename from test/main.cc
rename to test/main.cpp
diff --git a/test/test-contact-storage.cc b/test/test-contact-storage.cpp
similarity index 68%
rename from test/test-contact-storage.cc
rename to test/test-contact-storage.cpp
index 12b2a54..cc97e08 100644
--- a/test/test-contact-storage.cc
+++ b/test/test-contact-storage.cpp
@@ -7,29 +7,29 @@
#include <boost/test/unit_test.hpp>
-#include "contact-storage.h"
-#include <cryptopp/hex.h>
-#include <cryptopp/sha.h>
-#include <cryptopp/files.h>
+#include "contact-storage.hpp"
+#include "cryptopp.hpp"
#include <boost/filesystem.hpp>
-using namespace ndn;
+namespace chronos {
+
+using std::string;
namespace fs = boost::filesystem;
BOOST_AUTO_TEST_SUITE(TestContactStorage)
-const std::string dbName("chronos-20e9530008b27c661ad3429d1956fa1c509b652dce9273bfe81b7c91819c272c.db");
+const string dbName("chronos-20e9530008b27c661ad3429d1956fa1c509b652dce9273bfe81b7c91819c272c.db");
BOOST_AUTO_TEST_CASE(InitializeTable)
{
Name identity("/TestContactStorage/InitializeTable");
- chronos::ContactStorage contactStorage(identity);
+ ContactStorage contactStorage(identity);
fs::path dbPath = fs::path(getenv("HOME")) / ".chronos" / dbName;
BOOST_CHECK(boost::filesystem::exists(dbPath));
}
-
-
BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace chronos
diff --git a/test/test-endorse-certificate.cc b/test/test-endorse-certificate.cpp
similarity index 73%
rename from test/test-endorse-certificate.cc
rename to test/test-endorse-certificate.cpp
index 95bc012..09eb935 100644
--- a/test/test-endorse-certificate.cc
+++ b/test/test-endorse-certificate.cpp
@@ -15,16 +15,20 @@
#include <boost/test/unit_test.hpp>
-#include <ndn-cpp-dev/security/key-chain.hpp>
-#include <ndn-cpp-dev/util/time.hpp>
-#include <ndn-cpp-dev/util/io.hpp>
-#include <cryptopp/base64.h>
-#include <cryptopp/files.h>
-#include "endorse-certificate.h"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/encoding/buffer-stream.hpp>
+#include <ndn-cxx/util/time.hpp>
+#include <ndn-cxx/util/io.hpp>
+#include "cryptopp.hpp"
+#include "endorse-certificate.hpp"
-using namespace ndn;
-using namespace std;
-using namespace chronos;
+namespace chronos {
+
+using std::vector;
+using std::string;
+
+using ndn::KeyChain;
+using ndn::IdentityCertificate;
BOOST_AUTO_TEST_SUITE(TestEndorseCertificate)
@@ -80,16 +84,18 @@
BOOST_AUTO_TEST_CASE(IdCert)
{
- boost::iostreams::stream<boost::iostreams::array_source> is (testIdCert.c_str(), testIdCert.size());
- shared_ptr<IdentityCertificate> idCert = io::load<IdentityCertificate>(is);
-
+ boost::iostreams::stream<boost::iostreams::array_source> is(testIdCert.c_str(),
+ testIdCert.size());
+ shared_ptr<IdentityCertificate> idCert = ndn::io::load<IdentityCertificate>(is);
+
BOOST_CHECK(static_cast<bool>(idCert));
- const Certificate::SubjectDescriptionList& subjectDescription = idCert->getSubjectDescriptionList();
+ const ndn::Certificate::SubjectDescriptionList& subjectDescription =
+ idCert->getSubjectDescriptionList();
BOOST_CHECK_EQUAL(subjectDescription.size(), 6);
- Certificate::SubjectDescriptionList::const_iterator it = subjectDescription.begin();
- Certificate::SubjectDescriptionList::const_iterator end = subjectDescription.end();
+ ndn::Certificate::SubjectDescriptionList::const_iterator it = subjectDescription.begin();
+ ndn::Certificate::SubjectDescriptionList::const_iterator end = subjectDescription.end();
int count = 0;
for(; it != end; it++)
{
@@ -126,49 +132,55 @@
}
BOOST_CHECK_EQUAL(count, 6);
- BOOST_CHECK_EQUAL(idCert->getName().toUri(), "/EndorseCertificateTests/KEY/EncodeDecode/ksk-1394072147335/ID-CERT/%FD%01D%95%2C%D5%E8");
+ BOOST_CHECK_EQUAL(idCert->getName().toUri(),
+ "/EndorseCertificateTests/KEY/EncodeDecode/ksk-1394072147335/ID-CERT/%FD%01D%95%2C%D5%E8");
- OBufferStream keyOs;
+ ndn::OBufferStream keyOs;
{
using namespace CryptoPP;
StringSource(testKey, true, new Base64Decoder(new FileSink(keyOs)));
}
- PublicKey key(keyOs.buf()->buf(), keyOs.buf()->size());
+ ndn::PublicKey key(keyOs.buf()->buf(), keyOs.buf()->size());
BOOST_CHECK(key == idCert->getPublicKeyInfo());
}
BOOST_AUTO_TEST_CASE(ConstructFromIdCert)
{
- boost::iostreams::stream<boost::iostreams::array_source> is (testIdCert.c_str(), testIdCert.size());
- shared_ptr<IdentityCertificate> idCert = io::load<IdentityCertificate>(is);
-
+ boost::iostreams::stream<boost::iostreams::array_source> is(testIdCert.c_str(),
+ testIdCert.size());
+ shared_ptr<IdentityCertificate> idCert = ndn::io::load<IdentityCertificate>(is);
+
Profile profile(*idCert);
vector<string> endorseList;
endorseList.push_back("email");
endorseList.push_back("homepage");
EndorseCertificate endorseCertificate(*idCert, profile, endorseList);
- KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
- keyChain.signWithSha256(endorseCertificate);
+ KeyChain keyChain("sqlite3", "file");
+ keyChain.signWithSha256(endorseCertificate);
const Block& endorseDataBlock = endorseCertificate.wireEncode();
Data decodedEndorseData;
decodedEndorseData.wireDecode(endorseDataBlock);
EndorseCertificate decodedEndorse(decodedEndorseData);
- BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("IDENTITY"), "/EndorseCertificateTests/EncodeDecode");
+ BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("IDENTITY"),
+ "/EndorseCertificateTests/EncodeDecode");
BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("name"), "MyName");
BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("homepage"), "MyHomePage");
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().size(), 2);
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().at(0), "email");
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().at(1), "homepage");
- BOOST_CHECK_EQUAL(decodedEndorse.getSigner(), "/EndorseCertificateTests/EncodeDecode/ksk-1394072147335");
- BOOST_CHECK_EQUAL(decodedEndorse.getPublicKeyName(), "/EndorseCertificateTests/EncodeDecode/ksk-1394072147335");
+ BOOST_CHECK_EQUAL(decodedEndorse.getSigner(),
+ "/EndorseCertificateTests/EncodeDecode/ksk-1394072147335");
+ BOOST_CHECK_EQUAL(decodedEndorse.getPublicKeyName(),
+ "/EndorseCertificateTests/EncodeDecode/ksk-1394072147335");
}
BOOST_AUTO_TEST_CASE(ConstructFromEndorseCert)
{
- boost::iostreams::stream<boost::iostreams::array_source> is (testEndorseCert.c_str(), testEndorseCert.size());
- shared_ptr<Data> rawData = io::load<Data>(is);
+ boost::iostreams::stream<boost::iostreams::array_source> is(testEndorseCert.c_str(),
+ testEndorseCert.size());
+ shared_ptr<Data> rawData = ndn::io::load<Data>(is);
EndorseCertificate rawEndorse(*rawData);
vector<string> endorseList;
@@ -178,7 +190,7 @@
Name signer("/EndorseCertificateTests/Singer/ksk-1234567890");
EndorseCertificate endorseCertificate(rawEndorse, signer, endorseList);
- KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
+ KeyChain keyChain("sqlite3", "file");
keyChain.signWithSha256(endorseCertificate);
const Block& endorseDataBlock = endorseCertificate.wireEncode();
@@ -186,15 +198,20 @@
Data decodedEndorseData;
decodedEndorseData.wireDecode(endorseDataBlock);
EndorseCertificate decodedEndorse(decodedEndorseData);
- BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("IDENTITY"), "/EndorseCertificateTests/EncodeDecode");
+ BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("IDENTITY"),
+ "/EndorseCertificateTests/EncodeDecode");
BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("name"), "MyName");
BOOST_CHECK_EQUAL(decodedEndorse.getProfile().get("homepage"), "MyHomePage");
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().size(), 3);
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().at(0), "institution");
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().at(1), "group");
BOOST_CHECK_EQUAL(decodedEndorse.getEndorseList().at(2), "advisor");
- BOOST_CHECK_EQUAL(decodedEndorse.getSigner(), "/EndorseCertificateTests/Singer/ksk-1234567890");
- BOOST_CHECK_EQUAL(decodedEndorse.getPublicKeyName(), "/EndorseCertificateTests/EncodeDecode/ksk-1394072147335");
+ BOOST_CHECK_EQUAL(decodedEndorse.getSigner(),
+ "/EndorseCertificateTests/Singer/ksk-1234567890");
+ BOOST_CHECK_EQUAL(decodedEndorse.getPublicKeyName(),
+ "/EndorseCertificateTests/EncodeDecode/ksk-1394072147335");
}
BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace chronos
diff --git a/test/test-profile.cc b/test/test-profile.cpp
similarity index 68%
rename from test/test-profile.cc
rename to test/test-profile.cpp
index 9c1b67a..9848685 100644
--- a/test/test-profile.cc
+++ b/test/test-profile.cpp
@@ -7,11 +7,12 @@
#include <boost/test/unit_test.hpp>
-#include "profile.h"
+#include "profile.hpp"
+#include <ndn-cxx/encoding/buffer-stream.hpp>
-using namespace ndn;
-using namespace std;
-using namespace chronos;
+namespace chronos {
+
+using std::string;
BOOST_AUTO_TEST_SUITE(TestProfile)
@@ -22,20 +23,23 @@
profile["name"] = "Yingdi Yu";
profile["school"] = "UCLA";
- OBufferStream os;
+ ndn::OBufferStream os;
profile.encode(os);
- shared_ptr<Buffer> encoded = os.buf();
-
- boost::iostreams::stream
- <boost::iostreams::array_source> is (reinterpret_cast<const char*>(encoded->buf ()), encoded->size ());
+ ndn::ConstBufferPtr encoded = os.buf();
- Profile decodedProfile;
+ boost::iostreams::stream
+ <boost::iostreams::array_source> is(reinterpret_cast<const char*>(encoded->buf()),
+ encoded->size ());
+
+ Profile decodedProfile;
decodedProfile.decode(is);
-
+
BOOST_CHECK_EQUAL(decodedProfile.getIdentityName().toUri(), string("/ndn/ucla/yingdi"));
BOOST_CHECK_EQUAL(decodedProfile["name"], string("Yingdi Yu"));
BOOST_CHECK_EQUAL(decodedProfile["school"], string("UCLA"));
}
BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace chronos
diff --git a/waf-tools/boost.py b/waf-tools/boost.py
index 10d4e19..8c36b34 100644
--- a/waf-tools/boost.py
+++ b/waf-tools/boost.py
@@ -39,9 +39,9 @@
- 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:
+ Errors:
- boost might also be compiled with /MT, which links the runtime statically.
- If you have problems with redefined symbols,
+ 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.
@@ -53,13 +53,24 @@
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']
-BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
+BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib',
+ '/usr/lib/x86_64-linux-gnu', '/usr/lib/i386-linux-gnu',
+ '/usr/local/ndn/lib', '/opt/ndn/lib']
+BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include',
+ '/usr/local/ndn/include', '/opt/ndn/include']
BOOST_VERSION_FILE = 'boost/version.hpp'
BOOST_VERSION_CODE = '''
#include <iostream>
#include <boost/version.hpp>
-int main() { std::cout << BOOST_LIB_VERSION << std::endl; }
+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
@@ -92,14 +103,14 @@
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 boost includes root (~boost root)
- e.g. /path/to/boost_1_47_0''')
+ 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_47_0/stage/lib''')
+ 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)')
@@ -107,19 +118,16 @@
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''')
+ 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)')
+ help='force a toolset e.g. msvc, vc90, gcc, mingw, mgw45 (default: auto)')
py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])
opt.add_option('--boost-python', type='string',
default=py_version, dest='boost_python',
- help='select the lib python with this version \
- (default: %s)' % py_version)
+ help='select the lib python with this version (default: %s)' % py_version)
@conf
@@ -139,11 +147,16 @@
except (OSError, IOError):
Logs.error("Could not read the file %r" % node.abspath())
else:
- re_but = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"', re.M)
- m = re_but.search(txt)
- if m:
- return m.group(1)
- return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True)
+ 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):
@@ -283,8 +296,12 @@
self.start_msg('Checking boost includes')
self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
- self.env.BOOST_VERSION = self.boost_get_version(inc)
- self.end_msg(self.env.BOOST_VERSION)
+ 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])
@@ -304,19 +321,13 @@
def try_link():
if 'system' in params['lib']:
self.check_cxx(
- fragment="\n".join([
- '#include <boost/system/error_code.hpp>',
- 'int main() { boost::system::error_code c; }',
- ]),
+ fragment=BOOST_SYSTEM_CODE,
use=var,
execute=False,
)
if 'thread' in params['lib']:
self.check_cxx(
- fragment="\n".join([
- '#include <boost/thread.hpp>',
- 'int main() { boost::thread t; }',
- ]),
+ fragment=BOOST_THREAD_CODE,
use=var,
execute=False,
)
@@ -368,4 +379,3 @@
self.end_msg("Could not link against boost libraries using supplied options")
self.fatal('The configuration failed')
self.end_msg('ok')
-
diff --git a/waf-tools/default-compiler-flags.py b/waf-tools/default-compiler-flags.py
new file mode 100644
index 0000000..e6e13fa
--- /dev/null
+++ b/waf-tools/default-compiler-flags.py
@@ -0,0 +1,62 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+from waflib import Logs, Configure
+
+def options(opt):
+ opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
+ help='''Compile in debugging mode without all optimizations (-O0)''')
+ opt.add_option('--with-c++11', action='store_true', default=False, dest='use_cxx11',
+ help='''Use C++ 11 features if available in the compiler''')
+
+def configure(conf):
+ areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
+ defaultFlags = []
+
+ if conf.options.use_cxx11:
+ defaultFlags += ['-std=c++0x', '-std=c++11']
+ else:
+ defaultFlags += ['-std=c++03']
+
+ defaultFlags += ['-pedantic', '-Wall', '-Wno-long-long', '-Wno-unneeded-internal-declaration',
+ '-Wno-c++11-extensions', '-Wno-nested-anon-types']
+
+ if conf.options.debug:
+ conf.define('_DEBUG', 1)
+ conf.env['_DEBUG'] = 1
+ defaultFlags += ['-O0',
+ '-Og', # gcc >= 4.8
+ '-g3',
+ '-fcolor-diagnostics', # clang
+ '-fdiagnostics-color', # gcc >= 4.9
+ '-Werror',
+ '-Wno-unused-variable',
+ '-Wno-error=deprecated-register',
+ '-Wno-error=maybe-uninitialized', # Bug #1615
+ ]
+ if areCustomCxxflagsPresent:
+ missingFlags = [x for x in defaultFlags 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:
+ conf.add_supported_cxxflags(defaultFlags)
+ else:
+ defaultFlags += ['-O2', '-g']
+ if not areCustomCxxflagsPresent:
+ conf.add_supported_cxxflags(defaultFlags)
+
+@Configure.conf
+def add_supported_cxxflags(self, cxxflags):
+ """
+ Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
+ """
+ self.start_msg('Checking allowed flags for c++ compiler')
+
+ 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
diff --git a/waf-tools/doxygen.py b/waf-tools/doxygen.py
new file mode 100644
index 0000000..ac8c70b
--- /dev/null
+++ b/waf-tools/doxygen.py
@@ -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"
diff --git a/waf-tools/sphinx_build.py b/waf-tools/sphinx_build.py
new file mode 100644
index 0000000..e61da6e
--- /dev/null
+++ b/waf-tools/sphinx_build.py
@@ -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"
diff --git a/wscript b/wscript
index 35590be..6e6d1db 100644
--- a/wscript
+++ b/wscript
@@ -2,72 +2,70 @@
VERSION='0.5'
APPNAME='ChronoChat'
-from waflib import Configure, Utils
+from waflib import Configure, Utils, Logs, Context
+import os
def options(opt):
- opt.add_option('--debug',action='store_true',default=False,dest='debug',help='''debugging mode''')
- opt.add_option('--with-log4cxx',action='store_true',default=False,dest='log4cxx',help='''Enable log4cxx''')
- opt.add_option('--with-tests', action='store_true',default=False,dest='with_tests',help='''build unit tests''')
- opt.add_option('--without-security', action='store_false',default=True,dest='with_security',help='''Enable security''')
- opt.load('compiler_c compiler_cxx qt4')
-
+ opt.load(['compiler_c', 'compiler_cxx', 'qt4'])
if Utils.unversioned_sys_platform () != "darwin":
opt.load('gnu_dirs');
- opt.load('boost protoc', tooldir=['waf-tools'])
+ opt.load(['default-compiler-flags', 'boost', 'protoc',
+ 'doxygen', 'sphinx_build'],
+ tooldir=['waf-tools'])
+
+ opt = opt.add_option_group('ChronotChat Options')
+
+ opt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
+ help='''build unit tests''')
+
+ opt.add_option('--with-log4cxx', action='store_true', default=False, dest='log4cxx',
+ help='''Enable log4cxx''')
def configure(conf):
- conf.load("compiler_c compiler_cxx boost protoc qt4")
-
+ conf.load(['compiler_c', 'compiler_cxx', 'qt4',
+ 'default-compiler-flags', 'boost', 'protoc',
+ 'doxygen', 'sphinx_build'])
if Utils.unversioned_sys_platform () != "darwin":
- conf.load('gnu_dirs');
+ opt.load('gnu_dirs');
- if conf.options.debug:
- conf.define ('_DEBUG', 1)
- conf.env['_DEBUG'] = True;
- flags = ['-O0',
- '-Wall',
- '-Wno-unused-variable',
- '-g3',
- '-Wno-unused-private-field', # only clang supports
- '-fcolor-diagnostics', # only clang supports
- '-Qunused-arguments', # only clang supports
- '-Wno-deprecated-declarations',
- '-Wno-unneeded-internal-declaration',
- ]
-
- conf.add_supported_cxxflags (cxxflags = flags)
- else:
- flags = ['-O3', '-g', '-Wno-tautological-compare', '-Wno-unused-function', '-Wno-deprecated-declarations']
- conf.add_supported_cxxflags (cxxflags = flags)
-
- conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX', mandatory=True)
-
+ conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
+ uselib_store='NDN_CXX', mandatory=True)
if conf.options.log4cxx:
- conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX', mandatory=True)
- conf.define ("HAVE_LOG4CXX", 1)
+ conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'],
+ uselib_store='LOG4CXX', mandatory=True)
+ conf.define("HAVE_LOG4CXX", 1)
- conf.check_cfg (package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'], uselib_store='SYNC', mandatory=True)
+ conf.check_cfg (package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'],
+ uselib_store='SYNC', mandatory=True)
- conf.check_boost(lib='system random thread filesystem unit_test_framework')
-
+ boost_libs = 'system random thread filesystem'
if conf.options.with_tests:
- conf.env['WITH_TESTS'] = True
- conf.define('WITH_TESTS', 1)
+ conf.env['WITH_TESTS'] = 1
+ conf.define('WITH_TESTS', 1);
+ boost_libs += ' unit_test_framework'
-
- if conf.options.with_security:
- conf.define('WITH_SECURITY', 1)
+ conf.check_boost(lib=boost_libs)
+ if conf.env.BOOST_VERSION_NUMBER < 104800:
+ Logs.error("Minimum required boost version is 1.48.0")
+ Logs.error("Please upgrade your distribution or install custom boost libraries" +
+ " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
+ return
conf.write_config_header('src/config.h')
def build (bld):
+ feature_list = 'qt4 cxx'
+ if bld.env["WITH_TESTS"]:
+ feature_list += ' cxxshlib'
+ else:
+ feature_list += ' cxxprogram'
+
qt = bld (
target = "ChronoChat",
- features = "qt4 cxx cxxprogram",
- # features= "qt4 cxx cxxshlib",
+ features = feature_list,
defines = "WAF",
source = bld.path.ant_glob(['src/*.cpp', 'src/*.ui', '*.qrc', 'logging.cc', 'src/*.proto']),
includes = "src .",
@@ -75,15 +73,15 @@
)
# Unit tests
- # if bld.env["WITH_TESTS"]:
- # unittests = bld.program (
- # target="unit-tests",
- # source = bld.path.ant_glob(['test/**/*.cc']),
- # features=['cxx', 'cxxprogram'],
- # use = 'BOOST ChronoChat',
- # includes = "src",
- # install_path = None,
- # )
+ if bld.env["WITH_TESTS"]:
+ unittests = bld.program (
+ target="unit-tests",
+ source = bld.path.ant_glob(['test/**/*.cpp']),
+ features=['cxx', 'cxxprogram'],
+ use = 'BOOST ChronoChat',
+ includes = "src .",
+ install_path = None,
+ )
# Debug tools
if bld.env["_DEBUG"]:
@@ -92,64 +90,107 @@
target = '%s' % (str(app.change_ext('','.cc'))),
source = app,
use = 'NDN_CXX',
+ includes = "src .",
install_path = None,
)
- # Tmp disable
- if Utils.unversioned_sys_platform () == "darwin":
- app_plist = '''<?xml version="1.0" encoding="UTF-8"?>
+ if not bld.env["WITH_TESTS"]:
+ if Utils.unversioned_sys_platform () == "darwin":
+ app_plist = '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
-<dict>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleIconFile</key>
- <string>demo.icns</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Waf</string>
- <key>CFBundleIdentifier</key>
- <string>edu.ucla.cs.irl.ChronoChat</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>NOTE</key>
- <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
- <key>CFBundleExecutable</key>
- <string>%s</string>
- <key>SUPublicDSAKeyFile</key>
- <string>dsa_pub.pem</string>
- <key>CFBundleIconFile</key>
- <string>demo.icns</string>
-</dict>
+ <dict>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleIconFile</key>
+ <string>demo.icns</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Created by Waf</string>
+ <key>CFBundleIdentifier</key>
+ <string>edu.ucla.cs.irl.ChronoChat</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>NOTE</key>
+ <string>THIS IS A GENERATED FILE, DO NOT MODIFY</string>
+ <key>CFBundleExecutable</key>
+ <string>%s</string>
+ <key>SUPublicDSAKeyFile</key>
+ <string>dsa_pub.pem</string>
+ <key>CFBundleIconFile</key>
+ <string>demo.icns</string>
+ </dict>
</plist>'''
# <key>LSUIElement</key>
# <string>1</string>
- qt.mac_app = "ChronoChat.app"
- qt.mac_plist = app_plist % "ChronoChat"
- qt.mac_resources = 'demo.icns'
+ qt.mac_app = "ChronoChat.app"
+ qt.mac_plist = app_plist % "ChronoChat"
+ qt.mac_resources = 'demo.icns'
+ else:
+ bld(features = "subst",
+ source = 'linux/chronochat.desktop.in',
+ target = 'linux/chronochat.desktop',
+ BINARY = "ChronoChat",
+ install_path = "${DATAROOTDIR}/applications"
+ )
+ bld.install_files("${DATAROOTDIR}/chronochat",
+ bld.path.ant_glob(['linux/Resources/*']))
+
+
+# docs
+def docs(bld):
+ from waflib import Options
+ Options.commands = ['doxygen', 'sphinx'] + Options.commands
+
+def doxygen(bld):
+ version(bld)
+
+ if not bld.env.DOXYGEN:
+ Logs.error("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
else:
- bld (features = "subst",
- source = 'linux/chronochat.desktop.in',
- target = 'linux/chronochat.desktop',
- BINARY = "ChronoChat",
- install_path = "${DATAROOTDIR}/applications"
+ bld(features="subst",
+ name="doxygen-conf",
+ source=["docs/doxygen.conf.in",
+ "docs/named_data_theme/named_data_footer-with-analytics.html.in"],
+ target=["docs/doxygen.conf",
+ "docs/named_data_theme/named_data_footer-with-analytics.html"],
+ VERSION=VERSION,
+ HTML_FOOTER="../build/docs/named_data_theme/named_data_footer-with-analytics.html" \
+ if os.getenv('GOOGLE_ANALYTICS', None) \
+ else "../docs/named_data_theme/named_data_footer.html",
+ GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ""),
)
- bld.install_files("${DATAROOTDIR}/chronochat",
- bld.path.ant_glob(['linux/Resources/*']))
+ bld(features="doxygen",
+ doxyfile='docs/doxygen.conf',
+ use="doxygen-conf")
-@Configure.conf
-def add_supported_cxxflags(self, cxxflags):
- """
- Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
- """
- self.start_msg('Checking allowed flags for c++ compiler')
+def sphinx(bld):
+ version(bld)
- supportedFlags = []
- for flag in cxxflags:
- if self.check_cxx (cxxflags=[flag], mandatory=False):
- supportedFlags += [flag]
+ if not bld.env.SPHINX_BUILD:
+ bld.fatal("ERROR: cannot build documentation (`sphinx-build' is not found in $PATH)")
+ else:
+ bld(features="sphinx",
+ outdir="docs",
+ source=bld.path.ant_glob("docs/**/*.rst"),
+ config="docs/conf.py",
+ VERSION=VERSION)
- self.end_msg (' '.join (supportedFlags))
- self.env.CXXFLAGS += supportedFlags
+def version(ctx):
+ if getattr(Context.g_module, 'VERSION_BASE', None):
+ return
+
+ Context.g_module.VERSION_BASE = Context.g_module.VERSION
+ Context.g_module.VERSION_SPLIT = [v for v in VERSION_BASE.split('.')]
+
+ try:
+ cmd = ['git', 'describe', '--match', 'ChronoChat-*']
+ p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
+ stderr=None, stdin=None)
+ out = p.communicate()[0].strip()
+ if p.returncode == 0 and out != "":
+ Context.g_module.VERSION = out[11:]
+ except:
+ pass