Bläddra i källkod

added more documentation to libraries and some cosmetic changes needed by doc

Vaclav Kubart 20 år sedan
förälder
incheckning
b7d8ebac09
52 ändrade filer med 2542 tillägg och 14 borttagningar
  1. 15 7
      lib/cds/doc/cds.xml
  2. 50 0
      lib/cds/doc/cds_free.xml
  3. 52 0
      lib/cds/doc/cds_malloc.xml
  4. 46 0
      lib/cds/doc/cds_mutex_destroy.xml
  5. 45 0
      lib/cds/doc/cds_mutex_init.xml
  6. 46 0
      lib/cds/doc/cds_mutex_lock.xml
  7. 41 0
      lib/cds/doc/cds_mutex_t.xml
  8. 46 0
      lib/cds/doc/cds_mutex_unlock.xml
  9. 64 0
      lib/cds/doc/create_message.xml
  10. 63 0
      lib/cds/doc/create_message_ex.xml
  11. 49 0
      lib/cds/doc/destroy_sstream.xml
  12. 57 0
      lib/cds/doc/free_message.xml
  13. 55 0
      lib/cds/doc/get_serialized_sstream.xml
  14. 56 0
      lib/cds/doc/init_input_sstream.xml
  15. 53 0
      lib/cds/doc/init_message_ex.xml
  16. 55 0
      lib/cds/doc/init_output_sstream.xml
  17. 50 0
      lib/cds/doc/is_msg_queue_empty.xml
  18. 29 0
      lib/cds/doc/memory.xml
  19. 76 0
      lib/cds/doc/mq_message_t.xml
  20. 35 0
      lib/cds/doc/msg_queue.xml
  21. 55 0
      lib/cds/doc/msg_queue_destroy.xml
  22. 51 0
      lib/cds/doc/msg_queue_init.xml
  23. 55 0
      lib/cds/doc/msg_queue_init_ex.xml
  24. 43 0
      lib/cds/doc/msg_queue_t.xml
  25. 53 0
      lib/cds/doc/pop_message.xml
  26. 60 0
      lib/cds/doc/push_message.xml
  27. 17 0
      lib/cds/doc/serialization.xml
  28. 59 0
      lib/cds/doc/serialize_char.xml
  29. 59 0
      lib/cds/doc/serialize_int.xml
  30. 59 0
      lib/cds/doc/serialize_str.xml
  31. 59 0
      lib/cds/doc/serialize_uchar.xml
  32. 59 0
      lib/cds/doc/serialize_uint.xml
  33. 5 0
      lib/cds/doc/sstr.xml
  34. 53 0
      lib/cds/doc/sstream_get.xml
  35. 58 0
      lib/cds/doc/sstream_get_str.xml
  36. 57 0
      lib/cds/doc/sstream_get_str_ex.xml
  37. 55 0
      lib/cds/doc/sstream_put.xml
  38. 53 0
      lib/cds/doc/sstream_put_str.xml
  39. 53 0
      lib/cds/doc/sstream_put_zt.xml
  40. 44 0
      lib/cds/doc/str_clear.xml
  41. 65 0
      lib/cds/doc/str_dup.xml
  42. 44 0
      lib/cds/doc/str_free.xml
  43. 44 0
      lib/cds/doc/str_free_content.xml
  44. 84 0
      lib/cds/doc/str_other.xml
  45. 7 0
      lib/cds/doc/str_t.xml
  46. 23 0
      lib/cds/doc/sync.xml
  47. 30 3
      lib/cds/msg_queue.c
  48. 13 4
      lib/cds/msg_queue.h
  49. 26 0
      lib/doc/collection.xml
  50. 121 0
      lib/doc/libraries.xml
  51. 46 0
      lib/presence/doc/presence.xml
  52. 49 0
      lib/xcap/doc/xcap.xml

+ 15 - 7
lib/cds/doc/cds.xml

@@ -1,14 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'
-'file:///usr/share/xml/docbook/schema/dtd/4.2/docbookx.dtd'>
-
-<!--<!DOCTYPE article PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'
-'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'>-->
+'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'[
+	<!ENTITY % local.common.attrib "xml:base  CDATA  #IMPLIED">
+]>
 
 <book lang="en">
 <bookinfo>
-	<title>Common Data Structures</title>
+	<title>Common Data Structures (libcds)</title>
 	<author><firstname>Václav</firstname><surname>Kubart</surname></author>
 	<abstract><para>Description of CDS (Common Data Structures) library.
 	</para></abstract>
@@ -35,11 +34,20 @@ is able to use some internal SER's data types like strings.
 </para>
 </section>
 
+<section id="libcds.dependencies"><title>Dependencies</title>
+<para>This library depends only on standard C libraries and needs no other
+external libraries.</para>
+</section>
+
 </preface>
 
-<!--<part><title>Functions and data types</title>-->
+<part><title>Reference</title>
+<include xmlns="http://www.w3.org/2001/XInclude" href="memory.xml"/>
 <include xmlns="http://www.w3.org/2001/XInclude" href="sstr.xml"/>
 <include xmlns="http://www.w3.org/2001/XInclude" href="dstring.xml"/>
 <include xmlns="http://www.w3.org/2001/XInclude" href="serialization.xml"/>
-<!--</part>-->
+<include xmlns="http://www.w3.org/2001/XInclude" href="sync.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="msg_queue.xml"/>
+</part>
+
 </book>

