docs: simplify conf.py and fix compatibility with upcoming Sphinx 6.0

Change-Id: Ia69db4e8d6bef7f779bd3556be6afe534df8ad31
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index 3172c21..f96bf6a 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -12,7 +12,7 @@
 
 - doxygen
 - graphviz
-- sphinx >= 1.3
+- sphinx >= 4.0
 - sphinxcontrib-doxylink
 
 Build
diff --git a/docs/_static/.gitignore b/docs/_static/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/docs/_static/.gitignore
+++ /dev/null
diff --git a/docs/_static/nfd-status.xsd b/docs/_static/nfd-status.xsd
deleted file mode 100644
index 844b4f9..0000000
--- a/docs/_static/nfd-status.xsd
+++ /dev/null
@@ -1,169 +0,0 @@
-<?xml version="1.0"?>
-
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-targetNamespace="ndn:/localhost/nfd/status/1" xmlns:nfd="ndn:/localhost/nfd/status/1"
-elementFormDefault="qualified">
-
-<xs:complexType name="unidirectionalPacketCountersType">
-  <xs:sequence>
-    <xs:element type="xs:nonNegativeInteger" name="nInterests"/>
-    <xs:element type="xs:nonNegativeInteger" name="nDatas"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="bidirectionalPacketCountersType">
-  <xs:sequence>
-    <xs:element type="nfd:unidirectionalPacketCountersType" name="incomingPackets"/>
-    <xs:element type="nfd:unidirectionalPacketCountersType" name="outgoingPackets"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="bidirectionalByteCountersType">
-  <xs:sequence>
-    <xs:element type="xs:nonNegativeInteger" name="incomingBytes"/>
-    <xs:element type="xs:nonNegativeInteger" name="outgoingBytes"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="generalStatusType">
-  <xs:sequence>
-    <xs:element type="xs:anyURI" name="nfdId"/>
-    <xs:element type="xs:string" name="version"/>
-    <xs:element type="xs:dateTime" name="startTime"/>
-    <xs:element type="xs:dateTime" name="currentTime"/>
-    <xs:element type="xs:duration" name="uptime"/>
-    <xs:element type="xs:nonNegativeInteger" name="nNameTreeEntries"/>
-    <xs:element type="xs:nonNegativeInteger" name="nFibEntries"/>
-    <xs:element type="xs:nonNegativeInteger" name="nPitEntries"/>
-    <xs:element type="xs:nonNegativeInteger" name="nMeasurementsEntries"/>
-    <xs:element type="xs:nonNegativeInteger" name="nCsEntries"/>
-    <xs:element type="nfd:bidirectionalPacketCountersType" name="packetCounters"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="channelType">
-  <xs:sequence>
-    <xs:element type="xs:anyURI" name="localUri"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="channelsType">
-  <xs:sequence>
-    <xs:element type="nfd:channelType" name="channel" maxOccurs="unbounded" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="faceFlagsType">
-  <xs:sequence>
-    <xs:element type="xs:string" name="local" minOccurs="0"/>
-    <xs:element type="xs:string" name="on-demand" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="faceType">
-  <xs:sequence>
-    <xs:element type="xs:nonNegativeInteger" name="faceId"/>
-    <xs:element type="xs:anyURI" name="remoteUri"/>
-    <xs:element type="xs:anyURI" name="localUri"/>
-    <xs:element type="xs:duration" name="expirationPeriod" minOccurs="0"/>
-    <xs:element type="nfd:bidirectionalPacketCountersType" name="packetCounters"/>
-    <xs:element type="nfd:bidirectionalByteCountersType" name="byteCounters"/>
-    <xs:element type="nfd:faceFlagsType" name="flags" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="facesType">
-  <xs:sequence>
-    <xs:element type="nfd:faceType" name="face" maxOccurs="unbounded" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="nextHopType">
-  <xs:sequence>
-    <xs:element type="xs:nonNegativeInteger" name="faceId"/>
-    <xs:element type="xs:nonNegativeInteger" name="cost"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="fibEntryType">
-  <xs:sequence>
-    <xs:element type="xs:anyURI" name="prefix"/>
-    <xs:element name="nextHops">
-      <xs:complexType>
-        <xs:sequence>
-          <xs:element type="nfd:nextHopType" name="nextHop" maxOccurs="unbounded"/>
-        </xs:sequence>
-      </xs:complexType>
-    </xs:element>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="fibType">
-  <xs:sequence>
-    <xs:element type="nfd:fibEntryType" name="fibEntry" maxOccurs="unbounded" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="routeType">
-  <xs:sequence>
-    <xs:element type="xs:nonNegativeInteger" name="faceId"/>
-    <xs:element type="xs:nonNegativeInteger" name="origin"/>
-    <xs:element type="xs:nonNegativeInteger" name="cost"/>
-    <xs:element type="xs:nonNegativeInteger" name="flags"/>
-    <xs:element type="xs:duration" name="expirationPeriod" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="ribEntryType">
-  <xs:sequence>
-    <xs:element type="xs:anyURI" name="prefix"/>
-    <xs:element name="routes">
-      <xs:complexType>
-        <xs:sequence>
-          <xs:element type="nfd:routeType" name="route" maxOccurs="unbounded"/>
-        </xs:sequence>
-      </xs:complexType>
-    </xs:element>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="ribType">
-  <xs:sequence>
-    <xs:element type="nfd:ribEntryType" name="ribEntry" maxOccurs="unbounded" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="strategyType">
-  <xs:sequence>
-    <xs:element type="xs:anyURI" name="name"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="strategyChoiceType">
-  <xs:sequence>
-    <xs:element type="xs:anyURI" name="namespace"/>
-    <xs:element type="nfd:strategyType" name="strategy"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:complexType name="strategyChoicesType">
-  <xs:sequence>
-    <xs:element type="nfd:strategyChoiceType" name="strategyChoice"
-                maxOccurs="unbounded" minOccurs="0"/>
-  </xs:sequence>
-</xs:complexType>
-
-<xs:element name="nfdStatus">
-  <xs:complexType>
-    <xs:sequence>
-      <xs:element type="nfd:generalStatusType" name="generalStatus"/>
-      <xs:element type="nfd:channelsType" name="channels"/>
-      <xs:element type="nfd:facesType" name="faces"/>
-      <xs:element type="nfd:fibType" name="fib"/>
-      <xs:element type="nfd:ribType" name="rib"/>
-      <xs:element type="nfd:strategyChoicesType" name="strategyChoices"/>
-    </xs:sequence>
-  </xs:complexType>
-</xs:element>
-
-</xs:schema>
diff --git a/docs/conf.py b/docs/conf.py
index b38059e..5f1dea9 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,25 +1,17 @@
 # Configuration file for the Sphinx documentation builder.
 #
