include snippets from main doc

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
This commit is contained in:
Nikos Mavrogiannopoulos 2018-01-31 15:25:49 +01:00
parent 7814dcfd84
commit 2efc8b3b21
10 changed files with 74 additions and 74 deletions

View file

@ -56,7 +56,7 @@ The cast silences a compiler warning;
[subs="quotes"]
----
$ include "snippets/C-Pointers-remaining.xml"
include::snippets/C-Pointers-remaining.adoc[]
----
@ -86,7 +86,7 @@ see <<ex-Defensive_Coding-C-Arithmetic-bad>>.
[subs="quotes"]
----
$ include "snippets/C-Arithmetic-add.xml"
include::snippets/C-Arithmetic-add.adoc[]
----
@ -112,7 +112,7 @@ additions have to be checked in this way.
====
----
$ include "snippets/C-Arithmetic-add_unsigned.xml"
include::snippets/C-Arithmetic-add_unsigned.adoc[]
----
@ -129,7 +129,7 @@ see <<ex-Defensive_Coding-C-Arithmetic-mult>>.
[subs="quotes"]
----
$ include "snippets/C-Arithmetic-mult.xml"
include::snippets/C-Arithmetic-mult.adoc[]
----
@ -189,7 +189,7 @@ after the `*`, and not before it.
====
----
$ include "snippets/C-Globals-String_Array.xml"
include::snippets/C-Globals-String_Array.adoc[]
----

View file

@ -126,7 +126,7 @@ size is allocated on the heap, consider use
[subs="quotes"]
----
$ include "snippets/C-String-Functions-snprintf.xml"
include::snippets/C-String-Functions-snprintf.adoc[]
----
@ -156,7 +156,7 @@ invariant. After the loop, the result string is in the
[subs="quotes"]
----
$ include "snippets/C-String-Functions-snprintf-incremental.xml"
include::snippets/C-String-Functions-snprintf-incremental.adoc[]
----
@ -191,7 +191,7 @@ function (see <<ex-Defensive_Coding-C-String-Functions-format-Attribute>>).
[subs="quotes"]
----
$ include "snippets/C-String-Functions-format.xml"
include::snippets/C-String-Functions-format.adoc[]
----
@ -206,7 +206,7 @@ ensuring NUL termination is:
[subs="quotes"]
----
$ include "snippets/C-String-Functions-strncpy.xml"
include::snippets/C-String-Functions-strncpy.adoc[]
----
@ -215,7 +215,7 @@ function for this purpose:
[subs="quotes"]
----
$ include "snippets/C-String-Functions-strncat-as-strncpy.xml"
include::snippets/C-String-Functions-strncat-as-strncpy.adoc[]
----
@ -238,7 +238,7 @@ approach similar to <<ex-Defensive_Coding-C-String-Functions-snprintf-incrementa
[subs="quotes"]
----
$ include "snippets/C-String-Functions-strncat-emulation.xml"
include::snippets/C-String-Functions-strncat-emulation.adoc[]
----
@ -248,7 +248,7 @@ string:
[subs="quotes"]
----
$ include "snippets/C-String-Functions-strncat-merged.xml"
include::snippets/C-String-Functions-strncat-merged.adoc[]
----

View file

@ -81,7 +81,7 @@ and its usage to sign data.
[subs="quotes"]
----
$ include "snippets/Features-HSM-OpenSSL.xml"
include::snippets/Features-HSM-OpenSSL.adoc[]
----
@ -105,7 +105,7 @@ and its usage to sign data.
[subs="quotes"]
----
$ include "snippets/Features-HSM-GNUTLS.xml"
include::snippets/Features-HSM-GNUTLS.adoc[]
----
@ -121,7 +121,7 @@ An example PIN callback function is shown below.
[subs="quotes"]
----
$ include "snippets/Features-HSM-GNUTLS-PIN.xml"
include::snippets/Features-HSM-GNUTLS-PIN.adoc[]
----
@ -148,7 +148,7 @@ The following example demonstrates a typical NSS application for signing.
[subs="quotes"]
----
$ include "snippets/Features-HSM-NSS.xml"
include::snippets/Features-HSM-NSS.adoc[]
----
@ -176,7 +176,7 @@ $ NSS_Sign_Example "${token_name}:${cert_name}"
[subs="quotes"]
----
$ include "snippets/Features-HSM-NSS-PIN.xml"
include::snippets/Features-HSM-NSS-PIN.adoc[]
----

View file