+ 50 - 0
lib/cds/doc/cds_free.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_free"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>cds_free</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>cds_free</refname> <!-- function name -->
+<refpurpose>free allocated memory</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/memory.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>void <function>cds_free</function></funcdef>
+  <paramdef>void *<parameter>ptr</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Frees memory allocated using <function>cds_malloc</function>.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 52 - 0
lib/cds/doc/cds_malloc.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_malloc"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>cds_malloc</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>cds_malloc</refname> <!-- function name -->
+<refpurpose>memory allocation</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/memory.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>cds_malloc</function></funcdef>
+  <paramdef>int <parameter>size</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Allocates Memory of given size. If compiled with SER it internaly uses
+<function>shm_malloc</function>, if compiled without SER it uses 
+<function>malloc</function>.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>Returns NULL on error, pointer to allocated memory otherwise.
+<!-- return value description -->
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="cds_malloc"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 46 - 0
lib/cds/doc/cds_mutex_destroy.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_mutex_destroy"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>cds_mutex_destroy</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>cds_mutex_destroy</refname> <!-- function name -->
+<refpurpose>mutex destruction</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/sync.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>cds_mutex_destroy</function></funcdef>
+  <paramdef>cds_mutex_t *<parameter>m</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Destroys mutex. It is defined as macro now thus type control and return
+value specification may be problematic!
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+<xref linkend="cds_mutex_t"/>, <xref linkend="cds_mutex_init"/>,
+<xref linkend="cds_mutex_lock"/>, <xref linkend="cds_mutex_unlock"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 45 - 0
lib/cds/doc/cds_mutex_init.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_mutex_init"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>cds_mutex_init</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>cds_mutex_init</refname> <!-- function name -->
+<refpurpose>mutex initialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/sync.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>cds_mutex_init</function></funcdef>
+  <paramdef>cds_mutex_t *<parameter>m</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Initializes mutex. It is defined as macro now thus type control and return
+value specification may be problematic!
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<!-- references to other pages -->
+<para><xref linkend="cds_mutex_t"/>, <xref linkend="cds_mutex_destroy"/>,
+<xref linkend="cds_mutex_lock"/>, <xref linkend="cds_mutex_unlock"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 46 - 0
lib/cds/doc/cds_mutex_lock.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_mutex_lock"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>cds_mutex_lock</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>cds_mutex_lock</refname> <!-- function name -->
+<refpurpose>mutex lock</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/sync.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>cds_mutex_lock</function></funcdef>
+  <paramdef>cds_mutex_t *<parameter>m</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Locks mutex. It is defined as macro now thus type control and return
+value specification may be problematic!
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+<xref linkend="cds_mutex_t"/>, <xref linkend="cds_mutex_init"/>,
+<xref linkend="cds_mutex_destroy"/>, <xref linkend="cds_mutex_unlock"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 41 - 0
lib/cds/doc/cds_mutex_t.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_mutex_t">
+
+<refmeta><refentrytitle>cds_mutex_t</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv><refname>cds_mutex_t</refname>
+<refpurpose>wrapper type for mutex</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><synopsis>
+#include &lt;cds/sync.h&gt;
+
+outside of SIP Express Router:
+
+#include &lt;pthread.h&gt;
+#define cds_mutex_t   pthread_mutex_t
+
+inside of SIP Express Router:
+
+#define cds_mutex_t   gen_lock_t
+
+</synopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Wrapper type for mutex. It is defined as macro now, but this may change.
+</para> 
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para><xref linkend="cds_mutex_init"/>, <xref linkend="cds_mutex_destroy"/>,
+<xref linkend="cds_mutex_lock"/>, <xref linkend="cds_mutex_unlock"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 46 - 0
lib/cds/doc/cds_mutex_unlock.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="cds_mutex_unlock"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>cds_mutex_unlock</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>cds_mutex_unlock</refname> <!-- function name -->
+<refpurpose>mutex unlock</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/sync.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>cds_mutex_unlock</function></funcdef>
+  <paramdef>cds_mutex_t *<parameter>m</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Unlocks mutex. It is defined as macro now thus type control and return
+value specification may be problematic!
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+<xref linkend="cds_mutex_t"/>, <xref linkend="cds_mutex_init"/>,
+<xref linkend="cds_mutex_destroy"/>, <xref linkend="cds_mutex_lock"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 64 - 0
lib/cds/doc/create_message.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="create_message"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>create_message</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>create_message</refname> <!-- function name -->
+<refpurpose>allocates and initializes message</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>create_message</function></funcdef>
+  <paramdef>void *<parameter>data</parameter></paramdef>
+  <paramdef>int <parameter>data_len</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>Allocates message using <function>cds_malloc</function> and initializes
+its content so it will be freed automaticaly. Pointer to the explicitly
+allocated data is set to <parameter>data</parameter> and its length is set to
+<parameter>data_len</parameter>. Message created by <function>create_message</function> 
+should be freed using <function>message_free</function>.</para>
+
+<para>Unremoved messages created this way are freed automaticaly in
+<function>msg_queue_destroy</function> using <function>free_message</function>.
+</para>
+
+<para>Calling <function>free_message</function> to such message frees the
+message and the data given by parameter <parameter>data</parameter> too, thus
+they can NOT be freed by the caller!
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns NULL on error, pointer to initialized message structure otherwise.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="create_message_ex"/>, <xref linkend="init_message_ex"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 63 - 0
lib/cds/doc/create_message_ex.xml

