Ver código fonte

add documentation generation with sphinx

Julius Pfrommer 9 anos atrás
pai
commit
c2f87ed825
9 arquivos alterados com 690 adições e 63 exclusões
  1. 2 0
      .travis.yml
  2. 13 9
      CMakeLists.txt
  3. 11 0
      cmake/FindSphinx.cmake
  4. 3 3
      doc/Doxyfile.in
  5. 288 0
      doc/conf.py
  6. 219 0
      doc/datatypes.rst
  7. 137 0
      doc/index.rst
  8. 0 0
      doc/style/doxygen.css
  9. 17 51
      include/ua_types.h

+ 2 - 0
.travis.yml

@@ -26,6 +26,8 @@ before_install:
 - sudo dpkg -i liburcu2_0.8.5-1ubuntu1_amd64.deb
 - sudo dpkg -i liburcu-dev_0.8.5-1ubuntu1_amd64.deb
 - sudo pip install cpp-coveralls
+- sudo pip install sphinx
+- sudo pip install breathe
 script:
 - echo "Checking the applicability of patches"
 - # ./tools/.checkPorts.sh

+ 13 - 9
CMakeLists.txt

@@ -330,15 +330,19 @@ if(BUILD_UNIT_TESTS)
 endif()
 
 # build documentation
-option(BUILD_DOCUMENTATION "Generate doxygen documentation" OFF)
+option(BUILD_DOCUMENTATION "Generate doxygen/sphinx documentation" OFF)
 if(BUILD_DOCUMENTATION)
-    find_package(Doxygen)
-        if(NOT DOXYGEN_FOUND)
-            message(FATAL_ERROR "Doxygen is not installed or not properly configured")
-        endif(NOT DOXYGEN_FOUND)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
-    add_custom_target(doc
-                      ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
-                      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    find_package(Doxygen REQUIRED)
+    find_package(Sphinx REQUIRED)
+    configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY)
+    configure_file(${PROJECT_SOURCE_DIR}/doc/conf.py ${PROJECT_BINARY_DIR}/conf.py @ONLY)
+    add_custom_target(doxygen
+                      ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
+                      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
                       COMMENT "Generating API documentation with Doxygen")
+    add_custom_target(doc ${SPHINX_EXECUTABLE}
+      -b html -c "${PROJECT_BINARY_DIR}"
+      "${PROJECT_SOURCE_DIR}/doc" "${PROJECT_BINARY_DIR}/doc/sphinx"
+      DEPENDS doxygen
+      COMMENT "Building HTML documentation with Sphinx")
 endif()

+ 11 - 0
cmake/FindSphinx.cmake

@@ -0,0 +1,11 @@
+find_program(SPHINX_EXECUTABLE NAMES sphinx-build
+  HINTS
+  $ENV{SPHINX_DIR}
+  PATH_SUFFIXES bin
+  DOC "Sphinx documentation generator")
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(Sphinx DEFAULT_MSG SPHINX_EXECUTABLE)
+
+mark_as_advanced(SPHINX_EXECUTABLE)

+ 3 - 3
doc/Doxyfile.in

@@ -1799,7 +1799,7 @@ MAN_LINKS              = NO
 # captures the structure of the code including all documentation.
 # The default value is: NO.
 
-GENERATE_XML           = NO
+GENERATE_XML           = YES
 
 # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
 # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@@ -1911,7 +1911,7 @@ MACRO_EXPANSION        = YES
 # The default value is: NO.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-EXPAND_ONLY_PREDEF     = NO
+EXPAND_ONLY_PREDEF     = YES
 
 # If the SEARCH_INCLUDES tag is set to YES the includes files in the
 # INCLUDE_PATH will be searched if a #include is found.
@@ -1943,7 +1943,7 @@ INCLUDE_FILE_PATTERNS  =
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED             = 
+PREDEFINED             = UA_EXPORT= UA_BITFIELD=
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The

+ 288 - 0
doc/conf.py

