<refentry id="camel-CamelKeyFile">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelKeyFile.top_of_page">CamelKeyFile</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelKeyFile</refname>
<refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv id="camel-CamelKeyFile.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
typedef             <link linkend="camel-block-t">camel_block_t</link>;
typedef             <link linkend="camel-key-t">camel_key_t</link>;
                    <link linkend="CamelBlockRoot">CamelBlockRoot</link>;
                    <link linkend="CamelBlock">CamelBlock</link>;
                    <link linkend="CamelBlockFile">CamelBlockFile</link>;
#define             <link linkend="CAMEL-BLOCK-FILE-SYNC--CAPS">CAMEL_BLOCK_FILE_SYNC</link>
#define             <link linkend="CAMEL-BLOCK-SIZE--CAPS">CAMEL_BLOCK_SIZE</link>
#define             <link linkend="CAMEL-BLOCK-SIZE-BITS--CAPS">CAMEL_BLOCK_SIZE_BITS</link>
#define             <link linkend="CAMEL-BLOCK-DIRTY--CAPS">CAMEL_BLOCK_DIRTY</link>
#define             <link linkend="CAMEL-BLOCK-DETACHED--CAPS">CAMEL_BLOCK_DETACHED</link>
<link linkend="CamelBlockFile">CamelBlockFile</link> *    <link linkend="camel-block-file-new">camel_block_file_new</link>                (const <link linkend="char">char</link> *path,
                                                         <link linkend="int">int</link> flags,
                                                         const <link linkend="char">char</link> version[8],
                                                         <link linkend="size-t">size_t</link> block_size);
<link linkend="int">int</link>                 <link linkend="camel-block-file-rename">camel_block_file_rename</link>             (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         const <link linkend="char">char</link> *path);
<link linkend="int">int</link>                 <link linkend="camel-block-file-delete">camel_block_file_delete</link>             (<link linkend="CamelBlockFile">CamelBlockFile</link> *kf);
<link linkend="CamelBlock">CamelBlock</link> *        <link linkend="camel-block-file-new-block">camel_block_file_new_block</link>          (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs);
<link linkend="int">int</link>                 <link linkend="camel-block-file-free-block">camel_block_file_free_block</link>         (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> id);
<link linkend="CamelBlock">CamelBlock</link> *        <link linkend="camel-block-file-get-block">camel_block_file_get_block</link>          (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> id);
<link linkend="void">void</link>                <link linkend="camel-block-file-detach-block">camel_block_file_detach_block</link>       (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);
<link linkend="void">void</link>                <link linkend="camel-block-file-attach-block">camel_block_file_attach_block</link>       (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);
<link linkend="void">void</link>                <link linkend="camel-block-file-touch-block">camel_block_file_touch_block</link>        (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);
<link linkend="void">void</link>                <link linkend="camel-block-file-unref-block">camel_block_file_unref_block</link>        (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);
<link linkend="int">int</link>                 <link linkend="camel-block-file-sync-block">camel_block_file_sync_block</link>         (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);
<link linkend="int">int</link>                 <link linkend="camel-block-file-sync">camel_block_file_sync</link>               (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs);
                    <link linkend="CamelKeyFile">CamelKeyFile</link>;
<link linkend="CamelKeyFile">CamelKeyFile</link> *      <link linkend="camel-key-file-new">camel_key_file_new</link>                  (const <link linkend="char">char</link> *path,
                                                         <link linkend="int">int</link> flags,
                                                         const <link linkend="char">char</link> version[8]);
<link linkend="int">int</link>                 <link linkend="camel-key-file-rename">camel_key_file_rename</link>               (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf,
                                                         const <link linkend="char">char</link> *path);
<link linkend="int">int</link>                 <link linkend="camel-key-file-delete">camel_key_file_delete</link>               (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf);
<link linkend="int">int</link>                 <link linkend="camel-key-file-write">camel_key_file_write</link>                (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf,
                                                         <link linkend="camel-block-t">camel_block_t</link> *parent,
                                                         <link linkend="size-t">size_t</link> len,
                                                         <link linkend="camel-key-t">camel_key_t</link> *records);
<link linkend="int">int</link>                 <link linkend="camel-key-file-read">camel_key_file_read</link>                 (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf,
                                                         <link linkend="camel-block-t">camel_block_t</link> *start,
                                                         <link linkend="size-t">size_t</link> *len,
                                                         <link linkend="camel-key-t">camel_key_t</link> **records);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelKeyFile.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="camel-CamelKeyFile.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="camel-block-t" role="typedef">