-# This file only contains a selection of the most common options. For a full
-# list see the documentation:
+# For the full list of built-in configuration values, see the documentation:
 # https://www.sphinx-doc.org/en/master/usage/configuration.html
 
-# -- Path setup --------------------------------------------------------------
-
-# 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.
-#
-# import os
+import importlib.util
 import sys
-# sys.path.insert(0, os.path.abspath('.'))
-
 
 # -- Project information -----------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
 
-project = u'NDNS: Domain Name Service for Named Data Networking'
-copyright = u'Copyright © 2014-2022 Named Data Networking Project.'
-author = u'Named Data Networking Project'
+project = 'NDNS: Domain Name Service for Named Data Networking'
+copyright = 'Copyright © 2014-2022 Named Data Networking Project.'
+author = 'Named Data Networking Project'
 
 # The short X.Y version.
 #version = ''
@@ -35,49 +27,31 @@
 
 
 # -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
 
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-needs_sphinx = '1.3'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
+needs_sphinx = '4.0'
 extensions = [
     'sphinx.ext.extlinks',
     'sphinx.ext.todo',
 ]
 
 def addExtensionIfExists(extension):
-    try:
-        __import__(extension)
+    if importlib.util.find_spec(extension) is not None:
         extensions.append(extension)
-    except ImportError:
-        sys.stderr.write("Extension '%s' not found. "
-                         "Some documentation may not build correctly.\n" % extension)
+    else:
+        sys.stderr.write(f'WARNING: Extension {extension!r} not found. '
+                          'Some documentation may not build correctly.\n')
 
 addExtensionIfExists('sphinxcontrib.doxylink')
 
-# The master toctree document.
-master_doc = 'index'
-
-# Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This pattern also affects html_static_path and html_extra_path.
-exclude_patterns = []
+exclude_patterns = ['Thumbs.db', '.DS_Store']
 
 
 # -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
 
-# The theme to use for HTML and HTML Help pages.  See the documentation for
-# a list of builtin themes.
-#
 html_theme = 'named_data_theme'
-
-# Add any paths that contain custom themes here, relative to this directory.
 html_theme_path = ['.']
 
 # Add any paths that contain custom static files (such as style sheets) here,
@@ -92,53 +66,22 @@
 highlight_language = 'none'
 
 
-# -- 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 = [
-    ('index', 'ndns-docs.tex', u'NDNS: Domain Name Service for Named Data Networking',
-     author, 'manual'),
-]
-
-
 # -- Options for manual page output ------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-manual-page-output
 
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('manpages/ndns-daemon', 'ndns-daemon', u'Domain Name Service Daemon for Named Data Networking', None, 1),
+    ('manpages/ndns-daemon', 'ndns-daemon', 'Domain Name Service Daemon for Named Data Networking', None, 1),
 ]
 
-# If true, show URL addresses after external links.
-#man_show_urls = True
 
-
-# -- Custom options ----------------------------------------------------------
+# -- Misc options ------------------------------------------------------------
 
 doxylink = {
     'NDNS': ('NDNS.tag', 'doxygen/'),
 }
 
 extlinks = {
-    'issue': ('https://redmine.named-data.net/issues/%s', 'issue #'),
+    'issue': ('https://redmine.named-data.net/issues/%s', 'issue #%s'),
 }
