Functions | |
| void * | kdbhSetBackendData (KDB *handle, void *data) |
| void * | kdbhGetBackendData (const KDB *handle) |
| KDBCap * | kdbhSetCapability (KDB *handle, KDBCap *cap) |
| KDBCap * | kdbhGetCapability (const KDB *handle) |
| Trie * | kdbhGetTrie (const KDB *handle) |
| void | kdbhSetTrie (KDB *handle, Trie *trie) |
| const Key * | kdbhGetMountpoint (KDB *handle) |
| void | kdbhSetMountpoint (KDB *handle, const Key *mountpoint) |
| KeySet * | kdbhGetConfig (KDB *handle) |
To use them:
#include <kdb.h>
These functions provide access to the information stored in Backend Handles.
| void* kdbhGetBackendData | ( | const KDB * | handle | ) |
Get the previously set backend-specific data from the handle.
This is useful when your backend have a backend-global context or environment.
This method will probably be called everytime one of your kdb*() implementations is called. And if you change something inside the data, you don't have to kdbhSetBackendData() again, bacause you are manipulating your data, and not a copy of it.
struct MyBackendData { int context1; int context2; }; int kdbOpen_mybackend(KDB *handle) { struct MyBackendData *context; context=malloc(sizeof(struct MyBackendData)); // a random initialization... context->context1=1; context->context2=2; kdbhSetBackendData(*handle,context); return 0; } int kdbGetKey_maybackend(KDB handle) { struct MyBackendData *context; context=kdbhGetBackendData(handle); // No do something with the context . . . return 0; }
int kdbClose_mybackend(KDB &handle) { struct MyBackendData *context; context=kdbhGetBackendData(handle); free(context); return 0; }
| handle | contains internal information of opened key database |
| KDBCap* kdbhGetCapability | ( | const KDB * | handle | ) |
Gets capability for handle.
| handle | contains internal information of opened key database |
handle. | KeySet* kdbhGetConfig | ( | KDB * | handle | ) |
Returns configuration for handle.
Every backend may have its own configuration using a Keyset.
| handle | contains internal information of opened key database |
| const Key* kdbhGetMountpoint | ( | KDB * | handle | ) |
Gets mountpoint for handle.
Every mounted backend has a specific mountpoint where it is mounted. You may need to know where you were mounted inside a backend to calculate relative pathes.
The keyName() is where the backend is mounted, keyString() gives the name of which backend is mounted.
| handle | contains internal information of opened key database |
| Trie* kdbhGetTrie | ( | const KDB * | handle | ) |
Gets trie for handle.
The trie is a datastructure containing the mounted backends.
| handle | contains internal information of opened key database |
handle. | void* kdbhSetBackendData | ( | KDB * | handle, | |
| void * | data | |||
| ) |
Set some backend-specific data in the handle.
This is useful when your backend have a backend-global context or environment.
| handle | contains internal information of opened key database | |
| data | a pointer to general data specific to a backend implementation. |
| KDBCap* kdbhSetCapability | ( | KDB * | handle, | |
| KDBCap * | cap | |||
| ) |
Sets capabilty for handle.
| cap | a pointer to capability structure | |
| handle | contains internal information of opened key database |
handle. | void kdbhSetMountpoint | ( | KDB * | handle, | |
| const Key * | mountpoint | |||
| ) |
Sets mountpoint for handle.
You must not change the mountpoint inside your backend, it was set correctly already for you.
| handle | contains internal information of opened key database | |
| mountpoint | the key containing as name where backend is mounted and as value the backendname |
| void kdbhSetTrie | ( | KDB * | handle, | |
| Trie * | trie | |||
| ) |
Sets trie for handle.
The trie is a datastructure containing the mounted backends. This must not done inside backends, it was set correctly already for you.
| handle | contains internal information of opened key database | |
| trie | the datastructure referencing to the other handles of backends |
1.5.6