- Fixed conflicts in ascon.c
- Supressed superfluous message from fmess - Expanded multicounter to deal with threshold commands nicely - Fixed an an issue with an uninitialized dummy connection in nserver - Many changes to simidex to make it work in a more reliable way. - Added hdbfactory path alias targetpath - Extended frame to deal with sinqhttp HM
This commit is contained in:
102
sicshdbfactory.c
102
sicshdbfactory.c
@ -305,7 +305,6 @@ static hdbCallbackReturn CommandSetCallback(pHdb node, void *userData,
|
||||
}
|
||||
return hdbContinue;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static hdbCallbackReturn CommandGetCallback(pHdb node, void *userData,
|
||||
pHdbMessage message)
|
||||
@ -361,7 +360,106 @@ static int MakeCommandNode(pHdb parent, char *name, SConnection * pCon,
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static hdbCallbackReturn AliasSourceCallback(pHdb node, void *userData,
|
||||
pHdbMessage message)
|
||||
{
|
||||
SConnection *pCon = NULL;
|
||||
pHdb targetNode = NULL;
|
||||
pHdbDataMessage mm;
|
||||
|
||||
if((mm = GetHdbSetMessage(message)) != NULL){
|
||||
pCon = mm->callData;
|
||||
targetNode = FindHdbNode(NULL,(char *)userData, pCon);
|
||||
if(targetNode == NULL){
|
||||
if(pCon != NULL){
|
||||
SCPrintf(pCon,eError,"ERROR: link target %s not found, deleting link callbacks",
|
||||
(char *)userData);
|
||||
}
|
||||
return hdbKill;
|
||||
}
|
||||
SetHipadabaPar(targetNode,*mm->v,pCon);
|
||||
return hdbContinue;
|
||||
}
|
||||
|
||||
if((mm = GetHdbGetMessage(message)) != NULL){
|
||||
pCon = mm->callData;
|
||||
targetNode = FindHdbNode(NULL,(char *)userData, pCon);
|
||||
if(targetNode == NULL){
|
||||
if(pCon != NULL){
|
||||
SCPrintf(pCon,eError,"ERROR: link target %s not found, deleting link callbacks",
|
||||
(char *)userData);
|
||||
}
|
||||
return hdbKill;
|
||||
}
|
||||
GetHipadabaPar(targetNode,mm->v,pCon);
|
||||
copyHdbValue(mm->v,&node->value);
|
||||
return hdbContinue;
|
||||
}
|
||||
|
||||
return hdbContinue;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static hdbCallbackReturn AliasTargetCallback(pHdb node, void *userData,
|
||||
pHdbMessage message)
|
||||
{
|
||||
SConnection *pCon = NULL;
|
||||
pHdb targetNode = NULL;
|
||||
pHdbDataMessage mm;
|
||||
|
||||
if((mm = GetHdbUpdateMessage(message)) != NULL){
|
||||
pCon = mm->callData;
|
||||
targetNode = FindHdbNode(NULL,(char *)userData, pCon);
|
||||
if(targetNode == NULL){
|
||||
if(pCon != NULL){
|
||||
SCPrintf(pCon,eError,"ERROR: link source %s not found, deleting link callbacks",
|
||||
(char *)userData);
|
||||
}
|
||||
return hdbKill;
|
||||
}
|
||||
UpdateHipadabaPar(targetNode,*mm->v,pCon);
|
||||
return hdbContinue;
|
||||
}
|
||||
return hdbContinue;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int MakeAliasNode(pHdb parent, char *name, SConnection *pCon,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
hdbValue v;
|
||||
pHdb targetNode = NULL, child = NULL;
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: hdbfactory alias needs 4 arguments, not enough supplied",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
targetNode = FindHdbNode(NULL,argv[3], pCon);
|
||||
if(targetNode == NULL){
|
||||
SCPrintf(pCon,eError,"ERROR: alias target %s not found",
|
||||
argv[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
child = MakeHipadabaNode(name,targetNode->value.dataType,
|
||||
targetNode->value.arrayLength);
|
||||
if(child == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in hdbfactory alias", eError);
|
||||
return 0;
|
||||
}
|
||||
AppendHipadabaCallback(child,
|
||||
MakeHipadabaCallback(AliasSourceCallback,
|
||||
strdup(argv[3]),free));
|
||||
AddHipadabaChild(parent,child, pCon);
|
||||
|
||||
AppendHipadabaCallback(targetNode,
|
||||
MakeHipadabaCallback(AliasTargetCallback,
|
||||
strdup(argv[1]),free));
|
||||
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int HdbNodeFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
@ -390,6 +488,8 @@ int HdbNodeFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return MakeScriptNode(parent, name, pCon, argc, argv);
|
||||
} else if (strcmp(argv[2], "link") == 0) {
|
||||
return MakeLinkNode(parent, name, pCon, argc, argv);
|
||||
} else if (strcmp(argv[2], "alias") == 0) {
|
||||
return MakeAliasNode(parent, name, pCon, argc, argv);
|
||||
} else if (strcmp(argv[2], "command") == 0) {
|
||||
return MakeCommandNode(parent, name, pCon, argc, argv);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user