@@ -0,0 +1,288 @@
+# -*- coding: utf-8 -*-
+#
+# open62541 documentation build configuration file, created by
+# sphinx-quickstart on Sat May 23 19:39:37 2015.
+#
+# 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
+
+# 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 = ['breathe']
+
+breathe_projects = { "open62541-breathe": "doc/xml/" }
+breathe_default_project = "open62541-breathe"
+breathe_domain_by_extension = {"h" : "c", "c" : "c"}
+
+# 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'open62541'
+copyright = u'2015, The open62541 authors'
+author = u'The open62541 authors'
+
+# 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.
+version = '0'
+# The full version, including alpha/beta/rc tags.
+release = '1'
+
+# 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 = []
+
+# 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.
+html_theme = 'sphinx_rtd_theme'
+
+# 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
+# "<project> v<release> 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 <link> 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 = 'open62541doc'
+
+# -- 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, 'open62541.tex', u'open62541 Documentation',
+   u'The open62541 authors', '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 manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    (master_doc, 'open62541', u'open62541 Documentation',
+     [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- 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, 'open62541', u'open62541 Documentation',
+   author, 'open62541', 'One line description of project.',
+   '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

+ 219 - 0
doc/datatypes.rst

@@ -0,0 +1,219 @@
+Data Types
+==========
+
+Generic Data Type Handling
+--------------------------
+
+All data types are combinations of the 25 builtin data types show below. Types
+are described in the UA_DataType structure.
+
+.. doxygenstruct:: UA_DataType
+   :members:
+
+.. c:var:: const UA_DataType UA_TYPES[UA_TYPES_COUNT]
+
+  The datatypes defined in the standard are stored in the ``UA_TYPES`` array.
+  A typical function call is ``UA_Array_new(&data_ptr, 20, &UA_TYPES[UA_TYPES_STRING])``.
+
+.. doxygenfunction:: UA_new
+.. doxygenfunction:: UA_init
+.. doxygenfunction:: UA_copy
+.. doxygenfunction:: UA_deleteMembers
+.. doxygenfunction:: UA_delete
+
+For all datatypes, there are also macros with syntactic sugar over calling the
+generic functions with a pointer into the ``UA_TYPES`` array.
+
+.. c:function:: <typename>_new()
+
+  Allocates the memory for the type and runs _init on the returned variable.
+  Returns null if no memory could be allocated.
+
+.. c:function:: <typename>_init(<typename> *value)
+
+  Sets all members of the type to a default value, usually zero. Arrays (e.g.
+  for strings) are set to a length of -1.
+
+.. c:function:: <typename>_copy(<typename> *src, <typename> *dst)
+
+  Copies a datatype. This performs a deep copy iterating over the members.
+  Copying into variants with an external data source is not permitted. If
+  copying fails, a deleteMembers is performed and an error code returned.
+
+.. c:function:: <typename>_deleteMembers(<typename> *value)
+
+   Frees the memory of dynamically sized members of a datatype (e.g. arrays).
+
+.. c:function:: <typename>_delete(<typename> *value)
+
+   Frees the memory of the datatype and its dynamically allocated members.
+
+Array Handling
+--------------
+   
+.. doxygenfunction:: UA_Array_new
+.. doxygenfunction:: UA_Array_copy
+.. doxygenfunction:: UA_Array_delete
+
+Builtin Data Types
+------------------
+
+Number-Types
+^^^^^^^^^^^^
+
+.. doxygentypedef:: UA_Boolean
+.. doxygentypedef:: UA_SByte
+.. doxygentypedef:: UA_Byte
+.. doxygentypedef:: UA_Int16
+.. doxygentypedef:: UA_UInt16
+.. doxygentypedef:: UA_Int32
+.. doxygentypedef:: UA_UInt32
+.. doxygentypedef:: UA_Int64
+.. doxygentypedef:: UA_UInt64
+.. doxygentypedef:: UA_Float
+.. doxygentypedef:: UA_Double
+
+UA_String
+^^^^^^^^^
+.. doxygenstruct:: UA_String
+  :members:
+
+.. c:macro:: UA_STRING_NULL
+
+  The empty string
+
+.. c:macro:: UA_STRING(CHARS)
+     
+  Creates an UA_String from an array of ``char``. The characters are not copied
+  on the heap. Instead, the string points into the existing array.
+
+.. c:macro:: UA_STRING_ALLOC(CHARS)
+     
+  Creates an UA_String from an array of ``char``. The characters are copied on
+  the heap.
+
+.. doxygenfunction:: UA_String_equal
+.. doxygenfunction:: UA_String_copyprintf
+
+UA_DateTime
+^^^^^^^^^^^
+.. doxygentypedef:: UA_DateTime
+.. doxygenfunction:: UA_DateTime_now(void)
+.. doxygenfunction:: UA_DateTime_toString
+.. doxygenfunction:: UA_DateTime_toStruct
+
+UA_Guid
+^^^^^^^
+.. doxygenstruct:: UA_Guid
+.. doxygenfunction:: UA_Guid_equal
+.. doxygenfunction:: UA_Guid_random
+   
+UA_ByteString
+^^^^^^^^^^^^^
+Bytestring are just a redefinition of strings. The semantic difference is that
+ByteStrings may hold non-UTF8 data.
+
+.. doxygentypedef:: UA_ByteString
+
+.. c:macro:: UA_BYTESTRING_NULL
+
+   The empty ByteString
+
+.. c:function:: UA_Boolean UA_ByteString_equal(const UA_ByteString *s1, const UA_ByteString *s2)
+
+   Compares two ByteStrings.
+   
+UA_XmlElement
+^^^^^^^^^^^^^
+XmlElements are just a redefinition of strings.
+
+.. doxygentypedef:: UA_XmlElement
+
+UA_NodeId
+^^^^^^^^^
+.. doxygenstruct:: UA_NodeId
+  :members:
+
+.. doxygenfunction:: UA_NodeId_equal
+.. doxygenfunction:: UA_NodeId_isNull
+
+.. c:macro:: UA_NODEID_NULL
+
+  The null NodeId
+
+.. c:macro:: UA_NODEID_NUMERIC(NSID, NUMERICID)
+.. c:macro:: UA_NODEID_STRING(NSID, CHARS)
+.. c:macro:: UA_NODEID_STRING_ALLOC(NSID, CHARS)
+.. c:macro:: UA_NODEID_GUID(NSID, GUID)
+.. c:macro:: UA_NODEID_BYTESTRING(NSID, CHARS)
+.. c:macro:: UA_NODEID_BYTESTRING_ALLOC(NSID, CHARS)
+
+UA_ExpandedNodeId
+^^^^^^^^^^^^^^^^^
+.. doxygenstruct:: UA_ExpandedNodeId
+  :members:
+
+.. doxygenfunction:: UA_ExpandedNodeId_isNull
+.. c:macro:: UA_EXPANDEDNODEID_NUMERIC(NSID, NUMERICID)
+  
+UA_StatusCode
+^^^^^^^^^^^^^
+Many functions in open62541 return either ``UA_STATUSCODE_GOOD`` or an error code.
+
+.. doxygentypedef:: UA_StatusCode
+
+UA_QualifiedName
+^^^^^^^^^^^^^^^^   
+.. doxygenstruct:: UA_QualifiedName
+  :members:
+
+.. c:macro:: UA_QUALIFIEDNAME(NSID, CHARS)
+.. c:macro:: UA_QUALIFIEDNAME_ALLOC(NSID, CHARS)
+  
+UA_LocalizedText
+^^^^^^^^^^^^^^^^
+.. doxygenstruct:: UA_LocalizedText
+  :members:
+
+.. c:macro:: UA_LOCALIZEDTEXT(LOCALE, TEXT)
+   Takes two arrays of ``char`` as the input.
+
+.. c:macro:: UA_LOCALIZEDTEXT_ALLOC(LOCALE, TEXT)
+  
+UA_ExtensionObject
+^^^^^^^^^^^^^^^^^^
+
+.. doxygenstruct:: UA_ExtensionObject
+  :members:
+
+UA_DataValue
+^^^^^^^^^^^^
+
+.. doxygenstruct:: UA_DataValue
+  :members:
+  :undoc-members:
+
+UA_Variant
+^^^^^^^^^^
+
+.. doxygenstruct:: UA_Variant
+  :members:
+
+.. doxygenfunction:: UA_Variant_isScalar
+.. doxygenfunction:: UA_Variant_setScalar
+.. doxygenfunction:: UA_Variant_setScalarCopy
+.. doxygenfunction:: UA_Variant_setArray
+.. doxygenfunction:: UA_Variant_setArrayCopy
+
+.. doxygenstruct:: UA_NumericRange
+   :undoc-members:
+
+.. doxygenfunction:: UA_Variant_setRange
+.. doxygenfunction:: UA_Variant_setRangeCopy
+        
+UA_DiagnosticInfo
+^^^^^^^^^^^^^^^^^
+
+.. doxygenstruct:: UA_DiagnosticInfo
+  :members:
+  :undoc-members:

+ 137 - 0
doc/index.rst

@@ -0,0 +1,137 @@
+Welcome to open62541's documentation!
+=====================================
+
+.. toctree::
+   :maxdepth: 2
+   :hidden:
+
+   datatypes
+
+`OPC UA <http://en.wikipedia.org/wiki/OPC_Unified_Architecture>`_ (short for OPC
+Unified Architecture) is a protocol for industrial communication and has been
+standardized in the IEC62541. At its core, OPC UA defines a set of services to
+interact with a server-side object-oriented information model. Besides the
+service-calls initiated by the client, push-notification of remote events (such
+as data changes) can be negotiated with the server. The client/server
+interaction is mapped either to a binary encoding and TCP-based transmission or
+to SOAP-based webservices. As of late, OPC UA is marketed as the one standard
+for non-realtime industrial communication.
+
+We believe that it is best to understand OPC UA *from the inside out*, building
+upon conceptually simple first principles. After establishing a first
+understanding, we go on explaining how these principles are realized in detail.
+Examples are given based on the *open62541* implementation of the
+standard.
+
+OPC UA, a collection of services
+--------------------------------
+
+In OPC-UA, all communication is based on service calls, each consisting of a request and a response
+message. Be careful to note the difference between services and methods. Services are pre-defined in
+the standard and cannot be changed. But you can use the *Call* service to invoke user-defined
+methods on the server.
+
+For completeness, the following tables contain all services defined in the standard. Do not bother
+with their details yet. We will introduce the different services later in the text. In open62541,
+each service is implemented in a single function. See the \ref services section for details.
+
+**Establishing communication**
+
++-----------------------------+-----------------------------+------------------------------+
+| Discovery Service Set       | SecureChannel Service Set   | Session Service Set          |
++=============================+=============================+==============================+
+| FindServers                 | OpenSecureChannel           | CreateSession                |
++-----------------------------+-----------------------------+------------------------------+
+| GetEndpoints                | CloseSecureChannel          | ActivateSession              |
++-----------------------------+-----------------------------+------------------------------+
+| RegisterServer              | CloseSession                |                              |
++-----------------------------+-----------------------------+------------------------------+
+| Cancel                      |                             |                              |
++-----------------------------+-----------------------------+------------------------------+
+
+**Interaction with the information model**
+
++-----------------------------+-------------------------------+------------------------------+------------------------------+----------------------+
+| Attribute Service Set       | View Service Set              | Method Service Set           | NodeManagement Service Set   | Query Service Set    |
++=============================+===============================+==============================+==============================+======================+
+| Read                        | Browse                        | Call                         | AddNodes                     | QueryFirst           |
++-----------------------------+-------------------------------+------------------------------+------------------------------+----------------------+
+| HistoryRead                 | BrowseNext                    |                              | AddReferences                | QueryNext            |
++-----------------------------+-------------------------------+------------------------------+------------------------------+----------------------+
+| Write                       | TranslateBrowsePathsToNodeids |                              | DeleteNodes                  |                      |
++-----------------------------+-------------------------------+------------------------------+------------------------------+----------------------+
+| HistoryUpdate               | RegisterNodes                 |                              | DeleteReferences             |                      |
++-----------------------------+-------------------------------+------------------------------+------------------------------+----------------------+
+|                             | UnregisterNodes               |                              |                              |                      |
++-----------------------------+-------------------------------+------------------------------+------------------------------+----------------------+
+
+**Notifications**
+
++-----------------------------+-------------------------------+
+| MonitoredItem Service Set   | Subscription Service Set      |
++=============================+===============================+
+| CreateMonitoredItems        | CreateSubscription            |
++-----------------------------+-------------------------------+
+| ModifyMonitoreditems        | ModifySubscription            |
++-----------------------------+-------------------------------+
+| SetMonitoringMode           | SetPublishingMode             |
++-----------------------------+-------------------------------+
+| SetTriggering               | Publish                       |
++-----------------------------+-------------------------------+
+| DeleteMonitoredItems        | Republish                     |
++-----------------------------+-------------------------------+
+|                             | TransferSubscription          |
++-----------------------------+-------------------------------+
+|                             | DeleteSubscription            |
++-----------------------------+-------------------------------+
+
+OPC UA, a web of nodes
+----------------------
+
+The information model in each OPC UA server is a web of interconnected nodes.
+There are eight different types of nodes. Depending on its type, every node
+contains different attributes. Some attributes, such as the *NodeId* (unique
+identifier) and the *BrowseName*, are contained in all node types.
+
++-----------------------+-------------------+
+| ReferenceTypeNode     | MethodNode        |
++-----------------------+-------------------+
+| DataTypeNode          | ObjectTypeNode    |
++-----------------------+-------------------+
+| VariableTypeNode      | ObjectNode        |
++-----------------------+-------------------+
+| VariableNode          | ViewNode          |
++-----------------------+-------------------+
+                                                                                                            
+Nodes are interconnected by directed reference-triples of the form ``(nodeid,
+referencetype, target-nodeid)``. Therefore an OPC UA information model is
+easiest imagined as a *web of nodes*. Reference types can be
+
+- standard- or user-defined and
+- either non-hierarchical (e.g., indicating the type of a variable-node) or
+  hierarchical (e.g., indicating a parent-child relationship).
+
+OPC UA, a protocol
+------------------
+
+The OPC UA protocol (both binary and XML-based) is based on 25 *built-in*
+datatypes. In open62541, these are defined in ua_types.h.
+
+The builtin datatypes are combined to more complex structures. When the structure contains an array,
+then the size of the array is stored in an Int32 value just before the array itself. A size of -1
+indicates an undefined array. Positive sizes (and zero) have the usual semantics.
+
+Most importantly, every service has a request and a response message defined as such a data
+structure. The entire OPC UA protocol revolves around the exchange of these request and response
+messages. Their exact definitions can be looked up here:
+https://opcfoundation.org/UA/schemas/Opc.Ua.Types.bsd.xml. In open62541, we autogenerate the
+C-structs to handle the standard-defined structures automatically. See ua_types_generated.h for
+comparison.
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

+ 0 - 0
doc/style/doxygen.css


+ 17 - 51
include/ua_types.h

@@ -25,39 +25,6 @@ extern "C" {
 #include <stddef.h>
 #include "ua_config.h"
 
-/**
- * @defgroup types Datatypes
- *
- * @brief The built-in datatypes. The remaining datatypes are autogenerated from
- * XML descriptions as they are all enums or structures made up of the built-in
- * datatypes.
- *
- * All datatypes have similar functions with a common postfix. DO NOT CALL THESE
- * FUNCTIONS WITH NULL-POINTERS IF IT IS NOT EXPLICITLY PERMITTED.
- *
- * - _new: Allocates the memory for the type and runs _init on the returned
- *   variable. Returns null if no memory could be allocated.
- *
- * - _init: Sets all members to a "safe" standard, usually zero. Arrays (e.g.
- *   for strings) are set to a length of -1.
- *
- * - _copy: Copies a datatype. This performs a deep copy that iterates over the
- *    members. Copying into variants with an external data source is not
- *    permitted. If copying fails, a deleteMembers is performed and an error
- *    code returned.
- *
- * - _delete: Frees the memory where the datatype was stored. This performs an
- *   _deleteMembers internally if required.
- *
- * - _deleteMembers: Frees the memory of dynamically sized members (e.g. a
- *   string) of a datatype. This is useful when the datatype was allocated on
- *   the stack, whereas the dynamically sized members is heap-allocated. To
- *   reuse the variable, the remaining members (not dynamically allocated) need
- *   to be cleaned up with an _init.
- *
- * @{
- */
-
 /** @brief A two-state logical value (true or false). */
 typedef bool UA_Boolean;
 #define UA_TRUE true
@@ -372,27 +339,27 @@ UA_NodeId UA_EXPORT UA_NodeId_fromCharByteStringCopy(UA_UInt16 nsIndex, char con
 UA_NodeId UA_EXPORT UA_NodeId_fromByteString(UA_UInt16 nsIndex, UA_ByteString identifier);
 UA_NodeId UA_EXPORT UA_NodeId_fromByteStringCopy(UA_UInt16 nsIndex, UA_ByteString identifier);
 
-#define UA_NODEID_NUMERIC(NS_INDEX, NUMERICID) UA_NodeId_fromInteger(NS_INDEX, NUMERICID)
-#define UA_NODEID_STRING(NS_INDEX, CHARS) UA_NodeId_fromCharString(NS_INDEX, CHARS)
-#define UA_NODEID_STRING_ALLOC(NS_INDEX, CHARS) UA_NodeId_fromCharStringCopy(NS_INDEX, CHARS)
-#define UA_NODEID_GUID(NS_INDEX, GUID) UA_NodeId_fromGuid(NS_INDEX, GUID)
-#define UA_NODEID_BYTESTRING(NS_INDEX, CHARS) UA_NodeId_fromCharByteString(NS_INDEX, CHARS)
-#define UA_NODEID_BYTESTRING_ALLOC(NS_INDEX, CHARS) UA_NodeId_fromCharStringCopy(NS_INDEX, CHARS)
+#define UA_NODEID_NUMERIC(NSID, NUMERICID) UA_NodeId_fromInteger(NSID, NUMERICID)
+#define UA_NODEID_STRING(NSID, CHARS) UA_NodeId_fromCharString(NSID, CHARS)
+#define UA_NODEID_STRING_ALLOC(NSID, CHARS) UA_NodeId_fromCharStringCopy(NSID, CHARS)
+#define UA_NODEID_GUID(NSID, GUID) UA_NodeId_fromGuid(NSID, GUID)
+#define UA_NODEID_BYTESTRING(NSID, CHARS) UA_NodeId_fromCharByteString(NSID, CHARS)
+#define UA_NODEID_BYTESTRING_ALLOC(NSID, CHARS) UA_NodeId_fromCharStringCopy(NSID, CHARS)
 #define UA_NODEID_NULL UA_NODEID_NUMERIC(0,0)
 
 /* ExpandedNodeId */
 UA_Boolean UA_EXPORT UA_ExpandedNodeId_isNull(const UA_ExpandedNodeId *p);
 
-#define UA_EXPANDEDNODEID_NUMERIC(NS_INDEX, NUMERICID) (UA_ExpandedNodeId) {            \
-        .nodeId = {.namespaceIndex = NS_INDEX, .identifierType = UA_NODEIDTYPE_NUMERIC, \
+#define UA_EXPANDEDNODEID_NUMERIC(NSID, NUMERICID) (UA_ExpandedNodeId) {            \
+        .nodeId = {.namespaceIndex = NSID, .identifierType = UA_NODEIDTYPE_NUMERIC, \
                    .identifier.numeric = NUMERICID },                                   \
         .serverIndex = 0, .namespaceUri = {.data = (UA_Byte*)0, .length = -1} }
     
 /* QualifiedName */
-#define UA_QUALIFIEDNAME(NS_INDEX, CHARS) (const UA_QualifiedName) {    \
-        .namespaceIndex = NS_INDEX, .name = UA_STRING(CHARS) }
-#define UA_QUALIFIEDNAME_ALLOC(NS_INDEX, CHARS) (UA_QualifiedName) {    \
-        .namespaceIndex = NS_INDEX, .name = UA_STRING_ALLOC(CHARS) }
+#define UA_QUALIFIEDNAME(NSID, CHARS) (const UA_QualifiedName) {    \
+        .namespaceIndex = NSID, .name = UA_STRING(CHARS) }
+#define UA_QUALIFIEDNAME_ALLOC(NSID, CHARS) (UA_QualifiedName) {    \
+        .namespaceIndex = NSID, .name = UA_STRING_ALLOC(CHARS) }
 
 /* LocalizedText */
 #define UA_LOCALIZEDTEXT(LOCALE, TEXT) (const UA_LocalizedText) {       \