<title>camel_block_t</title>
<indexterm zone="camel-block-t"><primary sortas="camel_block_t">camel_block_t</primary></indexterm><programlisting>typedef guint32 camel_block_t;	/* block offset, absolute, bottom BLOCK_SIZE_BITS always 0 */
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-key-t" role="typedef">
<title>camel_key_t</title>
<indexterm zone="camel-key-t"><primary sortas="camel_key_t">camel_key_t</primary></indexterm><programlisting>typedef guint32 camel_key_t;	/* this is a bitfield of (block offset:BLOCK_SIZE_BITS) */
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelBlockRoot" role="struct">
<title>CamelBlockRoot</title>
<indexterm zone="CamelBlockRoot"><primary sortas="CamelBlockRoot">CamelBlockRoot</primary></indexterm><programlisting>typedef struct {
	char version[8];	/* version number */

	guint32 flags;		/* flags for file */
	guint32 block_size;	/* block size of this file */
	camel_block_t free;	/* free block list */
	camel_block_t last;	/* pointer to end of blocks */

	/* subclasses tack on, but no more than CAMEL_BLOCK_SIZE! */
} CamelBlockRoot;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelBlock" role="struct">
<title>CamelBlock</title>
<indexterm zone="CamelBlock"><primary sortas="CamelBlock">CamelBlock</primary></indexterm><programlisting>typedef struct {
	struct _CamelBlock *next;
	struct _CamelBlock *prev;

	camel_block_t id;
	guint32 flags;
	guint32 refcount;
	guint32 align00;

	unsigned char data[CAMEL_BLOCK_SIZE];
} CamelBlock;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CamelBlockFile" role="struct">
<title>CamelBlockFile</title>
<indexterm zone="CamelBlockFile"><primary sortas="CamelBlockFile">CamelBlockFile</primary></indexterm><programlisting>typedef struct {
	CamelObject parent;

	struct _CamelBlockFilePrivate *priv;

	char version[8];
	char *path;
	int flags;

	int fd;
	size_t block_size;

	CamelBlockRoot *root;
	CamelBlock *root_block;

	/* make private? */
	int block_cache_limit;
	int block_cache_count;
	CamelDList block_cache;
	GHashTable *blocks;
} CamelBlockFile;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CAMEL-BLOCK-FILE-SYNC--CAPS" role="macro">
<title>CAMEL_BLOCK_FILE_SYNC</title>
<indexterm zone="CAMEL-BLOCK-FILE-SYNC--CAPS"><primary sortas="CAMEL_BLOCK_FILE_SYNC">CAMEL_BLOCK_FILE_SYNC</primary></indexterm><programlisting>#define CAMEL_BLOCK_FILE_SYNC (1&lt;&lt;0)
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CAMEL-BLOCK-SIZE--CAPS" role="macro">
<title>CAMEL_BLOCK_SIZE</title>
<indexterm zone="CAMEL-BLOCK-SIZE--CAPS"><primary sortas="CAMEL_BLOCK_SIZE">CAMEL_BLOCK_SIZE</primary></indexterm><programlisting>#define CAMEL_BLOCK_SIZE (1024)
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CAMEL-BLOCK-SIZE-BITS--CAPS" role="macro">
<title>CAMEL_BLOCK_SIZE_BITS</title>
<indexterm zone="CAMEL-BLOCK-SIZE-BITS--CAPS"><primary sortas="CAMEL_BLOCK_SIZE_BITS">CAMEL_BLOCK_SIZE_BITS</primary></indexterm><programlisting>#define CAMEL_BLOCK_SIZE_BITS (10) /* # bits to contain block_size bytes */
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CAMEL-BLOCK-DIRTY--CAPS" role="macro">
<title>CAMEL_BLOCK_DIRTY</title>
<indexterm zone="CAMEL-BLOCK-DIRTY--CAPS"><primary sortas="CAMEL_BLOCK_DIRTY">CAMEL_BLOCK_DIRTY</primary></indexterm><programlisting>#define CAMEL_BLOCK_DIRTY (1&lt;&lt;0)
</programlisting>
<para>
</para></refsect2>
<refsect2 id="CAMEL-BLOCK-DETACHED--CAPS" role="macro">
<title>CAMEL_BLOCK_DETACHED</title>
<indexterm zone="CAMEL-BLOCK-DETACHED--CAPS"><primary sortas="CAMEL_BLOCK_DETACHED">CAMEL_BLOCK_DETACHED</primary></indexterm><programlisting>#define CAMEL_BLOCK_DETACHED (1&lt;&lt;1)
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-block-file-new" role="function">
<title>camel_block_file_new ()</title>
<indexterm zone="camel-block-file-new"><primary sortas="camel_block_file_new">camel_block_file_new</primary></indexterm><programlisting><link linkend="CamelBlockFile">CamelBlockFile</link> *    camel_block_file_new                (const <link linkend="char">char</link> *path,
                                                         <link linkend="int">int</link> flags,
                                                         const <link linkend="char">char</link> version[8],
                                                         <link linkend="size-t">size_t</link> block_size);</programlisting>