@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="create_message_ex"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>create_message_ex</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>create_message_ex</refname> <!-- function name -->
+<refpurpose>create and initialize message</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>mq_message_t *<function>create_message_ex</function></funcdef>
+  <paramdef>int <parameter>data_len</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>Allocates message with data of given size
+(<parameter>data_len</parameter>) using <function>cds_malloc</function>. It
+initializes message content so it will be freed automaticaly. 
+Pointer to allocated data should be obtained by 
+<function>get_message_data</function>.
+</para>
+
+<para>Messages created by <function>create_message_ex</function> 
+should be freed using <function>message_free</function>.</para>
+
+<para>Unremoved messages created this way are freed automaticaly in
+<function>msg_queue_destroy</function> using <function>free_message</function>.
+</para>
+
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns NULL on error, pointer to initialized message structure otherwise.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="create_message"/>, <xref linkend="init_message_ex"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 49 - 0
lib/cds/doc/destroy_sstream.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="destroy_sstream"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>destroy_sstream</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>destroy_sstream</refname> <!-- function name -->
+<refpurpose>destroys input/output serialization stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>void <function>destroy_sstream</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>
+Destroys serialization stream and frees all internal data buffers. After calling
+this function can NOT be called any other serialization stream manipulation
+function except <function>init_input_sstream</function> or
+<function>init_ouput_stream</function>.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, <xref linkend="init_input_sstream"/>, <xref
+linkend="init_output_sstream"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 57 - 0
lib/cds/doc/free_message.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="free_message"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>free_message</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>free_message</refname> <!-- function name -->
+<refpurpose>free message</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>void <function>free_message</function></funcdef>
+  <paramdef>mq_message_t *<parameter>msg</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Frees message. If data is allocated explicitly it frees it using
+<function>cds_free</function>,
+if they are allocated implicitly, it is freed together with message. Thus simple
+data strutures are deallocated automaticaly in both cases. There might be a
+problem with more complicated structures with internal pointers to other
+structures - these are NOT deallocated automaticaly because this function can't
+know the internal data structure and they must be freed by the
+caller!
+<!-- detailed description -->
+</para>
+
+<para>This function does NOT free messages which were initialized using
+<function>message_init_ex</function> with <parameter>auto_free</parameter> not
+set, they must be freed explicitly by caller!
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="create_message"/>, <xref linkend="create_message_ex"/>, <xref
+linkend="init_message_ex"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 55 - 0
lib/cds/doc/get_serialized_sstream.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="get_serialized_sstream"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>get_serialized_sstream</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>get_serialized_sstream</refname> <!-- function name -->
+<refpurpose>get output stream data</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>get_serialized_sstream</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>str_t *<parameter>dst</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>
+Copies data stored during output serialization into given destination. It allocates buffer
+necessary for serialized data using cds_malloc function. These data can be freed
+using <function>str_free_content</function>.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, <xref linkend="str_free_content"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 56 - 0
lib/cds/doc/init_input_sstream.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="init_input_sstream"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>init_input_sstream</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>init_input_sstream</refname> <!-- function name -->
+<refpurpose>initializes input serialization stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis> <!-- usage -->
+
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>init_input_sstream</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>char *<parameter>data_in</parameter></paramdef>
+  <paramdef>int <parameter>data_len</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Initializes serialization stream as input. Input data are read from char
+array given by pointer <parameter>data_in</parameter> and length
+<parameter>data_len</parameter>.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+Returns 0 if successful, nonzero otherwise.
+<!-- return value description -->
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 53 - 0
lib/cds/doc/init_message_ex.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="init_message_ex"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>init_message_ex</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>init_message_ex</refname> <!-- function name -->
+<refpurpose>initialize message</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>void <function>init_message_ex</function></funcdef>
+  <paramdef>mq_message_t *<parameter>m</parameter></paramdef>
+  <paramdef>void *<parameter>data</parameter></paramdef>
+  <paramdef>int <parameter>data_len</parameter></paramdef>
+  <paramdef>int <parameter>auto_free</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Initializes message structure with given data and given data length. If
+<parameter>auto_free</parameter> is set, the message can be be freed
+using <function>free_message</function> and such unremoved messages are freed
+automaticaly with <function>msg_queue_destroy</function>. If this flag is not set,
+calling <function>free message</function> will not do anything and the message
+and message data must be freed explicitly by caller.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+<xref linkend="create_message"/>, <xref linkend="create_message_ex"/>, <xref
+linkend="free_message"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 55 - 0
lib/cds/doc/init_output_sstream.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="init_output_sstream"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>init_output_sstream</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>init_output_sstream</refname> <!-- function name -->
+<refpurpose>initializes serialization stream for output</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>init_output_sstream</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>int <parameter>out_buff_resize</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Initializes given serialization stream for output. Parameter
+<parameter>out_buff_resize</parameter> is stored into
+<structname>sstream_t</structname> structure and specifies the size of newly
+allocated data buffers. Data buffers are allocated when needed during output.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+Returns 0 on success, non-zero on error.
+<!-- return value description -->
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+<xref linkend="sstream_t"/>, <xref linkend="dstring_t"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 50 - 0
lib/cds/doc/is_msg_queue_empty.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="is_msg_queue_empty"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>is_msg_queue_empty</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>is_msg_queue_empty</refname> <!-- function name -->
+<refpurpose>test if message queue empty</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>is_msg_queue_empty</function></funcdef>
+  <paramdef>msg_queue_t *<parameter>q</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Tests message queue if it is empty.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>Returns nonzero if message queue empty, zero otherwise.
+<!-- return value description -->
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="push_message"/>, <xref linkend="pop_message"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 29 - 0
lib/cds/doc/memory.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<reference id="memory">
+<title>Memory operations</title>
+
+<partintro>
+<para>Memory operations are common for whole CDS library. Because it must work
+together with SER's memory management and must work without it too, there are
+standalone functions (?macros in the future?) which cover internal
+implementation of memory allocation/deallocation functions.
+</para>
+
+<para>It is possible to redefine these functions to help with memory debugging
+or for monitoring purposes or so.
+</para>
+
+<!--
+<para>It might be useful some parts of code determined for SER probe out of it,
+with a memory debugging tool like valgrind
+</para> -->
+</partintro>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_malloc.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_free.xml"/>
+
+</reference>

+ 76 - 0
lib/cds/doc/mq_message_t.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="mq_message_t">
+
+<refmeta><refentrytitle>mq_message_t</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv><refname>mq_message_t</refname>
+<refpurpose>message data structure</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><synopsis>
+#include &lt;cds/msg_queue.h&gt;
+
+typedef struct _mq_message_t {
+	void *data;
+	int data_len;
+	struct _mq_message_t *next;
+	enum { 
+		message_allocated_with_data, 
+		message_holding_data_ptr 
+	} allocation_style;
+	char data_buf[1];
+} mq_message_t;
+</synopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>Data structure used as basic element in message queue. Pointer to
+message data should be obtained by <function>get_message_data</function>.
+</para>
+
+<para>There are more possibilities how to allocate message data:
+<itemizedlist>
+	<listitem><para>explicitly, data buffer is allocated outside of
+	<structname>mq_message_t</structname> structure and only pointer to it is stored
+	in this structure, see <xref linkend="create_message"/>
+	<!-- - in this case the data must be deallocated explicitly--></para></listitem>
+	
+	<listitem><para>implicitly, data buffer is allocated together with
+	<structname>mq_message_t</structname> structure - data must be copied into
+	it after structure allocation, see <xref linkend="create_message_ex"/></para></listitem>
+
+	<listitem><para>there is third possibility, that data and message - both -
+	are allocated/freed by caller without using
+	<function>create_message</function>, <function>create_message_ex</function> and 
+	<function>msg_free</function>, see <xref linkend="init_message_ex"/></para>
+<!--	<para>In this case might be the <structname>mq_message_t</structname> for
+	example a part of the data structure.</para>
+	<para>This is not recomended because of
+	future possibility of <quote>network message queues</quote> and the
+	framework between could not free message memory.</para>-->
+	</listitem>
+</itemizedlist>
+</para>
+
+<para>More different data allocation methods are due to more efficiency - less
+memory allocation calls and less fragmentation in second case, but more common
+and may be simpler for usage in first case.
+</para>
+
+<para>Warning: internal implementation of this structure may change, use it only
+through existing functions.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para><xref linkend="msg_queue_t"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 35 - 0
lib/cds/doc/msg_queue.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<reference id="msg_queue">
+<title>Message queue</title>
+
+<partintro>
+<para>Message queue is implementation of simple FIFO. It is declared in
+<filename>msg_queue.h</filename>.
+</para>
+
+<!--
+<para> TODO: describe element allocation methods !
+</para> -->
+</partintro>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="msg_queue_t.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="mq_message_t.xml"/>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="msg_queue_init.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="msg_queue_init_ex.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="msg_queue_destroy.xml"/>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="push_message.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="pop_message.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="is_msg_queue_empty.xml"/>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="create_message.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="create_message_ex.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="init_message_ex.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="free_message.xml"/>
+
+</reference>

