doc.dox 3.01 KB
Newer Older
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at


 @page docs Building Kea Documentation

 There are several types of documentation for Kea. The primary one, intended to
 be read by users, is User's Guide. It comes in HTML, PDF and txt format. All
 of them generated from the same sources. To generate this doc, you need to
 run configure script with --enable-generate-docs option. Several tools have to
 be present in the system: docbook environment, links and several others.
 You can generate this by doing:
$ ./configure --enable-generate-docs
$ cd doc/
$ make guide

The output files will be generated in doc/guide/ directory.

Since Kea 1.5, this doc has appendix A that lists all Kea commands. That
appendix is generated using a small tool called docgen. The basic principle
is that for every command there is a JSON file that briefly describes the major
aspects of the new command, such as name, short description, expected syntax,
expected response, a hook that needs to be loaded, first Kea version where it
appeared, etc. Those JSON files are loaded by docgen tool that will generate
api.xml that will be used by make guide. There is no need to generate this,
unless you alter description of existing commands or add a new one.

@section docsNewCommand Documenting new command

There are several steps needed to document a new API command:

38 39 40 41 42 43
 1. Configure sources with ./configure --enable-generate-docs
 1. Copy doc/sphinx/api/_template.json to appropriate name.
 2. Remove comments from it and fill in the actual content.
 3. Update api_files variable in doc/sphinx/
 4. make html will generate multi-page html.
 5. make singlehtml will generate a single page html.
44 45 46 47 48 49 50 51

A word of caution regaring editing JSON files. The files themselves need to be
valid JSON files. They also often contain fields, such as command syntax or
command response, there are themselves a JSON or JSON like structures. That
means that some trickery with escaping double quotes will be involved. Note
there is no need to escape any other character, unless you want to specify
non-printable characters.

52 53 54 55 56 57
Also, while Kea's JSON parser supports comments and multi-line string, they
are not part of JSON standard. That means that external tools, such as python
or Sphinx parsers are not able to deal with them. Therefore comments must
be removed and long strings (such as command descriptions or example invocations)
are to be presented as a list of strings ( e.g. [ "line1", "line2, "line3" ]).

58 59 60 61 62 63 64 65
@section docsDevelGuide Generating Developer's Guide

Generating Developer's Guide is very simple, although you need to have
doxygen installed in your system. If you also have graphviz installed, it will
generate nice diagrams. To generate developer's guide, do the following commands:

$ ./configure
$ cd doc/devel
67 68 69 70
$ make devel