diff --git a/docs/index.rst b/docs/index.rst
index 4bfa906..559b338 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -29,7 +29,7 @@
 Downloading
 -----------
 
-* `Source code git repository <https://github.com/named-data/NDNS>`_
+* `Source code git repository <https://github.com/named-data/ndns>`_
 
 License
 -------
@@ -37,4 +37,4 @@
 NDNS is an open and free software package licensed under GPL 3.0 license and is the
 centerpiece of our committement to making NDN's core technology open and free to all
 Internet users and developers. For more information about the licensing details and
-limitation, refer to `COPYING.md <https://github.com/named-data/NDNS/blob/master/COPYING.md>`_.
+limitation, refer to `COPYING.md <https://github.com/named-data/ndns/blob/master/COPYING.md>`_.
diff --git a/docs/named_data_theme/named_data_header.html b/docs/named_data_theme/named_data_header.html
index 97b2932..8d6378d 100644
--- a/docs/named_data_theme/named_data_header.html
+++ b/docs/named_data_theme/named_data_header.html
@@ -26,7 +26,7 @@
     <div class="row">
          <div class="three columns">
               <div id="logo">
-                    <a href="http://named-data.net" title="A Future Internet Architecture"><img src="http://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
+                    <a href="https://named-data.net" title="A Future Internet Architecture"><img src="https://named-data.net/wp-content/uploads/cropped-20130722_Logo2.png" alt="" /></a>
               </div><!--logo end-->
          </div>
 
diff --git a/src/daemon/name-server.cpp b/src/daemon/name-server.cpp
index 4e40b17..1c40759 100644
--- a/src/daemon/name-server.cpp
+++ b/src/daemon/name-server.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -19,6 +19,7 @@
 
 #include "name-server.hpp"
 #include "logger.hpp"
+
 #include <ndn-cxx/encoding/encoding-buffer.hpp>
 #include <ndn-cxx/security/signing-helpers.hpp>
 
@@ -27,7 +28,7 @@
 
 NDNS_LOG_INIT(NameServer);
 
-const time::milliseconds NAME_SERVER_DEFAULT_CONTENT_FRESHNESS(4000);
+constexpr time::milliseconds NAME_SERVER_DEFAULT_CONTENT_FRESHNESS{4000};
 
 NameServer::NameServer(const Name& zoneName, const Name& certName, Face& face, DbMgr& dbMgr,
                        KeyChain& keyChain, security::Validator& validator)
diff --git a/src/ndns-label.hpp b/src/ndns-label.hpp
index 076d06c..cf8da97 100644
--- a/src/ndns-label.hpp
+++ b/src/ndns-label.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDNS (Named Data Networking Domain Name Service).
  * See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -25,59 +25,48 @@
 #include <ndn-cxx/name.hpp>
 #include <ndn-cxx/interest.hpp>
 
-#include <string>
-
-namespace ndn {
-namespace ndns {
-namespace label {
-
+namespace ndn::ndns::label {
 
 /**
  * @brief NDNS iterative query type
  */
-
-const name::Component NDNS_ITERATIVE_QUERY("NDNS");
+inline const name::Component NDNS_ITERATIVE_QUERY{"NDNS"};
 
 /**
  * @brief NDNS recursive query type
  */
 // it is not supported now
-// const name::Component NDNS_RECURSIVE_QUERY("NDNS-R");
-
-/////////////////////////////////////////////
+// inline const name::Component NDNS_RECURSIVE_QUERY{"NDNS-R"};
 
 /**
- * @brief label of update message, located at the last component in Interest name
+ * @brief Label of update message, located at the last component in Interest name
  */
-const name::Component NDNS_UPDATE_LABEL("UPDATE");
-
-
-//////////////////////////////////////////////
+inline const name::Component NDNS_UPDATE_LABEL{"UPDATE"};
 
 /**
  * @brief NS resource record type
  */
-const name::Component NS_RR_TYPE("NS");
+inline const name::Component NS_RR_TYPE{"NS"};
 
 /**
- * @brief ndns related certificate resource record type
+ * @brief NDNS related certificate resource record type
  */
-const name::Component CERT_RR_TYPE("CERT");
+inline const name::Component CERT_RR_TYPE{"CERT"};
 
 /**
- * @brief application stored certificate resource record type
+ * @brief Application stored certificate resource record type
  */
-const name::Component APPCERT_RR_TYPE("APPCERT");
+inline const name::Component APPCERT_RR_TYPE{"APPCERT"};
 
 /**
  * @brief TXT resource record type
  */
-const name::Component TXT_RR_TYPE("TXT");
+inline const name::Component TXT_RR_TYPE{"TXT"};
 
 /**
  * @brief Denial of Existance record type
  */
-const name::Component DOE_RR_TYPE("DOE");
+inline const name::Component DOE_RR_TYPE{"DOE"};
 
 //////////////////////////////////////////
 
@@ -119,8 +108,6 @@
           const Name& zone,
           MatchResult& result);
 
-} // namespace label
-} // namespace ndns
-} // namespace ndn
+} // namespace ndn::ndns::label
 
 #endif // NDNS_NDNS_LABEL_HPP