1 /***************************************************************************
2 kdb_wrapper.c - The server for the daemon backend
4 copyright : (C) 2006 by Yannick Lecaillez
5 email : sizon5@gmail.com
6 ***************************************************************************/
8 /***************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the BSD License (revised). *
13 ***************************************************************************/
31 #include <stdlib.h> /* malloc */
33 #ifdef HAVE_SYS_TYPES_H
34 #include <sys/types.h>
40 #include "kdbbackend.h"
46 Message *wrapper_kdbStatKey(KDB *handle, Message *request)
53 if ( messageExtractArgs(request,
60 ret = kdbStatKey(handle, &key);
63 reply = messageNew(MESSAGE_REPLY, KDB_BE_STATKEY,
64 DATATYPE_INTEGER, &ret,
65 DATATYPE_INTEGER, &error,
74 Message *wrapper_kdbGetKey(KDB *handle, Message *request)
83 if ( messageExtractArgs(request,
90 ret = kdbGetKey(handle, &key);
93 reply = messageNew(MESSAGE_REPLY, KDB_BE_GETKEY,
94 DATATYPE_INTEGER, &ret,
95 DATATYPE_INTEGER, &error,
104 Message *wrapper_kdbSetKey(KDB *handle, void *request)
113 if ( messageExtractArgs(request,
120 ret = kdbSetKey(handle, &key);
123 reply = messageNew(MESSAGE_REPLY, KDB_BE_SETKEY,
124 DATATYPE_INTEGER, &ret,
125 DATATYPE_INTEGER, &error,
134 Message *wrapper_kdbSetKeys(KDB *handle, void *request)
140 if ( (ks = ksNew()) == NULL )
143 if ( messageExtractArgs(request,
150 ret = kdbSetKeys(handle, ks);
152 reply = messageNew(MESSAGE_REPLY, KDB_BE_SETKEYS,
153 DATATYPE_INTEGER, &ret,
154 DATATYPE_INTEGER, &error,
163 Message *wrapper_kdbGetChild(KDB *handle, Message *request)
168 unsigned long options;
173 if ( messageExtractArgs(request,
174 DATATYPE_KEY, &parentKey,
175 DATATYPE_ULONG, &options,
177 keyClose(&parentKey);
182 ret = kdbGetKeyChildKeys(handle, &parentKey, ks, options);
184 keyClose(&parentKey);
186 reply = messageNew(MESSAGE_REPLY, KDB_BE_GETCHILD,
187 DATATYPE_INTEGER, &ret,
188 DATATYPE_INTEGER, &error,