@@ -457,10 +424,11 @@ UA_StatusCode UA_EXPORT UA_Variant_setArray(UA_Variant *v, void *array, UA_Int32
 UA_StatusCode UA_EXPORT UA_Variant_setArrayCopy(UA_Variant *v, const void *array, UA_Int32 noElements,
                                                 const UA_DataType *type);
 
-/** @brief NumericRanges are used select a subset in a (multidimensional) variant array.
-    NumericRange has no official type structure in the standard. Officially, it only exists as an
-    encoded string, such as "1:2,0:3,5". The colon separates min/max index and the comma separates
-    dimensions. A single value indicates a range with a single element (min==max). */
+/** @brief NumericRanges are used select a subset in a (multidimensional)
+    variant array. NumericRange has no official type structure in the standard.
+    On the wire, it only exists as an encoded string, such as "1:2,0:3,5". The
+    colon separates min/max index and the comma separates dimensions. A single
+    value indicates a range with a single element (min==max). */
 typedef struct {
     UA_Int32 dimensionsSize;
     struct UA_NumericRangeDimension {
@@ -620,8 +588,6 @@ UA_StatusCode UA_EXPORT UA_Array_copy(const void *src, void **dst, const UA_Data
  */
 void UA_EXPORT UA_Array_delete(void *p, const UA_DataType *dataType, UA_Int32 noElements);
 
-/** @} */
-
 /* These are not generated from XML. Server *and* client need them. */
 typedef enum {
     UA_ATTRIBUTEID_NODEID                  = 1,