+ 55 - 0
lib/cds/doc/msg_queue_destroy.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="msg_queue_destroy"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>msg_queue_destroy</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>msg_queue_destroy</refname> <!-- function name -->
+<refpurpose>destroy message queue</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>void <function>msg_queue_destroy</function></funcdef>
+  <paramdef>msg_queue_t *<parameter>q</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Destroys initialized message queue. After calling
+<function>msg_queue_destroy</function> can not be called any of message queue
+manipulation functions except <function>msg_queue_init</function>.
+<!-- detailed description -->
+</para>
+
+<para>All messages which stay in the queue and have <parameter>auto_free</parameter> flag set 
+are automaticaly freed using <function>free_message</function>. 
+It depends on allocation manner of messages if it is sufficient.
+</para>
+
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="msg_queue_init"/>, <xref linkend="msg_queue_init_ex"/>, <xref
+linkend="msg_queue_t"/>, <xref linkend="mq_message_t"/>, <xref
+linkend="free_message"/>, <xref linkend="init_message_ex"/>
+<!--, <xref
+linkend="free_message"/>-->
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 51 - 0
lib/cds/doc/msg_queue_init.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="msg_queue_init"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>msg_queue_init</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>msg_queue_init</refname> <!-- function name -->
+<refpurpose>message queue initialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>msg_queue_init</function></funcdef>
+  <paramdef>msg_queue_t *<parameter>q</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Initializes synchronized (using internal mutex) message queue structure.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="msg_queue_init_ex"/>, <xref linkend="msg_queue_destroy"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 55 - 0
lib/cds/doc/msg_queue_init_ex.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="msg_queue_init_ex"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>msg_queue_init_ex</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>msg_queue_init_ex</refname> <!-- function name -->
+<refpurpose>message queue initialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>msg_queue_init_ex</function></funcdef>
+  <paramdef>msg_queue_t *<parameter>q</parameter></paramdef>
+  <paramdef>int <parameter>synchronized</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Initializes message queue structure. The value of
+<parameter>synchronized</parameter> may be 0 or 1. Zero means, that the message
+queue will not use mutex for internal data access (will be NOT synchronized), 1
+means that message queue will be synchronized by mutex created internaly.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="msg_queue_init"/>, <xref linkend="msg_queue_destroy"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 43 - 0
lib/cds/doc/msg_queue_t.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="msg_queue_t">
+
+<refmeta><refentrytitle>msg_queue_t</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv><refname>msg_queue_t</refname>
+<refpurpose>message queue data structure</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><synopsis>
+#include &lt;cds/msg_queue.h&gt;
+
+typedef struct msg_queue {
+	mq_message_t *first;
+	mq_message_t *last;
+	cds_mutex_t q_mutex;
+	int use_mutex;
+} msg_queue_t;
+
+</synopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Message queue is implemented as simple linked list of elements. Message
+queue may be locked or not - it depends on initialization.
+</para> 
+<para>Warning: internal implementation of this structure may change, use it only
+through existing functions.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="mq_message_t"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 53 - 0
lib/cds/doc/pop_message.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="pop_message"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>pop_message</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>pop_message</refname> <!-- function name -->
+<refpurpose>pop message from the queue</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>mq_message_t *<function>pop_message</function></funcdef>
+  <paramdef>msg_queue_t *<parameter>q</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Removes first message from the queue. If the queue is empty or an error
+occured it returns NULL value. Removed messages are NOT automaticaly freed -
+caller must use <function>free_message</function> or free it itself (see <xref
+linkend="free_message"/>)!
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>Returns pointer to message removed from the queue. If the queue is empty
+or an error occured the return value is NULL.
+<!-- return value description -->
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="push_message"/>, <xref linkend="free_message"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 60 - 0
lib/cds/doc/push_message.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="push_message"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>push_message</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>push_message</refname> <!-- function name -->
+<refpurpose>push message into message queue</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/msg_queue.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>push_message</function></funcdef>
+  <paramdef>msg_queue_t *<parameter>q</parameter></paramdef>
+  <paramdef>mq_message_t *<parameter>msg</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Function pushes initialized message into message queue. This
+message may be removed from the queue using <function>pop_message</function>.
+Unremoved messages are automaticaly freed by <function>msg_queue_destroy</function> 
+(depending on message initialization, see <xref
+linkend="create_message"/>, <xref linkend="create_message_ex"/> and <xref
+linkend="init_message_ex"/>).
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<!-- references to other pages -->
+<xref linkend="pop_message"/>, 
+<xref linkend="create_message"/>, 
+<xref linkend="create_message_ex"/>, 
+<xref linkend="init_message_ex"/>
+</para>
+</refsect1>
+
+</refentry> 
+

+ 17 - 0
lib/cds/doc/serialization.xml

@@ -15,5 +15,22 @@ serialization (see <xref linkend="sstream_t.example"/>).</para>
 </partintro>
 
 <include xmlns="http://www.w3.org/2001/XInclude" href="sstream_t.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="init_input_sstream.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="init_output_sstream.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="get_serialized_sstream.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="destroy_sstream.xml"/>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="sstream_put.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="sstream_put_str.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="sstream_put_zt.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="sstream_get.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="sstream_get_str.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="sstream_get_str_ex.xml"/>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="serialize_int.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="serialize_uint.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="serialize_char.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="serialize_uchar.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="serialize_str.xml"/>
 
 </reference>

