Commit 3cd215da authored by Daniel Salzman's avatar Daniel Salzman

Clean project directory

parent ef5413cb
Coding style
============
* Indentation: TAB (8 spaces width)
* Braces: K&R, 1TBS
* Max line width: 80 chars
* Pointer asterisk attached to the name of the variable
* Own structures/types: _t suffix (f.e. nameserver_t)
* Header guard format: _KNOTD_HEADER_H_
* Spaces around binary operators
* Space between keyword and bracket (f.e. "if (predicate)")
* No space between variable and typecast (f.e. "return (int)val;")
To sum it up, Linux KNF is used, see [1].
[1] Linux Coding Style:
http://kerneltrap.org/files/Jeremy/CodingStyle.txt
AStyle command format
=====================
astyle --style=1tbs -t8 -w -p -H -U -j --align-pointer=name
Doxygen
=======
* Format: Qt-style
* "\brief", not "@brief"
* "/*!", not "/**"
* Order of sections
* brief description
* long description
* notes
* warnings
* parameters
* return values
* todos
* Always use \brief (no autobrief)
* Indent text (using spaces only) in multiple-line sections
* In multi-line comments, opening line (/*!) should be empty
* One empty line between two consecutive sections
* Struct and union members documented on the same line if the comment fits
* Use \retval (or more of them) instead of \return
if the function returns some distinct values
(such as 0 for no error, -1 for something else, etc.)
Example
=======
/*!
* \brief Some structure.
*
* Longer description.
*/
struct some_struct {
/*!
* \brief This comment does not fit on the same line as the member
* as it is rather large.
*/
int fd;
int flags; /*!< Flags. */
};
/*!
* \brief Brief description of some function.
*
* Longer description.
*
* \note This function is deprecated.
*
* \warning Do not use this function!
*
* \param param1 Some parameter.
* \param param2 Other parameter. This one has rather large comment,
* so its next line is indented for better readability.
*
* \retval 0 on success.
* \retval -1 if some error occured.
*
* \todo Remove (deprecated).
*/
This diff is collapsed.
This diff is collapsed.
......@@ -16,11 +16,6 @@ Optional packages:
Dependencies for building documentation:
* texinfo
Knot DNS requires compiler to support atomic intrinsics.
GCC version at least 4.1 supports legacy atomic builtins, however 4.7
or newer is preferred.
Clang supports atomics since version 2.9.
By default Knot DNS is distributed with a slower zone file parser because of
smaller source file and quick compile time. In most cases it is sufficient.
If you plan to process large zone files, we recommend to build Knot DNS
......@@ -30,119 +25,49 @@ and it is normal if the C compiler takes much more time (minutes).
Installation
============
Knot DNS may be already included in your operating system distribution and
Knot DNS may already be included in your operating system distribution and
therefore can be installed from packages (Linux) or ports (BSD). This is
always preferred unless you want to test the latest features, contribute to
Knot development, or you just know what you are doing.
Following sections describe how to build Knot DNS from the source code.
Installation on Debian based distributions
==========================================
The following steps should work (verified in VirtualBox only)
for the distribution/architecture/release combinations as listed bellow.
1) Install prerequisites
----------------------------------------------
Debian (AMD64, I386) 6.0.2.1 (squeeze)
Ubuntu Server (AMD64, I386) 10.04 LTS
Ubuntu Desktop (AMD64, I386) 10.04 LTS
----------------------------------------------
# Make the system up-to-date
Debian based distributions
--------------------------
Update the system:
$ sudo apt-get update
$ sudo apt-get upgrade
# Ensure all prerequisites are installed
$ sudo apt-get install git-core autoconf libtool flex bison libssl-dev liburcu-dev
Install prerequisites:
$ sudo apt-get install git-core libtool autoconf flex bison libssl-dev liburcu-dev
# Install optional packages (POSIX 1003.1e capabilities)
$ sudo apt-get install libcap-ng-dev
Install optional packages:
($ sudo apt-get install libcap-ng-dev)
($ sudo apt-get install ragel)
# If the liburcu-dev package is not present, install it directly
# Get the source code
$ git clone git://git.nic.cz/knot-dns.git
$ cd knot-dns
$ autoreconf -if
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
Installation on Fedora
======================
Notice: Knot DNS is available in official distribution repositories since
Fedora 18 (Spherical Cow). Search for 'knot' package.
All commands with the '#' prompt should be run as the root user, commands with
the '$' prompt should be run as a regular non-root user.
If the liburcu-dev package is not present, install it from the source code
(http://lttng.org/urcu)
Fedora like distributions
-------------------------
Update the system:
# yum upgrade
$ yum upgrade
Ensure all base development tools are available:
# yum install @buildsys-build
$ yum install @buildsys-build
Ensure all prerequisites are installed:
# yum install libtool autoconf flex bison openssl-devel userspace-rcu-devel
You can also install optional packages:
# yum install libcap-ng-devel ragel
Download the latest source code from Git and compile it:
$ git clone git://git.nic.cz/knot-dns.git
$ cd knot
$ autoreconf -if
$ ./configure
$ make
Install Knot DNS into system (run only if you really know what these commands do):
# make install
# ldconfig
$ yum install libtool autoconf flex bison openssl-devel userspace-rcu-devel
Installation on BSD
===================
Not all prerequisites are available as ports on BSD.
- liburcu must be compiled from sources
- version 0.6.4 compiles on BSD without any source code modifications
- in case of x86_64 build, CFLAGS nad build type has to be set appropriately.
$ CFLAGS=-fPIC ./configure --build amd64
- flex must be newer version from ports that support reentrant parsers
Knot DNS requires more recent version of flex from ports, to prevent name clash
specify flex destination.
$ cd <knot sources>
$ autoreconf -if
$ ./configure
$ make && sudo make install
It is also present in port tree, so you can install it from there.
$ cd /usr/ports/dns/knot
$ sudo make install
Installation on OpenBSD/NetBSD
==============================
Also works for OS X, if you don't want to install gcc from ports.
Prerequisites:
- flex and bison from packages
$ mkdir liburcu && cd liburcu
$ wget "http://lttng.org/files/urcu/userspace-rcu-0.8.0.tar.bz2"
$ autoconf && ./configure && make && sudo make install
$ # or follow installation instructions in INSTALL
Knot DNS installation is the same as in previous section (Installation on BSD).
Installation on OS X
====================
Install optional packages:
($ yum install libcap-ng-devel)
($ yum install ragel)
OS X
----
Not all prerequisites are preinstalled for OS X.
- liburcu must be compiled from sources
- liburcu requires gcc-4.6 from MacPorts, as it depends on __thread keyword
$ CC=gcc-mp-4.6 ARCH=x86_64 ./configure
......@@ -152,32 +77,54 @@ Not all prerequisites are preinstalled for OS X.
Compiling Knot DNS with gcc-mp-4.6 is recommended, but not necessary.
2) Install Knot DNS
Knot DNS requires compiler to support atomic intrinsics.
GCC version at least 4.1 supports legacy atomic builtins, however 4.7
or newer is preferred.
Clang supports atomics since version 2.9.
Get the source code:
$ git clone git://git.nic.cz/knot-dns.git
Or extract source package to knot-dns directory
Compile Knot
$ cd knot-dns
$ autoreconf -if
$ ./configure
$ make
Install Knot DNS into system:
$ sudo make install
$ sudo ldconfig
Running
=======
First, each server needs configuration file.
Please see samples/knot.sample.conf for reference.
More examples can be found in samples/knot.full.conf
1) Each server needs configuration file. Please see samples/knot.sample.conf
for reference or samples/knot.full.conf for more examples.
Configuration file has to specify:
* storage for PID files, journal files etc.
* network interfaces
* served zones
$ cp samples/knot.sample.conf myserver.conf
$ vim myserver.conf # or your favourite text editor
$ knotd -h # see what it can do
- storage for PID files, journal files etc.
- network interfaces
- served zones
Second, prepare working directory.
E.g. use the default config file:
$ cd /etc/knot
$ mv knot.sample.conf knot.conf
Modify the config:
$ vim knot.conf
$ mkdir -p /tmp/knot-minimal/samples; cp samples/example.com.zone /tmp/knot-minimal/samples/
2) Prepare working directory
$ mv example.com.zone /var/lib/knot/
Third, let's start the server. This can be done by running the 'knotd' command.
3) Start the server. This can be done by running the 'knotd' command.
Alternatively, your distribution should have an init script available, if you've
installed Knot using a binary package.
Lets start our server in foreground to see if it runs:
Start Knot in foreground to see if it runs:
$ knotd -c myserver.conf
For more information, refer to the user manual.
For more information, refer to the user manual or:
$ knotc -h
$ knotd -h
Knot DNS THANKS file
Knot DNS was originally written by CZ.NIC Labs. It would not be what
Knot DNS was originally written by CZ.NIC Labs. It would not be what
it is today without the invaluable help of these people, who have
reported problems, suggested improvements, or submitted actual code.
Please help us keep this list complete and free from errors. Also see
Please help us keep this list complete and free from errors. Also see
the AUTHORS file for the list of people with contributions significant
enough to warrant copyright assignment.
......@@ -12,26 +10,3 @@ Geert Hendrickx geert@hendrickx.be
Michal 'vorner' Vaner vorner@ucw.cz
Ondřej Caletka ondrej@caletka.cz
Anand Buddhdev anandb@ripe.net
================
Local Variables:
mode: text
coding: utf-8
End:
Copyright (C) 2011 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--style=1tbs
--indent=tab=8
--indent-preprocessor
--pad-oper
--pad-header
--unpad-paren
--add-brackets
--convert-tabs
--align-pointer=name
--mode=c
--lineend=linux
......@@ -86,3 +86,5 @@ void estimator_rrset_memsize_wrap(const scanner_t *scanner);
void estimator_free_trie_node(value_t *val, void *data);
#endif /* _KNOT_ESTIMATOR_H_ */
/*! @} */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment