- removed functions with void *data in the interface

- added GetHdbProp
This commit is contained in:
zolliker
2008-05-14 14:20:35 +00:00
parent cc55389e71
commit f996d69612
2 changed files with 118 additions and 270 deletions

View File

@ -20,6 +20,7 @@ static char get[] = {"get"};
static char update[] = {"update"}; static char update[] = {"update"};
static char treeChange[] = {"treeChange"}; static char treeChange[] = {"treeChange"};
static char dataSearch[] = {"dataSearch"}; static char dataSearch[] = {"dataSearch"};
static char killNode[] = {"killNode"};
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
pHdbDataMessage GetHdbSetMessage(pHdbMessage toTest){ pHdbDataMessage GetHdbSetMessage(pHdbMessage toTest){
if(toTest->type == set){ if(toTest->type == set){
@ -55,6 +56,13 @@ pHdbDataSearch GetHdbDataSearchMessage(pHdbMessage toTest){
} }
return NULL; return NULL;
} }
/*-------------------------------------------------------------------------*/
pHdbMessage GetHdbKillNodeMessage(pHdbMessage toTest){
if(toTest->type == killNode){
return toTest;
}
return NULL;
}
/*================== internal functions ===================================*/ /*================== internal functions ===================================*/
void DeleteCallbackChain(pHdbCallback root){ void DeleteCallbackChain(pHdbCallback root){
pHdbCallback current = NULL, thisEntry; pHdbCallback current = NULL, thisEntry;
@ -106,26 +114,18 @@ void DeleteNodeData(pHdb node){
free(node); free(node);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
static pHdbCallback CleanCallbackChain(pHdbCallback chain){ static pHdbCallback CleanCallbackChain(pHdbCallback head){
pHdbCallback head = chain; pHdbCallback current = head;
pHdbCallback current = chain;
pHdbCallback next; pHdbCallback next;
pHdbCallback *ptr2last = &head;
while(current != NULL){ while(current != NULL){
if(current->killFlag == 1){ if(current->killFlag == 1){
next = current->next; next = current->next;
if(current == head){
head = next;
}
/* /*
* unlink * unlink
*/ */
if(next != NULL){ *ptr2last = next;
next->previous = current->previous;
}
if(current->previous != NULL){
current->previous->next = next;
}
/* /*
* delete * delete
*/ */
@ -138,6 +138,7 @@ static pHdbCallback CleanCallbackChain(pHdbCallback chain){
*/ */
current = next; current = next;
} else { } else {
ptr2last = &current->next;
current = current->next; current = current->next;
} }
} }
@ -209,19 +210,6 @@ int CountHdbChildren(pHdb node){
} }
return count; return count;
} }
/*-----------------------------------------------------------------------*/
static void RemoveCallbackNode(pHdbCallback victim){
if(victim->previous != NULL) {
victim->previous->next = victim->next;
}
if(victim->next != NULL){
victim->next->previous = victim->previous;
}
if(victim->killFunc != NULL){
victim->killFunc(victim->userData);
}
free(victim);
}
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
char *hdbTrim(char *str) char *hdbTrim(char *str)
{ {
@ -297,6 +285,7 @@ hdbValue makeHdbValue(int datatype, int length){
memset(&val,0,sizeof(hdbValue)); memset(&val,0,sizeof(hdbValue));
val.dataType = datatype; val.dataType = datatype;
val.doNotFree = 0;
switch(datatype){ switch(datatype){
case HIPINTAR: case HIPINTAR:
@ -322,63 +311,6 @@ hdbValue makeHdbValue(int datatype, int length){
} }
return val; return val;
} }
/*------------------------------------------------------------------------*/
hdbValue makeHdbData(int datatype, int length, void *data){
hdbValue val;
memset(&val,0,sizeof(hdbValue));
val.dataType = datatype;
switch(datatype){
case HIPINT:
if(data != NULL){
memcpy(&val.v.intValue,data,sizeof(int));
}
break;
case HIPFLOAT:
if(data != NULL){
memcpy(&val.v.doubleValue,data,sizeof(double));
}
break;
case HIPINTAR:
case HIPINTVARAR:
val.arrayLength = length;
val.v.intArray = malloc(length*sizeof(int));
if(val.v.intArray != NULL){
memset(val.v.intArray,0,length*sizeof(int));
}
if(data != NULL){
memcpy(val.v.intArray,data,length*sizeof(int));
}
break;
case HIPFLOATAR:
case HIPFLOATVARAR:
val.arrayLength = length;
val.v.floatArray = malloc(length*sizeof(double));
if(val.v.floatArray != NULL){
memset(val.v.floatArray,0,length*sizeof(double));
}
if(data != NULL){
memcpy(val.v.floatArray,data,length*sizeof(double));
}
break;
case HIPTEXT:
if(data != NULL){
val.v.text = strdup((char *)data);
} else {
val.v.text = strdup("UNKNOWN");
}
val.arrayLength = strlen(val.v.text);
break;
case HIPOBJ:
val.v.obj = data;
break;
case HIPFUNC:
val.v.obj = data;
break;
}
return val;
}
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
hdbValue MakeHdbInt(int initValue){ hdbValue MakeHdbInt(int initValue){
hdbValue result; hdbValue result;
@ -402,7 +334,7 @@ hdbValue MakeHdbText(char *initText){
hdbValue result; hdbValue result;
result.dataType = HIPTEXT; result.dataType = HIPTEXT;
result.v.text = strdup(initText); result.v.text = initText; /* no strdup here ! */
result.arrayLength = strlen(initText); result.arrayLength = strlen(initText);
return result; return result;
} }
@ -425,6 +357,22 @@ hdbValue MakeHdbFloatArray(int length, double *data){
return result; return result;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
hdbValue MakeHdbFunc(voidFunc *func){
hdbValue result;
result.dataType = HIPFUNC;
result.v.func = func;
return result;
}
/*-------------------------------------------------------------------------*/
hdbValue MakeHdbObj(void *obj){
hdbValue result;
result.dataType = HIPOBJ;
result.v.obj = obj;
return result;
}
/*-------------------------------------------------------------------------*/
void ReleaseHdbValue(hdbValue *v){ void ReleaseHdbValue(hdbValue *v){
if(v->doNotFree == 1){ if(v->doNotFree == 1){
@ -516,13 +464,19 @@ int compareHdbValue(hdbValue v1, hdbValue v2){
return 1; return 1;
break; break;
case HIPOBJ: case HIPOBJ:
case HIPFUNC:
if(v2.v.obj == v1.v.obj) { if(v2.v.obj == v1.v.obj) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
break; break;
case HIPFUNC:
if(v2.v.func == v1.v.func) {
return 1;
} else {
return 0;
}
break;
default: default:
assert(0); assert(0);
break; break;
@ -561,9 +515,11 @@ int getHdbValueLength(hdbValue v){
length = strlen(v.v.text); length = strlen(v.v.text);
break; break;
case HIPOBJ: case HIPOBJ:
case HIPFUNC:
length = sizeof(void *); length = sizeof(void *);
break; break;
case HIPFUNC:
length = sizeof(voidFunc *);
break;
} }
return length; return length;
} }
@ -639,11 +595,15 @@ void AddHipadabaChild(pHdb parent, pHdb child, void *callData){
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
void DeleteHipadabaNode(pHdb node, void *callData){ void DeleteHipadabaNode(pHdb node, void *callData){
pHdb current = NULL, tmp = NULL; pHdb current = NULL, tmp = NULL;
hdbMessage killNodeMsg;
if(node == NULL){ if(node == NULL){
return; return;
} }
killNodeMsg.type = killNode;
InvokeCallbackChain(node, &killNodeMsg);
RemoveHdbNodeFromParent(node, callData); RemoveHdbNodeFromParent(node, callData);
DeleteNodeData(node); DeleteNodeData(node);
@ -765,35 +725,28 @@ void AppendHipadabaCallback(pHdb node, pHdbCallback newCB){
assert(node); assert(node);
current = node->callBackChain; current = node->callBackChain;
newCB->next = NULL;
if(current == NULL){ if(current == NULL){
node->callBackChain = newCB; node->callBackChain = newCB;
return; return;
} }
if(current != NULL){ while(current->next != NULL){
while(current->next != NULL){ current = (pHdbCallback)current->next;
current = (pHdbCallback)current->next;
}
current->next= newCB;
newCB->previous = current;
} }
current->next = newCB;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void PrependHipadabaCallback(pHdb node,pHdbCallback newCB){ void PrependHipadabaCallback(pHdb node,pHdbCallback newCB){
assert(node != NULL); assert(node != NULL);
newCB->next = node->callBackChain; newCB->next = node->callBackChain;
if(node->callBackChain != NULL){
node->callBackChain->previous = newCB;
}
node->callBackChain = newCB; node->callBackChain = newCB;
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void *FindHdbCallbackData(pHdb node, hdbCallbackFunction func, void *FindHdbCallbackData(pHdb node, void *userPtr){
void *userPtr){
hdbDataSearch dsm; hdbDataSearch dsm;
dsm.type = dataSearch; dsm.type = dataSearch;
dsm.testFunc = func;
dsm.testPtr = userPtr; dsm.testPtr = userPtr;
dsm.result = NULL; dsm.result = NULL;
@ -887,9 +840,11 @@ int copyHdbValue(hdbValue *source, hdbValue *target){
} }
break; break;
case HIPOBJ: case HIPOBJ:
case HIPFUNC:
target->v.obj = source->v.obj; target->v.obj = source->v.obj;
break; break;
case HIPFUNC:
target->v.func = source->v.func;
break;
default: default:
/* /*
* unknown data type * unknown data type
@ -903,21 +858,16 @@ int copyHdbValue(hdbValue *source, hdbValue *target){
static int SendDataMessage(pHdb node, char *type, static int SendDataMessage(pHdb node, char *type,
hdbValue v, void *callData){ hdbValue v, void *callData){
hdbDataMessage dataMes; hdbDataMessage dataMes;
if(strstr(type,"set") != NULL){ assert(type == set || type == get || type == update);
dataMes.type = set; dataMes.type = type;
} else if(strstr(type,"get") != NULL){
dataMes.type = get;
} else if(strstr(type,"update") != NULL){
dataMes.type = update;
}
dataMes.v = &v; dataMes.v = &v;
dataMes.callData = callData; dataMes.callData = callData;
return InvokeCallbackChain(node, (pHdbMessage)&dataMes); return InvokeCallbackChain(node, (pHdbMessage)&dataMes);
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
int SetHipadabaPar(pHdb node, hdbValue v, void *callData){ int SetHipadabaPar(pHdb node, hdbValue v, void *callData){
return SendDataMessage(node, set, v,callData); return SendDataMessage(node, set, v,callData);
} }
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
int UpdateHipadabaPar(pHdb node, hdbValue v, void *callData){ int UpdateHipadabaPar(pHdb node, hdbValue v, void *callData){
@ -939,6 +889,7 @@ int GetHipadabaPar(pHdb node, hdbValue *v, void *callData){
int status; int status;
v->dataType = node->value.dataType; v->dataType = node->value.dataType;
v->doNotFree = 0;
v->v.text = NULL; /* this sets all pointers in the union to NULL */ v->v.text = NULL; /* this sets all pointers in the union to NULL */
status = SendDataMessage(node, get, *v,callData); status = SendDataMessage(node, get, *v,callData);
@ -960,103 +911,6 @@ static int calcDataLength(pHdb node, int testLength){
} }
return length; return length;
} }
/*--------------------------------------------------------------------------*/
int SetHdbPar(pHdb node, int dataType, void *data, int length,
void *callData){
int status;
hdbValue v;
if(node->value.dataType == HIPNONE){
return 1;
}
if(dataType != node->value.dataType){
return HDBTYPEMISMATCH;
}
if(length != calcDataLength(node,length)){
return HDBLENGTHMISMATCH;
}
v = makeHdbData(dataType, length, data);
status = SetHipadabaPar(node, v, callData);
ReleaseHdbValue(&v);
return status;
}
/*--------------------------------------------------------------------------*/
int UpdateHdbPar(pHdb node, int dataType, void *data, int length,
void *callData){
int status;
hdbValue v;
if(node->value.dataType == HIPNONE){
return 1;
}
if(dataType != node->value.dataType){
return HDBTYPEMISMATCH;
}
if(length != calcDataLength(node,length)){
return HDBLENGTHMISMATCH;
}
v = makeHdbData(dataType,length,data);
status = UpdateHipadabaPar(node,v,callData);
ReleaseHdbValue(&v);
return status;
}
/*-----------------------------------------------------------------------------*/
int GetHdbPar(pHdb node, int dataType, void *data, int length,
void *callData){
int status, toCopy;
hdbValue v;
if(dataType != node->value.dataType){
return HDBTYPEMISMATCH;
}
if(length != calcDataLength(node,length)){
return HDBLENGTHMISMATCH;
}
status = GetHipadabaPar(node, &v, callData);
if(status != 1 ){
return status;
}
switch(dataType){
case HIPNONE:
break;
case HIPINT:
memcpy(data,&node->value.v.intValue,sizeof(int));
break;
case HIPFLOAT:
memcpy(data,&node->value.v.doubleValue,sizeof(double));
break;
case HIPINTAR:
case HIPINTVARAR:
memcpy(data,node->value.v.intArray,
node->value.arrayLength*sizeof(int));
break;
case HIPTEXT:
toCopy = strlen(node->value.v.text);
if(toCopy > length){
toCopy = length;
}
memcpy(data,&node->value.v.text, toCopy);
break;
case HIPFLOATAR:
case HIPFLOATVARAR:
memcpy(data,node->value.v.floatArray,
node->value.arrayLength*sizeof(double));
break;
case HIPOBJ:
memcpy(data,&node->value.v.obj,sizeof(void *));
break;
default:
assert(0);
break;
}
return 1;
}
/*============================= Property Functions ==========================*/ /*============================= Property Functions ==========================*/
void SetHdbProperty(pHdb node, char *key, char *value){ void SetHdbProperty(pHdb node, char *key, char *value){
if(node != NULL && key != NULL && node->properties != NULL){ if(node != NULL && key != NULL && node->properties != NULL){
@ -1076,6 +930,14 @@ int GetHdbProperty(pHdb node, char *key, char *value, int len){
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
char *GetHdbProp(pHdb node, char *key){
if(node != NULL && node->properties != NULL){
return StringDictGetShort(node->properties,key);
} else {
return NULL;
}
}
/*---------------------------------------------------------------------------*/
void InitHdbPropertySearch(pHdb node){ void InitHdbPropertySearch(pHdb node){
if(node != NULL && node->properties != NULL){ if(node != NULL && node->properties != NULL){
StringDictKillScan(node->properties); StringDictKillScan(node->properties);

View File

@ -1,4 +1,4 @@
/** /** @file
* Hipadaba is a hierarchical database of parameters. Parameters can be of * Hipadaba is a hierarchical database of parameters. Parameters can be of
* various types. What happens when a parameter is being set, updated or read * various types. What happens when a parameter is being set, updated or read
* is largely determined through callbacks which can be registered on * is largely determined through callbacks which can be registered on
@ -46,16 +46,19 @@
#define HDBTYPEMISMATCH -7701 #define HDBTYPEMISMATCH -7701
#define HDBLENGTHMISMATCH -7702 #define HDBLENGTHMISMATCH -7702
/*===================== structure definitions ===================================*/ /*===================== structure definitions ===================================*/
typedef void voidFunc(void);
typedef struct __hdbValue { typedef struct __hdbValue {
int dataType; int dataType;
int arrayLength; int arrayLength;
int doNotFree; int doNotFree;
union __value { union __value {
int intValue; int intValue;
double doubleValue; double doubleValue;
char *text; char *text;
int *intArray; int *intArray;
double *floatArray; double *floatArray;
voidFunc *func;
void *obj; void *obj;
}v; }v;
}hdbValue; }hdbValue;
@ -90,7 +93,13 @@ typedef struct {
char *type; char *type;
void *callData; void *callData;
}hdbTreeChangeMessage, *pHdbTreeChangeMessage; }hdbTreeChangeMessage, *pHdbTreeChangeMessage;
/*-------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------*/
typedef struct {
char *type;
void *testPtr;
void *result;
}hdbDataSearch, *pHdbDataSearch;
/*-------------------------------------------------------------------------------*/
typedef hdbCallbackReturn (*hdbCallbackFunction)(pHdb currentNode, typedef hdbCallbackReturn (*hdbCallbackFunction)(pHdb currentNode,
void *userData, void *userData,
pHdbMessage message); pHdbMessage message);
@ -105,13 +114,6 @@ typedef struct __hdbcallback {
struct __hdbcallback *next; struct __hdbcallback *next;
struct __hdbcallback *previous; struct __hdbcallback *previous;
}hdbCallback, *pHdbCallback; }hdbCallback, *pHdbCallback;
/*--------------- another message: must be here for seqeunce --------------------*/
typedef struct {
char *type;
hdbCallbackFunction testFunc;
void *testPtr;
void *result;
}hdbDataSearch, *pHdbDataSearch;
/*============= Message Test Functions ==========================================*/ /*============= Message Test Functions ==========================================*/
/** /**
* Test a message if it is a set message * Test a message if it is a set message
@ -146,17 +148,22 @@ pHdbTreeChangeMessage GetHdbTreeChangeMessage(pHdbMessage toTest);
* pointer if it is. * pointer if it is.
*/ */
pHdbDataSearch GetHdbDataSearchMessage(pHdbMessage toTest); pHdbDataSearch GetHdbDataSearchMessage(pHdbMessage toTest);
/*======================== Function protoypes: hdbData ========================*/
hdbValue makeHdbValue(int datatype, int length);
/** /**
* make a hdbValue and initailize it with the data in the void * Test a message if it is a kill node message
* pointer. Do not initialise when data = NULL. * @param toTest The message to test.
* @param dataType The datatype of the hdbValue * @return NULL if the message is no kill node message or a message
* @param The array length of the hdbValue * pointer if it is.
* @param data Initialisation data for hdbValue */
pHdbMessage GetHdbKillNodeMessage(pHdbMessage toTest);
/*======================== Function protoypes: hdbData ========================*/
/**
* make a hdbValue with the given datatype and length
* Do not initialise
* @param datatype The datatype of the hdbValue
* @param length The array length of the hdbValue
* @return a suitably defined hdbValue * @return a suitably defined hdbValue
*/ */
hdbValue makeHdbData(int datatype, int length, void *data); hdbValue makeHdbValue(int datatype, int length);
/** /**
* wrap an integer as an hdbValue * wrap an integer as an hdbValue
* @param initValue the initial value of the int * @param initValue the initial value of the int
@ -198,6 +205,18 @@ hdbValue MakeHdbIntArray(int length, int *data);
* @return: A properly initialized hdbValue structure * @return: A properly initialized hdbValue structure
*/ */
hdbValue MakeHdbFloatArray(int length, double *data); hdbValue MakeHdbFloatArray(int length, double *data);
/**
* wrap a function as an hdbValue
* @param func the function
* @return: A properly initialized hdbValue structure
*/
hdbValue MakeHdbFunc(voidFunc *func);
/**
* wrap an object as an hdbValue
* @param obj the object
* @return: A properly initialized hdbValue structure
*/
hdbValue MakeHdbObj(void *obj);
/** /**
* release any dynamic memory associated with v * release any dynamic memory associated with v
* @param v The hdbValue to check for dynamic memory allocation to be * @param v The hdbValue to check for dynamic memory allocation to be
@ -238,6 +257,7 @@ int getHdbValueLength(hdbValue v);
* make a new hipadaba node * make a new hipadaba node
* @param name The name of the new node * @param name The name of the new node
* @param datatype The datatype of the new node * @param datatype The datatype of the new node
* @param length the array length
* @return a new node or NULL when out of memory * @return a new node or NULL when out of memory
*/ */
pHdb MakeHipadabaNode(char *name, int datatype, int length); pHdb MakeHipadabaNode(char *name, int datatype, int length);
@ -256,7 +276,7 @@ void DeleteNodeData(pHdb node);
/** /**
* delete a hipadaba node and all its children. Then invoke the tree * delete a hipadaba node and all its children. Then invoke the tree
* change callback to notify listeners. * change callback to notify listeners.
* @parma node The node to delete * @param node The node to delete
* @param callData User data for the tree change callback * @param callData User data for the tree change callback
*/ */
void DeleteHipadabaNode(pHdb node, void *callData); void DeleteHipadabaNode(pHdb node, void *callData);
@ -282,7 +302,7 @@ pHdb GetHipadabaNode(pHdb root, char *path);
char *GetHipadabaPath(pHdb node); char *GetHipadabaPath(pHdb node);
/** /**
* removes a node from the parents child list. * removes a node from the parents child list.
* @node the node to remove * @param node the node to remove
* @param callData User data for the tree change callback * @param callData User data for the tree change callback
*/ */
void RemoveHdbNodeFromParent(pHdb node, void *callData); void RemoveHdbNodeFromParent(pHdb node, void *callData);
@ -307,33 +327,27 @@ pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func,
/** /**
* add a callback at the end of the callback chain * add a callback at the end of the callback chain
* @param node The node to which to append the callback * @param node The node to which to append the callback
* @param type the type of the callback to append
* @param newCB The callback to append * @param newCB The callback to append
*/ */
void AppendHipadabaCallback(pHdb node,pHdbCallback newCB); void AppendHipadabaCallback(pHdb node,pHdbCallback newCB);
/** /**
* add a callback at the head of the callback chain * add a callback at the head of the callback chain
* @param node The node to which to append the callback * @param node The node to which to append the callback
* @param type the type of the callback to append
* @param newCB The callback prepend * @param newCB The callback prepend
*/ */
void PrependHipadabaCallback(pHdb node,pHdbCallback newCB); void PrependHipadabaCallback(pHdb node,pHdbCallback newCB);
/** /**
* find the callback data * find the callback data
* @param node the node from where callbacks have to be searched * @param node the node from where callbacks have to be searched
* @param func the function registered with the searched callback * @param userPtr A pointer to some user data which the callback
* @param userPtr A pointer to some user data whih the callback
* uses to determine if it is the right one. * uses to determine if it is the right one.
* @return the found callback user data or NULL on failure * @return the found callback user data or NULL on failure
*/ */
void *FindHdbCallbackData(pHdb node,hdbCallbackFunction func, void *FindHdbCallbackData(pHdb node, void *userPtr);
void *userPtr);
/** /**
* invoke a callback chain. * invoke a callback chain.
* @param root The callback chain to invoke * @param node The node reponsible for this callback chain
* @param node The node reposnible for this callback chain * @param message the message to send
* @param callData Some data belonging to the callback
* @param v The new value for this callback
* @return 1 on success, 0 on failure * @return 1 on success, 0 on failure
*/ */
int InvokeCallbackChain(pHdb node, pHdbMessage message); int InvokeCallbackChain(pHdb node, pHdbMessage message);
@ -384,42 +398,6 @@ int NotifyHipadabaPar(pHdb node,void *callData);
* @return 0 on failure, 1 on success * @return 0 on failure, 1 on success
*/ */
int GetHipadabaPar(pHdb node, hdbValue *v, void *callData); int GetHipadabaPar(pHdb node, hdbValue *v, void *callData);
/**
* Set a hipadaba parameter. This is an external set for a parameter. It may cause
* motors to start driving etc.
* @param node The node for which to set the parameter
* param dataType The datatype the value ought to have
* @param data A pointer to the data to set.
* @param length The length of data
* @param callData Additonal context data to be passed to the callback functions
* @return 0 on failure, a negative error code on failure
*/
int SetHdbPar(pHdb node, int dataType, void *data, int length,
void *callData);
/**
* Updates a hipadaba parameter. This does not cause an active parameter to
* start driving but invokes all notifications which may be registered on
* this parameter.
* @param node The node for which to set the parameter
* param dataType The datatype the value ought to have
* @param data A pointer to the data to set.
* @param length The length of data
* @param callData Additonal context data to be passed to the callback functions
* @return 0 on failure, a negative error code on failure
*/
int UpdateHdbPar(pHdb node, int dataType, void *data, int length,
void *callData);
/**
* Read a hipadaba parameter
* @param node The node for which to read the parameter
* @param dataType The expected type of the data
* @param data A pointer to which data will be copied
* @param length The length of data.
* @param callData Additonal context data to be passed to the callback functions
* @return 0 on failure, a negative error code on failures.
*/
int GetHdbPar(pHdb node, int dataType, void *data, int length,
void *callData);
/*================================ Property Interface ==============================================*/ /*================================ Property Interface ==============================================*/
/** /**
* set a property * set a property
@ -437,6 +415,14 @@ int GetHdbPar(pHdb node, int dataType, void *data, int length,
* @return 0 on failure, 1 on success * @return 0 on failure, 1 on success
*/ */
int GetHdbProperty(pHdb node, char *key, char *value, int len); int GetHdbProperty(pHdb node, char *key, char *value, int len);
/**
* get the value of a property
* @param node The node to get the property from
* @param key The properties key
* @return the property or NULL on failure. Warning: the string is
* only valid as long as the property has not changed
*/
char *GetHdbProp(pHdb node, char *key);
/** /**
* initialize a property scan on this node * initialize a property scan on this node
* @param node The node for which to scan properties * @param node The node for which to scan properties