+ 59 - 0
lib/cds/doc/serialize_char.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="serialize_char"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>serialize_char</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>serialize_char</refname> <!-- function name -->
+<refpurpose>character serialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>serialize_char</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>char *<parameter>c</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Serializes character. This means that in the case of input stream this
+functions sets value of given character parameter to value read from stream, 
+in the case of output stream it
+writes the character given in parameter into that stream.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, 
+<xref linkend="serialize_int"/>, 
+<xref linkend="serialize_uint"/>, 
+<xref linkend="serialize_uchar"/>, 
+<xref linkend="serialize_str"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 59 - 0
lib/cds/doc/serialize_int.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="serialize_int"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>serialize_int</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>serialize_int</refname> <!-- function name -->
+<refpurpose>integer serialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>serialize_int</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>int *<parameter>num</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Serializes number. This means that in case of input stream this
+functions sets value of given integer parameter to value read from stream, 
+in case of output stream it
+writes the number given in parameter into that stream.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>
+<xref linkend="serialize_uint"/>, 
+<xref linkend="serialize_char"/>, 
+<xref linkend="serialize_uchar"/>, 
+<xref linkend="serialize_str"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 59 - 0
lib/cds/doc/serialize_str.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="serialize_str"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>serialize_str</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>serialize_str</refname> <!-- function name -->
+<refpurpose>string serialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>serialize_str</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>str_t *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Serializes string. This means that in the case of input stream this
+functions reads string from the stream (allocated using cds_malloc),
+in the case of output stream it
+writes the given string into that stream.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, 
+<xref linkend="serialize_int"/>, 
+<xref linkend="serialize_uint"/>, 
+<xref linkend="serialize_char"/>, 
+<xref linkend="serialize_uchar"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 59 - 0
lib/cds/doc/serialize_uchar.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="serialize_uchar"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>serialize_uchar</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>serialize_uchar</refname> <!-- function name -->
+<refpurpose>unsigned character serialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>serialize_uchar</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>unsigned char *<parameter>c</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Serializes unsigned character. This means that in the case of input stream this
+functions sets value of given character parameter to value read from stream, 
+in the case of output stream it
+writes the character given in parameter into that stream.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, 
+<xref linkend="serialize_int"/>, 
+<xref linkend="serialize_uint"/>, 
+<xref linkend="serialize_char"/>, 
+<xref linkend="serialize_str"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 59 - 0
lib/cds/doc/serialize_uint.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="serialize_uint"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>serialize_uint</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>serialize_uint</refname> <!-- function name -->
+<refpurpose>unsigned integer serialization</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>serialize_uint</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>unsigned int *<parameter>num</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Serializes number. This means that in the case of input stream this
+functions sets value of given unsigned integer parameter to value read from stream, 
+in the case of output stream it
+writes the number given in parameter into that stream.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, 
+<xref linkend="serialize_int"/>, 
+<xref linkend="serialize_char"/>, 
+<xref linkend="serialize_uchar"/>, 
+<xref linkend="serialize_str"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 5 - 0
lib/cds/doc/sstr.xml

@@ -19,5 +19,10 @@ often duplictly in SER's modules.</para>
 </partintro>
 
 <include xmlns="http://www.w3.org/2001/XInclude" href="str_t.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="str_dup.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="str_clear.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="str_free.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="str_free_content.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="str_other.xml"/>
 
 </reference>

+ 53 - 0
lib/cds/doc/sstream_get.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="sstream_get"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>sstream_get</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>sstream_get</refname> <!-- function name -->
+<refpurpose>read data from input stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>sstream_get</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>char *<parameter>c</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Reads a character from input stream into <parameter>c</parameter>.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, <xref linkend="sstream_get_str"/>, <xref
+linkend="sstream_get_str_ex"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 58 - 0
lib/cds/doc/sstream_get_str.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="sstream_get_str"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>sstream_get_str</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>sstream_get_str</refname> <!-- function name -->
+<refpurpose>read data from input stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>sstream_get_str</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>int <parameter>length</parameter></paramdef>
+  <paramdef>str_t *<parameter>dst</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Reads <parameter>len</parameter> bytes from input stream makes a copy of
+them and returns them in string <parameter>dst</parameter>. For allocation it
+uses cds_malloc function. The string may be freed using for example
+<function>str_free_content</function>. If there is not enough data to read (less
+than <parameter>len</parameter> bytes), the function returns error.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error. 
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, <xref linkend="sstream_get"/>, <xref
+linkend="sstream_get_str_ex"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 57 - 0
lib/cds/doc/sstream_get_str_ex.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="sstream_get_str_ex"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>sstream_get_str_ex</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>sstream_get_str_ex</refname> <!-- function name -->
+<refpurpose>read data from input stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>sstream_get_str_ex</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>int <parameter>len</parameter></paramdef>
+  <paramdef>str_t *<parameter>dst</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Returns data buffer of requested length (<parameter>len</parameter>). If
+there is not enough data to read (less than <parameter>len</parameter> bytes), 
+the function returns error. The memory can NOT be freed becausse it is a part of
+input buffer!
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error. 
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>, <xref linkend="sstream_get"/>, <xref
+linkend="sstream_get_str"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 55 - 0
lib/cds/doc/sstream_put.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="sstream_put"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>sstream_put</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>sstream_put</refname> <!-- function name -->
+<refpurpose>store data into output stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>sstream_put</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>const char *<parameter>s</parameter></paramdef>
+  <paramdef>int <parameter>len</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Stores data into output stream. It copies data of size
+<parameter>len</parameter> from memory at address <parameter>s</parameter> into
+internal data buffers.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 53 - 0
lib/cds/doc/sstream_put_str.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="sstream_put_str"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>sstream_put_str</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>sstream_put_str</refname> <!-- function name -->
+<refpurpose>store data into output stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>sstream_put_str</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>const str_t *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Stores data into output stream. It copies data from given string into
+internal data buffers.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 53 - 0
lib/cds/doc/sstream_put_zt.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="sstream_put_zt"> <!-- ID for references -->
+
+<refmeta>
+<refentrytitle>sstream_put_zt</refentrytitle> <!-- title shown in references -->
+<manvolnum>3</manvolnum></refmeta> <!-- man volume id (3 for libraries) -->
+
+<refnamediv>
+<refname>sstream_put_zt</refname> <!-- function name -->
+<refpurpose>store data into output stream</refpurpose> <!-- short function description -->
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;cds/serialize.h&gt; <!-- included headers -->
+</funcsynopsisinfo>
+
+<funcprototype> <!-- function prototype -->
+  <funcdef>int <function>sstream_put_zt</function></funcdef>
+  <paramdef>sstream_t *<parameter>ss</parameter></paramdef>
+  <paramdef>const char *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Stores data into output stream. It copies data from zero-terminated string
+<parameter>s</parameter> into internal data buffers.
+<!-- detailed description -->
+</para>
+
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>
+<!-- return value description -->
+Returns 0 on success, non-zero on error.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="sstream_t"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 44 - 0
lib/cds/doc/str_clear.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="str_clear">
+
+<refmeta><refentrytitle>str_clear</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv>
+<refname>str_clear</refname>
+<refpurpose>string initialization function</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+
+<funcsynopsisinfo>
+#include &lt;cds/sstr.h&gt;
+</funcsynopsisinfo>
+
+<funcprototype>
+  <funcdef>void <function>str_clear</function></funcdef>
+  <paramdef>str_t *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Clears the given string - it sets string length 
+to 0 and pointer to data to NULL</para>
+</refsect1>
+
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="str_t"/>, <xref linkend="str_free"/>, <xref
+linkend="str_free_content"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 65 - 0
lib/cds/doc/str_dup.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="str_dup">
+
+<refmeta><refentrytitle>str_dup</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv>
+<refname>str_dup</refname>
+<refname>str_dup_new</refname>
+<refname>str_dup_zt</refname>
+<refpurpose>string duplication functions</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+
+<funcsynopsisinfo>
+#include &lt;cds/sstr.h&gt;
+</funcsynopsisinfo>
+
+<funcprototype>
+  <funcdef>int <function>str_dup</function></funcdef>
+  <paramdef>str_t *<parameter>dst</parameter></paramdef>
+  <paramdef>const str_t *<parameter>src</parameter></paramdef>
+</funcprototype>
+
+<funcprototype>
+  <funcdef>int <function>str_dup_new</function></funcdef>
+  <paramdef>str_t *<parameter>dst</parameter></paramdef>
+  <paramdef>const char *<parameter>src</parameter></paramdef>
+</funcprototype>
+
+<funcprototype>
+  <funcdef>int <function>str_dup_zt</function></funcdef>
+  <paramdef>const str_t *<parameter>src</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>All these functions allocates necessary memory using
+<function>cds_malloc</function>.</para>
+
+<para><function>str_dup</function> takes as source the string given in
+<parameter>src</parameter></para>
+
+<para><function>str_dup_zt</function> takes as source zero-terminated string given in
+<parameter>src</parameter></para>
+
+<para><function>str_dup_new</function> works like <function>str_dup</function>
+with the difference, that it allocates not only the data buffer, but the 
+destination <structname>str_t</structname> structure too.
+</para>
+</refsect1>
+
+<refsect1><title>Return value</title>
+<para>All these functions return 0 if successful, nonzero otherwise.
+</para>
+</refsect1>
+
+</refentry> 
+