<para>
Allocate a new block file, stored at <parameter>path</parameter>.  <parameter>version</parameter> contains an 8 character
version string which must match the head of the file, or the file will be
intitialised.
</para>
<para>
<parameter>block_size</parameter> is currently ignored and is set to CAMEL_BLOCK_SIZE.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> 
@: 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>version</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>block_size</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The new block file, or NULL if it could not be created.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-rename" role="function">
<title>camel_block_file_rename ()</title>
<indexterm zone="camel-block-file-rename"><primary sortas="camel_block_file_rename">camel_block_file_rename</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_block_file_rename             (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         const <link linkend="char">char</link> *path);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-delete" role="function">
<title>camel_block_file_delete ()</title>
<indexterm zone="camel-block-file-delete"><primary sortas="camel_block_file_delete">camel_block_file_delete</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_block_file_delete             (<link linkend="CamelBlockFile">CamelBlockFile</link> *kf);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>kf</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-new-block" role="function">
<title>camel_block_file_new_block ()</title>
<indexterm zone="camel-block-file-new-block"><primary sortas="camel_block_file_new_block">camel_block_file_new_block</primary></indexterm><programlisting><link linkend="CamelBlock">CamelBlock</link> *        camel_block_file_new_block          (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs);</programlisting>
<para>
Allocate a new block, return a pointer to it.  Old blocks
may be flushed to disk during this call.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The block, or NULL if an error occured.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-free-block" role="function">
<title>camel_block_file_free_block ()</title>
<indexterm zone="camel-block-file-free-block"><primary sortas="camel_block_file_free_block">camel_block_file_free_block</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_block_file_free_block         (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> id);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-get-block" role="function">
<title>camel_block_file_get_block ()</title>
<indexterm zone="camel-block-file-get-block"><primary sortas="camel_block_file_get_block">camel_block_file_get_block</primary></indexterm><programlisting><link linkend="CamelBlock">CamelBlock</link> *        camel_block_file_get_block          (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="camel-block-t">camel_block_t</link> id);</programlisting>
<para>
Retreive a block <parameter>id</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> The block, or NULL if blockid is invalid or a file error
occured.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-detach-block" role="function">
<title>camel_block_file_detach_block ()</title>
<indexterm zone="camel-block-file-detach-block"><primary sortas="camel_block_file_detach_block">camel_block_file_detach_block</primary></indexterm><programlisting><link linkend="void">void</link>                camel_block_file_detach_block       (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);</programlisting>
<para>
Detatch a block from the block file's cache.  The block should
be unref'd or attached when finished with.  The block file will
perform no writes of this block or flushing of it if the cache
fills.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bl</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-attach-block" role="function">
<title>camel_block_file_attach_block ()</title>
<indexterm zone="camel-block-file-attach-block"><primary sortas="camel_block_file_attach_block">camel_block_file_attach_block</primary></indexterm><programlisting><link linkend="void">void</link>                camel_block_file_attach_block       (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);</programlisting>
<para>
Reattach a block that has been detached.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bl</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-touch-block" role="function">
<title>camel_block_file_touch_block ()</title>
<indexterm zone="camel-block-file-touch-block"><primary sortas="camel_block_file_touch_block">camel_block_file_touch_block</primary></indexterm><programlisting><link linkend="void">void</link>                camel_block_file_touch_block        (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);</programlisting>
<para>
Mark a block as dirty.  The block will be written to disk if
it ever expires from the cache.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bl</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-unref-block" role="function">
<title>camel_block_file_unref_block ()</title>
<indexterm zone="camel-block-file-unref-block"><primary sortas="camel_block_file_unref_block">camel_block_file_unref_block</primary></indexterm><programlisting><link linkend="void">void</link>                camel_block_file_unref_block        (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);</programlisting>
<para>
Mark a block as unused.  If a block is used it will not be
written to disk, or flushed from memory.
</para>
<para>
If a block is detatched and this is the last reference, the
block will be freed.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bl</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-sync-block" role="function">
<title>camel_block_file_sync_block ()</title>
<indexterm zone="camel-block-file-sync-block"><primary sortas="camel_block_file_sync_block">camel_block_file_sync_block</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_block_file_sync_block         (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs,
                                                         <link linkend="CamelBlock">CamelBlock</link> *bl);</programlisting>
