00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KDBPRIVATE_H
00024 #define KDBPRIVATE_H
00025
00026
00027 #define KDB_DB_SYSTEM "/etc/kdb"
00028 #define KDB_DB_USER ".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
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