Use Doxygen to generate the API documentation. (#1558)

* Integrated Doxygen documentation into Sphinx

Signed-off-by: lns <matzeton@googlemail.com>
This commit is contained in:
Toni 2022-05-29 13:44:52 +02:00 committed by GitHub
parent 33f9729ee4
commit 6b7b23b01d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 2728 additions and 25 deletions

4
.ci-ignore Normal file
View file

@ -0,0 +1,4 @@
# Codige Code Review ignore
# Prevent Codiga complaining about Sphinx config.py
doc/conf.py

View file

@ -34,7 +34,7 @@ jobs:
./tests/do-dga.sh
- name: Generate Coverage Report
run: |
mkdir -p coverage_report/ndpi_coverage_report
mkdir -vp coverage_report/ndpi_coverage_report
lcov --directory . --capture --output-file lcov.info
genhtml -o coverage_report/ndpi_coverage_report lcov.info
- uses: actions/upload-artifact@v2
@ -75,6 +75,39 @@ jobs:
cd python
python tests.py
documentation:
name: Documentation (ubuntu-latest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install Ubuntu Prerequisites
run: |
sudo apt-get update
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison doxygen
- name: Configure nDPI library
run: |
./autogen.sh --with-only-libndpi
- name: Generate Documentation
run: |
cd doc
pip install --upgrade pip
pip install -r requirements.txt
make html
cd ..
mkdir -vp doc/_build/ndpi-documentation-upload/ndpi-documentation
mv -v doc/_build/html doc/_build/ndpi-documentation-upload/ndpi-documentation/html
- uses: actions/upload-artifact@v2
with:
name: ndpi-documentation
path: doc/_build/ndpi-documentation-upload
retention-days: 7
test-scripts:
name: Test Utils (ubuntu-latest)
runs-on: ubuntu-latest
@ -334,12 +367,6 @@ jobs:
run: |
make dist
./utils/verify_dist_tarball.sh
- name: Generate documentation
if: startsWith(matrix.os, 'ubuntu-latest') && startsWith(matrix.arch, 'x86_64')
run: |
pip3 install --user sphinxcontrib.swaggerdoc
make -C doc text
make -C doc html
- name: Build nDPI [Mingw-w64] (runs only on ubuntu jobs)
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'x86_64')
run: |

View file

@ -12,13 +12,13 @@ EXTRA_DIST = README.md README.nDPI README.fuzzer.md CHANGELOG.md CONTRIBUTING.md
autogen.sh wireshark windows utils packages \
influxdb/Makefile.in influxdb/metric_anomaly.c influxdb/README.txt \
rrdtool/Makefile.in rrdtool/README.txt rrdtool/rrd_anomaly.c rrdtool/rrd_similarity.c \
doc/api.rst doc/conf.py doc/flow_risks.rst doc/guide/nDPI_QuickStartGuide.pages \
doc/requirements.txt doc/conf.py doc/flow_risks.rst doc/guide/nDPI_QuickStartGuide.pages \
doc/guide/nDPI_QuickStartGuide.pdf doc/img/logo.png doc/index.rst \
doc/Makefile doc/what_is_ndpi.rst \
python/DEV_GUIDE.md python/dev_requirements.txt python/ndpi_example.py python/ndpi/__init__.py \
python/ndpi/ndpi_build.py python/ndpi/ndpi.py python/README.md \
python/requirements.txt python/setup.py python/tests.py \
sonar-project.properties .github .lgtm/cpp-queries/packet-payload-integer-arithmetic.ql lgtm.yml
sonar-project.properties .github .ci-ignore .lgtm/cpp-queries/packet-payload-integer-arithmetic.ql lgtm.yml
changelog:

View file

@ -297,7 +297,7 @@ dnl> ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lcurl"
dnl> AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [curl is present])
dnl> fi
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile tests/unit/Makefile tests/performance/Makefile tests/dga/Makefile rrdtool/Makefile influxdb/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile fuzz/Makefile src/include/ndpi_api.h])
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile tests/unit/Makefile tests/performance/Makefile tests/dga/Makefile rrdtool/Makefile influxdb/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile fuzz/Makefile src/include/ndpi_api.h doc/Doxyfile.cfg])
AC_CONFIG_FILES([tests/do.sh], [chmod +x tests/do.sh])
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
AC_SUBST(GIT_RELEASE)

2658
doc/Doxyfile.cfg.in Normal file

File diff suppressed because it is too large Load diff

View file

@ -22,8 +22,8 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " release to make standalone HTML files for ntop documentation release"
@echo " html to make standalone HTML files"
@echo " release to make standalone Doxygen/HTML files for ntop documentation release"
@echo " html to make standalone Doxygen/HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@ -50,12 +50,15 @@ help:
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
cd doxygen; make clean
rm -rf $(BUILDDIR)/* api doxygen
.PHONY: html
html:
cd doxygen; make
@test -r Doxyfile.cfg || { \
echo 'Doxyfile.cfg does not exist; Please run $(realpath ..)/autogen.sh or $(realpath ..)/configure first.'; \
false; \
}
doxygen Doxyfile.cfg
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

View file

@ -1,4 +0,0 @@
nDPI Programming API
####################
Placeholder

View file

@ -21,7 +21,8 @@ sys.path.append( "breathe/" )
# ones.
extensions = [
'sphinx.ext.intersphinx',
'breathe'
'breathe',
'exhale'
]
# Workaround for platforms where swaggerdoc is not available
@ -31,6 +32,18 @@ if not os.environ.get("PYTHON_SKIP_SWAGGERDOC"):
breathe_projects = { "apidoc" : "doxygen/xml/" }
breathe_default_project = "apidoc"
exhale_args = {
"containmentFolder": "./api",
"rootFileName": "library_root.rst",
"rootFileTitle": "Library API",
"doxygenStripFromPath": ".",
"createTreeView": True,
# "treeViewIsBootstrap": True,
}
primary_domain = 'c'
highlight_language = 'c'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -139,7 +152,7 @@ html_logo = "img/logo.png"
# 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']
#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
@ -288,4 +301,4 @@ texinfo_documents = [
intersphinx_mapping = {'https://docs.python.org/': None}
def setup(app):
app.add_stylesheet('css/ntop.css')
app.add_css_file('css/ntop.css')

View file

@ -13,7 +13,7 @@ nDPI is an open source DPI (Deep Packet Inspection) toolkit for traffic analysis
:maxdepth: 2
:caption: Developer's Guide
api
api/library_root
flow_risks
.. toctree::

4
doc/requirements.txt Normal file
View file

@ -0,0 +1,4 @@
breathe
exhale
sphinx-rtd-theme
sphinxcontrib-swaggerdoc

View file

@ -127,8 +127,6 @@ extern "C" {
extern u_int8_t ndpi_is_proto(ndpi_protocol proto, u_int16_t p);
extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
const char **file, const char **func, u_int32_t * line);