@ -62,7 +62,7 @@ duration of the handshake), or use the Linux-specific
[subs="quotes"]
----
$ include "snippets/Features-TLS-Nagle.xml"
include::snippets/Features-TLS-Nagle.adoc[]
----
@ -134,7 +134,7 @@ due to a connection teardown by the other end).
[subs="quotes"]
----
$ include "snippets/Features-TLS-OpenSSL-Errors.xml"
include::snippets/Features-TLS-OpenSSL-Errors.adoc[]
----
@ -311,7 +311,7 @@ The OpenSSL library needs explicit initialization (see <<ex-Defensive_Coding-TLS
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenSSL-Init.xml"
include::snippets/Features-TLS-Client-OpenSSL-Init.adoc[]
----
@ -334,7 +334,7 @@ be cumbersome.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenSSL-CTX.xml"
include::snippets/Features-TLS-Client-OpenSSL-CTX.adoc[]
----
@ -383,7 +383,7 @@ name.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenSSL-Connect.xml"
include::snippets/Features-TLS-Client-OpenSSL-Connect.adoc[]
----
@ -401,7 +401,7 @@ transport, using `BIO_set_ssl`.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenSSL-Connection-Use.xml"
include::snippets/Features-TLS-Client-OpenSSL-Connection-Use.adoc[]
----
@ -423,7 +423,7 @@ socket after the connection object has been freed.
[subs="quotes"]
----
$ include "snippets/Features-TLS-OpenSSL-Connection-Close.xml"
include::snippets/Features-TLS-OpenSSL-Connection-Close.adoc[]
----
@ -439,7 +439,7 @@ because no further TLS connections will be established.
[subs="quotes"]
----
$ include "snippets/Features-TLS-OpenSSL-Context-Close.xml"
include::snippets/Features-TLS-OpenSSL-Context-Close.adoc[]
----
@ -463,7 +463,7 @@ CAs (<<ex-Defensive_Coding-TLS-Client-GNUTLS-Credentials>>).
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-GNUTLS-Credentials.xml"
include::snippets/Features-TLS-Client-GNUTLS-Credentials.adoc[]
----
@ -474,7 +474,7 @@ object should be freed:
[subs="quotes"]
----
$ include "snippets/Features-TLS-GNUTLS-Credentials-Close.xml"
include::snippets/Features-TLS-GNUTLS-Credentials-Close.adoc[]
----
@ -495,7 +495,7 @@ This is shown in <<ex-Defensive_Coding-TLS-Client-GNUTLS-Connect>>.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-GNUTLS-Connect.xml"
include::snippets/Features-TLS-Client-GNUTLS-Connect.adoc[]
----
@ -515,7 +515,7 @@ can be omitted if the functionality is not needed.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-GNUTLS-Verify.xml"
include::snippets/Features-TLS-Client-GNUTLS-Verify.adoc[]
----
@ -530,7 +530,7 @@ receiving data, as in <<ex-Defensive_Coding-TLS-GNUTLS-Use>>.
[subs="quotes"]
----
$ include "snippets/Features-TLS-GNUTLS-Use.xml"
include::snippets/Features-TLS-GNUTLS-Use.adoc[]
----
@ -547,7 +547,7 @@ Finally, the session object can be deallocated using
[subs="quotes"]
----
$ include "snippets/Features-TLS-GNUTLS-Disconnect.xml"
include::snippets/Features-TLS-GNUTLS-Disconnect.adoc[]
----
@ -561,7 +561,7 @@ classes:
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenJDK-Import.xml"
include::snippets/Features-TLS-Client-OpenJDK-Import.adoc[]
----
@ -593,7 +593,7 @@ be supported as a fall-back option. This is shown in <<ex-Defensive_Coding-TLS-C
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenJDK-Context.xml"
include::snippets/Features-TLS-Client-OpenJDK-Context.adoc[]
----
@ -611,7 +611,7 @@ connections.
[subs="quotes"]
----
$ include "snippets/Features-TLS-OpenJDK-Parameters.xml"
include::snippets/Features-TLS-OpenJDK-Parameters.adoc[]
----
@ -623,7 +623,7 @@ separately, and this is only supported by OpenJDK 7 and later:
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenJDK-Hostname.xml"
include::snippets/Features-TLS-Client-OpenJDK-Hostname.adoc[]
----
@ -647,7 +647,7 @@ internal API on OpenJDK 6.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenJDK-Connect.xml"
include::snippets/Features-TLS-Client-OpenJDK-Connect.adoc[]
----
@ -669,7 +669,7 @@ The TLS socket can be used as a regular socket, as shown in
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenJDK-Use.xml"
include::snippets/Features-TLS-Client-OpenJDK-Use.adoc[]
----
@ -695,7 +695,7 @@ the server certificate is identified by its SHA-256 hash.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-OpenJDK-MyTrustManager.xml"
include::snippets/Features-TLS-Client-OpenJDK-MyTrustManager.adoc[]
----
@ -710,7 +710,7 @@ This trust manager has to be passed to the
====
----
$ include "snippets/Features-TLS-Client-OpenJDK-Context_For_Cert.xml"
include::snippets/Features-TLS-Client-OpenJDK-Context_For_Cert.adoc[]
----
@ -756,7 +756,7 @@ Using NSS needs several header files, as shown in
[subs="quotes"]
----
$ include "snippets/Features-TLS-NSS-Includes.xml"
include::snippets/Features-TLS-NSS-Includes.adoc[]
----
@ -783,7 +783,7 @@ load trusted CA certificates from a file.)
[subs="quotes"]
----
$ include "snippets/Features-TLS-NSS-Init.xml"
include::snippets/Features-TLS-NSS-Init.adoc[]
----
@ -794,7 +794,7 @@ the following function calls:
[subs="quotes"]
----
$ include "snippets/Features-TLS-NSS-Close.xml"
include::snippets/Features-TLS-NSS-Close.adoc[]
----
@ -831,7 +831,7 @@ certificate is verified and matched against the host name.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-NSS-Connect.xml"
include::snippets/Features-TLS-Client-NSS-Connect.adoc[]
----
@ -846,7 +846,7 @@ the NSPR descriptor to communicate with the server.
[subs="quotes"]
----
$ include "snippets/Features-TLS-NSS-Use.xml"
include::snippets/Features-TLS-NSS-Use.adoc[]
----
@ -861,7 +861,7 @@ shows how to close the connection.
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-NSS-Close.xml"
include::snippets/Features-TLS-Client-NSS-Close.adoc[]
----
@ -902,7 +902,7 @@ certificate returned by `getpeercert`.
====
----
$ include "snippets/Features-TLS-Client-Python-check_host_name.xml"
include::snippets/Features-TLS-Client-Python-check_host_name.adoc[]
----
@ -949,7 +949,7 @@ manually against the host name, by calling the
[subs="quotes"]
----
$ include "snippets/Features-TLS-Client-Python-Connect.xml"
include::snippets/Features-TLS-Client-Python-Connect.adoc[]
----
@ -960,7 +960,7 @@ be used like a regular socket:
[subs="quotes"]
----
$ include "snippets/Features-TLS-Python-Use.xml"
include::snippets/Features-TLS-Python-Use.adoc[]
----
@ -968,6 +968,6 @@ Closing the TLS socket is straightforward as well:
[subs="quotes"]
----
$ include "snippets/Features-TLS-Python-Close.xml"
include::snippets/Features-TLS-Python-Close.adoc[]
----