+ 44 - 0
lib/cds/doc/str_free.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="str_free">
+
+<refmeta><refentrytitle>str_free</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv>
+<refname>str_free</refname>
+<refpurpose>destroys string</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+
+<funcsynopsisinfo>
+#include &lt;cds/sstr.h&gt;
+</funcsynopsisinfo>
+
+<funcprototype>
+  <funcdef>void <function>str_free</function></funcdef>
+  <paramdef>str_t *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para>Frees string's data like str_free_content, 
+and the frees the <structname>str_t</structname> structure too.
+It uses <function>cds_free</function> as memory deallocation function.</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="str_t"/>, <xref linkend="str_free_content"/>, <xref linkend="str_clear"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 44 - 0
lib/cds/doc/str_free_content.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="str_free_content">
+
+<refmeta><refentrytitle>str_free_content</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv>
+<refname>str_free_content</refname>
+<refpurpose>frees content of a string</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+
+<funcsynopsisinfo>
+#include &lt;cds/sstr.h&gt;
+</funcsynopsisinfo>
+
+<funcprototype>
+  <funcdef>void <function>str_free_content</function></funcdef>
+  <paramdef>str_t *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>Frees string's data if allocated
+(length &gt; 0 and pointer is not NULL) and clears its content like str_clear.
+It uses <function>cds_free</function> as memory deallocation function.</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para>
+<xref linkend="str_t"/>, <xref linkend="str_free"/>, <xref linkend="str_clear"/>
+<!-- references to other pages -->
+</para>
+</refsect1>
+
+</refentry> 
+

+ 84 - 0
lib/cds/doc/str_other.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<refentry id="str_other">
+
+<refmeta><refentrytitle>helper functions</refentrytitle>
+<manvolnum>3</manvolnum></refmeta>
+
+<refnamediv>
+<refname>zt2str</refname>
+<refname>is_str_empty</refname>
+<refname>zt_strdup</refname>
+<refname>str_prefix</refname>
+<refname>str_strchr</refname>
+<refpurpose>various string helper functions</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><funcsynopsis>
+
+<funcsynopsisinfo>
+#include &lt;cds/sstr.h&gt;
+</funcsynopsisinfo>
+
+<funcprototype>
+  <funcdef>str_t <function>zt2str</function></funcdef>
+  <paramdef>char *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+<funcprototype>
+  <funcdef>int <function>is_str_empty</function></funcdef>
+  <paramdef>const str_t *<parameter>s</parameter></paramdef>
+</funcprototype>
+
+<funcprototype>
+  <funcdef>char *<function>zt_strdup</function></funcdef>
+  <paramdef>const char *<parameter>src</parameter></paramdef>
+</funcprototype>
+
+<funcprototype>
+  <funcdef>int <function>str_prefix</function></funcdef>
+  <paramdef>const str_t *<parameter>a</parameter></paramdef>
+  <paramdef>const str_t *<parameter>b</parameter></paramdef>
+</funcprototype>
+
+<funcprototype>
+  <funcdef>char *<function>str_strchr</function></funcdef>
+  <paramdef>const str_t *<parameter>s</parameter></paramdef>
+  <paramdef>char <parameter>c</parameter></paramdef>
+</funcprototype>
+
+</funcsynopsis></refsynopsisdiv>
+
+<refsect1><title>Description</title>
+<para><function>zt2str</function> converts zero terminated string to
+<structname>str_t</structname>. It doesn't copy data - both strings use the same
+buffer!
+</para>
+
+<para><function>is_str_empty</function> returns 1 if given string is empty (NULL
+pointer or length &lt; 1 or NULL pointer to string data)
+</para>
+
+<para><function>zt_strdup</function> duplicates given zero terminated string to
+another zero terminated string using cds_malloc function
+</para>
+
+<para><function>str_prefix</function> returns 0 if string
+<parameter>b</parameter> is prefix of <parameter>a</parameter>, nonzero
+otherwise (deprecated)
+</para>
+
+<para><function>str_strchr</function> searches for given character. It returns
+pointer to it in the string or NULL if not found.
+</para>
+</refsect1>
+
+<refsect1><title>See Also</title>
+<para><xref linkend="str_t"/></para>
+</refsect1>
+
+</refentry> 
+

+ 7 - 0
lib/cds/doc/str_t.xml

@@ -37,5 +37,12 @@ length of this buffer.
 </para> 
 </refsect1>
 
+<refsect1><title>See Also</title>
+<para><xref linkend="str_dup"/>, <xref linkend="str_clear"/>, 
+<xref linkend="str_free_content"/>,	<xref linkend="str_free"/>
+<xref linkend="str_other"/>
+</para>
+</refsect1>
+
 </refentry> 
 

+ 23 - 0
lib/cds/doc/sync.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<reference id="sync">
+<title>Synchronization</title>
+
+<partintro>
+<para>Interprocess synchronization functions and data structures are 
+specific for SER. There are some wrapper macros for them in 
+the CDS library.
+</para>
+
+</partintro>
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_mutex_t.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_mutex_init.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_mutex_destroy.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_mutex_lock.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="cds_mutex_unlock.xml"/>
+
+</reference>

