1 /***************************************************************************
2 template.c - Skeleton of backends to access the Key Database
4 begin : Mon Dec 26 2004
5 copyright : (C) 2004 by Avi Alkalay
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the BSD License (revised). *
14 ***************************************************************************/
18 /***************************************************************************
20 * This is the skeleton of the methods you'll have to implement in order *
21 * to provide libelektra.so a valid backend. *
22 * Simple fill the empty _template functions with your code and you are *
25 ***************************************************************************/
30 int kdbOpen_template(KDB *handle)
32 int errnosave = errno;
33 KDBCap *cap = kdbhGetCapability (handle);
67 /* backend initialization logic */
73 int kdbClose_template(KDB *handle)
75 int errnosave = errno;
76 /* free all backend resources and shut it down */
79 return 0; /* success */
82 ssize_t kdbGet_template(KDB *handle, KeySet *returned, const Key *parentKey)
85 int errnosave = errno;
87 /* get all keys below parentKey and count them with nr_keys */
90 return nr_keys; /* success */
93 ssize_t kdbSet_template(KDB *handle, KeySet *returned, const Key *parentKey)
96 int errnosave = errno;
98 /* set all keys below parentKey and count them with nr_keys */
106 return kdbBackendExport(BACKENDNAME,
107 KDB_BE_OPEN, &kdbOpen_template,
108 KDB_BE_CLOSE, &kdbClose_template,
109 KDB_BE_GET, &kdbGet_template,
110 KDB_BE_SET, &kdbSet_template,
111 KDB_BE_VERSION, BACKENDVERSION,
112 KDB_BE_AUTHOR, "Full Name <email@libelektra.org>",
113 KDB_BE_LICENCE, "BSD",
115 "Add description here",