Sophie

Sophie

distrib > Fedora > 13 > x86_64 > by-pkgid > 1f68756f2311732dff7a7e2ea2a48123 > files > 38

elektra-devel-0.7.0-3.fc13.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Elektra Projekt: Streaming</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Streaming</h1>
<p>Methods to output, generate and toXML Keys and Keysets.  
<a href="#_details">More...</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga0f01b410963104a39a8c0109c339d1cd">KDBStream</a> { <br/>
&nbsp;&nbsp;<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdaf108bbeaf014509dccbe4098a828d71a">KDB_O_SHOWMETA</a> = 0xF0, 
<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda1f8f6dde6172b89e07c3a3be222da2c6">KDB_O_SHOWFLAGS</a> = 1&lt;&lt;14, 
<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda7ed84255e173af98655d16c480e324bf">KDB_O_SHOWINDICES</a> = 1&lt;&lt;15, 
<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdaf13abb6e6831a159418bd71ef05cfdd2">KDB_O_CONDENSED</a> = 1&lt;&lt;16, 
<br/>
&nbsp;&nbsp;<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda7df0465c4d5d6c3e063860e7ce6205d9">KDB_O_NUMBER</a> = 1&lt;&lt;17, 
<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdab7831d9df99114658de58990c5158d29">KDB_O_HEADER</a> = 1&lt;&lt;18, 
<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda51691743e0c71a19d885bfd39b696b3d">KDB_O_FULLNAME</a> = 1&lt;&lt;19, 
<a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdac1ce72f70ae166f80235020660c1c856">KDB_O_HIER</a> = 1&lt;&lt;20
<br/>
 }</td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga68078d5ed73459629e01a228503e6821">ksFromXMLfile</a> (KeySet *ks, const char *filename)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga2fb7bd97dbf4fcaeb7d75efb6cad45d8">ksFromXML</a> (KeySet *ks, int fd)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">ssize_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#gaba86ec51ba1abc125372c5519abd45a9">keyToStream</a> (const Key *key, FILE *stream, option_t options)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">ssize_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga32b9dcebc110c4bf69d9c08ca9f96400">keyToStreamBasename</a> (const Key *key, FILE *stream, const char *parent, const size_t parentSize, option_t options)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">ssize_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga7766ffe8c534fa7154a74fd26bd974f3">ksToStream</a> (const KeySet *ks, FILE *stream, option_t options)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga4eb79e22d81302283ef9acda19b372f5">keyOutput</a> (const Key *k, FILE *stream, option_t options)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga45ae77a71186960d05d4e39f47184cb1">ksOutput</a> (const KeySet *ks, FILE *stream, option_t options)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga7522c446271b79d62db8e52157495f40">keyGenerate</a> (const Key *key, FILE *stream, option_t options)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__stream.html#ga4a4eb7b7cfea5e2faef99ac331eb15e2">ksGenerate</a> (const KeySet *ks, FILE *stream, option_t options)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Methods to output, generate and toXML Keys and Keysets. </p>
