- Added asynchronous IO code from ANSTO

- Added new ACT protocol
- Extended sicshdbadapter to cover counters and status to put the status
 into Hipadaba
- Fixes to napi5.c
- Exe now supports hdbrun which allows to write output for a buffer into
 hdb node.
This commit is contained in:
koennecke
2007-06-22 11:44:46 +00:00
parent d5ff6410bc
commit 08c5e037a0
24 changed files with 13224 additions and 1291 deletions

121
conman.c
View File

@ -745,6 +745,94 @@ static void writeToLogFiles(SConnection *self, char *buffer)
}
return 1;
}
/*--------------------------------------------------------------------------*/
int SCACTWrite(SConnection *self, char *buffer, int iOut)
{
int i, iPtr, iRet;
char pBueffel[1024];
char *pPtr = pBueffel;
commandContext cx;
if(!VerifyConnection(self))
{
return 0;
}
if (buffer[0] == '\0' && iOut >= eStart && iOut <= eEvent) {
return 1; /* do not write empty line */
}
/* log it for any case */
if(self->pSock)
{
iRet = self->pSock->sockid;
}
else
{
iRet = 0;
}
sprintf(pBueffel,"Next line intended for socket: %d",iRet);
SICSLogWrite(pBueffel,eInternal);
SICSLogWrite(buffer,iOut);
/* write to commandlog if user or manager privilege */
if(SCGetRights(self) <= usUser)
{
if(self->iMacro != 1)
{
sprintf(pBueffel,"To sock %d :",iRet);
sendingConnection = self;
WriteToCommandLog(pBueffel,buffer);
sendingConnection = NULL;
}
else
{
if(iOut == eError || iOut == eWarning)
{
sprintf(pBueffel,"To sock %d :",iRet);
sendingConnection = self;
WriteToCommandLog(pBueffel,buffer);
sendingConnection = NULL;
}
}
}
/*
* copy in ACT
*/
if(strlen(buffer) + 30 > 1024){
pPtr = (char *)malloc((strlen(buffer)+30)*sizeof(char));
memset(pPtr,0,strlen(buffer)+20);
}
cx = SCGetContext(self);
sprintf(pPtr,"%d::>%s<::", cx.transID, buffer);
/* put it into the interpreter if present */
if(SCinMacro(self))
{
InterpWrite(pServ->pSics,buffer);
/* print it to client if error message */
if((iOut== eError) || (iOut == eWarning) )
{
iRet = doSockWrite(self,pPtr);
}
}
else /* not in interpreter, normal logic */
{
/* is this really to be printed ? */
if(iOut < self->iOutput)
return 0;
/* first the socket */
iRet = doSockWrite(self,pPtr);
writeToLogFiles(self,buffer);
}
if(pPtr != pBueffel){
free(pPtr);
}
return 1;
}
/*--------------------------------------------------------------------------*/
int SCWriteWithOutcode(SConnection *self, char *buffer, int iOut)
{
@ -964,13 +1052,34 @@ pDynString SCEndBuffering(SConnection *pCon)
/* put into Serverlog */
sprintf(pBueffel,"Next line intended for socket: %d",-10);
SICSLogWrite(pBueffel,eInternal);
SICSLogWrite(buffer,iOut);
/* log it for any case */
if(self->pSock)
{
iRet = self->pSock->sockid;
}
else
{
iRet = -10;
}
/* write to commandlog if user or manager privilege */
if(SCGetRights(self) <= usUser && self->iMacro != 1)
if(SCGetRights(self) <= usUser)
{
sprintf(pBueffel,"To sock %d :",-10);
WriteToCommandLog(pBueffel,buffer);
if(self->iMacro != 1)
{
sprintf(pBueffel,"To sock %d :",iRet);
WriteToCommandLog(pBueffel,buffer);
}
else
{
if(iOut == eError || iOut == eWarning)
{
sprintf(pBueffel,"To sock %d :",iRet);
WriteToCommandLog(pBueffel,buffer);
}
}
}
/* put it into the interpreter if present */
@ -1494,7 +1603,7 @@ pDynString SCEndBuffering(SConnection *pCon)
config OutCode val sets an new output code
config Rights User Password sets and verifies new user rights
config File Filename Logs to another file
config output normal | withcode Sets output mode
config output normal | withcode | ACT Sets output mode
config listen 0 | 1 enables commandlog listen mode
---------------------------------------------------------------------------*/
@ -1633,6 +1742,10 @@ pDynString SCEndBuffering(SConnection *pCon)
{
SCSetWriteFunc(pCon,SCWriteWithOutcode);
}
else if(strcmp(argv[2],"act") == 0)
{
SCSetWriteFunc(pCon,SCACTWrite);
}
else
{
SCWrite(pCon,"ERROT: output mode not recognised",eError);