View file

@ -52,7 +52,7 @@ details.
====
----
$ include "snippets/Go-Error_Handling-Regular.xml"
include::snippets/Go-Error_Handling-Regular.adoc[]
----
@ -71,7 +71,7 @@ returning both data and an error at the same time.
====
----
$ include "snippets/Go-Error_Handling-IO.xml"
include::snippets/Go-Error_Handling-IO.adoc[]
----

View file

@ -31,7 +31,7 @@ data, implementing an exponential growth policy. See the
[subs="quotes"]
----
$ include "snippets/Java-Language-ReadArray.xml"
include::snippets/Java-Language-ReadArray.adoc[]
----
@ -62,7 +62,7 @@ possible and should not throw any exceptions.
[subs="quotes"]
----
$ include "snippets/Java-Finally.xml"
include::snippets/Java-Finally.adoc[]
----
@ -87,7 +87,7 @@ used instead. The Java compiler will automatically insert the
[subs="quotes"]
----
$ include "snippets/Java-TryWithResource.xml"
include::snippets/Java-TryWithResource.adoc[]
----

View file

@ -75,7 +75,7 @@ beginning of the array.
[subs="quotes"]
----
$ include "snippets/Java-JNI-Pointers.xml"
include::snippets/Java-JNI-Pointers.adoc[]
----

View file