<p>Here are some functions that are in a separate library because they depend on non-basic libraries as libxml. Link against kdbtools library if your program won't be installed in /bin, or is not essential in early boot stages.</p>
<p>It is also possible to have a dynamic linkage, see the sourcecode from kdb-tool or testing framework how to achieve that.</p>
<p>Output prints keys line per line, meaned to be read by humans.</p>
<ul>
<li><a class="el" href="group__stream.html#ga4eb79e22d81302283ef9acda19b372f5">keyOutput()</a></li>
<li><a class="el" href="group__stream.html#ga45ae77a71186960d05d4e39f47184cb1">ksOutput()</a></li>
</ul>
<p>Generate prints keys and keysets as C-Structs, meaned to be read by a C-Compiler.</p>
<ul>
<li><a class="el" href="group__stream.html#ga7522c446271b79d62db8e52157495f40">keyGenerate()</a></li>
<li><a class="el" href="group__stream.html#ga4a4eb7b7cfea5e2faef99ac331eb15e2">ksGenerate()</a></li>
</ul>
<p>toXML prints keys and keysets as XML, meaned to be used as exchange format.</p>
<ul>
<li><a class="el" href="group__stream.html#gaba86ec51ba1abc125372c5519abd45a9">keyToStream()</a></li>
<li><a class="el" href="group__stream.html#ga7766ffe8c534fa7154a74fd26bd974f3">ksToStream()</a></li>
</ul>
<p>To use them: </p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;kdbtools.h&gt;</span>
</pre></div> <hr/><h2>Enumeration Type Documentation</h2>
<a class="anchor" id="ga0f01b410963104a39a8c0109c339d1cd"></a><!-- doxytag: member="kdbtools.h::KDBStream" ref="ga0f01b410963104a39a8c0109c339d1cd" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__stream.html#ga0f01b410963104a39a8c0109c339d1cd">KDBStream</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Options to change the default behavior of streaming.</p>
<p>On default the streaming options only output the names of the given keysets. If you want more information, header, metainfo, compressed output, full names, values or comments you will find the appropriate options here.</p>
<p>For full influence of value, comment and metadata shown, use these options together with keyswitch_t. All bits of meta-information ORed together are KDB_O_SHOWMETA.</p>
<p>For more information about the flags, consult the documentation of the streaming methods.</p>
<p>These options can be ORed. That is the |-Operator in C.</p>
<p>It uses the values defined in keyswitch_t too, so it starts with 14.</p>
<dl class="see"><dt><b>See also:</b></dt><dd>kdbGetChildKeys() </dd>
<dd>
<a class="el" href="group__stream.html#ga7766ffe8c534fa7154a74fd26bd974f3">ksToStream()</a> </dd>
<dd>
<a class="el" href="group__stream.html#gaba86ec51ba1abc125372c5519abd45a9">keyToStream()</a> </dd></dl>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cdaf108bbeaf014509dccbe4098a828d71a"></a><!-- doxytag: member="KDB_O_SHOWMETA" ref="gga0f01b410963104a39a8c0109c339d1cdaf108bbeaf014509dccbe4098a828d71a" args="" -->KDB_O_SHOWMETA</em>&nbsp;</td><td>
<p>Show all metadata (type, uid, gid, mode) </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cda1f8f6dde6172b89e07c3a3be222da2c6"></a><!-- doxytag: member="KDB_O_SHOWFLAGS" ref="gga0f01b410963104a39a8c0109c339d1cda1f8f6dde6172b89e07c3a3be222da2c6" args="" -->KDB_O_SHOWFLAGS</em>&nbsp;</td><td>
<p>Show all flags </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cda7ed84255e173af98655d16c480e324bf"></a><!-- doxytag: member="KDB_O_SHOWINDICES" ref="gga0f01b410963104a39a8c0109c339d1cda7ed84255e173af98655d16c480e324bf" args="" -->KDB_O_SHOWINDICES</em>&nbsp;</td><td>
<p>Show the indices for the entries </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cdaf13abb6e6831a159418bd71ef05cfdd2"></a><!-- doxytag: member="KDB_O_CONDENSED" ref="gga0f01b410963104a39a8c0109c339d1cdaf13abb6e6831a159418bd71ef05cfdd2" args="" -->KDB_O_CONDENSED</em>&nbsp;</td><td>
<p>Spare any whitespaces and do not group visually together. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cda7df0465c4d5d6c3e063860e7ce6205d9"></a><!-- doxytag: member="KDB_O_NUMBER" ref="gga0f01b410963104a39a8c0109c339d1cda7df0465c4d5d6c3e063860e7ce6205d9" args="" -->KDB_O_NUMBER</em>&nbsp;</td><td>
<p>Use a number intead of user and group name. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cdab7831d9df99114658de58990c5158d29"></a><!-- doxytag: member="KDB_O_HEADER" ref="gga0f01b410963104a39a8c0109c339d1cdab7831d9df99114658de58990c5158d29" args="" -->KDB_O_HEADER</em>&nbsp;</td><td>
<p>Show also the header of the document. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cda51691743e0c71a19d885bfd39b696b3d"></a><!-- doxytag: member="KDB_O_FULLNAME" ref="gga0f01b410963104a39a8c0109c339d1cda51691743e0c71a19d885bfd39b696b3d" args="" -->KDB_O_FULLNAME</em>&nbsp;</td><td>
<p>Export <code>user</code> keys using full name. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="gga0f01b410963104a39a8c0109c339d1cdac1ce72f70ae166f80235020660c1c856"></a><!-- doxytag: member="KDB_O_HIER" ref="gga0f01b410963104a39a8c0109c339d1cdac1ce72f70ae166f80235020660c1c856" args="" -->KDB_O_HIER</em>&nbsp;</td><td>
<p>Export to the new hierarchical XML representation using key basename. See <a class="el" href="group__stream.html#ga7766ffe8c534fa7154a74fd26bd974f3">ksToStream()</a>. </p>
</td></tr>
</table>
</dd>
</dl>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga7522c446271b79d62db8e52157495f40"></a><!-- doxytag: member="stream.c::keyGenerate" ref="ga7522c446271b79d62db8e52157495f40" args="(const Key *key, FILE *stream, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int keyGenerate </td>
          <td>(</td>
          <td class="paramtype">const Key *&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Generate a C-Style key and stream it.</p>
<p>This keyset can be used to include as c-code for applikations using elektra.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>the key object to work with </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the file pointer where to send the stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>KDB_O_SHOWINDICES, KDB_O_IGNORE_COMMENT, KDB_O_SHOWINFO </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success </dd></dl>

</div>
</div>
<a class="anchor" id="ga4eb79e22d81302283ef9acda19b372f5"></a><!-- doxytag: member="stream.c::keyOutput" ref="ga4eb79e22d81302283ef9acda19b372f5" args="(const Key *k, FILE *stream, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int keyOutput </td>
          <td>(</td>
          <td class="paramtype">const Key *&nbsp;</td>
          <td class="paramname"> <em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Output every information of a single key depending on options.</p>
<p>The format is not very strict and only intend to be read by human eyes for debugging purposes. Don't rely on the format in your applications.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>k</em>&nbsp;</td><td>the key object to work with </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the file pointer where to send the stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>see text above </td></tr>
  </table>
  </dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__stream.html#ga45ae77a71186960d05d4e39f47184cb1">ksOutput()</a> </dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success </dd>
<dd>
-1 on allocation errors </dd></dl>

</div>
</div>
<a class="anchor" id="gaba86ec51ba1abc125372c5519abd45a9"></a><!-- doxytag: member="stream.c::keyToStream" ref="gaba86ec51ba1abc125372c5519abd45a9" args="(const Key *key, FILE *stream, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ssize_t keyToStream </td>
          <td>(</td>
          <td class="paramtype">const Key *&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Prints an XML representation of the key.</p>
<p>String generated is of the form: </p>
<div class="fragment"><pre class="fragment">
	&lt;key name="system/sw/xorg/Monitor/Monitor0/Name"
		type="string" uid="root" gid="root" mode="0660"&gt;

		&lt;value&gt;Samsung TFT panel&lt;/value&gt;
		&lt;comment&gt;My monitor&lt;/comment&gt;
	&lt;/key&gt;</pre></div><div class="fragment"><pre class="fragment">
	&lt;key parent="system/sw/xorg/Monitor/Monitor0" basename="Name"
		type="string" uid="root" gid="root" mode="0660"&gt;

		&lt;value&gt;Samsung TFT panel&lt;/value&gt;
		&lt;comment&gt;My monitor&lt;/comment&gt;
	&lt;/key&gt;</pre></div><dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>the key object to work with </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>where to write output: a file or stdout </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>Some option_t ORed:</p>
<ul>
<li><code>option_t::KDB_O_NUMBERS</code> <br/>
 Do not convert UID and GID into user and group names</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdaf13abb6e6831a159418bd71ef05cfdd2">option_t::KDB_O_CONDENSED</a></code> <br/>
 Less human readable, more condensed output</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda51691743e0c71a19d885bfd39b696b3d">option_t::KDB_O_FULLNAME</a></code> <br/>
 The <code>user</code> keys are exported with their full names (including user domains)</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__stream.html#ga7766ffe8c534fa7154a74fd26bd974f3">ksToStream()</a> </dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes written to output </dd></dl>

</div>
</div>
<a class="anchor" id="ga32b9dcebc110c4bf69d9c08ca9f96400"></a><!-- doxytag: member="stream.c::keyToStreamBasename" ref="ga32b9dcebc110c4bf69d9c08ca9f96400" args="(const Key *key, FILE *stream, const char *parent, const size_t parentSize, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ssize_t keyToStreamBasename </td>
          <td>(</td>
          <td class="paramtype">const Key *&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const size_t&nbsp;</td>
          <td class="paramname"> <em>parentSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Same as <a class="el" href="group__stream.html#gaba86ec51ba1abc125372c5519abd45a9">keyToStream()</a> but tries to strip <code>parentSize</code> bytes from <code>key</code> name if it matches <code>parent</code> .</p>
<p>Taking the example from <a class="el" href="group__stream.html#gaba86ec51ba1abc125372c5519abd45a9">keyToStream()</a>, if <code>parent</code> is <code>"system/sw/xorg"</code>, the generated string is of the form: </p>
<div class="fragment"><pre class="fragment">
	&lt;key basename="Monitor/Monitor0/Name"
		type="string" uid="root" gid="root" mode="0660"&gt;

		&lt;value&gt;Samsung TFT panel&lt;/value&gt;
		&lt;comment&gt;My monitor&lt;/comment&gt;
	&lt;/key&gt;</pre></div><p>It usefull to produce more human readable XML output of a key when it is being represented in a context that defines the parent key name. For example:</p>
<div class="fragment"><pre class="fragment">
	&lt;keyset parent="user/sw"&gt;
		&lt;key basename="kdbedit"..../&gt;
		&lt;key basename="phototools"..../&gt;
		&lt;key basename="myapp"..../&gt;
	&lt;/keyset&gt;</pre></div><p>In the bove example, each <code>&lt;key&gt;</code> entry was generated by a call to <a class="el" href="group__stream.html#ga32b9dcebc110c4bf69d9c08ca9f96400">keyToStreamBasename()</a> having <code>"user/sw"</code> as <code>parent</code> .</p>
<p>This method is used when <a class="el" href="group__stream.html#ga7766ffe8c534fa7154a74fd26bd974f3">ksToStream()</a> is called with <a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdac1ce72f70ae166f80235020660c1c856">KDBOption::KDB_O_HIER</a> option.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>the key object to work with </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the FILE where to send the stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parentSize</em>&nbsp;</td><td>the maximum size of <code>parent</code> that will be used. If 0, the entire <code>parent</code> will be used. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>parent</em>&nbsp;</td><td>the string (or part of it, defined by <code>parentSize</code> ) that will be used to strip from the key name. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>Some option_t ORed:</p>
<ul>
<li><code>option_t::KDB_O_NUMBERS</code> <br/>
 Do not convert UID and GID into user and group names</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdaf13abb6e6831a159418bd71ef05cfdd2">option_t::KDB_O_CONDENSED</a></code> <br/>
 Less human readable, more condensed output</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda51691743e0c71a19d885bfd39b696b3d">option_t::KDB_O_FULLNAME</a></code> <br/>
 The <code>user</code> keys are exported with their full names (including user domains)</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes written to output </dd></dl>

</div>
</div>
<a class="anchor" id="ga2fb7bd97dbf4fcaeb7d75efb6cad45d8"></a><!-- doxytag: member="kdbtools.c::ksFromXML" ref="ga2fb7bd97dbf4fcaeb7d75efb6cad45d8" args="(KeySet *ks, int fd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ksFromXML </td>
          <td>(</td>
          <td class="paramtype">KeySet *&nbsp;</td>
          <td class="paramname"> <em>ks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>fd</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>FIXME: not working when fd is stdin Given a file descriptor (that can be <code>stdin</code>) for an XML file, validate schema, process nodes, convert and save it in the <code>ks</code> KeySet.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>keyset </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>fd</em>&nbsp;</td><td>Filedeskriptor?? should be FILE* </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga68078d5ed73459629e01a228503e6821"></a><!-- doxytag: member="kdbtools.c::ksFromXMLfile" ref="ga68078d5ed73459629e01a228503e6821" args="(KeySet *ks, const char *filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ksFromXMLfile </td>
          <td>(</td>
          <td class="paramtype">KeySet *&nbsp;</td>
          <td class="paramname"> <em>ks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>filename</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Given an XML <code>filename</code>, open it, validate schema, process nodes, convert and save it in the <code>ks</code> KeySet.</p>
<p>Currently, the XML file can have many root <code>&lt;keyset&gt;</code> and <code>&lt;key&gt;</code> nodes. They will all be reduced to simple keys returned in <code>ks</code>.</p>
<p>To check if the xml file is valid (best before you read from it): </p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include </span>
<span class="preprocessor"></span><span class="keywordtype">char</span> schemaPath[513];
schemaPath[0]=0;
ret=<a class="code" href="group__kdbhighlevel.html#ga1e1b1a2beace8c9ce93d16259564b51f">kdbGetString</a>(handle, KDB_SCHEMA_PATH_KEY,schemaPath,<span class="keyword">sizeof</span>(schemaPath));

<span class="keywordflow">if</span> (ret==0) ret = isValidXML(filename,schemaPath);
<span class="keywordflow">else</span> ret = isValidXML(filename,KDB_SCHEMA_PATH); 
</pre></div><dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>the keyset </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>the file to parse </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga4a4eb7b7cfea5e2faef99ac331eb15e2"></a><!-- doxytag: member="stream.c::ksGenerate" ref="ga4a4eb7b7cfea5e2faef99ac331eb15e2" args="(const KeySet *ks, FILE *stream, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ksGenerate </td>
          <td>(</td>
          <td class="paramtype">const KeySet *&nbsp;</td>
          <td class="paramname"> <em>ks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Generate a C-Style keyset and stream it.</p>
<p>This keyset can be used to include as c-code for applikations using elektra.</p>
<p>The options takes the same options as <a class="el" href="group__kdb.html#ga37b44bda1b83bc0144916bf21a86c1b5">kdbGet()</a> and <a class="el" href="group__kdb.html#ga953cf29721e6000c2516cd6b5d36f571">kdbSet()</a>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>the keyset to work with </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the file pointer where to send the stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>which keys not to output </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success </dd></dl>

</div>
</div>
<a class="anchor" id="ga45ae77a71186960d05d4e39f47184cb1"></a><!-- doxytag: member="stream.c::ksOutput" ref="ga45ae77a71186960d05d4e39f47184cb1" args="(const KeySet *ks, FILE *stream, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ksOutput </td>
          <td>(</td>
          <td class="paramtype">const KeySet *&nbsp;</td>
          <td class="paramname"> <em>ks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Output all information of a keyset.</p>
<p>The format is not very strict and only intend to be read by human eyes for debugging purposes. Don't rely on the format in your applications.</p>
<p>Keys are printed line per line with <a class="el" href="group__stream.html#ga4eb79e22d81302283ef9acda19b372f5">keyOutput()</a>.</p>
<p>The same options as <a class="el" href="group__stream.html#ga4eb79e22d81302283ef9acda19b372f5">keyOutput()</a> are taken and passed to them.</p>
<p>Additional KDB_O_HEADER will print the number of keys as first line.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>the keyset to work with </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the file pointer where to send the stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__stream.html#ga4eb79e22d81302283ef9acda19b372f5">keyOutput()</a> </dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>1 on success </dd>
<dd>
-1 on allocation errors </dd></dl>

</div>
</div>
<a class="anchor" id="ga7766ffe8c534fa7154a74fd26bd974f3"></a><!-- doxytag: member="stream.c::ksToStream" ref="ga7766ffe8c534fa7154a74fd26bd974f3" args="(const KeySet *ks, FILE *stream, option_t options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ssize_t ksToStream </td>
          <td>(</td>
          <td class="paramtype">const KeySet *&nbsp;</td>
          <td class="paramname"> <em>ks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">option_t&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Writes to <code>stream</code> an XML version of the <code>ks</code> object.</p>
<p>String generated is of the form: </p>
<div class="fragment"><pre class="fragment">
&lt;keyset&gt;
&lt;key name=...&gt;...&lt;/key&gt;
&lt;key name=...&gt;...&lt;/key&gt;
&lt;key name=...&gt;...&lt;/key&gt;

&lt;/keyset&gt;
 * </pre></div><p>or if KDB_O_HIER is used, the form will be: </p>
<div class="fragment"><pre class="fragment">
&lt;keyset parent="user/smallest/parent/name"&gt;

&lt;key basename=...&gt;...&lt;/key&gt;
&lt;key name=...&gt;...&lt;/key&gt; &lt;!-- a key thats not under this keyset's parent --&gt;
&lt;key basename=...&gt;...&lt;/key&gt;

&lt;/keyset&gt;
 * </pre></div><p>KDB_O_HEADER will additionally generate a header like: </p>
<div class="fragment"><pre class="fragment">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!-- Generated by Elektra API. Total of n keys. --&gt;
&lt;keyset xmlns="http://www.libelektra.org"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.libelektra.org elektra.xsd"&gt;
 * </pre></div><dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>the KeySet to serialize </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>where to write output: a file or stdout </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>accepted option_t ORed:</p>
<ul>
<li><code>option_t::KDB_O_NUMBERS</code> <br/>
 Do not convert UID and GID into user and group names.</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cda51691743e0c71a19d885bfd39b696b3d">option_t::KDB_O_FULLNAME</a></code> <br/>
 The <code>user</code> keys are exported with their full names (including user domains)</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdaf13abb6e6831a159418bd71ef05cfdd2">option_t::KDB_O_CONDENSED</a></code> <br/>
 Less human readable, more condensed output.</li>
<li><code>option_t::KDB_O_XMLHEADERS</code> <br/>
 Exclude the correct XML headers in the output. If not used, the &lt;?xml?&gt; and schema info inside the &lt;keyset&gt; object will not be generated.</li>
<li><code><a class="el" href="group__stream.html#gga0f01b410963104a39a8c0109c339d1cdac1ce72f70ae166f80235020660c1c856">option_t::KDB_O_HIER</a></code> <br/>
 Will generate a &lt;keyset&gt; node containing a <code>parent</code> attribute, and &lt;key&gt; nodes with a <code>basename</code> relative to that <code>parent</code>. The <code>parent</code> is calculated by taking the smallest key name in the keyset, so it is a good idea to have only related keys on the keyset. Otherwise, a valid consistent XML document still will be generated with regular absolute <code>name</code> attribute for the &lt;key&gt; nodes, due to a clever <a class="el" href="group__stream.html#ga32b9dcebc110c4bf69d9c08ca9f96400">keyToStreamBasename()</a> implementation.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__stream.html#gaba86ec51ba1abc125372c5519abd45a9">keyToStream()</a> </dd>
<dd>
commandList() for usage example </dd></dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes written to output, or -1 if some error occurs</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ks</em>&nbsp;</td><td>The keyset to output </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>the file pointer where to send the stream </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>see above text </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 8 Nov 2009 for Elektra Projekt by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>