<para>
Flush a block to disk immediately.  The block will only
be flushed to disk if it is marked as dirty (touched).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>bl</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on io error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-block-file-sync" role="function">
<title>camel_block_file_sync ()</title>
<indexterm zone="camel-block-file-sync"><primary sortas="camel_block_file_sync">camel_block_file_sync</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_block_file_sync               (<link linkend="CamelBlockFile">CamelBlockFile</link> *bs);</programlisting>
<para>
Sync all dirty blocks to disk, including the root block.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>bs</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on io error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="CamelKeyFile" role="struct">
<title>CamelKeyFile</title>
<indexterm zone="CamelKeyFile"><primary sortas="CamelKeyFile">CamelKeyFile</primary></indexterm><programlisting>typedef struct {
	CamelObject parent;

	struct _CamelKeyFilePrivate *priv;

	FILE *fp;
	char *path;
	int flags;
	off_t last;
} CamelKeyFile;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-key-file-new" role="function">
<title>camel_key_file_new ()</title>
<indexterm zone="camel-key-file-new"><primary sortas="camel_key_file_new">camel_key_file_new</primary></indexterm><programlisting><link linkend="CamelKeyFile">CamelKeyFile</link> *      camel_key_file_new                  (const <link linkend="char">char</link> *path,
                                                         <link linkend="int">int</link> flags,
                                                         const <link linkend="char">char</link> version[8]);</programlisting>
<para>
Create a new key file.  A linked list of record blocks.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara> open flags
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>version</parameter>&#160;:</term>
<listitem><simpara> Version string (header) of file.  Currently
written but not checked.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A new key file, or NULL if the file could not
be opened/created/initialised.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-file-rename" role="function">
<title>camel_key_file_rename ()</title>
<indexterm zone="camel-key-file-rename"><primary sortas="camel_key_file_rename">camel_key_file_rename</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_key_file_rename               (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf,
                                                         const <link linkend="char">char</link> *path);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>kf</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-file-delete" role="function">
<title>camel_key_file_delete ()</title>
<indexterm zone="camel-key-file-delete"><primary sortas="camel_key_file_delete">camel_key_file_delete</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_key_file_delete               (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf);</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>kf</parameter>&#160;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-file-write" role="function">
<title>camel_key_file_write ()</title>
<indexterm zone="camel-key-file-write"><primary sortas="camel_key_file_write">camel_key_file_write</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_key_file_write                (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf,
                                                         <link linkend="camel-block-t">camel_block_t</link> *parent,
                                                         <link linkend="size-t">size_t</link> len,
                                                         <link linkend="camel-key-t">camel_key_t</link> *records);</programlisting>
<para>
Write a new list of records to the key file.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>kf</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>parent</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>records</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on io error.  The key file will remain unchanged.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-key-file-read" role="function">
<title>camel_key_file_read ()</title>
<indexterm zone="camel-key-file-read"><primary sortas="camel_key_file_read">camel_key_file_read</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_key_file_read                 (<link linkend="CamelKeyFile">CamelKeyFile</link> *kf,
                                                         <link linkend="camel-block-t">camel_block_t</link> *start,
                                                         <link linkend="size-t">size_t</link> *len,
                                                         <link linkend="camel-key-t">camel_key_t</link> **records);</programlisting>
<para>
Read the next block of data from the key file.  Returns the number of
records.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>kf</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>start</parameter>&#160;:</term>
<listitem><simpara> The record pointer.  This will be set to the next record pointer on success.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter>&#160;:</term>
<listitem><simpara> Number of records read, if != NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>records</parameter>&#160;:</term>
<listitem><simpara> Records, allocated, must be freed with g_free, if != NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on io error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