@ -110,7 +110,7 @@ shows how to run a piece code of with reduced privileges.
[subs="quotes"]
----
$ include "snippets/Java-SecurityManager-Unprivileged.xml"
include::snippets/Java-SecurityManager-Unprivileged.adoc[]
----
@ -123,7 +123,7 @@ on all files in the current directory) can be used:
[subs="quotes"]
----
$ include "snippets/Java-SecurityManager-CurrentDirectory.xml"
include::snippets/Java-SecurityManager-CurrentDirectory.adoc[]
----
@ -208,7 +208,7 @@ shows how to request additional privileges.
[subs="quotes"]
----
$ include "snippets/Java-SecurityManager-Privileged.xml"
include::snippets/Java-SecurityManager-Privileged.adoc[]
----
@ -249,7 +249,7 @@ invocation out of the privileged code section, of course.)
[subs="quotes"]
----
$ include "snippets/Java-SecurityManager-Callback.xml"
include::snippets/Java-SecurityManager-Callback.adoc[]
----

View file

@ -347,7 +347,7 @@ POSIX shells.
====
----
$ include "snippets/Shell-Input_Validation.xml"
include::snippets/Shell-Input_Validation.adoc[]
----

View file

@ -217,9 +217,9 @@ in various places.
[subs="quotes"]
----
&lt;!ENTITY sys SYSTEM "http://www.example.com/ent.xml"&gt;
&lt;!ENTITY sys SYSTEM "http://www.example.com/ent.adoc[]&gt;
&lt;!ENTITY pub PUBLIC "-//Example//Public Entity//EN"
"http://www.example.com/pub-ent.xml"&gt;
"http://www.example.com/pub-ent.adoc[]&gt;
----
@ -228,7 +228,7 @@ in various places.
[subs="quotes"]
----
&lt;!NOTATION not SYSTEM "../not.xml"&gt;
&lt;!NOTATION not SYSTEM "../not.adoc[]&gt;
----
@ -308,7 +308,7 @@ problems related to that.
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-Expat-EntityDeclHandler.xml"
include::snippets/Tasks-Serialization-XML-Expat-EntityDeclHandler.adoc[]
----
@ -323,7 +323,7 @@ This handler must be installed when the
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-Expat-Create.xml"
include::snippets/Tasks-Serialization-XML-Expat-Create.adoc[]
----
@ -356,7 +356,7 @@ parsing to stop when encountering entity declarations.
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-Qt-NoEntityHandler.xml"
include::snippets/Tasks-Serialization-XML-Qt-NoEntityHandler.adoc[]
----
@ -377,7 +377,7 @@ may need adjusting.
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-Qt-NoEntityReader.xml"
include::snippets/Tasks-Serialization-XML-Qt-NoEntityReader.adoc[]
----
@ -399,7 +399,7 @@ return value and report any error.
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-Qt-QDomDocument.xml"
include::snippets/Tasks-Serialization-XML-Qt-QDomDocument.adoc[]
----
@ -430,7 +430,7 @@ external ID resolution.
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-OpenJDK-NoEntityResolver.xml"
include::snippets/Tasks-Serialization-XML-OpenJDK-NoEntityResolver.adoc[]
----
@ -443,7 +443,7 @@ $ include "snippets/Tasks-Serialization-XML-OpenJDK-NoEntityResolver.xml"
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-OpenJDK-NoResourceResolver.xml"
include::snippets/Tasks-Serialization-XML-OpenJDK-NoResourceResolver.adoc[]
----
@ -458,7 +458,7 @@ shows the imports used by the examples.
[subs="quotes"]
----
$ include "snippets/Tasks-Serialization-XML-OpenJDK-Imports.xml"
include::snippets/Tasks-Serialization-XML-OpenJDK-Imports.adoc[]
----
@ -478,7 +478,7 @@ instance in the `inputStream` variable.
====
----
$ include "snippets/Tasks-Serialization-XML-OpenJDK_Parse-DOM.xml"
include::snippets/Tasks-Serialization-XML-OpenJDK_Parse-DOM.adoc[]
----
@ -511,7 +511,7 @@ using a SAX-based approach. The XML data is read from an
====
----
$ include "snippets/Tasks-Serialization-XML-OpenJDK_Parse-XMLSchema_SAX.xml"
include::snippets/Tasks-Serialization-XML-OpenJDK_Parse-XMLSchema_SAX.adoc[]
----
@ -535,7 +535,7 @@ to perform the schema-based validation on the
====
----
$ include "snippets/Tasks-Serialization-XML-OpenJDK_Parse-XMLSchema_DOM.xml"
include::snippets/Tasks-Serialization-XML-OpenJDK_Parse-XMLSchema_DOM.adoc[]
----