ndns: new port
diff --git a/ndns/Makefile b/ndns/Makefile
new file mode 100644
index 0000000..7f0adae
--- /dev/null
+++ b/ndns/Makefile
@@ -0,0 +1,16 @@
+# URL for git clone
+GIT_URL=https://github.com/named-data/ndns
+
+# Tag name or commit hash for checkout
+GIT_VERSION=d6b3bda24b001e9bc909188c25f45a084b8c3046
+
+# Package name
+NAME=ndns
+
+# Package version
+VERSION=0.0.1
+
+# PPA version
+PPA_VERSION=1
+
+include ../packaging.mk
diff --git a/ndns/debian/changelog b/ndns/debian/changelog
new file mode 100644
index 0000000..9eb9745
--- /dev/null
+++ b/ndns/debian/changelog
@@ -0,0 +1,12 @@
+ndns (0.0.1-ppa1~DISTRO) DISTRO; urgency=low
+
+ * New version based on d6b3bda24b001e9bc909188c25f45a084b8c3046
+ (https://github.com/named-data/ndns)
+
+ -- Alexander Afanasyev <alexander.afanasyev@ucla.edu> Sun, 30 Nov 2014 21:12:27 -0800
+
+ndns (0.0.0~ppa0~DISTRO) DISTRO; urgency=low
+
+ * Initial release
+
+ -- Xiaoke Jiang <shock.jiang@gmail.com> Wed, 26 Nov 2014 16:58:30 -0800
diff --git a/ndns/debian/compat b/ndns/debian/compat
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/ndns/debian/compat
@@ -0,0 +1 @@
+8
diff --git a/ndns/debian/control b/ndns/debian/control
new file mode 100644
index 0000000..4aac66d
--- /dev/null
+++ b/ndns/debian/control
@@ -0,0 +1,21 @@
+Source: ndns
+Priority: extra
+Maintainer: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+Build-Depends: debhelper (>= 8.0.0),
+ python (>= 2.7.0),
+ pkg-config (>= 0.26),
+ ndn-cxx-dev (>= 0.3.0~rc0.0),
+ liblog4cxx10-dev (>= 0.10.0)
+Standards-Version: 3.9.2
+Section: net
+Homepage: http://github.com/named-data/ndns
+Vcs-Git: git://github.com/named-data/ndns.git
+Vcs-Browser: http://github.com/named-data/ndns
+
+Package: ndns
+Architecture: i386 amd64
+Depends: ${shlibs:Depends}, ${misc:Depends}, ndn-cxx, nfd
+Description: Domain Name Service for Named Data Networking
+ NDNS is a completely distributed database system that largely mimics
+ the structure of the DNS system in today's Internet but operates within
+ the NDN architecture.
diff --git a/ndns/debian/copyright b/ndns/debian/copyright
new file mode 100644
index 0000000..75455e7
--- /dev/null
+++ b/ndns/debian/copyright
@@ -0,0 +1,33 @@
+Format: http://dep.debian.net/deps/dep5
+Upstream-Name: repo-ng
+Source: http://github.com/named-data/repo-ng
+
+Files: *
+Copyright: Copyright (c) 2014, Regents of the University of California.
+License: GPL-3+
+
+Files: debian/*
+Copyright: Copyright (c) 2013-2014, Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+License: BSD
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Regents of the University of California nor
+ the names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL REGENTS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/ndns/debian/log4cxx.properties b/ndns/debian/log4cxx.properties
new file mode 100644
index 0000000..49fad2d
--- /dev/null
+++ b/ndns/debian/log4cxx.properties
@@ -0,0 +1,10 @@
+log4j.rootLogger=OFF, A1
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.target=System.err
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+
+# Print the date in ISO 8601 format
+log4j.appender.A1.layout.ConversionPattern=%-5p %-15c - %m%n
+
+# Print only messages of level WARN or above in the package com.foo.
+#log4j.logger.com.foo=WARN
diff --git a/ndns/debian/ndn-testbed-root.ndncert.base64 b/ndns/debian/ndn-testbed-root.ndncert.base64
new file mode 100644
index 0000000..ef2af1f
--- /dev/null
+++ b/ndns/debian/ndn-testbed-root.ndncert.base64
@@ -0,0 +1,13 @@
+Bv0C1QcwCANuZG4IA0tFWQgRa3NrLTEzOTc1MzcyMjg2NDkIB0lELUNFUlQICAAAAUVjtyQUFAMY
+AQIV/QFnMIIBYzAiGA8yMDE0MDQxNDAwMDAwMFoYDzIwMTgxMjMxMjM1OTU5WjAZMBcGA1UEKRMQ
+TkROIFRlc3RiZWQgUm9vdDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAL/XonINE4KB
+IC5G3Aab3uJmz9nf/4nTRa2/tWDPn5Notqs/+h4i/xF7LusKbBXkugLRjYcJsO1bIVf597921U8L
+pCfQdhaxBWfr26M4ZsZ3i2cVanBvxTneZQWYahsg8M0gA+jMFbSkpgVhMsAfVR+UCPhcvPkZ/94V
+HoOq3Nae36RRW64pa0QKCuUluFRVrAhZD9zj+QJHM8faOlOJTLnss9vjggb5MWu/dS8cYEfY9o/O
+oVlpbeCbCoQJdhGc0NWhEmpTx/UZHSUEDKRV6643ETx63yQtT99WIp4+VVBAoxh1Dz8i4ePBjgBs
+DJTW7p3xxreOxeW/ndIKNpUzv/UCAREWLRsBARwoByYIA25kbggDS0VZCBFrc2stMTM5NzUzNzIy
+ODY0OQgHSUQtQ0VSVBf9AQAhyPUjSO3lCt1XDWSAsTiw7M454QlyUIXWvS5WqIXGE9zJgIMxt0OL
+ec6o6rg5LZyH+hh6MSoK9ItUvQDVA/FXyQdTfKZAshGhx7ejEmKwU5yCt3PXfprfwQZwuImjkFo2
+QpgrwN/cToXGkiEOQ/7r5qXCSAEagmIWiLncefixfTopK7mGW+ADQryvChtTeiXawWuq0xPC45wm
+wzkoEyE2cGuEbgdyQoHTB0i/75nJVmQOc6iJbgAfxrdLIC53krKe5QRX8H1GDf5IrELmwC7kKa0b
+b06RJ+hLLGEKa286IOHeAJAFsQu3wnoThWBFvUDegt41zF50awzgosHLrZRD
diff --git a/ndns/debian/ndns.conf b/ndns/debian/ndns.conf
new file mode 100644
index 0000000..ad5c1e5
--- /dev/null
+++ b/ndns/debian/ndns.conf
@@ -0,0 +1,13 @@
+zones
+{
+ dbFile /var/lib/ndns/ndns.db
+ validatorConfigFile /etc/ndns/validator.conf
+
+ ; zone {
+ ; name /
+ ; }
+}
+
+hints
+{
+}
diff --git a/ndns/debian/ndns.default b/ndns/debian/ndns.default
new file mode 100644
index 0000000..80f2bf6
--- /dev/null
+++ b/ndns/debian/ndns.default
@@ -0,0 +1,4 @@
+# ndns defaults
+
+# Enable ndns-daemon (disabled by default)
+# NDNS_DAEMON_ENABLE=true
diff --git a/ndns/debian/ndns.dirs b/ndns/debian/ndns.dirs
new file mode 100644
index 0000000..aee4f6b
--- /dev/null
+++ b/ndns/debian/ndns.dirs
@@ -0,0 +1,3 @@
+etc/ndns
+etc/ndns/anchors
+usr/bin
diff --git a/ndns/debian/ndns.install b/ndns/debian/ndns.install
new file mode 100644
index 0000000..62b4fab
--- /dev/null
+++ b/ndns/debian/ndns.install
@@ -0,0 +1,6 @@
+etc/ndns/*
+debian/ndns.conf etc/ndns/
+debian/validator.conf etc/ndns/
+debian/ndn-testbed-root.ndncert.base64 etc/ndns/anchors/
+debian/log4cxx.properties etc/ndns/
+usr/bin/*
diff --git a/ndns/debian/ndns.postinst b/ndns/debian/ndns.postinst
new file mode 100644
index 0000000..2b8379d
--- /dev/null
+++ b/ndns/debian/ndns.postinst
@@ -0,0 +1,16 @@
+#!/bin/sh -e
+
+if [ "$1" != "configure" ]; then
+ exit 0
+fi
+
+APP=ndns
+
+if [ ! -d /var/lib/ndns ]; then
+ sudo mkdir -p /var/lib/ndns
+ sudo chown -R ndns:ndns /var/lib/ndns
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/ndns/debian/ndns.preinst b/ndns/debian/ndns.preinst
new file mode 100644
index 0000000..edceb2a
--- /dev/null
+++ b/ndns/debian/ndns.preinst
@@ -0,0 +1,61 @@
+#!/bin/sh
+# preinst script for nfd
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <new-preinst> `install'
+# * <new-preinst> `install' <old-version>
+# * <new-preinst> `upgrade' <old-version>
+# * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ install|upgrade)
+ # Now we have to ensure the following state:
+ # /etc/passwd: ndns:x:YYY:ZZZ:NDNS User:/nonexistent:/bin/false
+ # /etc/group: ndns:x:ZZZ:
+ #
+ # Sadly there could any state be present on the system so we have to
+ # modify everything carefully i.e. not doing a chown before creating
+ # the user etc...
+
+ # creating ndns group if he isn't already there
+ if ! getent group ndns >/dev/null; then
+ # Adding system group: ndns.
+ addgroup --system ndns >/dev/null
+ fi
+
+ # creating ndns user if he isn't already there
+ if ! getent passwd ndns >/dev/null; then
+ # Adding system user: ndns.
+ adduser \
+ --system \
+ --disabled-login \
+ --ingroup ndns \
+ --home /var/lib/ndns \
+ --gecos "NDNS User" \
+ --shell /bin/bash \
+ ndns >/dev/null
+ fi
+ ;;
+
+ abort-upgrade)
+ ;;
+
+ *)
+ echo "preinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/ndns/debian/ndns.upstart b/ndns/debian/ndns.upstart
new file mode 100644
index 0000000..b3d50f2
--- /dev/null
+++ b/ndns/debian/ndns.upstart
@@ -0,0 +1,21 @@
+description "Domain Name Service for Named Data Networking"
+author "Xiaoke Jiang <shock.jiang@gmail.com>"
+
+start on started nrd
+stop on stopping nrd
+
+respawn
+respawn limit 10 5
+# respawn limit unlimited
+
+setuid ndns
+setgid ndns
+
+script
+ export HOME=/var/lib/ndns
+ NDNS_DAEMON_ENABLE=false
+ . /etc/default/ndns
+ if [[ $NDNS_DAEMON_ENABLE == "true" ]]; then
+ exec /usr/bin/ndns-daemon -c /etc/ndns/ndns.conf
+ fi
+end script
diff --git a/ndns/debian/rules b/ndns/debian/rules
new file mode 100755
index 0000000..185d67b
--- /dev/null
+++ b/ndns/debian/rules
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
+CXXFLAGS += -std=c++11
+
+%:
+ dh $@ --parallel
+
+override_dh_auto_configure:
+ LDFLAGS="${LDFLAGS}" CXXFLAGS="$(CXXFLAGS)" ./waf configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib
+
+override_dh_auto_build:
+ ./waf build
+
+override_dh_auto_install:
+ ./waf install --destdir=debian/tmp
+
+override_dh_auto_clean:
+ ./waf distclean
+
+override_dh_clean:
+ dh_clean
+ ./waf distclean
+ rm -rf .waf-1*
+ rm -rf .waf3-1*
+ rm -f .waf-tools/*.pyc
+ rm -f docs/*.pyc
+
+override_dh_auto_test:
diff --git a/ndns/debian/rules.precise b/ndns/debian/rules.precise
new file mode 100755
index 0000000..ea22c4d
--- /dev/null
+++ b/ndns/debian/rules.precise
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
+CXXFLAGS += -std=c++0x
+
+%:
+ dh $@ --parallel
+
+override_dh_auto_configure:
+ LDFLAGS="${LDFLAGS}" CXXFLAGS="$(CXXFLAGS)" ./waf configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib
+
+override_dh_auto_build:
+ ./waf build
+
+override_dh_auto_install:
+ ./waf install --destdir=debian/tmp
+
+override_dh_auto_clean:
+ ./waf distclean
+
+override_dh_clean:
+ dh_clean
+ ./waf distclean
+ rm -rf .waf-1*
+ rm -rf .waf3-1*
+ rm -f .waf-tools/*.pyc
+ rm -f docs/*.pyc
+
+override_dh_auto_test:
diff --git a/ndns/debian/source/format b/ndns/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/ndns/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/ndns/debian/validator.conf b/ndns/debian/validator.conf
new file mode 100644
index 0000000..e3f90e6
--- /dev/null
+++ b/ndns/debian/validator.conf
@@ -0,0 +1,28 @@
+rule
+{
+ id "NDNS Validator"
+ for data
+ checker
+ {
+ type customized
+ sig-type rsa-sha256
+ key-locator
+ {
+ type name
+ hyper-relation
+ {
+ k-regex ^(<>*)<KEY>(<>*)<><ID-CERT>$
+ k-expand \\1\\2
+ h-relation is-prefix-of ; data is only allowed to be signed by the zone key
+ p-regex ^(<>*)[<KEY><NDNS>](<>*)<><>$
+ p-expand \\1\\2
+ }
+ }
+ }
+}
+
+trust-anchor
+{
+ type file
+ file-name anchors/ndn-testbed-root.ndncert.base64
+}