diff --git a/.clang-format b/.clang-format index 69670b574247..e1b4e41f6650 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,5 @@ # Suricata settings as per -# doc/devguide/codebase/code-style.rst +# doc/userguide/devguide/codebase/code-style.rst # # This file is set up for clang 9. For the settings available, see # https://releases.llvm.org/9.0.0/tools/clang/docs/ClangFormatStyleOptions.html diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index b50c25a6faeb..0007322ff4da 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -1157,7 +1157,6 @@ jobs: - run: make dist - name: Checking that documentation was built run: | - test -e doc/devguide/devguide.pdf test -e doc/userguide/userguide.pdf test -e doc/userguide/suricata.1 - name: Extracting suricata-verify diff --git a/configure.ac b/configure.ac index a34b71f4f04f..754237da1219 100644 --- a/configure.ac +++ b/configure.ac @@ -2534,7 +2534,7 @@ AM_CONDITIONAL([BUILD_SHARED_LIBRARY], [test "x$enable_shared" = "xyes"] && [tes AC_CONFIG_FILES(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/derive/Cargo.toml rust/.cargo/config) AC_CONFIG_FILES(qa/Makefile qa/coccinelle/Makefile) -AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile doc/devguide/Makefile) +AC_CONFIG_FILES(rules/Makefile doc/Makefile doc/userguide/Makefile) AC_CONFIG_FILES(contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile) AC_CONFIG_FILES(suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service) AC_CONFIG_FILES(python/Makefile python/suricata/config/defaults.py) diff --git a/doc/Makefile.am b/doc/Makefile.am index c2bd1d456ca6..f3cad3d0713d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = userguide devguide +SUBDIRS = userguide EXTRA_DIST = \ AUTHORS \ diff --git a/doc/devguide/Makefile.am b/doc/devguide/Makefile.am deleted file mode 100644 index e4fe5ea309ef..000000000000 --- a/doc/devguide/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -EXTRA_DIST = \ - conf.py \ - _static \ - index.rst \ - extending/detect/index.rst \ - extending/decoder/index.rst \ - extending/index.rst \ - extending/app-layer/index.rst \ - extending/app-layer/app-layer-frames.rst \ - extending/app-layer/parser.rst \ - extending/app-layer/transactions.rst \ - extending/app-layer/diagrams \ - extending/app-layer/img \ - extending/capture/index.rst \ - extending/output/index.rst \ - internals/engines/index.rst \ - internals/threading/index.rst \ - internals/index.rst \ - internals/pipeline/index.rst \ - internals/datastructs/index.rst \ - codebase/index.rst \ - codebase/code-style.rst \ - codebase/contributing/code-submission-process.rst \ - codebase/contributing/index.rst \ - codebase/fuzz-testing.rst \ - codebase/testing.rst \ - codebase/unittests-c.rst \ - codebase/unittests-rust.rst - -if HAVE_SPHINXBUILD -if HAVE_MSCGEN - -if HAVE_PDFLATEX -EXTRA_DIST += devguide.pdf -endif - -SPHINX_BUILD = sphinx-build -q - -html: - sysconfdir=$(sysconfdir) \ - localstatedir=$(localstatedir) \ - version=$(PACKAGE_VERSION) \ - $(SPHINX_BUILD) -W -b html -d _build/doctrees \ - $(top_srcdir)/doc/devguide _build/html - -_build/latex/Suricata.pdf: - sysconfdir=$(sysconfdir) \ - localstatedir=$(localstatedir) \ - version=$(PACKAGE_VERSION) \ - $(SPHINX_BUILD) -W -b latex -d _build/doctrees \ - $(top_srcdir)/doc/devguide _build/latex -# The Sphinx generated Makefile is GNU Make specific, so just do what -# it does here - yes, multiple passes of pdflatex is required. - cd _build/latex && pdflatex Suricata.tex - cd _build/latex && pdflatex Suricata.tex - cd _build/latex && pdflatex Suricata.tex - cd _build/latex && makeindex -s python.ist Suricata.idx - cd _build/latex && pdflatex Suricata.tex - cd _build/latex && pdflatex Suricata.tex - -devguide.pdf: _build/latex/Suricata.pdf - cp _build/latex/Suricata.pdf devguide.pdf - -pdf: devguide.pdf - -# Remove build artifacts that aren't tracked by autotools. -clean-local: - rm -rf $(top_builddir)/doc/devguide/_build - rm -f $(top_builddir)/doc/devguide/suricata.1 - rm -f $(top_builddir)/doc/devguide/devguide.pdf - -endif # HAVE_MSCGEN -endif # HAVE_SPHINXBUILD diff --git a/doc/devguide/Makefile.sphinx b/doc/devguide/Makefile.sphinx deleted file mode 100644 index bd8cddd8e9e2..000000000000 --- a/doc/devguide/Makefile.sphinx +++ /dev/null @@ -1,204 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build - -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -BUILD_IMG = ./tools/generate-images.sh - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text changes linkcheck doctest coverage gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone 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" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " applehelp to make an Apple Help Book" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " coverage to run coverage check of the documentation (if enabled)" - -clean: - rm -rf $(BUILDDIR)/* - -html: - $(BUILD_IMG) - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(BUILD_IMG) - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(BUILD_IMG) - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(BUILD_IMG) - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(BUILD_IMG) - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(BUILD_IMG) - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(BUILD_IMG) - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Suricata.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Suricata.qhc" - -applehelp: - $(BUILD_IMG) - $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp - @echo - @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." - @echo "N.B. You won't be able to view it unless you put it in" \ - "~/Library/Documentation/Help or install it in your application" \ - "bundle." - -devhelp: - $(BUILD_IMG) - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/Suricata" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Suricata" - @echo "# devhelp" - -epub: - $(BUILD_IMG) - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(BUILD_IMG) - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(BUILD_IMG) - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: - $(BUILD_IMG) - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(BUILD_IMG) - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -texinfo: - $(BUILD_IMG) - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(BUILD_IMG) - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(BUILD_IMG) - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -coverage: - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage - @echo "Testing of coverage in the sources finished, look at the " \ - "results in $(BUILDDIR)/coverage/python.txt." - -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/doc/devguide/_static/.gitignore b/doc/devguide/_static/.gitignore deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/doc/devguide/_static/css/suricata.css b/doc/devguide/_static/css/suricata.css deleted file mode 100644 index 5fdbbf11181a..000000000000 --- a/doc/devguide/_static/css/suricata.css +++ /dev/null @@ -1,27 +0,0 @@ -.example-rule { - padding: 12px 12px; - font-family: Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace; - font-size: 12px; - line-height: 1.5; - display: block; - overflow: auto; - color: #404040; - - border: 1px solid #e1e4e5; - background: #fff; - margin: 1px 0 24px 0; -} -.example-rule-emphasis { - color: #f00; - font-weight: bold; -} - -.example-rule-action { - color: #f00; -} -.example-rule-header { - color: #090; -} -.example-rule-options { - color: #00f; -} diff --git a/doc/devguide/conf.py b/doc/devguide/conf.py deleted file mode 100644 index 5e5f8d1f6ce2..000000000000 --- a/doc/devguide/conf.py +++ /dev/null @@ -1,315 +0,0 @@ -# -*- coding: utf-8 -*- -# -# 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 shlex -import re -import subprocess - -on_rtd = os.environ.get('READTHEDOCS', None) == 'True' - -# 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 = [] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] -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'Suricata' -copyright = u'2020, OISF' -author = u'OISF' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. - -# Attempt to extract the version configure.ac. -try: - version = os.environ.get('version', None) - if not version: - version = re.search( - "AC_INIT\(\[suricata\],\s*\[(.*)?\]\)", - open("../../configure.ac").read()).groups()[0] - if not version: - version = "unknown" -except: - version = "unknown" -release = version - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -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 = [ - '_build', -] - -# 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 - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -if not on_rtd: - # Attempt to use the read the docs theme. - try: - import sphinx_rtd_theme - html_theme = 'sphinx_rtd_theme' - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - except: - html_theme = 'default' -else: - html_context = { - 'css_files': [ - 'https://media.readthedocs.org/css/sphinx_rtd_theme.css', - 'https://media.readthedocs.org/css/readthedocs-doc-embed.css', - '_static/css/suricata.css', - ], - } - -def setup(app): - # Generate images. - subprocess.check_call("./tools/generate-images.sh") - if not on_rtd: - if hasattr(app, 'add_css_file'): - app.add_css_file('css/suricata.css') - else: - app.add_stylesheet('css/suricata.css') - -# 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 -# " v 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 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 = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -#html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -#html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'suricatadevdoc' - -# -- 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': '', - -# Latex figure (float) alignment -#'figure_align': 'htbp', -} - -# 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 = [ - (master_doc, 'Suricata.tex', u'Suricata Developer Guide', - u'OISF', '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 Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'Suricata', u'Suricata Developer Guide', - author, 'Suricata', 'High performance NSM tool', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False - -rst_epilog = """ -.. |sysconfdir| replace:: %(sysconfdir)s -.. |localstatedir| replace:: %(localstatedir)s -""" % { - "sysconfdir": os.getenv("sysconfdir", "/etc"), - "localstatedir": os.getenv("localstatedir", "/var"), -} diff --git a/doc/userguide/Makefile.am b/doc/userguide/Makefile.am index b6c9888ba7fc..e535462a8a84 100644 --- a/doc/userguide/Makefile.am +++ b/doc/userguide/Makefile.am @@ -6,6 +6,7 @@ EXTRA_DIST = \ command-line-options.rst \ conf.py \ configuration \ + devguide \ file-extraction \ index.rst \ upgrade \ @@ -88,5 +89,6 @@ clean-local: rm -rf $(top_builddir)/doc/userguide/_build rm -f $(top_builddir)/doc/userguide/suricata*.1 rm -f $(top_builddir)/doc/userguide/userguide.pdf + rm -f $(top_builddir)/doc/userguide/devguide/extending/app-layer/diagrams/*.png endif # HAVE_SPHINXBUILD diff --git a/doc/userguide/README.md b/doc/userguide/README.md index 65776b225e15..b625625c17da 100644 --- a/doc/userguide/README.md +++ b/doc/userguide/README.md @@ -1,7 +1,8 @@ # Suricata User Guide -This directory contains the Suricata Guide. The -[Sphinx Document Generator](http://sphinx-doc.org) is used to build the +This directory contains the Suricata Guide. The Suricata Developer's guide +is included as a chapter of the Guide. +The [Sphinx Document Generator](http://sphinx-doc.org) is used to build the documentation. For a primer os reStructuredText see the [reStructuredText Primer](http://sphinx-doc.org/rest.html). diff --git a/doc/userguide/conf.py b/doc/userguide/conf.py index baf4726e6238..1cb1287d2aee 100644 --- a/doc/userguide/conf.py +++ b/doc/userguide/conf.py @@ -16,6 +16,7 @@ import os import shlex import re +import subprocess on_rtd = os.environ.get('READTHEDOCS', None) == 'True' @@ -50,7 +51,7 @@ # General information about the project. project = u'Suricata' -copyright = u'2016-2019, OISF' +copyright = u'2016-2022, OISF' author = u'OISF' # The version info for the project you're documenting, acts as replacement for @@ -134,11 +135,6 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] except: html_theme = 'default' - def setup(app): - if hasattr(app, 'add_css_file'): - app.add_css_file('css/suricata.css') - else: - app.add_stylesheet('css/suricata.css') else: html_context = { 'css_files': [ @@ -148,6 +144,15 @@ def setup(app): ], } +def setup(app): + # Generate images. + subprocess.check_call("./devguide/tools/generate-images.sh") + if not on_rtd: + if hasattr(app, 'add_css_file'): + app.add_css_file('css/suricata.css') + else: + app.add_stylesheet('css/suricata.css') + # 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. diff --git a/doc/devguide/.gitignore b/doc/userguide/devguide/.gitignore similarity index 83% rename from doc/devguide/.gitignore rename to doc/userguide/devguide/.gitignore index faba9ed00cb4..507d52cdc509 100644 --- a/doc/devguide/.gitignore +++ b/doc/userguide/devguide/.gitignore @@ -1,2 +1 @@ -_build extending/app-layer/diagrams/*.png diff --git a/doc/devguide/README.md b/doc/userguide/devguide/README.md similarity index 100% rename from doc/devguide/README.md rename to doc/userguide/devguide/README.md diff --git a/doc/devguide/codebase/code-style.rst b/doc/userguide/devguide/codebase/code-style.rst similarity index 100% rename from doc/devguide/codebase/code-style.rst rename to doc/userguide/devguide/codebase/code-style.rst diff --git a/doc/devguide/codebase/contributing/code-submission-process.rst b/doc/userguide/devguide/codebase/contributing/code-submission-process.rst similarity index 100% rename from doc/devguide/codebase/contributing/code-submission-process.rst rename to doc/userguide/devguide/codebase/contributing/code-submission-process.rst diff --git a/doc/devguide/codebase/contributing/index.rst b/doc/userguide/devguide/codebase/contributing/index.rst similarity index 100% rename from doc/devguide/codebase/contributing/index.rst rename to doc/userguide/devguide/codebase/contributing/index.rst diff --git a/doc/devguide/codebase/fuzz-testing.rst b/doc/userguide/devguide/codebase/fuzz-testing.rst similarity index 100% rename from doc/devguide/codebase/fuzz-testing.rst rename to doc/userguide/devguide/codebase/fuzz-testing.rst diff --git a/doc/devguide/codebase/img/InputCaptureExample.png b/doc/userguide/devguide/codebase/img/InputCaptureExample.png similarity index 100% rename from doc/devguide/codebase/img/InputCaptureExample.png rename to doc/userguide/devguide/codebase/img/InputCaptureExample.png diff --git a/doc/devguide/codebase/index.rst b/doc/userguide/devguide/codebase/index.rst similarity index 100% rename from doc/devguide/codebase/index.rst rename to doc/userguide/devguide/codebase/index.rst diff --git a/doc/devguide/codebase/testing.rst b/doc/userguide/devguide/codebase/testing.rst similarity index 100% rename from doc/devguide/codebase/testing.rst rename to doc/userguide/devguide/codebase/testing.rst diff --git a/doc/devguide/codebase/unittests-c.rst b/doc/userguide/devguide/codebase/unittests-c.rst similarity index 100% rename from doc/devguide/codebase/unittests-c.rst rename to doc/userguide/devguide/codebase/unittests-c.rst diff --git a/doc/devguide/codebase/unittests-rust.rst b/doc/userguide/devguide/codebase/unittests-rust.rst similarity index 100% rename from doc/devguide/codebase/unittests-rust.rst rename to doc/userguide/devguide/codebase/unittests-rust.rst diff --git a/doc/devguide/extending/app-layer/app-layer-frames.rst b/doc/userguide/devguide/extending/app-layer/app-layer-frames.rst similarity index 94% rename from doc/devguide/extending/app-layer/app-layer-frames.rst rename to doc/userguide/devguide/extending/app-layer/app-layer-frames.rst index 115532162c95..ec16ea91c9b2 100644 --- a/doc/devguide/extending/app-layer/app-layer-frames.rst +++ b/doc/userguide/devguide/extending/app-layer/app-layer-frames.rst @@ -75,7 +75,7 @@ This section shows how Frame support is added in Rust, using examples from the ` **Define the frame types**. The frame types are defined as an enum. In Rust, make sure to derive from the ``AppLayerFrameType``: -.. literalinclude:: ../../../../rust/src/sip/sip.rs +.. literalinclude:: ../../../../../rust/src/sip/sip.rs :caption: rust/src/sip/sip.rs :language: rust :start-after: // app-layer-frame-documentation tag start: FrameType enum @@ -83,7 +83,7 @@ This section shows how Frame support is added in Rust, using examples from the ` **Frame registering**. Some understanding of the parser will be needed in order to find where the frames should be registered. It makes sense that it will happen when the input stream is being parsed into records. See when some pdu and request frames are created for SIP: -.. literalinclude:: ../../../../rust/src/sip/sip.rs +.. literalinclude:: ../../../../../rust/src/sip/sip.rs :caption: rust/src/sip/sip.rs :language: rust :start-after: // app-layer-frame-documentation tag start: parse_request @@ -96,7 +96,7 @@ This section shows how Frame support is added in Rust, using examples from the ` **Use the Frame API or build upon them as needed**. These are the frame registration functions highlighted above: -.. literalinclude:: ../../../../rust/src/sip/sip.rs +.. literalinclude:: ../../../../../rust/src/sip/sip.rs :caption: rust/src/sip/sip.rs :language: rust :start-after: // app-layer-frame-documentation tag start: function to add frames @@ -104,7 +104,7 @@ This section shows how Frame support is added in Rust, using examples from the ` **Register relevant frame callbacks.** As these are inferred from the ``#[derive(AppLayerFrameType)]`` statement, all that is needed is: -.. literalinclude:: ../../../../rust/src/sip/sip.rs +.. literalinclude:: ../../../../../rust/src/sip/sip.rs :caption: rust/src/sip/sip.rs :language: rust :start-at: get_frame_id_by_name @@ -117,7 +117,7 @@ This section shows how Frame support is added in Rust, using examples from the ` The telnet parser has examples of using the Frame API directly for registering telnet frames, and also illustrates how that is done when length is not yet known: -.. literalinclude:: ../../../../rust/src/telnet/telnet.rs +.. literalinclude:: ../../../../../rust/src/telnet/telnet.rs :caption: rust/src/telnet/telnet.rs :language: rust :start-after: // app-layer-frame-documentation tag start: parse_request @@ -127,7 +127,7 @@ The telnet parser has examples of using the Frame API directly for registering t We then update length later on (note especially lines 3 and 10): -.. literalinclude:: ../../../../rust/src/telnet/telnet.rs +.. literalinclude:: ../../../../../rust/src/telnet/telnet.rs :caption: rust/src/telnet/telnet.rs :language: rust :start-after: // app-layer-frame-documentation tag start: update frame_len @@ -145,7 +145,7 @@ The Frame API calls parameters represent: ``StreamSlice`` contains the input data to the parser, alongside other Stream-related data important in parsing context. Definition is found in *applayer.rs*: -.. literalinclude:: ../../../../rust/src/applayer.rs +.. literalinclude:: ../../../../../rust/src/applayer.rs :caption: rust/src/applayer.rs :language: rust :start-at: pub struct StreamSlice @@ -159,7 +159,7 @@ Implementing Frame support in C involves a bit more manual work, as one cannot m Defining the frame types with the enum means: -.. literalinclude:: ../../../../src/app-layer-htp.c +.. literalinclude:: ../../../../../src/app-layer-htp.c :caption: src/app-layer-htp.c :start-after: /* app-layer-frame-documentation tag start: HttpFrameTypes :end-before: /* app-layer-frame-documentation tag end: HttpFrameTypes @@ -167,7 +167,7 @@ Defining the frame types with the enum means: The HTTP parser uses the Frame registration functions from the C API (``app-layer-frames.c``) directly for registering request Frames. Here we also don't know the length yet. The ``0`` indicates flow direction: ``toserver``, and ``1`` would be used for ``toclient``: -.. literalinclude:: ../../../../src/app-layer-htp.c +.. literalinclude:: ../../../../../src/app-layer-htp.c :caption: src/app-layer-htp.c :start-after: /* app-layer-frame-documentation tag start: frame registration http request :end-before: /* app-layer-frame-documentation tag end: frame registration http request @@ -175,7 +175,7 @@ The HTTP parser uses the Frame registration functions from the C API (``app-laye Updating ``frame->len`` later: -.. literalinclude:: ../../../../src/app-layer-htp.c +.. literalinclude:: ../../../../../src/app-layer-htp.c :caption: src/app-layer-htp.c :start-after: /* app-layer-frame-documentation tag start: updating frame->len :end-before: /* app-layer-frame-documentation tag end: updating frame->len @@ -183,7 +183,7 @@ Updating ``frame->len`` later: Register relevant callbacks (note that the actual functions will also have to be written, for C): -.. literalinclude:: ../../../../src/app-layer-htp.c +.. literalinclude:: ../../../../../src/app-layer-htp.c :caption: src/app-layer-htp.c :language: c :start-after: /* app-layer-frame-documentation tag start: registering relevant callbacks diff --git a/doc/devguide/extending/app-layer/diagrams/DnsUnidirectionalTransactions.msc b/doc/userguide/devguide/extending/app-layer/diagrams/DnsUnidirectionalTransactions.msc similarity index 100% rename from doc/devguide/extending/app-layer/diagrams/DnsUnidirectionalTransactions.msc rename to doc/userguide/devguide/extending/app-layer/diagrams/DnsUnidirectionalTransactions.msc diff --git a/doc/devguide/extending/app-layer/diagrams/HTTP2BidirectionalTransaction.msc b/doc/userguide/devguide/extending/app-layer/diagrams/HTTP2BidirectionalTransaction.msc similarity index 100% rename from doc/devguide/extending/app-layer/diagrams/HTTP2BidirectionalTransaction.msc rename to doc/userguide/devguide/extending/app-layer/diagrams/HTTP2BidirectionalTransaction.msc diff --git a/doc/devguide/extending/app-layer/diagrams/TemplateTransaction.msc b/doc/userguide/devguide/extending/app-layer/diagrams/TemplateTransaction.msc similarity index 100% rename from doc/devguide/extending/app-layer/diagrams/TemplateTransaction.msc rename to doc/userguide/devguide/extending/app-layer/diagrams/TemplateTransaction.msc diff --git a/doc/devguide/extending/app-layer/diagrams/TlsHandshake.msc b/doc/userguide/devguide/extending/app-layer/diagrams/TlsHandshake.msc similarity index 100% rename from doc/devguide/extending/app-layer/diagrams/TlsHandshake.msc rename to doc/userguide/devguide/extending/app-layer/diagrams/TlsHandshake.msc diff --git a/doc/devguide/extending/app-layer/img/StreamFrames.png b/doc/userguide/devguide/extending/app-layer/img/StreamFrames.png similarity index 100% rename from doc/devguide/extending/app-layer/img/StreamFrames.png rename to doc/userguide/devguide/extending/app-layer/img/StreamFrames.png diff --git a/doc/devguide/extending/app-layer/index.rst b/doc/userguide/devguide/extending/app-layer/index.rst similarity index 100% rename from doc/devguide/extending/app-layer/index.rst rename to doc/userguide/devguide/extending/app-layer/index.rst diff --git a/doc/devguide/extending/app-layer/parser.rst b/doc/userguide/devguide/extending/app-layer/parser.rst similarity index 100% rename from doc/devguide/extending/app-layer/parser.rst rename to doc/userguide/devguide/extending/app-layer/parser.rst diff --git a/doc/devguide/extending/app-layer/transactions.rst b/doc/userguide/devguide/extending/app-layer/transactions.rst similarity index 100% rename from doc/devguide/extending/app-layer/transactions.rst rename to doc/userguide/devguide/extending/app-layer/transactions.rst diff --git a/doc/devguide/extending/capture/index.rst b/doc/userguide/devguide/extending/capture/index.rst similarity index 100% rename from doc/devguide/extending/capture/index.rst rename to doc/userguide/devguide/extending/capture/index.rst diff --git a/doc/devguide/extending/decoder/index.rst b/doc/userguide/devguide/extending/decoder/index.rst similarity index 100% rename from doc/devguide/extending/decoder/index.rst rename to doc/userguide/devguide/extending/decoder/index.rst diff --git a/doc/devguide/extending/detect/index.rst b/doc/userguide/devguide/extending/detect/index.rst similarity index 100% rename from doc/devguide/extending/detect/index.rst rename to doc/userguide/devguide/extending/detect/index.rst diff --git a/doc/devguide/extending/index.rst b/doc/userguide/devguide/extending/index.rst similarity index 100% rename from doc/devguide/extending/index.rst rename to doc/userguide/devguide/extending/index.rst diff --git a/doc/devguide/extending/output/index.rst b/doc/userguide/devguide/extending/output/index.rst similarity index 100% rename from doc/devguide/extending/output/index.rst rename to doc/userguide/devguide/extending/output/index.rst diff --git a/doc/devguide/index.rst b/doc/userguide/devguide/index.rst similarity index 91% rename from doc/devguide/index.rst rename to doc/userguide/devguide/index.rst index 48007de2c3c7..b6b5fbc1c7d3 100644 --- a/doc/devguide/index.rst +++ b/doc/userguide/devguide/index.rst @@ -2,7 +2,6 @@ Suricata Developer Guide ======================== .. toctree:: - :numbered: :maxdepth: 2 codebase/index.rst diff --git a/doc/devguide/internals/datastructs/index.rst b/doc/userguide/devguide/internals/datastructs/index.rst similarity index 100% rename from doc/devguide/internals/datastructs/index.rst rename to doc/userguide/devguide/internals/datastructs/index.rst diff --git a/doc/devguide/internals/engines/index.rst b/doc/userguide/devguide/internals/engines/index.rst similarity index 100% rename from doc/devguide/internals/engines/index.rst rename to doc/userguide/devguide/internals/engines/index.rst diff --git a/doc/devguide/internals/index.rst b/doc/userguide/devguide/internals/index.rst similarity index 100% rename from doc/devguide/internals/index.rst rename to doc/userguide/devguide/internals/index.rst diff --git a/doc/devguide/internals/pipeline/index.rst b/doc/userguide/devguide/internals/pipeline/index.rst similarity index 100% rename from doc/devguide/internals/pipeline/index.rst rename to doc/userguide/devguide/internals/pipeline/index.rst diff --git a/doc/devguide/internals/threading/index.rst b/doc/userguide/devguide/internals/threading/index.rst similarity index 100% rename from doc/devguide/internals/threading/index.rst rename to doc/userguide/devguide/internals/threading/index.rst diff --git a/doc/devguide/tools/generate-images.sh b/doc/userguide/devguide/tools/generate-images.sh similarity index 80% rename from doc/devguide/tools/generate-images.sh rename to doc/userguide/devguide/tools/generate-images.sh index 52d83e19f1e3..5db3f953cfde 100755 --- a/doc/devguide/tools/generate-images.sh +++ b/doc/userguide/devguide/tools/generate-images.sh @@ -3,9 +3,12 @@ # Script to generate Sequence Diagram images with mscgen # +parent_path=$(cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P) + set -e -cd extending/app-layer/diagrams +cd "$parent_path" +cd ../extending/app-layer/diagrams for FILE in *.msc ; do # call mscgen and convert each file in images dir diff --git a/doc/userguide/index.rst b/doc/userguide/index.rst index 5e4821988d13..0f1a069cd3a4 100644 --- a/doc/userguide/index.rst +++ b/doc/userguide/index.rst @@ -29,3 +29,4 @@ Suricata User Guide manpages/index.rst acknowledgements licenses/index.rst + devguide/index.rst