+ 30 - 3
lib/cds/msg_queue.c

@@ -40,6 +40,31 @@ mq_message_t *create_message_ex(int data_len)
 	return m;
 }
 
+mq_message_t *create_message(void *data, int data_len)
+{
+	mq_message_t *m;
+	/* if (data_len < 0) data_len = 0; */
+	m = cds_malloc(sizeof(mq_message_t));
+	if (!m) return NULL;
+	m->data_len = data_len;
+	m->data = data;
+	m->next = NULL;
+	m->allocation_style = message_holding_data_ptr;
+	return m;
+}
+
+void init_message_ex(mq_message_t *m, void *data, int data_len, int auto_free)
+{
+	/* if (data_len < 0) data_len = 0; */
+	if (!m) return;
+	
+	m->data_len = data_len;
+	m->data = data;
+	m->next = NULL;
+	if (auto_free) m->allocation_style = message_holding_data_ptr;
+	else m->allocation_style = message_holding_data_ptr_no_free;
+}
+
 void free_message(mq_message_t *msg)
 {
 	switch (msg->allocation_style) {
@@ -48,6 +73,9 @@ void free_message(mq_message_t *msg)
 		case message_holding_data_ptr: 
 				if (msg->data) cds_free(msg->data);
 				break;
+		case message_holding_data_ptr_no_free:
+				/* not automaticaly freed !! */
+				return;
 	}
 	cds_free(msg);
 }
@@ -127,10 +155,10 @@ int msg_queue_init_ex(msg_queue_t *q, int synchronize)
 	return 0;
 }
 
-int msg_queue_destroy(msg_queue_t *q)
+void msg_queue_destroy(msg_queue_t *q)
 {
 	mq_message_t *m,*n;
-	if (!q) return -1;
+	if (!q) return;
 	
 	if (q->use_mutex) cds_mutex_lock(&q->q_mutex);
 	m = q->first;
@@ -145,7 +173,6 @@ int msg_queue_destroy(msg_queue_t *q)
 		cds_mutex_unlock(&q->q_mutex);
 		cds_mutex_destroy(&q->q_mutex);
 	}
-	return 0;
 }
 
 

+ 13 - 4
lib/cds/msg_queue.h

@@ -28,13 +28,14 @@
 
 #include <cds/sync.h>
 
