#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "boris.h"
#include "plugin.h"

Go to the source code of this file.
Data Structures | |
| struct | fdb_iterator |
| handle used for iteration of all records of a particular domain. More... | |
| struct | fdb_read_handle |
| handle used for reading a record. More... | |
| struct | fdb_write_handle |
| handle used for writing. More... | |
| struct | plugin_fdb_class |
| class definition. More... | |
Defines | |
| #define | FDB_VALUE_MAX 4096 |
| #define | MKDIR(d) mkdir(d, 0777) |
| #define | PERROR(m) perror(m) |
| #define | VERBOSE printf |
Functions | |
| static char * | fdb_basepath (const char *domain) |
| generate the directory used for a domain. | |
| static int | fdb_domain_init (const char *domain) |
| initializes a domain. | |
| static int | fdb_istempname (const char *filename) |
| checks to see if filename is a temp filename. | |
| static struct fdb_iterator * | fdb_iterator_begin (const char *domain) |
| get an iterator that lists all records in domain. | |
| static void | fdb_iterator_end (struct fdb_iterator *it) |
| finish the iterator. | |
| static const char * | fdb_iterator_next (struct fdb_iterator *it) |
| get id of record. | |
| static char * | fdb_makepath (const char *domain, const char *id) |
| creates a filename name. | |
| static char * | fdb_makepath_tmp (const char *domain, const char *id) |
| creates a temporary name. | |
| static int | fdb_parse_line (char *line, const char **name, const char **value) |
| modifies line and points name and value to the correct positions. | |
| static struct fdb_read_handle * | fdb_read_begin (const char *domain, const char *id) |
| start reading. | |
| static struct fdb_read_handle * | fdb_read_begin_uint (const char *domain, unsigned id) |
| static int | fdb_read_end (struct fdb_read_handle *h) |
| end reading process, close the file and free the handle. | |
| static void | fdb_read_handle_free (struct fdb_read_handle *h) |
| frees a read handle. | |
| static int | fdb_read_next (struct fdb_read_handle *h, const char **name, const char **value) |
| read a line of data from the file. | |
| static void | fdb_write_abort (struct fdb_write_handle *h) |
| terminate the creation of this record. | |
| static struct fdb_write_handle * | fdb_write_begin (const char *domain, const char *id) |
| open the file and start writing to it. | |
| static struct fdb_write_handle * | fdb_write_begin_uint (const char *domain, unsigned id) |
| same as fdb_write_begin() but takes a uint. | |
| static int | fdb_write_end (struct fdb_write_handle *h) |
| move the temp file over the real file then close it. | |
| static int | fdb_write_format (struct fdb_write_handle *h, const char *name, const char *value_fmt,...) |
| write a string to an open record. | |
| static void | fdb_write_handle_free (struct fdb_write_handle *h) |
| frees a write handle. | |
| static int | fdb_write_pair (struct fdb_write_handle *h, const char *name, const char *value_str) |
| write a string to an open record. | |
| static int | initialize (void) |
| static int | ishex (const char code[2]) |
| return true if 2 characters are valid hexidecimal. | |
| static int | shutdown (void) |
| static void | unescape (char *str) |
| process XX escapes in-place. | |
| static unsigned | unhex (const char code[2]) |
| verify with ishex() before calling. | |
Variables | |
| struct plugin_fdb_class | plugin_class |
Definition in file fdbfile.c.
| static char* fdb_basepath | ( | const char * | domain | ) | [static] |
| static int fdb_domain_init | ( | const char * | domain | ) | [static] |
| static int fdb_istempname | ( | const char * | filename | ) | [static] |
| static struct fdb_iterator* fdb_iterator_begin | ( | const char * | domain | ) | [static, read] |
| static void fdb_iterator_end | ( | struct fdb_iterator * | it | ) | [static] |
| static const char* fdb_iterator_next | ( | struct fdb_iterator * | it | ) | [static] |
| static char* fdb_makepath | ( | const char * | domain, | |
| const char * | id | |||
| ) | [static] |
| static char* fdb_makepath_tmp | ( | const char * | domain, | |
| const char * | id | |||
| ) | [static] |
| static int fdb_parse_line | ( | char * | line, | |
| const char ** | name, | |||
| const char ** | value | |||
| ) | [static] |
| static struct fdb_read_handle* fdb_read_begin | ( | const char * | domain, | |
| const char * | id | |||
| ) | [static, read] |
| static struct fdb_read_handle* fdb_read_begin_uint | ( | const char * | domain, | |
| unsigned | id | |||
| ) | [static, read] |
| static int fdb_read_end | ( | struct fdb_read_handle * | h | ) | [static] |
| static void fdb_read_handle_free | ( | struct fdb_read_handle * | h | ) | [static] |
| static int fdb_read_next | ( | struct fdb_read_handle * | h, | |
| const char ** | name, | |||
| const char ** | value | |||
| ) | [static] |
| static void fdb_write_abort | ( | struct fdb_write_handle * | h | ) | [static] |
terminate the creation of this record.
it is still necessary to call fdb_write_end()
| static struct fdb_write_handle* fdb_write_begin | ( | const char * | domain, | |
| const char * | id | |||
| ) | [static, read] |
| static struct fdb_write_handle* fdb_write_begin_uint | ( | const char * | domain, | |
| unsigned | id | |||
| ) | [static, read] |
same as fdb_write_begin() but takes a uint.
Definition at line 263 of file fdbfile.c.

| static int fdb_write_end | ( | struct fdb_write_handle * | h | ) | [static] |
| static int fdb_write_format | ( | struct fdb_write_handle * | h, | |
| const char * | name, | |||
| const char * | value_fmt, | |||
| ... | ||||
| ) | [static] |
write a string to an open record.
this interface is limited to FDB_VALUE_MAX. you can only use a name once per transaction (begin/end)
< holds the largest possible value.
Definition at line 326 of file fdbfile.c.

| static void fdb_write_handle_free | ( | struct fdb_write_handle * | h | ) | [static] |
| static int fdb_write_pair | ( | struct fdb_write_handle * | h, | |
| const char * | name, | |||
| const char * | value_str | |||
| ) | [static] |
| static int initialize | ( | void | ) | [static] |
| static int ishex | ( | const char | code[2] | ) | [static] |
| static int shutdown | ( | void | ) | [static] |
| static void unescape | ( | char * | str | ) | [static] |
| static unsigned unhex | ( | const char | code[2] | ) | [static] |
struct plugin_fdb_class plugin_class [read] |
Initial value:
{
.base_class = { PLUGIN_API, "fdb", initialize, shutdown },
.fdb_interface = {
fdb_domain_init,
fdb_write_begin,
fdb_write_begin_uint,
fdb_write_pair,
fdb_write_format,
fdb_write_end,
fdb_write_abort,
fdb_read_begin,
fdb_read_begin_uint,
fdb_read_next,
fdb_read_end,
fdb_iterator_begin,
fdb_iterator_next,
fdb_iterator_end,
},
}
1.5.8