kdbprivate.h

00001 /***************************************************************************
00002       kdbprivate.h  -  Private classes definition
00003                            -------------------
00004     begin                : Mon Apr 12 2004
00005     copyright            : (C) 2004 by Avi Alkalay
00006     email                : avi@unix.sh
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the BSD License (revised).                      *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 
00017 /* Subversion stuff
00018 
00019 $Id: kdbprivate.h.in 939 2006-10-23 15:57:37Z aviram $
00020 
00021 */
00022 
00023 #ifndef KDBPRIVATE_H
00024 #define KDBPRIVATE_H
00025 
00026 /* Elektra data directories */
00027 #define KDB_DB_SYSTEM            "/etc/kdb"
00028 #define KDB_DB_USER              ".kdb"   /* $HOME/.kdb */
00029 
00030 
00031 
00032 #define BUFFER_SIZE 100
00033 
00034 #ifdef UT_NAMESIZE
00035 #define USER_NAME_SIZE UT_NAMESIZE
00036 #else
00037 #define USER_NAME_SIZE 100
00038 #endif
00039 
00040 
00041 #ifndef DEFFILEMODE
00042 #define DEFFILEMODE 0666
00043 #endif
00044 
00045 
00046 
00047 #define UTF8_TO   1
00048 #define UTF8_FROM 0
00049 
00050 
00051 /* These define the type for pointers to all the kdb functions */
00052 typedef int      (*kdbOpenPtr)(KDBHandle *);
00053 typedef int      (*kdbClosePtr)(KDBHandle *);
00054 typedef int      (*kdbStatKeyPtr)(KDBHandle, Key *);
00055 typedef int      (*kdbGetKeyPtr)(KDBHandle, Key *);
00056 typedef int      (*kdbSetKeyPtr)(KDBHandle, Key *);
00057 typedef int      (*kdbRenamePtr)(KDBHandle, Key *, const char *);
00058 typedef int      (*kdbRemoveKeyPtr)(KDBHandle, const Key *);
00059 typedef int      (*kdbGetChildKeysPtr)(KDBHandle, const Key *, KeySet *,
00060                  unsigned long);
00061 
00062 typedef int      (*kdbSetKeysPtr)(KDBHandle, KeySet *);
00063 
00064 typedef uint32_t (*kdbMonitorKeyPtr)(KDBHandle, Key *, uint32_t,
00065                  unsigned long, unsigned);
00066 
00067 typedef uint32_t (*kdbMonitorKeysPtr)(KDBHandle, KeySet *, uint32_t,
00068                  unsigned long, unsigned);
00069 
00070 
00071 
00072 
00073 
00087 struct _Key {
00092     uint8_t       type;
00093 
00098     uid_t          uid;
00099 
00104     uid_t          gid;
00105 
00110     mode_t         access;
00111 
00116     time_t         atime;
00117 
00122     time_t         mtime;
00123 
00128     time_t         ctime;
00129 
00134     size_t         commentSize;
00135 
00140     size_t         dataSize;
00141     size_t         recordSize;  
00147     uint32_t      flags;
00148 
00153     char *         key;
00154 
00159     char *         comment;
00160 
00165     char *         userDomain;
00166 
00171     void *         data;        
00172     struct _Key *  next;        
00173 };
00174 
00175 
00186 #define KEY_METAINFO_SIZE(k) ((unsigned int)&(k->recordSize) - (unsigned int)k)
00187 
00188 
00189 
00203 struct _KeySet {
00204     struct _Key * start;   
00205     struct _Key * end;     
00206     struct _Key * cursor;  
00207     size_t        size;    
00208 };
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 #ifdef __cplusplus
00219 extern "C" {
00220 #endif
00221 
00222 
00223 
00224 ssize_t encode(void *unencoded, size_t size, char *returned);
00225 ssize_t unencode(char *encoded, void *returned);
00226 
00227 int kdbNeedsUTF8Conversion();
00228 int UTF8Engine(int direction, char **string, size_t *inputByteSize);
00229 
00230 
00231 
00232 
00233 #ifdef __cplusplus
00234 }
00235 #endif
00236 
00237 
00238 
00239 
00240 #endif /* KDBPRIVATE_H */

Generated on Fri Sep 14 06:44:58 2007 for Elektra Project by  doxygen 1.5.1