-typedef struct mq_message_t {
+typedef struct _mq_message_t {
 	void *data;
 	int data_len;
-	struct mq_message_t *next;
+	struct _mq_message_t *next;
 	enum { 
 		message_allocated_with_data, 
-		message_holding_data_ptr 
+		message_holding_data_ptr, 
+		message_holding_data_ptr_no_free /* not automaticaly freed */
 	} allocation_style;
 	char data_buf[1];
 } mq_message_t;
@@ -46,6 +47,9 @@ typedef struct msg_queue {
 	int use_mutex;
 } msg_queue_t;
 
+#define get_message_data(msg)		(msg ? msg->data: NULL)
+#define get_message_data_len(msg)	(msg ? msg->data_len: 0)
+
 /** the space for data is allocated in messages data
  * (they are automaticaly freed!)! Pointer to allocated
  * data bytes is in data variable in the message structure. */
@@ -55,6 +59,11 @@ mq_message_t *create_message_ex(int data_len);
  * are automacicaly freed! */
 mq_message_t *create_message(void *data, int data_len);
 
+/** initializes message, 
+ * if auto_free set, data must be allocated using cds_malloc and are automaticaly freed by free_message 
+ * (and if msg_queue_destroy called) */
+void init_message_ex(mq_message_t *m, void *data, int data_len, int auto_free);
+
 /** frees the message and data holding by the message !!!! */
 void free_message(mq_message_t *msg);
 
@@ -67,7 +76,7 @@ int is_msg_queue_empty(msg_queue_t *q);
 /** initializes synchronized message queue */
 int msg_queue_init(msg_queue_t *q);
 int msg_queue_init_ex(msg_queue_t *q, int synchronize);
-int msg_queue_destroy(msg_queue_t *q);
+void msg_queue_destroy(msg_queue_t *q);
 
 #endif
 

+ 26 - 0
lib/doc/collection.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE set PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'
+'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd' [
+<!ENTITY % local.common.attrib "xml:base  CDATA  #IMPLIED"> 
+<!-- needed for DocBook version <= 4.2, see 
+http://www.sagehill.net/docbookxsl/ValidXinclude.htm -->
+]>
+
+<set>
+<setinfo>
+	<title>Common libraries for SIP Express Router</title>
+	<author><firstname>Václav</firstname><surname>Kubart</surname></author>
+	<!--<abstract><para>Description of common libraries.
+	</para></abstract>-->
+</setinfo>
+
+<!--<preface><title>Preface</title>
+<para>...</para>
+</preface>-->
+
+<include xmlns="http://www.w3.org/2001/XInclude" href="libraries.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="../cds/doc/cds.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="../xcap/doc/xcap.xml"/>
+<include xmlns="http://www.w3.org/2001/XInclude" href="../presence/doc/presence.xml"/>
+</set>

+ 121 - 0
lib/doc/libraries.xml

@@ -0,0 +1,121 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'
+	'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'[
+	<!ENTITY % local.common.attrib "xml:base  CDATA  #IMPLIED">
+]> 
+
+<book lang="en">
+	<bookinfo>
+		<title>Usage of common libraries</title>
+		<author><firstname>Václav</firstname><surname>Kubart</surname></author>
+		<abstract><para>Installation and usage of common libraries.
+		</para></abstract>
+	</bookinfo>
+
+<chapter><title>Introduction</title>
+
+<section><title>About</title>
+<para>Common libraries are originaly determined for usage with SER - as a
+collection of useful functions which are not present in the SER's code. 
+But as the time goes it seems to be good to make them usable without SER too, 
+at least for testing parts of SER modules and thus it is possible to use 
+them alone now.</para>
+</section>
+
+<section id="lib.dependencies"><title>Dependencies</title>
+<!-- <para>Individual libraries may need some external libraries to compile and work. These
+dependencies are in detail described in their documentation. But dependencies may
+exist between standalone libraries too. For example the CDS library is a basis
+for others because it offers useful common functions and data structures used by
+them.</para>-->
+
+<section><title>libcds dependencies</title>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+	href="../cds/doc/cds.xml"
+	xpointer="xpointer(id('libcds.dependencies')/child::*[not(self::title)])">
+	<xi:fallback>
+		<para><emphasis>Missing dependencies for CDS library!
+		Add section with <markup>id</markup> <quote><constant>libcds.dependencies</constant></quote>
+		to CDS library documentation.</emphasis></para>
+	</xi:fallback>
+</xi:include>
+</section>
+
+<section><title>libxcap dependencies</title>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+	href="../xcap/doc/xcap.xml"
+	xpointer="xpointer(id('libxcap.dependencies')/child::*[not(self::title)])">
+	<xi:fallback>
+		<para><emphasis>Missing dependencies for XCAP library!
+		Add section with <markup>id</markup> <quote><constant>libxcap.dependencies</constant></quote>
+		to XCAP library documentation.</emphasis></para>
+	</xi:fallback>
+</xi:include>
+</section>
+
+<section><title>libpresence dependencies</title>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+	href="../presence/doc/presence.xml"
+	xpointer="xpointer(id('libpresence.dependencies')/child::*[not(self::title)])">
+	<xi:fallback>
+		<para><emphasis>Missing dependencies for Presence library!
+		Add section with <markup>id</markup> <quote><constant>libpresence.dependencies</constant></quote>
+		to Presence library documentation.</emphasis></para>
+	</xi:fallback>
+</xi:include>
+</section>
+</section>
+
+</chapter>
+
+<chapter><title>Installation and usage</title>
+
+<para>Before installation is needed to install external libraries according to
+<link linkend="lib.dependencies">dependencies</link>.
+</para>
+
+<section id="lib.usage-ser"><title>Usage with SIP Express Router</title>
+
+<para>These libraries are distributed together with SER, but they are not
+compiled together with other SER code. They must be compiled separately, before
+compiling SER modules which use them.
+</para>
+
+<para>There is standalone makefile for compilation with SER named
+<filename>Makefile.ser</filename>.</para>
+
+<section><title>Installation steps</title>
+<para>There is an example of steps which need to be done while installing SER
+with these libraries into directory /base/ser/directory (if no directory specified - 
+no prefix parameter given - default value is used: /usr/local/)
+<orderedlist>
+	<listitem><para>Download current ser sources:</para>
+	<para><userinput>cvs -d :pserver:[email protected]:/cvsroot/ser checkout sip_router</userinput>
+	</para></listitem>
+
+	<listitem><para>Compile and install libraries for usage with SER:</para>
+	<para><userinput>cd sip_router/lib</userinput></para>
+	<para><userinput>make -f Makefile.ser install prefix=/base/ser/directory</userinput></para>
+	</listitem>
+
+	<listitem><para>Compile and install SER</para>
+	<para><userinput>cd ..</userinput></para>
+	<para><userinput>make install prefix=/base/ser/directory</userinput></para>
+	</listitem>
+</orderedlist>
+</para>
+</section><!-- installation steps (with SER) -->
+
+<section><title>Running SER</title>
+<para>Linker used for dynamic linking must know, where to find these libraries.
+This may be done by setting <varname>LD_LIBRARY_PATH</varname> before
+startup.</para>
+<para><userinput>export LD_LIBRARY_PATH=/base/ser/directory/lib/ser</userinput></para>
+<para><userinput>/base/ser/directory/sbin/ser -f /base/ser/directory/etc/ser/ser.cfg</userinput></para>
+</section> <!-- running SER -->
+
+</section> <!-- installation with SER -->
+
+</chapter>
+
+</book>

+ 46 - 0
lib/presence/doc/presence.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'
+'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'[
+	<!ENTITY % local.common.attrib "xml:base  CDATA  #IMPLIED">
+]>
+
+<book lang="en">
+<bookinfo>
+	<title>Presence utilities and data types (libpresence)</title>
+	<author><firstname>Václav</firstname><surname>Kubart</surname></author>
+	<abstract><para>Description of helper Presence library.
+	</para></abstract>
+</bookinfo>
+
+<preface><title>Preface</title>
+<para>This library contains data structures for presence documents
+representation and helper functions.
+</para>
+
+<section><title>Conventions</title>
+<para>There is list of conventions used in this library:
+<itemizedlist>
+	<listitem><para>data types (structures, enums, ...) have their names with suffix 
+	<quote>_t</quote> (<structname>dstring_t</structname>, 
+	<structname>str_t</structname>, ...)</para></listitem>
+	<listitem><para>many functions have prefix according to data structure on
+	which are operating (like <function>dstr_append</function> which operates on
+	<structname>dstring_t</structname> data structure)</para></listitem>
+	<listitem><para>most functions return 0 as successful result and nonzero
+	value as error</para></listitem>
+</itemizedlist>
+</para>
+</section>
+
+<section id="libpresence.dependencies"><title>Dependencies</title>
+<para>
+<itemizedlist>
+	<listitem><para><application>libcds</application> (distributed with SER)</para></listitem>
+</itemizedlist>
+</para>
+</section>
+
+</preface>
+
+</book>

+ 49 - 0
lib/xcap/doc/xcap.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.2//EN'
+'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'[
+	<!ENTITY % local.common.attrib "xml:base  CDATA  #IMPLIED">
+]>
+
+<book lang="en">
+<bookinfo>
+	<title>XCAP operations (libxcap)</title>
+	<author><firstname>Václav</firstname><surname>Kubart</surname></author>
+	<abstract><para>Description of helper XCAP library.
+	</para></abstract>
+</bookinfo>
+
+<preface><title>Preface</title>
+<para>This library contains functions for manipulating data using XCAP protocol.
+</para>
+
+<section><title>Conventions</title>
+<para>There is list of conventions used in this library:
+<itemizedlist>
+	<listitem><para>data types (structures, enums, ...) have their names with suffix 
+	<quote>_t</quote> (<structname>dstring_t</structname>, 
+	<structname>str_t</structname>, ...)</para></listitem>
+	<listitem><para>many functions have prefix according to data structure on
+	which are operating (like <function>dstr_append</function> which operates on
+	<structname>dstring_t</structname> data structure)</para></listitem>
+	<listitem><para>most functions return 0 as successful result and nonzero
+	value as error</para></listitem>
+</itemizedlist>
+</para>
+</section>
+
+<section id="libxcap.dependencies"><title>Dependencies</title>
+<para>
+<itemizedlist>
+	<listitem><para><application>libcds</application> (distributed with SER)</para></listitem>
+	<listitem><para><application>libxml2</application> (external library for
+	parsing XML documents)</para></listitem>
+	<listitem><para><application>libcurl3</application> (external library for
+	HTTP operations)</para></listitem>
+</itemizedlist>
+</para>
+</section>
+
+</preface>
+
+</book>